public function computeSample()
 {
     // Initialize the projects array.
     $this->projectIssueMetricInitProjects(array('new_issues' => 0, 'new_comments' => 0, 'new_total' => 0));
     // Load options.
     $sample = $this->currentSample;
     $where_pieces = array();
     $args = array();
     $args = array_merge($args, array($sample->sample_startstamp, $sample->sample_endstamp));
     // Restrict to only the passed projects.
     if (!empty($sample->options['object_ids'])) {
         $where_pieces[] = "pi.pid IN (" . db_placeholders($sample->options['object_ids']) . ")";
         $args = array_merge($args, $sample->options['object_ids']);
     }
     if (empty($where_pieces)) {
         $where = '';
     } else {
         $where = ' AND ' . implode(' AND ', $where_pieces);
     }
     // Pull the count of new issues per project.
     $projects = db_query("SELECT pi.pid, COUNT(pi.nid) AS count FROM {project_issues} pi INNER JOIN {node} n ON pi.nid = n.nid WHERE n.created >= %d AND n.created < %d{$where} GROUP BY pi.pid", $args);
     while ($project = db_fetch_object($projects)) {
         $this->currentSample->values[$project->pid]['new_issues'] = (int) $project->count;
         $this->currentSample->values[$project->pid]['new_total'] = (int) $project->count;
     }
     // Pull the count of new issue comments per project.
     $projects = db_query("SELECT pi.pid, COUNT(pi.cid) AS count FROM {project_issue_comments} pi WHERE pi.timestamp >= %d AND pi.timestamp < %d{$where} GROUP BY pi.pid", $args);
     while ($project = db_fetch_object($projects)) {
         $this->currentSample->values[$project->pid]['new_comments'] = (int) $project->count;
         // Add the comment count to the total.
         $this->currentSample->values[$project->pid]['new_total'] = $this->currentSample->values[$project->pid]['new_total'] + (int) $project->count;
     }
 }
コード例 #2
0
 static function getUserIDFromName($user_name)
 {
     $results = db_query("SELECT uid FROM {users} WHERE name='%s'", $user_name);
     $result = db_fetch_object($results);
     $user_id = $result->uid;
     return $user_id;
 }
コード例 #3
0
ファイル: GuifiAPI.php プロジェクト: itorres/drupal-guifi
 private function tokenLogin()
 {
     global $user;
     if (empty($this->auth_token)) {
         return false;
     }
     $max_date = time() - 12 * 3600;
     // 12 hours since created
     db_query("DELETE FROM {guifi_api_tokens} WHERE created < FROM_UNIXTIME(%d)", $max_date);
     $dbtoken = db_fetch_object(db_query("SELECT * FROM {guifi_api_tokens} WHERE token = '%s'", $this->auth_token));
     if (!$dbtoken->uid) {
         return false;
     }
     $token = base64_decode($this->auth_token);
     $token = explode(':', $token);
     if (count($token) < 3) {
         return false;
     }
     $uid = $token[0];
     $hash = $token[1];
     $time = $token[2];
     if ($dbtoken->uid != $uid) {
         return false;
     }
     $account = user_load($uid);
     $check = md5($account->mail . $account->pass . $account->created . $account->uid . $time . $dbtoken->rand_key);
     if ($check == $hash) {
         $user = $account;
         return true;
     }
     return false;
 }
コード例 #4
0
function apiary_project_help_text_form()
{
    $categories = db_query("select DISTINCT category from {apiary_project_help_text} ");
    $records = db_query("select * from {apiary_project_help_text} ");
    $form = '';
    $k = 0;
    $flag = true;
    while ($category = db_fetch_object($categories)) {
        $form[$category->category] = array('#type' => 'fieldset', '#title' => t($category->category), '#weight' => $k, '#collapsible' => TRUE, '#collapsed' => TRUE);
        $k++;
        if ($category->category == 'General') {
            $flag = false;
        }
    }
    if ($flag) {
        $form['General'] = array('#type' => 'fieldset', '#title' => t('General'), '#weight' => $k, '#collapsible' => TRUE, '#collapsed' => TRUE);
    }
    while ($record = db_fetch_object($records)) {
        $form[$record->category][$record->term] = array('#type' => 'textarea', '#cols' => '30', '#rows' => '2', '#title' => t($record->label), '#default_value' => t($record->help_text));
    }
    $form['General']['new_term'] = array('#type' => 'textfield', '#title' => t('Term Name'));
    $form['General']['new_label'] = array('#type' => 'textfield', '#title' => t('Term Label'));
    $form['General']['new_category'] = array('#type' => 'select', '#title' => t('Category'), '#options' => array('General' => t('General')));
    $form['General']['new_help_text'] = array('#type' => 'textarea', '#cols' => '30', '#rows' => '2', '#title' => t('Help text'));
    $form['submit'] = array('#type' => 'submit', '#value' => t('Save'), '#weight' => 200);
    return $form;
}
コード例 #5
0
 /**
  * Performs the fetch of the work request
  *
  * @param $params
  *   Associative array of parameters
  *   - $params->wr: Work Request ID or array of
  *   - $params->user: User ID making the request
  *   @return
  *    - The request object on success
  *    - Error message if access is denied, or wr was not filled.
  */
 function run($params)
 {
     $access = access::getInstance();
     if ($params['GET']['wr'] == null) {
         error_logging('WARNING', "No work request number (wr) provided.");
         return new error('No work request number (wr) provided.');
     }
     if (!preg_match('/^(\\d+)(,\\d+)*$/', $params['GET']['wr'])) {
         error_logging('WARNING', 'Provided work request (wr) of; "' . $params['GET']['wr'] . '" argument does not match required format.');
         return new error('Bad work request (wr) argument. Argument must be in the format of one or more integers seperated by commas.');
     }
     $response = new response('Success');
     $sql = 'SELECT * FROM request WHERE request_id IN (' . $params['GET']['wr'] . ')';
     $result = db_query($sql);
     while ($row = db_fetch_object($result)) {
         if ($access->permitted('wr/view', $row->request_id)) {
             $object = new WrmsWorkRequest();
             $object->populate($row);
             $object->populateChildren();
             $response->data[] = $object;
         } else {
             $response->data[] = new error('You cannot access this work request.', 403);
             # EKM TODO add id not allowed option
         }
     }
     return $response;
 }
コード例 #6
0
ファイル: db.php プロジェクト: kimpepper/drupal-base
 function get($key)
 {
     global $user;
     // Load local cache for multiple hits per page.
     if (isset($this->content[$key])) {
         return $this->content[$key];
     }
     // Handle garbage collection
     $this->gc();
     $cache = db_fetch_object(db_query("SELECT data, created, headers, expire, serialized FROM {" . $this->name . "} WHERE cid = '%s'", $key));
     if (isset($cache->data)) {
         // If the data is permanent or we're not enforcing a minimum cache lifetime
         // always return the cached data.
         if ($cache->expire == CACHE_PERMANENT || !variable_get('cache_lifetime', 0)) {
             $cache->data = db_decode_blob($cache->data);
             if ($cache->serialized) {
                 $cache->data = unserialize($cache->data);
             }
         } else {
             if ($user->cache > $cache->created) {
                 // This cache data is too old and thus not valid for us, ignore it.
                 return 0;
             } else {
                 $cache->data = db_decode_blob($cache->data);
                 if ($cache->serialized) {
                     $cache->data = unserialize($cache->data);
                 }
             }
         }
         $this->content[$key] = $cache;
         return $cache;
     }
     return 0;
 }
コード例 #7
0
ファイル: programm.php プロジェクト: BackupTheBerlios/otmp
function sql_getProgrammData($id)
{
    /* returns Data from Programm Table for ID */
    global $CFG;
    $qid = db_query("\n     SELECT \n     ProgrammPRGID as id, \n     ProgrammName as name, \n     ProgrammVersion as version\n     FROM {$CFG->tbl_programm} \n     WHERE ProgrammPRGID={$id} ORDER BY ProgrammSort\n   ");
    return db_fetch_object($qid);
}
/**
 * Convert project repository data.
 */
function cvs_to_versioncontrol_project_update_2()
{
    // This determines how many projects will be processed in each batch run. A reasonable
    // default has been chosen, but you may want to tweak depending on your setup.
    $limit = 100;
    // Multi-part update
    if (!isset($_SESSION['cvs_to_versioncontrol_project_update_2'])) {
        $_SESSION['cvs_to_versioncontrol_project_update_2'] = 0;
        $_SESSION['cvs_to_versioncontrol_project_update_2_max'] = db_result(db_query("SELECT COUNT(*) FROM {cvs_projects}"));
    }
    // Pull the next batch of users.
    $projects = db_query_range("SELECT p.nid, p.rid, p.directory, r.modules FROM {cvs_projects} p INNER JOIN {cvs_repositories} r ON p.rid = r.rid ORDER BY p.nid", $_SESSION['cvs_to_versioncontrol_project_update_2'], $limit);
    // Loop through each project.
    while ($project = db_fetch_object($projects)) {
        // Add the repo module, and chop off the trailing slash.
        $directory = '/' . trim($project->modules) . drupal_substr($project->directory, 0, drupal_strlen($project->directory) - 1);
        db_query("INSERT INTO {versioncontrol_project_projects} (nid, repo_id, directory) VALUES (%d, %d, '%s')", $project->nid, $project->rid, $directory);
        $_SESSION['cvs_to_versioncontrol_project_update_2']++;
    }
    if ($_SESSION['cvs_to_versioncontrol_project_update_2'] >= $_SESSION['cvs_to_versioncontrol_project_update_2_max']) {
        $count = $_SESSION['cvs_to_versioncontrol_project_update_2_max'];
        unset($_SESSION['cvs_to_versioncontrol_project_update_2']);
        unset($_SESSION['cvs_to_versioncontrol_project_update_2_max']);
        return array(array('success' => TRUE, 'query' => t('Converted @count project repository entries.', array('@count' => $count))));
    }
    return array('#finished' => $_SESSION['cvs_to_versioncontrol_project_update_2'] / $_SESSION['cvs_to_versioncontrol_project_update_2_max']);
}
コード例 #9
0
 function buildTypeMap()
 {
     $result = db_query("SELECT * FROM {biblio_contributor_type} ;");
     while ($type = db_fetch_object($result)) {
         $this->typeMap[$type->type] = $type->ctid;
     }
 }
コード例 #10
0
 public function performCheck(&$obj, &$user)
 {
     //Check if user has been assigned to the system
     $return = false;
     $systems = $user->getSystems();
     $system_id = 0;
     if (is_numeric($obj)) {
         //Was passed request ID
         $result = db_query("SELECT system_id FROM request WHERE request_id = %d", $obj);
         if ($result) {
             $info = db_fetch_object($result);
             $system_id = $info->system_id;
         }
     }
     if (isset($systems[$system_id])) {
         //If the system info exists user must have access to view it
         switch ($systems[$system_id]['role']) {
             case 'S':
             case 'C':
             case 'E':
                 $return = true;
                 break;
         }
     }
     return $return;
 }
コード例 #11
0
ファイル: statistic.php プロジェクト: rjdesign/Ilch-1.2
function user_admin_online_liste()
{
    $OnListe = '';
    $class = '';
    $dif = date('Y-m-d H:i:s', time() - USERUPTIME);
    $erg = db_query("SELECT DISTINCT `uid`, DATE_FORMAT(`uptime`, '%d.%m.%Y - %H:%i:%s') as `datum`, `ipa`, `name`, `content` as aufenthalt FROM `prefix_online` LEFT JOIN `prefix_user` on `prefix_user`.`id` = `prefix_online`.`uid` WHERE `uptime` > '" . $dif . "' ORDER BY `uid` DESC");
    while ($row = db_fetch_object($erg)) {
        $name = $row->name;
        if ($row->uid == 0) {
            $name = 'Gast';
        }
        $host_patterns = array('/crawl-[0-9]{1,3}-[0-9]{1,3}-[0-9]{1,3}-[0-9]{1,3}\\.googlebot\\.com/si', '/[a-z]*[0-9]*\\.inktomisearch\\.com/si', '/[a-z]*[0-9]*\\.ask\\.com/si', '/p[0-9A-F]*\\.dip[0-9]*\\.t-(dialin|ipconnect)\\.(net|de)/si', '/[0-9A-F]*\\.ipt\\.aol\\.com/si', '/dslb-[0-9]{3}-[0-9]{3}-[0-9]{3}-[0-9]{3}.pools.arcor-ip.net/si', '/crawl[0-9]*\\}exabot\\.com/si', '/[0-9A-Z]+\\.adsl\\.highway\\.telekom\\.at/si');
        $host_names = array('Bot Google', 'Bot Inktomi/Yahoo', 'Bot Ask.com', 'T-Online', 'AOL', 'Arcor DSL', 'Bot Exalead', 'Telekom Austria DSL');
        $class = $class == 'Cmite' ? 'Cnorm' : 'Cmite';
        $OnListe .= '<tr class="' . $class . '">';
        $OnListe .= '<td>' . $name . '</td>';
        $OnListe .= '<td>' . $row->datum . '</td>';
        $OnListe .= '<td>' . $row->ipa . '</td>';
        $OnListe .= '<td>' . preg_replace($host_patterns, $host_names, @gethostbyaddr($row->ipa)) . '</td>';
        $OnListe .= '<td>' . $row->aufenthalt . '</td>';
        $OnListe .= '</tr>';
    }
    // $OnListe = substr($OnListe,0,strlen($OnListe) - 3);
    return $OnListe;
}
コード例 #12
0
 public function load($node)
 {
     $sql = "SELECT author_name, media_source, url, pubdate FROM {newsarticle} WHERE vid = %d";
     $na = db_fetch_object(db_query($sql, $node->vid));
     $na->datestr = scf_date_string($na->pubdate);
     return $na;
 }
コード例 #13
0
  static function getLayersInfoArray($query, $query_args=null) {
    $arr_theme=array();
    $j=0;

    $layersChecked=$GLOBALS['layersChecked'];

    if ($query_args == null) {
      $result_layer=db_query($query);
    }
    else {
      $result_layer=db_query($query, $query_args);
    }
    if (!$result_layer) {
      $errmsgstr=$GLOBALS['errmsgstr'];
      die('Error fetching layer info. ' . $errmsgstr);
    }
    else {
      while ($layer_obj=db_fetch_object($result_layer)) {
        $layer_tablename=$layer_obj->layer_tablename;
        $layer_name=$layer_obj->layer_name;
        $participation_type=$layer_obj->participation_type;
        $p_nid=$layer_obj->p_nid;
        $access=$layer_obj->access;
        $layer_type=$layer_obj->layer_type;
        $arr_theme[$j]["id"]="li" . $layer_tablename;
        $arr_theme[$j]["text"]=treeViewEntryHTML($layer_tablename, $layer_name, $participation_type, $layer_type, $p_nid, $access);
        $arr_theme[$j]["title"]=$layer_name;
        $j++;
      }
    }
    return $arr_theme;
  }
コード例 #14
0
 /**
  *  loadPublicationTypes - get number values for word values of publication types
  */
 function loadPublicationTypes()
 {
     static $biblioTypes = array();
     if ($biblioTypes) {
         // done
     } else {
         $sql = 'SELECT * FROM {biblio_types}';
         $res = db_query($sql);
         if ($res) {
             while ($data = db_fetch_object($res)) {
                 $key = $data->tid;
                 $name = $data->name;
                 $biblioTypes[strtolower($name)] = $key;
             }
             // add a couple items that are not in the given set
             $biblioTypes['series'] = $biblioTypes['journal'];
             $biblioTypes['article'] = $biblioTypes['journal article'];
         } else {
             // failed, so fall back on bad hard coding
             // these should match what is in table: biblio_types
             //   and match what biblio_install, _add_publication_types() sets up
             $biblioTypes['book'] = 100;
             $biblioTypes['journal article'] = 102;
             $biblioTypes['series'] = $biblioTypes['journal'];
             $biblioTypes['article'] = $biblioTypes['journal article'];
             $biblioTypes['journal'] = 131;
             $biblioTypes['original description'] = 132;
             $biblioTypes['treatment'] = 133;
         }
     }
     return $biblioTypes;
 }
コード例 #15
0
ファイル: upload.php プロジェクト: rahool/maplocator
function getSchema($layer_tablename){
  //get column names except custom columns
  global $table_cols;
  global $col_type;

  $query = "select column_name,data_type from information_schema.columns where table_name='%s' AND column_name not like '".AUTO_DBCOL_PREFIX."%'";
  $result = db_query($query,$layer_tablename);
  if(!$result) {
  } else {
     while($obj = db_fetch_object($result)) {
	    $cols .= "'".$obj->column_name."',";
	    $col_type[$obj->column_name] = $obj->data_type;
	 }
  }
  $cols = substr($cols,0,(strlen($cols)-1));
  $col_info = getDBColDesc($layer_tablename,$cols);

  //get layer_type
  $query = "select layer_type from \"Meta_Layer\" where layer_tablename = '%s'";
  $result = db_query($query,$layer_tablename);
  if(!$result) {
  } else {
     while($obj = db_fetch_object($result)) {
	     $layer_type = $obj->layer_type;
	 }
  }
  if(isset($_REQUEST['action'])){
    $table_cols = $col_info;
  } else {
      $table_cols = $cols;
  }
  return $layer_type;
}
コード例 #16
0
ファイル: pages.php プロジェクト: NazarK/sqp
function page_by_title($title, $edit = false)
{
    $ret = db_fetch_object(db_query("SELECT * FROM pages WHERE short='%s' LIMIT 1", $title));
    if ($edit && admin()) {
        $ret->content = p_quickedit_html($ret->id) . $ret->content;
    }
    return $ret->content;
}
コード例 #17
0
 static function getExpirationForID($session_id)
 {
     $results = db_query("SELECT session_expiration FROM {apiary_project_workflow_sessions} WHERE session_id='%s'", $session_id);
     while ($result = db_fetch_object($results)) {
         $session_expiration = $result->session_expiration;
     }
     return $session_expiration;
 }
コード例 #18
0
ファイル: render.php プロジェクト: Tymecode/SMS-XMPP
function shutdown($uid)
{
    $user = db_fetch_object(db_query("SELECT timestamp FROM {im_plus_plus_user} WHERE uid = %d", $uid));
    if ($user->timestamp + 300 < time()) {
        db_query("UPDATE {im_plus_plus_user} SET status = %d WHERE uid = %d", AWAY, $uid);
        db_query('DELETE FROM {im_plus_plus_user_addressbook} WHERE uid = %d', $uid);
    }
}
コード例 #19
0
 static function getIDFromName($permission_name)
 {
     $results = db_query("SELECT permission_id FROM {apiary_project_permission} WHERE permission_name='%s'", $permission_name);
     while ($result = db_fetch_object($results)) {
         $permission_id = $result->permission_id;
     }
     return $permission_id;
 }
コード例 #20
0
/**
 * Allows modules to alter transaction info before it's added to the Google
 * Analytics e-commerce tracking code.
 *
 * The Pay Google Analytics module works in much the same way as the Ubercart
 * Google Analytics module by constructing function calls that work through
 * the Google Analytics JS API to report order information for e-commerce
 * tracking purposes.  The module builds the argument list for the transaction
 * and uses this hook to give other modules a chance to alter what gets reported
 * to Google Analytics.
 *
 * @param $trans
 *   An array of arguments being passed to Google Analytics representing the
 *     transaction, including pxid (pay transaction id), store (defaults to site
 *     name), total, tax, shipping, city, state and country.  Only pxid, store
 *     and total are set by the pay_googleanalytics module and you will need to
 *     implement this hook in order to set the other values based on your form
 *     implementation.
 * @param $transaction
 *   The pay transaction object being reported to Google Analytics.
 * @param $activity
 *   The pay activity object being reported to Google Analytics.
 * @return
 *   Nothing should be returned. Hook implementations should receive the $trans
 *     array by reference and alter it directly.
 */
function hook_pay_googleanalytics_transaction_alter(&$trans, $transaction, $activity)
{
    // Fetch the location fields of your custom form fields, for example:
    $record = db_fetch_object(db_query("SELECT city, state, country FROM {my_form_data} WHERE txid = %d", $transaction->pxid));
    // Set city, state and country.
    $trans['city'] = $record->city;
    $trans['state'] = $record->state;
    $trans['country'] = $record->country;
}
コード例 #21
0
function wow_class($class, $specnum)
{
    $specnum = 'spec' . $specnum;
    $abf = db_query("SELECT * FROM `prefix_wow_recruit` WHERE `class` = '" . $class . "'");
    while ($row = db_fetch_object($abf)) {
        $spec = $row->{$specnum} > 0 ? 'class="specInvis"' : '';
    }
    return $spec;
}
コード例 #22
0
 public function trackObjectIDs()
 {
     $nids = array();
     $projects = db_query("SELECT nid FROM {project_projects}");
     while ($project = db_fetch_object($projects)) {
         $nids[] = $project->nid;
     }
     return $nids;
 }
コード例 #23
0
ファイル: subscriptions.php プロジェクト: jonolsson/Saturday
 /**
  * Find all subscriber URLs for a given topic URL.
  *
  * @return
  *   An array of subscriber URLs.
  */
 public function all($topic)
 {
     $subscribers = array();
     $result = db_query("SELECT subscriber FROM {push_hub_subscriptions} WHERE topic = '%s'", $topic);
     while ($row = db_fetch_object($result)) {
         $subscribers[] = $row->subscriber;
     }
     return $subscribers;
 }
コード例 #24
0
 public function getColumns($tableName)
 {
     $column_names = array();
     $columns_result = db_query("SHOW COLUMNS FROM `%s`", $tableName);
     while ($column = db_fetch_object($columns_result)) {
         $column_names[] = $column->Field;
     }
     return $column_names;
 }
コード例 #25
0
function run_html_report()
{
    $parameters = $_GET['ses'];
    $form_ses = $_GET['form_ses'];
    $report = $_GET['r'];
    $dir = $_GET['dir'];
    $emailer = $_GET['emailer'];
    include_once "../{$dir}/database.php";
    include_once 'common.php';
    if ($emailer != '1') {
        if (activityPasswordNeeded($report)) {
            $session = nuSession($parameters, false);
            if ($session->foundOK == '') {
                print 'you have been logged out..';
                return;
            }
        }
    }
    $setup = nuSetup();
    $T = nuRunQuery("SELECT * FROM zzsys_activity WHERE sat_all_code = '{$report}'");
    $A = db_fetch_object($T);
    //----------allow for custom code----------------------------------------------
    //--already done now..	eval($A->sat_report_display_code);
    $id = uniqid('1');
    $thedate = date('Y-m-d H:i:s');
    $dq = '"';
    if ($A->zzsys_activity_id != '') {
        //$viewer               = $_SESSION['zzsys_user_id'];
        $viewer = $session->sss_zzsys_user_id;
        $s = "INSERT INTO zzsys_report_log (zzsys_report_log_id, ";
        $s = $s . "srl_zzsys_activity_id, srl_date ,srl_viewer) ";
        $s = $s . "VALUES ('{$id}', '{$report}', '{$thedate}', '{$viewer}')";
        nuRunQuery($s);
    } else {
        print 'No Such Report...';
        return;
    }
    $s = "SELECT count(*), MAX(sva_expiry_date) FROM zzsys_variable ";
    $s = $s . "WHERE sva_id = '{$form_ses}' ";
    $s = $s . "GROUP BY sva_expiry_date";
    $t1 = nuRunQuery($s);
    $r1 = db_fetch_row($t1);
    $numberOfVariables = $r1[0];
    $expiryDate = $r1[1];
    //---must have at least 1 variable
    if ($numberOfVariables > 0) {
        $s = "DELETE FROM zzsys_variable ";
        $s = $s . "WHERE sva_id = '{$form_ses}' ";
        $s = $s . "AND sva_name = 'ReportTitle'";
        nuRunQuery($s);
        setnuVariable($form_ses, $expiryDate, 'ReportTitle', $A->sat_all_description);
        MakeReport($form_ses, $A);
    } else {
        print 'Report has Expired...';
    }
}
コード例 #26
0
ファイル: db_result.php プロジェクト: jasonjohnson/blast
 /**
  * Returns the next object in the result set
  *
  * @access	public
  * @return	object
  */
 public function result()
 {
     $result = db_fetch_object($this->result_resource);
     if (!$result) {
         return false;
     }
     $this->results[] = $result;
     $this->result_index++;
     return $this->results[$this->result_index];
 }
コード例 #27
0
function multisite_manager_batch_install()
{
    // XXX This query will install multiple times sites that have several revisions once the _update function is
    // properly overriden in the .module file.
    $result = db_query("SELECT * FROM {drupal_site} WHERE installed = 0");
    while ($node = db_fetch_object($result)) {
        multisite_manager_install_site($node);
        db_query("UPDATE {drupal_site} SET installed = 1 WHERE vid = %d and nid = %d", $node->vid, $node->nid);
    }
}
コード例 #28
0
ファイル: database.tests.php プロジェクト: Br3nda/medusa
 function testQuery()
 {
     $result = db_query("SELECT * FROM request ORDER BY request_id LIMIT 10");
     $this->assertTrue($result != false);
     while ($row = db_fetch_object($result)) {
         foreach (array('request_id', 'request_on', 'active', 'last_status', 'requester_id', 'last_activity', 'sla_response_time', 'sla_response_type', 'brief', 'entered_by', 'system_id') as $param) {
             $this->assertTrue(isset($row->{$param}), $param . ' missing from object');
         }
     }
 }
コード例 #29
0
/**
 * override hook_add_to_cart
 * 
 * @param string $nid
 * @param integer $qty
 * @param array $data
 * @return array
 */
function uc_stock_add_to_cart($nid, $qty, $data)
{
    $product = node_load($nid);
    uc_product_load($product);
    $sql = "SELECT nid FROM {uc_product_stock} WHERE sku = '%s' AND nid = '%s' AND  stock <= 0";
    $result = db_fetch_object(db_query($sql, $product->model, $nid));
    if (db_affected_rows($result) == 1) {
        return array(array('success' => FALSE, 'message' => t('@product out of stock', array('@product' => $product->title))));
    }
}
コード例 #30
0
ファイル: oss-db-update.php プロジェクト: rollinsb1010/bbcom
function variable_mass_move($old_base, $new_base)
{
    $res = db_query("SELECT name FROM variable WHERE name LIKE '%s_%%'", $old_base);
    while ($obj = db_fetch_object($res)) {
        $old = $obj->name;
        $new = preg_replace("/^{$old_base}/", $new_base, $old);
        //print ("$old => $new\n");
        variable_move($old, $new);
    }
}