Changeset 42 for trunk/services


Ignore:
Timestamp:
Dec 18, 2005 12:16:03 AM (18 years ago)
Author:
scdev
Message:

detabbed all files ;P

Location:
trunk/services
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/services/admins.php

    r41 r42  
    11<?php
    22/**
    3  * admins.php 
     3 * admins.php
    44 * Code by Strangecode :: www.strangecode.com :: This document contains copyrighted information
    55 */
     
    2323 * CONFIG
    2424 *****************************************************************************/
    25  
     25
    2626// Titles and navigation header.
    2727$nav->addPage(_("Administrators"), $_SERVER['PHP_SELF']);
    28    
     28
    2929// The object to validate form input.
    3030$fv = new FormValidator();
     
    6060 * MAIN
    6161 *****************************************************************************/
    62  
     62
    6363// We may want to use the add/edit interface from another script, so this
    6464// allows us to remember which page we came from so we can go back there.
     
    208208    $fv->isEmpty('username', _("<strong>Username</strong> cannot be blank."));
    209209    $fv->stringLength('username', 0, 255, _("<strong>Username</strong> must contain less than 256 characters."));
    210    
     210
    211211    $fv->isEmpty('userpass', _("<strong>Passwords</strong> cannot be blank."));
    212212    $fv->stringLength('userpass', 6, 36, _("<strong>Passwords</strong> must be between 6 and 36 characters long."));
    213    
     213
    214214    $fv->stringLength('first_name', 0, 255, _("<strong>First name</strong> must contain less than 256 characters."));
    215    
     215
    216216    $fv->stringLength('last_name', 0, 255, _("<strong>Last name</strong> must contain less than 256 characters."));
    217217
     
    219219    $fv->stringLength('email', 0, 255, _("<strong>Email</strong> must contain less than 256 characters."));
    220220    $fv->validateEmail('email');
    221    
     221
    222222    $fv->isEmpty('user_type', _("<strong>User type</strong> cannot be blank."));
    223223    $fv->stringLength('user_type', 0, 255, _("<strong>User type</strong> has an invalid selection."));
     
    265265    // Get the information for the form.
    266266    $qid = DB::query("
    267         SELECT * 
     267        SELECT *
    268268        FROM admin_tbl
    269269        WHERE admin_id = '" . addslashes($id) . "'
     
    274274        App::dieBoomerangURL();
    275275    }
    276    
     276
    277277    // Lock this record.
    278278    $lock->set('admin_tbl', 'admin_id', $id, $frm['username']);
    279    
     279
    280280    // Set misc values for the form.
    281281    $frm = array_merge(array(
     
    312312{
    313313    global $auth, $lock;
    314    
     314
    315315    $lock->select('admin_tbl', 'admin_id', $id);
    316316    if ($lock->isLocked() && !$lock->isMine()) {
     
    320320    // Break the cache because we are changing the list data.
    321321    SessionCache::breakCache($_SERVER['PHP_SELF']);
    322    
     322
    323323    // Get the information for this object.
    324324    $qid = DB::query("
     
    331331        App::dieBoomerangURL();
    332332    }
    333    
     333
    334334    // Get the information for this object.
    335335    $qid = DB::query("SELECT COUNT(*) from admin_tbl");
     
    357357{
    358358    global $auth;
    359    
     359
    360360    // Break the cache because we are changing the list data.
    361361    SessionCache::breakCache($_SERVER['PHP_SELF']);
    362    
     362
    363363    // Insert record data.
    364364    DB::query("
     
    382382    ");
    383383    $last_insert_id = mysql_insert_id(DB::getDBH());
    384    
     384
    385385    // Set admin password.
    386386    $auth->setPassword($last_insert_id, $frm['userpass']);
    387    
     387
    388388    // Create version.
    389389    $version = RecordVersion::getInstance($GLOBALS['auth']);
    390390    $version->create('admin_tbl', 'admin_id', $last_insert_id, $frm['username']);
    391    
     391
    392392    App::raiseMsg(sprintf(_("The Admin <strong>%s</strong> has been added."), $frm['username']), MSG_SUCCESS, __FILE__, __LINE__);
    393    
     393
    394394    return $last_insert_id;
    395395}
     
    398398{
    399399    global $auth, $lock;
    400    
     400
    401401    $lock->select('admin_tbl', 'admin_id', $frm['admin_id']);
    402402    if ($lock->isLocked() && !$lock->isMine()) {
     
    406406    // Break the cache because we are changing the list data.
    407407    SessionCache::breakCache($_SERVER['PHP_SELF']);
    408    
     408
    409409    // If the userpass is left blank or with the filler **** characters, we don't want to update it.
    410410    if (!empty($frm['userpass']) && !preg_match('/[\*]{4,}/', $frm['userpass'])) {
     
    412412        $auth->setPassword($frm['admin_id'], $frm['userpass']);
    413413    }
    414    
     414
    415415    // Update record data.
    416416    DB::query("
     
    440440    global $page;
    441441    global $so;
    442    
     442
    443443    $where_clause = '';
    444    
     444
    445445    // Build search query if available.
    446446    if (getFormData('search_query', false)) {
     
    460460    // Count the total number of records so we can do something about the page numbers.
    461461    $qid = DB::query("
    462         SELECT COUNT(*) 
    463         FROM admin_tbl 
     462        SELECT COUNT(*)
     463        FROM admin_tbl
    464464        $where_clause
    465465    ");
    466466    list($num_results) = mysql_fetch_row($qid);
    467    
     467
    468468    // Set page numbers now we know (needed for next step).
    469469    $page->setTotalItems($num_results);
    470470    $page->calculate();
    471    
     471
    472472    // Final SQL, with sort and page limiters.
    473473    $sql = "
    474         SELECT 
    475             admin_tbl.*, 
     474        SELECT
     475            admin_tbl.*,
    476476            a1.username AS added_admin_username,
    477477            a2.username AS modified_admin_username
     
    483483        " . $page->getLimitSQL() . "
    484484    ";
    485    
     485
    486486    // A unique key for this query, with the total_items in case db records
    487487    // were added since the last cache. This identifies a unique set of
     
    494494        Prefs::setValue('cache_hash', $cache_hash, $_SERVER['PHP_SELF']);
    495495    }
    496    
     496
    497497    if (SessionCache::isCached($_SERVER['PHP_SELF']) && false) {
    498498        // Get the cached results.
     
    505505            $list[] = $row;
    506506        }
    507            
     507
    508508        if (isset($list) && !empty($list)) {
    509509            // Cache the results.
  • trunk/services/css.php

    r41 r42  
    11<?php
    22/**
    3  * css.php 
     3 * css.php
    44 * Code by Strangecode :: www.strangecode.com :: This document contains copyrighted information
    55 *
  • trunk/services/lock.php

    r41 r42  
    11<?php
    22/**
    3  * lock.php 
     3 * lock.php
    44 * Code by Strangecode :: www.strangecode.com :: This document contains copyrighted information
    55 */
  • trunk/services/login.php

    r41 r42  
    11<?php
    22/**
    3  * login.php 
     3 * login.php
    44 * Code by Strangecode :: www.strangecode.com :: This document contains copyrighted information
    55 */
     
    2424    } else {
    2525        App::raiseMsg(_("Login failed, please try again."), MSG_NOTICE, __FILE__, __LINE__);
    26         App::logMsg(sprintf('%s %s failed login using (MD5ed) password: %s', $auth->getVal('auth_name'), $frm['username'], md5($frm['password'])), LOG_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__);
    2727    }
    2828}
  • trunk/services/logout.php

    r41 r42  
    11<?php
    22/**
    3  * logout.php 
     3 * logout.php
    44 * Code by Strangecode :: www.strangecode.com :: This document contains copyrighted information
    55 */
  • trunk/services/logs.php

    r41 r42  
    11<?php
    22/**
    3  * logs.php 
     3 * logs.php
    44 * Code by Strangecode :: www.strangecode.com :: This document contains copyrighted information
    55 */
     
    4848 * MAIN
    4949 *****************************************************************************/
    50  
     50
    5151// Allow realtime file stats.
    52 clearstatcache(); 
     52clearstatcache();
    5353
    5454// What action to take.
     
    6565    App::dieURL($_SERVER['PHP_SELF']);
    6666    break;
    67    
     67
    6868case 'clear' :
    6969//     $auth->requireAccessClearance(ZONE_ADMIN_APPLOG_FUNC_RESET);
     
    7676    App::dieURL($_SERVER['PHP_SELF']);
    7777    break;
    78    
     78
    7979case 'archive' :
    8080//     $auth->requireAccessClearance(ZONE_ADMIN_APPLOG_FUNC_RESET);
     
    9090    App::dieURL($_SERVER['PHP_SELF']);
    9191    break;
    92    
     92
    9393// case 'ouput' :
    9494//     $main_template = 'ouput';
    9595//     break;
    96    
     96
    9797case 'download' :
    9898    header('Content-Type: application/octet-stream');
     
    101101    die;
    102102    break;
    103    
     103
    104104default :
    105105    $list =& getLog(Prefs::getValue('log_file', 'logs_module'), getFormData('search_query'));
     
    137137
    138138function deleteLog($log_file)
    139 {   
     139{
    140140    if (!file_exists(App::getParam('log_directory') . '/' . $log_file)) {
    141141        App::raiseMsg(sprintf(_("Log file %s does not exist."), $log_file), MSG_NOTICE, __FILE__, __LINE__);
     
    143143        return false;
    144144    }
    145    
     145
    146146    if (!is_writable(App::getParam('log_directory') . '/' . $log_file) && !is_writable(App::getParam('log_directory'))) {
    147147        App::raiseMsg(sprintf(_("Log file %s could not be deleted."), $log_file), MSG_NOTICE, __FILE__, __LINE__);
     
    149149        return false;
    150150    }
    151    
     151
    152152    if (unlink(App::getParam('log_directory') . '/' . $log_file)) {
    153153        App::raiseMsg(sprintf(_("Log file %s has been deleted."), $log_file), MSG_NOTICE, __FILE__, __LINE__);
     
    162162
    163163function clearLog($log_file)
    164 {   
     164{
    165165    if (!$fp = fopen(App::getParam('log_directory') . '/' . $log_file, 'r+')) {
    166166        App::raiseMsg(sprintf(_("Log file %s could not be opened."), $log_file), MSG_NOTICE, __FILE__, __LINE__);
     
    168168        return false;
    169169    }
    170    
     170
    171171    flock($fp, LOCK_EX);
    172172    $ftruncate_return = ftruncate($fp, 0);
     
    185185
    186186function archiveLog($log_file)
    187 {   
     187{
    188188    $old_file_name = $log_file;
    189189    $new_file_name = $log_file . '__' . date('Y-m-d');
     
    198198        return false;
    199199    }
    200    
     200
    201201    App::raiseMsg(sprintf(_("Log file %s has been archived to %s."), $old_file_name, $new_file_name), MSG_NOTICE, __FILE__, __LINE__);
    202202    App::logMsg(sprintf('Log file %s has been archived to %s.', $old_file_name, $new_file_name), LOG_NOTICE, __FILE__, __LINE__);
     
    205205
    206206function printLog($log_file)
    207 {       
     207{
    208208    if (!is_file(App::getParam('log_directory') . '/' . $log_file)) {
    209209        App::raiseMsg(sprintf(_("Log file %s not found."), $log_file), MSG_WARNING, __FILE__, __LINE__);
     
    216216
    217217function &getLog($log_file, $search_query='')
    218 {   
     218{
    219219    if (!is_file(App::getParam('log_directory') . '/' . $log_file)) {
    220220        App::raiseMsg(sprintf(_("Log file %s not found."), $log_file), MSG_WARNING, __FILE__, __LINE__);
     
    223223    }
    224224    $log = file(App::getParam('log_directory') . '/' . $log_file);
    225    
     225
    226226    if ('' != trim($search_query)) {
    227227        if (getFormData('search_grep')) {
     
    237237{
    238238    global $valid_file_extensions;
    239    
     239
    240240    // Get a list of all files in the log directory.
    241241    $dir_handle = opendir(App::getParam('log_directory'));
  • trunk/services/password.php

    r41 r42  
    11<?php
    22/**
    3  * password.php 
     3 * password.php
    44 * Code by Strangecode :: www.strangecode.com :: This document contains copyrighted information
    55 */
     
    1414 * CODE CONFIG
    1515 *****************************************************************************/
    16    
     16
    1717// Titles and navigation header.
    1818$nav->addPage(_("Change password"));
     
    4747        }
    4848    }
    49    
     49
    5050    if (!$fv->anyErrors() && false === $auth->authenticate($auth->getVal('username'), $frm['oldpassword'])) {
    5151        $fv->addError('oldpassword', _("Your <strong>Old password</strong> failed authentication."));
  • trunk/services/templates/admin_list.ihtml

    r41 r42  
    66    <span class="nowrap commandtext"><a href="<?php echo App::oHREF($_SERVER['PHP_SELF'] . '?op=add'); ?>"><?php echo _("Add administrator"); ?></a></span>
    77    <br />
    8    
     8
    99    <input type="text" class="small" size="20" name="search_query" value="<?php echo getFormData('search_query'); ?>" title="<?php echo oTxt(_("Fields searched: Admin id, Username, Userpass, First name, Last name, Email, User type, Login abuse exempt, Blocked, Blocked reason, Abuse warning level, Seconds online, Last login datetime, Last access datetime, Last login ip, Added by user id, Modified by user id, Added datetime, Modified datetime.")); ?>" />
    1010    <input type="submit" value="<?php echo _("Search"); ?>" />
  • trunk/services/templates/list_info.ihtml

    r41 r42  
    44    <?php } ?>
    55    <span class="nowrap commanditem commandtext">
    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) ?> 
     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) ?>
    77        &nbsp;&nbsp; <a href="<?php echo App::oHREF($_SERVER['PHP_SELF'], false); ?>"><?php echo _("List all"); ?></a>
    88        &nbsp;&nbsp; <?php echo _("Per page"); ?>:&nbsp;<?php $page->printPerPageLinks() ?>
  • trunk/services/templates/lock.ihtml

    r41 r42  
    1 <?php 
     1<?php
    22if (!is_a($lock, 'RecordLock')) {
    33    return null;
     
    99
    1010    <p><?php
    11     printf(_("The record <strong>%s</strong> is currently being edited by <strong>%s</strong> (%d minutes elapsed). You cannot modify the record while it is locked by another user."), 
    12         $lock->getTitle(), 
    13         $lock->getEditor(), 
     11    printf(_("The record <strong>%s</strong> is currently being edited by <strong>%s</strong> (%d minutes elapsed). You cannot modify the record while it is locked by another user."),
     12        $lock->getTitle(),
     13        $lock->getEditor(),
    1414        date('i', $lock->getSecondsElapsed() + 60)
    1515    );
  • trunk/services/templates/versions_diff.ihtml

    r41 r42  
    1 <div id="commandbox">               
     1<div id="commandbox">
    22<?php if (!getFormData('current', false)) { ?>
    33    <span class="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>
  • trunk/services/templates/versions_list.ihtml

    r41 r42  
    99    <th class="padleft"><?php echo _("By"); ?></th>
    1010</tr>
    11 <?php 
     11<?php
    1212$first = true;
    1313foreach ($versions as $v) { ?>
     
    2525    <td class="padleft nowrap"><?php echo $v['editor']; ?></td>
    2626</tr>
    27 <?php 
     27<?php
    2828$first = false;
    29 } 
     29}
    3030?>
    3131</table>
  • trunk/services/templates/versions_view.ihtml

    r41 r42  
    1 <div id="commandbox">               
     1<div id="commandbox">
    22<?php if (!getFormData('current', false)) { ?>
    33    <span class="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>
     
    1010<table class="list" border="0" cellspacing="0" cellpadding="4">
    1111<?php
    12 while ((list($k, $v_d) = each($data))) { 
     12while ((list($k, $v_d) = each($data))) {
    1313    ?>
    1414    <tr>
  • trunk/services/versions.php

    r41 r42  
    11<?php
    22/**
    3  * versions.php 
     3 * versions.php
    44 * Code by Strangecode :: www.strangecode.com :: This document contains copyrighted information
    55 */
     
    110110 * TEMPLATE INITIALIZATION
    111111 *****************************************************************************/
    112  
     112
    113113include 'header.ihtml';
    114114include 'codebase/services/templates/' . $main_template;
Note: See TracChangeset for help on using the changeset viewer.