Esempio n. 1
0
 /**
  * List current set of users
  *
  * @version 1.0
  * @since   1.0.0
  * @author  Dan Aldridge
  * 
  * @return  void
  */
 public function manage()
 {
     $objSQL = Core_Classes_coreObj::getDBO();
     $objTPL = Core_Classes_coreObj::getTPL();
     $objTime = Core_Classes_coreObj::getTime();
     $objUser = Core_Classes_coreObj::getUser();
     $objTPL->set_filenames(array('body' => cmsROOT . Core_Classes_Page::$THEME_ROOT . 'block.tpl', 'panel' => cmsROOT . 'modules/core/views/admin/users/list.tpl'));
     $query = $objSQL->queryBuilder()->select('*')->from('#__users')->orderby('id')->build();
     $users = $objSQL->fetchAll($query, 'id');
     if (!$users) {
         msgDie('INFO', 'Cant query users :/');
         return false;
     }
     foreach ($users as $id => $user) {
         switch ($user['userlevel']) {
             case ADMIN:
                 $role = 'Administrator';
                 break;
             case MOD:
                 $role = 'Moderator';
                 break;
             case USER:
                 $role = 'User';
                 break;
         }
         $objTPL->assign_block_vars('user', array('ID' => $id, 'NAME' => $objUser->makeUsername($id), 'EMAIL' => $user['email'], 'DATE_REGISTERED' => $objTime->mk_time($user['register_date']), 'ROLE' => $role, 'STATUS' => $user['active'] == '1' ? 'Active' : 'Disabled', 'STATUS_LABEL' => $user['active'] == '1' ? 'success' : 'error'));
     }
     $objTPL->parse('panel', false);
     Core_Classes_coreObj::getAdminCP()->setupBlock('body', array('cols' => 3, 'vars' => array('TITLE' => 'User Management', 'CONTENT' => $objTPL->get_html('panel', false), 'ICON' => 'fa-icon-user'), 'custom_html' => array('HTML' => Core_Classes_coreObj::getForm()->inputBox('search_user', 'text', '', array('class' => 'input-mini', 'placeholder' => 'Search..')))));
 }
    /**
     * Simple Debug info
     *
     * @version 1.0
     * @since   1.0.0
     * @author  Dan Aldridge
     * 
     * @return  void
     */
    public function systeminfo()
    {
        $objSQL = Core_Classes_coreObj::getDBO();
        $objTPL = Core_Classes_coreObj::getTPL();
        $objTime = Core_Classes_coreObj::getTime();
        $objForm = Core_Classes_coreObj::getForm();
        $objTPL->set_filenames(array('body' => cmsROOT . Core_Classes_Page::$THEME_ROOT . 'block.tpl'));
        // checkers
        // grab some info about GD
        if (function_exists('gd_info')) {
            $a = gd_info();
            $gdVer = preg_replace('/[[:alpha:][:space:]()]+/', '', $a['GD Version']);
        } else {
            $gdVer = 'Not Installed.';
        }
        $info = '<div class="alert alert-info"><strong>Important!</strong> This panel needs more updating to output more useful data that has been made avaliable during the last overhaul</div>';
        $content = 'This panel gives the CMS dev team some information about your setup.

;--System Setup
    CMS Version: ' . CMS_VERSION . '
    PHP Version: ' . PHP_VERSION . ' (' . (@ini_get('safe_mode') == '1' || strtolower(@ini_get('safe_mode')) == 'on' ? 'Safe Mode Enabled' : 'Safe Mode Disabled') . ')
    MySQL Version: ' . mysql_get_server_info() . '

    GD Version: ' . $gdVer . '

;--CMS Setup
    Install Path: /' . root() . '

' . json_encode($objSQL->fetchAll('SELECT * FROM `#__config`')) . '';
        Core_Classes_coreObj::getAdminCP()->setupBlock('body', array('cols' => 3, 'vars' => array('TITLE' => 'System Info', 'CONTENT' => $info . $objForm->textarea('sysInfo', $content, array('style' => 'width: 99%', 'rows' => 20)), 'ICON' => 'fa-icon-user')));
    }
 /**
  * Generates a form for the site configuration
  *
  * @version 1.0
  * @since   1.0.0
  * @author  Dan Aldridge
  * 
  * @return  void
  */
 public function siteConfig()
 {
     Core_Classes_coreObj::getPage()->addBreadcrumbs(array(array('url' => doArgs('REQUEST_URI', '', $_SERVER), 'name' => 'Site Config')));
     $objForm = Core_Classes_coreObj::getForm();
     $objTPL = Core_Classes_coreObj::getTPL();
     $yn = array(1 => langVar('L_YES'), 0 => langVar('L_NO'));
     $fields = array(langVar('L_SITE_CONFIG') => '_header_', langVar('L_SITE_TITLE') => $objForm->inputbox('title', 'text', $this->config('site', 'title')), langVar('L_SITE_SLOGAN') => $objForm->inputbox('slogan', 'text', $this->config('site', 'slogan')), langVar('L_ADMIN_EMAIL') => $objForm->inputbox('admin_email', 'text', $this->config('site', 'admin_email')), langVar('L_GANALYTICS') => $objForm->inputbox('google_analytics', 'input', $this->config('site', 'google_analytics')), langVar('L_CUSTOMIZE') => '_header_', langVar('L_THEME_OVERRIDE') => $objForm->radio('theme_override', $yn, $this->config('site', 'theme_override')), langVar('L_SITE_TZ') => $timezone, langVar('L_DST') => $objForm->radio('dst', $yn, $this->config('time', 'dst')), langVar('L_DEF_DATE_FORMAT') => $objForm->inputbox('default_format', 'input', $this->config('time', 'default_format')));
     $form = $objForm->outputForm(array('FORM_START' => $objForm->start('panel', array('method' => 'POST', 'action' => $saveUrl, 'class' => 'form-horizontal')), 'FORM_END' => $objForm->finish(), 'FORM_TITLE' => $mod_name, 'FORM_SUBMIT' => $objForm->button('submit', 'Submit', array('class' => 'btn-primary')), 'FORM_RESET' => $objForm->button('reset', 'Reset'), 'HIDDEN' => $objForm->inputbox('sessid', 'hidden', $sessid) . $objForm->inputbox('id', 'hidden', $uid)), array('field' => $fields, 'desc' => array(langVar('L_INDEX_MODULE') => langVar('L_DESC_IMODULE'), langVar('L_SITE_TZ') => langVar('L_DESC_SITE_TZ'), langVar('L_DEF_DATE_FORMAT') => langVar('L_DESC_DEF_DATE'), langVar('L_DEF_THEME') => langVar('L_DESC_DEF_THEME'), langVar('L_THEME_OVERRIDE') => langVar('L_DESC_THEME_OVERRIDE'), langVar('L_ALLOW_REGISTER') => langVar('L_DESC_ALLOW_REGISTER'), langVar('L_EMAIL_ACTIVATE') => langVar('L_DESC_EMAIL_ACTIVATE'), langVar('L_MAX_LOGIN_TRIES') => langVar('L_DESC_MAX_LOGIN'), langVar('L_REMME') => langVar('L_DESC_REMME'), langVar('L_GANALYTICS') => langVar('L_DESC_GANALYTICS')), 'errors' => $_SESSION['site']['panel']['error']), array('header' => '<h4>%s</h4>', 'dedicatedHeader' => true, 'parseDesc' => true));
     Core_Classes_coreObj::getAdminCP()->setupBlock('body', array('cols' => 3, 'vars' => array('TITLE' => 'Site Configuration', 'CONTENT' => $form, 'ICON' => 'fa-icon-user')));
 }
Esempio n. 4
0
 /**
  * Adds a new link to the menu
  * 
  * @version 1.0
  * @since   1.0.0
  * @author  Dan Aldridge
  * 
  * @return  void
  */
 public function newlink()
 {
     $objTPL = Core_Classes_coreObj::getTPL();
     $objSQL = Core_Classes_coreObj::getDBO();
     $objPage = Core_Classes_coreObj::getPage();
     $objForm = Core_Classes_coreObj::getForm();
     $objPage->addJSFile(array('src' => '/' . root() . 'modules/core/assets/javascript/admin/menus/custom.js'), 'footer');
     // List the different types of menus
     $query = $objSQL->queryBuilder()->select('id', 'menu_name')->from('#__menus')->groupBy('menu_name')->build();
     $menus = $objSQL->fetchAll($query, 'id');
     $options = array();
     foreach ($menus as $id => $menu) {
         $options[$menu['menu_name']] = $menu['menu_name'];
     }
     $options['*add*'] = 'Add to new menu..';
     $form = $objForm->outputForm(array('FORM_START' => $objForm->start('new_link', array('method' => 'POST', 'action' => '/' . root() . 'admin/core/menus/newlinkSave/', 'class' => 'form-horizontal')), 'FORM_END' => $objForm->finish(), 'FORM_TITLE' => 'Add a link', 'FORM_SUBMIT' => $objForm->button('submit', 'Submit', array('class' => 'btn btn-info')), 'FORM_RESET' => $objForm->button('reset', 'Reset')), array('field' => array('Link Name' => $objForm->inputbox('name', 'text'), 'URL' => $objForm->inputbox('url', 'text'), 'Menu Identifier' => $objForm->select('ident1', $options) . $objForm->inputbox('ident2', 'input', '', array('class' => 'hide')), 'External Link?' => $objForm->radio('external', array('0' => langVar('L_YES'), '1' => langVar('L_NO')), 0)), 'desc' => array(), 'errors' => $_SESSION['errors']['menus']));
     $objTPL->parse('panel', false);
     Core_Classes_coreObj::getAdminCP()->setupBlock('body', array('cols' => 3, 'vars' => array('TITLE' => 'Menu Administration', 'CONTENT' => $form, 'ICON' => 'icon-th-list')));
 }
Esempio n. 5
0
 /**
  * Outputs a table with currently detected themes in
  *
  * @version 1.0
  * @since   1.0.0
  * @author  Dan Aldridge
  * 
  * @return  void
  */
 public function themes()
 {
     $objForm = Core_Classes_coreObj::getForm();
     $objTPL = Core_Classes_coreObj::getTPL();
     $objTPL->set_filenames(array('body' => cmsROOT . Core_Classes_Page::$THEME_ROOT . 'block.tpl', 'table' => cmsROOT . 'modules/core/views/admin/themes/manageTable.tpl'));
     $dir = cmsROOT . 'themes';
     $tpls = getFiles($dir);
     //echo dump($tpls);
     foreach ($tpls as $tpl) {
         if ($tpl['type'] !== 'dir') {
             continue;
         }
         $tplName = secureMe($tpl['name'], 'alphanum');
         $details = $this->getDetails($tplName);
         //echo dump($details, $tplName);
         $objTPL->assign_block_vars('theme', array('NAME' => doArgs('name', 'N/A', $details), 'VERSION' => doArgs('version', '0.0', $details), 'ENABLED' => 'true', 'COUNT' => '9001', 'MODE' => doArgs('mode', 'N/A', $details), 'AUTHOR' => doArgs('author', 'N/A', $details)));
     }
     $objTPL->parse('table', false);
     Core_Classes_coreObj::getAdminCP()->setupBlock('body', array('cols' => 3, 'vars' => array('TITLE' => 'Theme Management', 'CONTENT' => $objTPL->get_html('table', false), 'ICON' => 'fa-icon-user')));
 }
Esempio n. 6
0
 public function block_login($block)
 {
     $objTPL = Core_Classes_coreObj::getTPL();
     $objForm = Core_Classes_coreObj::getForm();
     $objSession = Core_Classes_coreObj::getSession();
     $objPage = Core_Classes_coreObj::getPage();
     if (Core_Classes_User::$IS_ONLINE) {
         $objPage->redirect('/' . root());
     }
     $objTPL->set_filenames(array('block_login' => cmsROOT . 'modules/core/views/module/login_form/block.tpl'));
     $form = array('FORM_START' => $objForm->start('login', array('method' => 'POST', 'action' => '/' . root() . 'login?')), 'FORM_END' => $objForm->finish(), 'HIDDEN' => $objForm->inputbox('hash', 'hidden', $objSession->getFormToken(true)), 'L_USERNAME' => langVar('L_USERNAME'), 'F_USERNAME' => $objForm->inputbox('username', 'text', '', array('class' => 'icon username', 'required' => true)), 'L_PASSWORD' => langVar('L_PASSWORD'), 'F_PASSWORD' => $objForm->inputbox('password', 'password', '', array('class' => 'icon password', 'required' => true)), 'L_REMME' => langVar('L_REMME'), 'F_REMME' => $objForm->select('remember', array('0' => 'No Thanks', '1' => 'Forever'), array('selected' => 0)), 'SUBMIT' => $objForm->button('submit', 'Login', array('class' => 'btn btn-success')));
     $objTPL->reset_block_vars('login');
     $objTPL->assign_block_vars('login', $form);
     $objTPL->assign_vars(array('TITLE' => $block['title']));
     if (isset($_SESSION['login']['errors']) && count($_SESSION['login']['errors'])) {
         foreach ($_SESSION['login']['errors'] as $error) {
             $objTPL->assign_block_vars('login.errors', array('ERROR' => $error));
         }
         unset($_SESSION['login']);
     }
     return $objTPL->get_html('block_login');
 }
Esempio n. 7
0
/**
 * Displays a confirmation messagebox.
 *
 * @version 1.0
 * @since   1.0.0
 * @author  Dan Aldridge
 *
 * @param   string $type
 * @param   string $msg
 * @param   string $title
 * @param   string $tplVar
 *
 * @return  bool
 */
function confirmMsg($type, $msg, $title = NULL, $tplVar = NULL)
{
    $objPage = Core_Classes_coreObj::getPage();
    $objForm = Core_Classes_coreObj::getForm();
    $objUser = Core_Classes_coreObj::getUser();
    //check if we have confirmed either way yet
    if (!HTTP_POST) {
        //setup redirects and session ids
        $_SESSION['site']['confirm']['return'] = isset($_SERVER['HTTP_REFERER']) && !is_empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/' . root() . '';
        $_SESSION['site']['confirm']['sessid'] = $sessid = $objUser->mkPassword($objUser->grab('username') . time());
        //and the form, atm its gotta be crude, it'll be sexied up for the rebuild
        $newMsg = $objForm->start('msg', array('method' => 'POST'));
        $newMsg .= $msg . '<br />';
        $newMsg .= $objForm->inputbox('sessid', 'hidden', $sessid) . '<br />';
        $newMsg .= '<div align="center">' . $objForm->button('submit', 'Continue') . ' ' . $objForm->button('submit', 'Go Back', array('class' => 'black')) . '</div>';
        $newMsg .= $objForm->finish();
        //use msg() to output and return false so the code wont exec below
        echo msg($type, $newMsg, $tplVar, $title);
        return false;
    } else {
        //now we have confirmed, lets do a little sanity checking
        $redir = $_SESSION['site']['confirm']['return'];
        //we have the sessid
        if (!isset($_POST['sessid'])) {
            hmsgDie('FAIL', 'Error: Please confirm your intentions via the form.');
        }
        if ($_POST['sessid'] != $_SESSION['site']['confirm']['sessid']) {
            hmsgDie('FAIL', 'Error: Could not verify your intentions.');
        }
        //dont need this anymore
        unset($_SESSION['site']['confirm']);
        //make sure we actually have the submit
        if (!isset($_POST['submit'])) {
            hmsgDie('FAIL', 'Error: Could not verify your intentions.');
        }
        //now check for what we expect and act accordingly
        if ($_POST['submit'] == 'Continue') {
            return true;
        }
        if ($_POST['submit'] == 'Go Back') {
            $objPage->redirect($redir, 3, 0);
            hmsgDie('INFO', 'Redirecting you back.');
        }
        //if we get here, they tried to play us, so lets just return false anyway
        return false;
    }
}