示例#1
0
 /**
  * @param array(CMS_users) $users users to send message to
  * @param array(CMS_profile_user) $users
  * @param array($language=>$subject) $messages indexed by languages code
  * @param array($language=>$subject) $subjects indexed by languages code
  * @param integer $alertLevel
  * @return void
  * @access public
  */
 function setUserMessages($users, $messages, $subjects, $alertLevel = ALERT_LEVEL_VALIDATION, $module = MOD_STANDARD_CODENAME)
 {
     $mainURL = CMS_websitesCatalog::getMainURL();
     $template = is_file(PATH_MAIL_TEMPLATES_FS) ? PATH_MAIL_TEMPLATES_FS : '';
     foreach ($users as $user) {
         //if is integer create user object
         if (!is_a($user, "CMS_user_profile") && SensitiveIO::isPositiveInteger($user)) {
             $user = CMS_profile_usersCatalog::getByID($user);
         }
         //if user hasn't alert level for this module or user is not active anymore, skip it
         if (!$user->hasAlertLevel($alertLevel, $module) || $user->isDeleted() || !$user->isActive()) {
             //CMS_grandFather::raiseError('user '.$user->getFullName().' has no alerts for level '.$alertLevel.' for module '.$module);
             continue;
         }
         $userLang = $user->getLanguage();
         $email = new CMS_email();
         if ($user->getEmail()) {
             if ($email->setEmailTo($user->getEmail())) {
                 $email->setSubject($subjects[$userLang->getCode()], true);
                 $email->setBody($messages[$userLang->getCode()]);
                 $email->setFooter($userLang->getMessage(self::MESSAGE_EMAIL_BODY_URLS, array(APPLICATION_LABEL, $mainURL . "/", $mainURL . PATH_ADMIN_WR . "/")));
                 $email->setTemplate($template);
                 $this->_messages[] = $email;
             } else {
                 $this->raiseError("Email Catalog: email invalid (" . $user->getEmail() . ") for user : " . $user->getFullName());
             }
         }
     }
 }
示例#2
0
        $header[0] = '"Date"';
    }
    foreach ($fields as $field) {
        if ($field->getAttribute('type') != 'submit') {
            //remove submit field
            $header[$field->getID()] = '"' . cleanvalue($field->getAttribute('label')) . '"';
        }
        //check for file field in form
        if ($field->getAttribute('type') == 'file') {
            $fileFields[$field->getID()] = true;
        }
    }
}
//prepare files path if needed
if (sizeof($fileFields)) {
    $filesPath = CMS_websitesCatalog::getMainURL() . PATH_MODULES_FILES_WR . '/' . MOD_CMS_FORMS_CODENAME . '/';
}
//then create CVS file
//CSV header
$csv = implode(';', $header) . "\n";
//CSV content
if (sizeof($formDatas)) {
    foreach ($formDatas as $formData) {
        $count = 0;
        foreach ($header as $fieldID => $head) {
            $csv .= $count ? ';' : '';
            if (!$fileFields[$fieldID]) {
                $csv .= '"' . cleanvalue($formData[$fieldID]) . '"';
            } else {
                if ($formData[$fieldID]) {
                    $csv .= '"' . $filesPath . cleanvalue($formData[$fieldID]) . '"';
示例#3
0
 /**
  * Returns The URL of the current website, according to parameter or constant CURRENT_PAGE or the main domain URL if constant does not exists
  * Static function.
  *
  * @param mixed $currentPage : The current page id or CMS_page
  * @return string The current website URL
  * @access public
  */
 static function getCurrentDomain($currentPage = '')
 {
     static $domain;
     if (!isset($domain)) {
         $domain = '';
         if (io::isPositiveInteger($currentPage)) {
             $page = CMS_tree::getPageByID($currentPage);
         } elseif (is_object($currentPage)) {
             $page = $currentPage;
         } elseif (defined('CURRENT_PAGE') && io::isPositiveInteger(CURRENT_PAGE)) {
             $page = CMS_tree::getPageByID(CURRENT_PAGE);
         }
         if (isset($page) && is_object($page) && !$page->hasError()) {
             $domain = $page->getWebsite()->getURL();
             //check for HTTPS
             if ($page->isHTTPS() || defined('PAGE_SSL_MODE') && PAGE_SSL_MODE) {
                 $domain = str_ireplace('http://', 'https://', $domain);
             }
         }
         if (!$domain) {
             $domain = CMS_websitesCatalog::getMainURL();
         }
     }
     return $domain;
 }
示例#4
0
        $pageId = $cms_page->getID();
        $isAutomne = true;
    }
} elseif ($pageId) {
    //try to instanciate the requested page
    $cms_page = CMS_tree::getPageByID($pageId);
    $isAutomne = true;
}
if (!isset($cms_page) || !$cms_page || !is_object($cms_page) || $cms_page->hasError() || $cms_page->getID() != APPLICATION_ROOT_PAGE_ID && !CMS_tree::hasAncestor($cms_page->getID())) {
    if ($pageUrl && !$isAutomne) {
        if ($pageUrl == PATH_REALROOT_WR . '/' && $httpHost != @parse_url(CMS_websitesCatalog::getMainURL(), PHP_URL_HOST)) {
            //Website domain is not properly set
            if ($cms_user->hasAdminClearance(CLEARANCE_ADMINISTRATION_EDITVALIDATEALL)) {
                $jscontent = "\n\t\t\t\t\tAutomne.message.popup({\n\t\t\t\t\t\ttitle: \t\t'" . $cms_language->getJSMessage(MESSAGE_PAGE_INCORRECT_DOMAIN) . "', \n\t\t\t\t\t\tmsg: \t\t'" . $cms_language->getJSMessage(MESSAGE_PAGE_INCORRECT_WEBSITE_CONFIG, array($httpHost, @parse_url(CMS_websitesCatalog::getMainURL(), PHP_URL_HOST))) . "',\n\t\t\t\t\t\tbuttons:\tExt.MessageBox.OK,\n\t\t\t\t\t\ticon: \t\tExt.MessageBox.WARNING,\n\t\t\t\t\t\tfn: \t\tfunction (button) {\n\t\t\t\t\t\t\t\t\t\tvar window = new Automne.frameWindow({\n\t\t\t\t\t\t\t\t\t\t\tid:\t\t\t\t'websitesWindow',\n\t\t\t\t\t\t\t\t\t\t\tframeURL:\t\t'" . PATH_MAIN_WR . "/admin-v3/websites.php',\n\t\t\t\t\t\t\t\t\t\t\tallowFrameNav:\ttrue,\n\t\t\t\t\t\t\t\t\t\t\twidth:\t\t\t750,\n\t\t\t\t\t\t\t\t\t\t\theight:\t\t\t580\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\twindow.show();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t";
            } else {
                $jscontent = "\n\t\t\t\t\tAutomne.message.popup({\n\t\t\t\t\t\ttitle: \t\t'" . $cms_language->getJSMessage(MESSAGE_PAGE_INCORRECT_DOMAIN) . "', \n\t\t\t\t\t\tmsg: \t\t'" . $cms_language->getJSMessage(MESSAGE_PAGE_INCORRECT_WEBSITE_CONFIG_ADMIN, array($httpHost, @parse_url(CMS_websitesCatalog::getMainURL(), PHP_URL_HOST))) . "',\n\t\t\t\t\t\tbuttons:\tExt.MessageBox.OK,\n\t\t\t\t\t\ticon: \t\tExt.MessageBox.ERROR\n\t\t\t\t\t});\n\t\t\t\t";
            }
        } else {
            $jscontent = "\n\t\t\t\tAutomne.message.popup({\n\t\t\t\t\tmsg: \t\t'" . $cms_language->getJSMessage(MESSAGE_PAGE_FOLLOW_EXTERNAL_LINK) . "',\n\t\t\t\t\tbuttons:\tExt.MessageBox.OKCANCEL,\n\t\t\t\t\ticon: \t\tExt.MessageBox.INFO,\n\t\t\t\t\tfn: \t\tfunction (button) {\n\t\t\t\t\t\t\t\t\tif (button == 'ok') {\n\t\t\t\t\t\t\t\t\t\twindow.open('{$pageUrl}');\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t";
        }
        $view->addJavascript($jscontent);
        if ($from) {
            $cms_page = CMS_tree::getPageByID($from);
            $pageId = $cms_page->getID();
        }
    } else {
        $jscontent = "\n\t\t\t//disable all tabs except search and tree\n\t\t\tAutomne.tabPanels.items.each(function(panel) {\n\t\t\t\tif (panel.id != 'search' && panel.id != 'tree') {\n\t\t\t\t\tpanel.disable();\n\t\t\t\t} else {\n\t\t\t\t\tpanel.enable();\n\t\t\t\t}\n\t\t\t});\n\t\t\tAutomne.message.popup({\n\t\t\t\ttitle: \t\t'" . $cms_language->getJSMessage(MESSAGE_PAGE_ERROR) . "', \n\t\t\t\tmsg: \t\t'" . $cms_language->getJSMessage(MESSAGE_PAGE_PAGE_NOT_VIEWVABLE, array($pageId)) . "',\n\t\t\t\tbuttons:\tExt.MessageBox.OK,\n\t\t\t\ticon: \t\tExt.MessageBox.ERROR\n\t\t\t});\n\t\t";
        $view->addJavascript($jscontent);
        CMS_grandFather::raiseError('Error on page : ' . $pageId);
        $view->show();
    }
示例#5
0
    if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
        $body .= 'User : '******'REMOTE_ADDR'] . ' (' . $_SERVER['HTTP_ACCEPT_LANGUAGE'] . ')' . "\n\n";
    } else {
        $body .= 'User : '******'REMOTE_ADDR'] . "\n\n";
    }
    if (isset($_SERVER['HTTP_USER_AGENT'])) {
        $body .= 'Browser : ' . $_SERVER['HTTP_USER_AGENT'] . "\n\n";
    }
    $body .= 'Host : ' . $_SERVER['HTTP_HOST'] . ' (' . $_SERVER['SERVER_ADDR'] . ")\n\n";
    $body .= 'This email is automaticaly sent from your website. You can stop this sending with the parameter ERROR404 EMAIL ALERT.';
    $mail = new CMS_email();
    $mail->setSubject("404 Error in " . APPLICATION_LABEL);
    $mail->setBody($body);
    $mail->setEmailFrom(APPLICATION_POSTMASTER_EMAIL . "<" . APPLICATION_POSTMASTER_EMAIL . ">");
    $mail->setEmailTo(APPLICATION_MAINTAINER_EMAIL);
    $mainURL = CMS_websitesCatalog::getMainURL();
    $cms_language = CMS_languagesCatalog::getByCode('en');
    $mail->setFooter($cms_language->getMessage(CMS_emailsCatalog::MESSAGE_EMAIL_BODY_URLS, array(APPLICATION_LABEL, $mainURL . "/", $mainURL . PATH_ADMIN_WR . "/")));
    $mail->setTemplate(PATH_MAIL_TEMPLATES_FS);
    $mail->sendEmail();
}
//try to get website by path to serve specific 404 page
$path = pathinfo(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH), PATHINFO_DIRNAME);
$website = null;
if ($path && $path != '/') {
    $websites = CMS_websitesCatalog::getAll('order');
    foreach ($websites as $website) {
        if ($website->getPagesPath(PATH_RELATIVETO_WEBROOT)) {
            if (strpos($path, $website->getPagesPath(PATH_RELATIVETO_WEBROOT)) === 0 && is_object($website->get404())) {
                break;
            }
示例#6
0
 /**
  * Send the mail
  *
  * @return boolean true on success, false on failure
  * @access public
  */
 function sendEmail()
 {
     if ($this->hasError()) {
         $this->raiseError('Cannot send email, error appened');
         return false;
     }
     $emailSent = true;
     if (!$this->_emailTo) {
         $this->raiseError('emailTo can not be null');
         return false;
     }
     $OB = "----=_OuterBoundary_000";
     $IB = "----=_InnerBoundery_001";
     $encoding = $this->_emailEncoding ? $this->_emailEncoding : APPLICATION_DEFAULT_ENCODING;
     if ($this->_template) {
         //if template is provided for email HTML, use it
         $template = new CMS_file($this->_template);
         $templateContent = $template->getContent();
         $replace = array('{{subject}}' => $this->_subject, '{{body}}' => $this->_emailHTML ? $this->_emailHTML : $this->convertTextToHTML($this->_body), '{{footer}}' => $this->convertTextToHTML($this->_footer), '{{href}}' => CMS_websitesCatalog::getMainURL(), '{{charset}}' => strtoupper($encoding));
         $Html = str_replace(array_keys($replace), $replace, $templateContent);
     } elseif ($this->_emailHTML) {
         //if HTML content is provided for email, use it
         //if this mail contain relative link, append default website address
         if (io::strpos($this->_emailHTML, 'href="/') !== false || io::strpos($this->_emailHTML, 'src="/') !== false) {
             $url = CMS_websitesCatalog::getMainURL();
             $this->_emailHTML = str_replace(array('href="/', 'src="/'), array('href="' . $url . '/', 'src="' . $url . '/'), $this->_emailHTML);
         }
         $Html = $this->_emailHTML;
     } else {
         //else use text content converted to HTML
         $Html = $this->convertTextToHTML($this->_body . ($this->_footer ? "\n\n" . $this->_footer : ''));
     }
     $Text = $this->_body ? $this->_body . ($this->_footer ? "\n\n" . $this->_footer : '') : "Sorry, but you need an HTML compatible mailer to read this mail...";
     $From = $this->_emailFrom ? $this->_emailFrom : APPLICATION_POSTMASTER_EMAIL;
     $FromName = $this->_fromName ? $this->_fromName : '';
     $toUsers = is_array($this->_emailTo) && $this->_emailTo ? $this->_emailTo : array($this->_emailTo);
     $cc = is_array($this->_cc) && $this->_cc ? $this->_cc : ($this->_cc ? array($this->_cc) : '');
     $bcc = is_array($this->_bcc) && $this->_bcc ? $this->_bcc : ($this->_bcc ? array($this->_bcc) : '');
     $toNames = is_array($this->_toName) && $this->_toName ? $this->_toName : array($this->_toName);
     $Error = $this->_error ? $this->_error : '';
     $Subject = $this->_subject;
     $AttmFiles = $this->_files;
     //Messages start with text/html alternatives in OB
     $Msg = "This is a multi-part message in MIME format.\n";
     $Msg .= "\n--" . $OB . "\n";
     $Msg .= "Content-Type: multipart/alternative;\n\tboundary=\"" . $IB . "\"\n\n";
     //plaintext section
     $Msg .= "\n--" . $IB . "\n";
     $Msg .= "Content-Type: text/plain;\n\tcharset=\"" . $encoding . "\"\n";
     $Msg .= "Content-Transfer-Encoding: 8bit\n\n";
     // plaintext goes here
     $Msg .= $Text . "\n\n";
     // html section
     $Msg .= "\n--" . $IB . "\n";
     $Msg .= "Content-Type: text/html;\n\tcharset=\"" . $encoding . "\"\n";
     $Msg .= "Content-Transfer-Encoding: base64\n\n";
     // html goes here
     $Msg .= chunk_split(base64_encode($Html), 76, "\n") . "\n\n";
     // end of IB
     $Msg .= "\n--" . $IB . "--\n";
     // attachments
     if (is_array($AttmFiles) && $AttmFiles) {
         foreach ($AttmFiles as $AttmFile) {
             $patharray = explode("/", $AttmFile);
             $FileName = $patharray[count($patharray) - 1];
             $Msg .= "\n--" . $OB . "\n";
             $Msg .= "Content-Type: application/octet-stream;\n\tname=\"" . $FileName . "\"\n";
             $Msg .= "Content-Transfer-Encoding: base64\n";
             $Msg .= "Content-Disposition: attachment;\n\tfilename=\"" . $FileName . "\"\n\n";
             //file goes here
             $fd = fopen($AttmFile, "r");
             $FileContent = fread($fd, filesize($AttmFile));
             fclose($fd);
             $FileContent = chunk_split(base64_encode($FileContent), 76, "\n");
             $Msg .= $FileContent;
             $Msg .= "\n\n";
         }
     }
     if (LOG_SENDING_MAIL) {
         global $cms_user;
         $user = $cms_user ? $cms_user : CMS_profile_usersCatalog::getById(ROOT_PROFILEUSER_ID);
     }
     //message ends
     $Msg .= "\n--" . $OB . "--\n";
     foreach ($toUsers as $key => $to) {
         if (sensitiveIO::isValidEmail($to)) {
             $headers = "MIME-Version: 1.0\n";
             if ($FromName) {
                 $headers .= "From: " . $this->EncodeHeader($FromName) . " <" . $From . ">\n";
                 $headers .= "Reply-To: " . $this->EncodeHeader($FromName) . " <" . $From . ">\n";
                 $headers .= "Return-Path: " . $this->EncodeHeader($FromName) . " <" . $From . ">\n";
                 $headers .= "X-Sender: " . $this->EncodeHeader($FromName) . " <" . $From . ">\n";
             } else {
                 $headers .= "From: " . $From . "\n";
                 $headers .= "Reply-To: " . $From . "\n";
                 $headers .= "Return-Path: " . $From . "\n";
                 $headers .= "X-Sender: " . $From . "\n";
             }
             if (isset($toNames[$key]) && $toNames[$key]) {
                 $to = $this->EncodeHeader($toNames[$key]) . " <" . $to . ">";
             }
             if ($Error) {
                 $headers .= "Errors-To: " . $Error . "\n";
             }
             if ($cc) {
                 $headers .= "Cc: " . implode(',', $cc) . "\n";
             }
             if ($bcc) {
                 $headers .= "Bcc: " . implode(',', $bcc) . "\n";
             }
             /*$headers.="User-Agent: Automne (TM)\n";*/
             //Cause email to be reported as spam
             $headers .= "X-Mailer: Automne (TM)\n";
             $headers .= "X-Priority: 3\n";
             $headers .= "Content-Type: multipart/mixed;\n\tboundary=\"" . $OB . "\"\n";
             //Check drop emails list (Automne default emails)
             if (!in_array($to, $this->_drop) && !in_array($From, $this->_drop)) {
                 //log in the cms_error_log the complete email
                 if (LOG_APPLICATION_MAIL) {
                     $this->log($to . "\n" . $this->EncodeHeader($Subject) . "\n\n" . $Msg);
                 }
                 //if mail deactivated always return true
                 if (NO_APPLICATION_MAIL) {
                     return $emailSent;
                 } else {
                     //send emails
                     $sent = @mail($to, $this->EncodeHeader($Subject), $Msg, $headers);
                 }
                 $emailSent = $emailSent && $sent;
                 if (LOG_SENDING_MAIL) {
                     $log = new CMS_log();
                     $log->logMiscAction(CMS_log::LOG_ACTION_SEND_EMAIL, $user, 'Email To ' . $to . ', From : ' . $From . ', Subject : ' . $Subject . ', Sent : ' . ($sent ? 'Yes' : 'Error'));
                 }
             } else {
                 if (LOG_SENDING_MAIL) {
                     $log = new CMS_log();
                     $log->logMiscAction(CMS_log::LOG_ACTION_SEND_EMAIL, $user, 'Email To ' . $to . ', From : ' . $From . ', Subject : ' . $Subject . ', Sent : No, Dropped because sender or receiver address is under Automne drop address list');
                 } else {
                     $this->raiseError('Email to ' . $to . ', from : ' . $From . ' (subject : ' . $Subject . '), Dropped because sender or receiver address is under Automne drop address list');
                 }
             }
         } else {
             if (LOG_SENDING_MAIL) {
                 $log = new CMS_log();
                 $log->logMiscAction(CMS_log::LOG_ACTION_SEND_EMAIL, $user, 'Email To ' . $to . ', From : ' . $From . ', Subject : ' . $Subject . ', Sent : No, Dropped because receiver address is not valid');
             } else {
                 $this->raiseError('Email to ' . $to . ', from : ' . $From . ' (subject : ' . $Subject . '), Dropped because receiver address is not valid');
             }
         }
     }
     if (!$emailSent) {
         $this->raiseError('Email was not sent, please check your sendmail configuration or SMTP connection in php.ini');
     }
     return $emailSent;
 }
示例#7
0
        $archives[] = 'install.php';
        if ($archiveFound) {
            $archives[] = $archiveFile;
        }
        if (file_exists(dirname(__FILE__) . '/' . $demoFr)) {
            $archives[] = $demoFr;
        }
        if (file_exists(dirname(__FILE__) . '/' . $demoEn)) {
            $archives[] = $demoEn;
        }
        $archivesNames = '<ul>';
        foreach ($archives as $archive) {
            $archivesNames .= '<li>' . $archive . '</li>';
        }
        $archivesNames .= '</ul>';
        $mainURL = CMS_websitesCatalog::getMainURL() . PATH_REALROOT_WR;
        $content .= sprintf($step9_alldone, $mainURL, $mainURL, $mainURL, $mainURL, $archivesNames, $uname);
    }
    // +----------------------------------------------------------------------+
    // | RENDERING                                                            |
    // +----------------------------------------------------------------------+
    echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title>Automne :: Installation</title>
	<style type="text/css">
		body{
			background-color:	#e9f1da;
			font-family:		arial,verdana,helvetica,sans-serif;
示例#8
0
    if (!$error) {
        $content .= $data . "\n";
    } else {
        $content .= '<item>' . "\n" . '    <title>RSS Feed Error ..</title>' . "\n" . '    <guid isPermaLink="false">Error' . time() . '</guid>' . "\n" . '    <description><![CDATA[';
        switch ($error) {
            case 1:
                $content .= 'Error : RSS ID not found or not a valid integer ... Please contact the webmaster here : ' . APPLICATION_MAINTAINER_EMAIL;
                break;
            case 2:
                $content .= 'Error : Invalid RSS ID found ... Please contact the webmaster here : ' . APPLICATION_MAINTAINER_EMAIL;
                break;
            case 3:
                $content .= 'Error : RSS Content generation error or no valid content for this RSS feed ... Please contact the webmaster here : ' . APPLICATION_MAINTAINER_EMAIL;
                break;
        }
        $content .= ']]></description>' . "\n" . '    <link>' . CMS_websitesCatalog::getMainURL() . '</link>' . "\n" . '</item>';
    }
    $content .= '	</channel>' . "\n" . '</rss>';
    if ('utf-8' != strtolower(APPLICATION_DEFAULT_ENCODING)) {
        $content = io::utf8Encode($content);
    }
    //output content to record it into cache
    echo $content;
    $content = $cache->endSave();
}
unset($cache);
//send RSS content
if (!isset($_REQUEST['atm-previz'])) {
    header('Content-type: text/xml; charset=UTF-8');
    echo $content;
} else {
示例#9
0
    /**
     * Shows body of html page
     *
     * @return void
     * @access private
     */
    protected function _showBody()
    {
        switch ($this->_displayMode) {
            case 'menu':
                echo '
					<body marginheight="0" background="' . PATH_ADMIN_IMAGES_WR . '/../v3/img/fond_menu.gif" marginwidth="0" leftmargin="0" topmargin="0" class="admin">
						' . $this->_writeMenu() . '
					</body>
					';
                break;
            case 'frames':
                echo '
					<body>
					' . $this->_parseContent($this->_content) . '
					</body>
					';
                break;
            case 'frameChecker':
                echo '
					<body marginheight="0" marginwidth="0" leftmargin="0" topmargin="0" class="frame" onLoad="initJavascript();">
					' . $this->_parseContent($this->_content) . '
					</body>
					';
                break;
            case 'arbo':
                echo '
					<body marginheight="0" marginwidth="0" leftmargin="0" topmargin="0" class="frame">
						
					' . $this->_getTitleDesign($this->_title, "admin_frame", "picto_pages.gif") . '
					
					' . $this->_showMessage() . '
					' . $this->_parseContent($this->_content) . '
					</body>
				';
                break;
            case 'modules':
                echo '
					<body marginheight="0" marginwidth="0" leftmargin="0" topmargin="0" class="frame">
						
					' . $this->_getTitleDesign($this->_title, "admin_frame", "picto_modules.gif") . '
					
					' . $this->_showMessage() . '
					' . $this->_parseContent($this->_content) . '
					</body>
				';
                break;
            default:
                $user = $this->_context->getUser();
                $language = $user->getLanguage();
                echo '<body marginheight="0" marginwidth="0" leftmargin="0" topmargin="0" class="admin" onLoad="initJavascript();">';
                //content is out of frames, so add Automne content header and do not display menu
                if ($this->_displayMode == 'out') {
                    echo '
					<table width="100%" height="72" border="0" cellpadding="0" cellspacing="0" style="background:url(' . PATH_ADMIN_IMAGES_WR . '/../v3/img/fond.gif) repeat-x bottom left;">
						<tr>
							<td width="562" height="72" valign="top" class="admin">
								<table width="562" height="30" border="0" cellpadding="0" cellspacing="0">
									<tr>
										<td width="472" height="30" class="admin_date">
											<!--&nbsp;&nbsp;<span class="admin_site_label">' . APPLICATION_LABEL . '</span> - <b>' . date($language->getDateFormat(), time()) . '</b>--></td>
										<td width="90" height="30" class="admin"><a href="http://www.automne-cms.org" target="_blank"><img src="' . PATH_ADMIN_IMAGES_WR . '/../v3/img/powered.gif" border="0" /></a></td>
									</tr>
								</table>
								<table width="562" height="42" border="0" cellpadding="0" cellspacing="0">
									<tr>
										<td width="562" height="42" background="' . PATH_ADMIN_IMAGES_WR . '/../v3/img/fond.gif" valign="center"><img src="' . PATH_ADMIN_IMAGES_WR . '/../v3/img/pix_trans.gif" width="562" height="1" border="0" /><br />
											' . $this->_getSubMenu() . '
										</td>
									</tr>
								</table>
							</td>
							<td width="138" height="72"><a href="' . CMS_websitesCatalog::getMainURL() . '" target="_blank"><img src="' . PATH_ADMIN_IMAGES_WR . '/../v3/img/logo.png" class="png" width="138" height="72" border="0" /></a></td>
							<td width="100%" height="72" valign="top" class="admin">
								<table width="100%" height="72" border="0" cellpadding="0" cellspacing="0">
									<tr>
										<td width="100%" height="30"><img src="' . PATH_ADMIN_IMAGES_WR . '/../v3/img/pix_trans.gif" width="1" height="1" border="0" /></td>
									</tr>
									<tr>
										<td width="100%" height="42" background="' . PATH_ADMIN_IMAGES_WR . '/../v3/img/fond.gif"><img src="' . PATH_ADMIN_IMAGES_WR . '/../v3/img/pix_trans.gif" width="1" height="1" border="0" /></td>
									</tr>
								</table>
							</td>
						</tr>
					</table>';
                } else {
                    echo $this->_getSubMenu();
                }
                //display content
                echo '
					<table width="100%" cellpadding="0" cellspacing="0" border="0">
						<tr>
							<td width="15"><img src="' . PATH_ADMIN_IMAGES_WR . '/../v3/img/pix_trans.gif" border="0" width="15" height="1" /></td>
							<td class="admin">';
                if ($this->_title) {
                    echo $this->_getTitleDesign($this->_title, "admin_h1", $this->_picto);
                }
                echo '<br />' . $this->_showMessage();
                $replace = array(PATH_ADMIN_WR => '', 'modules/' => '', '/' => '_', '.php' => '');
                if (io::strpos($_SERVER["SCRIPT_NAME"], '/polymod/') !== false && isset($_REQUEST['polymod'])) {
                    $replace['polymod'] = $_REQUEST['polymod'];
                }
                $filename = sensitiveIO::sanitizeAsciiString(str_replace(array_keys($replace), $replace, $_SERVER["SCRIPT_NAME"]));
                if (file_exists(PATH_ADMIN_FS . '/inc/' . $filename . "_" . $language->getCode() . ".inc.php")) {
                    include_once PATH_ADMIN_FS . '/inc/' . $filename . "_" . $language->getCode() . ".inc.php";
                }
                echo '
								' . $this->_parseContent($this->_content) . '
								<br />
							</td>
						</tr>
					</table>
					' . $this->_beforeBody;
                if ($this->_displayMode != "loading") {
                    echo '</body>';
                } else {
                    //add loading class
                    require_once "loadingDialog.php";
                    //start loading mode
                    CMS_LoadingDialog::startLoadingMode();
                }
                break;
        }
    }
	<form name="frm" action="' . $_SERVER["SCRIPT_NAME"] . '" method="post">
	<input type="hidden" id="cms_action" name="cms_action" value="validate" />
	<input type="hidden" name="moduleCodename" value="' . $moduleCodename . '" />
	<input type="hidden" name="object" value="' . $object->getID() . '" />
	<input type="hidden" name="RSSDefinition" value="' . $RSSDefinition->getID() . '" />
		<tr>
			<td class="admin" align="right" valign="top"><span class="admin_text_alert">*</span> ' . $cms_language->getMessage(MESSAGE_PAGE_FIELD_TITLE) . '</td>
			<td class="admin" width="80%">' . $label->getHTMLAdmin('label') . '</td>
		</tr>
		<tr>
			<td class="admin" align="right" valign="top" nowrap="nowrap"><span class="admin_text_alert">*</span> ' . $cms_language->getMessage(MESSAGE_PAGE_FIELD_DESCRIPTION) . '</td>
			<td class="admin" width="80%">' . $description->getHTMLAdmin('description', true) . '</td>
		</tr>
		<tr>
			<td class="admin" align="right" valign="top">' . $cms_language->getMessage(MESSAGE_PAGE_FIELD_LINK, false, MOD_POLYMOD_CODENAME) . '</td>
			<td class="admin" width="80%"><input type="text" class="admin_input_long_text" name="link" value="' . $RSSDefinition->getValue('link') . '" /><br /><small>(' . $cms_language->getMessage(MESSAGE_PAGE_FIELD_LINK_EXPLANATION, array(CMS_websitesCatalog::getMainURL()), MOD_POLYMOD_CODENAME) . ')</small></td>
		</tr>
		<tr>
			<td class="admin" align="right" valign="top">' . $cms_language->getMessage(MESSAGE_PAGE_FIELD_AUTHOR, false, MOD_POLYMOD_CODENAME) . '</td>
			<td class="admin" width="80%"><input type="text" class="admin_input_long_text" name="author" value="' . $RSSDefinition->getValue('author') . '" /></td>
		</tr>
		<tr>
			<td class="admin" align="right" valign="top">' . $cms_language->getMessage(MESSAGE_PAGE_FIELD_EMAIL, false, MOD_POLYMOD_CODENAME) . '</td>
			<td class="admin" width="80%"><input type="text" class="admin_input_long_text" name="email" value="' . $RSSDefinition->getValue('email') . '" /></td>
		</tr>
		<tr>
			<td class="admin" align="right" valign="top">' . $cms_language->getMessage(MESSAGE_PAGE_FIELD_COPYRIGHT, false, MOD_POLYMOD_CODENAME) . '</td>
			<td class="admin" width="80%"><input type="text" class="admin_input_long_text" name="copyright" value="' . $RSSDefinition->getValue('copyright') . '" /></td>
		</tr>
		<tr>
			<td class="admin" align="right" valign="top">' . $cms_language->getMessage(MESSAGE_PAGE_FIELD_CATEGORIES, false, MOD_POLYMOD_CODENAME) . '</td>
示例#11
0
 /**
  * Treat given content tag by this module for the specified treatment mode, visualization mode and object.
  *
  * @param string $tag The CMS_XMLTag.
  * @param string $tagContent previous tag content.
  * @param integer $treatmentMode The current treatment mode (see constants on top of CMS_modulesTags class for accepted values).
  * @param integer $visualizationMode The current visualization mode (see constants on top of cms_page class for accepted values).
  * @param object $treatedObject The reference object to treat.
  * @param array $treatmentParameters : optionnal parameters used for the treatment. Usually an array of objects.
  * @return string the tag content treated.
  * @access public
  */
 function treatWantedTag(&$tag, $tagContent, $treatmentMode, $visualizationMode, &$treatedObject, $treatmentParameters)
 {
     switch ($treatmentMode) {
         case MODULE_TREATMENT_BLOCK_TAGS:
             if (!$treatedObject instanceof CMS_row) {
                 $this->raiseError('$treatedObject must be a CMS_row object');
                 return false;
             }
             if (!$treatmentParameters["page"] instanceof CMS_page) {
                 $this->raiseError('$treatmentParameters["page"] must be a CMS_page object');
                 return false;
             }
             if (!$treatmentParameters["language"] instanceof CMS_language) {
                 $this->raiseError('$treatmentParameters["language"] must be a CMS_language object');
                 return false;
             }
             if (!$treatmentParameters["clientSpace"] instanceof CMS_moduleClientspace) {
                 $this->raiseError('$treatmentParameters["clientSpace"] must be a CMS_moduleClientspace object');
                 return false;
             }
             if ($tag->getName() == 'row') {
                 //replace {{pageID}} tag in all page content.
                 return str_replace('{{pageID}}', $treatmentParameters["page"]->getID(), $tag->getInnerContent());
             } else {
                 //create the block data
                 $block = $tag->getRepresentationInstance();
                 return $block->getData($treatmentParameters["language"], $treatmentParameters["page"], $treatmentParameters["clientSpace"], $treatedObject, $visualizationMode);
             }
             break;
         case MODULE_TREATMENT_CLIENTSPACE_TAGS:
             if (!$treatedObject instanceof CMS_pageTemplate) {
                 $this->raiseError('$treatedObject must be a CMS_pageTemplate object');
                 return false;
             }
             if (!$treatmentParameters["page"] instanceof CMS_page) {
                 $this->raiseError('$treatmentParameters["page"] must be a CMS_page object');
                 return false;
             }
             if (!$treatmentParameters["language"] instanceof CMS_language) {
                 $this->raiseError('$treatmentParameters["language"] must be a CMS_language object');
                 return false;
             }
             $args = array("template" => $treatedObject->getID());
             if ($visualizationMode == PAGE_VISUALMODE_CLIENTSPACES_FORM || $visualizationMode == PAGE_VISUALMODE_HTML_EDITION || $visualizationMode == PAGE_VISUALMODE_FORM) {
                 $args["editedMode"] = true;
             }
             //load CS datas
             switch ($tag->getName()) {
                 case 'atm-clientspace':
                 default:
                     $client_space = $tag->getRepresentationInstance($args);
                     switch ($visualizationMode) {
                         case PAGE_VISUALMODE_PRINT:
                             $data = "";
                             $clientSpacesData = array();
                             $csTagID = $tag->getAttribute("id");
                             $printingCS = $treatedObject->getPrintingClientSpaces();
                             if (in_array($csTagID, $printingCS)) {
                                 $clientSpacesData[$csTagID] = $client_space->getData($treatmentParameters["language"], $treatmentParameters["page"], $visualizationMode, $treatedObject->hasPages());
                             }
                             foreach ($printingCS as $cs) {
                                 if (isset($clientSpacesData[$cs])) {
                                     $data .= $clientSpacesData[$cs] . '<br />';
                                 }
                             }
                             return $data;
                             break;
                         default:
                             if (is_object($client_space)) {
                                 return $client_space->getData($treatmentParameters["language"], $treatmentParameters["page"], $visualizationMode, false);
                             } else {
                                 return '';
                             }
                             break;
                     }
                     break;
             }
             break;
         case MODULE_TREATMENT_LINXES_TAGS:
             switch ($tag->getName()) {
                 case "atm-linx":
                     //linx are visible only if target pages are published (public tree)
                     $linx_args = array("page" => $treatedObject, "publicTree" => true);
                     $linx = $tag->getRepresentationInstance($linx_args);
                     return $linx->getOutput(true);
                     break;
             }
             return '';
             break;
         case MODULE_TREATMENT_PAGECONTENT_TAGS:
             if (!$treatedObject instanceof CMS_page) {
                 $this->raiseError('$treatedObject must be a CMS_page object');
                 return false;
             }
             switch ($tag->getName()) {
                 case "atm-main-url":
                     return CMS_websitesCatalog::getMainURL();
                     break;
                 case "atm-keywords":
                     return '<meta name="keywords" content="' . SensitiveIO::sanitizeHTMLString($treatedObject->getKeywords($visualizationMode == PAGE_VISUALMODE_HTML_PUBLIC)) . '" />';
                     break;
                 case "atm-description":
                     return '<meta name="description" content="' . SensitiveIO::sanitizeHTMLString($treatedObject->getDescription($visualizationMode == PAGE_VISUALMODE_HTML_PUBLIC)) . '" />';
                     break;
                 case "atm-last-update":
                     $lastlog = CMS_log_catalog::getByResourceAction(MOD_STANDARD_CODENAME, $treatedObject->getID(), array(CMS_log::LOG_ACTION_RESOURCE_SUBMIT_DRAFT, CMS_log::LOG_ACTION_RESOURCE_DIRECT_VALIDATION), 1);
                     if (!$lastlog || !is_object($lastlog[0])) {
                         return '';
                     }
                     $user = $lastlog[0]->getUser();
                     $date = $lastlog[0]->getDateTime();
                     $dateformat = $tag->getAttribute("format") ? $tag->getAttribute("format") : 'Y-m-d';
                     $replace = array('{{date}}' => date($dateformat, $date->getTimestamp()), '{{firstname}}' => $user->getFirstName(), '{{lastname}}' => $user->getLastName());
                     return str_replace(array_keys($replace), $replace, $tag->getInnerContent());
                     break;
                 case "atm-print-link":
                     if ($treatedObject->getPrintStatus()) {
                         $template = $tag->getInnerContent();
                         if ($tag->getAttribute("keeprequest") == 'true') {
                             return '<?php echo \'' . str_replace("{{href}}", $treatedObject->getURL(true) . '\'.($_SERVER["QUERY_STRING"] ? \'?\'.$_SERVER["QUERY_STRING"] : \'\').\'', str_replace("\\\\'", "\\'", str_replace("'", "\\'", $template))) . '\' ?>';
                         } else {
                             return str_replace("{{href}}", $treatedObject->getURL(true), $template);
                         }
                     }
                     return '';
                     break;
                 case "atm-constant":
                     $const = SensitiveIO::stripPHPTags(io::strtoupper($tag->getAttribute("name")));
                     if (defined($const)) {
                         return constant($const);
                     }
                     return '';
                     break;
                 case "head":
                     $headCode = '<?php' . "\n" . '$atmHost = null;' . "\n" . '$atmPort = null;' . "\n" . 'if(isset($_SERVER["HTTP_HOST"])) {' . "\n" . '	$atmHost = @parse_url($_SERVER["HTTP_HOST"], PHP_URL_HOST) ? @parse_url($_SERVER["HTTP_HOST"], PHP_URL_HOST) : $_SERVER["HTTP_HOST"];' . "\n" . '	$atmPort = @parse_url($_SERVER[\'HTTP_HOST\'], PHP_URL_PORT) ? \':\'.@parse_url($_SERVER[\'HTTP_HOST\'], PHP_URL_PORT) : \'\';' . "\n" . '}' . "\n" . 'echo "\\t".\'<base href="//\'.$atmHost.$atmPort.PATH_REALROOT_WR.\'/" />\'."\\n";' . "\n" . ' ?>';
                     //Append base code
                     return preg_replace('#<head([^>]*)>#', '<head\\1>' . "\n" . $headCode, $tag->getContent());
                     break;
                 case "body":
                     $statsCode = '<?php if (SYSTEM_DEBUG && STATS_DEBUG) {echo CMS_stats::view();} ?>';
                     //Append stats code
                     return preg_replace('#</body>$#', $statsCode . "\n" . '</body>', $tag->getContent());
                     break;
                 case "html":
                     //Append DTD
                     return '<?php if (defined(\'APPLICATION_XHTML_DTD\')) echo APPLICATION_XHTML_DTD."\\n"; ?>' . "\n" . $tag->getContent();
                     break;
             }
             return '';
             break;
         case MODULE_TREATMENT_PAGEHEADER_TAGS:
             if (!$treatedObject instanceof CMS_page) {
                 $this->raiseError('$treatedObject must be a CMS_page object');
                 return false;
             }
             switch ($tag->getName()) {
                 case "atm-linx":
                     if ($visualizationMode == PAGE_VISUALMODE_CLIENTSPACES_FORM || $visualizationMode == PAGE_VISUALMODE_FORM) {
                         //direct linx are visible even if target pages are not published (edited tree)
                         //all other linx are only visible if they are published (public tree)
                         $linx_args = array("page" => $treatedObject, "publicTree" => !($tag->getAttribute('type') == 'direct' || !$tag->getAttribute('type')));
                         $linx = $tag->getRepresentationInstance($linx_args);
                         $linx->setDebug(false);
                         $linx->setLog(false);
                         return $linx->getOutput();
                     } else {
                         //for public and print visualmode, this treatment is done by MODULE_TREATMENT_LINXES_TAGS mode during page file linx treatment
                         if ($visualizationMode != PAGE_VISUALMODE_HTML_PUBLIC && $visualizationMode != PAGE_VISUALMODE_PRINT) {
                             //linx are visible only if target pages are published (public tree)
                             $linx_args = array("page" => $treatedObject, "publicTree" => true);
                             $linx = $tag->getRepresentationInstance($linx_args);
                             return $linx->getOutput();
                         }
                     }
                     break;
                 case "atm-js-tags":
                 case "atm-css-tags":
                     $usage = CMS_module::moduleUsage($treatedObject->getID(), $this->_codename);
                     $tagFiles = $tag->getAttribute('files');
                     $tagFiles = array_map('trim', explode(',', $tagFiles));
                     //only if current page use a block of this module
                     if ($tagFiles) {
                         //save in global var the page ID who use this tag
                         CMS_module::moduleUsage($treatedObject->getID(), $this->_codename, array($tag->getName() => true));
                         $return = '';
                         //overwrite previous modules return to append files of this module
                         //save new 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");
                                 $files = is_array($files) ? $files : array();
                                 //append module js files
                                 $files = array_merge($files, $tagFiles);
                                 //append CMS_function.js file
                                 if (!isset($usage['js-files']) && file_exists(PATH_JS_FS . '/CMS_functions.js')) {
                                     $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]);
                             }
                         }
                     }
                     $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()));
                     return '';
                 }
                 $nodespecs = $domdocument->getElementsByTagName('nodespec');
                 if ($nodespecs->length == 1) {
                     $nodespec = $nodespecs->item(0);
                 }
                 $htmltemplates = $domdocument->getElementsByTagName('htmltemplate');
                 if ($htmltemplates->length == 1) {
                     $htmltemplate = $htmltemplates->item(0);
                 }
                 $noselections = $domdocument->getElementsByTagName('noselection');
                 if ($noselections->length == 1) {
                     $noselection = $noselections->item(0);
                 }
                 if ($nodespec && $htmltemplate) {
                     //if ($paramsTags[0]->getName() == "nodespec" && $paramsTags[1]->getName() == "noselection" && $paramsTags[2]->getName() == "htmltemplate") {
                     if (isset($noselection)) {
                         // case noselection tag
                         $pageID = $nodespec->getAttribute("value");
                         $link = CMS_DOMDocument::DOMElementToString($htmltemplate, true);
                         $treatedLink = str_replace('href', 'noselection="true" href', str_replace('{{href}}', '{{' . $pageID . '}}', $link));
                     } else {
                         $pageID = $nodespec->getAttribute("value");
                         $link = CMS_DOMDocument::DOMElementToString($htmltemplate, true);
                         $treatedLink = str_replace('{{href}}', '{{' . $pageID . '}}', $link);
                     }
                 }
             } elseif ($tag->getName() == 'span') {
                 //linx from other module
                 $ids = explode('-', $tag->getAttribute('id'));
                 $selectedPageID = (int) $ids[1];
                 $noselection = $ids[2];
                 //then create the code to paste for the current selected object if any
                 if (sensitiveIO::isPositiveInteger($selectedPageID) && ($noselection == 'true' || $noselection == 'false')) {
                     $pattern = "/(.*)<a([^>]*)'\\.CMS_tree.*, 'url'\\)\\.'(.*)\\<\\/a>(.*)<\\/span>/U";
                     if ($noselection == 'true') {
                         $replacement = '<a noselection="true"\\2{{' . $selectedPageID . '}}\\3</a>';
                     } else {
                         $replacement = '<a\\2{{' . $selectedPageID . '}}\\3</a>';
                     }
                     $treatedLink = str_replace("\\'", "'", preg_replace($pattern, $replacement, $tag->getContent()));
                 }
             }
             return $treatedLink;
         case MODULE_TREATMENT_WYSIWYG_OUTER_TAGS:
             //Anchor
             if (preg_match('/^#([a-zA-Z0-9._{}:-]*)$/i', $tag->getAttribute('href')) > 0) {
                 //instanciate anchor tag
                 $anchor = new CMS_XMLTag_anchor($tag->getName(), $tag->getAttributes(), $tag->getChildren(), $tag->getParameters());
                 return $anchor->compute(array('mode' => $treatmentMode, 'visualization' => $visualizationMode, 'object' => $treatedObject, 'parameters' => $treatmentParameters));
             } elseif (preg_match('/^.*\\{\\{(\\d+)\\}\\}.*$/i', $tag->getAttribute('href')) > 0) {
                 //internal links
                 /* Pattern explanation :
                  *
                  * \<a([^>]*) : start with "<a" and any characters after except a ">". Content found into the "()" (first parameters of the link) is the first variable : "\\1"
                  * {{(\d+)}} : some numbers only into "{{" and "}}". Content found into the "()" (the page number) is the second variable : "\\2"
                  * (.*)\<\/a> : any characters after followed by "</a>". Content found into the "()" (last parameters of the link and link content) is the third variable : "\\3"
                  * /U : PCRE_UNGREEDY stop to the first finded occurence.
                  */
                 $pattern = "/<a([^>]*){{(\\d+)}}(.*)\\<\\/a>/Us";
                 if ($tag->getName() == 'a' && $treatmentParameters['module'] == MOD_STANDARD_CODENAME) {
                     if ($tag->getAttribute('noselection') == 'true') {
                         $replacement = "<atm-linx type=\"direct\"><selection><start><nodespec type=\"node\" value=\"\\2\"/></start></selection><noselection>" . $tag->getInnerContent() . "</noselection><display><htmltemplate><a\\1{{href}}\\3</a></htmltemplate></display></atm-linx>";
                         $treatedLink = preg_replace($pattern, $replacement, str_replace('noselection="true"', '', $tag->getContent()));
                     } else {
                         $replacement = "<atm-linx type=\"direct\"><selection><start><nodespec type=\"node\" value=\"\\2\"/></start></selection><display><htmltemplate><a\\1{{href}}\\3</a></htmltemplate></display></atm-linx>";
                         $treatedLink = preg_replace($pattern, $replacement, $tag->getContent());
                     }
                 } elseif ($tag->getName() == 'a' && $treatmentParameters['module'] != MOD_STANDARD_CODENAME) {
                     if ($tag->getAttribute('noselection') == 'true') {
                         $replacement = '<span id="' . MOD_STANDARD_CODENAME . '-\\2-true"><?php if (CMS_tree::pageExistsForUser(\\2)) { echo \'<a\\1\'.CMS_tree::getPageValue(\\2, \'url\').\'\\3</a>\';} else { echo ' . var_export($tag->getInnerContent(), true) . ';} ?><!--{elements:' . base64_encode(serialize(array('module' => array(0 => MOD_STANDARD_CODENAME)))) . '}--></span>';
                         $treatedLink = preg_replace($pattern, $replacement, str_replace(array('noselection="true"', "'"), array('', "\\'"), $tag->getContent()));
                     } else {
                         $replacement = '<span id="' . MOD_STANDARD_CODENAME . '-\\2-false"><?php if (CMS_tree::pageExistsForUser(\\2)) { echo \'<a\\1\'.CMS_tree::getPageValue(\\2, \'url\').\'\\3</a>\';} ?><!--{elements:' . base64_encode(serialize(array('module' => array(0 => MOD_STANDARD_CODENAME)))) . '}--></span>';
                         $treatedLink = preg_replace($pattern, $replacement, str_replace("'", "\\'", $tag->getContent()));
                     }
                 }
                 return $treatedLink;
             }
             break;
     }
     //in case of no tag treatment, simply return it
     return $tag->getContent();
 }