本文整理汇总了PHP中CMS_view::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP CMS_view::getInstance方法的具体用法?PHP CMS_view::getInstance怎么用?PHP CMS_view::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMS_view
的用法示例。
在下文中一共展示了CMS_view::getInstance方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例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;
}
示例3: defined
* @subpackage admin
* @author Sébastien Pauchet <sebastien.pauchet@ws-interactive.fr>
*/
//does this file is directly included by another automne script ?
$included = defined('APPLICATION_CONFIG_LOADED') ? true : false;
if (!$included) {
if (file_exists(dirname(__FILE__) . '/../upload-vault/allow_front_update')) {
//in case of update patch which destroy admin user session, we need to allow
//this file with frontend rights
@unlink(dirname(__FILE__) . '/../upload-vault/allow_front_update');
require_once dirname(__FILE__) . '/../../cms_rc_frontend.php';
} else {
require_once dirname(__FILE__) . '/../../cms_rc_admin.php';
}
//load interface instance
$view = CMS_view::getInstance();
//set default display mode for this page
$view->setDisplayMode(CMS_view::SHOW_HTML);
}
$content = '';
$content .= "<pre>Start update of Automne database ... <br />";
//START UPDATE FROM 4.0.2 TO 4.1.0
if (!function_exists('atm_regen')) {
function atm_regen()
{
}
}
if (!defined('APPLICATION_CONFIG_LOADED')) {
define('APPLICATION_CONFIG_LOADED', true);
}
# Change structure of some tables to add uuid data
示例4: _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;
}
示例5: _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;
}
}
示例6: 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);
}
}
示例7: setSoapValues
/**
* Get soap values
*
* @param integer $fieldID The field ID
* @param object $language The CMS_language to deal with
* @param string $xml Values to set
*
* @return boolean true on success, false on failure
* @access public
*/
function setSoapValues($fieldID, $domdocument)
{
$view = CMS_view::getInstance();
$return = true;
$itemId = '';
// Fields
foreach ($domdocument->childNodes as $childNode) {
if ($childNode->nodeType == XML_ELEMENT_NODE) {
switch ($childNode->tagName) {
case 'field':
//<field id="40" label="Identifiant" required="1">
$fieldId = $childNode->getAttribute('id');
if (!sensitiveIO::isPositiveInteger($fieldId)) {
$view->addError('Missing or invalid attribute id for field tag');
return false;
}
if (!isset($this->_objectValues[$fieldId])) {
$view->addError('Unknown field id ' . $fieldId . ' for object ' . $this->_objectID);
return false;
}
// Check if field requires itemID to set values
if (method_exists($this->_objectValues[$fieldId], 'needIDToSetValues')) {
if (!$this->getID()) {
//if object has no id yet, save it
if (!$this->writeToPersistence(false, false, true)) {
$view->addError('Error during saving process (pre-saving need for the field ' . $this->_objectID . ')');
return false;
}
}
$itemId = $this->getID();
}
if (!$this->_objectValues[$fieldId]->setSoapValues($fieldId, $childNode, $itemId)) {
$view->addError('Unable to set values for field ' . $fieldId);
$return = false;
}
break;
case 'resource':
//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;
}
}
}
return $return;
}
示例8: 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
示例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']) {
示例10: 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;
}
}
}
//.........这里部分代码省略.........
示例11: treatWantedTag
//.........这里部分代码省略.........
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]);
}
}
}
$metaDatas = $treatedObject->getMetaTags($visualizationMode == PAGE_VISUALMODE_HTML_PUBLIC, $attributes);
$usage = CMS_module::moduleUsage($treatedObject->getID(), $this->_codename);
//if page template already use atm-js-tags tag, no need to add JS again
if (!is_array($usage) || !isset($usage['atm-js-tags'])) {
$metaDatas .= ' <script type="text/javascript" src="' . PATH_REALROOT_WR . '/js/CMS_functions.js"></script>' . "\n";
//save JS handled
CMS_module::moduleUsage($treatedObject->getID(), $this->_codename, array('js-files' => true));
}
if ($visualizationMode == PAGE_VISUALMODE_FORM) {
global $cms_user;
$isValidator = is_object($cms_user) && $cms_user->hasPageClearance($treatedObject->getID(), CLEARANCE_PAGE_EDIT) && $cms_user->hasValidationClearance(MOD_STANDARD_CODENAME) ? 'true' : 'false';
//add needed javascripts
$metaDatas .= '<script type="text/javascript">' . "\n" . 'var atmRowsDatas = {};' . "\n" . 'var atmBlocksDatas = {};' . "\n" . 'var atmCSDatas = {};' . "\n" . 'var atmIsValidator = ' . $isValidator . ';' . "\n" . 'var atmIsValidable = true;' . "\n" . 'var atmHasPreview = true;' . "\n" . 'var atmHasPreview = true;' . "\n" . 'var CKEDITOR_BASEPATH = \'' . PATH_MAIN_WR . '/ckeditor/\';' . "\n" . '</script>';
//append JS from current view instance
$view = CMS_view::getInstance();
$metaDatas .= $view->getJavascript();
$metaDatas .= CMS_view::getCSS(array('edit'));
} else {
if ($visualizationMode == PAGE_VISUALMODE_CLIENTSPACES_FORM) {
//add needed javascripts
$metaDatas .= '<script type="text/javascript">' . "\n" . 'var atmRowsDatas = {};' . "\n" . 'var atmBlocksDatas = {};' . "\n" . 'var atmCSDatas = {};' . "\n" . 'var atmIsValidator = false;' . "\n" . 'var atmIsValidable = false;' . "\n" . 'var atmHasPreview = false;' . "\n" . 'var CKEDITOR_BASEPATH = \'' . PATH_MAIN_WR . '/ckeditor/\';' . "\n" . '</script>';
//append JS from current view instance
$view = CMS_view::getInstance();
$metaDatas .= $view->getJavascript();
$metaDatas .= CMS_view::getCSS(array('edit'));
}
}
//if page template already use atm-js-tags tag, no need to add JS again
if (!is_array($usage) || !isset($usage['atm-js-tags'])) {
//if this page use a row block of this module then add the header code to the page
if (is_array($usage) && isset($usage['blockflash']) && $usage['blockflash'] == true) {
$metaDatas .= '<script type="text/javascript" src="' . PATH_MAIN_WR . '/swfobject/swfobject.js"></script>' . "\n";
}
}
return $metaDatas;
break;
}
return '';
break;
case MODULE_TREATMENT_WYSIWYG_INNER_TAGS:
if ($tag->getName() == 'atm-linx') {
//linx from standard module
$domdocument = new CMS_DOMDocument();
try {
$domdocument->loadXML('<html>' . $tag->getContent() . '</html>');
} catch (DOMException $e) {
$this->raiseError('Parse error for atm-linx : ' . $e->getMessage() . " :\n" . io::htmlspecialchars($tag->getContent()));
示例12: quit
/**
* Quit : global shutdown function for the application
* Send errors present in stack
*
* @return void
* @access public
* @static
*/
static function quit()
{
//check for error to be released
$view = CMS_view::getInstance();
if (!$view->isSent() && $view->getDisplayMode() != self::SHOW_HTML) {
$view->show();
}
if ($view->hasErrors()) {
echo $view->getErrors();
}
if ($view->hasRawDatas()) {
echo $view->getRawDatas();
}
exit;
}