Changeset 497


Ignore:
Timestamp:
Sep 15, 2014 9:44:27 PM (10 years ago)
Author:
anonymous
Message:

Beginning the process of adapting codebase to foundation styles.

Location:
trunk
Files:
1 added
29 edited

Legend:

Unmodified
Added
Removed
  • trunk/js/Msg.js

    r496 r497  
    1818*/
    1919
    20 // All Codebase functions will be under the Strangecode namespace.
     20// Codebase functions will be under the Strangecode namespace, unless they are added to the jQuery object for chaining.
    2121var Strangecode = Strangecode || {};
    2222
     
    3838var sc_msg = new Strangecode.Msg({
    3939    container: '#sc-msg-formvalidator',
    40     above_msg: 'The following errors occured:'
     40    above_msg: 'The following errors occurred:'
    4141});
    4242sc_msg.raise('Oops, you fuxt up!', 'sc-msg-error');
  • trunk/js/Utilities.js

    r496 r497  
    1818*/
    1919
    20 // All Codebase functions will be under the Strangecode namespace.
     20// Codebase functions will be under the Strangecode namespace, unless they are added to the jQuery object for chaining.
    2121var Strangecode = Strangecode || {};
    2222
     
    6868    });
    6969};
     70
     71/*
     72* Encode HTML by proxying content via an in-memory div, setting its inner text which jQuery automatically encodes.
     73Then we pull the encoded contents back out. The div never exists on the page.
     74---------------------------------------------------------------------
     75$('select').append($('<option>', {
     76    value: value,
     77    text: htmlEncode(text)
     78}));
     79---------------------------------------------------------------------
     80*
     81* @access   public
     82* @version  1.0
     83* @since    30 Jun 2013
     84*/
     85Strangecode.htmlEncode = function(text) {
     86    return $('<div/>').text(text).html();
     87};
     88jQuery.fn.htmlEncode = Strangecode.htmlEncode;
  • trunk/lib/App.inc.php

    r492 r497  
    537537                switch ($m['type']) {
    538538                case MSG_ERR:
    539                     echo '<div class="sc-msg-error">' . $m['message'] . '</div>';
     539                    echo '<div data-alert class="sc-msg-error alert-box alert">' . $m['message'] . '<a href="#" class="close">&times;</a></div>';
    540540                    break;
    541541
    542542                case MSG_WARNING:
    543                     echo '<div class="sc-msg-warning">' . $m['message'] . '</div>';
     543                    echo '<div data-alert class="sc-msg-warning alert-box warning">' . $m['message'] . '<a href="#" class="close">&times;</a></div>';
    544544                    break;
    545545
    546546                case MSG_SUCCESS:
    547                     echo '<div class="sc-msg-success">' . $m['message'] . '</div>';
     547                    echo '<div data-alert class="sc-msg-success alert-box success">' . $m['message'] . '<a href="#" class="close">&times;</a></div>';
    548548                    break;
    549549
    550550                case MSG_NOTICE:
    551551                default:
    552                     echo '<div class="sc-msg-notice">' . $m['message'] . '</div>';
     552                    echo '<div data-alert class="sc-msg-notice alert-box info">' . $m['message'] . '<a href="#" class="close">&times;</a></div>';
    553553                    break;
    554 
    555554                }
    556555            }
  • trunk/lib/Auth_SQL.inc.php

    r484 r497  
    471471         * (2) If this number exceeds the login_abuse_max_ips, assume multiple people are logging in under the same account.
    472472        **/
     473        // TODO: make this ipv6 compatible. At the moment, ipv6 addresses are converted into zero for remote_ip_binary.
     474        // http://www.highonphp.com/5-tips-for-working-with-ipv6-in-php
     475        // https://stackoverflow.com/questions/444966/working-with-ipv6-addresses-in-php
    473476        if ($this->getParam('abuse_detection') && !$this->get('login_abuse_exempt')) {
    474477            $qid = $db->query("
  • trunk/lib/DB.inc.php

    r484 r497  
    441441    }
    442442
     443    /**
     444     * Returns the values of an ENUM or SET column, returning them as an array.
     445     *
     446     * @param  string $db_table   database table to lookup
     447     * @param  string $db_col     database column to lookup
     448     * @param  bool   $sort          Sort the output.
     449     * @return array    Array of the set/enum values on success, false on failure.
     450     */
     451    public function getEnumValues($db_table, $db_col, $sort=false)
     452    {
     453        $app =& App::getInstance();
     454
     455        $qid = $this->query("SHOW COLUMNS FROM " . $this->escapeString($db_table) . " LIKE '" . $this->escapeString($db_col) . "'", false);
     456
     457        $row = mysql_fetch_row($qid);
     458        if (preg_match('/^enum|^set/i', $row[1]) && preg_match_all("/'([^']*)'/", $row[1], $matches)) {
     459            if ($sort) {
     460                natsort($matches[1]);
     461            }
     462            return $matches[1];
     463        } else {
     464            $app->logMsg(sprintf('No set or enum fields found in %s.%s', $db_table, $db_col), LOG_ERR, __FILE__, __LINE__);
     465            return false;
     466        }
     467    }
     468
     469
    443470} // End.
    444471
  • trunk/lib/FormValidator.inc.php

    r494 r497  
    209209                    switch ($e['type']) {
    210210                    case MSG_ERR:
    211                         echo '<div class="sc-msg-error">' . $e['message'] . '</div>';
     211                        echo '<div data-alert class="sc-msg-error alert-box alert">' . $e['message'] . '<a href="#" class="close">&times;</a></div>';
    212212                        break;
    213213
    214214                    case MSG_WARNING:
    215                         echo '<div class="sc-msg-warning">' . $e['message'] . '</div>';
     215                        echo '<div data-alert class="sc-msg-warning alert-box warning">' . $e['message'] . '<a href="#" class="close">&times;</a></div>';
    216216                        break;
    217217
    218218                    case MSG_SUCCESS:
    219                         echo '<div class="sc-msg-success">' . $e['message'] . '</div>';
     219                        echo '<div data-alert class="sc-msg-success alert-box alert">' . $e['message'] . '<a href="#" class="close">&times;</a></div>';
    220220                        break;
    221221
    222222                    case MSG_NOTICE:
    223223                    default:
    224                         echo '<div class="sc-msg-notice">' . $e['message'] . '</div>';
     224                        echo '<div data-alert class="sc-msg-notice alert-box info">' . $e['message'] . '<a href="#" class="close">&times;</a></div>';
    225225                        break;
    226226                    }
     
    304304    public function isEmpty($form_name, $msg='')
    305305    {
    306         $this->notEmpty($form_name, $msg);
     306        return $this->notEmpty($form_name, $msg);
    307307    }
    308308
  • trunk/lib/Lock.inc.php

    r484 r497  
    384384    {
    385385        $app =& App::getInstance();
    386 
    387386        ?>
    388387        <form method="post" action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>">
  • trunk/lib/Navigation.inc.php

    r485 r497  
    254254                        // A crumb with no link.
    255255                        $breadcrumbs[] = array(
    256                             'url' => false,
    257                             'title' => sprintf($this->getParam('last_crumb_format'), $page['title'])
     256                            'url' => $_SERVER['REQUEST_URI'],
     257                            'title' => sprintf($this->getParam('last_crumb_format'), $page['title']),
     258                            'class' => 'current'
    258259                        );
    259260                    } else if ($crumb_count > $this->getParam('chop_breadcrumb_links')) {
     
    261262                        $breadcrumbs[] = array(
    262263                            'url' => $page['url'],
    263                             'title' => sprintf($this->getParam('last_crumb_format'), $page['title'])
     264                            'title' => sprintf($this->getParam('last_crumb_format'), $page['title']),
     265                            'class' => '',
    264266                        );
    265267                    }
     
    269271                        $breadcrumbs[] = array(
    270272                            'url' => false,
    271                             'title' => $page['title']
     273                            'title' => $page['title'],
     274                            'class' => 'unavailable',
    272275                        );
    273276                    } else {
     
    275278                        $breadcrumbs[] = array(
    276279                            'url' => $page['url'],
    277                             'title' => $page['title']
     280                            'title' => $page['title'],
     281                            'class' => '',
    278282                        );
    279283                    }
     
    334338    }
    335339
     340    /*
     341    *
     342    *
     343    * @access   public
     344    * @param
     345    * @return
     346    * @author   Quinn Comendant <quinn@strangecode.com>
     347    * @version  1.0
     348    * @since    07 Sep 2014 12:22:19
     349    */
     350    public function getBreadcrumbsUL()
     351    {
     352        $breadcrumbs = $this->getBreadcrumbsArray();
     353        if (!empty($breadcrumbs)) {
     354            ?><ul class="breadcrumbs"><?php
     355            foreach ($breadcrumbs as $b) {
     356                $printclass = '' != $b['class'] ? sprintf(' class="%s"', $b['class']) : '';
     357                printf('<li%s><a href="%s">%s</a></li>', $printclass, $b['url'], $b['title']);
     358            }
     359            ?></ul><?php
     360        }
     361        unset($key, $value);
     362    }
     363
    336364    /**
    337365     * Test if the given URI matches the URL of the current page. By default the URI is tested
  • trunk/lib/SortOrder.inc.php

    r484 r497  
    212212            if ($this->sort_by == $col) {
    213213                if (mb_strtolower($this->order) == 'desc') {
    214                     ?><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?sort=' . $col . '&order=ASC'); ?>" title="<?php echo _("Change to ascending sort order"); ?>"><?php echo $this->desc_widget; ?></a><?php echo $col_name; ?><?php
     214                    ?><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?sort=' . $col . '&order=ASC'); ?>" title="<?php echo _("Change to ascending sort order"); ?>" class="sc-sort sc-desc"><?php echo $this->desc_widget; ?></a><?php echo $col_name; ?><?php
    215215                } else {
    216                     ?><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?sort=' . $col . '&order=DESC'); ?>" title="<?php echo _("Change to descending sort order"); ?>"><?php echo $this->asc_widget; ?></a><?php echo $col_name; ?><?php
     216                    ?><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?sort=' . $col . '&order=DESC'); ?>" title="<?php echo _("Change to descending sort order"); ?>" class="sc-sort sc-asc"><?php echo $this->asc_widget; ?></a><?php echo $col_name; ?><?php
    217217                }
    218218            } else {
    219                 ?><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?sort=' . $col . '&order=' . $default_order); ?>" title="<?php echo sprintf(_("Sort by %s"), $col_name); ?>"><?php echo $col_name; ?></a><?php
     219                ?><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?sort=' . $col . '&order=' . $default_order); ?>" title="<?php echo sprintf(_("Sort by %s"), $col_name); ?>" class="sc-sort"><?php echo $col_name; ?></a><?php
    220220            }
    221221        } else {
  • trunk/lib/Utilities.inc.php

    r487 r497  
    10821082}
    10831083
    1084 /**
    1085  * Returns the remote IP address, taking into consideration proxy servers.
    1086  *
    1087  * @param  bool $dolookup   If true we resolve to IP to a host name,
    1088  *                          if false we don't.
    1089  * @return string    IP address if $dolookup is false or no arg
    1090  *                   Hostname if $dolookup is true
    1091  */
    1092 function getRemoteAddr($dolookup=false)
    1093 {
    1094     $ip = getenv('HTTP_CLIENT_IP');
    1095     if (in_array($ip, array('', 'unknown', 'localhost', '127.0.0.1'))) {
    1096         $ip = getenv('HTTP_X_FORWARDED_FOR');
    1097         if (mb_strpos($ip, ',') !== false) {
    1098             // If HTTP_X_FORWARDED_FOR returns a comma-delimited list of IPs then return the first one (assuming the first is the original).
    1099             $ips = explode(',', $ip, 2);
    1100             $ip = $ips[0];
    1101         }
    1102         if (in_array($ip, array('', 'unknown', 'localhost', '127.0.0.1'))) {
    1103             $ip = getenv('REMOTE_ADDR');
    1104         }
    1105     }
    1106     return $dolookup && '' != $ip ? gethostbyaddr($ip) : $ip;
     1084/*
     1085* Returns the remote IP address, taking into consideration proxy servers.
     1086*
     1087* If strict checking is enabled, we will only trust REMOTE_ADDR or an HTTP header
     1088* value if REMOTE_ADDR is a trusted proxy (configured as an array in $cfg['trusted_proxies']).
     1089*
     1090* @access   public
     1091* @param    bool $dolookup            Resolve to IP to a hostname?
     1092* @param    bool $trust_all_proxies   Should we trust any IP address set in HTTP_* variables? Set to FALSE for secure usage.
     1093* @return   mixed Canonicalized IP address (or a corresponding hostname if $dolookup is true), or false if no IP was found.
     1094* @author   Alix Axel <http://stackoverflow.com/a/2031935/277303>
     1095* @author   Corey Ballou <http://blackbe.lt/advanced-method-to-obtain-the-client-ip-in-php/>
     1096* @author   Quinn Comendant <quinn@strangecode.com>
     1097* @version  1.0
     1098* @since    12 Sep 2014 19:07:46
     1099*/
     1100function getRemoteAddr($dolookup=false, $trust_all_proxies=true)
     1101{
     1102    global $cfg;
     1103
     1104    if (!isset($_SERVER['REMOTE_ADDR'])) {
     1105        // Must be a CLI.
     1106        return false;
     1107    }
     1108
     1109    // Use an HTTP header value only if $trust_all_proxies is true or when REMOTE_ADDR is in our $cfg['trusted_proxies'] array.
     1110    // $cfg['trusted_proxies'] is an array of proxy server addresses we expect to see in REMOTE_ADDR.
     1111    if ($trust_all_proxies || isset($cfg['trusted_proxies']) && is_array($cfg['trusted_proxies']) && in_array($_SERVER['REMOTE_ADDR'], $cfg['trusted_proxies'], true)) {
     1112        // Then it's probably safe to use an IP address value set in an HTTP header.
     1113        // Loop through possible IP address headers.
     1114        foreach (array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED') as $key) {
     1115            // Loop through and if
     1116            if (array_key_exists($key, $_SERVER)) {
     1117                foreach (explode(',', $_SERVER[$key]) as $addr) {
     1118                    $addr = canonicalIPAddr(trim($addr));
     1119                    if (false !== filter_var($addr, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
     1120                        return $dolookup && '' != $addr ? gethostbyaddr($addr) : $addr;
     1121                    }
     1122                }
     1123            }
     1124        }
     1125    }
     1126
     1127    $addr = canonicalIPAddr(trim($_SERVER['REMOTE_ADDR']));
     1128    return $dolookup && $addr ? gethostbyaddr($addr) : $addr;
     1129}
     1130
     1131/*
     1132* Converts an ipv4 IP address in hexadecimal form into canonical form (i.e., it removes the prefix).
     1133*
     1134* @access   public
     1135* @param    string  $addr   IP address.
     1136* @return   string          Canonical IP address.
     1137* @author   Sander Steffann <http://stackoverflow.com/a/12436099/277303>
     1138* @author   Quinn Comendant <quinn@strangecode.com>
     1139* @version  1.0
     1140* @since    15 Sep 2012
     1141*/
     1142function canonicalIPAddr($addr)
     1143{
     1144    // Known prefix
     1145    $v4mapped_prefix_bin = pack('H*', '00000000000000000000ffff');
     1146
     1147    // Parse
     1148    $addr_bin = inet_pton($addr);
     1149
     1150    // Check prefix
     1151    if (substr($addr_bin, 0, strlen($v4mapped_prefix_bin)) == $v4mapped_prefix_bin) {
     1152        // Strip prefix
     1153        echo 'prefix matches';
     1154        $addr_bin = substr($addr_bin, strlen($v4mapped_prefix_bin));
     1155    }
     1156
     1157    // Convert back to printable address in canonical form
     1158    return inet_ntop($addr_bin);
    11071159}
    11081160
     
    11171169 * @return  mixed   Returns the network that matched on success, false on failure.
    11181170 */
    1119 function ipInRange($ip, $networks)
     1171function ipInRange($addr, $networks)
    11201172{
    11211173    if (!is_array($networks)) {
     
    11231175    }
    11241176
    1125     $ip_binary = sprintf('%032b', ip2long($ip));
     1177    $addr_binary = sprintf('%032b', ip2long($addr));
    11261178    foreach ($networks as $network) {
    11271179        if (preg_match('![\d\.]{7,15}/\d{1,2}!', $network)) {
     
    11291181            list($cidr_ip, $cidr_bitmask) = explode('/', $network);
    11301182            $cidr_ip_binary = sprintf('%032b', ip2long($cidr_ip));
    1131             if (mb_substr($ip_binary, 0, $cidr_bitmask) === mb_substr($cidr_ip_binary, 0, $cidr_bitmask)) {
     1183            if (mb_substr($addr_binary, 0, $cidr_bitmask) === mb_substr($cidr_ip_binary, 0, $cidr_bitmask)) {
    11321184               // IP address is within the specified IP range.
    11331185               return $network;
    11341186            }
    11351187        } else {
    1136             if ($ip === $network) {
     1188            if ($addr === $network) {
    11371189               // IP address exactly matches.
    11381190               return $network;
  • trunk/lib/Version.inc.php

    r484 r497  
    266266        ");
    267267        if (!$record = mysql_fetch_assoc($qid)) {
    268             $app->raiseMsg(sprintf(_("Version ID %s%s not found."), $version_id, (empty($record['version_title']) ? '' : ' (' . $record['version_title'] . ')')), MSG_WARNING, __FILE__, __LINE__);
    269             $app->logMsg(sprintf('Version ID %s%s not found.', $version_id, (empty($record['version_title']) ? '' : ' (' . $record['version_title'] . ')')), LOG_WARNING, __FILE__, __LINE__);
     268            $app->raiseMsg(sprintf(_("Version %s%s not found."), $version_id, (empty($record['version_title']) ? '' : ' (' . $record['version_title'] . ')')), MSG_WARNING, __FILE__, __LINE__);
     269            $app->logMsg(sprintf('Version %s%s not found.', $version_id, (empty($record['version_title']) ? '' : ' (' . $record['version_title'] . ')')), LOG_WARNING, __FILE__, __LINE__);
    270270            return false;
    271271        }
     
    274274        // Ensure saved db columns match current table schema.
    275275        if (!$db->columnExists($record['record_table'], array_keys($data), $this->getParam('db_schema_strict'))) {
    276             $app->raiseMsg(sprintf(_("Version ID %s%s is not compatible with the current database table."), $version_id, (empty($record['version_title']) ? '' : ' (' . $record['version_title'] . ')')), MSG_ERR, __FILE__, __LINE__);
    277             $app->logMsg(sprintf('Version ID %s%s restoration failed, DB schema does not match for table %s.', $version_id, (empty($record['version_title']) ? '' : ' (' . $record['version_title'] . ')'), $record['record_table']), LOG_ALERT, __FILE__, __LINE__);
     276            $app->raiseMsg(sprintf(_("Version %s%s is not compatible with the current database table."), $version_id, (empty($record['version_title']) ? '' : ' (' . $record['version_title'] . ')')), MSG_ERR, __FILE__, __LINE__);
     277            $app->logMsg(sprintf('Version %s%s restoration failed, DB schema does not match for table %s.', $version_id, (empty($record['version_title']) ? '' : ' (' . $record['version_title'] . ')'), $record['record_table']), LOG_ALERT, __FILE__, __LINE__);
    278278            return false;
    279279        }
  • trunk/services/admins.php

    r479 r497  
    3434require_once 'codebase/lib/FormValidator.inc.php';
    3535require_once 'codebase/lib/SortOrder.inc.php';
    36 require_once 'codebase/lib/TemplateGlue.inc.php';
     36require_once 'codebase/lib/HTML.inc.php';
    3737require_once 'codebase/lib/Prefs.inc.php';
    3838require_once 'codebase/lib/Lock.inc.php';
     
    229229    }
    230230
    231     $fv->numericRange('admin_id', -32768, 32767, _("<strong>Admin id</strong> must be a valid number between -32768 and 32767."));
     231    $fv->numericRange('admin_id', 0, 32767, _("<strong>Admin id</strong> must be a valid number between 0 and 32767."));
    232232
    233233    $fv->isEmpty('username', _("<strong>Username</strong> cannot be blank."));
     
    235235
    236236    $fv->isEmpty('userpass', _("<strong>Passwords</strong> cannot be blank."));
    237     $fv->stringLength('userpass', 6, 36, _("<strong>Passwords</strong> must be between 6 and 36 characters long."));
     237    $fv->stringLength('userpass', 8, 36, _("<strong>Passwords</strong> must be between 8 and 36 characters long."));
    238238
    239239    $fv->stringLength('first_name', 0, 255, _("<strong>First name</strong> must contain less than 256 characters."));
     
    242242
    243243    $fv->isEmpty('email', _("<strong>Email</strong> cannot be blank."));
    244     $fv->stringLength('email', 0, 255, _("<strong>Email</strong> must contain less than 256 characters."));
    245244    $fv->validateEmail('email');
    246245}
     
    267266        'new_op' => 'insert',
    268267        'submit_buttons' => array(
    269             'submit' => _("Add Administrator"),
    270             'repeat' => _("Add &amp; repeat"),
    271             'cancel' => _("Cancel"),
     268            array('name' => 'submit', 'value' => _("Add Administrator"), 'class' => 'small button', 'accesskey' => 's'),
     269            array('name' => 'repeat', 'value' => _("Add &amp; repeat"), 'class' => 'small button secondary', 'accesskey' => 'r'),
     270            array('name' => 'cancel', 'value' => _("Cancel"), 'class' => 'small button secondary', 'accesskey' => 'c'),
    272271        ),
    273272    );
     
    280279    global $auth;
    281280    global $lock;
     281    global $locally_carried_queries;
    282282    $app =& App::getInstance();
    283283    $db =& DB::getInstance();
     
    324324        'old_username' => $frm['username'],
    325325        'submit_buttons' => array(
    326             'submit' => _("Save changes"),
    327             'repeat' => _("Save &amp; edit next"),
    328             'reset' => _("Reset"),
    329             'cancel' => _("Cancel"),
     326            array('name' => 'submit', 'value' => _("Save changes"), 'class' => 'small button', 'accesskey' => 's'),
     327            array('name' => 'repeat', 'value' => _("Save & edit next"), 'class' => 'small button secondary', 'accesskey' => 'e'),
     328            array('name' => 'reset', 'value' => _("Reset"), 'class' => 'small button secondary', 'accesskey' => 'r'),
     329            array('name' => 'cancel', 'value' => _("Cancel"), 'class' => 'small button secondary', 'accesskey' => 'c'),
    330330        ),
    331     ), $frm, array('userpass' => '****************'));
     331    ), $frm, array('userpass' => '•••••••••••••••'));
    332332
    333333    return $frm;
     
    339339    global $lock;
    340340    global $cache;
     341    global $locally_carried_queries;
    341342    $app =& App::getInstance();
    342343    $db =& DB::getInstance();
     
    367368    if ($num_admins <= 1) {
    368369        // There must always be at least one admnistrator!
    369         $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__);
     370        $app->raiseMsg(_("You cannot delete the only user in the database. There must be at least one to log in and create other users."), MSG_NOTICE, __FILE__, __LINE__);
    370371    } else if ($auth->get('user_id') == $id) {
    371372        // Do not delete yourself!
     
    418419    $version->create($auth->getParam('db_table'), $auth->getParam('db_primary_key'), $last_insert_id, $frm['username']);
    419420
    420     $app->raiseMsg(sprintf(_("The Administrator <em>%s</em> has been added."), $frm['username']), MSG_SUCCESS, __FILE__, __LINE__);
     421    $app->raiseMsg(sprintf(_("The user <em>%s</em> has been added."), $frm['username']), MSG_SUCCESS, __FILE__, __LINE__);
    421422
    422423    return $last_insert_id;
     
    461462    $version->create($auth->getParam('db_table'), $auth->getParam('db_primary_key'), $frm['admin_id'], $frm['username']);
    462463
    463     $app->raiseMsg(sprintf(_("The Administrator <em>%s</em> has been updated."), $frm['username']), MSG_SUCCESS, __FILE__, __LINE__);
     464    $app->raiseMsg(sprintf(_("The user <em>%s</em> has been updated."), $frm['username']), MSG_SUCCESS, __FILE__, __LINE__);
    464465
    465466    // Unlock record.
  • trunk/services/lock.php

    r468 r497  
    2525 */
    2626
    27 // require_once dirname(__FILE__) . '/_config.inc.php';
     27// Redefine include_path including the codebase/services but allow local templates override global ones.
     28ini_set('include_path', join(PATH_SEPARATOR, array(
     29    get_include_path(),
     30    dirname(__FILE__) . '/templates'
     31)));
     32
    2833require_once 'codebase/lib/Lock.inc.php';
     34require_once 'codebase/lib/HTML.inc.php';
    2935
    3036$app->sslOn();
     
    6672// Templates.
    6773include 'header.ihtml';
    68 $lock->printErrorHTML();
     74// $lock->printErrorHTML();
     75include 'lock.ihtml';
    6976include 'footer.ihtml';
    7077
  • trunk/services/login.php

    r477 r497  
    2424 * login.php
    2525 */
     26
     27// Redefine include_path including the codebase/services but allow local templates override global ones.
     28ini_set('include_path', join(PATH_SEPARATOR, array(
     29    get_include_path(),
     30    dirname(__FILE__) . '/templates'
     31)));
    2632
    2733// We may want to use the add/edit interface from another script, so this
     
    6470// Templates.
    6571include 'header.ihtml';
    66 include 'codebase/services/templates/login_form.ihtml';
     72include 'login_form.ihtml';
    6773include 'footer.ihtml';
    6874
  • trunk/services/logs.php

    r479 r497  
    2525 */
    2626
    27 // require_once dirname(__FILE__) . '/_config.inc.php';
     27// Redefine include_path including the codebase/services but allow local templates override global ones.
     28ini_set('include_path', join(PATH_SEPARATOR, array(
     29    get_include_path(),
     30    dirname(__FILE__) . '/templates'
     31)));
    2832
    2933$app->sslOn();
     
    6771
    6872// Titles and navigation header.
    69 $nav->add(sprintf(_("Viewing log: <em>%s</em>"), $tmp_prefs->get('log_file')), '/admin/logs.php');
     73$nav->add(sprintf(_("Viewing <em>%s</em>"), $tmp_prefs->get('log_file')), '/admin/logs.php');
    7074
    7175/********************************************************************
     
    148152    printLog($tmp_prefs->get('log_file'));
    149153} else {
    150     include 'codebase/services/templates/' . $main_template;
     154    include $main_template;
    151155}
    152156include 'footer.ihtml';
  • trunk/services/password.php

    r468 r497  
    44 * For details visit the project site: <http://trac.strangecode.com/codebase/>
    55 * Copyright 2001-2012 Strangecode, LLC
    6  * 
     6 *
    77 * This file is part of The Strangecode Codebase.
    88 *
     
    1111 * Free Software Foundation, either version 3 of the License, or (at your option)
    1212 * any later version.
    13  * 
     13 *
    1414 * The Strangecode Codebase is distributed in the hope that it will be useful, but
    1515 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1616 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    1717 * details.
    18  * 
     18 *
    1919 * You should have received a copy of the GNU General Public License along with
    2020 * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
     
    2525 */
    2626
    27 // require_once dirname(__FILE__) . '/_config.inc.php';
     27// Redefine include_path including the codebase/services but allow local templates override global ones.
     28ini_set('include_path', join(PATH_SEPARATOR, array(
     29    get_include_path(),
     30    dirname(__FILE__) . '/templates'
     31)));
    2832
    2933$auth->requireLogin();
    3034
    3135require_once 'codebase/lib/FormValidator.inc.php';
     36require_once 'codebase/lib/HTML.inc.php';
    3237
    3338/******************************************************************************
     
    3641
    3742// Titles and navigation header.
    38 $nav->add(_("Change password"));
     43$nav->add(sprintf(_("Change password for <em>%s</em>"), $auth->get('username')));
    3944
    4045// The object to validate form input from the user.
     
    5863
    5964    // Validate the posted data.
    60 //  $fv->isEmpty('oldpassword', _("You did not specify the <strong>old password</strong>."));
    61     $fv->checkRegex('oldpassword', '/^[[:alnum:][:punct:]]{0,128}$/i', true, _("The <strong>Old password</strong> specified is not valid."));
    62     if (!$fv->isEmpty('newpassword', _("You did not specify the <strong>New password</strong>."))) {
    63         $fv->checkRegex('newpassword', '/^[[:alnum:][:punct:]]{6,128}$/i', true, _("The <strong>New password</strong> specified is not valid. A password must be 6 or more characters."));
    64         if ($frm['newpassword'] != $frm['newpassword2'] && !$fv->isEmpty('newpassword2', _("You need to type the <strong>New password</strong> twice."))) {
    65             $fv->addError('newpassword', _("The <strong>New passwords</strong> do not match."));
    66             $fv->addError('newpassword2');
     65    if ($fv->notEmpty('oldpassword', _("You did not specify the <strong>old password</strong>."))) {
     66        $fv->checkRegex('oldpassword', '/^\S{0,128}$/i', true, _("The <strong>old password</strong> specified is not valid."));
     67    }
     68    if ($fv->notEmpty('newpassword', _("You did not specify the <strong>new password</strong>."))) {
     69        if ($fv->checkRegex('newpassword', '/^\S{8,128}$/i', true, _("The <strong>new password</strong> specified is not valid. A password must be eight or more characters."))) {
     70            if ($fv->notEmpty('newpassword2', _("You need to type the <strong>new password</strong> twice.")) && $frm['newpassword'] != $frm['newpassword2']) {
     71                $fv->addError('newpassword', _("The <strong>new passwords</strong> do not match."));
     72                $fv->addError('newpassword2');
     73            }
    6774        }
    6875    }
    6976
    7077    if (!$fv->anyErrors() && false === $auth->authenticate($auth->get('username'), $frm['oldpassword'])) {
    71         $fv->addError('oldpassword', _("Your <strong>Old password</strong> failed authentication."));
     78        $fv->addError('oldpassword', _("Your <strong>old password</strong> failed authentication."));
    7279        $app->logMsg(sprintf('Password change failed for %s, using (md5ed) password: %s', $auth->get('username'), md5($frm['oldpassword'])), LOG_NOTICE, __FILE__, __LINE__);
    7380    }
     
    8491// Templates.
    8592include 'header.ihtml';
    86 include 'codebase/services/templates/password.ihtml';
     93include 'password.ihtml';
    8794include 'footer.ihtml';
    8895
  • trunk/services/reset_password.php

    r468 r497  
    44 * For details visit the project site: <http://trac.strangecode.com/codebase/>
    55 * Copyright 2001-2012 Strangecode, LLC
    6  * 
     6 *
    77 * This file is part of The Strangecode Codebase.
    88 *
     
    1111 * Free Software Foundation, either version 3 of the License, or (at your option)
    1212 * any later version.
    13  * 
     13 *
    1414 * The Strangecode Codebase is distributed in the hope that it will be useful, but
    1515 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1616 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    1717 * details.
    18  * 
     18 *
    1919 * You should have received a copy of the GNU General Public License along with
    2020 * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
     
    3434********************************************************************/
    3535
     36// Redefine include_path including the codebase/services but allow local templates override global ones.
     37ini_set('include_path', join(PATH_SEPARATOR, array(
     38    get_include_path(),
     39    dirname(__FILE__) . '/templates'
     40)));
     41
    3642// The object to validate form input from the user.
    3743require_once 'codebase/lib/FormValidator.inc.php';
    3844$fv = new FormValidator();
     45
     46require_once 'codebase/lib/HTML.inc.php';
    3947
    4048/********************************************************************
     
    8492
    8593include 'header.ihtml';
    86 include 'codebase/services/templates/reset_password.ihtml';
     94include 'reset_password.ihtml';
    8795include 'footer.ihtml';
    8896
  • trunk/services/templates/admin_form.ihtml

    r435 r497  
    1 <?php $fv->printErrorMessages(); ?>
    2 
    3 <form method="post" action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" class="sc-form">
    4 <?php $app->printHiddenSession(); ?>
    5 <input type="hidden" name="op" value="<?php echo $frm['new_op']; ?>" />
    6 <input type="hidden" name="admin_id" value="<?php echo $frm['admin_id']; ?>" />
    7 <input type="hidden" name="old_username" value="<?php echo $frm['old_username']; ?>" />
    8 
    9 <table>
    10     <tr class="sc-form-row">
    11         <td class="sc-right"><label for="username" class="<?php $fv->err('username'); ?>"><?php echo _("Username"); ?></label></td>
    12         <td>
    13             <input type="text" class="sc-small" size="50" name="username" value="<?php echo oTxt($frm['username']); ?>" />
    14         </td>
    15     </tr>
    16     <tr class="sc-form-row">
    17         <td class="sc-right"><label for="userpass" class="<?php $fv->err('userpass'); ?>"><?php echo _("Password"); ?></label></td>
    18         <td>
    19             <input type="password" class="sc-small" size="50" name="userpass" value="<?php echo oTxt($frm['userpass']); ?>" />
    20         </td>
    21     </tr>
    22     <tr class="sc-form-row">
    23         <td class="sc-right"><label for="first_name" class="<?php $fv->err('first_name'); ?>"><?php echo _("First name"); ?></label></td>
    24         <td>
    25             <input type="text" class="sc-small" size="50" name="first_name" value="<?php echo oTxt($frm['first_name']); ?>" />
    26         </td>
    27     </tr>
    28     <tr class="sc-form-row">
    29         <td class="sc-right"><label for="last_name" class="<?php $fv->err('last_name'); ?>"><?php echo _("Last name"); ?></label></td>
    30         <td>
    31             <input type="text" class="sc-small" size="50" name="last_name" value="<?php echo oTxt($frm['last_name']); ?>" />
    32         </td>
    33     </tr>
    34     <tr class="sc-form-row">
    35         <td class="sc-right"><label for="email" class="<?php $fv->err('email'); ?>"><?php echo _("Email"); ?></label></td>
    36         <td>
    37             <input type="text" class="sc-medium" size="50" name="email" value="<?php echo oTxt($frm['email']); ?>" />
    38         </td>
    39     </tr>
    40     <tr class="sc-form-row">
    41         <td>&nbsp;</td>
    42         <td><?php printSubmitButtons($frm['submit_buttons']); ?></td>
    43     </tr>
    44 </table>
    45 </form>
     1<header class="row">
     2    <div class="large-12 columns">
     3        <h1><?php echo $nav->get('title'); ?></h1>
     4        <?php $fv->printErrorMessages(); ?>
     5    </div>
     6</header>
     7<main role="main">
     8    <form method="post" action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" class="sc-form">
     9        <?php $app->printHiddenSession(); ?>
     10        <input type="hidden" name="op" value="<?php echo $frm['new_op']; ?>" />
     11        <input type="hidden" name="admin_id" value="<?php echo $frm['admin_id']; ?>" />
     12        <input type="hidden" name="old_username" value="<?php echo $frm['old_username']; ?>" />
     13        <div class="row">
     14            <div class="medium-5 large-3 columns">
     15                <label for="first_name" class="<?php $fv->err('first_name'); ?>"><?php echo _("First name"); ?></label>
     16                <input type="text" class="sc-small" size="50" name="first_name" value="<?php echo oTxt($frm['first_name']); ?>" />
     17            </div>
     18            <div class="medium-5 large-3 columns end">
     19                <label for="last_name" class="<?php $fv->err('last_name'); ?>"><?php echo _("Last name"); ?></label>
     20                <input type="text" class="sc-small" size="50" name="last_name" value="<?php echo oTxt($frm['last_name']); ?>" />
     21            </div>
     22        </div>
     23        <div class="row">
     24            <div class="medium-10 large-6 columns">
     25                <label for="email" class="<?php $fv->err('email'); ?>"><?php echo _("Email address"); ?></label>
     26                <input type="text" class="sc-medium" size="50" name="email" value="<?php echo oTxt($frm['email']); ?>" />
     27            </div>
     28        </div>
     29        <div class="row">
     30            <div class="medium-5 large-3 columns">
     31                <label for="username" class="<?php $fv->err('username'); ?>"><?php echo _("Username"); ?></label>
     32                <input type="text" class="sc-small" size="50" name="username" value="<?php echo oTxt($frm['username']); ?>" />
     33            </div>
     34            <div class="medium-5 large-3 columns end">
     35                <label for="userpass" class="<?php $fv->err('userpass'); ?>"><?php echo _("Password"); ?></label>
     36                <input type="password" class="sc-small" size="50" name="userpass" value="<?php echo oTxt($frm['userpass']); ?>" />
     37            </div>
     38        </div>
     39        <div class="row">
     40            <div class="large-6 columns">
     41                <?php HTML::printButtons($frm['submit_buttons']); ?>
     42            </div>
     43        </div>
     44    </form>
     45</main>
  • trunk/services/templates/admin_list.ihtml

    r483 r497  
    1 
    2 <?php $fv->printErrorMessages(); ?>
    3 
    4 <div class="commandbox">
    5     <span class="sc-nowrap commanditem"><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=add'); ?>"><?php echo _("Add Administrator"); ?></a></span>
    6     <form action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" method="get" class="sc-form">
    7         <?php $app->printHiddenSession(false); ?>
    8         <input type="text" class="sc-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.")); ?>" />
    9         <input type="submit" value="<?php echo _("Search"); ?>" />
    10     </form>
     1<div class="sticky">
     2    <nav class="top-bar list-bar" data-topbar role="navigation" data-options="sticky_on: large">
     3        <ul class="title-area">
     4            <li class="name"><h1><a href="#"><?php echo $nav->get('title'); ?></a></h1></li>
     5            <li class="toggle-topbar"><a href="#"><span><?php echo _("Show commands"); ?></span></a></li>
     6        </ul>
     7        <section class="top-bar-section">
     8            <ul class="left">
     9                <li class="has-form"><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=add'); ?>" class="button"><i class="fa fa-plus"></i> <?php echo _("Add Administrator"); ?></a></li>
     10            </ul>
     11            <ul class="right">
     12                <li class="has-form">
     13                    <form action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" method="get">
     14                        <div class="row collapse">
     15                            <?php $app->printHiddenSession(false); ?>
     16                            <div class="small-8 columns">
     17                                <input type="text" class="" size="20" name="search_query" value="<?php echo getFormData('search_query'); ?>" placeholder="<?php echo _("Search
"); ?>" title="<?php echo oTxt(_("Fields searched: question text.")); ?>" />
     18                            </div>
     19                            <div class="small-4 columns">
     20                                <input type="submit" class="button expand" value="<?php echo _("Search"); ?>" />
     21                            </div>
     22                        </div>
     23                    </form>
     24                </li>
     25                <?php if ('' != getFormData('search_query')): ?>
     26                    <li class="has-form"><a href="<?php echo $app->ohref($_SERVER['PHP_SELF'], false); ?>" class="button expand"><?php echo _("Show all"); ?></a></li>
     27                <?php endif ?>
     28            </ul>
     29        </section>
     30    </nav>
    1131</div>
    12 
     32<table>
     33    <thead>
     34        <tr>
     35            <th></th>
     36            <th><?php echo $so->printSortHeader('admin_tbl.admin_id', _("ID"), 'ASC'); ?></th>
     37            <th><?php echo $so->printSortHeader('admin_tbl.username', _("Username"), 'ASC'); ?></th>
     38            <th><?php echo $so->printSortHeader('admin_tbl.first_name', _("First"), 'ASC'); ?> <?php echo $so->printSortHeader('admin_tbl.last_name', _("Last name"), 'ASC'); ?></th>
     39            <th><?php echo $so->printSortHeader('admin_tbl.seconds_online', _("Min online"), 'ASC'); ?></th>
     40            <th><?php echo $so->printSortHeader('admin_tbl.last_login_datetime', _("Last login"), 'ASC'); ?></th>
     41            <th><?php echo $so->printSortHeader('admin_tbl.last_login_ip', _("Remote host"), 'ASC'); ?></th>
     42            <th><?php echo $so->printSortHeader('admin_tbl.added_datetime', _("Added"), 'ASC'); ?></th>
     43            <th><?php echo $so->printSortHeader('admin_tbl.added_by_user_id', _("by"), 'ASC'); ?></th>
     44            <th><?php echo $so->printSortHeader('admin_tbl.modified_datetime', _("Modified"), 'ASC'); ?></th>
     45            <th><?php echo $so->printSortHeader('admin_tbl.modified_by_user_id', _("by"), 'ASC'); ?></th>
     46        </tr>
     47    </thead>
     48    <tbody>
     49        <?php for ($i = 0; $i <= $page->last_item - $page->first_item && $page->total_items > 0; $i++) { ?>
     50        <tr>
     51            <td>
     52                <a href="#" data-dropdown="actions-for-id-<?php echo oTxt($list[$i]['admin_id']); ?>" aria-controls="actions-for-id-<?php echo oTxt($list[$i]['admin_id']); ?>" aria-expanded="false" class="sc-action dropdown" data-options="is_hover:false"><i class="fa fa-cog fa-lg"></i></a>
     53                <ul id="actions-for-id-<?php echo oTxt($list[$i]['admin_id']); ?>" data-dropdown-content class="f-dropdown sc-action" aria-hidden="true" tabindex="-1">
     54                    <li><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=edit&admin_id=' . $list[$i]['admin_id']); ?>"><i class="fa fa-pencil fa-fw"></i> <?php printf(_("Edit <em>%s</em>"), oTxt(truncate($list[$i]['username'], 30))) ?></a></li>
     55                    <li><a href="<?php echo $app->oHREF('/versions.php?record_table=admin_tbl&record_key=admin_id&boomerang=true&record_val=' . $list[$i]['admin_id']); ?>"><i class="fa fa-files-o fa-fw"></i> <?php printf(_("Versions of %s"), oTxt(truncate($list[$i]['username'], 30))) ?></a></li>
     56                    <li><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . "?op=del&admin_id=" . $list[$i]['admin_id']); ?>"><i class="fa fa-trash-o fa-fw"></i> <?php printf(_("Delete <em>%s</em>"), oTxt(truncate($list[$i]['username'], 30))) ?></a></li>
     57                </ul>
     58            </td>
     59            <td class="sc-nowrap"><?php echo oTxt($list[$i]['admin_id'], true); ?></td>
     60            <td class="sc-nowrap"><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=edit&admin_id=' . $list[$i]['admin_id']); ?>"><?php echo oTxt($list[$i]['username'], true); ?></a></td>
     61            <td class="sc-nowrap"><?php echo oTxt($list[$i]['first_name'], true); ?> <?php echo oTxt($list[$i]['last_name'], true); ?></td>
     62            <td class="sc-nowrap"><?php echo round($list[$i]['seconds_online'] / 60); ?></td>
     63            <td class="sc-nowrap"><?php
     64                if ($auth->isLoggedIn($list[$i]['admin_id'])) {
     65                    ?><strong><?php echo date($app->getParam('date_format'), strtotime($list[$i]['last_login_datetime'])) ?></strong><?php
     66                } else {
     67                    echo Validator::validateStrDate($list[$i]['last_login_datetime']) ? date($app->getParam('date_format'), strtotime($list[$i]['last_login_datetime'])) : '';
     68                }
     69            ?></td>
     70            <td class="sc-nowrap"><?php echo gethostbyaddr($list[$i]['last_login_ip']); ?></td>
     71            <td class="sc-nowrap"><?php echo Validator::validateStrDate($list[$i]['added_datetime']) ? date($app->getParam('date_format'), strtotime($list[$i]['added_datetime'])) : ''; ?></td>
     72            <td class="sc-nowrap"><?php echo oTxt($list[$i]['added_admin_username'], true); ?></td>
     73            <td class="sc-nowrap"><?php echo Validator::validateStrDate($list[$i]['modified_datetime']) ? date($app->getParam('date_format'), strtotime($list[$i]['modified_datetime'])) : ''; ?></td>
     74            <td class="sc-nowrap"><?php echo oTxt($list[$i]['modified_admin_username'], true); ?></td>
     75        </tr>
     76        <?php } ?>
     77    </tbody>
     78</table>
    1379<?php include 'list_info.ihtml'; ?>
    14 
    15 <form action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" method="get" class="sc-form">
    16 <table class="list">
    17     <tr>
    18         <th>&nbsp;</th>
    19         <th>&nbsp;</th>
    20         <th><?php echo $so->printSortHeader('admin_tbl.admin_id', _("ID"), 'ASC'); ?></th>
    21         <th><?php echo $so->printSortHeader('admin_tbl.username', _("Username"), 'ASC'); ?></th>
    22         <th><?php echo $so->printSortHeader('admin_tbl.first_name', _("First"), 'ASC'); ?> <?php echo $so->printSortHeader('admin_tbl.last_name', _("Last name"), 'ASC'); ?></th>
    23         <th><?php echo $so->printSortHeader('admin_tbl.seconds_online', _("Min online"), 'ASC'); ?></th>
    24         <th><?php echo $so->printSortHeader('admin_tbl.last_login_datetime', _("Last login"), 'ASC'); ?></th>
    25         <th><?php echo $so->printSortHeader('admin_tbl.last_login_ip', _("Remote host"), 'ASC'); ?></th>
    26         <th><?php echo $so->printSortHeader('admin_tbl.added_datetime', _("Added"), 'ASC'); ?></th>
    27         <th><?php echo $so->printSortHeader('admin_tbl.added_by_user_id', _("by"), 'ASC'); ?></th>
    28         <th><?php echo $so->printSortHeader('admin_tbl.modified_datetime', _("Modified"), 'ASC'); ?></th>
    29         <th><?php echo $so->printSortHeader('admin_tbl.modified_by_user_id', _("by"), 'ASC'); ?></th>
    30         <th>&nbsp;</th>
    31     </tr>
    32     <?php for ($i = 0; $i <= $page->last_item - $page->first_item && $page->total_items > 0; $i++) { ?>
    33     <tr>
    34         <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/i/pen.gif" alt="Edit" width="12" height="12" border="0" /></a> &nbsp;</td>
    35         <td class="sc-padleft sc-nowrap"><a title="<?php printf(_("Versions of %s"), oTxt($list[$i]['username'])) ?>" href="<?php echo $app->oHREF(sprintf('/admin/versions.php?record_table=%s&record_key=%s&record_val=%s&boomerang=true', $auth->getParam('db_table'), $auth->getParam('db_primary_key'), $list[$i]['admin_id'])); ?>"><img src="/admin/i/multiple.png" alt="" width="12" height="12" border="0" /></a> &nbsp;</td>
    36         <td class="sc-nowrap"><?php echo oTxt($list[$i]['admin_id'], true); ?> &nbsp;</td>
    37         <td class="sc-nowrap"><?php echo oTxt($list[$i]['username'], true); ?> &nbsp;</td>
    38         <td class="sc-nowrap"><?php echo oTxt($list[$i]['first_name'], true); ?> <?php echo oTxt($list[$i]['last_name'], true); ?> &nbsp;</td>
    39         <td class="sc-nowrap"><?php echo round($list[$i]['seconds_online'] / 60); ?> &nbsp;</td>
    40         <td class="sc-nowrap"><?php
    41             if ($auth->isLoggedIn($list[$i]['admin_id'])) {
    42                 ?><strong><?php echo date($app->getParam('date_format'), strtotime($list[$i]['last_login_datetime'])) ?></strong><?php
    43             } else {
    44                 echo Validator::validateStrDate($list[$i]['last_login_datetime']) ? date($app->getParam('date_format'), strtotime($list[$i]['last_login_datetime'])) : '';
    45             }
    46         ?> &nbsp;</td>
    47         <td class="sc-nowrap"><?php echo gethostbyaddr($list[$i]['last_login_ip']); ?> &nbsp;</td>
    48         <td class="sc-nowrap"><?php echo Validator::validateStrDate($list[$i]['added_datetime']) ? date($app->getParam('date_format'), strtotime($list[$i]['added_datetime'])) : ''; ?> &nbsp;</td>
    49         <td class="sc-nowrap"><?php echo oTxt($list[$i]['added_admin_username'], true); ?> &nbsp;</td>
    50         <td class="sc-nowrap"><?php echo Validator::validateStrDate($list[$i]['modified_datetime']) ? date($app->getParam('date_format'), strtotime($list[$i]['modified_datetime'])) : ''; ?> &nbsp;</td>
    51         <td class="sc-nowrap"><?php echo oTxt($list[$i]['modified_admin_username'], true); ?> &nbsp;</td>
    52         <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/i/trash.gif" alt="Delete" width="10" height="10" border="0" /></a> &nbsp;</td>
    53     </tr>
    54     <?php } ?>
    55 </table>
    56 
    57 <?php if ($page->total_pages > 1) { ?>
    58 <div class="sc-nowrap commanditem" style="float: right;"><?php echo _("Pages:"); ?>&nbsp;<?php $page->printPageNumbers() ?></div>
    59 <?php } ?>
    60 </form>
  • trunk/services/templates/email_reset_password.txt

    r189 r497  
    99
    1010{SITE_NAME}
    11 <{SITE_URL}/>
     11{SITE_URL}/
    1212
  • trunk/services/templates/list_info.ihtml

    r270 r497  
    1 <div>
    2     <?php if ($page->total_pages > 1) { ?>
    3     <span class="sc-nowrap commanditem" style="float: right;"><?php echo _("Pages:"); ?>&nbsp;<?php $page->printPageNumbers() ?></span>
    4     <?php } ?>
    5     <span class="sc-nowrap commanditem">
    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         &nbsp;&nbsp; <a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'], false); ?>"><?php echo _("List all"); ?></a>
    8         &nbsp;&nbsp; <?php echo _("Per page"); ?>:&nbsp;<?php $page->printPerPageLinks() ?>
    9     </span>
     1<div class="row">
     2    <div class="large-12 text-center columns">
     3        <ul class="inline-list">
     4            <li><?php printf(_("Listing <strong>%s-%s</strong> of <strong>%s</strong> results on <strong>%s</strong> %s"), (0==$page->total_items ? 0 : $page->first_item+1), (0==$page->total_items ? 0 : $page->last_item+1), $page->total_items, $page->total_pages, (1==$page->total_pages ? _("page") : _("pages"))); ?></li>
     5            <?php if ($page->total_pages > 1) { ?>
     6                <li class=""><?php $page->printPageNumbers() ?></li>
     7                <li><?php echo _("Per page"); ?>:&nbsp;<?php $page->printPerPageLinks() ?></li>
     8            <?php } ?>
     9        </ul>
     10    </div>
    1011</div>
  • trunk/services/templates/lock.ihtml

    r295 r497  
    11<?php
    22if (!is_a($lock, 'Lock')) {
     3    // If the Lock object hasn't been instantiated, don't execute this template.
    34    return null;
    45}
    56?>
    6 <form method="post" action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" class="sc-form">
    7     <?php $app->printHiddenSession() ?>
    8     <input type="hidden" name="lock_id" value="<?php echo $lock->getID(); ?>" />
    9 
    10     <p><?php
    11     printf(_("The record %s is currently being edited by %s (%d minutes elapsed). You cannot modify the record while it is locked by another user."),
    12         $lock->getTitle(),
    13         $lock->getEditor(),
    14         date('i', $lock->getSecondsElapsed() + 60)
    15     );
    16     ?></p>
    17 
    18     <?php if ($lock->getSecondsElapsed() > $lock->timeout) { ?>
    19     <p><?php printf(_("You can force unlock the record if you believe the editing session has expired. You might want to confirm with before doing this."), $lock->getEditor()) ?></p>
    20     <input type="submit" name="unlock" value="<?php echo _("Unlock"); ?>" />
    21     <?php } ?>
    22 
    23     <input type="submit" name="cancel" value="<?php echo _("Cancel"); ?>" />
    24 </form>
     7<header class="row">
     8    <div class="large-12 columns">
     9        <h1><?php echo $nav->get('title'); ?></h2>
     10    </div>
     11</header>
     12<main role="main">
     13    <form method="post" action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>">
     14        <?php $app->printHiddenSession() ?>
     15        <input type="hidden" name="lock_id" value="<?php echo $lock->getID(); ?>" />
     16        <div id="sc-msg" class="sc-msg row">
     17            <div class="large-12 columns">
     18                <p class="sc-msg-notice">
     19                <?php printf(_("The record <em>%s</em> is currently being edited by %s (%d minutes elapsed). You cannot modify the record while it is locked by another user."),
     20                    $lock->getTitle(),
     21                    $lock->getEditor(),
     22                    date('i', $lock->getSecondsElapsed() + 60)
     23                ); ?>
     24                </p>
     25                <?php if ($lock->getSecondsElapsed() >= $lock->getParam('timeout')) { ?>
     26                    <p class="sc-msg-notice"><?php printf(_("You can forcibly unlock the record if you believe the editing session has expired. You might want to confirm with %s before doing this."), $lock->getEditor()) ?></p>
     27                    <div class="sc-msg-notice">
     28                        <?php
     29                        HTML::printButtons(array(
     30                            array('name' => 'unlock', 'value' => _("Unlock"), 'class' => 'small button alert', 'accesskey' => 'u'),
     31                            array('name' => 'cancel', 'value' => _("Cancel"), 'class' => 'small button secondary', 'accesskey' => 'c'),
     32                        ));
     33                        ?>
     34                    </div>
     35                <?php } else { ?>
     36                    <div class="sc-msg-notice">
     37                        <?php
     38                        HTML::printButtons(array(
     39                            array('name' => 'cancel', 'value' => _("Cancel"), 'class' => 'small button secondary', 'accesskey' => 'c'),
     40                        ));
     41                        ?>
     42                    </div>
     43                <?php } ?>
     44            </div>
     45        </div>
     46    </form>
     47</main>
  • trunk/services/templates/log_list.ihtml

    r457 r497  
    1 <form action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" method="get" class="sc-form">
    2 <?php $app->printHiddenSession(false); ?>
    3 <div class="commandbox">
    4 <?php if (is_array($logs) && !empty($logs)) { ?>
    5     <table>
    6     <?php
    7     foreach ($logs as $l) {
    8         ?>
    9         <tr>
    10             <td>
    11                 <?php if ($l['filename'] == $tmp_prefs->get('log_file')) { ?>
    12                     <strong class="sc-padright"><?php echo sprintf(_("%s"), $l['filename']); ?></strong>
    13                 <?php } else { ?>
    14                     <a class="sc-padright" href="<?php echo $app->oHREF('/admin/logs.php?log=' . $l['filename']); ?>"><strong><?php echo sprintf(_("%s"), $l['filename']); ?></strong></a>
    15                 <?php } ?>
    16             </td>
    17             <td>
    18                 <em class="sc-padright"><?php echo sprintf(_("%01.1f KB, last modified %s"), ($l['filesize']/1024), date($app->getParam('date_format'), $l['modified'])); ?></em>
    19             </td>
    20             <td>
    21                 <?php if (!preg_match($no_download_files, $l['filename'])) { ?><a class="sc-padright" href="<?php echo $app->oHREF('/admin/logs.php?op=download&log=' . $l['filename']); ?>"><?php echo _("Download"); ?></a><?php } ?>
    22                 <?php if (!preg_match($no_archive_files, $l['filename'])) { ?><a class="sc-padright" href="<?php echo $app->oHREF('/admin/logs.php?op=archive&log=' . $l['filename']); ?>"><?php echo _("Archive"); ?></a><?php } ?>
    23                 <?php if (!preg_match($no_clear_files, $l['filename'])) { ?><a class="sc-padright" 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><?php } ?>
    24                 <?php if (!preg_match($no_delete_files, $l['filename'])) { ?><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><?php } ?>
    25             </td>
    26         </tr><?php
    27     }
    28     ?>
    29     </table>
    30 <?php } ?>
    31     <div class="form">
    32         <input type="text" class="sc-small" size="20" name="search_query" value="<?php echo oTxt(getFormData('search_query')); ?>" title="<?php echo _("All lines in currently viewed log file are searched."); ?>" />
    33         <label class="sc-normal"><input type="checkbox" name="search_grep"<?php frmChecked(getFormData('search_grep')) ?> /><?php echo _("Use Regex"); ?></label>
    34         <input class="sc-padleft" type="submit" name="list" value="<?php echo _("Search"); ?>" />
     1<div class="sticky">
     2    <nav class="top-bar list-bar" data-topbar role="navigation" data-options="sticky_on: large">
     3        <ul class="title-area">
     4            <li class="name"><h1><a href="#"><?php echo $nav->get('title'); ?></a></h1></li>
     5            <li class="toggle-topbar"><a href="#"><span><?php echo _("Show commands"); ?></span></a></li>
     6        </ul>
     7        <section class="top-bar-section">
     8            <ul class="left">
     9                <li class="has-form">
     10                    <button data-dropdown="loglist" aria-controls="loglist" aria-expanded="false" class="button"><?php echo _("Select log"); ?> <i class="fa fa-caret-down"></i></button>
     11                </li>
     12            </ul>
     13            <ul class="right">
     14                <li class="has-form">
     15                    <form action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" method="get">
     16                        <div class="row collapse">
     17                            <?php $app->printHiddenSession(false); ?>
     18                            <div class="small-5 columns">
     19                                <input type="text" class="" size="20" name="search_query" value="<?php echo getFormData('search_query'); ?>" placeholder="<?php echo _("Search
"); ?>" title="<?php echo oTxt(_("Fields searched: question text.")); ?>" />
     20                            </div>
     21                            <div class="small-4 columns">
     22                                <input type="checkbox" id="search_grep" name="search_grep"<?php frmChecked(getFormData('search_grep')) ?> /><label for="search_grep"><?php echo _("Regex"); ?></label>
     23                            </div>
     24                            <div class="small-3 columns">
     25                                <input type="submit" class="button expand" value="<?php echo _("Search"); ?>" />
     26                            </div>
     27                        </div>
     28                    </form>
     29                </li>
     30                <?php if ('' != getFormData('search_query')): ?>
     31                    <li class="has-form"><a href="<?php echo $app->ohref($_SERVER['PHP_SELF'], false); ?>" class="button expand"><?php echo _("Show all"); ?></a></li>
     32                <?php endif ?>
     33            </ul>
     34        </section>
     35    </nav>
     36    <?php if (is_array($logs) && !empty($logs)) { ?>
     37    <div id="loglist" data-dropdown-content class="f-dropdown content large" aria-hidden="true" tabindex="-1">
     38        <table>
     39            <?php
     40            foreach ($logs as $l) {
     41                ?>
     42                <tr>
     43                    <td>
     44                        <?php if ($l['filename'] == $tmp_prefs->get('log_file')) { ?>
     45                            <strong class="sc-padright"><?php echo sprintf(_("%s"), $l['filename']); ?></strong>
     46                        <?php } else { ?>
     47                            <a class="sc-padright" href="<?php echo $app->oHREF('?log=' . $l['filename']); ?>"><strong><?php echo sprintf(_("%s"), $l['filename']); ?></strong></a>
     48                        <?php } ?>
     49                    </td>
     50                    <td>
     51                        <em class="sc-padright"><?php echo sprintf(_("%01.1f KB, last modified %s"), ($l['filesize']/1024), date($app->getParam('date_format'), $l['modified'])); ?></em>
     52                    </td>
     53                    <td>
     54                        <?php if (!preg_match($no_download_files, $l['filename'])) { ?><a class="sc-padright" href="<?php echo $app->oHREF('?op=download&log=' . $l['filename']); ?>"><?php echo _("Download"); ?></a><?php } ?>
     55                        <?php if (!preg_match($no_archive_files, $l['filename'])) { ?><a class="sc-padright" href="<?php echo $app->oHREF('?op=archive&log=' . $l['filename']); ?>"><?php echo _("Archive"); ?></a><?php } ?>
     56                        <?php if (!preg_match($no_clear_files, $l['filename'])) { ?><a class="sc-padright" href="<?php echo $app->oHREF('?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><?php } ?>
     57                        <?php if (!preg_match($no_delete_files, $l['filename'])) { ?><a href="<?php echo $app->oHREF('?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><?php } ?>
     58                    </td>
     59                </tr><?php
     60            }
     61            ?>
     62        </table>
    3563    </div>
     64    <?php } ?>
    3665</div>
    3766
    38 <?php include 'list_info.ihtml'; ?>
    39 
    40 <pre style="font: 9px monaco;">
     67<pre>
    4168<?php
    4269for ($i = $page->first_item; $i <= $page->last_item && $page->total_items; $i++) {
     
    4572?>
    4673</pre>
     74<?php include 'list_info.ihtml'; ?>
    4775
    48 <?php if ($page->total_pages > 1) { ?>
    49 <div class="sc-nowrap commanditem" style="float: right;"><?php echo _("Pages:"); ?>&nbsp;<?php $page->printPageNumbers() ?></div>
    50 <?php } ?>
    51 </form>
     76<style>
     77td { padding: .1rem .5rem; }
     78pre {
     79    font-family: monospace;
     80    font-size: .75rem;
     81    line-height: 1.2;
     82    padding: 15px;
     83}
     84.right .has-form .columns {
     85    padding: 0 .25rem;
     86}
     87</style>
  • trunk/services/templates/password.ihtml

    r296 r497  
    1 <?php $fv->printErrorMessages(); ?>
    2 
    3 <form method="post" action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" class="sc-form">
    4 <?php $app->printHiddenSession() ?>
    5 <input type="hidden" name="op" value="update_password" />
    6 <table>
    7     <tr class="sc-form-row">
    8         <td class="sc-right"><label for="oldpassword" class="<?php $fv->err('oldpassword'); ?>"><?php echo _("Old password"); ?></label></td>
    9         <td>
    10             <input type="password" class="sc-medium" size="50" name="oldpassword" />
    11         </td>
    12     </tr>
    13     <tr class="sc-form-row">
    14         <td class="sc-right"><label for="newpassword" class="<?php $fv->err('newpassword'); ?>"><?php echo _("New password"); ?></label></td>
    15         <td>
    16             <input type="password" class="sc-medium" size="50" name="newpassword" />
    17         </td>
    18     </tr>
    19     <tr class="sc-form-row">
    20         <td class="sc-right"><label for="newpassword2" class="<?php $fv->err('newpassword2'); ?>"><?php echo _("New password again"); ?></label></td>
    21         <td>
    22             <input type="password" class="sc-medium" size="50" name="newpassword2" />
    23         </td>
    24     </tr>
    25     <tr class="sc-form-row">
    26         <td>&nbsp;</td>
    27         <td><input type="submit" value="<?php echo _("Change password"); ?>" /></td>
    28     </tr>
    29 </table>
    30 </form>
     1<header class="row">
     2    <div class="large-12 columns">
     3        <h1><?php echo $nav->get('title'); ?></h1>
     4        <?php $fv->printErrorMessages(); ?>
     5    </div>
     6</header>
     7<main role="main">
     8    <form method="post" action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" class="sc-form">
     9        <?php $app->printHiddenSession() ?>
     10        <input type="hidden" name="op" value="update_password" />
     11        <div class="row">
     12            <div class="large-6 columns">
     13                <label for="oldpassword" class="<?php $fv->err('oldpassword'); ?>"><?php echo _("Old password"); ?></label>
     14                <input type="password" class="sc-medium" size="50" name="oldpassword" />
     15            </div>
     16        </div>
     17        <div class="row">
     18            <div class="large-6 columns">
     19                <label for="newpassword" class="<?php $fv->err('newpassword'); ?><?php $fv->err('newpassword2'); ?>"><?php echo _("New password (twice)"); ?></label>
     20                <input type="password" class="sc-medium" size="50" name="newpassword" />
     21            </div>
     22        </div>
     23        <div class="row">
     24            <div class="large-6 columns">
     25                <input type="password" class="sc-medium" size="50" name="newpassword2" />
     26                <div class="sc-help"><?php printf(_("See the <a href=\"%s\">Strangecode password guide</a> for tips on choosing a strong password."), 'http://www.strangecode.com/support/passwords'); ?></div>
     27            </div>
     28        </div>
     29        <div class="row">
     30            <div class="large-6 columns">
     31                <?php
     32                HTML::printButtons(array(array(
     33                    'name' => 'submit',
     34                    'value' => _("Change password"),
     35                    'class' => 'small button',
     36                    'accesskey' => 's'
     37                )));
     38                ?>
     39            </div>
     40        </div>
     41    </form>
     42</main>
  • trunk/services/templates/reset_password.ihtml

    r189 r497  
    1 <p><?php echo _("If you have forgotten your password enter your username here. A new password will be emailed to you."); ?></p>
    2 
    3 <form method="post" action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" class="sc-form">
    4     <?php $app->printHiddenSession(); ?>
    5     <input type="hidden" name="op" value="reset" />
    6     <div class="sc-form-row<?php $fv->err('username'); ?>">
    7         <label for="username"><?php echo _("Username"); ?></label>
    8         <input type="text" name="username" id="username" class="sc-medium" value="<?php echo oTxt($frm['username']); ?>" />
     1<header class="row">
     2    <div class="large-12 columns">
     3        <h1><?php echo $nav->get('title'); ?></h1>
     4        <p><?php echo _("If you have forgotten your password enter your username here. A new password will be emailed to you."); ?></p>
     5        <?php $fv->printErrorMessages(); ?>
    96    </div>
    10     <div class="sc-form-row sc-submit-buttons sc-clearboth">
    11         <input type="submit" value="<?php echo _("Submit"); ?>" />
    12     </div>
    13 </form>
     7</header>
     8<main role="main">
     9    <form method="post" action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" class="sc-form">
     10        <?php $app->printHiddenSession(); ?>
     11        <input type="hidden" name="op" value="reset" />
     12        <div class="row<?php $fv->err('username'); ?>">
     13            <div class="large-6 columns">
     14                <label for="username"><?php echo _("Username"); ?></label>
     15                <input type="text" name="username" id="username" class="sc-medium" value="<?php echo oTxt($frm['username']); ?>" />
     16            </div>
     17        </div>
     18        <div class="row sc-submit-buttons">
     19            <div class="large-6 columns">
     20                <?php
     21                HTML::printButtons(array(array(
     22                    'name' => 'submit',
     23                    'value' => _("Submit"),
     24                    'class' => 'small button',
     25                    'accesskey' => 's'
     26                )));
     27                ?>
     28            </div>
     29        </div>
     30    </form>
     31</main>
  • trunk/services/templates/versions_diff.ihtml

    r457 r497  
    1 <div class="commandbox">
    2 <?php if (!getFormData('current', false)) { ?>
    3     <span class="sc-nowrap commanditem"><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 <?php } else { ?>
    5     <span class="sc-nowrap commanditem">&nbsp;</span>
    6 <?php } ?>
    7 </div>
     1<header class="row">
     2    <div class="large-12 columns">
     3        <h1><?php echo $nav->get('title'); ?></h1>
     4    </div>
     5</header>
     6<main role="main">
     7    <div class="row">
     8        <div class="large-12 columns">
     9            <?php
     10            if (is_array($data) && !empty($data)) {
     11                ?>
     12                <table class="list">
     13                    <thead>
     14                        <tr>
     15                            <th class="sc-padleft"><?php echo _("Field"); ?></th>
     16                            <th class="sc-padleft"><?php echo _("Saved version"); ?></th>
     17                            <th class="sc-padleft"><?php echo _("Current record"); ?></th>
     18                        </tr>
     19                    </thead>
     20                    <tbody>
     21                        <?php
     22                        foreach ($current as $k=>$v_c) {
     23                            if (isset($data[$k])) {
     24                                $v_d =  $data[$k];
     25                                $td_style = '';
     26                            } else {
     27                                $v_d = '(Unavailable)';
     28                                $td_style = 'color: #e00;';
     29                            }
     30                            $tr_style = $v_d != $v_c ? 'font-weight:bold;' : '';
     31                            ?>
     32                            <tr style="<?php echo $tr_style; ?>">
     33                                <td class="sc-nowrap"><label><?php echo oTxt($k); ?></label></td>
     34                                <td style="<?php echo $td_style; ?>"><?php echo oTxt($v_d); ?></td>
     35                                <td style="<?php echo $td_style; ?>"><?php echo oTxt($v_c); ?></td>
     36                            </tr>
     37                        <?php } ?>
     38                    </tbody>
     39                </table>
     40                <p class="sc-help"><?php echo _("Emboldened lines indicate something changed between the saved version and the current record."); ?></p>
     41            <?php
     42            }
    843
    9 <?php if (is_array($data) && !empty($data) && is_array($current) && !empty($current)) { ?>
    10 <table class="list">
    11     <tr>
    12         <th class="sc-padleft"><?php echo _("Field"); ?></th>
    13         <th class="sc-padleft"><?php echo _("Saved version"); ?></th>
    14         <th class="sc-padleft"><?php echo _("Current record"); ?></th>
    15     </tr>
    16 <?php
    17 foreach ($current as $k=>$v_c) {
    18     $v_d = isset($data[$k]) ? $data[$k] : '<span style="color: #e00;">Unavailable</span>';
    19     $style = $v_d != $v_c ? ' style="font-weight: bold;"' : '';
    20     ?>
    21     <tr>
    22         <td class="sc-padleft sc-nowrap"<?php echo $style; ?>><label><?php echo $k; ?></label></td>
    23         <td class="sc-padleft"><?php echo $v_d; ?></td>
    24         <td class="sc-padleft"><?php echo $v_c; ?></td>
    25     </tr>
    26 <?php } ?>
    27 </table>
    28 <?php } ?>
     44            // Buttons.
     45            $action_links = array();
     46            if (!getFormData('current', false)) {
     47                $action_links[] = array('href' => $app->oHREF($_SERVER['PHP_SELF'] . '?op=restore', array('version_id', 'version_title')), 'value' => _("Restore this saved version"), 'class' => 'small button alert', 'accesskey' => 'r');
     48            }
     49            $action_links[] = array('href' => $app->ohref(oTxt($_SERVER['PHP_SELF'])), 'value' => _("Cancel"), 'class' => 'small button secondary', 'accesskey' => 'b');
     50            HTML::printButtons($action_links);
     51            ?>
     52        </div>
     53    </div>
     54</main>
  • trunk/services/templates/versions_list.ihtml

    r295 r497  
    1 <form method="post" action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" class="sc-form">
    2 <?php $app->printHiddenSession() ?>
    3 <input type="submit" name="op" value="<?php echo _("Cancel"); ?>" />
    4 <table class="list">
    5 <tr>
    6     <th class="sc-padleft" colspan="3">&nbsp;</th>
    7     <th class="sc-padleft"><?php echo _("ID"); ?></th>
    8     <th class="sc-padleft"><?php echo _("Saved"); ?></th>
    9     <th class="sc-padleft"><?php echo _("By"); ?></th>
    10 </tr>
    11 <?php
    12 $first = true;
    13 foreach ($versions as $v) { ?>
    14 <tr>
    15     <?php if ($first) { ?>
    16     <td class="sc-padleft sc-nowrap">[<a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=view&current=true&version_id=' . $v['version_id']); ?>">view</a>]</td>
    17     <td class="sc-padleft sc-nowrap" colspan="2">(<?php echo _("Current record"); ?>)</td>
    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>
    22     <?php } ?>
    23     <td class="sc-padleft sc-nowrap"><?php echo $v['version_id']; ?></td>
    24     <td class="sc-padleft sc-nowrap"><?php echo date('d M Y H:i:s', strtotime($v['version_datetime'])); ?></td>
    25     <td class="sc-padleft sc-nowrap"><?php echo $v['editor']; ?></td>
    26 </tr>
    27 <?php
    28 $first = false;
    29 }
    30 ?>
    31 </table>
    32 <div class="sc-help"><?php printf(_("When there are more than %s versions, those over %s days old are deleted."), $version->getParam('min_qty'), $version->getParam('min_days')); ?></div>
    33 <input type="submit" name="op" value="<?php echo _("Cancel"); ?>" />
    34 </form>
     1<header class="row">
     2    <div class="large-12 columns">
     3        <h1><?php echo $nav->get('title'); ?></h1>
     4    </div>
     5</header>
     6<main role="main">
     7    <form method="post" action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" class="sc-form">
     8        <?php $app->printHiddenSession() ?>
     9        <div class="row">
     10            <div class="large-12 columns">
     11                <table>
     12                    <thead>
     13                        <tr>
     14                            <th></th>
     15                            <th><?php echo _("ID"); ?></th>
     16                            <th><?php echo _("Date"); ?></th>
     17                            <th><?php echo _("By"); ?></th>
     18                        </tr>
     19                    </thead>
     20                    <tbody>
     21                        <?php
     22                        $first = true;
     23                        foreach ($versions as $v) { ?>
     24                        <tr>
     25                            <td>
     26                                <a href="#" data-dropdown="actions-for-id-<?php echo oTxt($v['version_id']); ?>" aria-controls="actions-for-id-<?php echo oTxt($v['version_id']); ?>" aria-expanded="false" class="sc-action dropdown" data-options="is_hover:false"><i class="fa fa-cog fa-lg"></i></a>
     27                                <ul id="actions-for-id-<?php echo oTxt($v['version_id']); ?>" data-dropdown-content class="f-dropdown sc-action" aria-hidden="true" tabindex="-1">
     28                                    <li><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=view&version_id=' . $v['version_id']); ?>"><i class="fa fa-eye fa-fw"></i> <?php printf(_("View version <em>%s</em>"), oTxt(truncate($v['version_id'], 30))) ?></a></li>
     29                                    <?php if (!$first) { ?>
     30                                        <li><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=diff&version_id=' . $v['version_id']); ?>"><i class="fa fa-columns fa-fw"></i> <?php printf(_("View differences from version %s"), oTxt(truncate($v['version_id'], 30))) ?></a></li>
     31                                        <li><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=restore&version_id=' . $v['version_id']); ?>"><i class="fa fa-history fa-fw"></i> <?php printf(_("Restore version <em>%s</em>"), oTxt(truncate($v['version_id'], 30))) ?></a></li>
     32                                    <?php } ?>
     33                                </ul>
     34                            </td>
     35                            <td class="sc-padleft sc-nowrap"><?php echo $v['version_id']; ?></td>
     36                            <td class="sc-padleft sc-nowrap"><?php
     37                                echo date(sprintf('%s %s', $app->getParam('date_format'), $app->getParam('time_format')), strtotime($v['version_datetime']));
     38                                if ($first) {
     39                                    ?> <span><em>(<?php echo _("The current record"); ?>)</em></span><?php
     40                                }
     41                                ?></td>
     42                            <td class="sc-padleft sc-nowrap"><?php echo $v['editor']; ?></td>
     43                        </tr>
     44                        <?php
     45                        $first = false;
     46                        }
     47                        ?>
     48                    </tbody>
     49                </table>
     50                <div class="sc-help"><?php printf(_("When there are more than %s versions, those over %s days old are deleted."), $version->getParam('min_qty'), $version->getParam('min_days')); ?></div>
     51                <?php
     52                HTML::printButtons(array(
     53                    array('name' => 'op', 'value' => _("Cancel"), 'class' => 'small button secondary', 'accesskey' => 'c'),
     54                ));
     55                ?>
     56            </div>
     57        </div>
     58    </form>
     59</main>
  • trunk/services/templates/versions_view.ihtml

    r457 r497  
    1 <div class="commandbox">
    2 <span class="sc-nowrap commanditem"><a href="<?php echo $app->ohref(oTxt($_SERVER['PHP_SELF'])); ?>"><?php echo _("Back to the Versions List"); ?></a></span>
    3 <?php if (!getFormData('current', false)) { ?>
    4     <span class="sc-nowrap commanditem"><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=restore', array('version_id', 'version_title')); ?>"><?php echo _("Restore this saved version"); ?></a></span>
    5 <?php } ?>
    6 </div>
     1<header class="row">
     2    <div class="large-12 columns">
     3        <h1><?php echo $nav->get('title'); ?></h1>
     4    </div>
     5</header>
     6<main role="main">
     7    <div class="row">
     8        <div class="large-12 columns">
     9            <?php
     10            if (is_array($data) && !empty($data)) {
     11                ?>
     12                <table class="list">
     13                    <tbody>
     14                        <?php
     15                        foreach ($data as $k => $v_d) {
     16                            ?>
     17                            <tr>
     18                                <td class="sc-nowrap"><label><?php echo oTxt($k); ?></label></td>
     19                                <td><pre><?php echo oTxt($v_d); ?></pre></td>
     20                            </tr>
     21                        <?php } ?>
     22                    </tbody>
     23                </table>
     24            <?php
     25            }
    726
    8 <?php if (is_array($data) && !empty($data)) { ?>
    9 <table class="list">
    10 <?php
    11 while ((list($k, $v_d) = each($data))) {
    12     ?>
    13     <tr>
    14         <td class="sc-padleft sc-nowrap"><label><?php echo $k; ?></label></td>
    15         <td class="sc-padleft"><pre><?php echo $v_d; ?></pre></td>
    16     </tr>
    17 <?php } ?>
    18 </table>
    19 <?php } ?>
     27            // Buttons.
     28            $action_links = array();
     29            if (!getFormData('current', false)) {
     30                $action_links[] = array('href' => $app->oHREF($_SERVER['PHP_SELF'] . '?op=restore', array('version_id', 'version_title')), 'value' => _("Restore this saved version"), 'class' => 'small button alert', 'accesskey' => 'r');
     31            }
     32            $action_links[] = array('href' => $app->ohref(oTxt($_SERVER['PHP_SELF'])), 'value' => _("Cancel"), 'class' => 'small button secondary', 'accesskey' => 'b');
     33            HTML::printButtons($action_links);
     34            ?>
     35        </div>
     36    </div>
     37</main>
  • trunk/services/versions.php

    r468 r497  
    3232require_once 'codebase/lib/Version.inc.php';
    3333require_once 'codebase/lib/Lock.inc.php';
     34require_once 'codebase/lib/HTML.inc.php';
    3435
    3536/******************************************************************************
     
    3940// Since we're using the singleton pattern we can instantiate a Version object earlier with custom parameters.
    4041$version =& Version::getInstance($auth);
     42$version->setParam(array(
     43    // If true, makes an exact comparison of saved vs. live table schemas. If false, just checks that the saved columns are available.
     44    'db_schema_strict' => false,
     45));
    4146
    4247// Query arguments to retain their values between page requests.
     
    8085    $data = $version->getData($version_id);
    8186    $versionrecord = $version->getVerson($version_id);
    82     $nav->add(sprintf(_("View <em>%s</em> version %s (%s)"), $versionrecord['version_title'], $version_id, $versionrecord['version_datetime']));
     87    $nav->add(sprintf(_("%s <small>Version %s (%s)</small>"), $versionrecord['version_title'], $version_id, date(sprintf('%s %s', $app->getParam('date_format'), $app->getParam('time_format')), strtotime($versionrecord['version_datetime']))));
    8388    $main_template = 'versions_view.ihtml';
    8489    break;
     
    8994    $current = $version->getCurrent($record_table, $record_key, $record_val);
    9095    if (serialize($data) == serialize($current)) {
    91         $app->raiseMsg(sprintf(_("Version <em>%s</em> is identical to the current record"), $version_id), MSG_NOTICE, __FILE__, __LINE__);
     96        $app->raiseMsg(sprintf(_("Version %s is identical to the current record"), $version_id), MSG_NOTICE, __FILE__, __LINE__);
    9297    }
    93     $nav->add(sprintf(_("Difference between version %s (%s) and current record."), $version_id, $versionrecord['version_datetime']));
     98    $nav->add(sprintf(_("%s <small>Version %s (%s)</small>"), $versionrecord['version_title'], $version_id, date(sprintf('%s %s', $app->getParam('date_format'), $app->getParam('time_format')), strtotime($versionrecord['version_datetime']))));
    9499    $main_template = 'versions_diff.ihtml';
    95100    break;
     
    119124    if (is_array($versions) && !empty($versions)) {
    120125        $_POST['version_title'] = $versions[0]['version_title'];
    121         $nav->add(sprintf(_("%s versions of record <em>%s</em>"), sizeof($versions), $versions[0]['version_title']));
     126        $nav->add(sprintf(_("%s versions of <em>%s</em>"), sizeof($versions), $versions[0]['version_title']));
    122127        $main_template = 'versions_list.ihtml';
    123128    } else {
    124         $app->raiseMsg(sprintf(_("No saved versions available for this record"), null), MSG_NOTICE, __FILE__, __LINE__);
     129        $app->raiseMsg(sprintf(_("No saved versions available"), null), MSG_NOTICE, __FILE__, __LINE__);
    125130        $app->dieBoomerangURL('versions');
    126131    }
Note: See TracChangeset for help on using the changeset viewer.