示例#1
0
function multi_array_key_exists($needle, $haystack)
{
    foreach ($haystack as $key => $value) {
        if ($needle == $key) {
            return $key;
        }
        if (is_array($value)) {
            if (multi_array_key_exists($needle, $value) == true) {
                return true;
            } else {
                continue;
            }
        }
    }
    return false;
}
示例#2
0
 function cs_position($position)
 {
     $widgets = $this->widgets;
     $position_active = multi_array_key_exists($position, $widgets);
     if (isset($widgets) && $position_active && $this->cs_position_active($position)) {
         $this->output('<div id="' . str_replace(' ', '-', strtolower($position)) . '-position">');
         foreach ($widgets as $w) {
             if ($w['position'] == $position && isset($w['param']['locations'][$this->template]) && (bool) $w['param']['locations'][$this->template]) {
                 $this->current_widget = $w;
                 $this->cs_get_widget($w['name'], @$w['param']['locations']['show_title'], $position);
             }
         }
         $this->output('</div>');
     }
 }
示例#3
0
function treeNavToSideMenu($treeNav, $idCurrent)
{
    $res = '';
    $res .= '<ul>';
    foreach ($treeNav as $id => $content) {
        $current = '';
        if ($idCurrent == $id) {
            $current = 'current';
        }
        $plus = 'direct';
        if ($content['child'] != null) {
            $plus = 'plus';
        }
        if ($content['child'] != null && (multi_array_key_exists($idCurrent, $content['child']) !== false || $idCurrent == $id)) {
            $state = 'open';
        } else {
            $state = 'closed';
        }
        $res .= '<li class="' . $state . ' ' . $current . ' ' . $plus . '"><a href="' . site_url($content['url']) . '">' . htmlspecialchars($content['title']) . '</a>';
        if ($content['child'] != null) {
            $res .= treeNavToSideMenu($content['child'], $idCurrent);
        }
        $res .= '</li>';
    }
    $res .= '</ul>';
    return $res;
}
} else {
    //	include menu file
    $the_file = AC_DIR_ADMIN . "admin-menu.inc.php";
    if (!file_exists($the_file)) {
        die("<b>" . $the_file . "</b> not found");
    } else {
        require_once $the_file;
    }
    //	define condition for users
    $sql_condition = "";
    if ($_SESSION["admin_level"] > 1) {
        $sql_condition = " AND b.id_user="******"admin_id"];
    }
    //echo $sql_condition; die;
    //	check user is allowed to see this page
    if (!multi_array_key_exists($_REQUEST["page"], $menu[$_SESSION["admin_level"]])) {
        $the_file = AC_DIR_ADMIN . "forbidden.admin.php";
    } else {
        $the_file = AC_DIR_ADMIN . ADMIN_PAGE . ".admin.php";
    }
    //	now inlcude the page defined
    if (!file_exists($the_file)) {
        die("<b>" . $the_file . "</b> not found");
    } else {
        require_once $the_file;
    }
    $this_title = '
	<div id="title">
		<div class="float_l" ><h1>>> ' . $page_title . ' ' . $page_title_add . '</h1></div>
		<div class="float_r">' . $bt_add . '</div>
		<div class="clear"></div>