$d = array('converted' => eHelper::title2sef($_POST['source'])); echo json_encode($d); exit; } ### Language files e107::coreLan('header', true); e107::coreLan('footer', true); $_globalLans = e107::pref('core', 'lan_global_list'); $_plugins = e107::getPref('plug_installed'); if (!empty($_plugins) && !empty($_globalLans) && is_array($_plugins) && count($_plugins) > 0) { $_plugins = array_keys($_plugins); foreach ($_plugins as $_p) { if (in_array($_p, $_globalLans) && defset('e_CURRENT_PLUGIN') != $_p) { continue; } e107::loadLanFiles($_p, 'admin'); } } // Get Icon constants, theme override (theme/templates/admin_icons_template.php) is allowed include_once e107::coreTemplatePath('admin_icons'); if (!defset('e_ADMIN_UI') && !defset('e_PAGETITLE')) { $array_functions = e107::getNav()->adminLinks('legacy'); // replacement see e107_handlers/sitelinks.php foreach ($array_functions as $val) { $link = str_replace("../", "", $val[0]); if (strpos(e_SELF, $link) !== FALSE) { // define('e_PAGETITLE',$val[1]); } } } if (!defined('ADMIN_WIDTH')) {
/** * Render menu * * @param string $mpath menu path * @param string $mname menu name * @param string $parm menu parameters * @param boolean $return * return string if required */ public function renderMenu($mpath, $mname = '', $parm = '', $return = false) { // global $sql; // required at the moment. global $sc_style, $e107_debug; $sql = e107::getDb(); $ns = e107::getRender(); $tp = e107::getParser(); if ($tmp = e107::unserialize($parm)) { $parm = $tmp; unset($tmp); } $this->_current_parms = $parm; $this->_current_menu = $mname; if ($return) { ob_start(); } if (e_DEBUG === true) { echo "\n<!-- Menu Start: " . $mname . " -->\n"; } e107::getDB()->db_Mark_Time($mname); if (is_numeric($mpath) || $mname === false) { $query = $mname === false ? "menu_name = '" . $mpath . "' " : "page_id=" . intval($mpath) . " "; // load by ID or load by menu-name (menu_name) $sql->select("page", "*", $query); $page = $sql->fetch(); if (!empty($page['menu_class']) && !check_class($page['menu_class'])) { echo "\n<!-- Menu not rendered due to userclass settings -->\n"; return; } $caption = vartrue($page['menu_icon']) ? $tp->toIcon($page['menu_icon']) : ''; $caption .= $tp->toHTML($page['menu_title'], true, 'parse_sc, constants'); if (vartrue($page['menu_template'])) { $template = e107::getCoreTemplate('menu', $page['menu_template'], true, true); // override and merge required. ie. when menu template is not in the theme, but only in the core. $page_shortcodes = e107::getScBatch('page', null, 'cpage'); $page_shortcodes->setVars($page); $head = $tp->parseTemplate($template['start'], true); $foot = $tp->parseTemplate($template['end'], true); // print_a($template['body']); $text = $head . $tp->parseTemplate($template['body'], true, $page_shortcodes) . $template['end']; // echo "TEMPLATE= ($mpath)".$page['menu_template']; // if($template['noTableRender'] !==true) // XXX Deprecated - causes confusion while themeing. use {SETSTYLE=none} instead. // { $ns->tablerender($caption, $text, 'cmenu-' . $page['menu_template']); // } // else // { // echo $text; // } } else { $text = $tp->toHTML($page['menu_text'], true, 'parse_sc, constants'); $ns->tablerender($caption, $text, 'cmenu'); } } else { // not sure what would break this, but it's good idea to go away e107::loadLanFiles($mpath); //include once is not an option anymore //e107_include will break many old menus (evil globals), so we'll wait for a while... //e107_include(e_PLUGIN.$mpath."/".$mname.".php"); //if(substr($mpath,-1)!='/') //{ // $mpath .= '/'; //} $mpath = trim($mpath, '/') . '/'; // faster... $e107_debug ? include e_PLUGIN . $mpath . $mname . '.php' : @(include e_PLUGIN . $mpath . $mname . '.php'); } e107::getDB()->db_Mark_Time("(After " . $mname . ")"); if ($error_handler->debug == true) { echo "\n<!-- Menu End: " . $mname . " -->\n"; } if ($return) { $ret = ob_get_contents(); ob_end_clean(); return $ret; } }
function pluginRenderPlugin($pluginList) { global $plugin; if (empty($pluginList)) { return ''; } $tp = e107::getParser(); $frm = e107::getForm(); $pgf = new pluginmanager_form(); $text = ""; foreach ($pluginList as $plug) { e107::loadLanFiles($plug['plugin_path'], 'admin'); if ($this->action == "avail") { e107::lan($plug['plugin_path'], 'global', true); // Load language files. } $_path = e_PLUGIN . $plug['plugin_path'] . '/'; $plug_vars = false; $plugin_config_icon = ""; if ($plugin->parse_plugin($plug['plugin_path'])) { $plug_vars = $plugin->plug_vars; } if (varset($plug['plugin_category']) == "menu") { continue; } if ($plug_vars) { $icon_src = (isset($plug_vars['plugin_php']) ? e_PLUGIN : $_path) . $plug_vars['administration']['icon']; $plugin_icon = $plug_vars['administration']['icon'] ? $icon_src : $tp->toGlyph('e-cat_plugins-32'); $conf_file = "#"; $conf_title = ""; if ($plug_vars['administration']['configFile'] && $plug['plugin_installflag'] == true) { $conf_file = e_PLUGIN . $plug['plugin_path'] . '/' . $plug_vars['administration']['configFile']; $conf_title = LAN_CONFIGURE . ' ' . $tp->toHtml($plug_vars['@attributes']['name'], "", "defs,emotes_off, no_make_clickable"); // $plugin_icon = "<a title='{$conf_title}' href='{$conf_file}' >".$plugin_icon."</a>"; $plugin_config_icon = "<a class='btn btn-default' title='{$conf_title}' href='{$conf_file}' >" . ADMIN_CONFIGURE_ICON . "</a>"; } $plugEmail = varset($plug_vars['author']['@attributes']['email'], ''); $plugAuthor = varset($plug_vars['author']['@attributes']['name'], ''); $plugURL = varset($plug_vars['author']['@attributes']['url'], ''); $plugDate = varset($plug_vars['@attributes']['date'], ''); $compatibility = varset($plug_vars['@attributes']['compatibility'], ''); $description = varset($plug_vars['description']['@attributes']['lang']) ? $tp->toHTML($plug_vars['description']['@attributes']['lang'], false, "defs,emotes_off, no_make_clickable") : $tp->toHTML($plug_vars['description']['@value'], false, "emotes_off, no_make_clickable"); $plugReadme = ""; if (varset($plug['plugin_installflag'])) { $plugName = "<a title='{$conf_title}' href='{$conf_file}' >" . $tp->toHTML($plug['plugin_name'], false, "defs,emotes_off, no_make_clickable") . "</a>"; } else { $plugName = $tp->toHTML($plug['plugin_name'], false, "defs,emotes_off, no_make_clickable"); } if (varset($plug_vars['readme'])) { $plugReadme = $plug_vars['readme']; } if (varset($plug_vars['readMe'])) { $plugReadme = $plug_vars['readMe']; } if (!file_exists($plugin_icon)) { $plugin_icon = 'e-cat_plugins-32'; // e_IMAGE."admin_images/cat_plugins_32.png"; } $data = array('plugin_id' => $plug['plugin_id'], 'plugin_icon' => $plugin_icon, 'plugin_name' => $plugName, 'plugin_folder' => $plug['plugin_path'], 'plugin_date' => $plugDate, 'plugin_category' => vartrue($plug['plugin_category']), 'plugin_author' => vartrue($plugAuthor), 'plugin_version' => $plug['plugin_version'], 'plugin_description' => $description, 'plugin_compatible' => $this->compatibilityLabel($plug_vars['@attributes']['compatibility']), 'plugin_website' => vartrue($row['authorUrl']), 'plugin_notes' => ''); $pgf->plug_vars = $plug_vars; $pgf->plug = $plug; $text .= $pgf->renderTableRow($this->fields, $this->fieldpref, $data, 'plugin_id'); /* //LEGACY CODE $text .= "<tr>"; if(varset($this-> fields['checkboxes'])) { $rowid = "checkboxes[".$plug['plugin_id']."]"; $text .= "<td class='center middle'>".$frm->checkbox($rowid, $plug['plugin_id'])."</td>\n"; } // $text .= (in_array("plugin_status",$this->fieldpref)) ? "<td class='center'>".$img."</td>" : ""; $text .= (in_array("plugin_icon",$this->fieldpref)) ? "<td class='center middle'>".$plugin_icon."</td>" : ""; $text .= (in_array("plugin_name",$this->fieldpref)) ? "<td class='middle'>".$plugName."</td>" : ""; $text .= (in_array("plugin_version",$this->fieldpref)) ? "<td class='middle'>".$plug['plugin_version']."</td>" : ""; $text .= (in_array("plugin_date",$this->fieldpref)) ? "<td class='middle'>".$plugDate."</td>" : ""; $text .= (in_array("plugin_folder",$this->fieldpref)) ? "<td class='middle'>".$plug['plugin_path']."</td>" : ""; $text .= (in_array("plugin_category",$this->fieldpref)) ? "<td class='middle'>".$plug['plugin_category']."</td>" : ""; $text .= (in_array("plugin_author",$this->fieldpref)) ? "<td class='middle'><a href='mailto:".$plugEmail."' title='".$plugEmail."'>".$plugAuthor."</a> </td>" : ""; $text .= (in_array("plugin_website",$this->fieldpref)) ? "<td class='center middle'>".($plugURL ? "<a href='{$plugURL}' title='{$plugURL}' >".ADMIN_URL_ICON."</a>" : "")."</td>" : ""; $text .= (in_array("plugin_compatible",$this->fieldpref)) ? "<td class='center middle'>".$this->compatibilityLabel($plug_vars['@attributes']['compatibility'])."</td>" : ""; $text .= (in_array("plugin_description",$this->fieldpref)) ? "<td class='middle'>".$description."</td>" : ""; $text .= (in_array("plugin_compliant",$this->fieldpref)) ? "<td class='center middle'>".((varset($plug_vars['compliant']) || varsettrue($plug_vars['@attributes']['xhtmlcompliant'])) ? ADMIN_TRUE_ICON : " ")."</td>" : ""; $text .= (in_array("plugin_notes",$this->fieldpref)) ? "<td class='center middle'>".($plugReadme ? "<a href='".e_PLUGIN.$plug['plugin_path']."/".$plugReadme."' title='".$plugReadme."'>".ADMIN_INFO_ICON."</a>" : " ")."</td>" : ""; // Plugin options Column -------------- $text .= "<td class='options center middle'> <div class='btn-group'>".$plugin_config_icon; if ($plug_vars['@attributes']['installRequired']) { if ($plug['plugin_installflag']) { $text .= ($plug['plugin_installflag'] ? "<a class='btn' href=\"".e_SELF."?uninstall.{$plug['plugin_id']}\" title='".EPL_ADLAN_1."' >".ADMIN_UNINSTALLPLUGIN_ICON."</a>" : "<a class='btn' href=\"".e_SELF."?install.{$plug['plugin_id']}\" title='".EPL_ADLAN_0."' >".ADMIN_INSTALLPLUGIN_ICON."</a>"); // $text .= ($plug['plugin_installflag'] ? "<button type='button' class='delete' value='no-value' onclick=\"location.href='".e_SELF."?uninstall.{$plug['plugin_id']}'\"><span>".EPL_ADLAN_1."</span></button>" : "<button type='button' class='update' value='no-value' onclick=\"location.href='".e_SELF."?install.{$plug['plugin_id']}'\"><span>".EPL_ADLAN_0."</span></button>"); if (PLUGIN_SHOW_REFRESH && !varsettrue($plug_vars['plugin_php'])) { $text .= "<br /><br /><input type='button' class='btn button' onclick=\"location.href='".e_SELF."?refresh.{$plug['plugin_id']}'\" title='".'Refresh plugin settings'."' value='".'Refresh plugin settings'."' /> "; } } else { // $text .= "<input type='button' class='btn' onclick=\"location.href='".e_SELF."?install.{$plug['plugin_id']}'\" title='".EPL_ADLAN_0."' value='".EPL_ADLAN_0."' />"; // $text .= "<button type='button' class='update' value='no-value' onclick=\"location.href='".e_SELF."?install.{$plug['plugin_id']}'\"><span>".EPL_ADLAN_0."</span></button>"; $text .= "<a class='btn' href=\"".e_SELF."?install.{$plug['plugin_id']}\" title='".EPL_ADLAN_0."' >".ADMIN_INSTALLPLUGIN_ICON."</a>"; } } else { if ($plug_vars['menuName']) { $text .= EPL_NOINSTALL.str_replace("..", "", e_PLUGIN.$plug['plugin_path'])."/ ".EPL_DIRECTORY; } else { $text .= EPL_NOINSTALL_1.str_replace("..", "", e_PLUGIN.$plug['plugin_path'])."/ ".EPL_DIRECTORY; if($plug['plugin_installflag'] == false) { e107::getDb()->db_Delete('plugin', "plugin_installflag=0 AND (plugin_path='{$plug['plugin_path']}' OR plugin_path='{$plug['plugin_path']}/' ) "); } } } if ($plug['plugin_version'] != $plug_vars['@attributes']['version'] && $plug['plugin_installflag']) { // $text .= "<br /><input type='button' class='btn' onclick=\"location.href='".e_SELF."?upgrade.{$plug['plugin_id']}'\" title='".EPL_UPGRADE." to v".$plug_vars['@attributes']['version']."' value='".EPL_UPGRADE."' />"; $text .= "<a class='btn' href='".e_SELF."?upgrade.{$plug['plugin_id']}' title=\"".EPL_UPGRADE." to v".$plug_vars['@attributes']['version']."\" >".ADMIN_UPGRADEPLUGIN_ICON."</a>"; } $text .="</div></td>"; // $text .= "</tr>"; */ } } return $text; }
/** * Plugin Folder Scanner * @return none */ private function plugin_viewscan() { $error_messages = array(0 => DBLAN_31, 1 => DBLAN_32, 2 => DBLAN_33, 3 => DBLAN_34); $error_image = array("integrity_pass.png", "integrity_fail.png", "warning.png", "blank.png"); global $e107; $sql = e107::getDb(); $tp = e107::getParser(); $frm = e107::getForm(); $emessage = e107::getMessage(); require_once e_HANDLER . "plugin_class.php"; $ep = new e107plugin(); $ep->update_plugins_table(); // scan for e_xxx changes and save to plugin table. $ep->save_addon_prefs(); // generate global e_xxx_list prefs from plugin table. /* we all are awaiting for PHP5 only support - method chaining... $emessage->add(DBLAN_22.' - '.DBLAN_23, E_MESSAGE_SUCCESS) ->add("<a href='".e_SELF."'>".LAN_BACK."</a>", E_MESSAGE_SUCCESS) ->add(DBLAN_30); */ $emessage->add(DBLAN_23, E_MESSAGE_SUCCESS); $emessage->add("<a href='" . e_SELF . "'>" . LAN_BACK . "</a>", E_MESSAGE_SUCCESS); $emessage->add(DBLAN_30); $text = "\n\t\t\t\t<form method='post' action='" . e_ADMIN . "db.php?mode=" . $_GET['mode'] . "' id='plug_edit'>\n\t\t\t\t\t<fieldset id='core-db-plugin-scan'>\n\t\t\t\t\t\t<legend class='e-hideme'>" . ADLAN_CL_7 . "</legend>\n\t\t\t\t\t\t<table class='table adminlist'>\n\t\t\t\t\t\t\t<colgroup>\n\t\t\t\t\t\t\t\t<col style='width: 20%' />\n\t\t\t\t\t\t\t\t<col style='width: 20%' />\n\t\t\t\t\t\t\t\t<col style='width: 35%' />\n\t\t\t\t\t\t\t\t<col style='width: 25%' />\n\t\t\t\t\t\t\t</colgroup>\n\t\t\t\t\t\t\t<thead>\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<th>" . DBLAN_24 . "</th>\n\t\t\t\t\t\t\t\t\t<th>" . DBLAN_25 . "</th>\n\t\t\t\t\t\t\t\t\t<th>" . DBLAN_26 . "</th>\n\t\t\t\t\t\t\t\t\t<th class='center last'>" . DBLAN_27 . "</th>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t</thead>\n\t\t\t\t\t\t\t<tbody>\n\t\t\t"; $sql->db_Select("plugin", "*", "plugin_id !='' order by plugin_path ASC"); // Must order by path to pick up duplicates. (plugin names may change). $previous = ''; while ($row = $sql->db_Fetch()) { e107::loadLanFiles($row['plugin_path'], 'admin'); $text .= "\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td>" . $e107->tp->toHtml($row['plugin_name'], FALSE, "defs,emotes_off") . "</td>\n\t \t\t\t\t\t<td>" . $row['plugin_path'] . "</td>\n\t\t\t\t\t\t\t\t\t<td>"; if (trim($row['plugin_addons'])) { //XXX - $nl_code = ''; - OLD VAR? foreach (explode(',', $row['plugin_addons']) as $this_addon) { $ret_code = 3; // Default to 'not checked if (strpos($this_addon, 'e_') === 0 && substr($this_addon, -4, 4) != '_sql') { $ret_code = $ep->checkAddon($row['plugin_path'], $this_addon); // See whether spaces before opening tag or after closing tag } $text .= "<div class='clear'>"; $text .= "<img class='icon action S16' src='" . e_IMAGE_ABS . "fileinspector/" . $error_image[$ret_code] . "' alt='" . $error_messages[$ret_code] . "' title='" . $error_messages[$ret_code] . "' />"; $text .= trim($this_addon); // $ret_code - 0=OK, 1=content error, 2=access error $text .= "</div>"; } } $text .= "\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td class='center'>\n\t\t\t\t"; if ($previous == $row['plugin_path']) { $delid = $row['plugin_id']; $delname = $row['plugin_name']; //Admin delete button $text .= $frm->admin_button("delplug[{$delid}]", DBLAN_52, 'delete', '', array('title' => LAN_CONFIRMDEL . " ID:{$delid} [{$delname}]")); //Or maybe image submit? - //$text .= $frm->submit_image("delplug[{$delid}]", DBLAN_52, 'delete', LAN_CONFIRMDEL." ID:{$delid} [$delname]"); } else { $text .= $row['plugin_installflag'] == 1 ? DBLAN_27 : " "; // "Installed and not installed"; } $text .= "\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t"; $previous = $row['plugin_path']; } $text .= "\n\t\t\t\t\t\t\t</tbody>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t</fieldset>\n\t\t\t\t</form>\n\t\t\t"; e107::getRender()->tablerender(DBLAN_10 . ' - ' . DBLAN_22, $emessage->render() . $text); }
/** * @deprecated - use e107::loadLanFiles(); * @param $unitName * @param string $type * @return bool|string */ function loadLanFiles($unitName, $type = 'runtime') { $info = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2); e107::getMessage()->addDebug("Using deprecated function loanLanFiles(). Replace with e107::loadLanFiles()." . print_a($info, true)); return e107::loadLanFiles($unitName, $type); }
/** * New Admin Navigation Routine. */ function sc_admin_navigation($parm) { if (!ADMIN) { return ''; } global $admin_cat, $array_functions, $array_sub_functions, $pref; $tp = e107::getParser(); $e107 = e107::getInstance(); $sql = e107::getDb(); parse_str($parm, $parms); $tmpl = strtoupper(varset($parms['tmpl'], 'E_ADMIN_NAVIGATION')); global ${$tmpl}; require e_ADMIN . 'ad_links.php'; require_once e_HANDLER . 'admin_handler.php'; if ($parm == 'home' || $parm == 'logout' || $parm == 'language') { $menu_vars = $this->getOtherNav($parm); return e_admin_menu('', '', $menu_vars, ${$tmpl}, FALSE, FALSE); } // MAIN LINK if ($parm != 'no-main') { $menu_vars = array(); $menu_vars['adminhome']['text'] = ADLAN_151; $menu_vars['adminhome']['link'] = e_ADMIN_ABS . 'admin.php'; $menu_vars['adminhome']['image'] = "<img src='" . E_16_NAV_MAIN . "' alt='" . ADLAN_151 . "' class='icon S16' />"; $menu_vars['adminhome']['image_src'] = ADLAN_151; $menu_vars['adminhome']['perm'] = ''; } //ALL OTHER ROOT LINKS - temporary data transformation - data structure will be changed in the future and this block will be removed foreach ($admin_cat['id'] as $i => $cat) { $id = $admin_cat['id'][$i]; $menu_vars[$id]['text'] = $admin_cat['title'][$i]; $menu_vars[$id]['description'] = $admin_cat['title'][$i]; $menu_vars[$id]['link'] = '#'; $menu_vars[$id]['image'] = "<img src='" . $admin_cat['img'][$i] . "' alt='" . $admin_cat['title'][$i] . "' class='icon S16' />"; $menu_vars[$id]['image_large'] = "<img src='" . $admin_cat['lrg_img'][$i] . "' alt='" . $admin_cat['title'][$i] . "' class='icon S32' />"; $menu_vars[$id]['image_src'] = $admin_cat['img'][$i]; $menu_vars[$id]['image_large_src'] = $admin_cat['lrg_img'][$i]; $menu_vars[$id]['perm'] = ''; $menu_vars[$id]['sort'] = $admin_cat['sort'][$i]; } //CORE SUBLINKS foreach ($array_functions as $key => $subitem) { $catid = $admin_cat['id'][$subitem[4]]; $tmp = array(); $tmp['text'] = $subitem[1]; $tmp['description'] = $subitem[2]; $tmp['link'] = $subitem[0]; $tmp['image'] = $subitem[5]; $tmp['image_large'] = $subitem[6]; $tmp['image_src'] = ''; $tmp['image_large_src'] = ''; $tmp['perm'] = $subitem[3]; $tmp['sub_class'] = ''; $tmp['sort'] = false; if ($pref['admin_slidedown_subs'] && vartrue($array_sub_functions[$key])) { $tmp['sub_class'] = 'sub'; foreach ($array_sub_functions[$key] as $subkey => $subsubitem) { $subid = $key . '_' . $subkey; $tmp['sub'][$subid]['text'] = $subsubitem[1]; $tmp['sub'][$subid]['description'] = $subsubitem[2]; $tmp['sub'][$subid]['link'] = $subsubitem[0]; $tmp['sub'][$subid]['image'] = $subsubitem[5]; $tmp['sub'][$subid]['image_large'] = $subsubitem[6]; $tmp['sub'][$subid]['image_src'] = ''; $tmp['sub'][$subid]['image_large_src'] = ''; $tmp['sub'][$subid]['perm'] = $subsubitem[3]; } } if ($tmp) { $menu_vars[$catid]['sub'][$key] = $tmp; } } //PLUGINS require_once e_HANDLER . 'plugin_class.php'; $plug = new e107plugin(); $tmp = array(); if ($sql->db_Select("plugin", "*", "plugin_installflag=1 ORDER BY plugin_path")) { while ($row = $sql->db_Fetch()) { if ($plug->parse_plugin($row['plugin_path'])) { $plug_vars = $plug->plug_vars; if ($row['plugin_path'] == 'tinymce') { // print_a($plug_vars); } e107::loadLanFiles($row['plugin_path'], 'admin'); if (varset($plug_vars['adminLinks']['link'])) { if ($row['plugin_category'] == 'menu' || !vartrue($plug_vars['adminLinks']['link'][0]['@attributes']['url'])) { continue; } $plugpath = varset($plug_vars['plugin_php']) ? e_PLUGIN_ABS : e_PLUGIN_ABS . $row['plugin_path'] . '/'; $icon_src = varset($plug_vars['administration']['iconSmall']) ? $plugpath . $plug_vars['administration']['iconSmall'] : ''; $icon_src_lrg = varset($plug_vars['administration']['icon']) ? $plugpath . $plug_vars['administration']['iconSmall'] : ''; $id = 'plugnav-' . $row['plugin_path']; $tmp[$id]['text'] = e107::getParser()->toHTML($plug_vars['@attributes']['name'], FALSE, "LINKTEXT"); $tmp[$id]['description'] = $plug_vars['description']; $tmp[$id]['link'] = e_PLUGIN_ABS . $row['plugin_path'] . '/' . $plug_vars['administration']['configFile']; $tmp[$id]['image'] = $icon_src ? "<img src='{$icon_src}' alt=\"" . varset($tmp[$id]['text']) . "\" class='icon S16' />" : E_16_PLUGIN; $tmp[$id]['image_large'] = $icon_src_lrg ? "<img src='{$icon_src_lrg}' alt=\"" . varset($tmp[$id]['text']) . "\" class='icon S32' />" : $icon_src_lrg; $tmp[$id]['image_src'] = $icon_src; $tmp[$id]['image_large_src'] = $icon_src_lrg; $tmp[$id]['perm'] = 'P' . $row['plugin_id']; $tmp[$id]['sub_class'] = ''; $tmp[$id]['sort'] = 2; $tmp[$id]['category'] = $row['plugin_category']; if ($pref['admin_slidedown_subs'] && vartrue($plug_vars['adminLinks']['link'])) { $tmp[$id]['sub_class'] = 'sub'; $tmp[$id]['sort'] = false; foreach ($plug_vars['adminLinks']['link'] as $subkey => $plugsub) { $subid = $id . '-' . $subkey; $predef_icons = array('add', 'manage', 'settings'); $title = $plugsub['@value']; $plugsub = $plugsub['@attributes']; if (varset($plugsub['primary']) == 'true') { continue; } $icon_src = in_array($plugsub['icon'], $predef_icons) ? e_IMAGE_ABS . "admin_images/{$plugsub['icon']}_16.png" : ($plugsub['icon'] ? $plugpath . $plugsub['icon'] : ''); $tmp[$id]['sub'][$subid]['text'] = e107::getParser()->toHTML($title, FALSE, 'LINKTEXT'); $tmp[$id]['sub'][$subid]['description'] = e107::getParser()->toHTML($plug_vars['description']); $tmp[$id]['sub'][$subid]['link'] = e_PLUGIN_ABS . $row['plugin_path'] . '/' . $plugsub['url']; $tmp[$id]['sub'][$subid]['image'] = $icon_src ? "<img src='{$icon_src}' alt=\"" . varset($tmp[$id]['sub'][$subid]['text']) . "\" class='icon S16' />" : ""; $tmp[$id]['sub'][$subid]['image_large'] = ''; $tmp[$id]['sub'][$subid]['image_src'] = $icon_src; $tmp[$id]['sub'][$subid]['image_large_src'] = ''; $tmp[$id]['sub'][$subid]['perm'] = varset($plugsub['perm']) ? $plugsub['perm'] : 'P' . $row['plugin_id']; $tmp[$id]['sub'][$subid]['sub_class'] = ''; } } } } } $menu_vars['plugMenu']['sub'] = multiarray_sort($tmp, 'text'); } // ---------------- Cameron's Bit --------------------------------- if (!varsettrue($pref['admin_separate_plugins'])) { // Convert Plugin Categories to Core Categories. $convert = array('settings' => array(1, 'setMenu'), 'users' => array(2, 'userMenu'), 'content' => array(3, 'contMenu'), 'tools' => array(4, 'toolMenu'), 'manage' => array(6, 'managMenu'), 'misc' => array(7, 'miscMenu'), 'help' => array(20, 'helpMenu')); foreach ($tmp as $pg) { $id = $convert[$pg['category']][1]; $menu_vars[$id]['sub'][] = $pg; } unset($menu_vars['plugMenu']); } // print_a($menu_vars); // ------------------------------------------------------------------ //added option to disable leave/logout (ll) - more flexibility for theme developers if (!varsettrue($parms['disable_ll'])) { // $menu_vars += $this->getOtherNav('home'); } // print_a($menu_vars); return e_admin_menu('', e_PAGE, $menu_vars, ${$tmpl}, FALSE, FALSE); }
function pluginLinks($iconSize = E_16_PLUGMANAGER, $linkStyle = 'adminb') { $sql = e107::getDb(); $tp = e107::getParser(); $plug_id = array(); $plugin_array = array(); e107::getDb()->db_Select("plugin", "*", "plugin_installflag = 1"); // Grab plugin IDs. while ($row = e107::getDb()->db_Fetch()) { $pth = $row['plugin_path']; $plug_id[$pth] = $row['plugin_id']; } $pref = e107::getConfig('core')->getPref(); $text = $this->renderAdminButton(e_ADMIN . "plugin.php", ADLAN_98, ADLAN_99, "Z", $iconSize, $linkStyle); $plugs = e107::getObject('e107plugin'); if (vartrue($pref['plug_installed'])) { foreach ($pref['plug_installed'] as $plug => $vers) { $plugs->parse_plugin($plug); $plugin_path = $plug; $name = $plugs->plug_vars['@attributes']['name']; /* echo "<h1>".$name." ($plug)</h1>"; print_a($plugs->plug_vars); */ if (!varset($plugs->plug_vars['adminLinks']['link'])) { continue; } foreach ($plugs->plug_vars['adminLinks']['link'] as $tag) { if (varset($tag['@attributes']['primary']) != 'true') { continue; } if (!in_array($plugin_path, $pref['lan_global_list'])) { e107::loadLanFiles($plugin_path, 'admin'); } $att = $tag['@attributes']; $eplug_name = $tp->toHTML($name, FALSE, "defs, emotes_off"); $eplug_conffile = $att['url']; $eplug_icon_small = !empty($att['iconSmall']) ? $plugin_path . '/' . $att['iconSmall'] : ''; $eplug_icon = !empty($att['icon']) ? $plugin_path . '/' . $att['icon'] : ''; $eplug_caption = str_replace("'", '', $tp->toHTML($att['description'], FALSE, 'defs, emotes_off')); if (varset($eplug_conffile)) { $eplug_name = $tp->toHTML($eplug_name, FALSE, "defs, emotes_off"); $plugin_icon = $eplug_icon_small ? "<img class='icon S16' src='" . e_PLUGIN_ABS . $eplug_icon_small . "' alt='' />" : E_16_PLUGIN; $plugin_icon_32 = $eplug_icon ? "<img class='icon S32' src='" . e_PLUGIN_ABS . $eplug_icon . "' alt='' />" : E_32_PLUGIN; $plugin_array['p-' . $plugin_path] = array('key' => 'p-' . $plugin_path, 'link' => e_PLUGIN . $plugin_path . "/" . $eplug_conffile, 'title' => $eplug_name, 'caption' => $eplug_caption, 'perms' => "P" . varset($plug_id[$plugin_path]), 'icon' => $plugin_icon, 'icon_32' => $plugin_icon_32, 'cat' => $this->plugCatToCoreCat($plugs->plug_vars['category'])); } } } } // print_a($plugs->plug_vars['adminLinks']['link']); /* echo "hello there"; $xml = e107::getXml(); $xml->filter = array('@attributes' => FALSE,'description'=>FALSE,'administration' => FALSE); // .. and they're all going to need the same filter if ($sql->db_Select("plugin", "*", "plugin_installflag=1")) { while ($row = $sql->db_Fetch()) { extract($row); // plugin_id int(10) unsigned NOT NULL auto_increment, // plugin_name varchar(100) NOT NULL default '', // plugin_version varchar(10) NOT NULL default '', // plugin_path varchar(100) NOT NULL default '', // plugin_installflag tinyint(1) unsigned NOT NULL default '0', // plugin_addons text NOT NULL, if (is_readable(e_PLUGIN.$plugin_path."/plugin.xml")) { $readFile = $xml->loadXMLfile(e_PLUGIN.$plugin_path.'/plugin.xml', true, true); if ($readFile === FALSE) { echo 'Error in file: '.e_PLUGIN.$plugin_path.'/plugin.xml'.'<br />'; } else { loadLanFiles($plugin_path, 'admin'); $eplug_name = $tp->toHTML($readFile['@attributes']['name'],FALSE,"defs, emotes_off"); $eplug_conffile = $readFile['administration']['configFile']; $eplug_icon_small = $plugin_path.'/'.$readFile['administration']['iconSmall']; $eplug_icon = $plugin_path.'/'.$readFile['administration']['icon']; $eplug_caption = str_replace("'", '', $tp->toHTML($readFile['description'], FALSE, 'defs, emotes_off')); } } elseif (is_readable(e_PLUGIN.$plugin_path."/plugin.php")) { include(e_PLUGIN.$plugin_path."/plugin.php"); } if (varset($eplug_conffile)) { $eplug_name = $tp->toHTML($eplug_name,FALSE,"defs, emotes_off"); $plugin_icon = $eplug_icon_small ? "<img class='icon S16' src='".e_PLUGIN.$eplug_icon_small."' alt='' />" : E_16_PLUGIN; $plugin_icon_32 = $eplug_icon ? "<img class='icon S32' src='".e_PLUGIN.$eplug_icon."' alt='' />" : E_32_PLUGIN; $plugin_array['p-'.$plugin_path] = array('link' => e_PLUGIN.$plugin_path."/".$eplug_conffile, 'title' => $eplug_name, 'caption' => $eplug_caption, 'perms' => "P".$plugin_id, 'icon' => $plugin_icon, 'icon_32' => $plugin_icon_32); } unset($eplug_conffile, $eplug_name, $eplug_caption, $eplug_icon_small); } } else { $plugin_array = array(); } */ ksort($plugin_array, SORT_STRING); // To FIX, without changing the current key format, sort by 'title' if ($linkStyle == "array" || $iconSize == 'assoc') { return $plugin_array; } foreach ($plugin_array as $plug_key => $plug_value) { $the_icon = $iconSize == E_16_PLUGMANAGER ? $plug_value['icon'] : $plug_value['icon_32']; $text .= $this->renderAdminButton($plug_value['link'], $plug_value['title'], $plug_value['caption'], $plug_value['perms'], $the_icon, $linkStyle); } return $text; }
/** * Render menu * * @param string $mpath menu path * @param string $mname menu name * @param string $parm menu parameters * @param boolean $return * return string if required */ public function renderMenu($mpath, $mname, $parm = '', $return = false) { global $sql; // required at the moment. global $ns, $tp, $sc_style, $e107_debug; $e107 = e107::getInstance(); if ($return) { ob_start(); } if (vartrue($error_handler->debug)) { echo "\n<!-- Menu Start: " . $mname . " -->\n"; } e107::getDB()->db_Mark_Time($mname); if (is_numeric($mpath)) { $sql->db_Select("page", "*", "page_id=" . intval($mpath) . " "); $page = $sql->db_Fetch(); $caption = $e107->tp->toHTML($page['page_title'], true, 'parse_sc, constants'); $text = $e107->tp->toHTML($page['page_text'], true, 'parse_sc, constants'); e107::getRender()->tablerender($caption, $text); } else { // not sure what would break this, but it's good idea to go away e107::loadLanFiles($mpath); //include once is not an option anymore //e107_include will break many old menus (evil globals), so we'll wait for a while... //e107_include(e_PLUGIN.$mpath."/".$mname.".php"); //if(substr($mpath,-1)!='/') //{ // $mpath .= '/'; //} $mpath = trim($mpath, '/') . '/'; // faster... $e107_debug ? include e_PLUGIN . $mpath . $mname . '.php' : @(include e_PLUGIN . $mpath . $mname . '.php'); /*if(file_exists(e_PLUGIN.$mpath."/".$mname.".php")) { include_once (e_PLUGIN.$mpath."/".$mname.".php"); }*/ } e107::getDB()->db_Mark_Time("(After " . $mname . ")"); if ($error_handler->debug == true) { echo "\n<!-- Menu End: " . $mname . " -->\n"; } if ($return) { $ret = ob_get_contents(); ob_end_clean(); return $ret; } }