예제 #1
0
    function display_links($module, $submod, $pages)
    {
        $MMCApp =& MMCApp::getInstance();
        $moduleObj = $MMCApp->getModule($module);
        if ($moduleObj) {
            $submodObj = $moduleObj->getSubmod($submod);
            if ($submodObj) {
                $submodPages = $submodObj->getPages();
                $hasPages = false;
                $links = "<ul>";
                foreach ($pages as $page) {
                    if (isset($submodPages[$page])) {
                        $pageObj = $submodPages[$page];
                        if ($pageObj->hasAccess($moduleObj, $submodObj)) {
                            $links .= '<li><a href="' . urlStrRedirect("{$module}/{$submod}/{$page}") . '">' . $pageObj->getDescription() . '</a></li>';
                            $hasPages = true;
                        }
                    }
                }
                $links .= "</ul>";
                if ($hasPages) {
                    echo <<<SUBPANEL
                    <div class="subpanel">
                        <h4>{$submodObj->getDescription()}</h4>
                        {$links}
                    </div>
SUBPANEL;
                }
            }
        }
    }
예제 #2
0
파일: favorites.php 프로젝트: neoclust/mmc
function showFav($sort_a) {

$MMCApp =& MMCApp::getInstance();


foreach(getSorted($MMCApp->getModules()) as $mkey => $mod) {
    if (!$sort_a[$mod->getName()]) {
        continue;
    }
    if ($mod->getName()==$_GET['lmodule']) {
        $style="_select";
    } else {
        $style="";
    }
    print "<div class=\"modulefav$style\"><h3>".$mod->getDescription()."</h3>";
    foreach($sort_a[$mod->getName()] as $key => $al) {
        $submod = $mod->getSubmod($key);
        if ($mod->getName()==$_GET['lmodule']) {
            if ($submod->getName()==$_GET['lsubmod']) {
                $style="_sselect";
            } else {
                $style="_select";
            }
        } else {
            $style="";
        }


        print "<div class=\"submodfav$style\"><h4>".$submod->getDescription()."</h4>";
        foreach($al as $akey => $value) {
            $uri = $mod->getName().'/'.$key.'/'.$akey;

            $getrecop = $_GET;
            $getrecop['fav_action']='del';

            $getrecop['uri']=$uri;
            ?> <span class="redbutton"><a href="#" onClick="new Ajax.Updater('__popup_container','<?php echo  urlStr('base/main/favorites',$getrecop); ?>'); return false">X</a></span> <?



            $page = getPage($uri);
            if ($page) {
                print '<a href="'.urlStr($uri).'">'.$page->getDescription().'</a>';
            } else {
                print $uri;
            }
            ?>
            <br/>

        <?
        }
    print '</div>';
    }
    print '</div>';
}
}
예제 #3
0
 function display_content()
 {
     $MMCApp =& MMCApp::getInstance();
     $errors = '';
     foreach ($this->data as $module => $services_infos) {
         $moduleObj = $MMCApp->getModule($module);
         if ($errors) {
             $errors .= "<br/>";
         }
         $errors .= '<strong>' . $moduleObj->getDescription() . ' : <a class="error" href="' . urlStrRedirect('services/control/index') . '">' . sprintf(dngettext("services", "%d inactive service", "%d inactive services", count($services_infos)), count($services_infos)) . '</a></strong>';
     }
     if ($errors) {
         echo '<p class="alert alert-error">' . $errors . '</p>';
     } else {
         echo '<p class="alert alert-success"><img src="img/common/icn_yes.gif" style="vertical-align: bottom" /> ' . _T("All services are up", "services") . '</p>';
     }
 }
예제 #4
0
 function __construct($moduleName, $pageName)
 {
     /* Add the configuration page in the sidebar */
     self::$instances[] = $this;
     global $sidemenu;
     $sidemenu->addSideMenuItem(new SideMenuItem(_($moduleName . " configuration"), "admin", "configure", $pageName, "modules/admin/graph/img/config/icn_global.gif", "modules/admin/graph/img/config/icn_global_active.gif"));
     /* Set the pages attributes, create an empty form, etc */
     $this->name = $pageName;
     $this->setSideMenu($sidemenu);
     $this->PageGenerator($moduleName);
     $this->form = new ValidatingForm();
     /*  */
     $MMCApp =& MMCApp::getInstance();
     $adminModule = $MMCApp->getModule('admin');
     $subModule = $adminModule->getSubmod('configure');
     $subModule->addPage(new Page($pageName, _($moduleName . ' configuration page')));
 }
예제 #5
0
/**
 * module declaration
 */
$mod = new Module("proxy");
$mod->setVersion("2.5.1");
$mod->setRevision('$Rev$');
$mod->setDescription(_T("Web proxy"), "proxy");
$mod->setAPIVersion('1:1:0');
/**
 * user submod definition
 */
$submod = new SubModule("blacklist");
$submod->setDescription(_T("Proxy", "proxy"));
$submod->setImg('modules/proxy/graph/navbar/proxy');
$submod->setDefaultPage("proxy/blacklist/statut");
$submod->setPriority(300);
$page = new Page("index", _T("Blacklist", "proxy"));
$submod->addPage($page);
$page = new Page("delete", _T("Remove a domain in the blacklist", "proxy"));
$page->setOptions(array("noHeader" => True, "visible" => False));
$submod->addPage($page);
$page = new Page("add", _T("Add a domain in the blacklist", "proxy"));
$submod->addPage($page);
$page = new Page("restart", _T("Restart proxy web service", "proxy"));
$page->setOptions(array("visible" => False));
$submod->addPage($page);
$page = new Page("statut", _T("Proxy status page", "proxy"));
$submod->addPage($page);
$mod->addSubmod($submod);
$MMCApp =& MMCApp::getInstance();
$MMCApp->addModule($mod);
예제 #6
0
파일: editacl.php 프로젝트: sebastiendu/mmc
function createRedirectAclTemplate($module_name, $acl, $acltab, $form)
{
    global $descArray;
    global $redirArray;
    global $tabDescArray;
    global $tabAclArray;
    $key = $module_name;
    $value = $redirArray[$module_name];
    $MMCApp =& MMCApp::getInstance();
    $base =& $MMCApp->getModule($module_name);
    $form->add(new TitleElement(_($base->getDescription()) . " " . sprintf(_(" (%s module)"), $module_name)));
    foreach ($value as $subkey => $subvalue) {
        $rowNum = 1;
        $submod =& $base->getSubmod($subkey);
        $form->add(new TitleElement(_($submod->getDescription()), 3));
        if (sizeof($subvalue) > 1) {
            $form->add(new SelectElement("acl[" . $module_name . "][" . $subkey . "]", "acltab[" . $module_name . "][" . $subkey . "]"));
        }
        $form->push(new Table());
        $form->add(new TrTitleElement(array(0 => _("Web page description"), 1 => _("Authorization"))));
        foreach ($subvalue as $actionkey => $actionvalue) {
            if ($descArray[$key][$subkey][$actionkey]) {
                if (isset($acl[$key][$subkey][$actionkey]["right"]) && $acl[$key][$subkey][$actionkey]["right"] == 'on') {
                    $form->add(new TrAclFormElement(_($descArray[$key][$subkey][$actionkey]), new CheckboxTpl("acl[" . $key . "][" . $subkey . "][" . $actionkey . "][right]"), $rowNum, array("value" => "checked")));
                } else {
                    $form->add(new TrAclFormElement(_($descArray[$key][$subkey][$actionkey]), new CheckboxTpl("acl[" . $key . "][" . $subkey . "][" . $actionkey . "][right]"), $rowNum, array("value" => "")));
                }
            } else {
                print _("Warning no desc found in infoPackage.inc.php :") . $actionkey;
            }
            $rowNum++;
            if (isset($tabAclArray[$key][$subkey][$actionkey])) {
                foreach ($tabAclArray[$key][$subkey][$actionkey] as $tabkey => $tabvalue) {
                    if ($acltab[$key][$subkey][$actionkey][$tabkey]["right"] == 'on') {
                        $t = new TrAclFormElement(_($tabDescArray[$key][$subkey][$actionkey][$tabkey]), new CheckboxTpl("acltab[" . $key . "][" . $subkey . "][" . $actionkey . "][" . $tabkey . "][right]"), $rowNum);
                        $t->setTab();
                        $form->add($t, array("value" => "checked"));
                    } else {
                        $t = new TrAclFormElement(_($tabDescArray[$key][$subkey][$actionkey][$tabkey]), new CheckboxTpl("acltab[" . $key . "][" . $subkey . "][" . $actionkey . "][" . $tabkey . "][right]"), $rowNum);
                        $t->setTab();
                        $form->add($t, array("value" => ""));
                    }
                    $rowNum++;
                }
            }
        }
        $form->pop();
    }
}
예제 #7
0
 /**
  * this function provide compatibility with old ACL,
  * infoPackage.inc.php system
  * generate css for all subproc
  */
 function process($module)
 {
     foreach ($this->_pages as $page) {
         $page->process($module, $this->getName());
     }
     $MMC =& MMCApp::getInstance();
     if (empty($_GET['submod'])) {
         $selected = False;
     } else {
         $selected = $_GET['submod'] == $this->getName();
     }
     if ($this->_visibility != True && $selected) {
         if ($this->_alias != Null) {
             $tmp = $_GET["submod"];
             $_GET["submod"] = $this->_alias;
             //fake url
             $parent =& $MMC->getModule($this->_parentname);
             $submod =& $parent->getSubmod($this->_alias);
             $submod->process($module);
             $_GET["submod"] = $tmp;
             return;
         }
     }
     if ($this->_img != Null) {
         if (!$selected) {
             $css = '#navbar ul li#navbar' . $this->getName() . ' {
                 width: ' . $this->_imgsize . 'px;
             }
             #navbar ul li#navbar' . $this->getName() . ' a {
                 background: url("' . $this->_img . '.png") no-repeat transparent;
                 background-position: 50% 10px;
             }
             #navbar ul li#navbar' . $this->getName() . ' a:hover {
                 background: url("' . $this->_img . '_hl.png") no-repeat transparent;
                 background-position: 50% 10px;
             }';
         } else {
             $css = '#navbar ul li#navbar' . $this->getName() . ' {
                 width: ' . $this->_imgsize . 'px;
             }
             #navbar ul li#navbar' . $this->getName() . ' a {
                 background: url("' . $this->_img . '_select.png") no-repeat white;
                 border-left: 1px solid #B2B2B2;
                 border-right: 1px solid #B2B2B2;
                 color: #EE5010;
                 background-position: 50% 8px;
             }';
         }
         $style =& $MMC->getStyle();
         $style->addCSS($css);
     }
 }
예제 #8
0
/**
 * @param $modules modules like base or samba
 * @param $submod sub modules like "users"
 * @param $action action like index or add
 * @return if action require noheader send
 */
function isNoHeader($pModules, $pSubmod, $pAction)
{
    $MMCApp =& MMCApp::getInstance();
    $mod = $MMCApp->getModule($pModules);
    $submodo = $mod->_submod[$pSubmod];
    $actiono = $submodo->_pages[$pAction];
    return $actiono->_options["noHeader"] || $actiono->_options["AJAX"];
}
예제 #9
0
파일: acl.inc.php 프로젝트: sebastiendu/mmc
function getDefaultPage()
{
    if ($_SESSION["login"] == "root") {
        $url = urlStrRedirect("base/main/default");
    } elseif (hasCorrectAcl('dashboard', 'main', 'default')) {
        $url = urlStrRedirect("dashboard/main/default");
    } else {
        $MMCApp =& MMCApp::getInstance();
        # get first page in acl list which is not a popup
        if (isset($_SESSION["acl"])) {
            foreach ($_SESSION["acl"] as $module => $modinfo) {
                foreach ($modinfo as $submod => $submodinfo) {
                    foreach ($submodinfo as $page => $pageinfo) {
                        # check page is not a popup
                        if (isset($MMCApp->_modules[$module]->_submod[$submod]->_pages[$page]) && $MMCApp->_modules[$module]->_submod[$submod]->_pages[$page]->_options['noHeader'] != 1 && $MMCApp->_modules[$module]->_submod[$submod]->_pages[$page]->_options['AJAX'] != true) {
                            # get url
                            $url = urlStrRedirect("{$module}/{$submod}/{$page}");
                            # stop foreach loops
                            break 3;
                        }
                    }
                }
            }
        }
    }
    if (!isset($url)) {
        return "index.php?error=" . urlencode(_("You do not have required rights"));
    }
    return $url;
}