示例#1
0
 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);
 }
示例#2
0
    $redirHidden = "{\n\t\txtype:\t\t\t'hidden',\n\t\tname:\t\t\t'page',\n\t\tvalue:\t\t\t'{$pageId}'\n\t},";
} else {
    if (io::isPositiveInteger($item->getPageID())) {
        $href->setLinkType(RESOURCE_LINK_TYPE_INTERNAL);
        $href->setInternalLink($item->getPageID());
    } elseif ($item->getURL()) {
        $href->setLinkType(RESOURCE_LINK_TYPE_EXTERNAL);
        $href->setExternalLink($item->getURL());
    }
    $redirDisabled = $redirHidden = '';
}
$redirectValue = io::sanitizeJSString($href->getTextDefinition());
$visualmode = RESOURCE_DATA_LOCATION_EDITED;
//Websites
$currentWebsites = $item->getWebsites();
$websites = CMS_websitesCatalog::getAll();
$availableWebsites = $selectedWebsites = array();
foreach ($websites as $id => $website) {
    if (in_array($website->getId(), $currentWebsites)) {
        $exists = false;
        foreach ($selectedWebsites as $data) {
            if ($data[1] == $website->getURL()) {
                $exists = true;
            }
        }
        if (!$exists) {
            $selectedWebsites[] = array($id, $website->getURL());
        }
    } else {
        $exists = false;
        foreach ($availableWebsites as $data) {
示例#3
0
            $orders = explode(',', $_POST['new_order']);
            if (CMS_websitesCatalog::setOrders($orders)) {
                $cms_message = $cms_language->getMessage(MESSAGE_ACTION_OPERATION_DONE);
            } else {
                $cms_message = $cms_language->getMessage(MESSAGE_PAGE_ACTION_ORDERING_ERROR);
            }
        }
        break;
}
if ($_GET["records_per_page"]) {
    CMS_session::setRecordsPerPage($_GET["records_per_page"]);
}
if ($_GET["bookmark"]) {
    CMS_session::setBookmark($_GET["bookmark"]);
}
$websites = CMS_websitesCatalog::getAll('order');
$records_per_page = CMS_session::getRecordsPerPage();
$bookmark = CMS_session::getBookmark();
$pages = ceil(sizeof($websites) / $records_per_page);
$first_record = ($bookmark - 1) * $records_per_page;
$dialog = new CMS_dialog();
$content = '';
$dialog->setTitle($cms_language->getMessage(MESSAGE_PAGE_TITLE));
if ($cms_message) {
    $dialog->setActionMessage($cms_message);
} elseif (io::request('cms_message_id', 'io::isPositiveInteger')) {
    $dialog->setActionMessage($cms_language->getMessage(io::request('cms_message_id')));
}
$content .= '
<script language="JavaScript" type="text/javascript" src="' . PATH_ADMIN_WR . '/v3/js/coordinates.js"></script>
<script language="JavaScript" type="text/javascript" src="' . PATH_ADMIN_WR . '/v3/js/drag.js"></script>
示例#4
0
 /**
  * get websites for a given domain or false if none found
  *
  * @param string $domain : the domain to found website of
  * @return array(CMS_website)
  * @access public
  */
 static function getWebsitesFromDomain($domain, &$isAlt = false)
 {
     //get all websites
     $websites = CMS_websitesCatalog::getAll('order');
     $matchWebsites = array();
     foreach ($websites as $website) {
         if (io::strtolower($domain) == io::strtolower(@parse_url($website->getURL(), PHP_URL_HOST))) {
             $matchWebsites[$website->getID()] = $website;
         } else {
             $altDomains = $website->getAltDomains();
             foreach ($altDomains as $altDomain) {
                 if (io::strtolower($domain) == io::strtolower(@parse_url($altDomain, PHP_URL_HOST))) {
                     $isAlt = true;
                     $matchWebsites[$website->getID()] = $website;
                 }
             }
         }
     }
     return $matchWebsites;
 }
示例#5
0
 /**
  * Sets the title of the alias
  *
  * @param string $alias The title to set
  * @return boolean true on success, false on failure
  * @access public
  */
 function setAlias($alias)
 {
     //clean alias characters
     $alias = sensitiveIO::sanitizeAsciiString($alias, '@');
     //check if alias directory already exists
     if (@is_dir($this->getPath(false, PATH_RELATIVETO_FILESYSTEM) . $alias)) {
         //check if directory is used by another alias
         $aliases = CMS_module_cms_aliases::getByName($alias);
         $otherAlias = false;
         $otherAliasesUsesWebsites = array();
         foreach ($aliases as $anAlias) {
             if ($this->getID() != $anAlias->getID() && $this->getPath(false) . $alias . '/' == $anAlias->getPath(true)) {
                 //check websites of other aliases. It must not use same domain as current one
                 if (!$anAlias->getWebsites()) {
                     //this other alias use all domains, so current alias can never be used
                     return false;
                 } else {
                     $otherAliasesUsesWebsites = array_merge($anAlias->getWebsites(), $otherAliasesUsesWebsites);
                 }
                 $otherAlias = true;
             }
         }
         if (!$otherAlias && $this->getPath(false) . $alias . '/' != $this->getPath(true)) {
             //no other alias use this directory, so it is used by something else
             return false;
         } elseif ($otherAliasesUsesWebsites) {
             //check if this alias can be used by a website
             $otherAliasesUsesWebsites = array_unique($otherAliasesUsesWebsites);
             if ($this->getWebsites()) {
                 $websites = $this->getWebsites();
             } else {
                 $websites = array_keys(CMS_websitesCatalog::getAll());
             }
             $freeWebsite = array();
             foreach ($websites as $codename) {
                 if (!in_array($codename, $otherAliasesUsesWebsites)) {
                     $freeWebsite[] = $codename;
                 }
             }
             if (!$freeWebsite) {
                 //no free website for this alias
                 return false;
             }
             //limit alias to free websites
             $this->setWebsites($freeWebsite);
         }
     }
     //alias already exists, check if alias name change. If so, delete old files
     if ($this->getID() && $this->_alias != $alias) {
         $this->_deleteFiles();
     }
     $this->_alias = $alias;
     return true;
 }