本文整理汇总了PHP中CMS_grandFather::raiseError方法的典型用法代码示例。如果您正苦于以下问题:PHP CMS_grandFather::raiseError方法的具体用法?PHP CMS_grandFather::raiseError怎么用?PHP CMS_grandFather::raiseError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMS_grandFather
的用法示例。
在下文中一共展示了CMS_grandFather::raiseError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: getValidations
/**
* Returns all the resource validations the user can do
* Static function.
*
* @param CMS_user $user The user we want the validations of
* @param string $module_codebame The module codename we want the validations of, if ommitted, validations for all the modules will be returned
* @return array(string=>CMS_resourceValidation) The validations to do, indexed by module codename
* @access public
*/
static function getValidations(&$user, $module_codename = false)
{
if (!is_a($user, "CMS_user")) {
parent::raiseError("User is not a valid CMS_user object");
return;
}
if ($module_codename) {
if (!($module = CMS_resourceModulesCatalog::getByCodename($codename))) {
return;
}
}
if ($module) {
$modules = array($module);
} else {
$modules = CMS_modulesCatalog::getAll();
}
$validations = array();
foreach ($modules as $aModule) {
if (!$user->hasValidationClearance($aModule->getID())) {
continue;
}
$validations_to_add = $aModule->getValidations($user);
if ($validations_to_add) {
$validations[$aModule->getCodename()] = $validations_to_add;
}
}
return $validations;
}
示例3: __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');
}
}
示例4: _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);
}
示例5: 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;
}
示例6: 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;
}
}
}
}
//.........这里部分代码省略.........
示例7:
$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;
示例8: 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;
}
示例9: 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);
//.........这里部分代码省略.........
示例10: 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;
}
示例11: 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 />';
示例12: 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}
示例13: 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;
}
示例14: 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)) {
示例15: 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;
}