Example #1
0
    /**
     * Legacy Admin Menu Routine. 
     * Currently Used by Jayya admin. 
     */
    function sc_admin_alt_nav($parm)
    {
        if (ADMIN) {
            global $sql, $pref, $tp;
            parse_str($parm);
            require e_ADMIN . 'ad_links.php';
            require_once e_HANDLER . 'admin_handler.php';
            function adnav_cat($cat_title, $cat_link, $cat_img, $cat_id = FALSE)
            {
                $cat_link = $cat_link ? $cat_link : "javascript:void(0);";
                $text = "<a class='menuButton' href='" . $cat_link . "' style='background-image: url(" . $cat_img . "); background-repeat: no-repeat;  background-position: 3px 1px' ";
                if ($cat_id) {
                    $text .= "onclick=\"return buttonClick(event, '" . $cat_id . "');\" onmouseover=\"buttonMouseover(event, '" . $cat_id . "');\"";
                }
                $text .= ">" . $cat_title . "</a>";
                return $text;
            }
            function adnav_main($cat_title, $cat_link, $cat_img, $cat_id = FALSE, $cat_highlight = '')
            {
                $exit = "";
                $text = "<a class='menuItem " . $cat_highlight . "' href='" . $cat_link . "' ";
                if ($cat_id) {
                    $text .= "onclick=\"return false;\" onmouseover=\"menuItemMouseover(event, '" . $cat_id . "');\"";
                }
                $text .= "><span class='menuItemBuffer'>" . $cat_img . "</span><span class='menuItemText'>" . $cat_title . "</span>";
                if ($cat_id) {
                    $text .= "<span class=\"menuItemArrow\">&#9654;</span>";
                }
                $text .= "</a>";
                return $text;
            }
            if (file_exists(THEME . 'nav_menu.js')) {
                $text = "<script type='text/javascript' src='" . THEME_ABS . "nav_menu.js'></script>";
            } else {
                $text = "<script type='text/javascript' src='" . e_JS . "nav_menu.js'></script>";
            }
            $text .= "<div style='width: 100%'><table style='border-collapse: collapse; width: 100%'>\n\t\t\t<tr><td>\n\t\t\t<div class='menuBar' style='width: 100%'>";
            $text .= adnav_cat(ADLAN_151, e_ADMIN . 'admin.php', E_16_NAV_MAIN);
            // Main Link.
            // Render Settings, Users, Content, Tools, Manage.
            for ($i = 1; $i < 7; $i++) {
                $ad_tmpi = 0;
                $ad_links_array = asortbyindex($array_functions, 1);
                $nav_main = adnav_cat($admin_cat['title'][$i], '', $admin_cat['img'][$i], $admin_cat['id'][$i]);
                $ad_texti = "<div id='" . $admin_cat['id'][$i] . "' class='menu' onmouseover=\"menuMouseover(event)\">";
                while (list($key, $nav_extract) = each($ad_links_array)) {
                    if ($nav_extract[4] == $i) {
                        if (getperms($nav_extract[3])) {
                            $ad_texti .= adnav_main($nav_extract[1], $nav_extract[0], $nav_extract[5]);
                            $ad_tmpi = 1;
                        }
                    }
                }
                $ad_texti .= '</div>';
                if ($ad_tmpi == 1) {
                    $text .= $nav_main;
                    $text .= $ad_texti;
                }
            }
            $render_plugins = FALSE;
            include_once e_HANDLER . 'plugin_class.php';
            $plug = new e107plugin();
            $plugin_array = array();
            // kill php notices
            if ($sql->db_Select('plugin', '*', 'plugin_installflag=1 ORDER BY plugin_path')) {
                while ($row = $sql->db_Fetch()) {
                    if (getperms('P' . $row['plugin_id'])) {
                        if ($plug->parse_plugin($row['plugin_path'])) {
                            $plug_vars = $plug->plug_vars;
                            loadLanFiles($row['plugin_path'], 'admin');
                            if ($plug_vars['administration']['configFile']) {
                                $plug_vars['@attributes']['name'] = $tp->toHTML($plug_vars['@attributes']['name'], FALSE, "defs");
                                $icon_src = (isset($plug_vars['plugin_php']) ? e_PLUGIN_ABS : e_PLUGIN_ABS . $row['plugin_path'] . '/') . $plug_vars['administration']['iconSmall'];
                                $plugin_icon = $plug_vars['administration']['iconSmall'] ? "<img src='{$icon_src}' alt='" . $plug_vars['administration']['caption'] . "' class='icon S16' />" : E_16_PLUGIN;
                                $plugin_array[ucfirst($plug_vars['@attributes']['name'])] = adnav_main($plug_vars['@attributes']['name'], e_PLUGIN . $row['plugin_path'] . "/" . $plug_vars['administration']['configFile'], $plugin_icon);
                            }
                            $render_plugins = TRUE;
                            $active_plugs = TRUE;
                        }
                    }
                }
                ksort($plugin_array, SORT_STRING);
                $plugs_text = '';
                foreach ($plugin_array as $plugin_compile) {
                    $plugs_text .= $plugin_compile;
                }
            }
            /*
            			if (getperms('Z'))
            			{
            				$pclass_extended = $active_plugs ? 'header' : '';
            				$plugin_text = adnav_main(ADLAN_98, e_ADMIN.'plugin.php', E_16_PLUGMANAGER, FALSE, $pclass_extended);
            				$render_plugins = TRUE;
            			}*/
            if ($render_plugins) {
                $text .= adnav_cat(ADLAN_CL_7, '', E_16_CAT_PLUG, 'plugMenu');
                $text .= "<div id='plugMenu' class='menu' onmouseover=\"menuMouseover(event)\">";
                $text .= varset($plugin_text) . varset($plugs_text);
                $text .= "</div>";
            }
            // Render the "About" Menu - Phpinfo, Credits and Docs.
            $text .= adnav_cat(ADLAN_CL_20, '', E_16_CAT_ABOUT, $admin_cat['id'][20]);
            //E_16_NAV_DOCS
            $text .= "<div id='" . $admin_cat['id'][20] . "' class='menu' onmouseover=\"menuMouseover(event)\">";
            foreach ($ad_links_array as $key => $nav_extract) {
                $text .= $nav_extract[4] == 20 ? adnav_main($nav_extract[1], $nav_extract[0], $nav_extract[5]) : "";
            }
            // if (!is_readable(e_DOCS.e_LANGUAGE."/")) // warning killed
            // {
            // $handle=opendir(e_DOCS.'English/');
            // }
            // $i=1;
            // if(varset($handle))
            // {
            // while ($file = readdir($handle))
            // {
            // if ($file != '.' && $file != '..' && $file != 'CVS')
            // {
            // $text .= adnav_main(str_replace('_', ' ', $file), e_ADMIN_ABS.'docs.php?'.$i, E_16_DOCS);
            // $i++;
            // }
            // }
            // closedir($handle);
            // }
            $text .= '</div>';
            $text .= '</div>
			</td>';
            if (varset($exit) != 'off') {
                $text .= "<td style='width: 160px; white-space: nowrap'>\n\t\t\t\t<div class='menuBar' style='width: 100%'>";
                $text .= adnav_cat(ADLAN_53, e_HTTP . 'index.php', E_16_NAV_LEAV);
                $text .= adnav_cat(ADLAN_46, e_ADMIN_ABS . 'admin.php?logout', E_16_NAV_LGOT);
                $text .= '</div>
				</td>';
            }
            $text .= '</tr>
			</table>
			</div>';
            return $text;
        }
    }
Example #2
0
    }
    return $text;
}
function render_clean()
{
    global $td;
    $text = "";
    while ($td <= ADLINK_COLS) {
        $text .= "<td class='td' style='width:20%;'></td>";
        $td++;
    }
    $text .= "</tr>";
    $td = 1;
    return $text;
}
$newarray = asortbyindex($array_functions, 1);
$array_functions_assoc = convert_core_icons($newarray);
function convert_core_icons($newarray)
{
    foreach ($newarray as $key => $val) {
        if (varset($val[0])) {
            $key = "e-" . basename($val[0], ".php");
            $val['icon'] = $val[5];
            $val['icon_32'] = $val[6];
            $val['title'] = $val[1];
            $val['link'] = $val[0];
            $val['caption'] = $val['2'];
            $val['perms'] = $val['3'];
            $array_functions_assoc[$key] = $val;
        }
    }
Example #3
0
 function adminLinks($mode = false)
 {
     if ($mode == 'plugin') {
         return $this->pluginLinks(E_16_PLUGMANAGER, "array");
     }
     $this->setIconArray();
     if ($mode == 'sub') {
         //FIXME  array structure suitable for e_admin_menu - see shortcodes/admin_navigation.php
         /*
          * Info about sublinks array structure
          *
          * key = $array_functions key
          * attribute 1 = link
          * attribute 2 = title
          * attribute 3 = description
          * attribute 4 = perms
          * attribute 5 = category
          * attribute 6 = 16 x 16 image
          * attribute 7 = 32 x 32 image
          *
          */
         $array_sub_functions = array();
         $array_sub_functions[17][] = array(e_ADMIN . 'newspost.php', LAN_MANAGE, ADLAN_3, 'H', 3, E_16_MANAGE, E_32_MANAGE);
         $array_sub_functions[17][] = array(e_ADMIN . 'newspost.php?create', LAN_CREATE, ADLAN_2, 'H', 3, E_16_CREATE, E_32_CREATE);
         $array_sub_functions[17][] = array(e_ADMIN . 'newspost.php?pref', LAN_PREFS, LAN_PREFS, 'H', 3, E_16_SETTINGS, E_32_SETTINGS);
         return $array_sub_functions;
     }
     //FIXME array structure suitable for e_admin_menu (NOW admin() below) - see shortcodes/admin_navigation.php
     //TODO find out where is used $array_functions elsewhere, refactor it
     //XXX DO NOT EDIT without first checking perms in user_handler.php !!!!
     $array_functions = array(0 => array(e_ADMIN_ABS . 'administrator.php', ADLAN_8, ADLAN_9, '3', 2, E_16_ADMIN, E_32_ADMIN), 1 => array(e_ADMIN_ABS . 'updateadmin.php', ADLAN_10, ADLAN_11, '', 2, E_16_ADPASS, E_32_ADPASS), 2 => array(e_ADMIN_ABS . 'banlist.php', ADLAN_34, ADLAN_35, '4', 2, E_16_BANLIST, E_32_BANLIST), 4 => array(e_ADMIN_ABS . 'cache.php', ADLAN_74, ADLAN_75, 'C', 1, E_16_CACHE, E_32_CACHE), 5 => array(e_ADMIN_ABS . 'cpage.php', ADLAN_42, ADLAN_43, '5|J', 3, E_16_CUST, E_32_CUST), 6 => array(e_ADMIN_ABS . 'db.php', ADLAN_44, ADLAN_45, '0', 4, E_16_DATAB, E_32_DATAB), 8 => array(e_ADMIN_ABS . 'emoticon.php', ADLAN_58, ADLAN_59, 'F', 1, E_16_EMOTE, E_32_EMOTE), 10 => array(e_ADMIN_ABS . 'frontpage.php', ADLAN_60, ADLAN_61, 'G', 1, E_16_FRONT, E_32_FRONT), 11 => array(e_ADMIN_ABS . 'image.php', LAN_MEDIAMANAGER, LAN_MEDIAMANAGER, 'A', 5, E_16_IMAGES, E_32_IMAGES), 12 => array(e_ADMIN_ABS . 'links.php', ADLAN_138, ADLAN_139, 'I', 1, E_16_LINKS, E_32_LINKS), 13 => array(e_ADMIN_ABS . 'wmessage.php', ADLAN_28, ADLAN_29, 'M', 3, E_16_WELCOME, E_32_WELCOME), 14 => array(e_ADMIN_ABS . 'ugflag.php', ADLAN_40, ADLAN_41, '9', 4, E_16_MAINTAIN, E_32_MAINTAIN), 15 => array(e_ADMIN_ABS . 'menus.php', ADLAN_6, ADLAN_7, '2', 5, E_16_MENUS, E_32_MENUS), 16 => array(e_ADMIN_ABS . 'meta.php', ADLAN_66, ADLAN_67, 'T', 1, E_16_META, E_32_META), 17 => array(e_ADMIN_ABS . 'newspost.php', ADLAN_0, ADLAN_1, 'H|N|7|H0|H1|H2|H3|H4|H5', 3, E_16_NEWS, E_32_NEWS), 18 => array(e_ADMIN_ABS . 'phpinfo.php', ADLAN_68, ADLAN_69, '0', 20, E_16_PHP, E_32_PHP), 19 => array(e_ADMIN_ABS . 'prefs.php', LAN_PREFS, ADLAN_5, '1', 1, E_16_PREFS, E_32_PREFS), 20 => array(e_ADMIN_ABS . 'search.php', LAN_SEARCH, ADLAN_143, 'X', 1, E_16_SEARCH, E_32_SEARCH), 21 => array(e_ADMIN_ABS . 'admin_log.php', ADLAN_155, ADLAN_156, 'S', 4, E_16_ADMINLOG, E_32_ADMINLOG), 22 => array(e_ADMIN_ABS . 'theme.php', ADLAN_140, ADLAN_141, '1', 5, E_16_THEMEMANAGER, E_32_THEMEMANAGER), 23 => array(e_ADMIN_ABS . 'upload.php', ADLAN_72, ADLAN_73, 'V', 3, E_16_UPLOADS, E_32_UPLOADS), 24 => array(e_ADMIN_ABS . 'users.php', ADLAN_36, ADLAN_37, '4|U0|U1|U2|U3', 2, E_16_USER, E_32_USER), 25 => array(e_ADMIN_ABS . 'userclass2.php', ADLAN_38, ADLAN_39, '4', 2, E_16_USERCLASS, E_32_USERCLASS), 26 => array(e_ADMIN_ABS . 'language.php', ADLAN_132, ADLAN_133, 'L', 1, E_16_LANGUAGE, E_32_LANGUAGE), 27 => array(e_ADMIN_ABS . 'mailout.php', ADLAN_136, ADLAN_137, 'W', 2, E_16_MAIL, E_32_MAIL), 28 => array(e_ADMIN_ABS . 'users_extended.php', ADLAN_78, ADLAN_79, '4', 2, E_16_USER_EXTENDED, E_32_USER_EXTENDED), 29 => array(e_ADMIN_ABS . 'fileinspector.php', ADLAN_147, ADLAN_148, 'Y', 4, E_16_INSPECT, E_32_INSPECT), 30 => array(e_ADMIN_ABS . 'notify.php', ADLAN_149, ADLAN_150, 'O', 4, E_16_NOTIFY, E_32_NOTIFY), 31 => array(e_ADMIN_ABS . 'cron.php', ADLAN_157, ADLAN_158, 'U', 4, E_16_CRON, E_32_CRON), 32 => array(e_ADMIN_ABS . 'eurl.php', ADLAN_159, ADLAN_160, 'K', 1, E_16_EURL, E_32_EURL), 33 => array(e_ADMIN_ABS . 'plugin.php', ADLAN_98, ADLAN_99, 'Z', 5, E_16_PLUGMANAGER, E_32_PLUGMANAGER), 34 => array(e_ADMIN_ABS . 'docs.php', ADLAN_12, ADLAN_13, '', 20, E_16_DOCS, E_32_DOCS), 36 => array(e_ADMIN_ABS . 'credits.php', LAN_CREDITS, LAN_CREDITS, '', 20, E_16_E107, E_32_E107), 38 => array(e_ADMIN_ABS . 'comment.php', LAN_COMMENTMAN, LAN_COMMENTMAN, 'B', 5, E_16_COMMENT, E_32_COMMENT));
     if ($mode == 'legacy') {
         return $array_functions;
         // Old BC format.
     }
     $newarray = asortbyindex($array_functions, 1);
     $array_functions_assoc = $this->convert_core_icons($newarray);
     if ($mode == 'core') {
         return $array_functions_assoc;
     }
     $merged = array_merge($array_functions_assoc, $this->pluginLinks(E_16_PLUGMANAGER, "array"));
     $sorted = multiarray_sort($merged, 'title');
     // this deleted the e-xxxx and p-xxxxx keys.
     return $this->restoreKeys($sorted);
     // we restore the keys with this.
 }