Changeset 130 for branches/2.0singleton/bin/module_maker/skel
- Timestamp:
- May 30, 2006 9:30:35 PM (18 years ago)
- 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 146 146 if (getFormdata('repeat', false)) { 147 147 // 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"); 149 149 if (list($next_id) = mysql_fetch_row($qid)) { 150 150 $app->dieURL($_SERVER['PHP_SELF'] . '?op=edit&%PRIMARY_KEY%=' . $next_id); … … 207 207 { 208 208 global $lock; 209 209 $db =& DB::getInstance(); 210 210 211 $lock->select('%DB_TBL%', '%PRIMARY_KEY%', $id); 211 212 if ($lock->isLocked() && !$lock->isMine()) { … … 214 215 215 216 // Get the information for the form. 216 $qid = DB::query("217 $qid = $db->query(" 217 218 SELECT * 218 219 FROM %DB_TBL% 219 WHERE %PRIMARY_KEY% = '" . DB::escapeString($id) . "'220 WHERE %PRIMARY_KEY% = '" . $db->escapeString($id) . "' 220 221 "); 221 222 if (!$frm = mysql_fetch_assoc($qid)) { … … 246 247 { 247 248 global $lock; 248 249 $db =& DB::getInstance(); 250 249 251 $lock->select('%DB_TBL%', '%PRIMARY_KEY%', $id); 250 252 if ($lock->isLocked() && !$lock->isMine()) { … … 256 258 257 259 // Get the information for this object. 258 $qid = DB::query("260 $qid = $db->query(" 259 261 SELECT <##> 260 262 FROM %DB_TBL% 261 WHERE %PRIMARY_KEY% = '" . DB::escapeString($id) . "'263 WHERE %PRIMARY_KEY% = '" . $db->escapeString($id) . "' 262 264 "); 263 265 if (! list($name) = mysql_fetch_row($qid)) { … … 268 270 269 271 // 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) . "'"); 271 273 272 274 $app->raiseMsg(sprintf(_("The %ITEM_TITLE% <strong>%s</strong> has been deleted."), $name), MSG_SUCCESS, __FILE__, __LINE__); … … 279 281 { 280 282 global $auth; 281 283 $db =& DB::getInstance(); 284 282 285 // Break the cache because we are changing the list data. 283 286 SessionCache::breakCache($_SERVER['PHP_SELF']); 284 287 285 288 %INSERT% 286 $last_insert_id = mysql_insert_id( DB::getDBH());289 $last_insert_id = mysql_insert_id($db->getDBH()); 287 290 288 291 // Create version. … … 323 326 global $page; 324 327 global $so; 325 328 $db =& DB::getInstance(); 329 326 330 $where_clause = ''; 327 331 … … 336 340 if (getFormData('filter_<##>', false)) { 337 341 // 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_<##>')) . "'"; 339 343 } 340 344 341 345 // Count the total number of records so we can do something about the page numbers. 342 $qid = DB::query("346 $qid = $db->query(" 343 347 SELECT COUNT(*) 344 348 FROM %DB_TBL% … … 381 385 } else { 382 386 // If the list is not already cached, query now. 383 $qid = DB::query($sql);387 $qid = $db->query($sql); 384 388 // Fill an array with the items for this page. 385 389 while ($row = mysql_fetch_assoc($qid)) { … … 398 402 function updateRank($ranks) 399 403 { 404 $db =& DB::getInstance(); 405 400 406 if (!is_array($ranks)) { 401 407 $app->logMsg('Saving rank failed, data posted is not an array: ' . $ranks, LOG_ERR, __FILE__, __LINE__); … … 416 422 $unspecified_counter++; 417 423 } 418 DB::query("424 $db->query(" 419 425 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) . "' 422 428 "); 423 429 } -
branches/2.0singleton/bin/module_maker/skel/public.php
r127 r130 34 34 35 35 // Get requested record. 36 $qid = DB::query("36 $qid = $db->query(" 37 37 SELECT * FROM %DB_TBL% 38 WHERE %PRIMARY_KEY% = '" . DB::escapeString(getFormData('%PRIMARY_KEY%')) . "'38 WHERE %PRIMARY_KEY% = '" . $db->escapeString(getFormData('%PRIMARY_KEY%')) . "' 39 39 AND publish = 'true' 40 40 <##>AND (publish_date <= CURDATE() OR publish_date = '0000-00-00') … … 47 47 48 48 // Update the hit counter for this record. 49 DB::query("49 $db->query(" 50 50 UPDATE %DB_TBL% 51 51 SET hit_count = hit_count + 1 52 WHERE %PRIMARY_KEY% = '" . DB::escapeString(getFormData('%PRIMARY_KEY%')) . "'52 WHERE %PRIMARY_KEY% = '" . $db->escapeString(getFormData('%PRIMARY_KEY%')) . "' 53 53 "); 54 54 … … 61 61 // Get the DEFAULT list. 62 62 $%NAME_SINGULAR%_list = array(); 63 $qid = DB::query("63 $qid = $db->query(" 64 64 SELECT * 65 65 FROM %DB_TBL% … … 79 79 // Get the FEATURED list. 80 80 $featured_list = array(); 81 $qid = DB::query("81 $qid = $db->query(" 82 82 SELECT * 83 83 FROM %DB_TBL% … … 92 92 // Get the POPULAR list. 93 93 $popular_list = array(); 94 $qid = DB::query("94 $qid = $db->query(" 95 95 SELECT * 96 96 FROM %DB_TBL% … … 104 104 // Get the RECENT list. 105 105 $recent_list = array(); 106 $qid = DB::query("106 $qid = $db->query(" 107 107 SELECT * 108 108 FROM %DB_TBL%
Note: See TracChangeset
for help on using the changeset viewer.