function update_70x_to_706($type = '') { global $sql, $ns, $pref, $e107info, $admin_log, $emessage; $just_check = $type == 'do' ? FALSE : TRUE; if (!$sql->db_Field("plugin", 5)) { if ($just_check) { return update_needed(); } $sql->db_Select_gen("ALTER TABLE `" . MPREFIX . "plugin` ADD `plugin_addons` TEXT NOT NULL ;"); catch_error($sql); } //rename plugin_rss field if ($sql->db_Field("plugin", 5) == "plugin_rss") { if ($just_check) { return update_needed(); } $sql->db_Select_gen("ALTER TABLE `" . MPREFIX . "plugin` CHANGE `plugin_rss` `plugin_addons` TEXT NOT NULL;"); catch_error($sql); } if ($sql->db_Field("dblog", 5) == "dblog_query") { if ($just_check) { return update_needed(); } $sql->db_Select_gen("ALTER TABLE `" . MPREFIX . "dblog` CHANGE `dblog_query` `dblog_title` VARCHAR( 255 ) NOT NULL DEFAULT '';"); catch_error($sql); $sql->db_Select_gen("ALTER TABLE `" . MPREFIX . "dblog` CHANGE `dblog_remarks` `dblog_remarks` TEXT NOT NULL;"); catch_error($sql); } if (!$sql->db_Field("plugin", "plugin_path", "UNIQUE")) { if ($just_check) { return update_needed(); } if (!$sql->db_Select_gen("ALTER TABLE `" . MPREFIX . "plugin` ADD UNIQUE (`plugin_path`);")) { $mesg = LAN_UPDATE_12 . " : <a href='" . e_ADMIN . "db.php?plugin'>" . ADLAN_145 . "</a>."; //$ns -> tablerender(LAN_ERROR,$mes); $emessage->add($mesg, E_MESSAGE_ERROR); catch_error($sql); } } if (!$sql->db_Field("online", 6)) { if ($just_check) { return update_needed(); } $sql->db_Select_gen("ALTER TABLE " . MPREFIX . "online ADD online_active INT(10) UNSIGNED NOT NULL DEFAULT '0'"); catch_error($sql); } if ($sql->db_Query("SHOW INDEX FROM " . MPREFIX . "tmp")) { $row = $sql->db_Fetch(); if (!in_array('tmp_ip', $row)) { if ($just_check) { return update_needed(); } $sql->db_Select_gen("ALTER TABLE `" . MPREFIX . "tmp` ADD INDEX `tmp_ip` (`tmp_ip`);"); $sql->db_Select_gen("ALTER TABLE `" . MPREFIX . "upload` ADD INDEX `upload_active` (`upload_active`);"); $sql->db_Select_gen("ALTER TABLE `" . MPREFIX . "generic` ADD INDEX `gen_type` (`gen_type`);"); } } if (!$just_check) { // update new fields require_once e_HANDLER . "plugin_class.php"; $ep = new e107plugin(); $ep->update_plugins_table('update'); $ep->save_addon_prefs('update'); } if (!isset($pref['displayname_maxlength'])) { if ($just_check) { return update_needed(); } $pref['displayname_maxlength'] = 15; save_prefs(); } // If we get to here, in checking mode no updates are required. In update mode, all done. if ($just_check) { return TRUE; } e107::getLog()->add('UPDATE_02', LAN_UPDATE_14 . $e107info['e107_version'], E_LOG_INFORMATIVE, ''); // Log result of actual update return $just_check; // TRUE if no updates needed, FALSE if updates needed and completed }
/** * 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); }
/** * New Admin Navigation Routine. */ function sc_admin_navigation($parm) { if (!ADMIN) { return ''; } // global $admin_cat, $array_functions, $array_sub_functions, $pref; $pref = e107::getPref(); $admin_cat = e107::getNav()->adminCats(); $array_functions = e107::getNav()->adminLinks('legacy'); $array_sub_functions = e107::getNav()->adminLinks('sub'); $tp = e107::getParser(); $e107 = e107::getInstance(); $sql = e107::getDb('sqlp'); parse_str($parm, $parms); $tmpl = strtoupper(varset($parms['tmpl'], 'E_ADMIN_NAVIGATION')); global ${$tmpl}; if ($parm == 'home' || $parm == 'logout' || $parm == 'language' || $parm == 'pm') { $menu_vars = $this->getOtherNav($parm); return e107::getNav()->admin('', '', $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]; // FIX - 'perm' should not be set or navigation->admin() will be broken (bad permissions) for non main administrators //$menu_vars[$id]['perm'] = ''; $menu_vars[$id]['sort'] = $admin_cat['sort'][$i]; } //CORE SUBLINKS foreach ($array_functions as $key => $subitem) { if (!empty($subitem[3]) && !getperms($subitem[3])) { continue; } $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 (vartrue($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->select("plugin", "*", "plugin_installflag =1 ORDER BY plugin_path")) { while ($row = $sql->fetch()) { if ($plug->parse_plugin($row['plugin_path'])) { $plug_vars = $plug->plug_vars; if ($row['plugin_path'] == 'calendar_menu') { // print_a($plug_vars); } // moved to boot.php // e107::loadLanFiles($row['plugin_path'], 'admin'); if (varset($plug_vars['adminLinks']['link'])) { if (!empty($row['plugin_category']) && $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']; if (!getperms('P' . $row['plugin_id'])) { continue; } $tmp[$id]['text'] = e107::getParser()->toHTML($plug_vars['@attributes']['name'], FALSE, "LINKTEXT"); $tmp[$id]['description'] = vartrue($plug_vars['description']['@value']); $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'] = varset($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 = vartrue($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'] = vartrue($plug_vars['description']['@value']) ? e107::getParser()->toHTML($plug_vars['description']['@value']) : ""; $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 (!vartrue($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) { if (!empty($pg['category'])) { $id = $convert[$pg['category']][1]; $menu_vars[$id]['sub'][] = $pg; } } unset($menu_vars['plugMenu']); // Clean up - remove empty main sections foreach ($menu_vars as $_m => $_d) { if (!isset($_d['sub']) || empty($_d['sub'])) { unset($menu_vars[$_m]); } } } // ------------------------------------------------------------------ //added option to disable leave/logout (ll) - more flexibility for theme developers if (!vartrue($parms['disable_ll'])) { // $menu_vars += $this->getOtherNav('home'); } // print_a($menu_vars); return e107::getNav()->admin('', e_PAGE, $menu_vars, ${$tmpl}, FALSE, FALSE); //return e_admin_men/u('', e_PAGE, $menu_vars, $$tmpl, FALSE, FALSE); }
function __construct() { global $e107cache, $pref; $mes = e107::getMessage(); /* if(deftrue('e_BOOTSTRAP3_ADMIN')) { $this->approvedAdminThemes[] = 'bootstrap3'; } */ require_once e_HANDLER . "form_handler.php"; //enable inner tabindex counter $this->frm = new e_form(); $this->fl = e107::getFile(); if (!empty($_POST['upload'])) { $unzippedTheme = $this->themeUpload(); } if (!empty($_POST['setUploadTheme']) && !empty($unzippedTheme)) { $themeArray = $this->getThemes(); $this->id = $themeArray[$unzippedTheme]['id']; if ($this->setTheme()) { $mes->addSuccess(TPVLAN_3); } else { $mes->addError("Could not change site theme."); // TODO LAN } } if (!empty($_POST['installContent'])) { $this->installContent($_POST['installContent']); } $this->themeArray = defined('E107_INSTALL') ? $this->getThemes('xml') : $this->getThemes(); // print_a($this -> themeArray); foreach ($_POST as $key => $post) { if (strstr($key, "preview")) { // $this -> id = str_replace("preview_", "", $key); $this->id = key($post); $this->themePreview(); } if (strstr($key, "selectmain")) { // $this -> id = str_replace("selectmain_", "", $key); $this->id = key($post); if ($this->setTheme()) { $mes->addSuccess(TPVLAN_3); } else { $mes->addError(TPVLAN_3); } } if (strstr($key, "selectadmin")) { $this->id = key($post); $this->setAdminTheme(); $this->refreshPage('admin'); } } if (isset($_POST['submit_adminstyle'])) { $this->id = $_POST['curTheme']; if ($this->setAdminStyle()) { eMessage::getInstance()->add(TPVLAN_43, E_MESSAGE_SUCCESS); } e107::getConfig()->save(true); } if (isset($_POST['submit_style'])) { $this->id = $_POST['curTheme']; $this->setLayouts(); // Update the layouts in case they have been manually changed. $this->SetCustomPages($_POST['custompages']); $this->setStyle(); e107::getConfig()->save(true); } if (isset($_POST['installplugin'])) { $key = key($_POST['installplugin']); include_lan(e_LANGUAGEDIR . e_LANGUAGE . "/admin/lan_plugin.php"); require_once e_HANDLER . "plugin_class.php"; $eplug = new e107plugin(); $message = $eplug->install_plugin($key); $mes->add($message, E_MESSAGE_SUCCESS); } if (isset($_POST['setMenuPreset'])) { $key = key($_POST['setMenuPreset']); include_lan(e_LANGUAGEDIR . e_LANGUAGE . "/admin/lan_menus.php"); require_once e_HANDLER . "menumanager_class.php"; $men = new e_menuManager(); $men->curLayout = $key; //menu_layout is left blank when it's default. $men->dbLayout = $men->curLayout != $pref['sitetheme_deflayout'] ? $men->curLayout : ""; if ($areas = $men->menuSetPreset()) { foreach ($areas as $val) { $ar[$val['menu_location']][] = $val['menu_name']; } foreach ($ar as $k => $v) { $message .= MENLAN_14 . " " . $k . " : " . implode(", ", $v) . "<br />"; } $mes->add(MENLAN_43 . " : " . $key . "<br />" . $message, E_MESSAGE_SUCCESS); } } }