• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CMS_grandFather类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中CMS_grandFather的典型用法代码示例。如果您正苦于以下问题:PHP CMS_grandFather类的具体用法?PHP CMS_grandFather怎么用?PHP CMS_grandFather使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了CMS_grandFather类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: getByEmail

    /**
     * Get array of contacts data by Email
     *
     * @param string $data
     * @return array of CMS_profile_user
     * @access public
     */
    static function getByEmail($data)
    {
        if (!SensitiveIO::isValidEmail($data)) {
            CMS_grandFather::raiseError('$data must be a valid email : ' . $data);
            return array();
        }
        $aUsers = array();
        //create the request to look for the data
        $sql = 'select `id_cd` 
			from `contactDatas`
			where `email_cd` = "' . sensitiveIO::sanitizeSQLString($data) . '"';
        //launching the request
        $q = new CMS_query($sql);
        //checking if ok and looping on results
        if (!$q->hasError()) {
            while (($oTmpUserId = $q->getValue("id_cd")) !== false) {
                //creating the user and filling the data
                $oTmpUser = CMS_profile_usersCatalog::getByID($oTmpUserId);
                if (!$oTmpUser->hasError()) {
                    $oTmpUser->getContactData();
                    if (!$oTmpUser->hasError()) {
                        $aUsers[] = $oTmpUser;
                    }
                }
            }
            unset($oTmpUser, $oTmpUserId);
        }
        return $aUsers;
    }
开发者ID:davidmottet,项目名称:automne,代码行数:36,代码来源:contactdatascatalog.php


示例2: __call

 function __call($name, $arguments)
 {
     if (is_callable(array('CMS_session', $name))) {
         return call_user_func_array(array('CMS_session', $name), $arguments);
     } else {
         CMS_grandFather::raiseError('unkown method ' . $name . ' in CMS_context');
     }
 }
开发者ID:davidmottet,项目名称:automne,代码行数:8,代码来源:context.php


示例3: _compute

 /**
  * Compute the tag
  *
  * @return string the PHP / HTML content computed
  * @access private
  */
 protected function _compute()
 {
     if (!isset($this->_computeParams['object']) || !$this->_computeParams['object'] instanceof CMS_page) {
         CMS_grandFather::raiseError('atm-js-add tag must be outside of <block> tags');
         return '';
     }
     if (!isset($this->_attributes['file'])) {
         CMS_grandFather::raiseError('atm-js-add tag must have file parameter');
         return '';
     }
     $files = CMS_module::moduleUsage($this->_computeParams['object']->getID(), "atm-js-tags-add");
     $files = is_array($files) ? $files : array();
     //append module js files
     $files = array_merge($files, array($this->_attributes['file']));
     //save files
     CMS_module::moduleUsage($this->_computeParams['object']->getID(), "atm-js-tags-add", $files, true);
 }
开发者ID:davidmottet,项目名称:automne,代码行数:23,代码来源:js-add.php


示例4: DOMElementToString

 public static function DOMElementToString($domelement, $contentOnly = false)
 {
     if (!is_a($domelement, "DOMElement")) {
         CMS_grandFather::raiseError('Domelement is not a DOMElement instance');
         return false;
     }
     static $autoClosedTagsList;
     if (!$autoClosedTagsList) {
         $xml2Array = new CMS_xml2Array();
         $tagsList = $xml2Array->getAutoClosedTagsList();
         $autoClosedTagsList = implode($tagsList, '|');
     }
     $output = '';
     if ($contentOnly) {
         $output = '';
         foreach ($domelement->childNodes as $node) {
             $output .= $node->ownerDocument->saveXML($node, LIBXML_NOEMPTYTAG);
         }
     } else {
         $output = $domNode->ownerDocument->saveXML($domNode, LIBXML_NOEMPTYTAG);
     }
     //convert output encoding if needed
     if (io::isUTF8($output)) {
         if (io::strtolower(APPLICATION_DEFAULT_ENCODING) != 'utf-8') {
             $output = utf8_decode($output);
         }
     } else {
         if (io::strtolower(APPLICATION_DEFAULT_ENCODING) == 'utf-8') {
             $output = utf8_encode($output);
         }
     }
     //to correct a bug in libXML < 2.6.27
     if (LIBXML_VERSION < 20627 && strpos($output, '&#x') !== false) {
         $output = preg_replace_callback('/(&#x[0-9A-Z]+;)/U', create_function('$matches', 'return io::decodeEntities($matches[0]);'), $output);
     }
     //replace tags like <br></br> by auto closed tags and strip cariage return arround entities
     $output = preg_replace(array('#\\n(&[a-z]+;)\\n#U', '#<(' . $autoClosedTagsList . ')([^>]*)></\\1>#U'), array('\\1', '<\\1\\2/>'), $output);
     return $output;
 }
开发者ID:davidmottet,项目名称:automne,代码行数:39,代码来源:xmldomdocument.php


示例5: moveResourceData

 /**
  * Move the data of a resource from one data location to another.
  * May be used by every module, provided it respects the naming rules described in the modules HOWTO
  *
  * @param string $module, The module codename
  * @param integer $resourceID The DB ID of the resource whose data we want to move
  * @param string $locationFrom The starting location, among the available RESOURCE_DATA_LOCATION
  * @param string $locationTo The ending location, among  the available RESOURCE_DATA_LOCATION
  * @param boolean $copyOnly If set to true, the deletion from the originating tables and dirs won't occur
  * @return boolean true on success, false on failure
  * @access public
  * @static
  */
 function moveResourceData($module, $resourceID, $locationFrom, $locationTo, $copyOnly = false)
 {
     //get all datas locations
     $locations = CMS_resource::getAllDataLocations();
     if (!in_array($locationFrom, $locations)) {
         CMS_grandFather::raiseError("LocationFrom is not a valid location : " . $locationFrom);
         return false;
     }
     if (!in_array($locationTo, $locations)) {
         CMS_grandFather::raiseError("LocationTo is not a valid location : " . $locationTo);
         return false;
     }
     if (!sensitiveIO::IsPositiveInteger($resourceID)) {
         CMS_grandFather::raiseError("ResourceID must be a positive integer : " . $resourceID);
         return false;
     }
     //first move DB datas
     $tables_prefixes = array('mod_subobject_date_', 'mod_subobject_integer_', 'mod_subobject_string_', 'mod_subobject_text_');
     foreach ($tables_prefixes as $table_prefix) {
         //delete all in the destination table and insert new ones
         if ($locationTo != RESOURCE_DATA_LOCATION_DEVNULL) {
             $sql = "\n\t\t\t\t\tdelete from\n\t\t\t\t\t\t" . $table_prefix . $locationTo . "\n\t\t\t\t\twhere\n\t\t\t\t\t\tobjectID='" . $resourceID . "'\n\t\t\t\t";
             $q = new CMS_query($sql);
             $sql = "\n\t\t\t\t\treplace into\n\t\t\t\t\t\t" . $table_prefix . $locationTo . "\n\t\t\t\t\t\tselect\n\t\t\t\t\t\t\t*\n\t\t\t\t\t\tfrom\n\t\t\t\t\t\t\t" . $table_prefix . $locationFrom . "\n\t\t\t\t\t\twhere\n\t\t\t\t\t\t\tobjectID='" . $resourceID . "'\n\t\t\t\t";
             $q = new CMS_query($sql);
         }
         if (!$copyOnly) {
             //delete from the starting table
             $sql = "\n\t\t\t\t\tdelete from\n\t\t\t\t\t\t" . $table_prefix . $locationFrom . "\n\t\t\t\t\twhere\n\t\t\t\t\t\tobjectID='" . $resourceID . "'\n\t\t\t\t";
             $q = new CMS_query($sql);
         }
     }
     //second, move the files
     $locationFromDir = new CMS_file(PATH_MODULES_FILES_FS . "/" . $module . "/" . $locationFrom, CMS_file::FILE_SYSTEM, CMS_file::TYPE_DIRECTORY);
     //cut here if the locationFromDir doesn't exists. That means the module doesn't have files
     if (!$locationFromDir->exists()) {
         return true;
     }
     if ($locationTo != RESOURCE_DATA_LOCATION_DEVNULL) {
         $locationToDir = new CMS_file(PATH_MODULES_FILES_FS . "/" . $module . "/" . $locationTo, CMS_file::FILE_SYSTEM, CMS_file::TYPE_DIRECTORY);
         //cut here if the locationToDir doesn't exists.
         if (!$locationToDir->exists()) {
             CMS_grandFather::raiseError("LocationToDir does not exists : " . PATH_MODULES_FILES_FS . "/" . $module . "/" . $locationTo);
             return false;
         }
         //delete all files of the locationToDir
         $files = glob(PATH_MODULES_FILES_FS . "/" . $module . "/" . $locationTo . '/r' . $resourceID . '_*', GLOB_NOSORT);
         if (is_array($files)) {
             foreach ($files as $file) {
                 if (!CMS_file::deleteFile($file)) {
                     $this->raiseError("Can't delete file " . $file);
                     return false;
                 }
             }
         }
         //then copy or move them to the locationToDir
         $files = glob(PATH_MODULES_FILES_FS . "/" . $module . "/" . $locationFrom . '/r' . $resourceID . '_*', GLOB_NOSORT);
         if (is_array($files)) {
             foreach ($files as $file) {
                 $to = str_replace('/' . $locationFrom . '/', '/' . $locationTo . '/', $file);
                 if ($copyOnly) {
                     if (!CMS_file::copyTo($file, $to)) {
                         $this->raiseError("Can't copy file " . $file . " to " . $to);
                         return false;
                     }
                 } else {
                     if (!CMS_file::moveTo($file, $to)) {
                         $this->raiseError("Can't move file " . $file . " to " . $to);
                         return false;
                     }
                 }
                 //then chmod new file
                 CMS_file::chmodFile(FILES_CHMOD, $to);
             }
         }
     } else {
         //then get all files of the locationFromDir
         $files = glob(PATH_MODULES_FILES_FS . "/" . $module . "/" . $locationFrom . '/r' . $resourceID . '_*', GLOB_NOSORT);
         if (is_array($files)) {
             foreach ($files as $file) {
                 if (!CMS_file::deleteFile($file)) {
                     $this->raiseError("Can't delete file " . $file);
                     return false;
                 }
             }
         }
     }
//.........这里部分代码省略.........
开发者ID:davidmottet,项目名称:automne,代码行数:101,代码来源:modulePolymodValidation.php


示例6:

 $value = sensitiveIO::request('value', 'is_array');
 $codename = sensitiveIO::request('module', CMS_modulesCatalog::getAllCodenames());
 $cms_page = CMS_tree::getPageByID($currentPage);
 //RIGHTS CHECK
 if (!is_object($cms_page) || $cms_page->hasError() || !$cms_user->hasPageClearance($cms_page->getID(), CLEARANCE_PAGE_EDIT) || !$cms_user->hasModuleClearance(MOD_STANDARD_CODENAME, CLEARANCE_MODULE_EDIT)) {
     CMS_grandFather::raiseError('Insufficient rights on page ' . $cms_page->getID());
     break;
 }
 //CHECKS user has module clearance
 if (!$cms_user->hasModuleClearance($codename, CLEARANCE_MODULE_EDIT)) {
     CMS_grandFather::raiseError('Error, user has no rights on module : ' . $codename);
     break;
 }
 //ARGUMENTS CHECK
 if (!$cs || !$rowTag || !$rowId || !$blockId) {
     CMS_grandFather::raiseError('Data missing ...');
     break;
 }
 //instanciate block
 $cms_block = new CMS_block_polymod();
 $cms_block->initializeFromID($blockId, $rowId);
 //instanciate block module
 $cms_module = CMS_modulesCatalog::getByCodename($codename);
 //get block datas if any
 $data = $cms_block->getRawData($cms_page->getID(), $cs, $rowTag, RESOURCE_LOCATION_EDITION, false);
 //get block parameters requirements
 $blockParamsDefinition = $cms_block->getBlockParametersRequirement($data["value"], $cms_page, true);
 //instanciate row
 $row = new CMS_row($rowId);
 //checks and assignments
 $formok = true;
开发者ID:davidmottet,项目名称:automne,代码行数:31,代码来源:items-controler.php


示例7: checkFormCode

 /**
  * Analyse a form xhtml code check if it has some copy-pasted code inside
  *
  * @access public
  * @return true if none error found
  */
 function checkFormCode($formCode)
 {
     //get form ID in xhtml code
     $status = preg_match('#<form[^>]* id="cms_forms_(\\d*)"#iU', $formCode, $formId);
     $formId = array_map("trim", $formId);
     if ($status) {
         $formIdXHTML = $formId[1];
     }
     if (isset($formIdXHTML) && $this->getID() && $formIdXHTML != $this->getID()) {
         CMS_grandFather::raiseError("Can't use another form code pasted into XHTML source code");
         return false;
     }
     return true;
 }
开发者ID:davidmottet,项目名称:automne,代码行数:20,代码来源:form.php


示例8: activate

 /**
  * activates the script function.
  *
  * @return void
  * @access public
  */
 function activate()
 {
     parent::activate();
     if ($_SERVER['argv']['1'] == '-s' && SensitiveIO::isPositiveInteger($_SERVER['argv']['2'])) {
         // SUB-SCRIPT : Processes one script task
         @ini_set('max_execution_time', SUB_SCRIPT_TIME_OUT);
         //set max execution time for sub script
         @set_time_limit(SUB_SCRIPT_TIME_OUT);
         //set the PHP timeout for sub script
         $sql = "\n\t\t\t\tselect\n\t\t\t\t\t*\n\t\t\t\tfrom\n\t\t\t\t\tregenerator\n\t\t\t\twhere\n\t\t\t\t\tid_reg = '" . $_SERVER['argv']['2'] . "'\n\t\t\t";
         $q = new CMS_query($sql);
         if ($q->getNumRows()) {
             $data = $q->getArray();
             //send script informations to process manager
             $this->_processManager->setParameters($data['module_reg'], $data['parameters_reg']);
             //instanciate script module
             $module = CMS_modulesCatalog::getByCodename($data['module_reg']);
             //then send script task to module (return task title by reference)
             $task = $module->scriptTask(unserialize($data['parameters_reg']));
             //delete the current script task
             $sql_delete = "\n\t\t\t\t\tdelete\n\t\t\t\t\tfrom\n\t\t\t\t\t\tregenerator\n\t\t\t\t\twhere\n\t\t\t\t\t\tid_reg='" . $data['id_reg'] . "'";
             $q = new CMS_query($sql_delete);
             if ($this->_debug) {
                 $this->raiseError($this->_processManager->getPIDFilePath() . " : task " . $_SERVER['argv']['2'] . " seems " . (!$task ? 'NOT ' : '') . "done !");
                 $this->raiseError($this->_processManager->getPIDFilePath() . " : PID file exists ? " . @file_exists($this->_processManager->getPIDFilePath()));
             }
             $fpath = $this->_processManager->getPIDFilePath() . '.ok';
             if (@touch($fpath) && @chmod($fpath, octdec(FILES_CHMOD))) {
                 $f = @fopen($fpath, 'a');
                 if (!@fwrite($f, 'Script OK')) {
                     $this->raiseError($this->_processManager->getPIDFilePath() . " : Can't write into file: " . $fpath);
                 }
                 @fclose($f);
             } else {
                 $this->raiseError($this->_processManager->getPIDFilePath() . " : Can't create file: " . $fpath);
             }
         }
     } else {
         // MASTER SCRIPT : Processes all sub-scripts
         @ini_set('max_execution_time', MASTER_SCRIPT_TIME_OUT);
         //set max execution time for master script
         @set_time_limit(MASTER_SCRIPT_TIME_OUT);
         //set the PHP timeout  for master script
         //max simultaneous scripts
         $maxScripts = $_SERVER['argv']['2'];
         $scriptsArray = array();
         //send script informations to process manager
         $this->_processManager->setParameters(processManager::MASTER_SCRIPT_NAME, '');
         //the sql script which selects one script task at a time
         $sql_select = "\n\t\t\t\tselect\n\t\t\t\t\t*\n\t\t\t\tfrom\n\t\t\t\t\tregenerator\n\t\t\t\tlimit\n\t\t\t\t\t" . $maxScripts . "\n\t\t\t";
         //and now, launch all sub-scripts until table is empty.
         while (true) {
             //get scripts
             $q = new CMS_query($sql_select);
             if ($q->getNumRows()) {
                 while (count($scriptsArray) < $maxScripts && ($data = $q->getArray())) {
                     // Launch sub-process
                     if (!APPLICATION_IS_WINDOWS) {
                         // On unix system
                         $sub_system = PATH_PACKAGES_FS . "/scripts/script.php -s " . $data["id_reg"] . " > /dev/null 2>&1 &";
                         if (!defined('PATH_PHP_CLI_UNIX') || !PATH_PHP_CLI_UNIX) {
                             CMS_patch::executeCommand("cd " . PATH_REALROOT_FS . "; php " . $sub_system, $error);
                             if ($error) {
                                 CMS_grandFather::raiseError('Error during execution of sub script command (cd ' . PATH_REALROOT_FS . '; php ' . $sub_system . '), please check your configuration : ' . $error);
                                 return false;
                             }
                         } else {
                             CMS_patch::executeCommand("cd " . PATH_REALROOT_FS . "; " . PATH_PHP_CLI_UNIX . " " . $sub_system, $error);
                             if ($error) {
                                 CMS_grandFather::raiseError('Error during execution of sub script command (cd ' . PATH_REALROOT_FS . '; ' . PATH_PHP_CLI_UNIX . ' ' . $sub_system . '), please check your configuration : ' . $error);
                                 return false;
                             }
                         }
                         $PIDfile = $this->_processManager->getTempPath() . "/" . SCRIPT_CODENAME . "_" . $data["id_reg"];
                         if ($this->_debug) {
                             $this->raiseError(processManager::MASTER_SCRIPT_NAME . " : Executes system(" . $sub_system . ")");
                         }
                         //sleep a little
                         @sleep(SLEEP_TIME);
                     } else {
                         // On windows system
                         //Create the BAT file
                         $command = '@echo off' . "\r\n" . '@start /B /BELOWNORMAL ' . realpath(PATH_PHP_CLI_WINDOWS) . ' ' . realpath(PATH_PACKAGES_FS . '\\scripts\\script.php') . ' -s ' . $data["id_reg"];
                         if (!@touch(realpath(PATH_WINDOWS_BIN_FS) . DIRECTORY_SEPARATOR . "sub_script.bat")) {
                             $this->raiseError(processManager::MASTER_SCRIPT_NAME . " : Create file error : sub_script.bat");
                         }
                         $replace = array('program files (x86)' => 'progra~2', 'program files' => 'progra~1', 'documents and settings' => 'docume~1');
                         $command = str_ireplace(array_keys($replace), $replace, $command);
                         $fh = fopen(realpath(PATH_WINDOWS_BIN_FS . DIRECTORY_SEPARATOR . "sub_script.bat"), "wb");
                         if (is_resource($fh)) {
                             if (!fwrite($fh, $command, io::strlen($command))) {
                                 CMS_grandFather::raiseError(processManager::MASTER_SCRIPT_NAME . " : Save file error : sub_script.bat");
                             }
                             fclose($fh);
//.........这里部分代码省略.........
开发者ID:davidmottet,项目名称:automne,代码行数:101,代码来源:script.php


示例9: extractEncodedID

 /**
  * Analyse an array of field id datas and return the CMS_forms_field DB id associated
  *
  * @access private
  * @param string $fieldIDDatas the encoded field id datas to analyse
  * @return integer the field id found
  */
 function extractEncodedID($fieldIDDatas)
 {
     $fieldIDDatas = CMS_forms_field::decodeFieldIdDatas($fieldIDDatas);
     $id = false;
     if (is_array($fieldIDDatas)) {
         foreach ($fieldIDDatas as $anIDData) {
             $id = sensitiveIO::isPositiveInteger($anIDData) ? $anIDData : $id;
         }
     }
     if (!$id) {
         if (is_object($this)) {
             $this->raiseError("No positive integer id found");
             return false;
         } else {
             CMS_grandFather::raiseError("No positive integer id found");
             return false;
         }
     }
     return $id;
 }
开发者ID:davidmottet,项目名称:automne,代码行数:27,代码来源:field.php


示例10: array

$codename = sensitiveIO::request('module');
$rootId = io::substr(sensitiveIO::request('node', 'checkCatId', 'cat0'), 3);
$maxDepth = sensitiveIO::request('maxDepth', 'sensitiveIO::isPositiveInteger', 2);
if (!$codename) {
    CMS_grandFather::raiseError('Unknown module ...');
    $view->show();
}
//load module
$module = CMS_modulesCatalog::getByCodename($codename);
if (!$module) {
    CMS_grandFather::raiseError('Unknown module or module for codename : ' . $codename);
    $view->show();
}
//CHECKS user has module clearance
if (!$cms_user->hasModuleClearance($codename, CLEARANCE_MODULE_EDIT)) {
    CMS_grandFather::raiseError('User has no rights on module : ' . $codename);
    $view->setActionMessage($cms_language->getmessage(MESSAGE_ERROR_MODULE_RIGHTS, array($module->getLabel($cms_language))));
    $view->show();
}
//get queried module categories
$attrs = array("module" => $codename, "language" => $cms_language, "level" => $rootId, "root" => $rootId ? false : 0, "attrs" => false, "cms_user" => $cms_user);
$categories = CMS_module::getModuleCategories($attrs);
$nodes = array();
foreach ($categories as $category) {
    $parentRight = sensitiveIO::isPositiveInteger($category->getAttribute('parentID')) ? $cms_user->hasModuleCategoryClearance($category->getAttribute('parentID'), CLEARANCE_MODULE_MANAGE) : $cms_user->hasModuleClearance($codename, CLEARANCE_MODULE_EDIT);
    $categoryRight = $cms_user->hasModuleCategoryClearance($category->getID(), CLEARANCE_MODULE_MANAGE);
    $hasSiblings = $category->hasSiblings();
    $qtip = $category->getIconPath(false, PATH_RELATIVETO_WEBROOT, true) ? '<img style="max-width:280px;" src="' . $category->getIconPath(true) . '" /><br />' : '';
    $qtip .= $category->getDescription() ? $category->getDescription() . '<br />' : '';
    if ($category->isProtected()) {
        $qtip .= '<strong>' . $cms_language->getMessage(MESSAGE_CATEGORY_PROTECTED) . ' : </strong>' . $cms_language->getMessage(MESSAGE_CATEGORY_PROTECTED_DESC) . '<br />';
开发者ID:davidmottet,项目名称:automne,代码行数:31,代码来源:modules-categories-nodes.php


示例11: define

define("MESSAGE_PAGE_EDIT_SELECTED", 1694);
define("MESSAGE_PAGE_CREATE_NEW_LANGUAGE", 1695);
//check user rights
if (!$cms_user->hasAdminClearance(CLEARANCE_ADMINISTRATION_EDITVALIDATEALL)) {
    CMS_grandFather::raiseError('User has no rights on language management');
    $view->show();
}
//load interface instance
$view = CMS_view::getInstance();
//set default display mode for this page
$view->setDisplayMode(CMS_view::SHOW_RAW);
//This file is an admin file. Interface must be secure
$view->setSecure();
$winId = sensitiveIO::request('winId');
if (!$winId) {
    CMS_grandFather::raiseError('Unknown window Id ...');
    $view->show();
}
//usefull vars
$searchURL = PATH_ADMIN_WR . '/languages-datas.php';
$editURL = PATH_ADMIN_WR . '/language.php';
$itemsControlerURL = PATH_ADMIN_WR . '/languages-controler.php';
$jscontent = <<<END
\tvar moduleObjectWindow = Ext.getCmp('{$winId}');
\tmoduleObjectWindow.setTitle('{$cms_language->getJsMessage(MESSAGE_PAGE_LANGUAGE_MANAGEMENT)}');
\t
\t//define search function into window (to be accessible by parent window)
\tmoduleObjectWindow.search = function() {
\t\tif (!moduleObjectWindow.ok) {
\t\t\treturn;
\t\t}
开发者ID:davidmottet,项目名称:automne,代码行数:31,代码来源:languages.php


示例12: getModuleCategories

 /**
  * Get array of categories this module can use to archive its datas
  *
  * @access public
  * @param array $attrs, array of attributes to determine which level of categoryies wanted, etc.
  *        format : array(language => CMS_language, level => integer, root => integer, attrs => array())
  * @return array(CMS_moduleCategory)
  * @static
  */
 function getModuleCategories($attrs)
 {
     if ((!isset($attrs["module"]) || !$attrs["module"]) && $this->_codename) {
         $attrs["module"] = $this->_codename;
     }
     if (!$attrs["module"]) {
         CMS_grandFather::raiseError("No codename defined to get its categories");
         return false;
     }
     if (APPLICATION_ENFORCES_ACCESS_CONTROL != false && !$attrs["cms_user"] instanceof CMS_profile) {
         CMS_grandFather::raiseError("Not valid CMS_profile given as enforced access control is active");
         return false;
     }
     if (isset($attrs["cms_user"]) && $attrs["cms_user"] instanceof CMS_profile && $attrs["cms_user"]->hasAdminClearance(CLEARANCE_ADMINISTRATION_EDITVALIDATEALL)) {
         // If current user is an adminsitrator, let's show all categories anytime
         unset($attrs["cms_user"]);
     }
     if (is_array($attrs) && $attrs) {
         $items = CMS_moduleCategories_catalog::getAll($attrs);
     }
     return $items;
 }
开发者ID:davidmottet,项目名称:automne,代码行数:31,代码来源:module.php


示例13: md5

}
if (!is_file($file)) {
    //file creation
    $fileCreation = true;
    $extension = '';
    $fileId = md5(rand());
    $fileDefinition = '';
    $labelField = "{\n\t\txtype:\t\t\t'textfield',\n\t\tvalue:\t\t\t'',\n\t\tname:\t\t\t'filelabel',\n\t\tfieldLabel:\t\t'{$cms_language->getJsMessage(MESSAGE_PAGE_LABEL)}',\n\t\tborder:\t\t\tfalse,\n\t\tbodyStyle: \t\t'padding-bottom:10px'\n\t},";
    $anchor = '-110';
    $action = 'create';
} else {
    //file edition
    $fileCreation = false;
    $extension = io::strtolower(pathinfo($file, PATHINFO_EXTENSION));
    if (!isset($allowedFiles[$extension])) {
        CMS_grandFather::raiseError('Action on this type of file is not allowed.');
        $view->show();
    }
    $fileId = md5($file);
    $file = new CMS_file($file);
    $fileDefinition = $file->readContent();
    $labelField = '';
    $anchor = '-60';
    $action = 'update';
}
if (strtolower(APPLICATION_DEFAULT_ENCODING) == 'utf-8') {
    if (!io::isUTF8($fileDefinition)) {
        $fileDefinition = utf8_encode($fileDefinition);
    }
} else {
    if (io::isUTF8($fileDefinition)) {
开发者ID:davidmottet,项目名称:automne,代码行数:31,代码来源:templates-file.php


示例14: getEditorFromParams

 /**
  * Get a CMS_textEditor from given parameters
  * 
  * @param mixed array(), $attrs each key => value is an attribute
  * of this class or an attribute to fckeditor
  * @return CMS_textEditor or null if error
  */
 function getEditorFromParams($attrs)
 {
     if (!is_array($attrs)) {
         CMS_grandFather::raiseError("None array of attributes passed to factory");
         return null;
     }
     $text_editor = new CMS_textEditor($attrs['form'], $attrs['field'], $attrs['value'], $_SERVER["HTTP_USER_AGENT"], '', $attrs['language'], $attrs['width'], $attrs['rows']);
     $fck_attrs = array('ToolbarSet' => $attrs['toolbarset'], 'Width' => $attrs['width'], 'Height' => $attrs['height']);
     $text_editor->setEditorAttributes($fck_attrs);
     return $text_editor;
 }
开发者ID:davidmottet,项目名称:automne,代码行数:18,代码来源:texteditor.php


示例15:

                    $cms_message = $cms_language->getMessage(MESSAGE_ERROR_NO_PAGES_FOUND);
                }
            }
        }
        break;
    case 'restart-scripts':
        CMS_scriptsManager::startScript(true);
        $cms_message = $cms_language->getMessage(MESSAGE_ACTION_OPERATION_DONE);
        break;
    case 'stop-scripts':
        CMS_scriptsManager::clearScripts();
        CMS_scriptsManager::startScript(true);
        $cms_message = $cms_language->getMessage(MESSAGE_ACTION_OPERATION_DONE);
        break;
    case 'clear-scripts':
        CMS_scriptsManager::clearScripts();
        $cms_message = $cms_language->getMessage(MESSAGE_ACTION_OPERATION_DONE);
        break;
    default:
        CMS_grandFather::raiseError('Unknown action to do ...');
        $view->show();
        break;
}
//set user message if any
if ($cms_message) {
    $view->setActionMessage($cms_message);
}
if ($content) {
    $view->setContent($content);
}
$view->show();
开发者ID:davidmottet,项目名称:automne,代码行数:31,代码来源:server-scripts-controler.php


示例16: define

// $Id: polymod-help.php,v 1.3 2010/03/08 16:42:07 sebastien Exp $
/**
 * PHP page : Load polymod help for object.
 * Used accross an Ajax request.
 *
 * @package Automne
 * @subpackage admin
 * @author Sébastien Pauchet <[email protected]>
 */
define("ENABLE_HTML_COMPRESSION", false);
require_once dirname(__FILE__) . '/../../cms_rc_admin.php';
define('MESSAGE_PAGE_NO_LOGS', 1608);
define("MESSAGE_PAGE_NO_SERVER_RIGHTS", 748);
//CHECKS user has admin clearance
if (!$cms_user->hasAdminClearance(CLEARANCE_ADMINISTRATION_EDITVALIDATEALL)) {
    CMS_grandFather::raiseError('User has no administration rights');
    echo $cms_language->getMessage(MESSAGE_PAGE_NO_SERVER_RIGHTS);
    exit;
}
$date = sensitiveIO::request('date');
$errorFile = '';
$gzip = false;
$now = new CMS_date();
$now->setNow(true);
$requestedDate = new CMS_date();
$requestedDate->setFormat($cms_language->getDateFormat());
$requestedDate->setLocalizedDate($date);
if (!$requestedDate->hasError()) {
    if (CMS_date::compare($requestedDate, $now, '==')) {
        $errorFile = PATH_MAIN_FS . '/' . CMS_grandFather::ERROR_LOG;
    } else {
开发者ID:davidmottet,项目名称:automne,代码行数:31,代码来源:server-errors.php


示例17: startScript

 /**
  * 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);
     }
 }
开发者ID:davidmottet,项目名称:automne,代码行数:82,代码来源:scriptsmanager.php


示例18: page

if ($cms_page->hasError()) {
    CMS_grandFather::raiseError('Selected page (' . $currentPage . ') has error ...');
    $view->show();
}
//check user rights
if (!$cms_user->hasPageClearance($cms_page->getID(), CLEARANCE_PAGE_EDIT)) {
    CMS_grandFather::raiseError('Error, user has no rights on page : ' . $cms_page->getID());
    $view->show();
}
//get block datas
if (class_exists($blockClass)) {
    $cms_block = new $blockClass();
    $cms_block->initializeFromBasicAttributes($blockId);
    $rawDatas = $cms_block->getRawData($cms_page->getID(), $cs, $rowTag, RESOURCE_LOCATION_EDITION, false);
} else {
    CMS_grandFather::raiseError('Error, can\'t get block class : ' . $blockClass);
    $view->show();
}
$maxFileSize = CMS_file::getMaxUploadFileSize('K');
if ($rawDatas['file'] && file_exists(PATH_MODULES_FILES_STANDARD_FS . '/edition/' . $rawDatas['file'])) {
    $file = new CMS_file(PATH_MODULES_FILES_STANDARD_FS . '/edition/' . $rawDatas['file']);
    $fileDatas = array('filename' => $file->getName(false), 'filepath' => $file->getFilePath(CMS_file::WEBROOT), 'filesize' => $file->getFileSize(), 'fileicon' => $file->getFileIcon(CMS_file::WEBROOT), 'extension' => $file->getExtension());
} else {
    $fileDatas = array('filename' => '', 'filepath' => '', 'filesize' => '', 'fileicon' => '', 'extension' => '');
}
$filePath = $fileDatas['filepath'];
$fileDatas = sensitiveIO::jsonEncode($fileDatas);
$flashvars = sensitiveIO::sanitizeJSString($rawDatas["flashvars"]);
$params = sensitiveIO::sanitizeJSString($rawDatas["params"]);
$attributes = sensitiveIO::sanitizeJSString($rawDatas["attributes"]);
$jscontent = <<<END
开发者ID:davidmottet,项目名称:automne,代码行数:31,代码来源:page-content-block-flash.php


示例19: redirect

 /**
  * Create the redirection of an alias
  *
  * @return boolean true on success, false on failure
  * @access public
  * @static
  */
 function redirect()
 {
     //get aliases for current folder
     $dirname = array_pop(explode(DIRECTORY_SEPARATOR, dirname($_SERVER['SCRIPT_NAME'])));
     $aliases = CMS_module_cms_aliases::getByName($dirname);
     if (!$aliases) {
         //no alias found, go to 404
         CMS_grandFather::raiseError('No alias found for directory ' . dirname($_SERVER['SCRIPT_NAME']));
         CMS_view::redirect(PATH_SPECIAL_PAGE_NOT_FOUND_WR, true, 301);
     }
     //check each aliases returned to get the one which respond to current alias
     $matchAlias = false;
     $domain = @parse_url($_SERVER['REQUEST_URI'], PHP_URL_HOST) ? @parse_url($_SERVER['REQUEST_URI'], PHP_URL_HOST) : (@parse_url($_SERVER['HTTP_HOST'], PHP_URL_HOST) ? @parse_url($_SERVER['HTTP_HOST'], PHP_URL_HOST) : $_SERVER['HTTP_HOST']);
     $websites = array();
     if ($domain) {
         $websites = CMS_websitesCatalog::getWebsitesFromDomain($domain);
     }
     foreach ($aliases as $alias) {
         if (!$matchAlias && dirname($_SERVER['SCRIPT_NAME']) == substr($alias->getPath(), 0, -1)) {
             if ($websites) {
                 foreach ($websites as $website) {
                     //alias match path, check for website
                     if (!$alias->getWebsites() || !$website || in_array($website->getId(), $alias->getWebsites())) {
                         //alias match website, use it
                         $matchAlias = $alias;
                     }
                 }
             } else {
                 //alias match path, check for website
                 if (!$alias->getWebsites()) {
                     //alias match website, use it
                     $matchAlias = $alias;
                 }
             }
         }
     }
     if (!$matchAlias) {
         //no alias found, go to 404
         CMS_grandFather::raiseError('No alias found for directory ' . dirname($_SERVER['SCRIPT_NAM 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CMS_view类代码示例发布时间:2022-05-23
下一篇:
PHP CMS_Asset类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap