/** * 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'))); }
/** * Outputs a table with the currently detected set of modules on * * @version 1.0 * @since 1.0.0 * @author Dan Aldridge * * @return void */ public function modules() { $objSQL = Core_Classes_coreObj::getDBO(); $objTPL = Core_Classes_coreObj::getTPL(); $objModule = Core_Classes_coreObj::getModule(); $objTPL->set_filenames(array('body' => cmsROOT . Core_Classes_Page::$THEME_ROOT . 'block.tpl', 'panel' => cmsROOT . 'modules/core/views/admin/modules/default/module_list.tpl')); $files = glob(sprintf('%smodules/*', cmsROOT)); foreach ($files as $file) { $moduleName = str_replace('modules/', '', $file); // Determine the status of the module if (parent::moduleExists($moduleName) === false) { continue; } $query = $objSQL->queryBuilder()->select('*')->from('#__modules')->where('name', '=', $moduleName)->build(); $row = $objSQL->fetchLine($query); $moduleInstalled = parent::moduleInstalled($moduleName); if (empty($row) || $moduleInstalled === false) { $details = $objModule->getModuleDetails($moduleName); if (!empty($details)) { $version = $details['version']; $hash = $details['hash']; } } $objTPL->assign_block_vars('module', array('NAME' => $moduleName, 'VERSION' => $version, 'HASH' => $hash, 'STATUS' => $moduleInstalled === false ? 'Not Installed' : 'Installed', 'STATUS_ICON' => $moduleInstalled === false ? 'default' : 'success')); } $objTPL->parse('panel', false); Core_Classes_coreObj::getAdminCP()->setupBlock('body', array('cols' => 3, 'vars' => array('TITLE' => 'Module List', 'CONTENT' => $objTPL->get_html('panel', false), 'ICON' => 'icon-th-list'))); }
/** * Add a new user to the system * * @version 1.0 * @since 1.0.0 * @author Dan Aldridge * * @return void */ public function add() { $objSQL = Core_Classes_coreObj::getDBO(); $objTPL = Core_Classes_coreObj::getTPL(); $objTime = Core_Classes_coreObj::getTime(); Core_Classes_coreObj::getPage()->addBreadcrumbs(array(array('url' => doArgs('REQUEST_URI', '', $_SERVER), 'name' => 'Add User'))); $objTPL->set_filenames(array('body' => cmsROOT . Core_Classes_Page::$THEME_ROOT . 'block.tpl', 'panel' => cmsROOT . 'modules/core/views/admin/users/add.tpl')); $objTPL->parse('panel', false); Core_Classes_coreObj::getAdminCP()->setupBlock('body', array('cols' => 3, 'vars' => array('TITLE' => 'Add User', 'CONTENT' => $objTPL->get_html('panel', false), 'ICON' => 'faicon-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'))); }
/** * 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'))); }
<?php /*======================================================================*\ || Cybershade CMS - Your CMS, Your Way || \*======================================================================*/ define('INDEX_CHECK', true); define('cmsDEBUG', true); $GET = $_GET; require_once 'core/core.php'; $objRoute = Core_Classes_coreObj::getRoute(); $objPage = Core_Classes_coreObj::getPage(); $objTPL = Core_Classes_coreObj::getTPL(); $objAdmin = Core_Classes_coreObj::getAdminCP('', $GET); $objUser = Core_Classes_coreObj::getUser(); $objRoute->modifyGET($GET); if (!Core_Classes_User::$IS_ONLINE || !Core_Classes_User::$IS_ADMIN) { // Need to sort out login // $objRoute->throwHTTP(404); $objPage->redirect('/' . root() . 'login'); exit; } $objPage->setTheme('perfectum-mootools'); $objPage->addBreadcrumbs(array(array('url' => '/' . root() . $objAdmin->mode . '/', 'name' => ucwords($objAdmin->mode) . ' Control Panel'))); $objPage->setTitle('Cybershade CMS Administration Panel'); // grab the nav and throw the baSic tpl setups together $objAdmin->getNav(); $objPage->tplGlobals(); // sort the route out, see what we need to do $objAdmin->invokeRoute(); // and then output..something $objPage->showHeader();
/** * Editor for the menu system * * @version 1.0 * @since 1.0.0 * @author Dan Aldridge * * @return void */ public function edit($args = array()) { $objTPL = Core_Classes_coreObj::getTPL(); $objSQL = Core_Classes_coreObj::getDBO(); $objPage = Core_Classes_coreObj::getPage(); // Check we have the menu name if (!is_array($args) || !is_string($args[1]) || strlen($args[1]) == 0) { // error trigger_error('Error: Could not get menu name.'); $this->menus(); return; } /** Menu JS **/ $objPage->addCSSFile(array('href' => '/' . root() . 'modules/core/assets/styles/admin/menus/Tree.css', 'type' => 'text/css')); $objPage->addCSSFile(array('href' => '/' . root() . 'modules/core/assets/styles/admin/menus/Collapse.css', 'type' => 'text/css')); $objPage->addJSFile(array('src' => '/' . root() . 'modules/core/assets/javascript/admin/menus/Tree.js'), 'footer'); $objPage->addJSFile(array('src' => '/' . root() . 'modules/core/assets/javascript/admin/menus/custom.js'), 'footer'); $menuName = $args[1]; $objTPL->set_filenames(array('panel' => cmsROOT . 'modules/core/views/admin/menus/menu_link_list.tpl')); $queryList = $objSQL->queryBuilder()->select('*')->from('#__menus')->where('menu_name', '=', $menuName)->orderBy('`parent_id`, `order`', 'ASC'); $links = $objSQL->fetchAll($queryList->build()); if (!is_array($links)) { trigger_error('Error: Menu does not exist.'); $this->menus(); return false; } $args = array('title' => 'link_title', 'id' => 'id', 'parent' => 'parent_id'); $tree = $this->generateTree($links, $args); $objTPL->assign_var('tree_menu', $tree); $objTPL->parse('panel', false); Core_Classes_coreObj::getAdminCP()->setupBlock('body', array('cols' => 3, 'vars' => array('TITLE' => 'Edit Menu - <strong>' . secureMe($menuName) . '</strong>', 'CONTENT' => $objTPL->get_html('panel', false), 'ICON' => 'icon-th-list'), 'custom' => array('ICON' => 'icon-save', 'URL' => '#', 'TITLE' => 'Save', 'LINK' => '', 'CLASS' => '', 'EXTRA' => 'data-toggle="tooltip" data-placement="top"'))); }