Beispiel #1
0
 /**
  * Generate a date string from a timestamp
  *
  * @version     1.0
  * @since       1.0.0
  * @author      Dan Aldridge
  *
  * @param       int       $timestamp
  * @param       string    $format
  * @param       bool      $format
  *
  * @return      string
  */
 public function mk_time($timestamp, $format = 'db', $return = 0)
 {
     // Get the instances we need
     $objUser = Core_Classes_coreObj::getUser();
     $translate = array();
     $format = $format == 'db' ? $this->config('site', 'time', 'jS F h:ia') : $format;
     $timestamp = isset($timestamp) ? $timestamp : time();
     $timestamp = date('I') == 0 ? $this->mod_time($timestamp, 0, 0, 1) : $timestamp;
     // If User is logged in, Use his/her timezone
     if (Core_Classes_User::$IS_ONLINE && $objUser->grab('timezone')) {
         $this->mod_time($timestamp, 0, 0, $objUser->grab('timezone'));
     }
     // Translate the date if it's possible
     if (empty($translate) && $this->currentLanguage != 'en') {
         $lang_date = langVar('DATETIME');
         reset($lang_date);
         while (list($match, $replace) = each($lang_date)) {
             $translate[$match] = $replace;
         }
     }
     // If we're not meant to return anything,
     if ($return === 0) {
         $return = gmdate($format, $timestamp);
         // Execute translation if there is a translation
         if (!empty($translate)) {
             $return = strtr($return, $translate);
         }
     } else {
         $return = $timestamp;
     }
     // Tidy up
     unset($objUser, $translate, $format, $timestamp, $lang_date, $match, $replace, $format);
     return $return;
 }
 /**
  * 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')));
 }
Beispiel #3
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')));
 }
Beispiel #4
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');
 }
Beispiel #5
0
 /**
  * Generates a ACL list for categories
  *
  * @version 2.0
  * @since   1.0.0
  * @author  xLink
  *
  * @param   constant    $type
  * @param   int         $forum_id
  *
  * @return  array
  */
 public function auth($type, $forum_id, $f_access = NULL)
 {
     switch ($type) {
         case AUTH_ALL:
             $a_sql = 'a.auth_view, a.auth_read, a.auth_post, a.auth_reply, a.auth_edit, a.auth_del, a.auth_move, a.auth_special';
             $auth_fields = array('auth_view', 'auth_read', 'auth_post', 'auth_reply', 'auth_edit', 'auth_del', 'auth_move', 'auth_special');
             break;
         case AUTH_VIEW:
             $a_sql = 'a.auth_view';
             $auth_fields = array('auth_view');
             break;
         case AUTH_READ:
             $a_sql = 'a.auth_read';
             $auth_fields = array('auth_read');
             break;
         case AUTH_POST:
             $a_sql = 'a.auth_post';
             $auth_fields = array('auth_post');
             break;
         case AUTH_REPLY:
             $a_sql = 'a.auth_reply';
             $auth_fields = array('auth_reply');
             break;
         case AUTH_EDIT:
             $a_sql = 'a.auth_edit';
             $auth_fields = array('auth_edit');
             break;
         case AUTH_DELETE:
             $a_sql = 'a.auth_del';
             $auth_fields = array('auth_del');
             break;
         case AUTH_MOVE:
             $a_sql = 'a.auth_move';
             $auth_fields = array('auth_move');
             break;
         case AUTH_SPECIAL:
             $a_sql = 'a.auth_special';
             $auth_fields = array('auth_special');
             break;
         default:
             break;
     }
     //check if we need to return perms for a specific forum or the entire lot
     if (empty($f_access)) {
         if (!isset($this->authQuery[$type][$forum_id])) {
             $forum_match_sql = $forum_id != AUTH_LIST_ALL ? 'WHERE a.id = ' . $forum_id : '';
             $sql = 'SELECT a.id, %s FROM `$Pforum_cats` a %s';
             $function = $forum_id != AUTH_LIST_ALL ? 'getLine' : 'getTable';
             if (!($this->authQuery[$type][$forum_id] = $f_access = $this->objSQL->{$function}($sql, array($a_sql, $forum_match_sql)))) {
                 $this->objSQL->freeResult($f_access);
                 return array();
             }
             $this->objSQL->freeResult($f_access);
         } else {
             $f_access = $this->authQuery[$type][$forum_id];
         }
     }
     // If the user isn't logged on then all we need do is check if the forum
     // has the type set to ALL, if yes they are good to go, if not then they
     // are denied access
     $u_access = array();
     if (user::$IS_ONLINE) {
         if (!isset($this->authQuery2[$type][$forum_id])) {
             if (!isset($this->authQuery3)) {
                 $this->authQuery3 = $query = $this->objSQL->getTable('SELECT a.cat_id, %s, a.auth_mod
                         FROM `$Pforum_auth` a, `$Pgroup_subs` ug
                         WHERE ug.uid = "%s"
                             AND ug.pending = 0
                             AND a.group_id = ug.gid', array($a_sql, $this->objUser->grab('id')));
                 if ($query === false) {
                     hmsgDie('FAIL', 'Error: Cannot retreive the forum authorization');
                 }
             } else {
                 $query = $this->authQuery3;
             }
             if (count($query)) {
                 foreach ($query as $row) {
                     if ($forum_id != AUTH_LIST_ALL) {
                         $u_access[] = $row;
                     } else {
                         $u_access[$row['cat_id']][] = $row;
                     }
                 }
             }
             $this->authQuery2[$type][$forum_id] = $u_access;
             $this->objSQL->freeResult($query);
         } else {
             $u_access = $this->authQuery2[$type][$forum_id];
         }
     }
     $is_admin = User::$IS_ONLINE && User::$IS_ADMIN ? true : 0;
     $auth_user = array();
     $icount = count($auth_fields);
     for ($i = 0; $i < $icount; $i++) {
         $key = $auth_fields[$i];
         if ($forum_id != AUTH_LIST_ALL) {
             $value = $f_access[$key];
             switch ($value) {
                 case AUTH_ALL:
                     $auth_user[$key] = true;
                     $auth_user[$key . '_type'] = langVar('L_Auth_Anonymous_Users');
                     break;
                 case AUTH_REG:
                     $auth_user[$key] = User::$IS_ONLINE ? true : 0;
                     $auth_user[$key . '_type'] = langVar('L_Auth_Registered_Users');
                     break;
                 case AUTH_ACL:
                     $auth_user[$key] = User::$IS_ONLINE ? $this->objUser->checkUserAuth(AUTH_ACL, $key, $u_access, $is_admin) : 0;
                     $auth_user[$key . '_type'] = langVar('L_Auth_Users_granted_access');
                     break;
                 case AUTH_MOD:
                     $auth_user[$key] = User::$IS_ONLINE ? $this->objUser->checkUserAuth(AUTH_MOD, 'auth_mod', $u_access, $is_admin) : 0;
                     $auth_user[$key . '_type'] = langVar('L_Auth_Moderators');
                     break;
                 case AUTH_ADMIN:
                     $auth_user[$key] = $is_admin;
                     $auth_user[$key . '_type'] = langVar('L_Auth_Administrators');
                     break;
                 default:
                     $auth_user[$key] = 0;
                     break;
             }
         } else {
             $kcount = count($f_access);
             for ($k = 0; $k < $kcount; $k++) {
                 $value = $f_access[$k][$key];
                 $f_fid = $f_access[$k]['id'];
                 $u_access[$f_fid] = isset($u_access[$f_fid]) ? $u_access[$f_fid] : array();
                 switch ($value) {
                     case AUTH_ALL:
                         $auth_user[$f_fid][$key] = true;
                         $auth_user[$f_fid][$key . '_type'] = langVar('L_Auth_Anonymous_Users');
                         break;
                     case AUTH_REG:
                         $auth_user[$f_fid][$key] = User::$IS_ONLINE ? true : 0;
                         $auth_user[$f_fid][$key . '_type'] = langVar('L_Auth_Registered_Users');
                         break;
                     case AUTH_ACL:
                         $auth_user[$f_fid][$key] = User::$IS_ONLINE ? $this->objUser->checkUserAuth(AUTH_ACL, $key, $u_access[$f_fid], $is_admin) : 0;
                         $auth_user[$f_fid][$key . '_type'] = langVar('L_Auth_Users_granted_access');
                         break;
                     case AUTH_MOD:
                         $auth_user[$f_fid][$key] = User::$IS_ONLINE ? $this->objUser->checkUserAuth(AUTH_MOD, 'auth_mod', $u_access[$f_fid], $is_admin) : 0;
                         $auth_user[$f_fid][$key . '_type'] = langVar('L_Auth_Moderators');
                         break;
                     case AUTH_ADMIN:
                         $auth_user[$f_fid][$key] = $is_admin;
                         $auth_user[$f_fid][$key . '_type'] = langVar('L_Auth_Administrators');
                         break;
                     default:
                         $auth_user[$f_fid][$key] = 0;
                         break;
                 }
             }
         }
     }
     // Is user a moderator?
     if ($forum_id != AUTH_LIST_ALL) {
         $auth_user['auth_mod'] = User::$IS_ONLINE ? $this->objUser->checkUserAuth(AUTH_MOD, 'auth_mod', $u_access, $is_admin) : 0;
     } else {
         for ($k = 0; $k < count($f_access); $k++) {
             $f_fid = $f_access[$k]['id'];
             $u_access[$f_fid] = isset($u_access[$f_fid]) ? $u_access[$f_fid] : array();
             $auth_user[$f_fid]['auth_mod'] = User::$IS_ONLINE ? $this->objUser->checkUserAuth(AUTH_MOD, 'auth_mod', $u_access[$f_fid], $is_admin) : 0;
         }
     }
     return $auth_user;
 }
<?php

/*======================================================================*\
||              Cybershade CMS - Your CMS, Your Way                     ||
\*======================================================================*/
if (!defined('INDEX_CHECK')) {
    die('Error: Cannot access directly.');
}
if (!defined('PANEL_CHECK')) {
    die('Error: Cannot include panel from current location.');
}
$objPage->setTitle(langVar('B_ACP') . ' > ' . langVar('L_OVERVIEW'));
$objPage->addPagecrumb(array(array('url' => $url, 'name' => langVar('L_OVERVIEW'))));
$objTPL->set_filenames(array('body' => 'modules/core/template/panels/panel.admin_overview.tpl'));
$mode = doArgs('mode', false, $_GET);
$objTPL->assign_vars(array('ADMIN_MODE' => langVar('L_NOTIFICATIONS')));
$objTPL->parse('body', false);
Beispiel #7
0
 public function tplGlobals()
 {
     $objUser = Core_Classes_coreObj::getUser();
     $tplGlobals = array('ROOT' => root(), 'THEME_ROOT' => root() . self::$THEME_ROOT, 'SITE_TITLE' => $this->config('site', 'title'), 'USERNAME' => $objUser->grab('username'), 'U_UCP' => '/' . root() . 'user/', 'L_UCP' => langVar('L_UCP'));
     if (!Core_Classes_User::$IS_ONLINE) {
         $tplGlobals += array('U_LOGIN' => '/' . root() . 'login', 'L_LOGIN' => 'Login');
     } else {
         $tplGlobals += array('U_LOGIN' => '/' . root() . 'logout?check=' . $objUser->grab('usercode'), 'L_LOGIN' => 'Logout');
     }
     $moreTPL = Core_Classes_coreObj::getPlugins()->hook('CMS_PAGE_TPL_GLOBALS');
     if (is_array($moreTPL) && count($moreTPL) > 1) {
         foreach ($moreTPL as $vars) {
             $tplGlobals = array_merge($tplGlobals, $vars);
         }
     }
     Core_Classes_coreObj::getTPL()->assign_vars($tplGlobals);
 }
            if (doArgs($setting, false, $_POST) != $objCore->config('site', $setting, true)) {
                $update[$setting] = $_POST[$setting];
            }
        }
        //if we have stuff to update
        if (count($update)) {
            foreach ($update as $setting => $value) {
                $update = $objSQL->updateRow('config', array('value' => $value), array('var = "%s"', $setting));
                if (!$update) {
                    $failed[$setting] = $objSQL->error();
                }
            }
        }
        //if we have a setting that failed, let the user know
        if (!is_empty($failed)) {
            $msg = null;
            foreach ($failed as $setting => $error) {
                $msg .= $setting . ': ' . $error . '<br />';
            }
            $objPage->redirect($url, 7);
            hmsgDie('FAIL', langVar('L_SET_NOT_UPDATED', $msg));
        }
        //unset the panel info and reset the cache
        unset($_SESSION['site']['panel']);
        $objCache->regenerateCache('config');
        //and redirect back
        $objPage->redirect($url, 3);
        hmsgDie('OK', langVar('L_SET_UPDATED'));
        break;
}
$objTPL->parse('body', false);
Beispiel #9
0
     $_SESSION['login']['cs_hash'] = $hash;
     $userValue = $acpCheck ? $objUser->grab('username') : '';
     $submit = $acpCheck ? '' : 'loginChecker();return false;';
     if ($acpCheck) {
         $hidden .= $objForm->inputbox('username', 'hidden', $userValue);
     }
     $fields = array(langVar('L_USERNAME') => $objForm->inputbox('username', 'text', $userValue, array('class' => 'icon username', 'br' => true, 'disabled' => $acpCheck, 'required' => !$acpCheck)), langVar('L_PASSWORD') => $objForm->inputbox('password', 'password', '', array('class' => 'icon password', 'br' => true, 'required' => !$acpCheck)));
     //we do want let them auto login? acpCheck auto disables it
     if ($objCore->config('login', 'remember_me') && !$acpCheck) {
         $fields += array(langVar('L_REMBER_ME') => $objForm->select('remember', array('0' => 'No Thanks', '1' => 'Forever'), array('selected' => 0)));
     }
     //but enables the pin portion of the form
     if ($acpCheck) {
         $fields += array(langVar('L_PIN') => $objForm->inputbox('pin', 'password', '', array('class' => 'icon pin', 'br' => true, 'autocomplete' => false)));
     }
     $objForm->outputForm(array('FORM_START' => $objForm->start('panel', array('method' => 'POST', 'action' => '/' . root() . 'login.php?action=check')), 'FORM_END' => $objForm->finish(), 'FORM_TITLE' => langVar('L_LOGIN'), 'FORM_SUBMIT' => $objForm->button('submit', 'Login'), 'FORM_RESET' => $objForm->button('reset', 'Reset'), 'HIDDEN' => $hidden . $objForm->inputbox('hash', 'hidden', $hash)), array('field' => $fields, 'desc' => array(langVar('L_PIN') => langVar('L_PIN_DESC')), 'errors' => $_SESSION['site']['panel']['error']), array('header' => '<h4>%s</h4>', 'dedicatedHeader' => true, 'parseDesc' => true));
     $objTPL->parse('body', false);
     break;
 case 'check':
     if (!HTTP_POST) {
         $objPage->redirect('?');
     }
     if (User::$IS_ONLINE && !$acpCheck && !isset($_GET['ajax'])) {
         $objPage->redirect('/' . root() . 'index.php');
     }
     $objLogin->doLogin(isset($_GET['ajax']) && HTTP_AJAX ? true : false);
     break;
 case 'active':
     if (!isset($_GET['un']) || !isset($_GET['check'])) {
         hmsgDie('FAIL', 'Cannot activate your account, Please use all the url sent to you in the email');
     } else {
Beispiel #10
0
 public function categoryModify()
 {
     //grab the ID, if its set to 0 then we want to add a category
     $id = doArgs('id', -1, $_GET, 'is_number');
     if ($id == -1) {
         hmsgDie('FAIL', 'Error: Invalid ID passed.');
     }
     //grab the forum category
     if ($id != 0) {
         $cat = $this->objForum->getForumInfo($id);
         if (!$cat) {
             hmsgDie('FAIL', 'Error: Could not find category by ID');
         }
         $cat = $cat[0];
     } else {
         $cat = array('title' => '', 'parent_id' => 0, 'desc' => '', 'auth_view' => 0, 'auth_read' => 0, 'auth_post' => 0, 'auth_reply' => 0, 'auth_edit' => 0, 'auth_del' => 0, 'auth_move' => 0, 'auth_special' => 0, 'auth_mod' => 0);
     }
     $this->objPage->setTitle(langVar($id != 0 ? 'L_EDIT_CAT' : 'L_ADD_CAT'));
     $this->objPage->addPagecrumb(array(array('url' => '/' . root() . 'admin/forum/setup/', 'name' => 'Category Management'), array('url' => $_url, 'name' => langVar($id != 0 ? 'L_EDIT_CAT' : 'L_ADD_CAT'))));
     if (!HTTP_POST) {
         $this->objPage->addJSFile('/' . root() . 'modules/forum/scripts/admin_catEdit.js');
         $this->objTPL->set_filenames(array('body' => 'modules/forum/template/admin/panel.edit_category.tpl'));
         $permList = array();
         $permList['0'] = 'Everyone';
         $permList['1'] = 'Registered Only';
         $permList['2'] = 'With Permission';
         $permList['3'] = 'Moderators Only';
         $permList['5'] = 'Admin Only';
         $field_names = array('auth_view' => array('View', 'Determine whether it is visible on listings.'), 'auth_read' => array('Read', 'Determine whether this categories contents are readable.'), 'auth_post' => array('Post', 'Determine if this category can be posted to.'), 'auth_reply' => array('Reply', 'Determine if the threads in this category can be replied to.'), 'auth_edit' => array('Edit', 'Deternine if the threads in this category can be editable.'), 'auth_del' => array('Delete', 'Deternine if the threads in this category can be deleted.'), 'auth_move' => array('Move', 'Deternine if the threads in this category can be moved.'), 'auth_special' => array('Special', 'Determine who has the ability to add special items(attachments, polls, etc) to a thread/post.'), 'auth_mod' => array('Moderate', 'Determine who gets to moderate this category.'));
         $perms = NULL;
         $j = 0;
         $img = '/' . root() . 'images/icons/help.png';
         foreach ($cat as $k => $v) {
             $match = preg_match('/auth_([a-zA-Z]*)/is', $k, $m);
             if (!$match) {
                 continue;
             }
             $perms .= '<td><div class="float-left"><img src="' . $img . '" alt="' . $field_names[$m[0]][1] . '" title="' . $field_names[$m[0]][1] . '" />' . $field_names[$m[0]][0] . ':</div>' . '<div class="float-right">' . $this->objForm->select($m[0], $permList, array('fancy' => false, 'extra' => 'data-js="changeme"')) . '</div></td>';
             if ($j++ == 4) {
                 $j = 0;
                 $perms .= '</tr><tr>';
             }
         }
         //this var handles the quick permission select box, this determines
         //  View      Read          Post        Reply       Edit        Delete          Move      Special       Moderate
         $simple_auth_array = array('01' => 'Change Me', AUTH_ALL . ',' . AUTH_ALL . ',' . AUTH_ALL . ',' . AUTH_ALL . ',' . AUTH_REG . ',' . AUTH_REG . ',' . AUTH_MOD . ',' . AUTH_MOD . ',' . AUTH_MOD => 'Everyone', AUTH_ALL . ',' . AUTH_ALL . ',' . AUTH_REG . ',' . AUTH_REG . ',' . AUTH_REG . ',' . AUTH_REG . ',' . AUTH_MOD . ',' . AUTH_MOD . ',' . AUTH_MOD => 'Registered', AUTH_REG . ',' . AUTH_REG . ',' . AUTH_REG . ',' . AUTH_REG . ',' . AUTH_REG . ',' . AUTH_REG . ',' . AUTH_MOD . ',' . AUTH_MOD . ',' . AUTH_MOD => 'Registered [ Hidden ]', AUTH_ALL . ',' . AUTH_ACL . ',' . AUTH_ACL . ',' . AUTH_ACL . ',' . AUTH_ACL . ',' . AUTH_ACL . ',' . AUTH_MOD . ',' . AUTH_MOD . ',' . AUTH_MOD => 'With Permission', AUTH_ACL . ',' . AUTH_ACL . ',' . AUTH_ACL . ',' . AUTH_ACL . ',' . AUTH_ACL . ',' . AUTH_ACL . ',' . AUTH_MOD . ',' . AUTH_MOD . ',' . AUTH_MOD => 'With Permission [ Hidden ]', AUTH_ALL . ',' . AUTH_MOD . ',' . AUTH_MOD . ',' . AUTH_MOD . ',' . AUTH_MOD . ',' . AUTH_MOD . ',' . AUTH_MOD . ',' . AUTH_MOD . ',' . AUTH_MOD => 'Moderators', AUTH_MOD . ',' . AUTH_MOD . ',' . AUTH_MOD . ',' . AUTH_MOD . ',' . AUTH_MOD . ',' . AUTH_MOD . ',' . AUTH_MOD . ',' . AUTH_MOD . ',' . AUTH_MOD => 'Moderators [ Hidden ]', '02' => '---', AUTH_ALL . ',' . AUTH_ALL . ',' . AUTH_MOD . ',' . AUTH_REG . ',' . AUTH_REG . ',' . AUTH_MOD . ',' . AUTH_MOD . ',' . AUTH_MOD . ',' . AUTH_MOD => 'News Category');
         $this->objTPL->assign_vars(array('L_EDITING_CAT' => langVar($id != 0 ? 'L_EDIT_CAT' : 'L_ADD_CAT'), 'FORM_START' => $this->objForm->start('admin', array('method' => 'POST', 'action' => '/' . root() . 'admin/forum/setup/edit/?action=save&id=' . $id)), 'FORM_END' => $this->objForm->finish(), 'L_CAT_NAME' => 'Category Name', 'CAT_NAME' => $this->objForm->inputbox('title', 'input', $cat['title'], array('extra' => 'style="width:99%"')), 'L_CAT_DESC' => 'Category Desc', 'CAT_DESC' => $this->objForm->textarea('desc', $cat['desc'], array('extra' => 'style="width:99%"', 'rows' => '3')), 'L_CAT_ATTACH' => 'Attach Forum To', 'CAT_ATTACH' => $this->objForum->buildJumpBox('parent_id', $this->objForum->buildJumpBoxArray(array('id' => 0, 'title' => 'Forum Root')), $cat['parentid']), 'L_CAT_PERMS' => 'Category Default Permissions', 'CAT_PERMS' => $perms, 'L_QUICK_PERMS' => 'Quick Swap Perms', 'QUICK_PERMS' => $this->objForm->select('quick_perms', $simple_auth_array, array('fancy' => false)), 'SUBMIT' => $this->objForm->button('submit', 'Save'), 'RESET' => $this->objForm->button('reset', 'Reset')));
         $this->objTPL->parse('body', false);
     } else {
         $cats = $this->objSQL->getTable('SELECT id FROM `$Pforum_cats`');
         #if(!$cats){ hmsgDie('FAIL', 'Error: Could not request forum categories.'); }
         $catRange = array(0);
         //set a default of 0, for the new "Master Cat"
         if ($cats) {
             foreach ($cats as $cat) {
                 $catRange[] = $cat['id'];
             }
         }
         $authRange = range(0, 5);
         $needed = array('title' => 'string', 'parentid' => $catRange, 'desc' => 'string', 'auth_view' => $authRange, 'auth_read' => $authRange, 'auth_post' => $authRange, 'auth_reply' => $authRange, 'auth_edit' => $authRange, 'auth_del' => $authRange, 'auth_move' => $authRange, 'auth_special' => $authRange, 'auth_mod' => $authRange);
         unset($update);
         foreach ($needed as $field => $vals) {
             //if what we need aint there, just continue
             if (!isset($_POST[$field])) {
                 continue;
             }
             //now check if its not an array, then we want to check if its empty
             if (!is_array($vals) && empty($_POST[$field])) {
                 continue;
             }
             //its an array, so check if the value from the post, is in the acceptable array
             if (is_array($vals) && !in_array($_POST[$field], $vals)) {
                 continue;
             }
             $update[$field] = $_POST[$field];
         }
         if ($id != 0) {
             $update = $this->objSQL->updateRow('forum_cats', $update, 'id = ' . $id, 'Forum: Updated category - ' . $update['title']);
             $this->objPage->redirect('/' . root() . 'admin/forum/setup/edit/?id=' . $id, 2);
             if (!$update) {
                 hmsgDie('FAIL', 'Error: Update Failed.');
             }
             hmsgDie('INFO', 'Update Successful.');
         } else {
             $AI = $this->objSQL->getAI('forum_cats');
             $update = $this->objSQL->insertRow('forum_cats', $update, 'Forum: Added new category - ' . $update['title']);
             $this->objPage->redirect('/' . root() . 'admin/forum/setup/edit/?id=' . $AI, 2);
             if (!$update) {
                 hmsgDie('FAIL', 'Error: Adding new category Failed.');
             }
             hmsgDie('INFO', 'New Category Added.');
         }
     }
 }
 function showProfile($uid)
 {
     if (!User::$IS_ONLINE) {
         hmsgDie('FAIL', 'Error: You must be logged in to view this users profile.');
     }
     if (is_empty($uid) && User::$IS_ONLINE) {
         $this->objPage->redirect('/' . root() . 'modules/profile/view/' . $this->objUser->grab('username'), 0);
         return;
     }
     $vars = $this->objPage->getVar('tplVars');
     $user = $this->objUser->getUserInfo($uid);
     if (!count($user)) {
         $this->objPage->setTitle('Profile > User doesnt exist.');
         hmsgDie('FAIL', 'Error: User doesnt exist.');
     }
     $this->objTPL->set_filenames(array('body' => 'modules/profile/template/viewProfile.tpl'));
     $this->objPage->setTitle('Profile > ' . $user['username']);
     $this->objPage->addCSSFile('/' . root() . 'modules/profile/contactInfo.css');
     $this->objPage->addJSFile('/' . root() . 'modules/profile/scripts/profile.js');
     $this->objPage->addPagecrumb(array(array('url' => '/' . root() . 'modules/profile/view/' . $user['username'], 'name' => 'Viewing ' . secureMe($user['username']) . '\'s profile')));
     $icons = $this->contactInfoLinks($user);
     $uProfile = $this->objUser->profile($user['id']);
     if (preg_match('_"color: ([^;]*);" title="([^"]*)">([^<]*)</font>_i', $uProfile, $m)) {
         $text = $m[2];
         $color = $m[1];
     }
     $this->objComments->start('PROFILE_COMMENTS', 'cpage', 'profile', $user['id'], 20, $user['id']);
     $this->objTPL->assign_block_vars('profile', array('USERNAME' => $uProfile, 'USERNAME_RAW' => $user['username'], 'AVATAR' => $this->objUser->parseAvatar($user['id']), 'TITLE' => !is_empty($title) ? secureMe($user['title']) : '<font color="' . $color . '">' . $text . '</font>', 'PM' => User::$IS_ONLINE ? '<a href="/' . root() . 'modules/pm/compose/' . $user['username'] . '"><img src="' . $vars['PM_compose'] . '" /></a>' : '', 'SIGNATURE' => contentParse($user['signature']), 'INTERESTS' => contentParse($user['interests']), 'ABOUT_ME' => contentParse($user['about']), 'L_LOCALTIME' => 'Local Time', 'LOCALTIME' => $this->objTime->mk_time(time(), 'D jS M h:ia', $user['timezone']), 'CONTACT_ICONS' => $icons, 'L_COMMENTS' => 'Comments', 'L_RECENTA' => 'Recent Activity', 'L_BIO' => 'User Bio'));
     if (!is_empty($user['about'])) {
         $this->objTPL->assign_block_vars('profile.ABOUT_ME', array());
     }
     if (!is_empty($user['interests'])) {
         $this->objTPL->assign_block_vars('profile.INTRESTS', array());
     }
     $bio_info = array();
     $bio_info[] = !is_empty($title) ? array('var' => 'User Title', 'val' => secureMe($user['title'])) : array('var' => 'User Privs', 'val' => '<font color="' . $color . '">' . $text . '</font>');
     $bio_info[] = array('var' => 'Registered Since', 'val' => $this->objTime->mk_time($user['registerdate'], 'l jS F Y @ h:ia'));
     $bio_info[] = array('var' => langVar('L_LAST_LOGGED_IN'), 'val' => $this->objTime->mk_time($user['timestamp']));
     if ($user['birthday'] != '00/00/0000') {
         $ex = explode('/', $user['birthday']);
         $tiem = gmmktime(0, 0, 0, $ex[1], $ex[0], $ex[2]);
         $bio_info[] = array('var' => 'Birthday', 'val' => $this->objTime->mk_time($tiem, 'D jS M'));
     }
     if (!is_empty($location)) {
         $bio_info[] = array('var' => 'Location', 'val' => $location);
     }
     $i = 0;
     foreach ($bio_info as $row) {
         $this->objTPL->assign_block_vars('profile.BINFO', array('VAR' => $row['var'], 'VAL' => $row['val'], 'ROW' => $i++ % 2 == 0 ? 'row_color1' : 'row_color2'));
     }
     $this->objTPL->assign_vars(array('RECENT_ACTIVITY_MSG' => msg('INFO', 'This part of the panel is still in development. Watch this space.', 'return')));
     $this->objTPL->parse('body', false);
 }
Beispiel #12
0
 /**
  * Loads the inital vars for the tpls
  *
  * @version 2.0
  * @since   1.0.0
  * @author  xLink
  */
 public function setThemeVars()
 {
     $vars = $this->getVar('tplVars');
     //incude extras.php from the theme if it exists
     $extras = Page::$THEME_ROOT . 'extras.php';
     if (is_readable($extras)) {
         include $extras;
     }
     //define array of vars that we want
     $vars = array('ROOT' => root(), 'THEME_ROOT' => root() . Page::$THEME_ROOT, 'ACP_TROOT' => root() . $this->acpThemeROOT, 'SITE_NAME' => $this->config('site', 'site_name'), 'ROW_COLOR1' => $vars['row_color1'], 'ROW_COLOR2' => $vars['row_color2'], 'USERNAME' => $this->objUser->grab('username'), 'TIME' => $this->objTime->mk_time(time(), 'l H:i:s a'), 'U_UCP' => '/' . root() . 'user/', 'U_LOGIN' => '/' . root() . 'login.php', 'U_LOGOUT' => '/' . root() . 'login.php?action=logout&check=' . $this->objUser->grab('usercode'), 'L_UCP' => langVar('L_UCP'), 'L_LOGIN' => langVar('L_LOGIN'), 'L_LOGOUT' => langVar('L_LOGOUT'));
     //this needs to show up if we have admin perms and dont have the acp auth atm
     if ($this->objUser->grab('userlevel') == ADMIN) {
         $vars += array('ACP_LINK' => '- <a href="/' . root() . 'admin/">' . langVar('L_ACP') . '</a>');
     }
     //hook onto the array to allow others to add to this list
     $this->objPlugins->hook('CMSCore_global_tplvars', $vars);
     //if user is online, set the IS_ONLINE, and IS_LOGGED_IN blocks
     if (User::$IS_ONLINE) {
         $this->objTPL->assign_block_vars('IS_ONLINE', array());
         $this->objTPL->assign_block_vars('IS_LOGGED_IN', array());
     }
     //if user is not online, set the NOT_LOGGED_IN
     if (!User::$IS_ONLINE) {
         $this->objTPL->assign_block_vars('NOT_LOGGED_IN', array());
     }
     //if user is logged in, and is admin
     if (User::$IS_ONLINE && User::$IS_ADMIN) {
         $this->objTPL->assign_block_vars('IS_ADMIN', array());
     }
     //merge, assign and unset ^_^
     $vars = !is_empty($_more_vars) && is_array($_more_vars) ? array_merge($vars, $_more_vars) : $vars;
     $this->objTPL->assign_vars($vars);
     unset($vars);
 }
Beispiel #13
0
    hmsgDie('FAIL', 'Fatal Error - BBCode\'s not available.');
}
//
//--Module Setup
//
$file = cmsROOT . 'core/classes/class.module.php';
if (is_readable($file)) {
    require_once $file;
} else {
    hmsgDie('FAIL', 'Fatal Error - Modules cannot be loaded.');
}
//if site is closed, make it so, kill debug, no menu is needed, 'cmsCLOSED' can be used as a bypass
if ($objCore->config('site', 'site_closed') == 1 && !defined('cmsCLOSED')) {
    if ($objUser->grab('userlevel') != ADMIN) {
        $objSQL->debug = false;
        $objPage->setMenu(false);
        $objPage->setTitle('DISABLED');
        hmsgDie('INFO', 'Site has been disabled. ' . contentParse("\n" . $objCore->config('site', 'closed_msg')));
    } else {
        $objTPL->assign_block_vars('__MSG', array('MESSAGE' => langVar('L_MAINTENANCE')));
    }
}
//
//--Include the CMS's internal CRON
//
$file = cmsROOT . 'core/cron.php';
if (is_readable($file)) {
    require_once $file;
} else {
    hmsgDie('FAIL', 'Fatal Error - Cron cannot be found.');
}
Beispiel #14
0
    if ($objForm->loadCaptcha('verify') === false) {
        $_error['captcha'] = 'The captcha you provided was incorrect. Please try again.';
    }
    if (count($_error)) {
        $_SESSION['register']['error'] = $_error;
        $_SESSION['register']['form'] = $_POST;
        $objPage->redirect($objCore->config('global', 'fullPath'), 3, 0);
        exit;
    }
    //set the input array up
    $userInfo['username'] = $_POST['username'];
    $userInfo['password'] = $_POST['password'];
    $userInfo['email'] = $_POST['email'];
    $register = $objUser->register($userInfo);
    if (!$register) {
        msgDie('FAIL', $objUser->error());
    }
    if ($objPage->config('site', 'register_verification')) {
        $user = $objUser->getUserInfo($register);
        $emailVars['URL'] = 'http://' . $_SERVER['HTTP_HOST'] . '/' . root() . 'login.php?action=active&un=' . $user['id'] . '&check=' . $user['usercode'];
        $emailVars['USERNAME'] = $userInfo['username'];
        $emailVars['SITE_NAME'] = $objCore->config('site', 'name');
        sendEmail($userInfo['email'], 'E_REG_SUCCESSFUL', $emailVars);
        $msg = langVar('L_REG_SUCCESS_EMAIL');
    } else {
        $msg = langVar('L_REG_SUCCESS_NO_EMAIL');
    }
    unset($_SESSION['register'], $_SESSION['error'], $query, $userInfo, $_error);
    $objCache->generate_statistics_cache();
    hmsgDie('INFO', $msg);
}
Beispiel #15
0
function menu_login($args)
{
    global $objCore, $objUser, $objTPL, $objPage, $objForm, $objTime, $config, $objSQL;
    if (!User::$IS_ONLINE) {
        $objTPL->set_filenames(array($args['uniqueId'] => 'modules/core/template/blocks/block_login.tpl'));
        //check see if we are allowing auto_login precedures
        if ($objCore->config('login', 'remember_me')) {
            $objTPL->assign_block_vars('remember_me', array());
        }
        $hash = md5(time() . 'userkey');
        $_SESSION['login']['cs_hash'] = $hash;
        $objTPL->assign_vars(array('FORM_START' => $objForm->start('login', array('method' => 'POST', 'action' => '/' . root() . 'login.php?action=check')), 'FORM_END' => $objForm->inputbox('hash', 'hidden', $hash) . $objForm->finish(), 'F_USERNAME' => $objForm->inputbox('username', 'text', $userValue, array('class' => 'icon username', 'br' => true, 'disabled' => $acpCheck, 'required' => true)), 'F_PASSWORD' => $objForm->inputbox('password', 'password', '', array('class' => 'icon password', 'br' => true, 'required' => true)), 'F_REMME' => $objForm->select('remember', array('0' => 'No Thanks', '1' => 'Forever'), array('selected' => 0)), 'L_USERNAME' => langVar('L_USERNAME'), 'L_PASSWORD' => langVar('L_PASSWORD'), 'L_REMME' => langVar('L_REMME'), 'SUBMIT' => $objForm->button('submit', 'Login'), 'RESET' => $objForm->button('reset', 'Reset Form'), 'REGISTER' => $objForm->button('register', 'Register', array('extra' => 'onclick="document.location = \'/' . root() . 'register.php\'; return false;"')), 'FORGOT_PWD' => $objForm->button('forgot_pwd', 'Forgot Password', array('extra' => 'onclick="inWindow(\'/' . root() . 'forgotpass.php?ajax\', \'Forgot Password\', 600, 500); return false;"'))));
    } else {
        $objTPL->set_filenames(array($args['uniqueId'] => 'modules/core/template/blocks/block_logout.tpl'));
        $user = $objUser->profile($objUser->grab('id'));
        $objTPL->assign_vars(array('L_LAST_VISIT' => langVar('LAST_VISIT', $objTime->mk_time($objUser->grab('timestamp'))), 'L_LOGOUT_BTN' => '<a href="/' . root() . 'login.php?action=logout&check=' . $objUser->grab('usercode') . '" class="button">' . langVar('L_LOGOUT') . '</a>'));
    }
    return $objTPL->get_html($args['uniqueId']);
}
                    $color = '#FF1200';
                    $show = $changed == 1 ? true : ($changed == 0 ? true : false);
                } else {
                    $filestatus = langVar('L_OK');
                    $color = '#269F00';
                    $show = $changed == 1 ? false : true;
                }
            }
            $path_cleaned = str_replace('./', '', $row['filename']);
            if ($show === true) {
                $objTPL->assign_block_vars('filestructure', array('FNAME' => '<a href="/' . root() . $path_cleaned . '">' . $path_cleaned . '</a>', 'STATUS' => '<font color="' . $color . '">' . $filestatus . '</font>', 'ROW' => $i++ % 2 ? 'row_color2' : 'row_color1'));
            }
        }
        break;
}
$objTPL->assign_vars(array('ADMIN_MODE' => langVar('L_FILE_REG'), 'L_FILENAME' => langVar('L_FILENAME'), 'L_STATUS' => langVar('L_FILE_STATUS'), 'CREATE_NEW' => '<a href="?action=check" class="button">' . langVar('L_CHECK_FH') . '</a>', 'UPDATE_OLD' => '<a href="?action=new" class="button">' . langVar('L_UPDATE_FH') . '</a>', 'CHANGED_ONLY' => '<a href="?action=check&chg=1" class="button">' . langVar('L_CHANGED_ONLY') . '</a>', 'L_LAST_CHANGED' => 'Last Updated On: ' . $objTime->mk_time($objCore->config('site', 'registry_update')), 'OUTPUT' => $output));
$objTPL->parse('body', false);
/**
 * Function used to gather data from each file within a directory
 */
function recursive_filechk($dir, $prefix = '', $extension)
{
    global $config, $objSQL;
    $directory = @opendir($dir);
    while ($file = @readdir($directory)) {
        if (!in_array($file, array('.', '..'))) {
            $is_dir = @is_dir($dir . '/' . $file) ? true : false;
            // Create a nice Path for the found Files / Folders
            $temp_path = '';
            $temp_path = $dir . '/' . ($is_dir ? strtoupper($file) : $file);
            $temp_path = str_replace('//', '/', $temp_path);
Beispiel #17
0
<?php

/*======================================================================*\
||              Cybershade CMS - Your CMS, Your Way                     ||
\*======================================================================*/
if (!defined('INDEX_CHECK')) {
    die('Error: Cannot access directly.');
}
function menuChecker($link = '')
{
    $module = isset($_GET['__module']) ? $_GET['__module'] : '';
    if (strtolower($module) == strtolower($link)) {
        return ' class="selected"';
    }
    return NULL;
}
$_menu = get_menu('main_nav', 'array');
$menu = '';
if (!is_empty($_menu)) {
    foreach ($_menu as $m) {
        $start = $m['options']['color'] == NULL ? '' : '<font style="color: ' . $m['options']['color'] . ';">';
        $stop = $m['options']['color'] == NULL ? '' : '</font>';
        $menu .= '<li' . menuChecker($m['options']['name']) . '>' . '<a href="' . $m['options']['link'] . '"' . $m['options']['blank'] . '>' . $start . $m['options']['name'] . $stop . '</a></li>' . "\n";
    }
}
$_more_vars = array('L_WELCOME' => langVar('L_WELCOME', $this->config('site', 'title'), $this->objUser->profile($this->objUser->grab('id'))), 'TPL_MENU' => $menu);
<?php

/*======================================================================*\
||              Cybershade CMS - Your CMS, Your Way                     ||
\*======================================================================*/
if (!defined('INDEX_CHECK')) {
    die('Error: Cannot access directly.');
}
if (!defined('PANEL_CHECK')) {
    die('Error: Cannot include panel from current location.');
}
$objPage->setTitle(langVar('B_ACP') . ' > ' . langVar('L_OVERVIEW'));
$objPage->addPagecrumb(array(array('url' => $url, 'name' => langVar('L_OVERVIEW'))));
$objTPL->set_filenames(array('body' => 'modules/core/template/panels/panel.admin_overview.tpl'));
$objTPL->assign_vars(array('ADMIN_MODE' => langVar('L_SITE_OVERVIEW')));
$objTPL->assign_block_vars('msg', array('MSG' => msg('INFO', 'This panel is currently incomplete, please check panel source for info on this panel.', 'return')));
/*
Functionality of the ACP Dashboard -
    A, Dashboard Menu                           |-------------------------------------------|
    B, Interactive Graph                        | |---------------------------------------| |
        |- Registered Users                     | |--A------------------------------------| |
        |- Posted Content?                      | |---------------------------------------| |
        |- User Inactivity Count                |                                           |
        |-                                      | |------------------------------||-------| |
    C, Latest Updates / Quick Notifications     | |                              ||   C   | |
    D, http://i.imgur.com/M9vzG.jpg             | |              B               ||-------| |
    E, Who is online                            | |                              |          |
        |- Tabs                                 | |------------------------------||-------| |
            |- Guests                           |                                 |       | |
            |- Search engine bots               | |------------------------------||   D   | |
            |- Users                            | |              E               ||       | |
Beispiel #19
0
 /**
  * Inserts a users info into the database.
  *
  * @version 1.1
  * @since   1.0.0
  * @author  Jesus
  *
  * @param   array $userInfo   Array of the users details.
  *
  * @return  bool
  */
 public function register(array $userInfo)
 {
     //Check all the args are good and valid
     $userInfo['username'] = doArgs('username', false, $userInfo);
     $userInfo['password'] = doArgs('password', false, $userInfo);
     $userInfo['email'] = doArgs('email', false, $userInfo);
     //if we have a false, in the above array, we has a problem
     if (in_array(false, $userInfo)) {
         $this->setError('username, password and email are all required to continue.');
         return false;
     }
     //add some extra stuff in before we submit it
     $userInfo['password'] = $this->mkPassword($userInfo['password']);
     $userInfo['register_date'] = time();
     $userInfo['usercode'] = substr(md5(time()), 0, 6);
     $userInfo['primary_group'] = $this->config('site', 'user_group');
     $userInfo['theme'] = $this->config('site', 'theme');
     //active needs to be the opposite of whatever 'register_verification' is...
     $userInfo['active'] = !$this->config('site', 'register_verification');
     //Implement a hook before a users' registration has completed
     $this->objPlugins->hook('CMSUser_Before_Registered', $userInfo);
     if (!is_array($userInfo) || is_empty($userInfo)) {
         $this->setError('$userInfo is no longer a useable array. Check plugins attached to CMSUser_Before_Register.');
         return false;
     }
     $insert_id = $this->objSQL->insertRow('users', $userInfo, langVar('LOG_CREATED_USER', sprintf('/%smodules/profile/%s', root(), $userInfo['username']), $userInfo['username']));
     //Implement a hook after a users' registration has completed
     $this->objPlugins->hook('CMSUser_After_Registered', $insert_id);
     if (!$insert_id) {
         $this->setError('insert_id has a false value, SQL: ' . mysql_error());
         return false;
     }
     //add a new row into user_extras for this users settings
     unset($insert);
     $insert['uid'] = $insert_id;
     $this->objSQL->insertRow('user_extras', $insert);
     //register the user into the group
     $this->objGroups->joinGroup($insert_id, $userInfo['primary_group'], 0);
     unset($userInfo);
     return $insert_id;
 }
Beispiel #20
0
     URL: "' . $objCore->config('global', 'rootUrl') . '"
     root(): "/' . root() . '"
     cmsROOT: "' . cmsROOT . '"
     https?: "' . ($objCore->config('global', 'secure') ? 'true' : 'false') . '"';
     if (doArgs('config', false, $_GET)) {
         $array = array('cms', 'db', 'email');
         $var = array('google_analytics', 'admin_email', 'registry_update');
         $content .= "\n\n" . json_encode($objSQL->getTable('SELECT * FROM `$Pconfig`
         WHERE array NOT IN("%s")
             AND var NOT IN("%s")
             AND var NOT LIKE "%s"
         ORDER BY array, var ASC', array(implode('", "', $array), implode('", "', $var), '%captcha_%')));
     }
     //and output
     include $path . '/cfg.php';
     $objTPL->assign_vars(array('ADMIN_MODE' => $mod_name, 'MSG' => msg('INFO', langVar('L_SYSINFO_MSG'), 'return', 'Information - <a href="' . $objCore->getQueryString($url, array('config' => 'true')) . '">With Configuration</a>'), 'CONTENT' => $objForm->textarea('sysInfo', $content, array('style' => 'width: 99%;border:0;'))));
     break;
 case 'update':
     hmsgDie('INFO', 'This panel has yet to be implemented. Some ideas for it have been put in the source.');
     /* TODO:
         No clue :P
     
     */
     break;
 case 'about':
     //        $objTPL->set_filenames(array(
     //            'body'      => 'modules/core/template/panels/panel.settings.tpl',
     //        ));
     hmsgDie('INFO', 'This panel has yet to be implemented. Some ideas for it have been put in the source.');
     /* TODO:
         Not sure about this one either, prolly wont stay here..
Beispiel #21
0
function menu_forum_users($args)
{
    global $objCore;
    $limit = doArgs('limit', 5, $args);
    $objCore->objTPL->set_filenames(array($args['uniqueId'] => 'modules/forum/template/block_forum.tpl'));
    $users = $objCore->objSQL->getTable('SELECT u.id, COUNT(DISTINCT p.id) AS count
        FROM `$Pusers` u, `$Pforum_posts` p, `$Pforum_threads` t, `$Pforum_cats` c
            WHERE p.author = u.id AND p.thread_id = t.id AND t.cat_id = c.id AND c.postcounts = 1
        GROUP BY u.id
        ORDER BY count DESC
        LIMIT %d', array($limit));
    if (!$users) {
        $objCore->objTPL->assign_block_vars('error', array('MESSAGE' => langVar('L_ERROR')));
        return $objCore->objTPL->get_html($args['uniqueId']);
    }
    $opened = round((time() - $objCore->config('statistics', 'site_opened')) / 86400);
    $j = 0;
    foreach ($users as $user) {
        $objCore->objTPL->assign_block_vars('userRow', array('ID' => $objCore->objUser->getUserInfo($user['id'], 'id'), 'USERNAME' => $objCore->objUser->profile($user['id']), 'COUNT' => $user['count'], 'PER_DAY' => langVar('L_PER_DAY', round(sprintf('%.2f', $user['count'] / $opened), 0)), 'CLASS' => $j % 2 == 0 ? 'row_color2' : 'row_color1'));
        $j++;
    }
    //reset the block var so the data dosent creep into the other templates
    $return = $objCore->objTPL->get_html($args['uniqueId']);
    $objCore->objTPL->reset_block_vars('userRow');
    return $return;
}
function recaptcha_announce(&$args)
{
    $args['recaptcha'] = langVar('L_RECAPTCHA');
    return true;
}
/**
 * Shows a message and then exit the current page with a footer.
 *
 * @version 2.0
 * @since   0.6.0
 */
function msgDie($msg_type, $message, $line = null, $file = null, $query = null, $footer = true)
{
    $objTPL = Core_Classes_coreObj::getTPL();
    $objPage = Core_Classes_coreObj::getPage();
    //if(!is_object($objTPL) || !is_object($objPage)){ echo $message; exit; }
    $objTPL->set_filenames(array('__msgBody' => cmsROOT . 'modules/core/views/module/message/default.tpl'));
    $query = !is_empty($query) ? $query : null;
    $line = !is_empty($line) ? $line : null;
    $file = !is_empty($file) ? $file : null;
    switch (strtolower($msg_type)) {
        case 'fail':
            $img = '/' . root() . 'images/fail.png';
            $type = 'error';
            break;
        case 'ok':
            $img = '/' . root() . 'images/ok.png';
            $type = 'status';
            break;
        case 'info':
            $img = '/' . root() . 'images/info.png';
            $type = 'warning';
            break;
        default:
            $img = null;
            break;
    }
    $objTPL->assign_vars(array('L_MSG_TYPE' => langVar('MSG_' . strtoupper($msg_type)), 'L_MSG' => $message, 'QUERY' => $query, 'LINE' => 'Line: ' . $line, 'FILE' => 'File: ' . $file, 'IMG' => isset($img) && !is_empty($img) ? '<img src="' . $img . '" style="height: 48px; width: 48px;">' : '', 'ALIGN' => 'center', 'TYPE' => $type));
    $gen_time = '0';
    $objTPL->parse('__msgBody');
    if ($footer) {
        $objPage->showFooter();
    }
    exit;
}
Beispiel #24
0
 /**
  * Outputs a human readable (facebook-like) time formatted string,
  *  relative to the current time/date
  *
  * @version 1.5
  * @since   1.0
  * @author  Jesus
  *
  * @param     int     $timestamp     Unix Timestamp of time in the past
  *
  * @return     string     $words         Language parsed time-ago string
  */
 public function timeago($timestamp = 0)
 {
     $timestamp = $this->localTime($timestamp);
     $now = $this->localTime(time());
     // Calculate all the times
     $seconds = $now - $timestamp;
     $minutes = $seconds / 60;
     $hours = $minutes / 60;
     $days = $hours / 24;
     $years = $days / 365;
     // Load in the conditions for the foreach loop
     $conditions = array(array($seconds, 45, 'TIMEAGO_SECONDS'), array($seconds, 90, 'TIMEAGO_MINUTE'), array($minutes, 45, 'TIMEAGO_MINUTES'), array($minutes, 90, 'TIMEAGO_HOUR'), array($hours, 24, 'TIMEAGO_HOURS'), array($hours, 48, 'TIMEAGO_DAY'), array($days, 7, 'TIMEAGO_DAYS'), array($days, 14, 'TIMEAGO_WEEK'), array($days / 7, 4, 'TIMEAGO_WEEKS'), array($days, 60, 'TIMEAGO_MONTH'), array($days / 30, 6, 'TIMEAGO_MONTHS'), array($days, 365, 'TIMEAGO_YEAR'));
     foreach ($conditions as $condition) {
         if ($condition[0] < $condition[1]) {
             $words = langVar($condition[2], $condition[0]);
             break;
         }
     }
     if (is_empty($words)) {
         $words = langVar('TIMEAGO_YEARS', $years);
     }
     return $words . langVar('TIMEAGO_SUFFIXAGO');
 }