本文整理汇总了PHP中CMS_view类的典型用法代码示例。如果您正苦于以下问题:PHP CMS_view类的具体用法?PHP CMS_view怎么用?PHP CMS_view使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CMS_view类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _raiseError
/**
* Raises an error. Shows it to the screen
* Deprecated, use raiseError instead
* @param string $errorMessage the error message.
* @param boolean $encodeOutput, does the screen output should be encoded (default : false)
* @return void
* @access public
*/
public function _raiseError($errorMessage, $encodeOutput = false, $error = true)
{
static $errorNumber;
$systemDebug = !defined('SYSTEM_DEBUG') ? true : SYSTEM_DEBUG;
if (isset($this) && isset($this->_debug) && $this->_debug === NULL) {
$this->_debug = $systemDebug;
}
if ($errorMessage) {
//second condition are for static calls (made by static methods)
if (!defined('APPLICATION_EXEC_TYPE') || APPLICATION_EXEC_TYPE == 'http' && (!isset($this) && $systemDebug || isset($this) && isset($this->_debug) && $this->_debug)) {
$backTrace = $backTraceLink = '';
if (version_compare(phpversion(), "5.2.5", "<")) {
$bt = @array_reverse(debug_backtrace());
} else {
$bt = @array_reverse(debug_backtrace(false));
}
$backtrace = array('summary' => sensitiveIO::printBackTrace($bt), 'backtrace' => @print_r($bt, true));
$backtraceName = 'bt_' . md5(rand());
$backTraceLink = PATH_ADMIN_WR . '/backtrace.php?bt=' . $backtraceName;
//save backtrace to cache (for 10 min)
$cache = new CMS_cache($backtraceName, 'atm-backtrace', 600, false);
if ($cache) {
$cache->save($backtrace);
}
unset($backtrace, $cache, $bt);
//append error to current view
$view = CMS_view::getInstance();
$outputMessage = $encodeOutput ? io::htmlspecialchars($errorMessage) : $errorMessage;
$view->addError(array('error' => $outputMessage, 'backtrace' => $backTraceLink));
}
//second condition are for static calls (made by static methods)
if (!isset($this) || !isset($this->_log) || $this->_log) {
if (@file_put_contents(PATH_MAIN_FS . '/' . self::ERROR_LOG, date("Y-m-d H:i:s", time()) . '|' . APPLICATION_EXEC_TYPE . '|' . $errorMessage . "\n", FILE_APPEND) !== false) {
CMS_file::chmodFile(FILES_CHMOD, PATH_MAIN_FS . '/' . self::ERROR_LOG);
} else {
die('<pre><b>' . CMS_view::SYSTEM_LABEL . ' ' . AUTOMNE_VERSION . ' error : /automne dir is not writable' . "</b></pre>\n");
}
}
}
//must be at the end because it interferes with the static calls conditions above
if ($error && isset($this)) {
$this->_errRaised = true;
}
}
开发者ID:davidmottet,项目名称:automne,代码行数:52,代码来源:grandfather.php
示例2: setSoapValues
/**
* Set soap values
*
* @param integer $fieldID The field ID
* @param $domdocument XML values to set
* @param $itemId the ID of the polyobject item, if any (necessary for some fields (image, file, etc...)
* @return boolean true or false
* @access public
*/
function setSoapValues($fieldID, $domdocument, $itemId = '')
{
$view = CMS_view::getInstance();
$fieldValues = array();
// subfield
foreach ($domdocument->childNodes as $childNode) {
if ($childNode->nodeType == XML_ELEMENT_NODE) {
switch ($childNode->tagName) {
case 'subfield':
//<subfield id="{int}" [name="{string}"] type="int|string|date|text|object|binary|category|user|group">
$subFieldId = $childNode->getAttribute('id');
if (!sensitiveIO::isPositiveInteger($subFieldId) && $subFieldId != 0) {
$view->addError('Missing or invalid attribute id for subfield tag');
return false;
}
if (!isset($this->_subfields[$subFieldId])) {
$view->addError('Unknown field id ' . $fieldId . ' for object ' . $this->_objectID);
return false;
}
$fieldValues[$fieldID . '_' . $subFieldId] = trim(io::strtolower(APPLICATION_DEFAULT_ENCODING) != 'utf-8' ? utf8_decode($childNode->nodeValue) : $childNode->nodeValue);
break;
case 'object':
//TODO
break;
default:
$view->addError('Unknown xml tag ' . $childNode->tagName . ' to process.');
return false;
break;
}
} else {
if ($childNode->nodeType == XML_TEXT_NODE && trim($childNode->nodeValue)) {
$view->addError('Unknown xml content tag ' . $childNode->nodeValue . ' to process.');
return false;
}
}
}
if (!$this->checkMandatory($fieldValues, '')) {
$view->addError('Error of mandatory values for field ' . $fieldID);
return false;
} elseif (!$this->setValues($fieldValues, '', false, $itemId)) {
return false;
}
return true;
}
开发者ID:davidmottet,项目名称:automne,代码行数:53,代码来源:object_common.php
示例3: array
$jsfiles = array('ext', 'debug', 'codemirror', 'main');
} else {
$jsfiles = array('ext', 'codemirror', 'main');
}
//set title
$view->setTitle($language->getMessage(MESSAGE_PAGE_TITLE, array(APPLICATION_LABEL)));
$content = '
<div id="atm-loading-mask"></div>
<div id="atm-center">
<div class="atm-loading-indicator">' . $language->getMessage(MESSAGE_PAGE_LOADING) . '</div>
<noscript class="atm-alert">You must have Javascript enabled to access Automne.<hr />Vous devez avoir Javascript actif pour accéder à Automne.</noscript>
</div>
<script type="text/javascript">
var CKEDITOR_BASEPATH = \'' . PATH_MAIN_WR . '/ckeditor/\';
</script>
' . CMS_view::getJavascript($jsfiles) . CMS_view::getJavascript(array('launch'));
if (io::request('cms_action') == 'logout') {
//append logout info
$content .= '<script type="text/javascript">Automne.logout = true;</script>';
}
if (APPLICATION_GCF_SUPPORT) {
//GCF prompt for IE
$content .= '
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js"></script>
<style type="text/css">
.chromeFrameOverlayContent {
z-index:200001;
}
</style>
<script type="text/javascript">
开发者ID:davidmottet,项目名称:automne,代码行数:31,代码来源:index.php
示例4: 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_NAME']) . ' and domain ' . $domain);
CMS_view::redirect(PATH_SPECIAL_PAGE_NOT_FOUND_WR, true, 301);
}
//if alias is used as a page url, return page
if ($matchAlias->urlReplaced()) {
if (io::isPositiveInteger($matchAlias->getPageID())) {
$page = CMS_tree::getPageById($matchAlias->getPageID());
} else {
//no valid page set, go to 404
$matchAlias->raiseError('No page set for alias ' . $matchAlias->getID());
CMS_view::redirect(PATH_SPECIAL_PAGE_NOT_FOUND_WR, true, 301);
}
if (!$page || $page->hasError()) {
//no valid page found, go to 404
$matchAlias->raiseError('Invalid page ' . $matchAlias->getPageID() . ' for alias ' . $matchAlias->getID());
CMS_view::redirect(PATH_SPECIAL_PAGE_NOT_FOUND_WR, true, 301);
}
//return page path
$pPath = $page->getHTMLURL(false, false, PATH_RELATIVETO_FILESYSTEM);
if ($pPath) {
if (file_exists($pPath)) {
return $pPath;
} elseif ($page->regenerate(true)) {
clearstatcache();
if (file_exists($pPath)) {
return $pPath;
}
}
}
//no valid url page found, go to 404
$matchAlias->raiseError('Invalid url page ' . $matchAlias->getPageID() . ' for alias ' . $matchAlias->getID());
CMS_view::redirect(PATH_SPECIAL_PAGE_NOT_FOUND_WR, true, 301);
} else {
//this is a redirection
$params = isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] ? '?' . $_SERVER['QUERY_STRING'] : '';
if (isset($_SERVER['HTTP_REFERER'])) {
header("Referer: " . $_SERVER['HTTP_REFERER']);
}
if (io::isPositiveInteger($matchAlias->getPageID())) {
//it's a redirection to an Automne Page
$page = CMS_tree::getPageById($matchAlias->getPageID());
if ($page && !$page->hasError()) {
$pageURL = CMS_tree::getPageValue($matchAlias->getPageID(), 'url');
if ($pageURL) {
CMS_view::redirect($pageURL . $params, true, $matchAlias->isPermanent() ? 301 : 302);
} else {
//no valid url page found, go to 404
$matchAlias->raiseError('Invalid url page ' . $matchAlias->getPageID() . ' for alias ' . $matchAlias->getID());
CMS_view::redirect(PATH_SPECIAL_PAGE_NOT_FOUND_WR, true, 301);
}
} else {
//no valid page found, go to 404
$matchAlias->raiseError('Invalid page ' . $matchAlias->getPageID() . ' for alias ' . $matchAlias->getID());
CMS_view::redirect(PATH_SPECIAL_PAGE_NOT_FOUND_WR, true, 301);
}
//.........这里部分代码省略.........
开发者ID:davidmottet,项目名称:automne,代码行数:101,代码来源:cms_aliases.php
示例5: treatWantedTag
//.........这里部分代码省略.........
$file = str_replace(PATH_REALROOT_FS . '/', '', PATH_JS_FS . '/CMS_functions.js');
$files = array_merge($files, array($file));
}
//append swfobject for block flash
if (is_array($usage) && isset($usage['blockflash']) && $usage['blockflash'] == true) {
$files[] = 'swfobject';
}
//save files
CMS_module::moduleUsage($treatedObject->getID(), $tag->getName(), $files, true);
break;
case "atm-css-tags":
//get old files for this tag already needed by other modules
$files = CMS_module::moduleUsage($treatedObject->getID(), "atm-css-tags");
$files = is_array($files) ? $files : array();
$media = $tag->getAttribute('media') ? $tag->getAttribute('media') : 'all';
//append module css files
if (!isset($files[$media])) {
$files[$media] = array();
}
$files[$media] = array_merge($files[$media], $tagFiles);
//save files
CMS_module::moduleUsage($treatedObject->getID(), "atm-css-tags", $files, true);
break;
}
//Create return for all saved modules files
switch ($tag->getName()) {
case "atm-js-tags":
//get old files for this tag already needed by other modules
$files = CMS_module::moduleUsage($treatedObject->getID(), "atm-js-tags");
//add files from atm-js-add tag
$filesAdd = CMS_module::moduleUsage($treatedObject->getID(), "atm-js-tags-add");
$filesAdd = is_array($filesAdd) ? $filesAdd : array();
$files = array_merge($files, $filesAdd);
$return .= '<?php echo CMS_view::getJavascript(array(\'' . implode('\',\'', array_unique($files)) . '\')); ?>' . "\n";
break;
case "atm-css-tags":
$media = $tag->getAttribute('media') ? $tag->getAttribute('media') : 'all';
//get old files for this tag already needed by other modules
$files = CMS_module::moduleUsage($treatedObject->getID(), "atm-css-tags");
//add files from atm-css-add tag
$filesAdd = CMS_module::moduleUsage($treatedObject->getID(), "atm-css-tags-add");
$filesAdd = is_array($filesAdd) ? $filesAdd : array();
if (isset($files[$media])) {
if (isset($filesAdd[$media])) {
$files[$media] = array_merge($files[$media], $filesAdd[$media]);
}
$return .= '<?php echo CMS_view::getCSS(array(\'' . implode('\',\'', array_unique($files[$media])) . '\'), \'' . $media . '\'); ?>' . "\n";
}
break;
}
return $return;
}
break;
case "atm-meta-tags":
$attributes = array();
//normalize values for attributes
if ($tag->getAttributes()) {
$attributes = $tag->getAttributes();
foreach ($attributes as $tagName => $value) {
if ($attributes == '1' || $value == 'true') {
$attributes[$tagName] = true;
} elseif ($value == '0' || $value == 'false') {
$attributes[$tagName] = false;
}
if ($attributes[$tagName] !== false && $attributes[$tagName] !== true) {
unset($attributes[$tagName]);
开发者ID:davidmottet,项目名称:automne,代码行数:67,代码来源:standard.php
示例6: _getHTMLForm
/**
* Get the HTML form given the block HTML example data.
*
* @param CMS_language &$language The language of the administration frontend
* @param CMS_page &$page The page which contains the client space
* @param CMS_clientSpace &$clientSpace The client space which contains the row
* @param CMS_row &$row The row which contains the block
* @param integer $blockID The tag ID of the block
* @param string $data The data to show as example
* @return string The HTML form which can send to the page that will modify the block
* @access private
*/
protected function _getHTMLForm($language, &$page, &$clientSpace, &$row, $blockID, $data)
{
global $cms_user;
$this->_jsBlockClass = 'Automne.blockCMS_Forms';
$rawDatas = $this->getRawData($page->getID(), $clientSpace->getTagID(), $row->getTagID(), RESOURCE_LOCATION_EDITION, false);
$datas = array('page' => isset($rawDatas['page']) ? $rawDatas['page'] : '', 'clientSpaceID' => isset($rawDatas['clientSpaceID']) ? $rawDatas['clientSpaceID'] : '', 'rowID' => isset($rawDatas['rowID']) ? $rawDatas['rowID'] : '', 'blockID' => isset($rawDatas['blockID']) ? $rawDatas['blockID'] : '', 'module' => MOD_CMS_FORMS_CODENAME);
$this->_value = $datas;
$html = parent::_getHTMLForm($language, $page, $clientSpace, $row, $blockID, '<div class="atm-form-block atm-block-helper">' . $data . '</div>');
//load interface instance
$view = CMS_view::getInstance();
//append JS block class file
if (PATH_REALROOT_WR) {
$file = str_replace(PATH_REALROOT_WR . '/', '', PATH_ADMIN_WR . '/js/edit/block-cms-forms.js');
} else {
$file = PATH_ADMIN_WR . '/js/edit/block-cms-forms.js';
}
$view->addJSFile($file);
return $html;
}
开发者ID:davidmottet,项目名称:automne,代码行数:31,代码来源:block.php
示例7: setValues
//.........这里部分代码省略.........
}
if ($params['maxZoomHeight'] && $newSizeY > $params['maxZoomHeight']) {
$newSizeX = round($params['maxZoomHeight'] * $newSizeX / $newSizeY);
$newSizeY = $params['maxZoomHeight'];
}
if (!$oImage->resize($newSizeX, $newSizeY, $filename)) {
return false;
}
}
}
//update files infos if needed
if ($this->_subfieldValues[0]->getValue() && file_exists(PATH_MODULES_FILES_FS . '/' . $moduleCodename . '/' . RESOURCE_DATA_LOCATION_EDITED . '/' . $this->_subfieldValues[0]->getValue())) {
$file = new CMS_file(PATH_MODULES_FILES_FS . '/' . $moduleCodename . '/' . RESOURCE_DATA_LOCATION_EDITED . '/' . $this->_subfieldValues[0]->getValue());
$imageDatas = array('filename' => $file->getName(false), 'filepath' => $file->getFilePath(CMS_file::WEBROOT), 'filesize' => $file->getFileSize(), 'fileicon' => $file->getFileIcon(CMS_file::WEBROOT), 'extension' => $file->getExtension());
} else {
$imageDatas = array('filename' => '', 'filepath' => '', 'filesize' => '', 'fileicon' => '', 'extension' => '');
}
$imageDatas['module'] = $moduleCodename;
$imageDatas['visualisation'] = RESOURCE_DATA_LOCATION_EDITED;
if ($params['useDistinctZoom'] || $this->_subfieldValues[2]->getValue()) {
//update files infos if needed
if ($this->_subfieldValues[2]->getValue() && file_exists(PATH_MODULES_FILES_FS . '/' . $moduleCodename . '/' . RESOURCE_DATA_LOCATION_EDITED . '/' . $this->_subfieldValues[2]->getValue())) {
$file = new CMS_file(PATH_MODULES_FILES_FS . '/' . $moduleCodename . '/' . RESOURCE_DATA_LOCATION_EDITED . '/' . $this->_subfieldValues[2]->getValue());
$zoomDatas = array('filename' => $file->getName(false), 'filepath' => $file->getFilePath(CMS_file::WEBROOT), 'filesize' => $file->getFileSize(), 'fileicon' => $file->getFileIcon(CMS_file::WEBROOT), 'extension' => $file->getExtension());
} else {
$zoomDatas = array('filename' => '', 'filepath' => '', 'filesize' => '', 'fileicon' => '', 'extension' => '');
}
$zoomDatas['module'] = $moduleCodename;
$zoomDatas['visualisation'] = RESOURCE_DATA_LOCATION_EDITED;
} else {
$zoomDatas = '';
}
$content = array('datas' => array('polymodFieldsValue[' . $prefixName . $this->_field->getID() . '_0]' => $imageDatas, 'polymodFieldsValue[' . $prefixName . $this->_field->getID() . '_2]' => $zoomDatas, 'polymodFieldsValue[' . $prefixName . $this->_field->getID() . '_1]' => sensitiveIO::decodeEntities($this->_subfieldValues[1]->getValue())));
$view = CMS_view::getInstance();
$view->addContent($content);
return true;
} else {
//Old format
//delete old images ?
if (isset($values[$prefixName . $this->_field->getID() . '_delete']) && $values[$prefixName . $this->_field->getID() . '_delete'] == 1) {
if ($this->_subfieldValues[0]->getValue()) {
@unlink(PATH_MODULES_FILES_FS . '/' . $moduleCodename . '/' . RESOURCE_DATA_LOCATION_EDITED . '/' . $this->_subfieldValues[0]->getValue());
$this->_subfieldValues[0]->setValue('');
} elseif (isset($values[$prefixName . $this->_field->getID() . '_0_hidden']) && $values[$prefixName . $this->_field->getID() . '_0_hidden']) {
@unlink(PATH_MODULES_FILES_FS . '/' . $moduleCodename . '/' . RESOURCE_DATA_LOCATION_EDITED . '/' . $values[$prefixName . $this->_field->getID() . '_0_hidden']);
$this->_subfieldValues[0]->setValue('');
}
if ($this->_subfieldValues[2]->getValue()) {
@unlink(PATH_MODULES_FILES_FS . '/' . $moduleCodename . '/' . RESOURCE_DATA_LOCATION_EDITED . '/' . $this->_subfieldValues[2]->getValue());
$this->_subfieldValues[2]->setValue('');
} elseif (isset($values[$prefixName . $this->_field->getID() . '_2_hidden']) && $values[$prefixName . $this->_field->getID() . '_2_hidden']) {
@unlink(PATH_MODULES_FILES_FS . '/' . $moduleCodename . '/' . RESOURCE_DATA_LOCATION_EDITED . '/' . $values[$prefixName . $this->_field->getID() . '_2_hidden']);
$this->_subfieldValues[2]->setValue('');
}
}
//set label from label field
if (!$this->_subfieldValues[1]->setValue(io::htmlspecialchars(@$values[$prefixName . $this->_field->getID() . '_1']))) {
return false;
}
//thumbnail
if (isset($_FILES[$prefixName . $this->_field->getID() . '_0']) && $_FILES[$prefixName . $this->_field->getID() . '_0']['name'] && !$_FILES[$prefixName . $this->_field->getID() . '_0']['error']) {
//check for image type before doing anything
if (!in_array(io::strtolower(pathinfo($_FILES[$prefixName . $this->_field->getID() . '_0']["name"], PATHINFO_EXTENSION)), $this->_allowedExtensions)) {
return false;
}
//set label as image name if none set
开发者ID:davidmottet,项目名称:automne,代码行数:67,代码来源:object_image.php
示例8: setValues
/**
* set object Values
*
* @param array $values : the POST result values
* @param string $prefixname : the prefix used for post names
* @param boolean newFormat : new automne v4 format (default false for compatibility)
* @param integer $objectID : the current object id. Must be set, but default is blank for compatibility with other objects
* @return boolean true on success, false on failure
* @access public
*/
function setValues($values, $prefixName, $newFormat = false, $objectID = '')
{
if (!sensitiveIO::isPositiveInteger($objectID)) {
$this->raiseError('ObjectID must be a positive integer : ' . $objectID);
return false;
}
//get module codename
$moduleCodename = CMS_poly_object_catalog::getModuleCodenameForField($this->_field->getID());
//create a sub prefix for CMS_dialog_href object
$subPrefixName = 'href' . $prefixName . $this->_field->getID() . '_0';
//create object CMS_href & CMS_dialog_href
$hrefDialog = new CMS_dialog_href(new CMS_href($this->_subfieldValues[0]->getValue()), $subPrefixName);
if ($newFormat) {
$hrefDialog->create($values[$subPrefixName], $moduleCodename, $objectID, $this->_field->getID());
if ($hrefDialog->hasError()) {
return false;
}
$href = $hrefDialog->getHREF();
if (!$this->_subfieldValues[0]->setValue($href->getTextDefinition())) {
return false;
}
$content = array('datas' => array('polymodFieldsValue[' . $subPrefixName . ']' => sensitiveIO::decodeEntities($this->_subfieldValues[0]->getValue())));
$view = CMS_view::getInstance();
$view->addContent($content);
} else {
//check for http://
if ($values[$subPrefixName . 'link_external'] && io::strpos($values[$subPrefixName . 'link_external'], 'http://') !== 0) {
$values[$subPrefixName . 'link_external'] = 'http://' . $values[$subPrefixName . 'link_external'];
}
$hrefDialog->doPost($moduleCodename, $objectID, $this->_field->getID());
if ($hrefDialog->hasError()) {
return false;
}
$href = $hrefDialog->getHREF();
if (!$this->_subfieldValues[0]->setValue($href->getTextDefinition())) {
return false;
}
}
return true;
}
开发者ID:davidmottet,项目名称:automne,代码行数:50,代码来源:object_href.php
示例9: setValues
//.........这里部分代码省略.........
//convert in MB
$filesize = round($filesize / 1048576, 2);
} else {
$filesize = '0';
}
if (!$this->_subfieldValues[2]->setValue($filesize)) {
return false;
}
}
}
// If label not set yet, set it
if (!$this->_subfieldValues[0]->getValue()) {
if ($this->_subfieldValues[4]->getValue()) {
$this->_subfieldValues[0]->setValue($this->_subfieldValues[4]->getValue());
}
}
//update files infos if needed
if ($this->_subfieldValues[1]->getValue() && file_exists(PATH_MODULES_FILES_FS . '/' . $moduleCodename . '/' . RESOURCE_DATA_LOCATION_EDITED . '/' . $this->_subfieldValues[1]->getValue())) {
$file = new CMS_file(PATH_MODULES_FILES_FS . '/' . $moduleCodename . '/' . RESOURCE_DATA_LOCATION_EDITED . '/' . $this->_subfieldValues[1]->getValue());
$imageDatas = array('filename' => $file->getName(false), 'filepath' => $file->getFilePath(CMS_file::WEBROOT), 'filesize' => $file->getFileSize(), 'fileicon' => $file->getFileIcon(CMS_file::WEBROOT), 'extension' => $file->getExtension());
} else {
$imageDatas = array('filename' => '', 'filepath' => '', 'filesize' => '', 'fileicon' => '', 'extension' => '');
}
//update files infos if needed
if ($this->_subfieldValues[4]->getValue() && file_exists(PATH_MODULES_FILES_FS . '/' . $moduleCodename . '/' . RESOURCE_DATA_LOCATION_EDITED . '/' . $this->_subfieldValues[4]->getValue())) {
$file = new CMS_file(PATH_MODULES_FILES_FS . '/' . $moduleCodename . '/' . RESOURCE_DATA_LOCATION_EDITED . '/' . $this->_subfieldValues[4]->getValue());
$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' => '');
}
$imageDatas['module'] = $fileDatas['module'] = $moduleCodename;
$imageDatas['visualisation'] = $fileDatas['visualisation'] = RESOURCE_DATA_LOCATION_EDITED;
$content = array('datas' => array('polymodFieldsValue[' . $prefixName . $this->_field->getID() . '_1]' => $imageDatas, 'polymodFieldsValue[' . $prefixName . $this->_field->getID() . '_4]' => $fileDatas, 'polymodFieldsValue[' . $prefixName . $this->_field->getID() . '_externalfile]' => '', 'polymodFieldsValue[' . $prefixName . $this->_field->getID() . '_0]' => sensitiveIO::decodeEntities($this->_subfieldValues[0]->getValue())));
$view = CMS_view::getInstance();
$view->addContent($content);
return true;
} else {
//Old format
//delete old files ?
if (isset($values[$prefixName . $this->_field->getID() . '_delete']) && $values[$prefixName . $this->_field->getID() . '_delete'] == 1) {
//thumbnail
if ($this->_subfieldValues[1]->getValue()) {
@unlink(PATH_MODULES_FILES_FS . '/' . $moduleCodename . '/' . RESOURCE_DATA_LOCATION_EDITED . '/' . $this->_subfieldValues[1]->getValue());
$this->_subfieldValues[1]->setValue('');
} elseif ($values[$prefixName . $this->_field->getID() . '_1_hidden']) {
@unlink(PATH_MODULES_FILES_FS . '/' . $moduleCodename . '/' . RESOURCE_DATA_LOCATION_EDITED . '/' . $values[$prefixName . $this->_field->getID() . '_1_hidden']);
$this->_subfieldValues[1]->setValue('');
}
//file
if ($this->_subfieldValues[4]->getValue()) {
@unlink(PATH_MODULES_FILES_FS . '/' . $moduleCodename . '/' . RESOURCE_DATA_LOCATION_EDITED . '/' . $this->_subfieldValues[4]->getValue());
$this->_subfieldValues[4]->setValue('');
} elseif ($values[$prefixName . $this->_field->getID() . '_4_hidden']) {
@unlink(PATH_MODULES_FILES_FS . '/' . $moduleCodename . '/' . RESOURCE_DATA_LOCATION_EDITED . '/' . $values[$prefixName . $this->_field->getID() . '_4_hidden']);
$this->_subfieldValues[4]->setValue('');
}
//reset filesize
if (!$this->_subfieldValues[2]->setValue(0)) {
return false;
}
}
if (!(isset($values[$prefixName . $this->_field->getID() . '_0']) && $this->_subfieldValues[0]->setValue(io::htmlspecialchars($values[$prefixName . $this->_field->getID() . '_0'])))) {
return false;
}
//thumbnail
if (isset($_FILES[$prefixName . $this->_field->getID() . '_1']) && $_FILES[$prefixName . $this->_field->getID() . '_1']['name'] && !$_FILES[$prefixName . $this->_field->getID() . '_1']['error']) {
开发者ID:davidmottet,项目名称:automne,代码行数:67,代码来源:object_file.php
示例10: clearstatcache
if (file_exists($pageURL)) {
$redirectTo = $page->getURL(substr($basename, 0, 5) == 'print' ? true : false);
} else {
//try to regenerate page
if ($page->regenerate(true)) {
clearstatcache();
if (file_exists($pageURL)) {
$redirectTo = $page->getURL(substr($basename, 0, 5) == 'print' ? true : false);
}
}
}
}
}
//do redirection to page if found
if ($redirectTo) {
CMS_view::redirect($redirectTo . (isset($_SERVER['REDIRECT_QUERY_STRING']) ? '?' . $_SERVER['REDIRECT_QUERY_STRING'] : ''), true, 301);
}
//then if no page found, display 404 error page
header('HTTP/1.x 404 Not Found', true, 404);
//Check if requested file is an image
$imagesExtensions = array('jpg', 'jpeg', 'gif', 'png', 'ico');
if (isset($pathinfo['extension']) && in_array(strtolower($pathinfo['extension']), $imagesExtensions)) {
if (file_exists(PATH_REALROOT_FS . '/img/404.png')) {
CMS_file::downloadFile(PATH_REALROOT_FS . '/img/404.png');
}
}
//send an email if needed
if (ERROR404_EMAIL_ALERT && sensitiveIO::isValidEmail(APPLICATION_MAINTAINER_EMAIL)) {
$body = "A 404 Error occured on your website.\n";
$body .= "\n\n";
$body .= 'The requested file : ' . CMS_websitesCatalog::getMainURL() . $_SERVER['REQUEST_URI'] . ' was not found.' . "\n\n";
开发者ID:davidmottet,项目名称:automne,代码行数:31,代码来源:404.php
示例11: setSoapValues
/**
* Set user by xml definition. Return XML
*
* @access public
* @param string $xmlInput XML definition to define user properties
* @return boolean True on success, false on failure
*/
function setSoapValues($domdocument)
{
$view = CMS_view::getInstance();
$contactData = new CMS_contactData();
$currentPassword = '';
$newGroups = array();
foreach ($domdocument->childNodes as $childNode) {
if ($childNode->nodeType == XML_ELEMENT_NODE) {
switch ($childNode->tagName) {
case 'contactData':
foreach ($childNode->childNodes as $cdChildNode) {
if ($cdChildNode->nodeType == XML_ELEMENT_NODE) {
if (!$contactData->setValue($cdChildNode->tagName, $cdChildNode->nodeValue)) {
$view->addError('Invalid value for contactData tag ' . $cdChildNode->tagName . ' and value ' . $cdChildNode->nodeValue);
return false;
}
} elseif ($cdChildNode->nodeType == XML_TEXT_NODE && trim($cdChildNode->nodeValue)) {
$view->addError('Unknown xml content contactData tag ' . $cdChildNode->nodeValue . ' to process.');
return false;
}
}
break;
case 'groups':
foreach ($childNode->childNodes as $groupChildNode) {
if ($groupChildNode->nodeType == XML_ELEMENT_NODE) {
$group = CMS_profile_usersGroupsCatalog::getByID($groupChildNode->nodeValue);
if ($group && !$group->hasError()) {
$newGroups[$group->getGroupId()] = $group->getGroupId();
} else {
$view->addError('Unknown group ID ' . $groupChildNode->nodeValue . '.');
return false;
}
} elseif ($cdChildNode->nodeType == XML_TEXT_NODE && trim($cdChildNode->nodeValue)) {
$view->addError('Unknown xml content contactData tag ' . $cdChildNode->nodeValue . ' to process.');
return false;
}
}
break;
default:
if (!$this->setValue($childNode->tagName, $childNode->nodeValue)) {
$view->addError('Invalid value for tag ' . $childNode->tagName . ' and value ' . $childNode->nodeValue);
return false;
}
if ($childNode->tagName == 'password') {
$currentPassword = $childNode->nodeValue;
}
break;
}
} elseif ($childNode->nodeType == XML_TEXT_NODE && trim($childNode->nodeValue)) {
$view->addError('Unknown xml content tag ' . $childNode->nodeValue . ' to process.');
return false;
}
}
// Check user required fields.
if ($this->hasError()) {
$view->addError('Values to set are invalid.');
return false;
}
if ($currentPassword == $this->getValue('login')) {
$view->addError('Login and password must be different.');
return false;
}
if ($this->getValue('login') && $contactData->getValue('email')) {
// Save contact data object
if ($contactData->writeToPersistence() && $this->setValue('contactData', $contactData)) {
// Get current user groups ids
$userGroupIds = CMS_profile_usersGroupsCatalog::getGroupsOfUser($this, true, true);
// First reset profile clearances
$this->resetClearances();
// Second, loop through user groups to remove group
foreach ($userGroupIds as $oldGroupId) {
if (!in_array($oldGroupId, $newGroups)) {
// Remove user to group
$oldGroup = CMS_profile_usersGroupsCatalog::getByID($oldGroupId);
if (!$oldGroup->removeUser($this) || !$oldGroup->writeToPersistence()) {
$view->addError('Error deleting user\'s group : ' . $oldGroupId);
return false;
}
}
}
// Third, loop through user groups to add groups
foreach ($newGroups as $newGroupId) {
if (!in_array($newGroupId, $userGroupIds)) {
$newGroup = CMS_profile_usersGroupsCatalog::getByID($newGroupId);
if ($newGroup && !$newGroup->hasError()) {
// Add group to user
$this->addGroup($newGroupId);
} else {
$view->addError('Error adding user\'s group : ' . $newGroupId);
return false;
}
}
}
//.........这里部分代码省略.........
开发者ID:davidmottet,项目名称:automne,代码行数:101,代码来源:profileuser.php
示例12: catch
}
/*close login window*/
Ext.WindowMgr.get(\'loginWindow\').close();';
//eval content into parent
$jscontent = '
try {delete parent.Ext.Element.cache[\'loginField\'];} catch (e) {}
parent.eval(\'' . sensitiveIO::sanitizeJSString($jscontent, true) . '\');';
$view->addJavascript($jscontent);
$view->show(CMS_view::SHOW_HTML);
} else {
//Disconnect user
CMS_session::authenticate(array('disconnect' => true, 'type' => 'admin'));
//Reset session (start fresh)
Zend_Session::destroy();
//Redirect
CMS_view::redirect($_SERVER['SCRIPT_NAME'] . '?cms_action=wrongcredentials', true, 301);
}
break;
case 'wrongcredentials':
//display error login window on top of login form
$loginError = "\n\t\tparent.Automne.message.popup({\n\t\t\tmsg: '{$cms_language->getJsMessage(MESSAGE_ERROR_LOGIN_INCORRECT)}',\n\t\t\tbuttons: Ext.MessageBox.OK,\n\t\t\ticon: Ext.MessageBox.ERROR,\n\t\t\tfn:function() {\n\t\t\t\tExt.fly('loginField').dom.select();\n\t\t\t}\n\t\t});";
break;
}
//Send Login form frame window (in which login form is displayed)
//set main and ext CSS
$view->addCSSFile('ext');
$view->addCSSFile('main');
$view->addCSSFile('codemirror');
if (SYSTEM_DEBUG) {
$view->addCSSFile('debug');
}
开发者ID:davidmottet,项目名称:automne,代码行数:31,代码来源:login-form.php
示例13: while
}
$rootPage = $website->getRoot();
if ($rootPage->getPublication() == RESOURCE_PUBLICATION_PUBLIC) {
//redirect to subpage if any
$redirectlink = $rootPage->getRedirectLink(true);
while ($redirectlink && $redirectlink->hasValidHREF() && sensitiveIO::IsPositiveInteger($redirectlink->getInternalLink())) {
$rootPage = new CMS_page($redirectlink->getInternalLink());
if ($rootPage->getPublication() == RESOURCE_PUBLICATION_PUBLIC) {
$redirectlink = $rootPage->getRedirectLink(true);
} else {
$redirectlink = '';
}
}
}
$pPath = $rootPage->getHTMLURL(false, false, PATH_RELATIVETO_FILESYSTEM);
if ($pPath) {
if (file_exists($pPath)) {
$cms_page_included = true;
require $pPath;
exit;
} elseif ($rootPage->regenerate(true)) {
clearstatcache();
if (file_exists($pPath)) {
$cms_page_included = true;
require $pPath;
exit;
}
}
}
CMS_view::redirect(PATH_SPECIAL_PAGE_NOT_FOUND_WR, true, 301);
开发者ID:davidmottet,项目名称:automne,代码行数:30,代码来源:index.php
示例14: array
$jsfiles = array('ext', 'debug', 'codemirror', 'main');
} else {
$jsfiles = array('ext', 'codemirror', 'main');
}
//set title
$view->setTitle($language->getMessage(MESSAGE_PAGE_TITLE, array(APPLICATION_LABEL)));
$content = '
<div id="atm-loading-mask"></div>
<div id="atm-center">
<div class="atm-loading-indicator">' . $language->getMessage(MESSAGE_PAGE_LOADING) . '</div>
<noscript class="atm-alert">You must have Javascript enabled to access Automne.<hr />Vous devez avoir Javascript actif pour accéder à Automne.</noscript>
</div>
<script type="text/javascript">
var CKEDITOR_BASEPATH = \'' . PATH_MAIN_WR . '/ckeditor/\';
</script>
' . CMS_view::getJavascript($jsfiles) . CMS_view::getJavascript(array('popup'));
if (APPLICATION_GCF_SUPPORT) {
//GCF prompt for IE
$content .= '
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js"></script>
<style type="text/css">
.chromeFrameOverlayContent {
z-index:200001;
}
</style>
<script type="text/javascript">
CFInstall.check({mode: "overlay"});
</script>';
}
//Page content
开发者ID:davidmottet,项目名称:automne,代码行数:31,代码来源:popup.php
示例15: pr
/**
* Usefull function to dump a var.
*/
function pr($data, $useVarDump = false)
{
//$data .= ' ('.io::getCallInfos().')';
$view = CMS_view::getInstance();
if (!$useVarDump) {
$view->addRawData(print_r($data, true));
} else {
ob_start();
var_dump($data);
$rawdata = ob_get_contents();
ob_end_clean();
$view->addRawData($rawdata);
}
}
开发者ID:davidmottet,项目名称:automne,代码行数:17,代码来源:cms_rc.php
示例16: def |
请发表评论