本文整理汇总了PHP中sensitiveIO类的典型用法代码示例。如果您正苦于以下问题:PHP sensitiveIO类的具体用法?PHP sensitiveIO怎么用?PHP sensitiveIO使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了sensitiveIO类的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: setParameters
/**
* Set the script informations.
*
* @return boolean true on success, false on failure
* @access public
*/
function setParameters($module, $parameters)
{
if (!$this->_scriptName) {
return false;
}
$sql = "\n\t\t\tupdate\n\t\t\t\tscriptsStatuses\n\t\t\tset\n\t\t\t\tmodule_ss='" . sensitiveIO::sanitizeSQLString($module) . "',\n\t\t\t\tparameters_ss='" . sensitiveIO::sanitizeSQLString($parameters) . "'\n\t\t\twhere\n\t\t\t\tscriptName_ss='" . $this->_scriptName . "'";
$q = new CMS_query($sql);
return true;
}
示例3: getHTMLAdmin
/**
* get HTML admin (used to enter object values in admin)
*
* @param integer $fieldID, the current field id (only for poly object compatibility)
* @param CMS_language $language, the current admin language
* @param string prefixname : the prefix to use for post names
* @return string : the html admin
* @access public
*/
function getHTMLAdmin($fieldID, $language, $prefixName)
{
//get module codename
$moduleCodename = CMS_poly_object_catalog::getModuleCodenameForField($this->_field->getID());
//is this field mandatory ?
$mandatory = $this->_field->getValue('required') ? '<span class="atm-red">*</span> ' : '';
$desc = $this->getFieldDescription($language);
if (POLYMOD_DEBUG) {
$values = array();
foreach (array_keys($this->_subfieldValues) as $subFieldID) {
if (is_object($this->_subfieldValues[$subFieldID])) {
$values[$subFieldID] = sensitiveIO::ellipsis(strip_tags($this->_subfieldValues[$subFieldID]->getValue()), 50);
}
}
$desc .= $desc ? '<br />' : '';
$desc .= '<span class="atm-red">Field : ' . $fieldID . ' - Value(s) : <ul>';
foreach ($values as $subFieldID => $value) {
$desc .= '<li>' . $subFieldID . ' : ' . $value . '</li>';
}
$desc .= '</ul></span>';
}
$label = $desc ? '<span class="atm-help" ext:qtip="' . io::htmlspecialchars($desc) . '">' . $mandatory . $this->getFieldLabel($language) . '</span>' : $mandatory . $this->getFieldLabel($language);
$ids = 'oembed-' . md5(mt_rand() . microtime());
$oembedURL = PATH_ADMIN_MODULES_WR . '/' . MOD_POLYMOD_CODENAME . '/oembed.php';
$loadingURL = PATH_ADMIN_IMAGES_WR . '/loading-old.gif';
$params = $this->getParamsValues();
$fields = array();
$fields[] = array('fieldLabel' => '<span class="atm-help" ext:qtip="' . io::htmlspecialchars($language->getMessage(self::MESSAGE_OBJECT_OEMBED_MEDIA_URL_DESC, false, MOD_POLYMOD_CODENAME)) . '">' . $language->getMessage(self::MESSAGE_OBJECT_OEMBED_MEDIA_URL, false, MOD_POLYMOD_CODENAME) . '</span>', 'xtype' => 'textfield', 'name' => 'polymodFieldsValue[' . $prefixName . $this->_field->getID() . '_0]', 'value' => $this->_subfieldValues[0]->getValue() ? sensitiveIO::decodeEntities($this->_subfieldValues[0]->getValue()) : '', 'enableKeyEvents' => true, 'listeners' => array('blur' => array('fn' => sensitiveIO::sanitizeJSString('function(el){
/*call server for oembed HTML content*/
Ext.get(\'' . $ids . '-view\').update(\'<img src="' . $loadingURL . '" />\');
Automne.server.call({
url: \'' . $oembedURL . '\',
scope: this,
fcnCallback: function(response, options, htmlResponse){
Ext.get(\'' . $ids . '-view\').update(htmlResponse);
},
params: {
module: \'' . $moduleCodename . '\',
url: el.getValue(),
width: 600,
height: 250,
key: \'' . $params['embedlyKey'] . '\'
}
});
}', false, false), 'buffer' => 600)));
$fields[] = array('xtype' => 'panel', 'border' => false, 'html' => '<div id="' . $ids . '-view" style="overflow:auto;text-align:center;">' . ($this->getValue('hasValue') ? $this->getValue('html', '600,250') : '') . '</div>');
$return = array();
$return = array('title' => $label, 'xtype' => 'fieldset', 'autoHeight' => true, 'defaultType' => 'textfield', 'defaults' => array('anchor' => '97%', 'allowBlank' => !$this->_field->getValue('required')), 'items' => $fields);
return $return;
}
示例4: 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;
}
}
}
}
//.........这里部分代码省略.........
示例5: ob_start
$view->setContent($datas);
$edited = true;
} else {
CMS_grandFather::raiseError('Can\'t get row type ' . $rowId . ' from clientspace ' . $cs . ' of page ' . $cms_page->getID() . ' with row id ' . $rowTag);
$view->setActionMessage($cms_language->getJsMessage(MESSAGE_PAGE_ERROR_UPDATE_BLOCK_CONTENT));
}
} else {
CMS_grandFather::raiseError('Can\'t get block class type ' . $blockClass . ' to update content');
$view->setActionMessage($cms_language->getJsMessage(MESSAGE_PAGE_ERROR_UPDATE_BLOCK_CONTENT));
}
break;
default:
CMS_grandFather::raiseError('Unknown action ' . $action . ' to do for page ' . $currentPage);
$view->show();
break;
}
//set user message if any
if (isset($cms_message) && $cms_message) {
$view->setActionMessage($cms_message);
}
//Eval PHP content if any
$content = $view->getContent();
if (io::strpos($content, '<?php') !== false) {
ob_start();
$content = sensitiveIO::evalPHPCode($content);
$return = ob_get_clean();
$content = $return . $content;
//set datas as returned content
$view->setContent($content);
}
$view->show();
示例6: _sortIds
/**
* Sort and limit found ids by orders and limit clauses
* This method limit results to existant objects too
*
* @access private
* @return array of object ids sorted
*/
protected function _sortIds()
{
$statusSuffix = $this->_public ? "_public" : "_edited";
$ids = array();
if ($this->_orderConditions) {
//reverse order conditions (needed to get natural order)
$orderConditions = array_reverse($this->_orderConditions, true);
//loop on each order conditions
foreach ($orderConditions as $type => $value) {
$sql = '';
if (!isset($value['direction']) || !$value['direction']) {
$value['direction'] = 'asc';
}
if (!isset($value['operator']) || !$value['operator']) {
$value['operator'] = '';
}
$direction = $value['direction'];
$operator = $value['operator'];
//add previously found ids to where clause
if (is_array($this->_resultsIds) && $this->_resultsIds) {
//update tmp table with found ids
$this->_updateTmpList($this->_resultsIds);
$where = ' and objectID in (' . $this->_getSQLTmpList() . ')';
} else {
$where = '';
}
switch ($type) {
case "publication date after":
// Date start
// Date start
case "publication date before":
// Date start
// Date start
case "publication date start":
// Date start
$sql = "\n\t\t\t\t\t\t\t\tselect\n\t\t\t\t\t\t\t\t\tdistinct objectID\n\t\t\t\t\t\t\t\tfrom\n\t\t\t\t\t\t\t\t\tmod_subobject_integer" . $statusSuffix . ",\n\t\t\t\t\t\t\t\t\tresources,\n\t\t\t\t\t\t\t\t\tresourceStatuses\n\t\t\t\t\t\t\t\twhere\n\t\t\t\t\t\t\t\t\tobjectFieldID = '0'\n\t\t\t\t\t\t\t\t\tand value = id_res\n\t\t\t\t\t\t\t\t\tand status_res=id_rs\n\t\t\t\t\t\t\t\t\t{$where}\n\t\t\t\t\t\t\t\torder by publicationDateStart_rs " . $direction;
break;
case "publication date end":
// Date end
$sql = "\n\t\t\t\t\t\t\t\tselect\n\t\t\t\t\t\t\t\t\tdistinct objectID\n\t\t\t\t\t\t\t\tfrom\n\t\t\t\t\t\t\t\t\tmod_subobject_integer" . $statusSuffix . ",\n\t\t\t\t\t\t\t\t\tresources,\n\t\t\t\t\t\t\t\t\tresourceStatuses\n\t\t\t\t\t\t\t\twhere\n\t\t\t\t\t\t\t\t\tobjectFieldID = '0'\n\t\t\t\t\t\t\t\t\tand value = id_res\n\t\t\t\t\t\t\t\t\tand status_res=id_rs\n\t\t\t\t\t\t\t\t\t{$where}\n\t\t\t\t\t\t\t\torder by publicationDateEnd_rs " . $direction;
break;
case 'objectID':
$ids = $ids ? $ids : $this->_resultsIds;
ksort($ids, SORT_NUMERIC);
$ids = $direction == 'asc' ? $ids : array_reverse($ids, true);
break;
case 'itemsOrdered':
$orderedIds = $direction == 'asc' ? $this->_orderConditions['itemsOrdered']['order'] : array_reverse($this->_orderConditions['itemsOrdered']['order'], true);
$ids = array_intersect($orderedIds, $ids ? $ids : $this->_resultsIds);
unset($orderedIds);
break;
case 'random':
$tmpIds = $ids ? $ids : $this->_resultsIds;
shuffle($tmpIds);
$ids = array();
foreach ($tmpIds as $id) {
$ids[$id] = $id;
}
break;
case "relevance":
//this order condition is replaced by an itemsOrdered order at the end of _getIds method
break;
default:
if (sensitiveIO::isPositiveInteger($type)) {
if (!isset($this->_fieldsDefinitions[$type]) || !is_object($this->_fieldsDefinitions[$type])) {
//get object fields definition
$this->_fieldsDefinitions = CMS_poly_object_catalog::getFieldsDefinition($this->_object->getID());
}
if (isset($this->_fieldsDefinitions[$type])) {
//get type object for field
$objectField = $this->_fieldsDefinitions[$type]->getTypeObject();
$operator = isset($operator) ? $operator : '';
$sql = $objectField->getFieldOrderSQL($type, $direction, $operator, $where, $this->_public);
} else {
$this->raiseError('Unknown field ' . $type . ' to use as order with value ' . print_r($value, true));
}
}
break;
}
if ($sql) {
if (isset($ids) && $ids) {
$sql .= " , field(objectID, " . implode(',', array_reverse($ids)) . ") desc ";
}
$q = new CMS_query($sql);
$orderedIds = array();
if (!$q->hasError()) {
//save ordered ids
while ($id = $q->getValue('objectID')) {
$orderedIds[$id] = $id;
}
}
$ids = $orderedIds;
}
//.........这里部分代码省略.........
示例7: getHTML
/**
* Get : a full XHTML a tag
*
* @param string $module If false, only returns the filename
* @param string $dataLocation Where does the data lies ? @see CMS_resource constants
* @param string $attrs, any attributes to append into A tag
* @return string, the XHTML Tag
* @access public
*/
function getHTML($label = false, $module = MOD_STANDARD_CODENAME, $dataLocation = RESOURCE_DATA_LOCATION_EDITED, $attrs = false, $hrefOnly = false)
{
if ($label) {
$this->_label = $label;
}
// Building href
$s = '';
$href = '';
$onClick = '';
switch ($this->_linkType) {
case RESOURCE_LINK_TYPE_INTERNAL:
// Get internal page URL
switch ($dataLocation) {
case RESOURCE_DATA_LOCATION_PUBLIC:
case RESOURCE_DATA_LOCATION_EDITED:
default:
if (sensitiveIO::isPositiveInteger($this->_internalLink) && ($href = CMS_tree::getPageValue($this->_internalLink, 'url'))) {
$href = PATH_PAGES_WR && strpos($href, PATH_PAGES_WR) !== false || stripos($href, 'http') !== false ? $href : PATH_PAGES_WR . $href;
}
break;
}
// Set a popup link, not a trivial link
if (isset($this->_popup['width']) && isset($this->_popup['height']) && $this->_popup['width'] > 0 && $this->_popup['height'] > 0) {
$onClick = "javascript:CMS_openPopUpPage('" . $href . "', 'popup_page', " . $this->_popup['width'] . ", " . $this->_popup['height'] . ");return false;";
}
break;
case RESOURCE_LINK_TYPE_EXTERNAL:
$href = io::htmlspecialchars($this->_externalLink);
$href = str_replace('&', '&', $href);
if (strtolower(substr($href, 0, 4)) != 'http') {
$href = 'http://' . $href;
}
// Set a popup link, not a trivial link
if (isset($this->_popup['width']) && $this->_popup['width'] > 0 && isset($this->_popup['height']) && $this->_popup['height'] > 0) {
$onClick = "javascript:CMS_openPopUpPage('" . $href . "', 'external', " . $this->_popup['width'] . ", " . $this->_popup['height'] . ");return false;";
}
break;
case RESOURCE_LINK_TYPE_FILE:
if (is_file($this->getFileLink(true, $module, $dataLocation, PATH_RELATIVETO_FILESYSTEM))) {
$href = $this->getFileLink(true, $module, $dataLocation, PATH_RELATIVETO_WEBROOT);
// Set a popup link, not a trivial link
if (isset($this->_popup['width']) && $this->_popup['width'] > 0 && isset($this->_popup['height']) && $this->_popup['height'] > 0) {
$onClick = "javascript:CMS_openPopUpPage('" . $href . "', 'file', " . $this->_popup['width'] . ", " . $this->_popup['height'] . ");return false;";
}
}
break;
}
if ($hrefOnly) {
return $href;
}
if ($this->_target) {
$target = ' target="' . $this->_target . '"';
}
// Get onClick
if ($onClick != '') {
$onClick = ' onClick="' . $onClick . '"';
}
// Return Link
if (trim($href) != '') {
if (!$attrs) {
$attrs = $this->getAttributesString();
}
$attrs = ' ' . trim($attrs);
$s = '<a href="' . $href . '"' . $onClick . $target . $attrs . '>' . $this->_label . '</a>';
}
return $s;
}
示例8: getJSonDescription
function getJSonDescription($user, $cms_language, $withDefinition = false)
{
//get websites
$websites = CMS_websitesCatalog::getAll();
$hasPages = $this->hasPages();
$websitesList = '';
$websitesDenied = $this->getWebsitesDenied();
foreach ($websites as $id => $website) {
if (!isset($websitesDenied[$id])) {
$websitesList .= $websitesList ? ', ' : '';
$websitesList .= $website->getLabel();
}
}
/*$shortdesc = sensitiveIO::ellipsis($this->getDescription(), 60);
if ($shortdesc != nl2br($this->getDescription())) {
$shortdesc = '<span class="atm-help" ext:qtip="'.nl2br(io::htmlspecialchars($this->getDescription())).'">'.$shortdesc.'</span>';
}
$shortdesc = $shortdesc ? $shortdesc.'<br />' : '';*/
$mediumdesc = sensitiveIO::ellipsis($this->getDescription(), 200);
if ($mediumdesc != $this->getDescription()) {
$mediumdesc = '<span class="atm-help" ext:qtip="' . nl2br(io::htmlspecialchars(strip_tags($this->getDescription()))) . '">' . nl2br(io::htmlspecialchars($mediumdesc)) . '</span>';
} else {
$mediumdesc = io::htmlspecialchars($mediumdesc);
}
$mediumdesc = $mediumdesc ? $mediumdesc . '<br />' : '';
//append template definition if needed
$definitionDatas = $withDefinition ? $this->getDefinition() : '';
if ($user->hasAdminClearance(CLEARANCE_ADMINISTRATION_EDIT_TEMPLATES)) {
$edit = array('url' => 'template.php', 'params' => array('template' => $this->getID()));
} else {
$edit = false;
}
return array('id' => $this->getID(), 'label' => $this->getLabel(), 'type' => $cms_language->getMessage(self::MESSAGE_DESC_TEMPLATE), 'image' => PATH_TEMPLATES_IMAGES_WR . '/' . ($this->getImage() ? $this->getImage() : 'nopicto.gif'), 'groups' => implode(', ', $this->getGroups()), 'websites' => $websitesList, 'desc' => io::htmlspecialchars($this->getDescription()), 'filter' => $this->getLabel() . ' ' . implode(', ', $this->getGroups()), 'description' => '<div' . (!$this->isUseable() ? ' class="atm-inactive"' : '') . '>' . '<img src="' . (PATH_TEMPLATES_IMAGES_WR . '/' . ($this->getImage() ? $this->getImage() : 'nopicto.gif')) . '" style="float:left;margin-right:3px;width:80px;" />' . $mediumdesc . $cms_language->getMessage(self::MESSAGE_DESC_WEBSITES) . ' <strong>' . $websitesList . '</strong><br />' . $cms_language->getMessage(self::MESSAGE_DESC_GROUPS) . ' <strong>' . ($this->getGroups() ? implode(', ', $this->getGroups()) : $cms_language->getMessage(self::MESSAGE_DESC_NONE)) . '</strong><br />' . $cms_language->getMessage(self::MESSAGE_DESC_ACTIVE) . ' <strong>' . ($this->isUseable() ? $cms_language->getMessage(self::MESSAGE_DESC_YES) : $cms_language->getMessage(self::MESSAGE_DESC_NO)) . '</strong><br />' . $cms_language->getMessage(self::MESSAGE_DESC_USED) . ' <strong>' . ($hasPages ? $cms_language->getMessage(self::MESSAGE_DESC_YES) : $cms_language->getMessage(self::MESSAGE_DESC_NO)) . '</strong>' . ($hasPages ? ' - <a href="#" onclick="Automne.view.search(\'template:' . $this->getID() . '\');return false;">' . $cms_language->getMessage(self::MESSAGE_DESC_SEE) . '</a>' . ($user->hasAdminClearance(CLEARANCE_ADMINISTRATION_REGENERATEPAGES) ? ' / <a href="#" onclick="Automne.server.call(\'templates-controler.php\', \'\', {templateId:' . $this->getID() . ', action:\'regenerate\'});return false;">' . $cms_language->getMessage(self::MESSAGE_DESC_REGENERATE) . '</a>' : '') . ' ' . $cms_language->getMessage(self::MESSAGE_DESC_PAGES) : '') . '<br />' . $cms_language->getMessage(self::MESSAGE_DESC_XML_FILE) . ': <strong>' . ($this->getDefinitionFile() ? $this->getDefinitionFile() : $cms_language->getMessage(self::MESSAGE_DESC_NONE)) . '</strong>' . '<br class="x-form-clear" />' . '</div>', 'activated' => $this->isUseable() ? true : false, 'used' => $hasPages, 'definition' => $definitionDatas, 'edit' => $edit);
}
示例9: getRecursiveOutput
/**
* Get the recursive HTML display for a recursivelinks, if it passes the condition of course.
*
* @param CMS_page $parsedPage The page in which the linx tag is
* @param integer $level The current level of recursivity
* @param multidimentionnal array $recursiveTree The tree to display
* @param array $pages array of pages objects (indexed by id)
* @param boolean $public Is the page data to show the public or edited one ?
* @param array $lineage The lineage of the pages (used to see wich recursions need to be done in closed link display mode)
* @return string The html of the recursive link
* @access public
*/
function getRecursiveOutput(&$parsedPage, $level = 0, $recursiveTree, &$pages, $public, $lineage = array())
{
$html = '';
if (is_array($recursiveTree) && $recursiveTree) {
$rank = 1;
$levelhtml = '';
foreach ($recursiveTree as $pageID => $subPages) {
//get Page Object
$page = $pages[$pageID];
//instanciate page if not exists as object
if (!is_object($page) && sensitiveIO::isPositiveInteger($page)) {
$page = CMS_tree::getPageByID($page);
}
$pagehtml = '';
//check if page pass the condition
if (is_object($page) && (!$this->hasCondition() || $this->pagePassesConditions($parsedPage, $page, $public, $rank)) && (!$public || $public && $page->isUseable() && $page->getPublication() == RESOURCE_PUBLICATION_PUBLIC)) {
//get pages infos
$linkTitle = $page->getLinkTitle($public);
$title = $page->getTitle($public);
//set pages infos in html template
$replace = array("{{title}}" => io::sanitizeHTMLString($linkTitle), "{{jstitle}}" => io::sanitizeHTMLString($linkTitle), "{{pagetitle}}" => io::sanitizeHTMLString($title), "{{jspagetitle}}" => io::sanitizeHTMLString($title), "{{desc}}" => io::sanitizeHTMLString($page->getDescription($public)), "{{href}}" => $page->getURL(), "{{id}}" => $page->getID(), "{{codename}}" => $page->getCodename($public), "{{number}}" => $rank - 1, "{{modulo}}" => ($rank - 1) % 2, "{{lvlClass}}" => "CMS_lvl" . ($level + 1), "{{currentClass}}" => $parsedPage->getID() == $page->getID() ? "CMS_current" : "", 'id="{{currentID}}"' => $parsedPage->getID() == $page->getID() ? 'id="CMS_current"' : "");
if (io::strpos($this->_htmlTemplate, '{{isParent}}') !== false) {
//only if needed because getLineage require a lot of query
$pagelineage = CMS_tree::getLineage($page->getID(), $parsedPage->getID(), false);
$replace['class="{{isParent}}"'] = is_array($pagelineage) && in_array($parsedPage->getID(), $pagelineage) ? 'class="CMS_parent"' : "";
$replace['{{isParent}}'] = is_array($pagelineage) && in_array($parsedPage->getID(), $pagelineage) ? 'CMS_parent' : "";
$replace['id="{{isParent}}"'] = is_array($pagelineage) && in_array($parsedPage->getID(), $pagelineage) ? 'id="CMS_parent"' : "";
}
if (io::strpos($this->_htmlTemplate, '{{website') !== false) {
//only if needed because getWebsite require a lot of query
$website = $page->getWebsite();
$replace['{{websitetitle}}'] = $website->getLabel();
$replace['{{websitecodename}}'] = $website->getCodename($public);
}
$pagehtml = str_replace(array_keys($replace), $replace, $this->_htmlTemplate);
if ($level == 0 && ($this->_root === 'false' || !$this->_root)) {
$pagehtml = str_replace(array_keys($replace), $replace, $this->getRecursiveOutput($parsedPage, $level + 1, $subPages, $pages, $public, $lineage));
} else {
//check if link is in open or closed mode
if ($this->_mode == "open") {
//if it is open mode recurse indefinitely (until end of tree)
//then mark info of sublevels or not
$replace = array("{{typeClass}}" => $subPages ? "CMS_sub" : "CMS_nosub", "{{sublevel}}" => $this->getRecursiveOutput($parsedPage, $level + 1, $subPages, $pages, $public));
$pagehtml = str_replace(array_keys($replace), $replace, $pagehtml);
} else {
//if it is 'close' mode recurse only for pages in current lineage
$recurse = false;
if (is_array($lineage)) {
$recurse = in_array($page->getID(), $lineage) ? true : false;
}
//then mark info of sublevels or not and if level is open or not
$sub = $recurse ? "CMS_open" : "CMS_sub";
$replace = array("{{typeClass}}" => $subPages ? $sub : "CMS_nosub", "{{sublevel}}" => $recurse ? $this->getRecursiveOutput($parsedPage, $level + 1, $subPages, $pages, $public, $lineage) : "");
if (!$recurse) {
//needed to update link targets which is used after to register watched links
$it = new RecursiveArrayIterator($subPages);
foreach ($it as $pageID => $element) {
unset($pages[$pageID]);
}
}
$pagehtml = str_replace(array_keys($replace), $replace, $pagehtml);
}
}
//add APPLICATION_ENFORCES_ACCESS_CONTROL php access checking
if (APPLICATION_ENFORCES_ACCESS_CONTROL && $public) {
$pagehtml = $this->_addSlashAroundPHPContent($pagehtml);
$replace = array("<?php" => "';", "?>" => "echo '");
$pagehtml = str_replace(array_keys($replace), $replace, $pagehtml);
$pagehtml = '<?php if ($cms_user->hasPageClearance(' . $page->getID() . ', CLEARANCE_PAGE_VIEW)) {' . "\n" . 'echo \'' . $pagehtml . '\';' . "\n" . '}' . "\n" . '?>';
}
$rank++;
} else {
//needed to update link targets which is used after to register watched links
unset($pages[$pageID]);
}
$levelhtml .= $pagehtml;
}
if ($level == 0 && ($this->_root === 'false' || !$this->_root)) {
$html = $levelhtml;
} else {
if ($levelhtml && io::strpos($this->_subleveltemplate, "{{sublevel}}") !== false) {
$replace = array("{{sublevel}}" => $levelhtml, "{{lvlClass}}" => "CMS_lvl" . ($level + 1));
$html = str_replace(array_keys($replace), $replace, $this->_subleveltemplate);
} else {
$html = $levelhtml;
}
}
}
//.........这里部分代码省略.........
示例10: checkCatId
function checkCatId($catId)
{
return io::strpos($catId, 'cat') === 0 && sensitiveIO::isPositiveInteger(io::substr($catId, 3));
}
示例11: define
*
* @package Automne
* @subpackage admin
* @author Sébastien Pauchet <sebastien.pauchet@ws-interactive.fr>
*/
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 {
$gzip = true;
$requestedDate->moveDate('+1 day');
$errorFile = PATH_LOGS_FS . '/' . CMS_grandFather::ERROR_LOG . '-' . $requestedDate->getLocalizedDate('Y-m-d') . '.gz';
}
示例12: dirname
*
* @package Automne
* @subpackage admin
* @author Sébastien Pauchet <sebastien.pauchet@ws-interactive.fr>
*/
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_JSON);
//This file is an admin file. Interface must be secure
$view->setSecure();
$keyword = sensitiveIO::request('keyword');
$elements = sensitiveIO::request('elements', 'is_array', array());
$start = sensitiveIO::request('start', 'sensitiveIO::isPositiveInteger', 0);
$limit = sensitiveIO::request('limit', 'sensitiveIO::isPositiveInteger', 0);
$results = $scores = array();
//Users search
if (in_array('users', $elements)) {
$usersResults = CMS_profile_usersCatalog::search($keyword, '', '', 'score', 'desc', 0, 0, false, false, $usersScore);
if ($usersResults) {
foreach ($usersResults as $resultId) {
if (isset($usersScore[$resultId])) {
$scores[$usersScore[$resultId]][] = array('users', $resultId);
} else {
$scores[0][] = array('users', $resultId);
}
}
//pr('Users :');
//pr($usersResults);
//pr($rowsScore);
示例13: dirname
// +----------------------------------------------------------------------+
//
// $Id: server-scripts-controler.php,v 1.6 2010/03/08 16:41:21 sebastien Exp $
/**
* PHP controler : Receive actions on server
* Used accross an Ajax request to process one server action
*
* @package Automne
* @subpackage admin
* @author Sébastien Pauchet <sebastien.pauchet@ws-interactive.fr>
*/
require_once dirname(__FILE__) . '/../../cms_rc_admin.php';
//Controler vars
$action = sensitiveIO::request('action', array('regenerate-all', 'regenerate-tree', 'regenerate-pages', 'restart-scripts', 'stop-scripts', 'clear-scripts'));
$page = sensitiveIO::request('page', 'sensitiveIO::isPositiveInteger');
$pages = sensitiveIO::request('pages');
define("MESSAGE_PAGE_NO_SCRIPTS_RIGHTS", 794);
define("MESSAGE_ACTION_ALL_PAGES_SUBMITED", 795);
define("MESSAGE_ACTION_N_PAGES_SUBMITED", 796);
define("MESSAGE_ACTION_N_PAGES_REGENERATED", 797);
define("MESSAGE_ERROR_NO_PAGES_FOUND", 798);
define("MESSAGE_ACTION_N_PAGES_REGENERATION_ERROR", 1602);
//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();
//CHECKS user has scripts admin clearance
if (!$cms_user->hasAdminClearance(CLEARANCE_ADMINISTRATION_REGENERATEPAGES)) {
CMS_grandFather::raiseError('User has no regeneration rights');
示例14: 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;
}
示例15: dirname
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_JSON);
//This file is an admin file. Interface must be secure
$view->setSecure();
//get search vars
$search = sensitiveIO::request('search');
$letter = sensitiveIO::request('letter');
$sort = sensitiveIO::request('sort');
$dir = sensitiveIO::request('dir');
$start = sensitiveIO::request('start', 'sensitiveIO::isPositiveInteger', 0);
$limit = sensitiveIO::request('limit', 'sensitiveIO::isPositiveInteger', CMS_session::getRecordsPerPage());
$userId = sensitiveIO::request('userId', 'sensitiveIO::isPositiveInteger');
$filter = sensitiveIO::request('filter') ? true : false;
$groupsDatas = array();
$groupsDatas['groups'] = array();
if (!$cms_user->hasAdminClearance(CLEARANCE_ADMINISTRATION_EDITUSERS)) {
CMS_grandFather::raiseError('User has no users management rights ...');
$view->setContent($groupsDatas);
$view->show();
}
//load user's groups if any
if ($userId) {
$userGroups = CMS_profile_usersGroupsCatalog::getGroupsOfUser($userId, true);
} else {
$userGroups = array();
}
if ($userId && $filter) {
//search users