示例#1
0
        }
    }
}
//If we must limit to some specific items (usually used during refresh of some listing elements)
if ($limitToItems) {
    $search->addWhereCondition("items", $limitToItems);
} elseif ($limitToOrderedItems) {
    //If we must limit to some specific items ordered (usually used for polymod multi_poly_object field)
    $search->addWhereCondition("itemsOrdered", $limitToOrderedItems);
} else {
    // Params : paginate limit
    $search->setAttribute('itemsPerPage', $limit);
    $search->setAttribute('page', $start / $limit);
    // Params : set default direction direction
    if (!CMS_session::getSessionVar('direction_' . $object->getID())) {
        CMS_session::setSessionVar('direction_' . $object->getID(), 'desc');
    }
    // Params : order
    if (CMS_session::getSessionVar('sort_' . $object->getID())) {
        $search->addOrderCondition(CMS_session::getSessionVar('sort_' . $object->getID()), CMS_session::getSessionVar('direction_' . $object->getID()));
    } else {
        $search->addOrderCondition('objectID', CMS_session::getSessionVar('direction_' . $object->getID()));
    }
}
//launch search
$search->search(CMS_object_search::POLYMOD_SEARCH_RETURN_INDIVIDUALS_OBJECTS);
// Vars for lists output purpose and pages display, see further
$itemsDatas['total'] = $search->getNumRows();
//Get parsed result definition
if ($resultsDefinition) {
    $definitionParsing = new CMS_polymod_definition_parsing($resultsDefinition, true, CMS_polymod_definition_parsing::PARSE_MODE);
示例#2
0
    /**
     * Returns XHTML formatted form fields for this Href
     * 
     * @param CMS_language $cms_language, the language to build the form with
     * @param string $module, the module codename (default : MOD_STANDARD_CODENAME)
     * @param constant $dataLocation, the current data location (RESOURCE_DATA_LOCATION_EDITED (default), RESOURCE_DATA_LOCATION_PUBLIC, etc.)
     * @param array $options, array of possible link options (default false : all options actived)
     *	Example :
     * Array (
     *     'label' 		=> true|false,				// Link has label ?
     *     'internal' 	=> true|false,				// Link can target an Automne page ?
     *     'external' 	=> true|false,				// Link can target an external resource ?
     *     'file' 		=> true|false,				// Link can target a file ?
     *     'destination'=> true|false,				// Can select a destination for the link ?
     *     'no_admin' 	=> true|false,				// Deprecated : Remove all admin class reference (default = false)
     *     'admin' 		=> true|false,				// Use admin JS and classes instead of direct actions (default = true)
     *     'currentPage'=> int|false,				// Current page to open tree panel (default : CMS_tree::getRoot())
     * )
     * @return string HTML formated expected
     * @access public
     */
    function getHTMLFields($cms_language, $module = MOD_STANDARD_CODENAME, $dataLocation = RESOURCE_DATA_LOCATION_EDITED, $options = false)
    {
        global $cms_user;
        if (!is_a($this->_href, 'CMS_href')) {
            $this->raiseError("\$this->_href isn't a CMS_href");
            return '';
        }
        $tdClass = $tdClassLight = $tdClassDark = $inputClass = '';
        if (!isset($options['no_admin']) || $options['no_admin'] === false) {
            $tdClass = ' class="admin"';
            $tdClassLight = ' class="admin_lightgreybg"';
            $tdClassDark = ' class="admin_darkgreybg"';
            $inputClass = ' class="admin_input_text"';
        }
        $s = '';
        if (!isset($options['destination']) || $options['destination'] == true) {
            $s .= '
			<script type="text/javascript">
				if (typeof CMS_openPopUpPage != "function") {
					function CMS_openPopUpPage(href, id, width, height) {
						if (href != "") {
							pagePopupWin = window.open(href, \'CMS_page_\'+id, \'width=\'+width+\',height=\'+height+\',resizable=yes,menubar=no,toolbar=no,scrollbars=yes,status=no,left=0,top=0\');
						}
					}
				}
			</script>';
        }
        $s .= '
		<table>';
        if (!isset($options['label']) || $options['label'] == true) {
            $s .= '
				<!-- link label -->
				<tr>
					<th' . $tdClass . '><span class="admin_text_alert">*</span> ' . $cms_language->getMessage(self::MESSAGE_PAGE_LINK_LABEL) . '</th>
					<td' . $tdClassLight . ' colspan="2"><input style="width:100%;" type="text"' . $inputClass . ' name="' . $this->_prefix . 'link_label" value="' . io::htmlspecialchars($this->_href->getLabel()) . '" /></td>
				</tr>';
        }
        $checked = $this->_href->getLinkType() == RESOURCE_LINK_TYPE_NONE ? ' checked="checked"' : '';
        $rowspan = 4;
        if (isset($options['internal']) && $options['internal'] == false) {
            $rowspan--;
        }
        if (isset($options['external']) && $options['external'] == false) {
            $rowspan--;
        }
        if (isset($options['file']) && $options['file'] == false) {
            $rowspan--;
        }
        $s .= '
					<tr>
						<th' . $tdClass . ' rowspan="' . $rowspan . '"><span class="admin_text_alert">*</span> ' . $cms_language->getMessage(self::MESSAGE_PAGE_LINK_DESTINATION) . '</th>
						<td' . $tdClassDark . '><input type="radio" id="' . $this->_prefix . 'link_type_0" name="' . $this->_prefix . 'link_type" value="' . RESOURCE_LINK_TYPE_NONE . '"' . $checked . ' /></td>
						<td' . $tdClassDark . '><label for="' . $this->_prefix . 'link_type_0">' . $cms_language->getMessage(self::MESSAGE_PAGE_NOLINK) . '</label></td>
					</tr>
			';
        if (!isset($options['internal']) || $options['internal'] == true) {
            $checked = $this->_href->getLinkType() == RESOURCE_LINK_TYPE_INTERNAL ? ' checked="checked"' : '';
            // Build tree link
            $grand_root = isset($options['currentPage']) && sensitiveIO::isPositiveInteger($options['currentPage']) ? CMS_tree::getPageByID($options['currentPage']) : CMS_tree::getRoot();
            $grand_rootID = $grand_root->getID();
            if ($cms_user && is_a($cms_user, 'CMS_profile_user')) {
                if (!$cms_user->hasPageClearance($grand_rootID, CLEARANCE_PAGE_VIEW)) {
                    // If user don't have any clearance view for page root : search a "first root" and viewable page sections
                    $sections_roots = array();
                    $sections_roots = $cms_user->getViewablePageClearanceRoots();
                    if ($sections_roots) {
                        CMS_session::setSessionVar('sectionsRoots', $sections_roots);
                        $sections_roots = array_reverse($sections_roots);
                        foreach ($sections_roots as $pageID) {
                            $lineages[count(CMS_tree::getLineage($grand_rootID, $pageID, false))] = $pageID;
                        }
                    }
                    ksort($lineages);
                    $grand_rootID = array_shift($lineages);
                }
            }
            if (!isset($options['admin']) || $options['admin'] == false) {
                //build tree link
                $href = '/automne/admin-v3/tree.php';
                $href .= '?root=' . $grand_rootID;
                $href .= '&amp;heading=' . $cms_language->getMessage(self::MESSAGE_PAGE_TREEH1);
                $href .= '&amp;encodedOnClick=' . base64_encode("window.opener.document.getElementById('" . $this->_prefix . "link_internal').value = '%s';self.close();");
                $href .= '&encodedPageLink=' . base64_encode('false');
                $treeLink = '<a href="' . $href . '"' . $tdClass . ' target="_blank"><img src="' . PATH_ADMIN_IMAGES_WR . '/tree.gif" border="0" align="absmiddle" /></a>';
            } else {
                $treeLink = '<a href="#" onclick="Automne.view.tree(\'' . $this->_prefix . 'link_internal\', \'' . sensitiveIO::sanitizeJSString($cms_language->getMessage(self::MESSAGE_PAGE_TREEH1)) . '\', \'' . $grand_rootID . '\')"><img src="' . PATH_ADMIN_IMAGES_WR . '/tree.gif" border="0" align="absmiddle" /></a>';
            }
            $s .= '<tr>
						<td' . $tdClassLight . '><input type="radio" id="' . $this->_prefix . 'link_type_1" name="' . $this->_prefix . 'link_type" value="' . RESOURCE_LINK_TYPE_INTERNAL . '"' . $checked . ' /></td>
						<td' . $tdClassLight . '>
							<label for="' . $this->_prefix . 'link_type_1">' . $cms_language->getMessage(self::MESSAGE_PAGE_INTERNALLINK) . '</label>
							<input type="text"' . $inputClass . ' id="' . $this->_prefix . 'link_internal" name="' . $this->_prefix . 'link_internal" value="' . $this->_href->getInternalLink() . '" size="6" />
							' . $treeLink . '
						</td>
					</tr>';
        }
        if (!isset($options['external']) || $options['external'] == true) {
            $checked = $this->_href->getLinkType() == RESOURCE_LINK_TYPE_EXTERNAL ? ' checked="checked"' : '';
            $s .= '
					<tr>
						<td' . $tdClassDark . '><input type="radio" id="' . $this->_prefix . 'link_type_2" name="' . $this->_prefix . 'link_type" value="' . RESOURCE_LINK_TYPE_EXTERNAL . '"' . $checked . ' /></td>
						<td' . $tdClassDark . '>
							<label for="' . $this->_prefix . 'link_type_2">' . $cms_language->getMessage(self::MESSAGE_PAGE_EXTERNALLINK) . '</label>
							<input type="text"' . $inputClass . ' id="' . $this->_prefix . 'link_external" name="' . $this->_prefix . 'link_external" value="' . io::htmlspecialchars($this->_href->getExternalLink()) . '" size="30" />
						</td>
					</tr>
				';
        }
        if (!isset($options['file']) || $options['file'] == true) {
            $checked = $this->_href->getLinkType() == RESOURCE_LINK_TYPE_FILE ? ' checked="checked"' : '';
            $s .= '
					<tr>
						<td' . $tdClassLight . '><input type="radio" id="' . $this->_prefix . 'link_type_3" name="' . $this->_prefix . 'link_type" value="' . RESOURCE_LINK_TYPE_FILE . '"' . $checked . ' /></td>
						<td' . $tdClassLight . '>
							<label for="' . $this->_prefix . 'link_type_3">' . $cms_language->getMessage(self::MESSAGE_PAGE_LINKFILE) . '</label>
							<input type="file"' . $inputClass . ' name="' . $this->_prefix . 'link_file" /><br />
							<label for="' . $this->_prefix . 'link_edit_linkfile"><input type="checkbox" id="' . $this->_prefix . 'link_edit_linkfile" name="' . $this->_prefix . 'link_edit_linkfile" value="1" /> ' . $cms_language->getMessage(self::MESSAGE_PAGE_FIELD_EDITFILE) . '</label>';
            if ($this->_href->getFileLink(false, $module, $dataLocation)) {
                $s .= '<br />' . $cms_language->getMessage(self::MESSAGE_PAGE_EXISTING_FILE) . ' : <a href="' . $this->_href->getFileLink(true, $module, $dataLocation) . '" target="_blank">' . $this->_href->getFileLink(false, $module, $dataLocation) . '</a>';
            } else {
                $s .= '<br />' . $cms_language->getMessage(self::MESSAGE_PAGE_EXISTING_FILE) . ' : ' . $cms_language->getMessage(self::MESSAGE_PAGE_NO_FILE);
            }
            $s .= '	</td>
					</tr>';
        }
        if (!isset($options['destination']) || $options['destination'] == true) {
            $popup = $this->_href->getPopup();
            $checked_pop = isset($popup['width']) && $popup['width'] > 0 ? ' checked="checked"' : '';
            $checked_top = isset($popup['width']) && $popup['width'] <= 0 && $this->_href->getTarget() == '_top' ? ' checked="checked"' : '';
            $checked_bl = isset($popup['width']) && $popup['width'] <= 0 && $this->_href->getTarget() == '_blank' ? ' checked="checked"' : '';
            if (!$checked_pop && !$checked_top && !$checked_bl) {
                $checked_top = ' checked="checked"';
            }
            $width = isset($popup['width']) ? $popup['width'] : 0;
            $height = isset($popup['height']) ? $popup['height'] : 0;
            $s .= '
					<!-- Link target -->
					<tr>
						<th' . $tdClass . ' rowspan="3">' . $cms_language->getMessage(self::MESSAGE_PAGE_LINK_SHOW) . '</th>
						<td' . $tdClassDark . '><input type="radio" id="' . $this->_prefix . 'link_target_top" name="' . $this->_prefix . 'link_target" value="top"' . $checked_top . ' /></td>
						<td' . $tdClassDark . '>
							<label for="' . $this->_prefix . 'link_target_top"><img src="' . PATH_ADMIN_IMAGES_WR . '/pic_link_top.gif" alt="" border="0" align="absmiddle" />
							' . $cms_language->getMessage(self::MESSAGE_PAGE_TARGET_TOP) . '</label>
						</td>
					</tr>
					<tr>
						<td' . $tdClassLight . '><input type="radio" id="' . $this->_prefix . 'link_target_blank" name="' . $this->_prefix . 'link_target" value="blank"' . $checked_bl . ' /></td>
						<td' . $tdClassLight . '>
							<label for="' . $this->_prefix . 'link_target_blank"><img src="' . PATH_ADMIN_IMAGES_WR . '/pic_link_blank.gif" alt="" border="0" align="absmiddle" />
							' . $cms_language->getMessage(self::MESSAGE_PAGE_TARGET_BLANK) . '</label>
						</td>
					</tr>
					<tr>
						<td' . $tdClassDark . '><input type="radio" id="' . $this->_prefix . 'link_target_popup" name="' . $this->_prefix . 'link_target" value="popup"' . $checked_pop . ' /></td>
						<td' . $tdClassDark . '>
							<label for="' . $this->_prefix . 'link_target_popup"><img src="' . PATH_ADMIN_IMAGES_WR . '/pic_link_top.gif" alt="" border="0" align="absmiddle" />
							' . $cms_language->getMessage(self::MESSAGE_PAGE_TARGET_POPUP) . ' : </label>
							' . $cms_language->getMessage(self::MESSAGE_PAGE_POPUP_WIDTH) . ' <input type="text"' . $inputClass . ' name="' . $this->_prefix . 'link_popup_width" value="' . $width . '" size="3" />
							' . $cms_language->getMessage(self::MESSAGE_PAGE_POPUP_HEIGHT) . ' <input type="text"' . $inputClass . ' name="' . $this->_prefix . 'link_popup_height" value="' . $height . '" size="3" />
						</td>
					</tr>';
        }
        $s .= '</table>';
        return $s;
    }
        if ($errorCorrected && !$cms_message) {
            unset($errors[0]);
        }
        if (!sizeof($errors)) {
            $dialog = new CMS_dialog();
            $content = $cms_language->getMessage(MESSAGE_PAGE_CORRECTION_DONE);
            $dialog->setTitle($cms_language->getMessage(MESSAGE_PAGE_TITLE));
            $dialog->setContent($content);
            $dialog->show();
            exit;
        } else {
            $updateErrors = array();
            foreach ($errors as $anError) {
                $updateErrors[] = $anError;
            }
            CMS_session::setSessionVar('patchErrors', $updateErrors);
        }
        break;
}
$dialog = new CMS_dialog();
$content = '';
$dialog->setTitle($cms_language->getMessage(MESSAGE_PAGE_TITLE));
//correct first error of the array
$errors = CMS_session::getSessionVar('patchErrors');
$error = $errors[0];
//button message
$validate_msg = !is_array($errors[1]) ? MESSAGE_PAGE_RETURN_TO_PATCH : MESSAGE_PAGE_NEXT_ERROR;
switch ($error['no']) {
    case 5:
        //try to update a protected file (UPDATE.DENY)
        $content .= $cms_language->getMessage(MESSAGE_PAGE_ERROR_5_LABEL) . '<br /><br />';
示例#4
0
$cms_block = new CMS_block_polymod();
$cms_block->initializeFromID($blockId, $rowId);
$cms_module = CMS_modulesCatalog::getByCodename(MOD_CMS_FORMS_CODENAME);
// Language
if (isset($_REQUEST["items_language"])) {
    CMS_session::setSessionVar("items_language", $_REQUEST["items_language"]);
} elseif (CMS_session::getSessionVar("items_language") == '') {
    CMS_session::setSessionVar("items_language", $cms_module->getParameters("default_language"));
}
$items_language = new CMS_language(CMS_session::getSessionVar("items_language"));
//
// Get default search options
//
// Get search options from posted datas
if ($_POST["cms_action"] == 'search') {
    CMS_session::setSessionVar("items_ctg", $_POST["items_ctg"]);
}
//Action management
switch ($_POST["cms_action"]) {
    case "validate":
        //checks and assignments
        $cms_message = "";
        $value = array('formID' => $_POST["value"]);
        if (!$cms_block->writeToPersistence($cms_page->getID(), $cs, $rowTag, RESOURCE_LOCATION_EDITION, false, array("value" => $value))) {
            $cms_message .= $cms_language->getMessage(MESSAGE_PAGE_VALIDATE_ERROR) . "\n";
        }
        if (!$cms_message) {
            $cms_message = $cms_language->getMessage(MESSAGE_ACTION_OPERATION_DONE);
            //grab block content
            $data = $cms_block->getRawData($cms_page->getID(), $cs, $rowTag, RESOURCE_LOCATION_EDITION, false);
        }
示例#5
0
 /**
  * Start the scripts process queue.
  * Remove the lock file then relaunch the script if force is true
  *
  * @param boolean $force Set to true if you wish to remove the lock file before launch
  * @return void
  * @access public
  * @static
  */
 static function startScript($force = false)
 {
     if (USE_BACKGROUND_REGENERATOR) {
         $forceRestart = '';
         if ($force) {
             $forceRestart = ' -F';
         } elseif (processManager::hasRunningScript()) {
             return false;
         }
         //test if we're on windows or linux, for the output redirection
         if (APPLICATION_IS_WINDOWS) {
             if (realpath(PATH_PHP_CLI_WINDOWS) === false) {
                 CMS_grandFather::raiseError("Unknown CLI location : " . PATH_PHP_CLI_WINDOWS . ", please check your configuration.");
                 return false;
             }
             // Create the BAT file
             $command = '@echo off' . "\r\n" . 'start /B /LOW ' . realpath(PATH_PHP_CLI_WINDOWS) . ' ' . realpath(PATH_PACKAGES_FS . '\\scripts\\script.php') . ' -m ' . REGENERATION_THREADS . $forceRestart;
             $replace = array('program files (x86)' => 'progra~2', 'program files' => 'progra~1', 'documents and settings' => 'docume~1');
             $command = str_ireplace(array_keys($replace), $replace, $command);
             if (!@touch(PATH_WINDOWS_BIN_FS . "/script.bat")) {
                 CMS_grandFather::_raiseError("CMS_scriptsManager : startScript : Create file error : " . PATH_WINDOWS_BIN_FS . "/script.bat");
                 return false;
             }
             $fh = @fopen(PATH_WINDOWS_BIN_FS . "/script.bat", "wb");
             if (is_resource($fh)) {
                 if (!@fwrite($fh, $command, io::strlen($command))) {
                     CMS_grandFather::raiseError("Save file error : script.bat");
                 }
                 @fclose($fh);
             }
             $WshShell = new COM("WScript.Shell");
             $oExec = $WshShell->Run(str_ireplace(array_keys($replace), $replace, realpath(PATH_WINDOWS_BIN_FS . '\\script.bat')), 0, false);
         } else {
             $error = '';
             if (!defined('PATH_PHP_CLI_UNIX') || !PATH_PHP_CLI_UNIX) {
                 $return = CMS_patch::executeCommand('which php 2>&1', $error);
                 if ($error) {
                     CMS_grandFather::raiseError('Error when finding php CLI with command "which php", please check your configuration : ' . $error);
                     return false;
                 }
                 if (io::substr($return, 0, 1) != '/') {
                     CMS_grandFather::raiseError('Can\'t find php CLI with command "which php", please check your configuration.');
                     return false;
                 }
                 $return = CMS_patch::executeCommand("cd " . PATH_REALROOT_FS . "; php " . PATH_PACKAGES_FS . "/scripts/script.php -m " . REGENERATION_THREADS . $forceRestart . " > /dev/null 2>&1 &", $error);
                 if ($error) {
                     CMS_grandFather::raiseError('Error during execution of script command (cd ' . PATH_REALROOT_FS . '; php ' . PATH_PACKAGES_FS . '/scripts/script.php -m ' . REGENERATION_THREADS . $forceRestart . '), please check your configuration : ' . $error);
                     return false;
                 }
             } else {
                 $return = CMS_patch::executeCommand(PATH_PHP_CLI_UNIX . ' -v 2>&1', $error);
                 if ($error) {
                     CMS_grandFather::raiseError('Error when testing php CLI with command "' . PATH_PHP_CLI_UNIX . ' -v", please check your configuration : ' . $error);
                     return false;
                 }
                 if (io::strpos(io::strtolower($return), '(cli)') === false) {
                     CMS_grandFather::raiseError(PATH_PHP_CLI_UNIX . ' is not the CLI version');
                     return false;
                 }
                 $return = CMS_patch::executeCommand("cd " . PATH_REALROOT_FS . "; " . PATH_PHP_CLI_UNIX . " " . PATH_PACKAGES_FS . "/scripts/script.php -m " . REGENERATION_THREADS . $forceRestart . " > /dev/null 2>&1 &", $error);
                 if ($error) {
                     CMS_grandFather::raiseError('Error during execution of script command (cd ' . PATH_REALROOT_FS . '; ' . PATH_PHP_CLI_UNIX . ' ' . PATH_PACKAGES_FS . '/scripts/script.php -m ' . REGENERATION_THREADS . $forceRestart . '), please check your configuration : ' . $error);
                     return false;
                 }
             }
             //CMS_grandFather::log($return);
             //CMS_grandFather::log("cd ".PATH_REALROOT_FS."; php ".PATH_PACKAGES_FS."/scripts/script.php -m ".REGENERATION_THREADS.$forceRestart." > /dev/null 2>&1 &");
             //@system("cd ".PATH_REALROOT_FS."; php ".PATH_PACKAGES_FS."/scripts/script.php -m ".REGENERATION_THREADS.$forceRestart." > /dev/null 2>&1 &");
         }
     } else {
         CMS_session::setSessionVar('start_script', true);
     }
 }
示例#6
0
        verbose('Read install file...');
        $installFile = new CMS_file(PATH_TMP_FS . "/install");
        if ($installFile->exists()) {
            $install = $installFile->readContent("array");
        } else {
            report('Error : File ' . PATH_TMP_FS . '/install does not exists ... This file is not a valid Automne patch.', true);
        }
        $installError = $automnePatch->checkInstall($install, $errorsInfos);
        if ($installError) {
            report('Error : Invalid install file :');
            $stopProcess = $automnePatch->canCorrectErrors($errorsInfos) ? false : true;
            report($installError, $stopProcess);
            if (!$force) {
                //if process continue, then we can correct patch errors.
                //save errors infos
                CMS_session::setSessionVar('patchErrors', $errorsInfos);
                //go to errors correction page
                $send = '
				<div id="correctUpdateErrors"></div>
				<script type="text/javascript">
					Ext.getCmp(\'serverWindow\').correctUpdateErrors();
				</script>';
                $content .= $send;
                echo $content;
                exit;
            }
        } else {
            verbose('-> Install file is correct.');
        }
        //start Installation process
        report('Start applying patch file...');
示例#7
0
//CHECKS
$cms_module = CMS_modulesCatalog::getByCodename(MOD_CMS_FORMS_CODENAME);
if (!$cms_user->hasModuleClearance(MOD_CMS_FORMS_CODENAME, CLEARANCE_MODULE_EDIT)) {
    header("Location: " . PATH_ADMIN_SPECIAL_ENTRY_WR . "?cms_message_id=" . MESSAGE_PAGE_CLEARANCE_ERROR . "&" . session_name() . "=" . session_name());
    exit;
} elseif (!$_POST["cms_action"] && $_POST["item"]) {
    $item = new CMS_forms_formular($_POST["item"]);
}
// +----------------------------------------------------------------------+
// | Session management                                                   |
// +----------------------------------------------------------------------+
// Language
if ($_REQUEST["items_language"] != '') {
    CMS_session::setSessionVar("items_language", $_REQUEST["items_language"]);
} elseif (CMS_session::getSessionVar("items_language") == '' || is_object(CMS_session::getSessionVar("items_language"))) {
    CMS_session::setSessionVar("items_language", $cms_module->getParameters("default_language"));
}
$items_language = new CMS_language(CMS_session::getSessionVar("items_language"));
// +----------------------------------------------------------------------+
// | Actions                                                              |
// +----------------------------------------------------------------------+
$item = new CMS_forms_formular($_POST["item"]);
if (!$item->getID()) {
    $item->setAttribute('language', $items_language);
    //item need an ID
    $item->writeToPersistence();
}
// All item relations with categories
$item_relations = new CMS_forms_formularCategories($item);
switch ($_POST["cms_action"]) {
    case "validate":
示例#8
0
 /**
  * Force a token expiration
  *
  * @param string $name, token name to expire
  * @return boolean
  * @access public
  */
 public static function expireToken($name)
 {
     $tokensDatas = CMS_session::getSessionVar('atm-tokens');
     $tokens = $tokensDatas['tokens'];
     if (isset($tokens[$name])) {
         unset($tokens[$name]);
     }
     CMS_session::setSessionVar('atm-tokens', $tokensDatas);
     return true;
 }
    $groupId = $profile->getGroupId();
}
$profileId = $profile->getId();
if (!isset($profile) || $profile->hasError()) {
    CMS_grandFather::raiseError('Unknown profile for given Id : ' . $profileId);
    $view->show();
}
// +----------------------------------------------------------------------+
// | Session management                                                   |
// +----------------------------------------------------------------------+
//Set max depth (iterations count)
if ($maxDepth) {
    CMS_session::setSessionVar("modules_clearances_max_depth", $maxDepth);
}
if (!sensitiveIO::isPositiveInteger(CMS_session::getSessionVar("modules_clearances_max_depth"))) {
    CMS_session::setSessionVar("modules_clearances_max_depth", 3);
}
$maxDepth = CMS_session::getSessionVar("modules_clearances_max_depth");
// Colors used to visualize access level
$clearance_colors = array(CLEARANCE_MODULE_NONE => '#FF7E71', CLEARANCE_MODULE_VIEW => '#e2faaa', CLEARANCE_MODULE_EDIT => '#CFE779', CLEARANCE_MODULE_MANAGE => '#85A122');
$bg_color_selected = "#fdf5a2";
//if user belongs to groups, all fields are disabled
$disableFields = $profile->hasAdminClearance(CLEARANCE_ADMINISTRATION_EDITVALIDATEALL) || $isUser && sizeof(CMS_profile_usersGroupsCatalog::getGroupsOfUser($profile, true)) ? true : false;
//unique hash relative to user module
$hash = md5($moduleCodename . '-' . $profileId);
/**
 * Module Elements rights
 * (This is recycled code from the V3)
 */
if (!function_exists("build_items_tree")) {
    /** 
示例#10
0
 /**
  * Sets session variable
  *
  * @param string $name
  * @param mixed $value
  * @return void
  * @access public
  */
 static function setSessionVar($name, $value)
 {
     return CMS_session::setSessionVar($name, $value);
 }