Changeset 127 for branches/2.0singleton/bin/module_maker/skel/admin.php
- Timestamp:
- May 25, 2006 10:21:07 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.0singleton/bin/module_maker/skel/admin.php
r111 r127 11 11 $auth->requireLogin(); 12 12 // $auth->requireAccessClearance(ZONE_ADMIN_%NAME_UPPER%); 13 App::sslOn();13 $app->sslOn(); 14 14 15 15 require_once 'codebase/lib/PageNumbers.inc.php'; … … 41 41 42 42 // Search limiters retain their values between page requests. 43 App::carryQuery('search_query');44 App::carryQuery('filter_<##>');43 $app->carryQuery('search_query'); 44 $app->carryQuery('filter_<##>'); 45 45 %ADMIN_UPLOAD_CONFIG% 46 46 /****************************************************************************** … … 51 51 // allows us to remember which page we came from so we can go back there. 52 52 if (getFormData('boomerang', false) && isset($_SERVER['HTTP_REFERER'])) { 53 App::setBoomerangURL($_SERVER['HTTP_REFERER'], '%NAME_PLURAL%');53 $app->setBoomerangURL($_SERVER['HTTP_REFERER'], '%NAME_PLURAL%'); 54 54 } 55 55 … … 81 81 // $auth->requireAccessClearance(ZONE_ADMIN_%NAME_UPPER%_FUNC_DELETE); 82 82 deleteRecord(getFormData('%PRIMARY_KEY%'));%ADMIN_UPLOAD_DEL% 83 if ( App::validBoomerangURL('%NAME_PLURAL%')) {83 if ($app->validBoomerangURL('%NAME_PLURAL%')) { 84 84 // Display boomerang page. 85 App::dieBoomerangURL('%NAME_PLURAL%');85 $app->dieBoomerangURL('%NAME_PLURAL%'); 86 86 } 87 87 // Display default page. 88 App::dieURL($_SERVER['PHP_SELF']);88 $app->dieURL($_SERVER['PHP_SELF']); 89 89 break; 90 90 … … 92 92 // $auth->requireAccessClearance(ZONE_ADMIN_%NAME_UPPER%_FUNC_ADD); 93 93 if (getFormdata('cancel', false)) { 94 if ( App::validBoomerangURL('%NAME_PLURAL%')) {94 if ($app->validBoomerangURL('%NAME_PLURAL%')) { 95 95 // Display boomerang page. 96 App::dieBoomerangURL('%NAME_PLURAL%');96 $app->dieBoomerangURL('%NAME_PLURAL%'); 97 97 } 98 98 // Display default page. 99 App::dieURL($_SERVER['PHP_SELF']);99 $app->dieURL($_SERVER['PHP_SELF']); 100 100 } 101 101 validateInput(); … … 109 109 if (getFormdata('repeat', false)) { 110 110 // Display function again. 111 App::dieURL($_SERVER['PHP_SELF'] . '?op=add');112 } else if ( App::validBoomerangURL('%NAME_PLURAL%')) {111 $app->dieURL($_SERVER['PHP_SELF'] . '?op=add'); 112 } else if ($app->validBoomerangURL('%NAME_PLURAL%')) { 113 113 // Display boomerang page. 114 App::dieBoomerangURL('%NAME_PLURAL%');114 $app->dieBoomerangURL('%NAME_PLURAL%'); 115 115 } 116 116 // Display default page. 117 App::dieURL($_SERVER['PHP_SELF']);117 $app->dieURL($_SERVER['PHP_SELF']); 118 118 } 119 119 break; … … 122 122 // $auth->requireAccessClearance(ZONE_ADMIN_%NAME_UPPER%_FUNC_EDIT); 123 123 if (getFormdata('reset', false)) { 124 App::raiseMsg(_("Saved values have been reloaded."), MSG_NOTICE, __FILE__, __LINE__);125 App::dieURL($_SERVER['PHP_SELF'] . '?op=edit&%PRIMARY_KEY%=' . getFormData('%PRIMARY_KEY%'));124 $app->raiseMsg(_("Saved values have been reloaded."), MSG_NOTICE, __FILE__, __LINE__); 125 $app->dieURL($_SERVER['PHP_SELF'] . '?op=edit&%PRIMARY_KEY%=' . getFormData('%PRIMARY_KEY%')); 126 126 } 127 127 if (getFormdata('cancel', false)) { … … 129 129 $lock->select('%DB_TBL%', '%PRIMARY_KEY%', getFormData('%PRIMARY_KEY%')); 130 130 $lock->remove(); 131 if ( App::validBoomerangURL('%NAME_PLURAL%')) {131 if ($app->validBoomerangURL('%NAME_PLURAL%')) { 132 132 // Display boomerang page. 133 App::dieBoomerangURL('%NAME_PLURAL%');133 $app->dieBoomerangURL('%NAME_PLURAL%'); 134 134 } 135 135 // Display default page. 136 App::dieURL($_SERVER['PHP_SELF']);136 $app->dieURL($_SERVER['PHP_SELF']); 137 137 } 138 138 validateInput(); … … 148 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 App::dieURL($_SERVER['PHP_SELF'] . '?op=edit&%PRIMARY_KEY%=' . $next_id);150 $app->dieURL($_SERVER['PHP_SELF'] . '?op=edit&%PRIMARY_KEY%=' . $next_id); 151 151 } else { 152 App::raiseMsg(_("Cannot edit next, the end of the list was reached"), MSG_NOTICE, __FILE__, __LINE__);152 $app->raiseMsg(_("Cannot edit next, the end of the list was reached"), MSG_NOTICE, __FILE__, __LINE__); 153 153 } 154 } else if ( App::validBoomerangURL('%NAME_PLURAL%')) {154 } else if ($app->validBoomerangURL('%NAME_PLURAL%')) { 155 155 // Display boomerang page. 156 App::dieBoomerangURL('%NAME_PLURAL%');156 $app->dieBoomerangURL('%NAME_PLURAL%'); 157 157 } 158 158 // Display default page. 159 App::dieURL($_SERVER['PHP_SELF']);159 $app->dieURL($_SERVER['PHP_SELF']); 160 160 } 161 161 break; … … 164 164 // $auth->requireAccessClearance(ZONE_ADMIN_PROGRAMS_FUNC_REORDER); 165 165 updateRank(getFormData('rank')); 166 App::dieURL($_SERVER['PHP_SELF']);166 $app->dieURL($_SERVER['PHP_SELF']); 167 167 break; 168 168 … … 220 220 "); 221 221 if (!$frm = mysql_fetch_assoc($qid)) { 222 App::logMsg('Could not find record with %PRIMARY_KEY%: ' . $id, LOG_WARNING, __FILE__, __LINE__);223 App::raiseMsg(sprintf(_("The requested record %s could not be found."), $id), MSG_ERR, __FILE__, __LINE__);224 App::dieBoomerangURL();222 $app->logMsg('Could not find record with %PRIMARY_KEY%: ' . $id, LOG_WARNING, __FILE__, __LINE__); 223 $app->raiseMsg(sprintf(_("The requested record %s could not be found."), $id), MSG_ERR, __FILE__, __LINE__); 224 $app->dieBoomerangURL(); 225 225 } 226 226 … … 262 262 "); 263 263 if (! list($name) = mysql_fetch_row($qid)) { 264 App::logMsg('Could not find record with %PRIMARY_KEY%: ' . $id, LOG_WARNING, __FILE__, __LINE__);265 App::raiseMsg(sprintf(_("The requested record %s could not be found."), $id), MSG_ERR, __FILE__, __LINE__);266 App::dieBoomerangURL();264 $app->logMsg('Could not find record with %PRIMARY_KEY%: ' . $id, LOG_WARNING, __FILE__, __LINE__); 265 $app->raiseMsg(sprintf(_("The requested record %s could not be found."), $id), MSG_ERR, __FILE__, __LINE__); 266 $app->dieBoomerangURL(); 267 267 } 268 268 … … 270 270 DB::query("DELETE FROM %DB_TBL% WHERE %PRIMARY_KEY% = '" . DB::escapeString($id) . "'"); 271 271 272 App::raiseMsg(sprintf(_("The %ITEM_TITLE% <strong>%s</strong> has been deleted."), $name), MSG_SUCCESS, __FILE__, __LINE__);272 $app->raiseMsg(sprintf(_("The %ITEM_TITLE% <strong>%s</strong> has been deleted."), $name), MSG_SUCCESS, __FILE__, __LINE__); 273 273 274 274 // Unlock record. … … 290 290 $version->create('%DB_TBL%', '%PRIMARY_KEY%', $last_insert_id, $frm['<##>']); 291 291 292 App::raiseMsg(sprintf(_("The %ITEM_TITLE% <strong>%s</strong> has been added."), $frm['<##>']), MSG_SUCCESS, __FILE__, __LINE__);292 $app->raiseMsg(sprintf(_("The %ITEM_TITLE% <strong>%s</strong> has been added."), $frm['<##>']), MSG_SUCCESS, __FILE__, __LINE__); 293 293 294 294 return $last_insert_id; … … 313 313 $version->create('%DB_TBL%', '%PRIMARY_KEY%', $frm['%PRIMARY_KEY%'], $frm['<##>']); 314 314 315 App::raiseMsg(sprintf(_("The %ITEM_TITLE% <strong>%s</strong> has been updated."), $frm['<##>']), MSG_SUCCESS, __FILE__, __LINE__);315 $app->raiseMsg(sprintf(_("The %ITEM_TITLE% <strong>%s</strong> has been updated."), $frm['<##>']), MSG_SUCCESS, __FILE__, __LINE__); 316 316 317 317 // Unlock record. … … 399 399 { 400 400 if (!is_array($ranks)) { 401 App::logMsg('Saving rank failed, data posted is not an array: ' . $ranks, LOG_ERR, __FILE__, __LINE__);401 $app->logMsg('Saving rank failed, data posted is not an array: ' . $ranks, LOG_ERR, __FILE__, __LINE__); 402 402 return false; 403 403 } … … 423 423 } 424 424 425 App::raiseMsg(_("Records have been reordered with the new rank."), MSG_SUCCESS, __FILE__, __LINE__);425 $app->raiseMsg(_("Records have been reordered with the new rank."), MSG_SUCCESS, __FILE__, __LINE__); 426 426 if ($unspecified_counter > 0) { 427 App::raiseMsg(sprintf(_("%s items with unspecified ranks were automatically assigned a rank of 10000."), $unspecified_counter), MSG_NOTICE, __FILE__, __LINE__);427 $app->raiseMsg(sprintf(_("%s items with unspecified ranks were automatically assigned a rank of 10000."), $unspecified_counter), MSG_NOTICE, __FILE__, __LINE__); 428 428 } 429 429 }
Note: See TracChangeset
for help on using the changeset viewer.