You are here

function webfm_check_attach_order in Web File Manager 5.2

Same name and namespace in other branches
  1. 5 webfm.module \webfm_check_attach_order()

webfm_check_attach_order - checks to see if the new order of the fids is the same as the old order stored in the database

Parameters

int $nid - node id:

array $fids - array of file ids:

Return value

bool - TRUE if the attach order is the same - FALSE if it has changed

1 call to webfm_check_attach_order()
webfm_dbupdate_attach in ./webfm.module
webfm_dbupdate_attach - updates the files in the webfm_attach table IF the order

File

./webfm.module, line 2179

Code

function webfm_check_attach_order($nid, $fids) {

  //check array against db result
  $query = "SELECT fid FROM {webfm_attach} WHERE nid = %d ORDER BY weight";
  $result = db_query($query, $nid);
  $match = TRUE;
  $i = 0;
  while ($dbfid = db_fetch_array($result)) {
    if ($dbfid['fid'] != $fids[$i]) {
      $match = FALSE;
      break;
    }
    $i++;
  }
  if ($i < count($fids)) {
    $match = FALSE;
  }
  return $match;
}