示例#1
0
 $tempformfield['VALUE'] = $props[$c]['VALUE'];
 $tempformfield['IDENTIFIER'] = 'ALIAS01';
 $tempformfield['LIST_VALUES'] = NULL;
 $tempformfield['DISPLAYNAME'] = '';
 switch ($props[$c]['TYPE']) {
     case 'TEXT':
         $tempformfield['FORMFIELD'] = 1;
         $tempformfield['VALUE'] = replaceSpecialURLs($props[$c]['VALUE']);
         break;
     case 'TEXTAREA':
         $tempformfield['FORMFIELD'] = 2;
         $tempformfield['VALUE'] = replaceSpecialURLs($props[$c]['VALUE']);
         break;
     case 'RICHTEXT':
         $tempformfield['FORMFIELD'] = 3;
         $tempformfield['VALUE'] = replaceSpecialURLs($props[$c]['VALUE']);
         break;
     case 'CHECKBOX':
         $tempformfield['FORMFIELD'] = 4;
         break;
     case 'LINK':
         $tempformfield['FORMFIELD'] = 5;
         $special_url = resolveSpecialURL($props[$c]['VALUE']);
         if ($special_url !== false) {
             $special_url_info = getSpecialURLInfo($props[$c]['VALUE']);
             if ($special_url_info['TYPE'] == 'IMG' || $special_url_info['TYPE'] == 'DOWN') {
                 $tempformfield['IS_FILE'] = true;
                 if ($special_url_info['ID']) {
                     $file = sFileMgr()->getFile($special_url_info['ID']);
                     $link_fileinfo = $file->get();
                     $tempformfield['LINKTITLE'] = $link_fileinfo['NAME'];
示例#2
0
function renderPage($page, $version, $pageInfo, $pageMgr, $siteInfo)
{
    $templateMgr = new Templates();
    $pageID = $pageInfo["OBJECTID"];
    $templateInfo = $templateMgr->getTemplate($pageInfo["TEMPLATEID"]);
    $templatefilename = $templateInfo["FILENAME"];
    $templatefullpath = $templateMgr->getDir() . $templateInfo["PATH"] . $templatefilename;
    $content = $page->getContent();
    // navi
    $tree = $pageMgr->getList($pageID, array($filter));
    $tree = $pageMgr->getAdditionalTreeInfo($pageID, $tree, true);
    $oldlevel = 0;
    for ($xt = 0; $xt < count($tree); $xt++) {
        if ($oldlevel != $tree[$xt]["LEVEL"] || !$pnames) {
            $tree[$xt]["PARENTS"] = $pnames = $pageMgr->getParents($tree[$xt]["ID"]);
            $oldlevel = $tree[$xt]["LEVEL"];
        } else {
            $tree[$xt]["PARENTS"] = $pnames;
        }
        if ($pageID == $tree[$xt]["ID"]) {
            $pageInfo["PARENTS"] = $pnames;
        }
        $url = "";
        $pi = count($pnames);
        while ($pi > 0) {
            $url .= $pnames[$pi - 1][0]["PNAME"] . "/";
            $pi--;
        }
        $tree[$xt]["PURL"] = $url . $tree[$xt]["PNAME"] . "/";
        $tree[$xt]["URL"] = sApp()->webroot . $url . $tree[$xt]["PNAME"] . "/";
        if ($tree[$xt]["HIDDEN"] == 0 && $tree[$xt]["SHOW"] == 1) {
            $xtc = $xtc + 1;
        }
    }
    $pageMgr->callExtensionHook("onRender", $siteInfo["ID"], $pageID, $version, array("FILTER" => $filter, "CONTENTAREAS" => &$content));
    // Fill userinfo with data from current user
    $currUser = new User(sUserMgr()->getCurrentUserID());
    $userInfo = $currUser->get();
    $userInfo['FULLNAME'] = trim($userInfo['FIRSTNAME'] . ' ' . $userInfo['LASTNAME']);
    sApp()->smarty->assign("user", $userInfo);
    sApp()->smarty->assign("devmode", (string) sApp()->devmode);
    sApp()->smarty->assign("pageinfo", $pageInfo);
    sApp()->smarty->assign("contentareas", $content);
    sApp()->smarty->assign("tree", $tree);
    sApp()->smarty->assign("site", $siteInfo["ID"]);
    sApp()->smarty->assign("siteinfo", $siteInfo);
    sApp()->smarty->assign("sitename", $siteInfo["PNAME"]);
    sApp()->smarty->assign("untitledparams", sApp()->request->untitled_parameters);
    if (!sApp()->output_tmp) {
        if ($templateInfo == NULL) {
            sApp()->output_tmp = "";
        } else {
            sApp()->output_tmp = sApp()->smarty->fetch("file:" . $templatefullpath);
        }
    }
    //2nd pass
    sApp()->smarty->left_delimiter = '[!';
    sApp()->smarty->right_delimiter = '!]';
    sApp()->output = sApp()->smarty->fetch("var:" . sApp()->output_tmp);
    //3rd pass (replace special urls with normal urls)
    sApp()->output = replaceSpecialURLs(sApp()->output);
    echo sApp()->output;
}
示例#3
0
$mailing = $mailingMgr->getMailing($mailingId, $mailingVersion);
// Mailing Properties
$mailingInfo = $mailing->get();
$mailingProperties = $mailing->properties->get();
$mailingInfo = array_merge($mailingProperties, $mailingInfo);
// Template
$templateMgr = new Templates();
$templateInfo = $templateMgr->getTemplate($mailingInfo['TEMPLATEID']);
$templatefilename = $templateInfo['FILENAME'];
$templatefullpath = $templateMgr->getDir() . $templateInfo['PATH'] . $templatefilename;
// Content
$content = $mailing->getContent();
$mailingcnt = array('USERINFO' => $userInfo, 'FILTER' => $filter, 'CONTENTAREAS' => &$content);
$mailingMgr->callExtensionHook('onRender', $mailingId, $mailingVersion, $mailingcnt);
sSmarty()->assign('pageinfo', $mailingInfo);
sSmarty()->assign('contentareas', $content);
if (!$output_tmp) {
    $output_tmp = sSmarty()->fetch('file:' . $templatefullpath);
}
// 2nd pass
sSmarty()->left_delimiter = '[!';
sSmarty()->right_delimiter = '!]';
sApp()->output = sSmarty()->fetch('var:' . $output_tmp);
// 3rd pass (replace special urls with normal urls)
sApp()->output = replaceSpecialURLs(sApp()->output, true);
// Replace relative URLs with aboslute URLs
sApp()->output = $mailing->absolutizeURLs(sApp()->output);
// Output everthing if we are in preview mode
if ($previewMode) {
    echo sApp()->output;
}
示例#4
0
 /**
  * Post processes a property value (resolves urls, permanent names, etc.)
  *
  * @param string $type Property type
  * @param string $value Property value
  * @return mixed Post processed property value
  */
 function postProcessValue($type, $value)
 {
     switch ($type) {
         case 'LINK':
             $linkInfo = checkLinkInternalExternal(resolveSpecialURL($value));
             if ($linkInfo['TYPE'] == 'internal') {
                 return resolveSpecialURL($linkInfoJSON['href']);
             } elseif ($linkInfo['TYPE'] == 'file') {
                 $pname = sFileMgr()->getPNameByFileId($linkInfo['INFO']['FILE_ID']);
                 if ($pname) {
                     return sApp()->webroot . 'download/' . $pname;
                 }
             } else {
                 if ($value != '') {
                     return $value;
                 } else {
                     return NULL;
                 }
             }
         case 'PAGE':
             $pageInfo = json_decode($value, true);
             $tmpPageMgr = sPageMgr($pageInfo['site']);
             $tmpPage = $tmpPageMgr->getPage($pageInfo['page']);
             if ($tmpPage) {
                 $tmpUrl = $tmpPage->getUrl();
                 $tmpPname = $tmpPageMgr->getPNameByPageId($pageInfo['page']);
                 return array('SITE_ID' => $pageInfo['site'], 'PAGE_ID' => $pageInfo['page'], 'URL' => $tmpUrl, 'PNAME' => $tmpPname, 'VALUE' => $value);
             } else {
                 return NULL;
             }
         case 'FILE':
             $pname = sFileMgr()->getPNameByFileId($value);
             if ($pname) {
                 return array('FILE_ID' => $value, 'URL' => sApp()->webroot . 'download/' . $pname, 'IMAGE_URL' => sApp()->webroot . 'image/' . $pname, 'PNAME' => $pname, 'VALUE' => $value);
             } else {
                 return NULL;
             }
         case 'RICHTEXT':
             return replaceSpecialURLs($value);
             break;
         case 'CBLOCK':
             $pname = sCblockMgr()->getPNameByCblockId($value);
             if ($pname) {
                 return array('CBLOCK_ID' => $value, 'PNAME' => $pname, 'VALUE' => $value);
             } else {
                 return NULL;
             }
         case 'TAG':
             $tagInfo = sTags()->get($value);
             if ($tagInfo) {
                 return array('TAG_ID' => $value, 'NAME' => $tagInfo['NAME'], 'VALUE' => $value);
             } else {
                 return NULL;
             }
         default:
             return $value;
     }
 }
示例#5
0
 /**
  * Gets Formfields of this Cblock including content, optionally of one specific Entrymask (internal method)
  *
  * @param int $linkId (optional) Cblock Entrymask Link Id
  * @return array Array of Formfields
  */
 function getFormfieldsInternal($linkId = 0)
 {
     $version = (int) $this->getVersion();
     $linkId = (int) $linkId;
     $cbId = (int) $this->_id;
     if ($this->permissions->checkInternal($this->_uid, $cbId, "RREAD")) {
         if ($cbId > 0) {
             $sql_where = "CBID = {$cbId} AND CBVERSION = {$version} ";
         }
         if ($linkId > 0) {
             $linksql = "AND lnk.ID = {$linkId}";
         }
         $sql = "SELECT\n\t\t\t\tlnk.ID AS LINKID,\n\t\t\t\tlnk.ENTRYMASK AS ENTRYMASKID,\n\t\t\t\tctrl.CODE AS CODE,\n\t\t\t\tctrl.NAME AS ENTRYMASKNAME,\n\t\t\t\tCBID,\n\t\t\t\tCBVERSION\n\t\t\tFROM\n\t\t\t\t`yg_contentblocks_lnk_entrymasks` as lnk,\n\t\t\t\tyg_entrymasks_properties as ctrl\n\t\t\tWHERE\n\t\t\t\t({$sql_where} {$linksql}) AND\n\t\t\t\t(lnk.ENTRYMASK = ctrl.OBJECTID)\n\t\t\tORDER BY ORDERPROD;";
         $ra = $this->cacheExecuteGetArray($sql);
         $webroot = (string) Singleton::config()->getVar('CONFIG/DIRECTORIES/WEBROOT');
         for ($l = 0; $l < count($ra); $l++) {
             $sql = "SELECT\n\t\t\t\t\t\t\tl.ID AS LINKID,\n\t\t\t\t\t\t\tl.ENTRYMASK AS ENTRYMASKID,\n\t\t\t\t\t\t\tp.CODE AS CODE,\n\t\t\t\t\t\t\tp.NAME AS ENTRYMASKNAME,\n\t\t\t\t\t\t\tw.IDENTIFIER AS IDENTIFIER,\n\t\t\t\t\t\t\tf.TYPE AS TYPE,\n\t\t\t\t\t\t\tc.ID,\n\t\t\t\t\t\t\tc.FORMFIELD,\n\t\t\t\t\t\t\tc.ENTRYMASKFORMFIELD,\n\t\t\t\t\t\t\tc.LNK,\n\t\t\t\t\t\t\tc.VALUE01,\n\t\t\t\t\t\t\tc.VALUE02,\n\t\t\t\t\t\t\tc.VALUE03,\n\t\t\t\t\t\t\tc.VALUE04,\n\t\t\t\t\t\t\tc.VALUE05,\n\t\t\t\t\t\t\tc.VALUE06,\n\t\t\t\t\t\t\tc.VALUE07,\n\t\t\t\t\t\t\tc.VALUE08,\n\t\t\t\t\t\t\tw.NAME AS NAME,\n\t\t\t\t\t\t\tl.CBID AS CBID,\n\t\t\t\t\t\t\tw.PRESET AS PRESET,\n\t\t\t\t\t\t\tw.WIDTH AS WIDTH,\n\t\t\t\t\t\t\tw.MAXLENGTH AS MAXLENGTH,\n\t\t\t\t\t\t\tw.CONFIG AS CONFIG,\n\t\t\t\t\t\t\tw.CUSTOM AS CUSTOM\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\tyg_contentblocks_lnk_entrymasks_c AS c,\n\t\t\t\t\t\t\tyg_contentblocks_lnk_entrymasks AS l,\n\t\t\t\t\t\t\tyg_entrymasks_lnk_formfields as w,\n\t\t\t\t\t\t\tyg_entrymasks_properties AS p,\n\t\t\t\t\t\t\tyg_formfields as f\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t(c.LNK = ?) AND\n\t\t\t\t\t\t\t(c.LNK = l.ID) AND\n\t\t\t\t\t\t\t(c.ENTRYMASKFORMFIELD = w.ID) AND\n\t\t\t\t\t\t\t(w.ENTRYMASK = p.OBJECTID) AND\n\t\t\t\t\t\t\t(l.ENTRYMASK = p.OBJECTID) AND\n\t\t\t\t\t\t\t(c.FORMFIELD = f.ID)\n\t\t\t\t\t\tORDER BY w.ORDER ASC;";
             $wc = $this->cacheExecuteGetArray($sql, $ra[$l]["LINKID"]);
             for ($w = 0; $w < count($wc); $w++) {
                 switch ($wc[$w]['TYPE']) {
                     case 'TEXT':
                     case 'CHECKBOX':
                     case 'PASSWORD':
                     case 'DATE':
                     case 'DATETIME':
                     case 'HEADLINE':
                         $wc[$w]['VALUE'] = $wc[$w]['VALUE01'];
                         break;
                     case 'TEXTAREA':
                     case 'WYSIWYG':
                         $wc[$w]['VALUE'] = replaceSpecialURLs($wc[$w]['VALUE01']);
                         break;
                     case 'LINK':
                         $resolvedUrl = resolveSpecialURL($wc[$w]['VALUE01']);
                         if ($resolvedUrl) {
                             $wc[$w]['URL'] = $resolvedUrl;
                         } else {
                             $wc[$w]['URL'] = $wc[$w]['VALUE01'];
                         }
                         break;
                     case 'PAGE':
                         $wc[$w]['PAGE_ID'] = $wc[$w]['VALUE01'];
                         $wc[$w]['SITE_ID'] = $wc[$w]['VALUE02'];
                         $wc[$w]['URL'] = $webroot . $wc[$w]['VALUE03'];
                         $wc[$w]['PNAME'] = $wc[$w]['VALUE04'];
                         $wc[$w]['SITE_PNAME'] = $wc[$w]['VALUE05'];
                         break;
                     case 'FILE':
                     case 'FILEFOLDER':
                         $wc[$w]['FILE_ID'] = $wc[$w]['VALUE01'];
                         if ($wc[$w]['FILE_ID']) {
                             $wc[$w]['VALUE03'] = sFileMgr()->getPNameByFileId($wc[$w]['FILE_ID']);
                         }
                         $wc[$w]['URL'] = '';
                         if ($wc[$w]['VALUE03'] != "") {
                             $wc[$w]['URL'] = $webroot . 'download/' . $wc[$w]['VALUE03'];
                             $wc[$w]['IMAGE_URL'] = $webroot . 'image/' . $wc[$w]['VALUE03'];
                             $wc[$w]['PNAME'] = $wc[$w]['VALUE03'];
                         }
                         break;
                     case 'CO':
                         $wc[$w]['CBLOCK_ID'] = $wc[$w]['VALUE01'];
                         break;
                     case 'TAG':
                         $wc[$w]['TAG_ID'] = $wc[$w]['VALUE01'];
                         break;
                     case 'LIST':
                         $wc[$w]['VALUE'] = $wc[$w]['VALUE01'];
                         break;
                 }
             }
         }
         return $wc;
     } else {
         return false;
     }
 }