コード例 #1
0
ファイル: search.php プロジェクト: davidmottet/automne
$search = sensitiveIO::sanitizeJSString(sensitiveIO::request('search'));
if (!$winId) {
    CMS_grandFather::raiseError('Unknown window Id ...');
    $view->show();
}
//usefull vars
$recordsPerPage = CMS_session::getRecordsPerPage();
//
// Search Panel
//
$searchPanel = '';
// Keywords
$searchPanel .= "{\n\tfieldLabel:\t\t'" . $cms_language->getJsMessage(MESSAGE_PAGE_FIELD_NAME) . "',\n\txtype:\t\t\t'textfield',\n\tname: \t\t\t'keyword',\n\tvalue:\t\t\t'{$search}',\n\tminLength:\t\t3,\n\tanchor:\t\t\t'-20px',\n\tvalidateOnBlur:\tfalse,\n\tlisteners:\t\t{'valid':{\n\t\tfn: \t\t\tsearchWindow.search, \n\t\toptions:\t\t{buffer:300}\n\t}}\n},";
//Modules
$elements = $checkedElements = array();
$modules = CMS_modulesCatalog::getALL();
$modulesPanels = '';
//MODULE STANDARD
if (isset($modules[MOD_STANDARD_CODENAME]) && $cms_user->hasModuleClearance(MOD_STANDARD_CODENAME, CLEARANCE_MODULE_EDIT)) {
    $elements[MOD_STANDARD_CODENAME] = $cms_language->getMessage(MESSAGE_PAGE_PAGES);
    $checkedElements[MOD_STANDARD_CODENAME] = true;
}
//OTHER MODULES ADMINISTRATIONS
foreach ($modules as $module) {
    if ($module->getCodename() != MOD_STANDARD_CODENAME && $cms_user->hasModuleClearance($module->getCodename(), CLEARANCE_MODULE_EDIT) && method_exists($module, 'search')) {
        $modLabel = sensitiveIO::sanitizeJSString($module->getLabel($cms_language));
        $elements[$module->getCodename()] = $modLabel;
        $checkedElements[$module->getCodename()] = true;
    }
}
//users is available by everyones
コード例 #2
0
ファイル: dialog.php プロジェクト: davidmottet/automne
 /**
  * Displays Admin frameset
  *
  * @return void
  * @access public
  */
 function showFrames()
 {
     if (!$this->_context->getSessionVar('largeur')) {
         $this->_context->setSessionVar('largeur', '200');
     }
     if (!$this->_context->getSessionVar('hauteurArbo') && $this->_context->getSessionVar('hauteurArbo') != '0') {
         $this->_context->setSessionVar('hauteurArbo', '*');
     }
     if (!$this->_context->getSessionVar('treeHref') && $this->_context->getSessionVar('hauteurArbo') != '0') {
         $user = $this->_context->getUser();
         //THE USER SECTIONS, Check if user has module administration, else hide Modules Frame
         $sections_roots = array();
         $sections_roots = $user->getEditablePageClearanceRoots();
         if (is_array($sections_roots) && $sections_roots) {
             $this->_context->setSessionVar('sectionsRoots', $sections_roots);
             $root = '9999999';
             $count = '0';
             foreach ($sections_roots as $rootID) {
                 $pg = CMS_tree::getPageByID($rootID);
                 if ($pg && !$pg->hasError()) {
                     $root = $rootID < $root ? $rootID : $root;
                 }
             }
             //build tree link
             $treeHref = PATH_ADMIN_SPECIAL_TREE_WR;
             $treeHref .= '?root=' . $root;
             $treeHref .= '&frame=1';
             $treeHref .= '&encodedPageLink=' . base64_encode(PATH_ADMIN_SPECIAL_PAGE_SUMMARY_WR . chr(167) . chr(167) . 'page=%s');
             $this->_context->setSessionVar('treeHref', $treeHref);
         } else {
             $treeHref = '';
             $this->_context->setSessionVar('hauteurArbo', '0');
         }
     }
     if (!$this->_context->getSessionVar('hauteurModules') && $this->_context->getSessionVar('hauteurModules') != '0') {
         $this->_context->setSessionVar('hauteurModules', '200');
         $user = $this->_context->getUser();
         //THE MODULES ADMINISTRATIONS, Check if user has module administration, else hide Modules Frame
         $modules = CMS_modulesCatalog::getALL();
         $modules_good = array();
         foreach ($modules as $module) {
             if ($module->getCodename() != MOD_STANDARD_CODENAME && $user->hasModuleClearance($module->getCodename(), CLEARANCE_MODULE_EDIT)) {
                 $modules_good[] = $module;
             }
         }
         if (!$modules_good) {
             $this->_context->setSessionVar('hauteurModules', '0');
         }
     }
     if ($this->_context->getSessionVar('hauteurArbo') == '0' && $this->_context->getSessionVar('hauteurModules') == '0') {
         //current user have not any admin rights so logout !
         header("Location: " . PATH_ADMIN_SPECIAL_LOGIN_WR . "?cms_message_id=65&cms_action=logout&" . session_name() . "=" . session_id());
         exit;
     }
     $main = $this->_mainFrame ? $this->_mainFrame : PATH_ADMIN_SPECIAL_ENTRY_WR;
     if (VIEW_SQL && STATS_DEBUG && SYSTEM_DEBUG) {
         $this->_context->setSessionVar('hauteurFrameChecker', '50');
     } else {
         $this->_context->setSessionVar('hauteurFrameChecker', '0');
     }
     $frameset = "\n\t\t\t<SCRIPT type=text/javascript>\n\t\t\t<!--\n\t\t\t    document.writeln('<frameset cols=\"" . $this->_context->getSessionVar('largeur') . ",*\" rows=\"*\" border=\"1\" frameborder=\"1\" framespacing=\"0\">');\n\t\t\t    document.writeln('    <frameset rows=\"" . $this->_context->getSessionVar('hauteurArbo') . ", " . $this->_context->getSessionVar('hauteurModules') . "," . $this->_context->getSessionVar('hauteurFrameChecker') . "\" framespacing=\"0\" frameborder=\"0\" border=\"0\">');\n\t\t\t    document.writeln('        <frame src=\"" . $this->_context->getSessionVar('treeHref') . "\" name=\"arbo\" border=\"1\" frameborder=\"1\" />');\n\t\t\t    document.writeln('        <frame src=\"modules.php\" name=\"modules\" border=\"1\" frameborder=\"1\" />');\n\t\t\t\tdocument.writeln('        <frame src=\"frameChecker.php\" name=\"frameChecker\" frameborder=\"0\" scrolling=\"no\" />');\n\t\t\t    document.writeln('    </frameset>');\n\t\t\t\tdocument.writeln('    <frameset rows=\"72, *\" framespacing=\"0\" frameborder=\"0\" border=\"0\">');\n\t\t\t    document.writeln('        <frame src=\"menu.php\" name=\"menu\" frameborder=\"0\" scrolling=\"no\" />');\n\t\t\t    document.writeln('        <frame src=\"" . $main . "\" name=\"main\" border=\"0\" frameborder=\"0\" />');\n\t\t\t    document.writeln('    </frameset>');\n\t\t\t    document.writeln('    <noframes>');\n\t\t\t    document.writeln('        <body bgcolor=\"#FFFFFF\">');\n\t\t\t    document.writeln('            <p>L\\'utilisation d\\'Automne nécéssite un navigateur <b>supportant les \"frames\"</b>.</p>');\n\t\t\t    document.writeln('            <p>The use of Automne requires a navigator <b>supporting frames</b>.</p>');\n\t\t\t    document.writeln('        </body>');\n\t\t\t    document.writeln('    </noframes>');\n\t\t\t    document.writeln('</frameset>');\n\t\t\t//-->\n\t\t\t</SCRIPT>";
     return $frameset;
 }