Example #1
0
 function pluginRefresh()
 {
     global $plug;
     $plug = e107::getSingleton('e107plugin')->getinfo($this->id);
     $_path = e_PLUGIN . $plug['plugin_path'] . '/';
     if (file_exists($_path . 'plugin.xml')) {
         // $text .= $plugin->install_plugin_xml($this->id, 'refresh');
         e107::getSingleton('e107plugin')->refresh($plug['plugin_path']);
         e107::getLog()->add('PLUGMAN_04', $this->id . ':' . $plug['plugin_path'], E_LOG_INFORMATIVE, '');
     }
 }
Example #2
0
function get_default_prefs()
{
    $xmlArray = e107::getSingleton('xmlClass')->loadXMLfile(e_CORE . "xml/default_install.xml", 'advanced');
    $pref = e107::getSingleton('xmlClass')->e107ImportPrefs($xmlArray, 'core');
    return $pref;
}
Example #3
0
 /**
  * @desc Closes the mySQL server connection.<br />
  * <br />
  * Only required if you open a second connection.<br />
  * Native e107 connection is closed in the footer.php file<br />
  * <br />
  * Example :<br />
  * <code>$sql->db_Close();</code>
  *
  * @access public
  * @return void
  */
 function close()
 {
     if (!$this->mySQLaccess) {
         global $db_ConnectionID;
         $this->mySQLaccess = $db_ConnectionID;
     }
     e107::getSingleton('e107_traffic')->BumpWho('db Close', 1);
     $this->mySQLaccess = NULL;
     // correct way to do it when using shared links.
     $this->dbError('dbClose');
 }
Example #4
0
 /**
  * Get JS Helper instance
  *
  * @return e_jshelper
  */
 public function getJsHelper()
 {
     return e107::getSingleton('e_jshelper', true, 'admin_response');
 }
Example #5
0
 /**
  * @param $caption string caption text
  * @param $text string
  * @param $mode unique identifier
  * @param $return boolean : return the html instead of echo it. 
  * @return null
  */
 public function tablerender($caption, $text, $mode = 'default', $return = false)
 {
     $override_tablerender = e107::getSingleton('override', e_HANDLER . 'override_class.php')->override_check('tablerender');
     if ($override_tablerender) {
         $result = call_user_func($override_tablerender, $caption, $text, $mode, $return);
         if ($result == 'return') {
             return '';
         }
         extract($result);
     }
     if ($return) {
         if (!empty($text) && $this->eMenuArea) {
             $this->eMenuCount++;
         }
         ob_start();
         $this->tablestyle($caption, $text, $mode);
         $ret = ob_get_contents();
         ob_end_clean();
         return $ret;
     } else {
         if (!empty($text) && $this->eMenuArea) {
             $this->eMenuCount++;
         }
         $this->tablestyle($caption, $text, $mode);
         return '';
     }
 }
Example #6
0
/**
 * Convenient proxy to e_admin_icons::path()
 * Get icon relative server path
 * <code>
 * echo _IPATH('edit');
 * // If icon path is overloaded by current admin theme:
 * // '../e107_themes/current_theme/icons/admin/edit_16.png'
 * // else
 * // '../e107_images/admin_images/edit_16.png'
 * </code>
 * 
 * @param string $name without size and extension e.g. 'edit'
 * @param integer size pixel , default 16
 * @param string $extension without leading dot, default 'png'
 * @return string icon relative server path
 */
function _IPATH($name, $size = 16, $extension = 'png')
{
    return e107::getSingleton('e_admin_icons')->path($name, $size, $extension);
}
Example #7
0
 /**
  * Install a Theme required plugin.
  *
  * @param string $plugpath - plugin folder name
  * @return void
  */
 public function install_plugin($plugpath)
 {
     e107::getDb()->db_Select_gen("SELECT * FROM #plugin WHERE plugin_path = '" . $plugpath . "' LIMIT 1");
     $row = e107::getDb()->db_Fetch(MYSQL_ASSOC);
     e107::getSingleton('e107plugin')->install_plugin($row['plugin_id']);
     return;
 }
Example #8
0
 function render_newsitem($news, $mode = 'default', $n_restrict = '', $NEWS_TEMPLATE = '', $param = array())
 {
     global $NEWSSTYLE, $NEWSLISTSTYLE;
     if ($override_newsitem = e107::getSingleton('override', true)->override_check('render_newsitem')) {
         $result = call_user_func($override_newsitem, $news, $mode, $n_restrict, $NEWS_TEMPLATE, $param);
         if ($result == 'return') {
             return;
         }
     }
     if ($n_restrict == 'userclass') {
         $news['news_id'] = 0;
         $news['news_title'] = LAN_NEWS_1;
         $news['data'] = LAN_NEWS_2;
         $news['news_extended'] = "";
         $news['news_allow_comments'] = 1;
         $news['news_start'] = 0;
         $news['news_end'] = 0;
         $news['news_render_type'] = 0;
         $news['comment_total'] = 0;
     }
     $tmp = array();
     $tmp['caticon'] = defset('ICONSTYLE');
     $tmp['commentoffstring'] = defset('COMMENTOFFSTRING');
     $tmp['commentlink'] = defset('COMMENTLINK');
     $tmp['trackbackstring'] = defset('TRACKBACKSTRING');
     $tmp['trackbackbeforestring'] = defset('TRACKBACKBEFORESTRING');
     $tmp['trackbackafterstring'] = defset('TRACKBACKAFTERSTRING');
     $tmp['itemlink'] = defset('NEWSLIST_ITEMLINK');
     $tmp['thumbnail'] = defset('NEWSLIST_THUMB', "border:0px");
     $tmp['catlink'] = defset('NEWSLIST_CATLINK');
     $tmp['caticon'] = defset('NEWSLIST_CATICON', defset('ICONSTYLE'));
     if (!$param) {
         $param = array();
     }
     $param = array_merge($tmp, $param);
     // Next three images aren't always defined by the caller, even if most of $param is.
     //XXX All of this should be done via CSS from v2 on.
     if (!isset($param['image_nonew_small'])) {
         if (!defined("IMAGE_nonew_small")) {
             define("IMAGE_nonew_small", file_exists(THEME . "images/nonew_comments.png") ? "<img src='" . THEME_ABS . "images/nonew_comments.png' alt=''  /> " : "<img src='" . e_IMAGE_ABS . "generic/nonew_comments.png' alt=''  />");
         }
         $param['image_nonew_small'] = IMAGE_nonew_small;
     }
     if (!isset($param['image_new_small'])) {
         if (!defined("IMAGE_new_small")) {
             define("IMAGE_new_small", file_exists(THEME . "images/new_comments.png") ? "<img src='" . THEME_ABS . "images/new_comments.png' alt=''  /> " : "<img src='" . e_IMAGE_ABS . "generic/new_comments.png' alt=''  /> ");
         }
         $param['image_new_small'] = IMAGE_new_small;
     }
     if (!isset($param['image_sticky'])) {
         if (!defined("IMAGE_sticky")) {
             define("IMAGE_sticky", file_exists(THEME . "images/sticky.png") ? "<img src='" . THEME_ABS . "images/sticky.png' alt=''  /> " : "<img src='" . e_IMAGE_ABS . "generic/sticky.png' alt='' style='width: 14px; height: 14px; vertical-align: bottom' /> ");
         }
         $param['image_sticky'] = IMAGE_sticky;
     }
     cachevars('current_news_item', $news);
     cachevars('current_news_param', $param);
     if ($news['news_render_type'] == 1 && $mode != "extend") {
         if (function_exists("news_list")) {
             $NEWS_PARSE = news_list($news);
         } else {
             if ($NEWSLISTSTYLE) {
                 $NEWS_PARSE = $NEWSLISTSTYLE;
             } else {
                 $NEWS_PARSE = "{NEWSICON}&nbsp;<b>{NEWSTITLELINK}</b><div class='smalltext'>{NEWSAUTHOR} " . LAN_NEWS_100 . " {NEWSDATE} | {NEWSCOMMENTS}</div>";
             }
         }
     } else {
         if ($NEWS_TEMPLATE) {
             $NEWS_PARSE = $NEWS_TEMPLATE;
         } else {
             if (function_exists("news_style")) {
                 $action = varset($param['current_action'], 'default');
                 $NEWS_PARSE = news_style($news, $action, $param);
             } else {
                 $NEWS_PARSE = $NEWSSTYLE;
             }
         }
     }
     //$loop_uid = $news['news_author']; - no references found
     //require_once(e_CORE.'shortcodes/batch/news_shortcodes.php');
     /* DEPRECATED
     		setScVar('news_shortcodes', 'news_item', $news);
     		setScVar('news_shortcodes', 'param', $param);
     		*/
     // Set the Values for the social shortcode usage.
     $tp = e107::getParser();
     $socialArray = array('url' => e107::getUrl()->create('news/view/item', $news, 'full=1'), 'title' => $tp->toText($news['news_title']), 'tags' => $news['news_meta_keywords']);
     $socialObj = e107::getScBatch('social');
     if (is_object($socialObj)) {
         $socialObj->setVars($socialArray);
     }
     // Retrieve batch sc object, set required vars
     $sc = e107::getScBatch('news')->wrapper('news/view/item')->setScVar('news_item', $news)->setScVar('param', $param);
     $text = e107::getParser()->parseTemplate($NEWS_PARSE, true, $sc);
     if ($mode == 'return') {
         return $text;
     } else {
         echo $text;
         return TRUE;
     }
 }
Example #9
0
 public function __get($name)
 {
     switch ($name) {
         case 'tp':
             $ret = e107::getParser();
             break;
         case 'sql':
             $ret = e107::getDb();
             break;
         case 'ecache':
             $ret = e107::getCache();
             break;
         case 'arrayStorage':
             $ret = e107::getArrayStorage();
             break;
         case 'e_event':
             $ret = e107::getEvent();
             break;
         case 'ns':
             $ret = e107::getRender();
             break;
         case 'url':
             $ret = e107::getUrl();
             break;
         case 'admin_log':
             $ret = e107::getAdminLog();
             break;
         case 'override':
             $ret = e107::getSingleton('override', e_HANDLER . 'override_class.php');
             break;
         case 'notify':
             $ret = e107::getNotify();
             break;
         case 'e_online':
             $ret = e107::getOnline();
             break;
         case 'eIPHandler':
             $ret = e107::getIPHandler();
             break;
         case 'user_class':
             $ret = e107::getUserClass();
             break;
         default:
             trigger_error('$e107->$' . $name . ' not defined', E_USER_WARNING);
             return null;
             break;
     }
     $this->{$name} = $ret;
     return $ret;
 }
Example #10
0
 public function import_configuration()
 {
     $this->logLine('Starting configuration import');
     // PRE-CONFIG start - create and register blank config instances - do not load!
     $config_aliases = array('core', 'core_backup', 'emote', 'menu', 'search', 'notify');
     foreach ($config_aliases as $alias) {
         e107::getConfig($alias, false)->clearPrefCache();
     }
     // PRE-CONFIG end
     // Basic stuff to get the handlers/classes to work.
     // $udirs = "admin/|plugins/|temp";
     // $e_SELF = $_SERVER['PHP_SELF'];
     // $e_HTTP = preg_replace("#".$udirs."#i", "", substr($e_SELF, 0, strrpos($e_SELF, "/"))."/");
     // define("MAGIC_QUOTES_GPC", (ini_get('magic_quotes_gpc') ? true : false));
     // define('CHARSET', 'utf-8');
     // define("e_LANGUAGE", $this->previous_steps['language']);
     // define('e_SELF', 'http://'.$_SERVER['HTTP_HOST']) . ($_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_FILENAME']);
     $themeImportFile = array();
     $themeImportFile[0] = $this->e107->e107_dirs['THEMES_DIRECTORY'] . $this->previous_steps['prefs']['sitetheme'] . "/install.xml";
     $themeImportFile[1] = $this->e107->e107_dirs['THEMES_DIRECTORY'] . $this->previous_steps['prefs']['sitetheme'] . "/install/install.xml";
     // $themeImportFile[3] = $this->e107->e107_dirs['CORE_DIRECTORY']. "xml/default_install.xml";
     $XMLImportfile = false;
     if (vartrue($this->previous_steps['generate_content'])) {
         foreach ($themeImportFile as $file) {
             if (is_readable($file)) {
                 $XMLImportfile = $file;
                 break;
             }
         }
     }
     $tp = e107::getParser();
     define('PREVIEWTHEMENAME', "");
     // Notice Removal.
     include_lan($this->e107->e107_dirs['LANGUAGES_DIRECTORY'] . $this->previous_steps['language'] . "/lan_prefs.php");
     include_lan($this->e107->e107_dirs['LANGUAGES_DIRECTORY'] . $this->previous_steps['language'] . "/admin/lan_theme.php");
     // [SecretR] should work now - fixed log errors (argument noLogs = true) change to false to enable log
     $coreConfig = $this->e107->e107_dirs['CORE_DIRECTORY'] . "xml/default_install.xml";
     $ret = e107::getXml()->e107Import($coreConfig, 'replace', true, false);
     // Add core pref values
     $this->logLine('Attempting to Write Core Prefs.');
     $this->logLine(print_r($ret, true));
     if ($XMLImportfile) {
         $ret2 = e107::getXml()->e107Import($XMLImportfile, 'replace', true, false);
         // Overwrite specific core pref and tables entries.
         $this->logLine('Attempting to write Theme Prefs/Tables (install.xml)');
         $this->logLine(print_r($ret2, true));
     }
     //Create default plugin-table entries.
     // e107::getConfig('core')->clearPrefCache();
     e107::getPlugin()->update_plugins_table('update');
     $this->logLine('Plugins table updated');
     // Install Theme-required plugins
     if (vartrue($this->previous_steps['install_plugins'])) {
         if ($themeInfo = $this->get_theme_xml($this->previous_steps['prefs']['sitetheme'])) {
             if (isset($themeInfo['plugins']['plugin'])) {
                 foreach ($themeInfo['plugins']['plugin'] as $k => $plug) {
                     $this->install_plugin($plug['@attributes']['name']);
                     $this->logLine('Theme-related plugin installed: ' . $plug['@attributes']['name']);
                 }
             }
         }
     }
     e107::getSingleton('e107plugin')->save_addon_prefs('update');
     // save plugin addon pref-lists. eg. e_latest_list.
     $this->logLine('Addon prefs saved');
     $tm = e107::getSingleton('themeHandler');
     $tm->noLog = true;
     // false to enable log
     $tm->setTheme($this->previous_steps['prefs']['sitetheme'], false);
     // Admin log fix - don't allow logs to be called inside pref handler
     // FIX
     e107::getConfig('core')->setParam('nologs', true);
     // change to false to enable log
     $pref = e107::getConfig('core')->getPref();
     // Set Preferences defined during install - overwriting those that may exist in the XML.
     $this->previous_steps['prefs']['sitelanguage'] = $this->previous_steps['language'];
     $this->previous_steps['prefs']['sitelang_init'] = $this->previous_steps['language'];
     $this->previous_steps['prefs']['siteadmin'] = $this->previous_steps['admin']['display'];
     $this->previous_steps['prefs']['siteadminemail'] = $this->previous_steps['admin']['email'];
     $this->previous_steps['prefs']['install_date'] = time();
     $this->previous_steps['prefs']['siteurl'] = e_HTTP;
     $this->previous_steps['prefs']['sitetag'] = "e107 Website System";
     $this->previous_steps['prefs']['sitedisclaimer'] = '';
     $this->previous_steps['prefs']['replyto_name'] = $this->previous_steps['admin']['display'];
     $this->previous_steps['prefs']['replyto_email'] = $this->previous_steps['admin']['email'];
     // Cookie name fix, ended up with 406 error when non-latin words used
     $cookiename = preg_replace('/[^a-z0-9]/i', '', trim($this->previous_steps['prefs']['sitename']));
     $this->previous_steps['prefs']['cookie_name'] = ($cookiename ? substr($cookiename, 0, 4) . '_' : 'e_') . 'cookie';
     ### URL related prefs
     // set all prefs so that they are available, required for adminReadModules() - it checks which plugins are installed
     e107::getConfig('core')->setPref($this->previous_steps['prefs']);
     $url_modules = eRouter::adminReadModules();
     $url_locations = eRouter::adminBuildLocations($url_modules);
     $url_config = eRouter::adminBuildConfig(array(), $url_modules);
     $this->previous_steps['prefs']['url_aliases'] = array();
     $this->previous_steps['prefs']['url_config'] = $url_config;
     $this->previous_steps['prefs']['url_modules'] = $url_modules;
     $this->previous_steps['prefs']['url_locations'] = $url_locations;
     eRouter::clearCache();
     $this->logLine('Core URL config set to default state');
     // Set prefs, save
     e107::getConfig('core')->setPref($this->previous_steps['prefs']);
     e107::getConfig('core')->save(FALSE, TRUE, FALSE);
     // save preferences made during install.
     $this->logLine('Core prefs set to install choices');
     // Create the admin user - replacing any that may be been included in the XML.
     $ip = $_SERVER['REMOTE_ADDR'];
     $userp = "1, '{$this->previous_steps['admin']['display']}', '{$this->previous_steps['admin']['user']}', '', '" . md5($this->previous_steps['admin']['password']) . "', '', '{$this->previous_steps['admin']['email']}', '', '', 0, " . time() . ", 0, 0, 0, 0, 0, '{$ip}', 0, '', 0, 1, '', '', '0', '', " . time() . ", ''";
     $qry = "REPLACE INTO {$this->previous_steps['mysql']['prefix']}user VALUES ({$userp})";
     $this->dbqry("REPLACE INTO {$this->previous_steps['mysql']['prefix']}user VALUES ({$userp})");
     $this->logLine('Admin user created');
     // Add Default user-extended values;
     $extendedQuery = "REPLACE INTO `{$this->previous_steps['mysql']['prefix']}user_extended` (`user_extended_id` ,\t`user_hidden_fields`) VALUES ('1', NULL \t);";
     $this->dbqry($extendedQuery);
     mysql_close($this->dbLink);
     e107::getMessage()->reset(false, false, true);
     return false;
 }
Example #11
0
function render_infopanel_menu_options()
{
    if (!getperms('0')) {
        return;
    }
    global $pref;
    $frm = e107::getSingleton('e_form');
    $text = "";
    $menu_qry = 'SELECT * FROM #menus WHERE menu_id!= 0  GROUP BY menu_name ORDER BY menu_name';
    $settings = varset($pref['core-infopanel-menus'], array());
    if (e107::getDb()->db_Select_gen($menu_qry)) {
        while ($row = e107::getDb()->db_Fetch()) {
            $label = str_replace("_menu", "", $row['menu_name']);
            $path_to_menu = $row['menu_path'] . $row['menu_name'];
            $checked = $settings && in_array($path_to_menu, $settings) ? true : false;
            $text .= "\n<div class='left f-left list field-spacer' style='display:block;height:24px;width:200px;'>";
            $text .= $frm->checkbox_label($label, "e-mymenus[]", $path_to_menu, $checked);
            $text .= "</div>";
        }
    }
    $text .= "<div class='clear'>&nbsp;</div>";
    return $text;
}
Example #12
0
File: db.php Project: notzen/e107
 /**
  * Import XML Dump
  * @return none
  */
 private function importXmlFile()
 {
     $ret = e107::getSingleton('xmlClass')->e107Import($_FILES['file_userfile']['tmp_name'][0]);
     foreach ($ret['success'] as $table) {
         eMessage::getInstance()->add("Inserted {$table}", E_MESSAGE_SUCCESS);
     }
     foreach ($ret['failed'] as $table) {
         eMessage::getInstance()->add("Failed to Insert {$table}", E_MESSAGE_ERROR);
     }
 }
Example #13
0
 function Show_Performance()
 {
     //
     // Stats by Time Marker
     //
     global $db_time;
     global $sql;
     global $eTimingStart, $eTimingStop;
     $this->Mark_Time('Stop');
     if (!E107_DBG_TIMEDETAILS) {
         return '';
     }
     $totTime = e107::getSingleton('e107_traffic')->TimeDelta($eTimingStart, $eTimingStop);
     $text = "\n<table class='fborder table table-striped table-condensed'>\n";
     $bRowHeaders = FALSE;
     reset($this->aTimeMarks);
     $aSum = $this->aTimeMarks[0];
     // create a template from the 'real' array
     $aSum['Index'] = '';
     $aSum['What'] = 'Total';
     $aSum['Time'] = 0;
     $aSum['DB Time'] = 0;
     $aSum['DB Count'] = 0;
     $aSum['Memory'] = '';
     while (list($tKey, $tMarker) = each($this->aTimeMarks)) {
         if (!$bRowHeaders) {
             // First time: emit headers
             $bRowHeaders = TRUE;
             $text .= "<tr><td class='fcaption' style='text-align:right'><b>" . implode("</b>&nbsp;</td><td class='fcaption' style='text-align:right'><b>", array_keys($tMarker)) . "</b>&nbsp;</td><td class='fcaption' style='text-align:right'><b>OB Lev&nbsp;</b></td></tr>\n";
             $aUnits = $tMarker;
             foreach ($aUnits as $key => $val) {
                 switch ($key) {
                     case 'DB Time':
                     case 'Time':
                         $aUnits[$key] = '(msec)';
                         break;
                     default:
                         $aUnits[$key] = '';
                         break;
                 }
             }
             $aUnits['OB Lev'] = 'lev(buf bytes)';
             $aUnits['Memory'] = '(kb)';
             $text .= "<tr><td class='fcaption' style='text-align:right'><b>" . implode("</b>&nbsp;</td><td class='fcaption' style='text-align:right'><b>", $aUnits) . "</b>&nbsp;</td></tr>\n";
         }
         $tMem = $tMarker['Memory'];
         $tMarker['Memory'] = $tMem ? number_format($tMem / 1024.0, 1) : '?';
         // display if known
         if ($tMarker['What'] == 'Stop') {
             $tMarker['Time'] = '&nbsp;';
             $tMarker['%Time'] = '&nbsp;';
             $tMarker['%DB Count'] = '&nbsp;';
             $tMarker['%DB Time'] = '&nbsp;';
             $tMarker['DB Time'] = '&nbsp;';
             $tMarker['OB Lev'] = $this->aOBMarks[$tKey];
             $tMarker['DB Count'] = '&nbsp;';
         } else {
             // Convert from start time to delta time, i.e. from now to next entry
             $nextMarker = current($this->aTimeMarks);
             $aNextT = $nextMarker['Time'];
             $aThisT = $tMarker['Time'];
             $thisDelta = e107::getSingleton('e107_traffic')->TimeDelta($aThisT, $aNextT);
             $aSum['Time'] += $thisDelta;
             $aSum['DB Time'] += $tMarker['DB Time'];
             $aSum['DB Count'] += $tMarker['DB Count'];
             $tMarker['Time'] = number_format($thisDelta * 1000.0, 1);
             $tMarker['%Time'] = $totTime ? number_format(100.0 * ($thisDelta / $totTime), 0) : 0;
             $tMarker['%DB Count'] = number_format(100.0 * $tMarker['DB Count'] / $sql->db_QueryCount(), 0);
             $tMarker['%DB Time'] = $db_time ? number_format(100.0 * $tMarker['DB Time'] / $db_time, 0) : 0;
             $tMarker['DB Time'] = number_format($tMarker['DB Time'] * 1000.0, 1);
             $tMarker['OB Lev'] = $this->aOBMarks[$tKey];
         }
         $text .= "<tr><td class='forumheader3' >" . implode("&nbsp;</td><td class='forumheader3'  style='text-align:right'>", array_values($tMarker)) . "&nbsp;</td></tr>\n";
         if (isset($this->aMarkNotes[$tKey])) {
             $text .= "<tr><td class='forumheader3' >&nbsp;</td><td class='forumheader3' colspan='4'>";
             $text .= $this->aMarkNotes[$tKey] . "</td></tr>\n";
         }
         if ($tMarker['What'] == 'Stop') {
             break;
         }
     }
     $aSum['%Time'] = $totTime ? number_format(100.0 * ($aSum['Time'] / $totTime), 0) : 0;
     $aSum['%DB Time'] = $db_time ? number_format(100.0 * ($aSum['DB Time'] / $db_time), 0) : 0;
     $aSum['%DB Count'] = $sql->db_QueryCount() ? number_format(100.0 * ($aSum['DB Count'] / $sql->db_QueryCount()), 0) : 0;
     $aSum['Time'] = number_format($aSum['Time'] * 1000.0, 1);
     $aSum['DB Time'] = number_format($aSum['DB Time'] * 1000.0, 1);
     $text .= "<tr><td class='fcaption'><b>" . implode("</b>&nbsp;</td><td class='fcaption' style='text-align:right'><b>", $aSum) . "</b>&nbsp;</td><td class='fcaption'>&nbsp;</td></tr>\n";
     $text .= "\n</table><br />\n";
     //
     // Stats by Table
     //
     $text .= "\n<table class='fborder table table-striped table-condensed'>\n";
     $bRowHeaders = FALSE;
     $aSum = $this->aDBbyTable['core'];
     // create a template from the 'real' array
     $aSum['Table'] = 'Total';
     $aSum['%DB Count'] = 0;
     $aSum['%DB Time'] = 0;
     $aSum['DB Time'] = 0;
     $aSum['DB Count'] = 0;
     foreach ($this->aDBbyTable as $curTable) {
         if (!$bRowHeaders) {
             $bRowHeaders = TRUE;
             $text .= "<tr><td class='fcaption'><b>" . implode("</b></td><td class='fcaption'><b>", array_keys($curTable)) . "</b></td></tr>\n";
             $aUnits = $curTable;
             foreach ($aUnits as $key => $val) {
                 switch ($key) {
                     case 'DB Time':
                         $aUnits[$key] = '(msec)';
                         break;
                     default:
                         $aUnits[$key] = '';
                         break;
                 }
             }
             $text .= "<tr><td class='fcaption' style='text-align:right'><b>" . implode("</b>&nbsp;</td><td class='fcaption' style='text-align:right'><b>", $aUnits) . "</b>&nbsp;</td></tr>\n";
         }
         $aSum['DB Time'] += $curTable['DB Time'];
         $aSum['DB Count'] += $curTable['DB Count'];
         $curTable['%DB Count'] = number_format(100.0 * $curTable['DB Count'] / $sql->db_QueryCount(), 0);
         $curTable['%DB Time'] = number_format(100.0 * $curTable['DB Time'] / $db_time, 0);
         $curTable['DB Time'] = number_format($curTable['DB Time'] * 1000.0, 1);
         $text .= "<tr><td class='forumheader3'>" . implode("&nbsp;</td><td class='forumheader3' style='text-align:right'>", array_values($curTable)) . "&nbsp;</td></tr>\n";
     }
     $aSum['%DB Time'] = $db_time ? number_format(100.0 * ($aSum['DB Time'] / $db_time), 0) : 0;
     $aSum['%DB Count'] = $sql->db_QueryCount() ? number_format(100.0 * ($aSum['DB Count'] / $sql->db_QueryCount()), 0) : 0;
     $aSum['DB Time'] = number_format($aSum['DB Time'] * 1000.0, 1);
     $text .= "<tr><td class='fcaption'>" . implode("&nbsp;</td><td class='fcaption' style='text-align:right'>", array_values($aSum)) . "&nbsp;</td></tr>\n";
     $text .= "\n</table><br />\n";
     return $text;
 }
Example #14
0
 function renderHelp()
 {
     $e_userclass = e107::getSingleton('user_class_admin');
     // Admin functions - should just obliterate any previous object created in class2.php
     $e_userclass->calc_tree();
     $text = "<div id='userclass-tree-structure'>" . $e_userclass->show_graphical_tree() . "</div>";
     return array('caption' => 'Class Structure', 'text' => $text);
     //TODO LAN
     // $text .= $e_userclass->show_graphical_tree();
 }
Example #15
0
 public function dbPage()
 {
     if (!getperms('0')) {
         return "Access Denied";
     }
     $this->dbPageEditProcess();
     if ($_GET['sub'] == 'edit' || $_GET['sub'] == 'create') {
         return $this->dbPageEdit();
     }
     //	$lanlist = e107::getLanguage()->installed();
     $lanlist = $this->installedLanguages;
     $tabs = $this->getTables();
     $sql = e107::getDb();
     $frm = e107::getForm();
     $tp = e107::getParser();
     $mes = e107::getMessage();
     $pref = e107::getPref();
     if (empty($pref['multilanguage'])) {
         return false;
     }
     $lck = e107::getSingleton('lancheck', e_ADMIN . "lancheck.php");
     // Choose Language to Edit:
     $text = "\n\t\t\t<fieldset id='core-language-list'>\n\t\t\t\t<legend class='e-hideme'>" . LANG_LAN_16 . "</legend>\n\t\t\t\t<table class='table table-striped adminlist'>\n\t\t\t\t\t<colgroup>\n\t\t\t\t\t\t<col style='width:20%' />\n\t\t\t\t\t\t<col style='width:60%' />\n\t\t\t\t\t\t<col style='width:20%' />\n\t\t\t\t\t</colgroup>\n\t\t\t\t\t<thead>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th>" . ADLAN_132 . "</th>\n\t\t\t\t\t\t\t<th>" . LANG_LAN_03 . "</th>\n\t\t\t\t\t\t\t<th class='last'>" . LAN_OPTIONS . "</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</thead>\n\t\t\t\t\t<tbody>\n\t\t\t\t\t\t<tr class='active'>\n\t\t\t\t\t\t\t<td>" . $pref['sitelanguage'] . "</td>\n\t\t\t\t\t\t\t<td><i>" . LANG_LAN_17 . "</i></td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t</tr>\n\t\t";
     sort($lanlist);
     foreach ($lanlist as $e_language) {
         if ($e_language == $pref['sitelanguage']) {
             continue;
         }
         $installed = array();
         $text .= "<tr><td>{$e_language}</td><td>";
         foreach ($tabs as $tab_name) {
             if ($e_language != $pref['sitelanguage'] && $sql->isTable($tab_name, $e_language)) {
                 $installed[] = $tab_name;
                 $text .= "<span class='label label-success'>" . $tab_name . "</span> ";
             }
         }
         $text .= !count($installed) ? "<span class='label label-danger label-important'>" . LANG_LAN_05 . "</span>" : "";
         $text .= "</td>\n";
         $text .= "<td>\n\t\t\t\t\t<form style='margin:0px' id='core-language-form-" . str_replace(" ", "-", $e_language) . "' action='" . e_SELF . "?mode=main&action=db' method='post'>\n";
         $text .= "<div>";
         if (count($installed)) {
             $text .= "<a class='btn btn-primary edit' href='" . e_SELF . "?mode=main&action=db&sub=edit&lan=" . $e_language . "'>" . LAN_EDIT . "</a>";
             // $text .= "<button class='btn btn-primary edit' type='submit' name='edit_existing' value='no-value'><span>".LAN_EDIT."</span></button>";
             $text .= $frm->admin_button('del_existing', LAN_DELETE, 'delete');
             //	$text .= "<button class='btn btn-danger delete' type='submit' name='del_existing' value='no-value' title='".$tp->lanVars(LANG_LAN_105, $e_language).' '.LAN_JSCONFIRM."'><span>".LAN_DELETE."</span></button>";
         } elseif ($e_language != $pref['sitelanguage']) {
             // $text .= "<button class='create' type='submit' name='create_edit_existing' value='no-value'><span>".LAN_CREATE."</span></button>";
             //	$text .= $frm->admin_button('create_edit_existing','no-value','create',LAN_CREATE);
             $text .= "<a class='btn btn-primary create' href='" . e_SELF . "?mode=main&action=db&sub=create&lan=" . $e_language . "'>" . LAN_CREATE . "</a>";
         }
         $text .= "<input type='hidden' name='lang_choices' value='" . $e_language . "' />\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</form>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t";
     }
     $text .= "\n\t\t\t\t\t</tbody>\n\t\t\t\t</table>\n\t\t\t</fieldset>\n\t\t";
     return $text;
     //	e107::getRender()->tablerender(ADLAN_132.SEP.LANG_LAN_16, $mes->render().$text); // Languages -> Tables
 }
Example #16
0
        if (vartrue($NEWSSTYLE)) {
            $template = $NEWSSTYLE;
        } elseif (function_exists("news_style")) {
            $template = news_style($news, 'extend', $param);
        } else {
            $tmp = e107::getTemplate('news', 'news', 'view');
            $template = $tmp['item'];
            unset($tmp);
        }
        ob_start();
        $ix->render_newsitem($news, 'extend', '', $template, $param);
        if (e107::getRegistry('news/page_allow_comments')) {
            global $comment_edit_query;
            //FIXME - kill me
            $comment_edit_query = 'comment.news.' . $news['news_id'];
            e107::getSingleton('comment')->compose_comment('news', 'comment', $news['news_id'], null, $news['news_title'], FALSE);
        }
        $cache_data = ob_get_contents();
        ob_end_flush();
        setNewsCache($cacheString, $cache_data);
        require_once FOOTERF;
        exit;
    } else {
        $action = 'default';
    }
}
//------------------------------------------------------
//			DISPLAY NEWS IN LIST FORMAT HERE
//------------------------------------------------------
// Show title, author, first part of news item...
if (empty($order)) {
Example #17
0
    	{
    		
    		echo "<br />There is a problem with the data submitted by the author of the plugin.";
    		echo "dir=".$dir;
    		echo "<br />pfolder=".$p['plugin_folder'];
    		exit;
    	}	
    	*/
    if ($unarc[0]['folder'] == 1 && is_dir($unarc[0]['filename'])) {
        $status = "Unzipping...";
        $dir = basename($unarc[0]['filename']);
        $plugPath = preg_replace("/[^a-z0-9-\\._]/", "-", strtolower($dir));
        e107::getSingleton('e107plugin')->update_plugins_table();
        e107::getDb()->db_Select_gen("SELECT plugin_id FROM #plugin WHERE plugin_path = '" . $plugPath . "' LIMIT 1");
        $row = e107::getDb()->db_Fetch(MYSQL_ASSOC);
        $status = e107::getSingleton('e107plugin')->install_plugin($row['plugin_id']);
        //unlink(e_UPLOAD.$localfile);
    } else {
        // print_a($fileList);
        $status = "Error: <br /><a href='" . $remotefile . "'>Download Manually</a>";
        //echo $archive->errorInfo(true);
        // $status = "There was a problem";
        //unlink(e_UPLOAD.$localfile);
    }
    echo $status;
    //	@unlink(e_TEMP.$localfile);
    //	echo "file=".$file;
    exit;
}
e107::coreLan('plugin', true);
$e_sub_cat = 'plug_manage';
Example #18
0
$e107 = e107::getInstance();
$sql = e107::getDb();
$pref = e107::getPref();
if (varset($e107_popup) != 1) {
    //
    // B.1 Clear cache (admin-only)
    //
    //
    // B.2 Send footer template, stop timing, send simple page stats
    //
    if (!deftrue('e_IFRAME')) {
        parseheader(varset($ph) ? $cust_footer : $FOOTER);
    }
    $eTimingStop = microtime();
    global $eTimingStart;
    $clockTime = e107::getSingleton('e107_traffic')->TimeDelta($eTimingStart, $eTimingStop);
    $dbPercent = 100.0 * $db_time / $clockTime;
    // Format for display or logging
    $rendertime = number_format($clockTime, 2);
    // Clock time during page render
    $db_time = number_format($db_time, 2);
    // Clock time in DB render
    $dbPercent = number_format($dbPercent, 0);
    // DB as percent of clock
    $memuse = eHelper::getMemoryUsage();
    // Memory at end, in B/KB/MB/GB ;)
    $queryCount = $sql->db_QueryCount();
    $rinfo = '';
    $logLine = '';
    if ($pref['log_page_accesses']) {
        // Collect the first batch of data to log
Example #19
0
 /**
  * Import XML Dump
  * @return none
  */
 private function importXmlFile()
 {
     $ret = e107::getSingleton('xmlClass')->e107Import($_FILES['file_userfile']['tmp_name'][0]);
     foreach ($ret['success'] as $table) {
         e107::getMessage()->addSuccess(DBLAN_103 . " {$table}");
     }
     foreach ($ret['failed'] as $table) {
         e107::getMessage()->addError(DBLAN_104 . " {$table}");
     }
 }