Ignore:
Timestamp:
May 30, 2006 9:30:35 PM (18 years ago)
Author:
scdev
Message:

finished updating DB:: to $db->

Location:
branches/2.0singleton/bin/module_maker/skel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2.0singleton/bin/module_maker/skel/admin.php

    r127 r130  
    146146        if (getFormdata('repeat', false)) {
    147147            // Display edit function with next available ID.
    148             $qid = DB::query("SELECT %PRIMARY_KEY% FROM %DB_TBL% WHERE %PRIMARY_KEY% > '" . DB::escapeString(getFormData('%PRIMARY_KEY%')) . "' ORDER BY %PRIMARY_KEY% ASC LIMIT 1");
     148            $qid = $db->query("SELECT %PRIMARY_KEY% FROM %DB_TBL% WHERE %PRIMARY_KEY% > '" . $db->escapeString(getFormData('%PRIMARY_KEY%')) . "' ORDER BY %PRIMARY_KEY% ASC LIMIT 1");
    149149            if (list($next_id) = mysql_fetch_row($qid)) {
    150150                $app->dieURL($_SERVER['PHP_SELF'] . '?op=edit&%PRIMARY_KEY%=' . $next_id);
     
    207207{
    208208    global $lock;
    209 
     209    $db =& DB::getInstance();
     210   
    210211    $lock->select('%DB_TBL%', '%PRIMARY_KEY%', $id);
    211212    if ($lock->isLocked() && !$lock->isMine()) {
     
    214215
    215216    // Get the information for the form.
    216     $qid = DB::query("
     217    $qid = $db->query("
    217218        SELECT *
    218219        FROM %DB_TBL%
    219         WHERE %PRIMARY_KEY% = '" . DB::escapeString($id) . "'
     220        WHERE %PRIMARY_KEY% = '" . $db->escapeString($id) . "'
    220221    ");
    221222    if (!$frm = mysql_fetch_assoc($qid)) {
     
    246247{
    247248    global $lock;
    248 
     249    $db =& DB::getInstance();
     250   
    249251    $lock->select('%DB_TBL%', '%PRIMARY_KEY%', $id);
    250252    if ($lock->isLocked() && !$lock->isMine()) {
     
    256258
    257259    // Get the information for this object.
    258     $qid = DB::query("
     260    $qid = $db->query("
    259261        SELECT <##>
    260262        FROM %DB_TBL%
    261         WHERE %PRIMARY_KEY% = '" . DB::escapeString($id) . "'
     263        WHERE %PRIMARY_KEY% = '" . $db->escapeString($id) . "'
    262264    ");
    263265    if (! list($name) = mysql_fetch_row($qid)) {
     
    268270
    269271    // Delete the record.
    270     DB::query("DELETE FROM %DB_TBL% WHERE %PRIMARY_KEY% = '" . DB::escapeString($id) . "'");
     272    $db->query("DELETE FROM %DB_TBL% WHERE %PRIMARY_KEY% = '" . $db->escapeString($id) . "'");
    271273
    272274    $app->raiseMsg(sprintf(_("The %ITEM_TITLE% <strong>%s</strong> has been deleted."), $name), MSG_SUCCESS, __FILE__, __LINE__);
     
    279281{
    280282    global $auth;
    281 
     283    $db =& DB::getInstance();
     284   
    282285    // Break the cache because we are changing the list data.
    283286    SessionCache::breakCache($_SERVER['PHP_SELF']);
    284287
    285288%INSERT%
    286     $last_insert_id = mysql_insert_id(DB::getDBH());
     289    $last_insert_id = mysql_insert_id($db->getDBH());
    287290
    288291    // Create version.
     
    323326    global $page;
    324327    global $so;
    325 
     328    $db =& DB::getInstance();
     329   
    326330    $where_clause = '';
    327331
     
    336340    if (getFormData('filter_<##>', false)) {
    337341        // Limit by filter.
    338         $where_clause .= (empty($where_clause) ? 'WHERE' : 'AND') . " <##> = '" . DB::escapeString(getFormData('filter_<##>')) . "'";
     342        $where_clause .= (empty($where_clause) ? 'WHERE' : 'AND') . " <##> = '" . $db->escapeString(getFormData('filter_<##>')) . "'";
    339343    }
    340344
    341345    // Count the total number of records so we can do something about the page numbers.
    342     $qid = DB::query("
     346    $qid = $db->query("
    343347        SELECT COUNT(*)
    344348        FROM %DB_TBL%
     
    381385    } else {
    382386        // If the list is not already cached, query now.
    383         $qid = DB::query($sql);
     387        $qid = $db->query($sql);
    384388        // Fill an array with the items for this page.
    385389        while ($row = mysql_fetch_assoc($qid)) {
     
    398402function updateRank($ranks)
    399403{
     404    $db =& DB::getInstance();
     405   
    400406    if (!is_array($ranks)) {
    401407        $app->logMsg('Saving rank failed, data posted is not an array: ' . $ranks, LOG_ERR, __FILE__, __LINE__);
     
    416422            $unspecified_counter++;
    417423        }
    418         DB::query("
     424        $db->query("
    419425            UPDATE %DB_TBL% SET
    420                 rank = '" . DB::escapeString($new_rank) . "'
    421             WHERE %PRIMARY_KEY% = '" . DB::escapeString($id) . "'
     426                rank = '" . $db->escapeString($new_rank) . "'
     427            WHERE %PRIMARY_KEY% = '" . $db->escapeString($id) . "'
    422428        ");
    423429    }
  • branches/2.0singleton/bin/module_maker/skel/public.php

    r127 r130  
    3434
    3535    // Get requested record.
    36     $qid = DB::query("
     36    $qid = $db->query("
    3737        SELECT * FROM %DB_TBL%
    38         WHERE %PRIMARY_KEY% = '" . DB::escapeString(getFormData('%PRIMARY_KEY%')) . "'
     38        WHERE %PRIMARY_KEY% = '" . $db->escapeString(getFormData('%PRIMARY_KEY%')) . "'
    3939        AND publish = 'true'
    4040        <##>AND (publish_date <= CURDATE() OR publish_date = '0000-00-00')
     
    4747
    4848    // Update the hit counter for this record.
    49     DB::query("
     49    $db->query("
    5050        UPDATE %DB_TBL%
    5151        SET hit_count = hit_count + 1
    52         WHERE %PRIMARY_KEY% = '" . DB::escapeString(getFormData('%PRIMARY_KEY%')) . "'
     52        WHERE %PRIMARY_KEY% = '" . $db->escapeString(getFormData('%PRIMARY_KEY%')) . "'
    5353    ");
    5454
     
    6161    // Get the DEFAULT list.
    6262    $%NAME_SINGULAR%_list = array();
    63     $qid = DB::query("
     63    $qid = $db->query("
    6464        SELECT *
    6565        FROM %DB_TBL%
     
    7979    // Get the FEATURED list.
    8080    $featured_list = array();
    81     $qid = DB::query("
     81    $qid = $db->query("
    8282        SELECT *
    8383        FROM %DB_TBL%
     
    9292    // Get the POPULAR list.
    9393    $popular_list = array();
    94     $qid = DB::query("
     94    $qid = $db->query("
    9595        SELECT *
    9696        FROM %DB_TBL%
     
    104104    // Get the RECENT list.
    105105    $recent_list = array();
    106     $qid = DB::query("
     106    $qid = $db->query("
    107107        SELECT *
    108108        FROM %DB_TBL%
Note: See TracChangeset for help on using the changeset viewer.