Changeset 136 for trunk/services
- Timestamp:
- Jun 3, 2006 7:47:48 PM (18 years ago)
- Location:
- trunk/services
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/services/admins.php
r111 r136 8 8 9 9 $auth->requireLogin(); 10 App::sslOn();10 $app->sslOn(); 11 11 12 12 require_once 'codebase/lib/PageNumbers.inc.php'; 13 require_once 'codebase/lib/ SessionCache.inc.php';13 require_once 'codebase/lib/Cache.inc.php'; 14 14 require_once 'codebase/lib/FormValidator.inc.php'; 15 15 require_once 'codebase/lib/SortOrder.inc.php'; … … 29 29 // The object to validate form input. 30 30 $fv = new FormValidator(); 31 32 $cache =& Cache::getInstance(); 31 33 32 34 // Instantiate a sorting object with the default sort and order. Add SQL for each column. … … 54 56 55 57 // Search limiters retain their values between page requests. 56 App::carryQuery('search_query');58 $app->carryQuery('search_query'); 57 59 58 60 … … 64 66 // allows us to remember which page we came from so we can go back there. 65 67 if (getFormData('boomerang', false) && isset($_SERVER['HTTP_REFERER'])) { 66 App::setBoomerangURL($_SERVER['HTTP_REFERER'], 'admins');68 $app->setBoomerangURL($_SERVER['HTTP_REFERER'], 'admins'); 67 69 } 68 70 69 71 if (getFormData('break_list_cache', false)) { 70 72 // Break the cache because we are changing the list data. 71 SessionCache::breakCache($_SERVER['PHP_SELF']);73 $cache->delete($_SERVER['PHP_SELF']); 72 74 } 73 75 … … 91 93 case 'del' : 92 94 deleteRecord(getFormData('admin_id')); 93 if ( App::validBoomerangURL('admins')) {95 if ($app->validBoomerangURL('admins')) { 94 96 // Display boomerang page. 95 App::dieBoomerangURL('admins');97 $app->dieBoomerangURL('admins'); 96 98 } 97 99 // Display default page. 98 App::dieURL($_SERVER['PHP_SELF']);100 $app->dieURL($_SERVER['PHP_SELF']); 99 101 break; 100 102 101 103 case 'insert' : 102 104 if (getFormdata('cancel', false)) { 103 if ( App::validBoomerangURL('admins')) {105 if ($app->validBoomerangURL('admins')) { 104 106 // Display boomerang page. 105 App::dieBoomerangURL('admins');107 $app->dieBoomerangURL('admins'); 106 108 } 107 109 // Display default page. 108 App::dieURL($_SERVER['PHP_SELF']);110 $app->dieURL($_SERVER['PHP_SELF']); 109 111 } 110 112 validateInput(); … … 118 120 if (getFormdata('repeat', false)) { 119 121 // Display function again. 120 App::dieURL($_SERVER['PHP_SELF'] . '?op=add');121 } else if ( App::validBoomerangURL('admins')) {122 $app->dieURL($_SERVER['PHP_SELF'] . '?op=add'); 123 } else if ($app->validBoomerangURL('admins')) { 122 124 // Display boomerang page. 123 App::dieBoomerangURL('admins');125 $app->dieBoomerangURL('admins'); 124 126 } 125 127 // Display default page. 126 App::dieURL($_SERVER['PHP_SELF']);128 $app->dieURL($_SERVER['PHP_SELF']); 127 129 } 128 130 break; … … 130 132 case 'update' : 131 133 if (getFormdata('reset', false)) { 132 App::raiseMsg(_("Saved values have been reloaded."), MSG_NOTICE, __FILE__, __LINE__);133 App::dieURL($_SERVER['PHP_SELF'] . '?op=edit&admin_id=' . getFormData('admin_id'));134 $app->raiseMsg(_("Saved values have been reloaded."), MSG_NOTICE, __FILE__, __LINE__); 135 $app->dieURL($_SERVER['PHP_SELF'] . '?op=edit&admin_id=' . getFormData('admin_id')); 134 136 } 135 137 if (getFormdata('cancel', false)) { … … 137 139 $lock->select('admin_tbl', 'admin_id', getFormData('admin_id')); 138 140 $lock->remove(); 139 if ( App::validBoomerangURL('admins')) {141 if ($app->validBoomerangURL('admins')) { 140 142 // Display boomerang page. 141 App::dieBoomerangURL('admins');143 $app->dieBoomerangURL('admins'); 142 144 } 143 145 // Display default page. 144 App::dieURL($_SERVER['PHP_SELF']);146 $app->dieURL($_SERVER['PHP_SELF']); 145 147 } 146 148 validateInput(); … … 154 156 if (getFormdata('repeat', false)) { 155 157 // Display edit function with next available ID. 156 $qid = DB::query("SELECT admin_id FROM admin_tbl WHERE admin_id > '" . DB::escapeString(getFormData('admin_id')) . "' ORDER BY admin_id ASC LIMIT 1");158 $qid = $db->query("SELECT admin_id FROM admin_tbl WHERE admin_id > '" . $db->escapeString(getFormData('admin_id')) . "' ORDER BY admin_id ASC LIMIT 1"); 157 159 if (list($next_id) = mysql_fetch_row($qid)) { 158 App::dieURL($_SERVER['PHP_SELF'] . '?op=edit&admin_id=' . $next_id);160 $app->dieURL($_SERVER['PHP_SELF'] . '?op=edit&admin_id=' . $next_id); 159 161 } else { 160 App::raiseMsg(_("Cannot edit next, the end of the list was reached"), MSG_NOTICE, __FILE__, __LINE__);162 $app->raiseMsg(_("Cannot edit next, the end of the list was reached"), MSG_NOTICE, __FILE__, __LINE__); 161 163 } 162 } else if ( App::validBoomerangURL('admins')) {164 } else if ($app->validBoomerangURL('admins')) { 163 165 // Display boomerang page. 164 App::dieBoomerangURL('admins');166 $app->dieBoomerangURL('admins'); 165 167 } 166 168 // Display default page. 167 App::dieURL($_SERVER['PHP_SELF']);169 $app->dieURL($_SERVER['PHP_SELF']); 168 170 } 169 171 break; … … 258 260 { 259 261 global $lock; 260 262 $app =& App::getInstance(); 263 $db =& DB::getInstance(); 264 261 265 $lock->select('admin_tbl', 'admin_id', $id); 262 266 if ($lock->isLocked() && !$lock->isMine()) { … … 265 269 266 270 // Get the information for the form. 267 $qid = DB::query("271 $qid = $db->query(" 268 272 SELECT * 269 273 FROM admin_tbl 270 WHERE admin_id = '" . DB::escapeString($id) . "'274 WHERE admin_id = '" . $db->escapeString($id) . "' 271 275 "); 272 276 if (!$frm = mysql_fetch_assoc($qid)) { 273 App::logMsg('Could not find record with admin_id: ' . $id, LOG_WARNING, __FILE__, __LINE__);274 App::raiseMsg(sprintf(_("The requested record %s could not be found."), $id), MSG_ERR, __FILE__, __LINE__);275 App::dieBoomerangURL();277 $app->logMsg('Could not find record with admin_id: ' . $id, LOG_WARNING, __FILE__, __LINE__); 278 $app->raiseMsg(sprintf(_("The requested record %s could not be found."), $id), MSG_ERR, __FILE__, __LINE__); 279 $app->dieBoomerangURL(); 276 280 } 277 281 … … 313 317 { 314 318 global $auth, $lock; 315 319 $app =& App::getInstance(); 320 $db =& DB::getInstance(); 321 $cache =& Cache::getInstance(); 322 316 323 $lock->select('admin_tbl', 'admin_id', $id); 317 324 if ($lock->isLocked() && !$lock->isMine()) { … … 320 327 321 328 // Break the cache because we are changing the list data. 322 SessionCache::breakCache($_SERVER['PHP_SELF']);329 $cache->delete($_SERVER['PHP_SELF']); 323 330 324 331 // Get the information for this object. 325 $qid = DB::query("332 $qid = $db->query(" 326 333 SELECT username, user_type from admin_tbl 327 WHERE admin_id = '" . DB::escapeString($id) . "'334 WHERE admin_id = '" . $db->escapeString($id) . "' 328 335 "); 329 336 if (! list($name, $user_type) = mysql_fetch_row($qid)) { 330 App::logMsg('Could not find record with admin_id: ' . $id, LOG_WARNING, __FILE__, __LINE__);331 App::raiseMsg(sprintf(_("The requested record %s could not be found."), $id), MSG_ERR, __FILE__, __LINE__);332 App::dieBoomerangURL();337 $app->logMsg('Could not find record with admin_id: ' . $id, LOG_WARNING, __FILE__, __LINE__); 338 $app->raiseMsg(sprintf(_("The requested record %s could not be found."), $id), MSG_ERR, __FILE__, __LINE__); 339 $app->dieBoomerangURL(); 333 340 } 334 341 335 342 // Get the information for this object. 336 $qid = DB::query("SELECT COUNT(*) from admin_tbl");343 $qid = $db->query("SELECT COUNT(*) from admin_tbl"); 337 344 list($num_admins) = mysql_fetch_row($qid); 338 345 if ('root' == $user_type && 'root' != $auth->getVal('user_type')) { 339 346 // Only root users can delete root users! 340 App::raiseMsg(_("You do not have clearance to delete a root administrator."), MSG_NOTICE, __FILE__, __LINE__);347 $app->raiseMsg(_("You do not have clearance to delete a root administrator."), MSG_NOTICE, __FILE__, __LINE__); 341 348 } else if ($num_admins <= 1) { 342 349 // There must always be at least one admnistrator! 343 App::raiseMsg(_("You cannot delete the only administrator in the database. There must be at least one to log in and create other users."), MSG_NOTICE, __FILE__, __LINE__);350 $app->raiseMsg(_("You cannot delete the only administrator in the database. There must be at least one to log in and create other users."), MSG_NOTICE, __FILE__, __LINE__); 344 351 } else if ($auth->getVal('user_id') == $id) { 345 352 // Do not delete yourself! 346 App::raiseMsg(_("You cannot delete yourself."), MSG_NOTICE, __FILE__, __LINE__);353 $app->raiseMsg(_("You cannot delete yourself."), MSG_NOTICE, __FILE__, __LINE__); 347 354 } else { 348 355 // Delete the record. 349 DB::query("DELETE FROM admin_tbl WHERE admin_id = '" . DB::escapeString($id) . "'");350 App::raiseMsg(sprintf(_("The admin <strong>%s</strong> has been deleted."), $name), MSG_SUCCESS, __FILE__, __LINE__);356 $db->query("DELETE FROM admin_tbl WHERE admin_id = '" . $db->escapeString($id) . "'"); 357 $app->raiseMsg(sprintf(_("The admin <strong>%s</strong> has been deleted."), $name), MSG_SUCCESS, __FILE__, __LINE__); 351 358 } 352 359 … … 358 365 { 359 366 global $auth; 360 367 $app =& App::getInstance(); 368 $db =& DB::getInstance(); 369 $cache =& Cache::getInstance(); 370 361 371 // Break the cache because we are changing the list data. 362 SessionCache::breakCache($_SERVER['PHP_SELF']);372 $cache->delete($_SERVER['PHP_SELF']); 363 373 364 374 // Insert record data. 365 DB::query("375 $db->query(" 366 376 INSERT INTO admin_tbl ( 367 377 username, … … 373 383 added_datetime 374 384 ) VALUES ( 375 '" . DB::escapeString($frm['username']) . "',376 '" . DB::escapeString($frm['first_name']) . "',377 '" . DB::escapeString($frm['last_name']) . "',378 '" . DB::escapeString($frm['email']) . "',379 '" . DB::escapeString($frm['user_type']) . "',380 '" . DB::escapeString($auth->getVal('user_id')) . "',385 '" . $db->escapeString($frm['username']) . "', 386 '" . $db->escapeString($frm['first_name']) . "', 387 '" . $db->escapeString($frm['last_name']) . "', 388 '" . $db->escapeString($frm['email']) . "', 389 '" . $db->escapeString($frm['user_type']) . "', 390 '" . $db->escapeString($auth->getVal('user_id')) . "', 381 391 NOW() 382 392 ) 383 393 "); 384 $last_insert_id = mysql_insert_id( DB::getDBH());394 $last_insert_id = mysql_insert_id($db->getDBH()); 385 395 386 396 // Set admin password. … … 391 401 $version->create('admin_tbl', 'admin_id', $last_insert_id, $frm['username']); 392 402 393 App::raiseMsg(sprintf(_("The Admin <strong>%s</strong> has been added."), $frm['username']), MSG_SUCCESS, __FILE__, __LINE__);403 $app->raiseMsg(sprintf(_("The Admin <strong>%s</strong> has been added."), $frm['username']), MSG_SUCCESS, __FILE__, __LINE__); 394 404 395 405 return $last_insert_id; … … 399 409 { 400 410 global $auth, $lock; 401 411 $app =& App::getInstance(); 412 $db =& DB::getInstance(); 413 $cache =& Cache::getInstance(); 414 402 415 $lock->select('admin_tbl', 'admin_id', $frm['admin_id']); 403 416 if ($lock->isLocked() && !$lock->isMine()) { … … 406 419 407 420 // Break the cache because we are changing the list data. 408 SessionCache::breakCache($_SERVER['PHP_SELF']);421 $cache->delete($_SERVER['PHP_SELF']); 409 422 410 423 // If the userpass is left blank or with the filler **** characters, we don't want to update it. … … 415 428 416 429 // Update record data. 417 DB::query("430 $db->query(" 418 431 UPDATE admin_tbl SET 419 username = '" . DB::escapeString($frm['username']) . "',420 first_name = '" . DB::escapeString($frm['first_name']) . "',421 last_name = '" . DB::escapeString($frm['last_name']) . "',422 email = '" . DB::escapeString($frm['email']) . "',423 user_type = '" . DB::escapeString($frm['user_type']) . "',424 modified_by_user_id = '" . DB::escapeString($auth->getVal('user_id')) . "',432 username = '" . $db->escapeString($frm['username']) . "', 433 first_name = '" . $db->escapeString($frm['first_name']) . "', 434 last_name = '" . $db->escapeString($frm['last_name']) . "', 435 email = '" . $db->escapeString($frm['email']) . "', 436 user_type = '" . $db->escapeString($frm['user_type']) . "', 437 modified_by_user_id = '" . $db->escapeString($auth->getVal('user_id')) . "', 425 438 modified_datetime = NOW() 426 WHERE admin_id = '" . DB::escapeString($frm['admin_id']) . "'439 WHERE admin_id = '" . $db->escapeString($frm['admin_id']) . "' 427 440 "); 428 441 … … 431 444 $version->create('admin_tbl', 'admin_id', $frm['admin_id'], $frm['username']); 432 445 433 App::raiseMsg(sprintf(_("The Admin <strong>%s</strong> has been updated."), $frm['username']), MSG_SUCCESS, __FILE__, __LINE__);446 $app->raiseMsg(sprintf(_("The Admin <strong>%s</strong> has been updated."), $frm['username']), MSG_SUCCESS, __FILE__, __LINE__); 434 447 435 448 // Unlock record. … … 441 454 global $page; 442 455 global $so; 443 456 $db =& DB::getInstance(); 457 $prefs =& Prefs::getInstance(); 458 $cache =& Cache::getInstance(); 459 444 460 $where_clause = ''; 445 461 … … 450 466 $where_clause .= (empty($where_clause) ? 'WHERE' : 'AND') . " 451 467 ( 452 admin_tbl.username LIKE '%" . DB::escapeString($qry_words[$i]) . "%'453 OR admin_tbl.first_name LIKE '%" . DB::escapeString($qry_words[$i]) . "%'454 OR admin_tbl.last_name LIKE '%" . DB::escapeString($qry_words[$i]) . "%'455 OR admin_tbl.email LIKE '%" . DB::escapeString($qry_words[$i]) . "%'468 admin_tbl.username LIKE '%" . $db->escapeString($qry_words[$i]) . "%' 469 OR admin_tbl.first_name LIKE '%" . $db->escapeString($qry_words[$i]) . "%' 470 OR admin_tbl.last_name LIKE '%" . $db->escapeString($qry_words[$i]) . "%' 471 OR admin_tbl.email LIKE '%" . $db->escapeString($qry_words[$i]) . "%' 456 472 ) 457 473 "; … … 460 476 461 477 // Count the total number of records so we can do something about the page numbers. 462 $qid = DB::query("478 $qid = $db->query(" 463 479 SELECT COUNT(*) 464 480 FROM admin_tbl … … 491 507 // without knowing the hash. 492 508 $cache_hash = md5($sql . '|' . $page->total_items); 493 if ( Prefs::getValue('cache_hash', $_SERVER['PHP_SELF']) != $cache_hash) {494 SessionCache::breakCache($_SERVER['PHP_SELF']);495 Prefs::setValue('cache_hash', $cache_hash, $_SERVER['PHP_SELF']);496 } 497 498 if ( SessionCache::isCached($_SERVER['PHP_SELF']) && false) {509 if ($prefs->get('cache_hash', $_SERVER['PHP_SELF']) != $cache_hash) { 510 $cache->delete($_SERVER['PHP_SELF']); 511 $prefs->set('cache_hash', $cache_hash, $_SERVER['PHP_SELF']); 512 } 513 514 if ($cache->exists($_SERVER['PHP_SELF']) && false) { 499 515 // Get the cached results. 500 $list = SessionCache::getCache($_SERVER['PHP_SELF']);516 $list = $cache->get($_SERVER['PHP_SELF']); 501 517 } else { 502 518 // If the list is not already cached, query now. 503 $qid = DB::query($sql);519 $qid = $db->query($sql); 504 520 // Fill an array with the items for this page. 505 521 while ($row = mysql_fetch_assoc($qid)) { … … 509 525 if (isset($list) && !empty($list)) { 510 526 // Cache the results. 511 SessionCache::putCache($list, $_SERVER['PHP_SELF']);527 $cache->set($list, $_SERVER['PHP_SELF']); 512 528 } 513 529 } -
trunk/services/lock.php
r53 r136 9 9 10 10 $auth->requireLogin(); 11 App::sslOn();11 $app->sslOn(); 12 12 13 13 if (getFormData('boomerang', false)) { 14 14 // We remember which page we came from so we can go back there. 15 15 $boom_url = strpos(getFormData('boomerang'), '/') !== false ? getFormData('boomerang') : $_SERVER['HTTP_REFERER']; 16 App::setBoomerangURL($boom_url, 'lock');16 $app->setBoomerangURL($boom_url, 'lock'); 17 17 if (isset($_SERVER['HTTP_REFERER'])) { 18 App::setBoomerangURL($_SERVER['HTTP_REFERER'], 'cancel-lock');18 $app->setBoomerangURL($_SERVER['HTTP_REFERER'], 'cancel-lock'); 19 19 } 20 20 } … … 26 26 27 27 if (!$lock->isLocked()) { 28 App::logMsg('Lock not found with lock_id: ' . getFormData('lock_id') . ', from referrer: ' . $_SERVER['HTTP_REFERER'], LOG_WARNING, __FILE__, __LINE__);29 App::dieBoomerangURL('lock');28 $app->logMsg('Lock not found with lock_id: ' . getFormData('lock_id') . ', from referrer: ' . $_SERVER['HTTP_REFERER'], LOG_WARNING, __FILE__, __LINE__); 29 $app->dieBoomerangURL('lock'); 30 30 } 31 31 … … 33 33 if (getFormData('unlock', false)) { 34 34 $lock->remove(); 35 App::raiseMsg(sprintf(_("The record <strong>%s</strong> has been unlocked, and can now be modified."), $lock->getTitle('title')), MSG_NOTICE, __FILE__, __LINE__);36 App::dieBoomerangURL('lock');35 $app->raiseMsg(sprintf(_("The record <strong>%s</strong> has been unlocked, and can now be modified."), $lock->getTitle('title')), MSG_NOTICE, __FILE__, __LINE__); 36 $app->dieBoomerangURL('lock'); 37 37 } else if (getFormData('cancel', false)) { 38 38 // Since the boomerang URL will go back to the locked record, and the record was not unlocked, we must delete the boomerang URL otherwise we'll come back here. 39 App::deleteBoomerangURL('lock');40 App::dieBoomerangURL('cancel-lock');39 $app->deleteBoomerangURL('lock'); 40 $app->dieBoomerangURL('cancel-lock'); 41 41 } 42 42 -
trunk/services/login.php
r103 r136 8 8 // allows us to remember which page we came from so we can go back there. 9 9 if (getFormData('boomerang', false) && isset($_SERVER['HTTP_REFERER'])) { 10 App::setBoomerangURL($_SERVER['HTTP_REFERER'], 'login');10 $app->setBoomerangURL($_SERVER['HTTP_REFERER'], 'login'); 11 11 } 12 App::sslOn();12 $app->sslOn(); 13 13 14 14 $frm['username'] = getFormdata('username'); … … 19 19 20 20 if ($auth->login($frm['username'], $frm['password'])) { 21 App::raiseMsg(_("You are now logged in."), MSG_SUCCESS, __FILE__, __LINE__);22 App::dieBoomerangURL('login');23 App::logMsg(sprintf('%s %s successfully logged-in.', $auth->getVal('auth_name'), $frm['username']), LOG_INFO, __FILE__, __LINE__);21 $app->raiseMsg(_("You are now logged in."), MSG_SUCCESS, __FILE__, __LINE__); 22 $app->dieBoomerangURL('login'); 23 $app->logMsg(sprintf('%s %s successfully logged-in.', $auth->getVal('auth_name'), $frm['username']), LOG_INFO, __FILE__, __LINE__); 24 24 } else { 25 App::raiseMsg(_("Login failed, please try again."), MSG_NOTICE, __FILE__, __LINE__);26 App::logMsg(sprintf('%s %s failed login using (MD5ed) password: %s', ucfirst($auth->getVal('auth_name')), $frm['username'], md5($frm['password'])), LOG_NOTICE, __FILE__, __LINE__);25 $app->raiseMsg(_("Login failed, please try again."), MSG_NOTICE, __FILE__, __LINE__); 26 $app->logMsg(sprintf('%s %s failed login using (MD5ed) password: %s', ucfirst($auth->getVal('auth_name')), $frm['username'], md5($frm['password'])), LOG_NOTICE, __FILE__, __LINE__); 27 27 } 28 28 } -
trunk/services/logout.php
r108 r136 5 5 */ 6 6 7 if (is _a($auth, 'Auth_SQL')) {7 if (isset($auth) && method_exists($auth, 'getVal')) { 8 8 // Delete the current user's record locks. 9 9 require_once 'codebase/lib/RecordLock.inc.php'; … … 15 15 $auth->clearAuth(); 16 16 17 App::raiseMsg(sprintf(_("Your session has been logged-out."), null), MSG_SUCCESS, __FILE__, __LINE__);18 App::dieURL(App::getParam('redirect_home_url'));17 $app->raiseMsg(sprintf(_("Your session has been logged-out."), null), MSG_SUCCESS, __FILE__, __LINE__); 18 $app->dieURL($app->getParam('redirect_home_url')); 19 19 20 20 ?> -
trunk/services/logs.php
r42 r136 9 9 $auth->requireLogin(); 10 10 // $auth->requireAccessClearance(ZONE_ADMIN_APPLOG); 11 App::sslOn();11 $app->sslOn(); 12 12 13 13 require_once 'codebase/lib/PageNumbers.inc.php'; … … 39 39 40 40 // Set the defaults and catch incoming settings. 41 Prefs::setDefault('log_file', App::getParam('log_filename'), 'logs_module'); 42 Prefs::setValue('log_file', getFormData('log'), 'logs_module'); 41 $prefs =& Prefs::getInstance(); 42 $prefs->setDefault('log_file', $app->getParam('log_filename'), 'logs_module'); 43 $prefs->set('log_file', getFormData('log'), 'logs_module'); 43 44 44 45 // Titles and navigation header. 45 $nav->addPage(sprintf(_("Viewing log: <em>%s</em>"), Prefs::getValue('log_file', 'logs_module')), '/admin/logs.php');46 $nav->addPage(sprintf(_("Viewing log: <em>%s</em>"), $prefs->get('log_file', 'logs_module')), '/admin/logs.php'); 46 47 47 48 /****************************************************************************** … … 56 57 case 'delete' : 57 58 // $auth->requireAccessClearance(ZONE_ADMIN_APPLOG_FUNC_RESET); 58 deleteLog( Prefs::getValue('log_file', 'logs_module'));59 Prefs::setValue('log_file', App::getParam('log_filename'), 'logs_module');60 if ( App::validBoomerangURL('app_log')) {59 deleteLog($prefs->get('log_file', 'logs_module')); 60 $prefs->set('log_file', $app->getParam('log_filename'), 'logs_module'); 61 if ($app->validBoomerangURL('app_log')) { 61 62 // Display boomerang page. 62 App::dieBoomerangURL('app_log');63 $app->dieBoomerangURL('app_log'); 63 64 } 64 65 // Display default page. 65 App::dieURL($_SERVER['PHP_SELF']);66 $app->dieURL($_SERVER['PHP_SELF']); 66 67 break; 67 68 68 69 case 'clear' : 69 70 // $auth->requireAccessClearance(ZONE_ADMIN_APPLOG_FUNC_RESET); 70 clearLog( Prefs::getValue('log_file', 'logs_module'));71 if ( App::validBoomerangURL('app_log')) {71 clearLog($prefs->get('log_file', 'logs_module')); 72 if ($app->validBoomerangURL('app_log')) { 72 73 // Display boomerang page. 73 App::dieBoomerangURL('app_log');74 $app->dieBoomerangURL('app_log'); 74 75 } 75 76 // Display default page. 76 App::dieURL($_SERVER['PHP_SELF']);77 $app->dieURL($_SERVER['PHP_SELF']); 77 78 break; 78 79 79 80 case 'archive' : 80 81 // $auth->requireAccessClearance(ZONE_ADMIN_APPLOG_FUNC_RESET); 81 if (archiveLog( Prefs::getValue('log_file', 'logs_module'))) {82 if (archiveLog($prefs->get('log_file', 'logs_module'))) { 82 83 // Now flush current log. 83 App::dieURL($_SERVER['PHP_SELF'] . '?op=clear');84 } 85 if ( App::validBoomerangURL('app_log')) {84 $app->dieURL($_SERVER['PHP_SELF'] . '?op=clear'); 85 } 86 if ($app->validBoomerangURL('app_log')) { 86 87 // Display boomerang page. 87 App::dieBoomerangURL('app_log');88 $app->dieBoomerangURL('app_log'); 88 89 } 89 90 // Display default page. 90 App::dieURL($_SERVER['PHP_SELF']);91 $app->dieURL($_SERVER['PHP_SELF']); 91 92 break; 92 93 … … 97 98 case 'download' : 98 99 header('Content-Type: application/octet-stream'); 99 header(sprintf('Content-Disposition: attachment; filename=%s.txt', Prefs::getValue('log_file', 'logs_module')));100 printLog( Prefs::getValue('log_file', 'logs_module'));100 header(sprintf('Content-Disposition: attachment; filename=%s.txt', $prefs->get('log_file', 'logs_module'))); 101 printLog($prefs->get('log_file', 'logs_module')); 101 102 die; 102 103 break; 103 104 104 105 default : 105 $list =& getLog( Prefs::getValue('log_file', 'logs_module'), getFormData('search_query'));106 $list =& getLog($prefs->get('log_file', 'logs_module'), getFormData('search_query')); 106 107 $main_template = 'log_list.ihtml'; 107 108 break; … … 125 126 include 'header.ihtml'; 126 127 if ('output' == $main_template) { 127 printLog( Prefs::getValue('log_file', 'logs_module'));128 printLog($prefs->get('log_file', 'logs_module')); 128 129 } else { 129 130 include 'codebase/services/templates/' . $main_template; … … 138 139 function deleteLog($log_file) 139 140 { 140 if (!file_exists(App::getParam('log_directory') . '/' . $log_file)) { 141 App::raiseMsg(sprintf(_("Log file %s does not exist."), $log_file), MSG_NOTICE, __FILE__, __LINE__); 142 App::logMsg(sprintf('Cannot delete nonexistent log file %s', App::getParam('log_directory') . '/' . $log_file), LOG_INFO, __FILE__, __LINE__); 143 return false; 144 } 145 146 if (!is_writable(App::getParam('log_directory') . '/' . $log_file) && !is_writable(App::getParam('log_directory'))) { 147 App::raiseMsg(sprintf(_("Log file %s could not be deleted."), $log_file), MSG_NOTICE, __FILE__, __LINE__); 148 App::logMsg(sprintf('Cannot delete log file %s, not writable.', App::getParam('log_directory') . '/' . $log_file), LOG_INFO, __FILE__, __LINE__); 149 return false; 150 } 151 152 if (unlink(App::getParam('log_directory') . '/' . $log_file)) { 153 App::raiseMsg(sprintf(_("Log file %s has been deleted."), $log_file), MSG_NOTICE, __FILE__, __LINE__); 154 App::logMsg(sprintf('Log file %s has been deleted', $log_file), LOG_INFO, __FILE__, __LINE__); 141 $app =& App::getInstance(); 142 143 if (!file_exists($app->getParam('log_directory') . '/' . $log_file)) { 144 $app->raiseMsg(sprintf(_("Log file %s does not exist."), $log_file), MSG_NOTICE, __FILE__, __LINE__); 145 $app->logMsg(sprintf('Cannot delete nonexistent log file %s', $app->getParam('log_directory') . '/' . $log_file), LOG_INFO, __FILE__, __LINE__); 146 return false; 147 } 148 149 if (!is_writable($app->getParam('log_directory') . '/' . $log_file) && !is_writable($app->getParam('log_directory'))) { 150 $app->raiseMsg(sprintf(_("Log file %s could not be deleted."), $log_file), MSG_NOTICE, __FILE__, __LINE__); 151 $app->logMsg(sprintf('Cannot delete log file %s, not writable.', $app->getParam('log_directory') . '/' . $log_file), LOG_INFO, __FILE__, __LINE__); 152 return false; 153 } 154 155 if (unlink($app->getParam('log_directory') . '/' . $log_file)) { 156 $app->raiseMsg(sprintf(_("Log file %s has been deleted."), $log_file), MSG_NOTICE, __FILE__, __LINE__); 157 $app->logMsg(sprintf('Log file %s has been deleted', $log_file), LOG_INFO, __FILE__, __LINE__); 155 158 return true; 156 159 } else { 157 App::raiseMsg(sprintf(_("Log file %s could not be deleted."), $log_file), MSG_WARNING, __FILE__, __LINE__);158 App::logMsg(sprintf('unlink failed on log file %s', App::getParam('log_directory') . '/' . $log_file), LOG_WARNING, __FILE__, __LINE__);160 $app->raiseMsg(sprintf(_("Log file %s could not be deleted."), $log_file), MSG_WARNING, __FILE__, __LINE__); 161 $app->logMsg(sprintf('unlink failed on log file %s', $app->getParam('log_directory') . '/' . $log_file), LOG_WARNING, __FILE__, __LINE__); 159 162 return false; 160 163 } … … 163 166 function clearLog($log_file) 164 167 { 165 if (!$fp = fopen(App::getParam('log_directory') . '/' . $log_file, 'r+')) { 166 App::raiseMsg(sprintf(_("Log file %s could not be opened."), $log_file), MSG_NOTICE, __FILE__, __LINE__); 167 App::logMsg(sprintf('fopen failed on log file %s', App::getParam('log_directory') . '/' . $log_file), LOG_INFO, __FILE__, __LINE__); 168 $app =& App::getInstance(); 169 170 if (!$fp = fopen($app->getParam('log_directory') . '/' . $log_file, 'r+')) { 171 $app->raiseMsg(sprintf(_("Log file %s could not be opened."), $log_file), MSG_NOTICE, __FILE__, __LINE__); 172 $app->logMsg(sprintf('fopen failed on log file %s', $app->getParam('log_directory') . '/' . $log_file), LOG_INFO, __FILE__, __LINE__); 168 173 return false; 169 174 } … … 174 179 fclose($fp); 175 180 if (!$ftruncate_return) { 176 App::raiseMsg(sprintf(_("Log file %s could not be cleared."), $log_file), MSG_WARNING, __FILE__, __LINE__);177 App::logMsg(sprintf('ftruncate failed on log file %s', App::getParam('log_directory') . '/' . $log_file), LOG_WARNING, __FILE__, __LINE__);181 $app->raiseMsg(sprintf(_("Log file %s could not be cleared."), $log_file), MSG_WARNING, __FILE__, __LINE__); 182 $app->logMsg(sprintf('ftruncate failed on log file %s', $app->getParam('log_directory') . '/' . $log_file), LOG_WARNING, __FILE__, __LINE__); 178 183 return false; 179 184 } else { 180 App::raiseMsg(sprintf(_("Log file %s has been cleared."), $log_file), MSG_NOTICE, __FILE__, __LINE__);181 App::logMsg(sprintf('Log file %s has been cleared', $log_file), LOG_INFO, __FILE__, __LINE__);185 $app->raiseMsg(sprintf(_("Log file %s has been cleared."), $log_file), MSG_NOTICE, __FILE__, __LINE__); 186 $app->logMsg(sprintf('Log file %s has been cleared', $log_file), LOG_INFO, __FILE__, __LINE__); 182 187 return true; 183 188 } … … 186 191 function archiveLog($log_file) 187 192 { 193 $app =& App::getInstance(); 194 188 195 $old_file_name = $log_file; 189 196 $new_file_name = $log_file . '__' . date('Y-m-d'); 190 If (!is_writable( App::getParam('log_directory') . '')) {191 App::raiseMsg(sprintf('Cannot archive log, log directory not writable: %s', App::getParam('log_directory')), MSG_WARNING, __FILE__, __LINE__);192 App::logMsg(sprintf('Cannot archive log, log directory not writable: %s', App::getParam('log_directory')), LOG_WARNING, __FILE__, __LINE__);193 return false; 194 } 195 If (!copy( App::getParam('log_directory') . '/' . $old_file_name, App::getParam('log_directory') . '/' . $new_file_name)) {196 App::raiseMsg(sprintf(_("Cannot archive log, copying old log file failed."), null), MSG_WARNING, __FILE__, __LINE__);197 App::logMsg(sprintf('Cannot archive log, copying old log file failed.', null), LOG_WARNING, __FILE__, __LINE__);198 return false; 199 } 200 201 App::raiseMsg(sprintf(_("Log file %s has been archived to %s."), $old_file_name, $new_file_name), MSG_NOTICE, __FILE__, __LINE__);202 App::logMsg(sprintf('Log file %s has been archived to %s.', $old_file_name, $new_file_name), LOG_NOTICE, __FILE__, __LINE__);197 If (!is_writable($app->getParam('log_directory') . '')) { 198 $app->raiseMsg(sprintf('Cannot archive log, log directory not writable: %s', $app->getParam('log_directory')), MSG_WARNING, __FILE__, __LINE__); 199 $app->logMsg(sprintf('Cannot archive log, log directory not writable: %s', $app->getParam('log_directory')), LOG_WARNING, __FILE__, __LINE__); 200 return false; 201 } 202 If (!copy($app->getParam('log_directory') . '/' . $old_file_name, $app->getParam('log_directory') . '/' . $new_file_name)) { 203 $app->raiseMsg(sprintf(_("Cannot archive log, copying old log file failed."), null), MSG_WARNING, __FILE__, __LINE__); 204 $app->logMsg(sprintf('Cannot archive log, copying old log file failed.', null), LOG_WARNING, __FILE__, __LINE__); 205 return false; 206 } 207 208 $app->raiseMsg(sprintf(_("Log file %s has been archived to %s."), $old_file_name, $new_file_name), MSG_NOTICE, __FILE__, __LINE__); 209 $app->logMsg(sprintf('Log file %s has been archived to %s.', $old_file_name, $new_file_name), LOG_NOTICE, __FILE__, __LINE__); 203 210 return true; 204 211 } … … 206 213 function printLog($log_file) 207 214 { 208 if (!is_file(App::getParam('log_directory') . '/' . $log_file)) { 209 App::raiseMsg(sprintf(_("Log file %s not found."), $log_file), MSG_WARNING, __FILE__, __LINE__); 210 App::logMsg(sprintf('Log file %s not found.', App::getParam('log_directory') . '/' . $log_file), LOG_WARNING, __FILE__, __LINE__); 211 return false; 212 } 213 214 readfile(App::getParam('log_directory') . '/' . $log_file); 215 $app =& App::getInstance(); 216 217 if (!is_file($app->getParam('log_directory') . '/' . $log_file)) { 218 $app->raiseMsg(sprintf(_("Log file %s not found."), $log_file), MSG_WARNING, __FILE__, __LINE__); 219 $app->logMsg(sprintf('Log file %s not found.', $app->getParam('log_directory') . '/' . $log_file), LOG_WARNING, __FILE__, __LINE__); 220 return false; 221 } 222 223 readfile($app->getParam('log_directory') . '/' . $log_file); 215 224 } 216 225 217 226 function &getLog($log_file, $search_query='') 218 227 { 219 if (!is_file(App::getParam('log_directory') . '/' . $log_file)) { 220 App::raiseMsg(sprintf(_("Log file %s not found."), $log_file), MSG_WARNING, __FILE__, __LINE__); 221 App::logMsg(sprintf('Log file %s not found.', App::getParam('log_directory') . '/' . $log_file), LOG_WARNING, __FILE__, __LINE__); 222 return false; 223 } 224 $log = file(App::getParam('log_directory') . '/' . $log_file); 228 $app =& App::getInstance(); 229 230 if (!is_file($app->getParam('log_directory') . '/' . $log_file)) { 231 $app->raiseMsg(sprintf(_("Log file %s not found."), $log_file), MSG_WARNING, __FILE__, __LINE__); 232 $app->logMsg(sprintf('Log file %s not found.', $app->getParam('log_directory') . '/' . $log_file), LOG_WARNING, __FILE__, __LINE__); 233 return false; 234 } 235 $log = file($app->getParam('log_directory') . '/' . $log_file); 225 236 226 237 if ('' != trim($search_query)) { … … 237 248 { 238 249 global $valid_file_extensions; 250 $app =& App::getInstance(); 239 251 240 252 // Get a list of all files in the log directory. 241 $dir_handle = opendir( App::getParam('log_directory'));253 $dir_handle = opendir($app->getParam('log_directory')); 242 254 $list = array(); 243 255 while ($dir_handle && ($file = readdir($dir_handle)) !== false) { 244 if (!preg_match('/^\./', $file) && is_file( App::getParam('log_directory') . '/' . $file) && in_array(strtolower(Upload::getFilenameExtension($file)), $valid_file_extensions)) {256 if (!preg_match('/^\./', $file) && is_file($app->getParam('log_directory') . '/' . $file) && in_array(strtolower(Upload::getFilenameExtension($file)), $valid_file_extensions)) { 245 257 $list[] = array( 246 258 'filename' => $file, 247 'filesize' => filesize( App::getParam('log_directory') . '/' . $file),248 'modified' => filemtime( App::getParam('log_directory') . '/' . $file),259 'filesize' => filesize($app->getParam('log_directory') . '/' . $file), 260 'modified' => filemtime($app->getParam('log_directory') . '/' . $file), 249 261 ); 250 262 } -
trunk/services/password.php
r42 r136 27 27 if (getFormData('boomerang', false) && isset($_SERVER['HTTP_REFERER'])) { 28 28 // We remember which page we came from so we can go back there. 29 App::setBoomerangURL($_SERVER['HTTP_REFERER'], 'admin_password');29 $app->setBoomerangURL($_SERVER['HTTP_REFERER'], 'admin_password'); 30 30 } 31 App::sslOn();31 $app->sslOn(); 32 32 33 33 switch (getFormData('op')) { … … 50 50 if (!$fv->anyErrors() && false === $auth->authenticate($auth->getVal('username'), $frm['oldpassword'])) { 51 51 $fv->addError('oldpassword', _("Your <strong>Old password</strong> failed authentication.")); 52 App::logMsg(sprintf(_("Password change failed for %s, using (md5ed) password: %s"), $auth->getVal('username'), md5($frm['oldpassword'])), LOG_NOTICE, __FILE__, __LINE__);52 $app->logMsg(sprintf(_("Password change failed for %s, using (md5ed) password: %s"), $auth->getVal('username'), md5($frm['oldpassword'])), LOG_NOTICE, __FILE__, __LINE__); 53 53 } 54 54 55 55 if (!$fv->anyErrors()) { 56 56 $auth->setPassword(null, $frm['newpassword']); 57 App::logMsg(sprintf(_("Password change successful for %s"), $auth->getVal('username')), LOG_INFO, __FILE__, __LINE__);58 App::raiseMsg(sprintf(_("Password change successful for %s"), $auth->getVal('username')), MSG_SUCCESS, __FILE__, __LINE__);59 App::dieBoomerangURL('admin_password');57 $app->logMsg(sprintf(_("Password change successful for %s"), $auth->getVal('username')), LOG_INFO, __FILE__, __LINE__); 58 $app->raiseMsg(sprintf(_("Password change successful for %s"), $auth->getVal('username')), MSG_SUCCESS, __FILE__, __LINE__); 59 $app->dieBoomerangURL('admin_password'); 60 60 } 61 61 break; -
trunk/services/templates/admin_form.ihtml
r121 r136 2 2 3 3 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> 4 <?php App::printHiddenSession(); ?>4 <?php $app->printHiddenSession(); ?> 5 5 <input type="hidden" name="op" value="<?php echo $frm['new_op']; ?>" /> 6 6 <input type="hidden" name="admin_id" value="<?php echo $frm['admin_id']; ?>" /> -
trunk/services/templates/admin_list.ihtml
r124 r136 2 2 <?php $fv->printErrorMessages(); ?> 3 3 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> 4 <?php App::printHiddenSession(false); ?>4 <?php $app->printHiddenSession(false); ?> 5 5 <div id="commandbox"> 6 <span class="sc-nowrap commandtext"><a href="<?php echo App::oHREF($_SERVER['PHP_SELF'] . '?op=add'); ?>"><?php echo _("Add administrator"); ?></a></span>6 <span class="sc-nowrap commandtext"><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=add'); ?>"><?php echo _("Add administrator"); ?></a></span> 7 7 <br /> 8 8 … … 31 31 <?php for ($i = 0; $i <= $page->last_item - $page->first_item && $page->total_items > 0; $i++) { ?> 32 32 <tr> 33 <td class="sc-padleft sc-nowrap"><a title="<?php printf(_("Edit %s"), oTxt($list[$i]['username'])) ?>" href="<?php echo App::oHREF($_SERVER['PHP_SELF'] . '?op=edit&admin_id=' . $list[$i]['admin_id']); ?>"><img src="/admin/_widgets/edit.gif" alt="Edit" width="14" height="18" border="0"></a> </td>34 <td class="sc-padleft sc-nowrap"><a title="<?php printf(_("Versions of %s"), oTxt($list[$i]['username'])) ?>" href="<?php echo App::oHREF('/admin/versions.php?record_table=admin_tbl&record_key=admin_id&boomerang=true&record_val=' . $list[$i]['admin_id']); ?>"><img src="/admin/_widgets/subcategory.gif" alt="" width="18" height="14" border="0" /></a> </td>33 <td class="sc-padleft sc-nowrap"><a title="<?php printf(_("Edit %s"), oTxt($list[$i]['username'])) ?>" href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=edit&admin_id=' . $list[$i]['admin_id']); ?>"><img src="/admin/_widgets/edit.gif" alt="Edit" width="14" height="18" border="0"></a> </td> 34 <td class="sc-padleft sc-nowrap"><a title="<?php printf(_("Versions of %s"), oTxt($list[$i]['username'])) ?>" href="<?php echo $app->oHREF('/admin/versions.php?record_table=admin_tbl&record_key=admin_id&boomerang=true&record_val=' . $list[$i]['admin_id']); ?>"><img src="/admin/_widgets/subcategory.gif" alt="" width="18" height="14" border="0" /></a> </td> 35 35 <td class="sc-nowrap"><?php echo oTxt($list[$i]['admin_id'], true); ?> </td> 36 36 <td class="sc-nowrap"><?php echo oTxt($list[$i]['username'], true); ?> </td> … … 40 40 <td class="sc-nowrap"><?php 41 41 if ($auth->isLoggedIn($list[$i]['admin_id'])) { 42 ?><strong><?php echo date( App::getParam('date_format'), strtotime($list[$i]['last_login_datetime'])) ?></strong><?php42 ?><strong><?php echo date($app->getParam('date_format'), strtotime($list[$i]['last_login_datetime'])) ?></strong><?php 43 43 } else { 44 echo '0000-00-00 00:00:00' == $list[$i]['last_login_datetime'] ? '' : date( App::getParam('date_format'), strtotime($list[$i]['last_login_datetime']));44 echo '0000-00-00 00:00:00' == $list[$i]['last_login_datetime'] ? '' : date($app->getParam('date_format'), strtotime($list[$i]['last_login_datetime'])); 45 45 } 46 46 ?> </td> 47 47 <td class="sc-nowrap"><?php echo gethostbyaddr($list[$i]['last_login_ip']); ?> </td> 48 <td class="sc-nowrap"><?php echo '0000-00-00 00:00:00' == $list[$i]['added_datetime'] ? '' : date( App::getParam('date_format'), strtotime($list[$i]['added_datetime'])); ?> </td>48 <td class="sc-nowrap"><?php echo '0000-00-00 00:00:00' == $list[$i]['added_datetime'] ? '' : date($app->getParam('date_format'), strtotime($list[$i]['added_datetime'])); ?> </td> 49 49 <td class="sc-nowrap"><?php echo oTxt($list[$i]['added_admin_username'], true); ?> </td> 50 <td class="sc-nowrap"><?php echo '0000-00-00 00:00:00' == $list[$i]['modified_datetime'] ? '' : date( App::getParam('date_format'), strtotime($list[$i]['modified_datetime'])); ?> </td>51 <td class="sc-padleft sc-nowrap" align="right"><a title="<?php printf(_("Delete %s"), oTxt($list[$i]['username'])) ?>" href="<?php echo App::oHREF($_SERVER['PHP_SELF'] . "?op=del&admin_id=" . $list[$i]['admin_id']); ?>" onClick="javascript:return confirm('<?php printf(_("Are you sure you want to delete the record %s? This action is permanent and cannot be undone."), oTxt($list[$i]['username'])) ?>')"><img src="/admin/_widgets/delete.gif" alt="Delete" width="16" height="17" border="0"></a> </td>50 <td class="sc-nowrap"><?php echo '0000-00-00 00:00:00' == $list[$i]['modified_datetime'] ? '' : date($app->getParam('date_format'), strtotime($list[$i]['modified_datetime'])); ?> </td> 51 <td class="sc-padleft sc-nowrap" align="right"><a title="<?php printf(_("Delete %s"), oTxt($list[$i]['username'])) ?>" href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . "?op=del&admin_id=" . $list[$i]['admin_id']); ?>" onClick="javascript:return confirm('<?php printf(_("Are you sure you want to delete the record %s? This action is permanent and cannot be undone."), oTxt($list[$i]['username'])) ?>')"><img src="/admin/_widgets/delete.gif" alt="Delete" width="16" height="17" border="0"></a> </td> 52 52 </tr> 53 53 <?php } ?> -
trunk/services/templates/list_info.ihtml
r121 r136 5 5 <span class="sc-nowrap commanditem commandtext"> 6 6 <?php printf(_("Listing <strong>%s-%s</strong> of <strong>%s</strong> results on <strong>%s</strong> pages"), (0==$page->total_items ? 0 : $page->first_item+1), (0==$page->total_items ? 0 : $page->last_item+1), $page->total_items, $page->total_pages) ?> 7 <a href="<?php echo App::oHREF($_SERVER['PHP_SELF'], false); ?>"><?php echo _("List all"); ?></a>7 <a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'], false); ?>"><?php echo _("List all"); ?></a> 8 8 <?php echo _("Per page"); ?>: <?php $page->printPerPageLinks() ?> 9 9 </span> -
trunk/services/templates/lock.ihtml
r42 r136 5 5 ?> 6 6 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> 7 <?php App::printHiddenSession() ?>7 <?php $app->printHiddenSession() ?> 8 8 <input type="hidden" name="lock_id" value="<?php echo $lock->getID(); ?>" /> 9 9 -
trunk/services/templates/log_list.ihtml
r121 r136 1 1 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> 2 <?php App::printHiddenSession(false); ?>2 <?php $app->printHiddenSession(false); ?> 3 3 4 4 <div id="commandbox"> … … 10 10 <tr class="commandtext"> 11 11 <td> 12 <?php if ($l['filename'] == Prefs::getValue('log_file', 'logs_module')) { ?>12 <?php if ($l['filename'] == $prefs->get('log_file', 'logs_module')) { ?> 13 13 <span class="commanditem"><strong><?php echo sprintf(_("%s"), $l['filename']); ?></strong></span> 14 14 <?php } else { ?> 15 <span class="commanditem"><a href="<?php echo App::oHREF('/admin/logs.php?log=' . $l['filename']); ?>"><strong><?php echo sprintf(_("%s"), $l['filename']); ?></strong></a></span>15 <span class="commanditem"><a href="<?php echo $app->oHREF('/admin/logs.php?log=' . $l['filename']); ?>"><strong><?php echo sprintf(_("%s"), $l['filename']); ?></strong></a></span> 16 16 <?php } ?> 17 17 </td> 18 18 <td> 19 <span class="commanditem"><em><?php echo sprintf(_("%01.1f KB, last modified %s"), ($l['filesize']/1024), date( App::getParam('date_format'), $l['modified'])); ?></em></span>19 <span class="commanditem"><em><?php echo sprintf(_("%01.1f KB, last modified %s"), ($l['filesize']/1024), date($app->getParam('date_format'), $l['modified'])); ?></em></span> 20 20 </td> 21 21 <td> 22 <?php if (!preg_match($no_download_files, $l['filename'])) { ?><span class="commanditem"><a href="<?php echo App::oHREF('/admin/logs.php?op=download&log=' . $l['filename']); ?>"><?php echo _("Download"); ?></a></span><?php } ?>23 <?php if (!preg_match($no_archive_files, $l['filename'])) { ?><span class="commanditem"><a href="<?php echo App::oHREF('/admin/logs.php?op=archive&log=' . $l['filename']); ?>"><?php echo _("Archive"); ?></a></span><?php } ?>24 <?php if (!preg_match($no_clear_files, $l['filename'])) { ?><span class="commanditem"><a href="<?php echo App::oHREF('/admin/logs.php?op=clear&log=' . $l['filename']); ?>" onClick="javascript:return confirm('<?php printf(_("Are you sure you want to clear the log file %s? This will empty this file of its contents. This action is not reversible."), $l['filename'])?>')"><?php echo _("Clear"); ?></a></span><?php } ?>25 <?php if (!preg_match($no_delete_files, $l['filename'])) { ?><span class="commanditem"><a href="<?php echo App::oHREF('/admin/logs.php?op=delete&log=' . $l['filename']); ?>" onClick="javascript:return confirm('<?php printf(_("Are you sure you want to delete the log file %s? This will remove this log file permanently. This action is not reversible."), $l['filename'])?>')"><?php echo _("Delete"); ?></a></span><?php } ?>22 <?php if (!preg_match($no_download_files, $l['filename'])) { ?><span class="commanditem"><a href="<?php echo $app->oHREF('/admin/logs.php?op=download&log=' . $l['filename']); ?>"><?php echo _("Download"); ?></a></span><?php } ?> 23 <?php if (!preg_match($no_archive_files, $l['filename'])) { ?><span class="commanditem"><a href="<?php echo $app->oHREF('/admin/logs.php?op=archive&log=' . $l['filename']); ?>"><?php echo _("Archive"); ?></a></span><?php } ?> 24 <?php if (!preg_match($no_clear_files, $l['filename'])) { ?><span class="commanditem"><a href="<?php echo $app->oHREF('/admin/logs.php?op=clear&log=' . $l['filename']); ?>" onClick="javascript:return confirm('<?php printf(_("Are you sure you want to clear the log file %s? This will empty this file of its contents. This action is not reversible."), $l['filename'])?>')"><?php echo _("Clear"); ?></a></span><?php } ?> 25 <?php if (!preg_match($no_delete_files, $l['filename'])) { ?><span class="commanditem"><a href="<?php echo $app->oHREF('/admin/logs.php?op=delete&log=' . $l['filename']); ?>" onClick="javascript:return confirm('<?php printf(_("Are you sure you want to delete the log file %s? This will remove this log file permanently. This action is not reversible."), $l['filename'])?>')"><?php echo _("Delete"); ?></a></span><?php } ?> 26 26 </td> 27 27 </tr><?php -
trunk/services/templates/login_form.ihtml
r121 r136 1 1 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> 2 <?php App::printHiddenSession() ?>2 <?php $app->printHiddenSession() ?> 3 3 <table> 4 4 <tr> -
trunk/services/templates/password.ihtml
r121 r136 2 2 3 3 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> 4 <?php App::printHiddenSession() ?>4 <?php $app->printHiddenSession() ?> 5 5 <input type="hidden" name="op" value="update_password" /> 6 6 <table> -
trunk/services/templates/versions_diff.ihtml
r124 r136 1 1 <div id="commandbox"> 2 2 <?php if (!getFormData('current', false)) { ?> 3 <span class="sc-nowrap commandtext"><a href="<?php echo App::oHREF($_SERVER['PHP_SELF'] . '?op=restore', array('version_id', 'version_title')); ?>"><?php echo _("Restore this saved version"); ?></a></span>3 <span class="sc-nowrap commandtext"><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=restore', array('version_id', 'version_title')); ?>"><?php echo _("Restore this saved version"); ?></a></span> 4 4 <?php } else { ?> 5 5 <span class="sc-nowrap commandtext"> </span> -
trunk/services/templates/versions_list.ihtml
r124 r136 1 1 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> 2 <?php App::printHiddenSession() ?>2 <?php $app->printHiddenSession() ?> 3 3 <input type="submit" name="op" value="<?php echo _("Cancel"); ?>" /> 4 4 <table class="list" border="0" cellspacing="0" cellpadding="4"> … … 14 14 <tr> 15 15 <?php if ($first) { ?> 16 <td class="sc-padleft sc-nowrap">[<a href="<?php echo App::oHREF($_SERVER['PHP_SELF'] . '?op=view¤t=true&version_id=' . $v['version_id']); ?>">view</a>]</td>16 <td class="sc-padleft sc-nowrap">[<a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=view¤t=true&version_id=' . $v['version_id']); ?>">view</a>]</td> 17 17 <td class="sc-padleft sc-nowrap" colspan="2">(<?php echo _("Current record"); ?>)</td> 18 18 <?php } else { ?> 19 <td class="sc-padleft sc-nowrap">[<a href="<?php echo App::oHREF($_SERVER['PHP_SELF'] . '?op=view&version_id=' . $v['version_id']); ?>">view</a>]</td>20 <td class="sc-padleft sc-nowrap">[<a href="<?php echo App::oHREF($_SERVER['PHP_SELF'] . '?op=diff&version_id=' . $v['version_id']); ?>">diff</a>]</td>21 <td class="sc-padleft sc-nowrap">[<a href="<?php echo App::oHREF($_SERVER['PHP_SELF'] . '?op=restore&version_id=' . $v['version_id']); ?>">restore</a>]</td>19 <td class="sc-padleft sc-nowrap">[<a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=view&version_id=' . $v['version_id']); ?>">view</a>]</td> 20 <td class="sc-padleft sc-nowrap">[<a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=diff&version_id=' . $v['version_id']); ?>">diff</a>]</td> 21 <td class="sc-padleft sc-nowrap">[<a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=restore&version_id=' . $v['version_id']); ?>">restore</a>]</td> 22 22 <?php } ?> 23 23 <td class="sc-padleft sc-nowrap"><?php echo $v['version_id']; ?></td> -
trunk/services/templates/versions_view.ihtml
r121 r136 1 1 <div id="commandbox"> 2 2 <?php if (!getFormData('current', false)) { ?> 3 <span class="sc-nowrap commandtext"><a href="<?php echo App::oHREF($_SERVER['PHP_SELF'] . '?op=restore', array('version_id', 'version_title')); ?>"><?php echo _("Restore this saved version"); ?></a></span>3 <span class="sc-nowrap commandtext"><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=restore', array('version_id', 'version_title')); ?>"><?php echo _("Restore this saved version"); ?></a></span> 4 4 <?php } else { ?> 5 5 <span class="sc-nowrap commandtext"> </span> -
trunk/services/versions.php
r42 r136 8 8 9 9 $auth->requireLogin(); 10 App::sslOn();10 $app->sslOn(); 11 11 12 12 require_once 'codebase/lib/RecordVersion.inc.php'; … … 20 20 21 21 // Query arguments to retain their values between page requests. 22 App::carryQuery('record_table');23 App::carryQuery('record_key');24 App::carryQuery('record_val');25 App::carryQuery('version_title');22 $app->carryQuery('record_table'); 23 $app->carryQuery('record_key'); 24 $app->carryQuery('record_val'); 25 $app->carryQuery('version_title'); 26 26 27 27 // Titles and navigation header. … … 39 39 40 40 if ('' == $version_id && ('' == $record_table || '' == $record_key || '' == $record_val)) { 41 App::raiseMsg(_("Record not specified for versioning."), MSG_WARNING, __FILE__, __LINE__);42 App::logMsg('Record not specified for versioning.', LOG_WARNING, __FILE__, __LINE__);43 App::dieBoomerangURL();41 $app->raiseMsg(_("Record not specified for versioning."), MSG_WARNING, __FILE__, __LINE__); 42 $app->logMsg('Record not specified for versioning.', LOG_WARNING, __FILE__, __LINE__); 43 $app->dieBoomerangURL(); 44 44 } 45 45 46 46 if (getFormData('boomerang', false) && isset($_SERVER['HTTP_REFERER'])) { 47 47 // We remember which page we came from so we can go back there. 48 App::setBoomerangURL($_SERVER['HTTP_REFERER'], 'versions');48 $app->setBoomerangURL($_SERVER['HTTP_REFERER'], 'versions'); 49 49 } 50 50 … … 53 53 54 54 case _("Cancel") : 55 App::dieBoomerangURL('versions', false);55 $app->dieBoomerangURL('versions', false); 56 56 break; 57 57 … … 68 68 $current = $version->getCurrent($record_table, $record_key, $record_val); 69 69 if (serialize($data) == serialize($current)) { 70 App::raiseMsg(sprintf(_("Version <strong>%s</strong> is identical to the current record"), $version_id), MSG_NOTICE, __FILE__, __LINE__);70 $app->raiseMsg(sprintf(_("Version <strong>%s</strong> is identical to the current record"), $version_id), MSG_NOTICE, __FILE__, __LINE__); 71 71 } 72 72 $nav->addPage(sprintf(_("Difference between version %s (%s) and current record."), $version_id, $versionrecord['version_datetime'])); … … 86 86 // Create version of this restored record as the "current" version. 87 87 $version->create($record_table, $record_key, $record_val, $v['version_title']); 88 App::raiseMsg(sprintf(_("The record <strong>%s</strong> has been replaced with <strong>%s</strong> version <strong>%s</strong> from <strong>%s</strong>."), getFormData('version_title'), $v['version_title'], $version_id, $v['version_datetime']), MSG_SUCCESS, __FILE__, __LINE__);89 App::dieBoomerangURL('versions', array('break_list_cache'=>'true', false));88 $app->raiseMsg(sprintf(_("The record <strong>%s</strong> has been replaced with <strong>%s</strong> version <strong>%s</strong> from <strong>%s</strong>."), getFormData('version_title'), $v['version_title'], $version_id, $v['version_datetime']), MSG_SUCCESS, __FILE__, __LINE__); 89 $app->dieBoomerangURL('versions', array('break_list_cache'=>'true', false)); 90 90 } else { 91 App::raiseMsg(_("Version restoration failed."), MSG_ERR, __FILE__, __LINE__);92 App::dieURL($_SERVER['PHP_SELF']);91 $app->raiseMsg(_("Version restoration failed."), MSG_ERR, __FILE__, __LINE__); 92 $app->dieURL($_SERVER['PHP_SELF']); 93 93 } 94 94 break; … … 101 101 $main_template = 'versions_list.ihtml'; 102 102 } else { 103 App::raiseMsg(sprintf(_("No saved versions available for this record"), null), MSG_NOTICE, __FILE__, __LINE__);104 App::dieBoomerangURL('versions');103 $app->raiseMsg(sprintf(_("No saved versions available for this record"), null), MSG_NOTICE, __FILE__, __LINE__); 104 $app->dieBoomerangURL('versions'); 105 105 } 106 106 }
Note: See TracChangeset
for help on using the changeset viewer.