public function onRender($args = NULL) { $page = $this->getPage(); $pageinfo = $page->get(); $action = sApp()->request->parameters['ACTION']; // check if commenting user is authenticated $anonymousUserID = sUserMgr()->getAnonymousID(); if ((int) sUserMgr()->getCurrentUserID() == $anonymousUserID) { $isLoggedIn = false; } else { $isLoggedIn = true; } // get comment infos $commentError = NULL; $commentObject = $page->comments; $commentSettings = $commentObject->getSettings(); $commentStatus = $commentObject->getStatus($pageinfo['ID']); $commentPermission = $page->permissions->check(sUserMgr()->getCurrentUserID(), 'RCOMMENT', $pageinfo['ID']); // add comment if ($action == 'ADD') { $commentUser = sApp()->request->parameters['USER']; $commentEmail = sApp()->request->parameters['EMAIL']; $commentText = sApp()->request->parameters['TEXT']; $result = $commentObject->add($commentText, $pageinfo['ID'], $commentUser, $commentEmail); if ($result !== ERROR_NONE) { switch ($result) { case ERROR_COMMENTS_MINIMUM_POST_INTERVAL_EXCEEDED: $commentError = 'Minimum post interval was exceeded.'; break; case ERROR_COMMENTS_BLACKLISTED_WORD: $commentError = 'You have used a blacklisted word.'; break; case ERROR_COMMENTS_AUTHENTICATION_NEEDED: $commentError = 'Authentication is needed.'; break; case ERROR_COMMENTS_COMMENTING_IS_CLOSED: $commentError = 'Commenting is closed.'; break; case ERROR_COMMENTS_NO_COMMENT_RIGHTS: $commentError = 'No permissions to comment.'; break; default: $commentError = 'An unknown error has occured.'; break; } } } // get comments - has to be after add functionaly in order for new comments to show up $commentCount = $commentObject->getCommentsCount(); $comments = $commentObject->getComments($pageinfo['ID'], NULL); sSmarty()->assign("isLoggedIn", $isLoggedIn); sSmarty()->assign("commentError", $commentError); sSmarty()->assign("commentCount", $commentCount); sSmarty()->assign("commentPermission", $commentPermission); sSmarty()->assign("commentSettings", $commentSettings); sSmarty()->assign("commentStatus", $commentStatus); sSmarty()->assign("comments", $comments); }
function getRequestPathString($request_path) { $request_path_string = implode('/', $request_path); if (strpos($request_path_string, "page/") === 0) { $request_path_string = substr($request_path_string, strlen("page/")); } if (strpos($request_path_string, sApp()->webroot) === 0) { $request_path_string = substr($request_path_string, strlen(sApp()->webroot)); } if ($colonPos = strpos($request_path_string, ':')) { $request_path_string = substr($request_path_string, 0, $colonPos); } return $request_path_string; }
public function onRender() { $action = sApp()->request->parameters['action']; if ($action == "insert") { $title = sYDB()->escape_string(sApp()->request->parameters['title']); $author = sYDB()->escape_string(sApp()->request->parameters['author']); $date = time(); $tablename = "yg_ext_" . $this->_code . "_exampletable"; $sql = "INSERT INTO {$tablename} \n\t\t\t\t\t(title, author, creation) VALUES \n\t\t\t\t\t(?, ?, ?);"; $dbr = sYDB()->Execute($sql, $title, $author, $date); if ($dbr === false) { throw new \Exception(sYDB()->ErrorMsg()); return false; } else { echo "SUCCESS"; die; } } }
$y2 = $this->params['y2'] / $zoom; $file = sFileMgr()->getFile($id, $version); $url = $file->getUrl(); $fileinfo = $file->get(); $filedir = getrealpath(getcwd() . "/" . sConfig()->getVar('CONFIG/DIRECTORIES/FILESDIR')) . "/"; $filename = $fileinfo['FILENAME']; $views = $file->views->getAssigned(true); for ($i = 0; $i < count($views); $i++) { if ($views[$i]["IDENTIFIER"] == $view) { $width = $views[$i]["WIDTH"]; $height = $views[$i]["HEIGHT"]; $constrainwidth = $views[$i]["CONSTRAINWIDTH"]; $constrainheight = $views[$i]["CONSTRAINHEIGHT"]; } } $procs = sApp()->files_procs; $fileproc = $file->filetypes->getProcessor($fileinfo['FILETYPE']); $procPathInternal = getcwd() . "/" . sConfig()->getVar("CONFIG/DIRECTORIES/FILES_PROCS"); $procPath = getcwd() . "/" . sConfig()->getVar("CONFIG/DIRECTORIES/PROCESSORSDIR"); for ($p = 0; $p < count($procs); $p++) { if ($procs[$p]["name"] == $fileproc) { if (file_exists(getrealpath($procPathInternal . $procs[$p]["dir"] . "/" . $procs[$p]["classname"] . ".php"))) { require_once getrealpath($procPathInternal . $procs[$p]["dir"] . "/" . $procs[$p]["classname"] . ".php"); } elseif (getrealpath($procPath . $procs[$p]["dir"] . "/" . $procs[$p]["classname"] . ".php")) { require_once getrealpath($procPath . $procs[$p]["dir"] . "/" . $procs[$p]["classname"] . ".php"); } else { continue; } $classname = (string) $procs[$p]["classname"]; $namespace = (string) $procs[$p]["namespace"]; if (strlen($namespace)) {
/** * Gets n last History entries * * @param int $max (optional) Maximum number of entries * @param string|array $text (optional) One or multiple text filters * @return array List of History entries * @throws Exception */ function getLastChanges($max = 8, $text = '') { $max = (int) $max; $tmpTableName = 'TMP_' . strtoupper(sApp()->request->parameters['us']) . '_' . rand() . '_HISTORY'; $sql = "DROP TEMPORARY TABLE IF EXISTS `{$tmpTableName}`;"; $result = sYDB()->Execute($sql); if ($result === false) { throw new Exception(sYDB()->ErrorMsg()); } $sql = "CREATE TEMPORARY TABLE `{$tmpTableName}` (\n\t\t\t\t\t`ID` int(11) NOT NULL,\n\t\t\t\t\t`SOURCEID` varchar(20) NOT NULL,\n\t\t\t\t\t`OID` int(11) NOT NULL DEFAULT '0',\n\t\t\t\t\t`DATETIME` int(11) DEFAULT NULL,\n\t\t\t\t\t`TEXT` text NOT NULL,\n\t\t\t\t\t`UID` int(11) NOT NULL DEFAULT '0',\n\t\t\t\t\t`TYPE` int(11) NOT NULL,\n\t\t\t\t\t`TARGETID` int(11) NOT NULL,\n\t\t\t\t\t`OLDVALUE` text NOT NULL,\n\t\t\t\t\t`NEWVALUE` text NOT NULL,\n\t\t\t\t\t`SITEID` int(11) NOT NULL,\n\t\t\t\t\t`FROM` int(11) DEFAULT '0',\n\t\t\t\t\t`TYPE_OID` int(11) DEFAULT NULL,\n\t\t\t\t\tPRIMARY KEY (`ID`),\n\t\t\t\t\tKEY `OID` (`OID`)\n\t\t\t\t);"; $result = sYDB()->Execute($sql); if ($result === false) { throw new Exception(sYDB()->ErrorMsg()); } $sqlargs = array(); if (!is_array($text) && strlen($text) > 1) { $wheresql .= "TEXT=?"; array_push($sqlargs, $text); } else { if (is_array($text) && count($text) > 0) { for ($t = 0; $t < count($text); $t++) { $wheresql .= "TEXT = ? "; array_push($sqlargs, $text[$t]); if ($t < count($text) - 1) { $wheresql .= " OR "; } } } else { $wheresql .= "1"; } } if ($this->_sourceid != "") { $sourcesql = "AND SOURCEID = ?"; array_push($sqlargs, $this->_sourceid); } $sql = "INSERT INTO `{$tmpTableName}`\n\t\t\t\tSELECT\n\t\t\t\t\t*,\n\t\t\t\t\t((TYPE *1000000) + OID) AS `TYPE_OID`\n\t\t\t\tFROM " . $this->_table . "\n\t\t\t\tWHERE {$wheresql} {$sourcesql}\n\t\t\t\tORDER BY `DATETIME` DESC\n\t\t\t\tLIMIT 0, 2000;"; array_unshift($sqlargs, $sql); $dbr = call_user_func_array(array(sYDB(), 'Execute'), $sqlargs); if ($dbr === false) { throw new Exception(sYDB()->ErrorMsg()); } // Get folder for embedded cblocks $embeddedCblockFolder = (int) sConfig()->getVar('CONFIG/EMBEDDED_CBLOCKFOLDER'); // Remove all embedded Cblocks from temporary table $sql = "DELETE\n\t\t\t\tFROM\n\t\t\t\t\t`{$tmpTableName}`\n\t\t\t\tUSING\n\t\t\t\t\t`{$tmpTableName}`\n\t\t\t\tINNER JOIN\n\t\t\t\t\t`yg_contentblocks_tree`\n\t\t\t\tWHERE\n\t\t\t\t\t(`{$tmpTableName}`.OID = `yg_contentblocks_tree`.ID) AND\n\t\t\t\t\t(`yg_contentblocks_tree`.PARENT = " . $embeddedCblockFolder . ") AND\n\t\t\t\t\t(TYPE = " . HISTORYTYPE_CO . ");"; $result = sYDB()->Execute($sql); if ($result === false) { throw new Exception(sYDB()->ErrorMsg()); } $sql = "SELECT *, (SELECT\n\t\t\t\t\t\tMAX(`DATETIME`)\n\t\t\t\t\tFROM\n\t\t\t\t\t\t" . $this->_table . " AS `h2`\n\t\t\t\t\tWHERE\n\t\t\t\t\t\t`h2`.`OID` = `lft`.`OID`) AS `MAXDATETIME`\n\t\t\t\tFROM `{$tmpTableName}` AS `lft`\n\t\t\t\tGROUP BY `TYPE_OID`\n\t\t\t\tORDER BY `DATETIME` DESC\n\t\t\t\tLIMIT 0, {$max};"; $result = sYDB()->Execute($sql); if ($result === false) { throw new Exception(sYDB()->ErrorMsg()); } $resultarray = $result->GetArray(); for ($i = 0; $i < count($resultarray); $i++) { $oid = $resultarray[$i]['OID']; $rread = false; if ($this->permissions == NULL) { if ($resultarray[$i]['SITEID'] && $resultarray[$i]['TYPE'] == HISTORYTYPE_PAGE) { $tmpPageMgr = new PageMgr($resultarray[$i]['SITEID']); if ($tmpPageMgr->permissions->checkInternal($this->_uid, $oid, "RREAD")) { $rread = true; } } if ($resultarray[$i]['TYPE'] == HISTORYTYPE_CO) { if (sCblockMgr()->permissions->checkInternal($this->_uid, $oid, "RREAD")) { $rread = true; } } if ($resultarray[$i]['TYPE'] == HISTORYTYPE_FILE) { if (sFileMgr()->permissions->checkInternal($this->_uid, $oid, "RREAD")) { $file = sFileMgr()->getFile($oid); if ($file) { $fileinfo = $file->get(); if ($fileinfo["FOLDER"] == 0) { $rread = true; } } } } } else { if ($this->permissions->checkInternal($this->_uid, $oid, "RREAD")) { $rread = true; } } if ($rread) { if ($resultarray[$i]['TYPE'] == HISTORYTYPE_CO) { $tmpCblock = sCblockMgr()->getCblock($resultarray[$i]['OID']); if ($tmpCblock) { $tmpCblockInfo = $tmpCblock->get(); $embeddedCblockFolder = (int) sConfig()->getVar("CONFIG/EMBEDDED_CBLOCKFOLDER"); if ($tmpCblockInfo['PARENT'] != $embeddedCblockFolder) { $ra[] = $resultarray[$i]; } } } else { $ra[] = $resultarray[$i]; } } } return $ra; }
function gen_tree($current, $site = 1, $icons, $imgpath, &$xml_tree, &$tree_id, &$tree_level, $maxlevels, $dnd, $cms, $subnodes, $itext, $action) { if ($tree_level > $maxlevels) { $tree_level--; return; } $svrload = 'false'; if ($tree_level == (int) $maxlevels) { $svrload = 'true'; } $oldlevel = 0; $urlprefix = ""; while (list($key, $value) = each($current)) { if ($current[$key]["RREAD"] > 0) { $iconData = getIconForPage($current[$key]); $img = $icons[$iconData['img']]; $cststyle = $iconData['style']; if ($oldlevel != $current[$key]["LEVEL"]) { $pnames = sPageMgr($site)->getParents($current[$key]["ID"]); $oldlevel = $current[$key]["LEVEL"]; $urlprefix = ""; $pi = count($pnames); while ($pi > 0) { if ($pnames[$pi - 1][0]["PNAME"] != "") { $urlprefix .= $pnames[$pi - 1][0]["PNAME"] . "/"; } $pi--; } } $url = sApp()->webroot . $urlprefix . $current[$key]["PNAME"] . "/"; // Add path if ($img == '' || img != undefined) { $img = $imgpath . 'icons/' . $img; } $node_svrload = 'false'; if ($svrload == 'true' && $current[$key]['CHILDREN'] != NULL) { $node_svrload = $svrload; } $props = array('TREE_ID' => ++$tree_id, 'TREE_LEVEL' => $tree_level, 'ID' => 'page_' . $current[$key]["ID"], 'CAPTION' => htmlspecialchars($current[$key]["NAME"]), 'URL' => $url, 'IC' => $img, 'EXP' => 'false', 'CHK' => 'false', 'CSTSTYLE' => $cststyle, 'TARGET' => '', 'TITLE' => '', 'DND' => $dnd, 'SVRLOAD' => $node_svrload, 'YG_ID' => $current[$key]["ID"] . '-' . $site, 'YG_TYPE' => 'page', 'YG_PROPERTY' => 'name', 'PNAME' => $current[$key]["PNAME"]); array_push($xml_tree, array('OBJECTID' => $tree_id, 'LEVEL' => $tree_level, 'PROPS' => $props)); if (is_array($current[$key]["CHILDREN"])) { $tree_level++; gen_tree($current[$key]["CHILDREN"], $site, $icons, $imgpath, $xml_tree, $tree_id, $tree_level, $maxlevels, $dnd, $cms, $subnodes, $itext, $action); } } } if (!$action && !$subnodes && $tree_level == 1) { $props = array('TREE_ID' => ++$tree_id, 'TREE_LEVEL' => $tree_level, 'ID' => 'page_trash', 'CAPTION' => htmlspecialchars($itext['TXT_TRASHCAN']), 'URL' => $url, 'IC' => $imgpath . 'icons/ico_trashcan_s.png', 'EXP' => 'false', 'CHK' => 'false', 'CSTSTYLE' => 'nodrag nodrop nosub', 'TARGET' => '', 'TITLE' => '', 'DND' => 'false', 'SVRLOAD' => 'false', 'YG_ID' => 'trash-' . $site, 'YG_TYPE' => 'page', 'YG_PROPERTY' => 'name'); array_push($xml_tree, array('OBJECTID' => $tree_id, 'LEVEL' => $tree_level, 'PROPS' => $props)); } $tree_level--; }
public function sendEmail($emailData) { $mail = new PHPMailer(); if ((bool) sConfig()->getVar('CONFIG/MAILINGS/DISABLE')) { return true; } // Obtain userdata $user = new User($emailData['USER_ID']); $userInfo = $user->get(); $userInfo['PROPERTIES'] = $user->properties->getValues($emailData['USER_ID']); // Obtain mailingdata $mailingMgr = new MailingMgr(); $mailing = $mailingMgr->getMailing($emailData['MAILING_ID']); if ($emailData['IS_TEST']) { $mailingInfo = $mailing->get(); $mailingVersion = $mailingInfo['VERSION']; } else { $mailingVersion = $mailing->getLatestApprovedVersion(); $mailing = $mailingMgr->getMailing($emailData['MAILING_ID'], $mailingVersion); $mailingInfo = $mailing->get(); } $templateMgr = new Templates(); $userId = $userInfo['ID']; $userEmail = $userInfo['PROPERTIES']['EMAIL']; $userFirstName = $userInfo['PROPERTIES']['FIRSTNAME']; $userLastName = $userInfo['PROPERTIES']['LASTNAME']; $userName = trim($userFirstName . ' ' . $userLastName); $userCompany = $userInfo['PROPERTIES']['COMPANY']; $userDepartment = $userInfo['PROPERTIES']['COMPANY']; $templateInfo = $templateMgr->getTemplate($mailingInfo['TEMPLATEID']); $userInfo['PROPERTIES']['FULLNAME'] = trim($userFirstName . ' ' . $userLastName); sSmarty()->clear_assign('recipient'); sSmarty()->assign('recipient', $userInfo); sSmarty()->clear_assign('user'); sSmarty()->assign('user', $userInfo['PROPERTIES']); sApp()->output = ''; $emailData['FROM'] = $mailingInfo['FROM_EMAIL']; $emailData['FROM_NAME'] = $mailingInfo['FROM_NAME']; $emailData['FROM_REPLYTO'] = $mailingInfo['FROM_REPLYTO']; $emailData['FROM_SENDER'] = $mailingInfo['FROM_SENDER']; $emailData['ENCODING'] = $mailingInfo['ENCODING']; if ($emailData['ENCODING'] == '') { $emailData['ENCODING'] = 'base64'; } $emailData['SUBJECT'] = $this->replaceUserdataVars($mailingInfo['SUBJECT'], $emailData['USER_ID']); $emailData['BODY_TEXT'] = $this->replaceUserdataVars($mailingInfo['FALLBACK_TEXT'], $emailData['USER_ID']); // Set special smarty delimiters sSmarty()->left_delimiter = '[!'; sSmarty()->right_delimiter = '!]'; // Parse subject with smarty $emailData['SUBJECT'] = sSmarty()->fetch('var:' . $emailData['SUBJECT']); //$emailData['BODY_TEXT'] = sSmarty()->fetch('var:'.$emailData['BODY_TEXT']); // Reset smarty delimiters sSmarty()->left_delimiter = '{'; sSmarty()->right_delimiter = '}'; $mailingId = $emailData['MAILING_ID']; include getrealpath(dirname(__FILE__) . '/../../output/mailing.php'); if ($templateInfo['FILENAME']) { $emailhtml = sApp()->output; $emailhtml = str_replace("\"/neptun/neptun.php", "\"" . $this->request->prefix . "://" . $this->request->http_host . $this->request->script_name, $emailhtml); $emailhtml = $this->replaceUserdataVars($emailhtml, $emailData['USER_ID']); $emailData['BODY_HTML'] = $emailhtml; } else { $emailData['BODY_HTML'] = NULL; } sApp()->output = ''; $smtpServer = (string) sConfig()->getVar('CONFIG/MAILINGS/SMTP'); if ($smtpServer) { $mail->IsSMTP(); $mail->Host = $smtpServer; } if ($emailData['ENCODING']) { $mail->Encoding = $emailData['ENCODING']; } if ($emailData['CHARSET']) { $mail->CharSet = $emailData['CHARSET']; } if ($emailData['FROM']) { $mail->From = $emailData['FROM']; } if ($emailData['FROM_NAME']) { $mail->FromName = $emailData['FROM_NAME']; } if ($emailData['FROM_REPLYTO']) { $mail->AddReplyTo($emailData['FROM_REPLYTO']); } if ($emailData['FROM_SENDER']) { $mail->Sender = $emailData['FROM_SENDER']; } if ($emailData['SUBJECT']) { $mail->Subject = $emailData['SUBJECT']; } if ($emailData['BODY_HTML']) { $mail->Body = $emailData['BODY_HTML']; $mail->IsHTML(true); } if ($emailData['BODY_TEXT'] && !$emailData['BODY_HTML']) { $mail->Body = $emailData['BODY_TEXT']; $mail->IsHTML(false); } if ($emailData['BODY_TEXT'] && $emailData['BODY_HTML']) { $mail->AltBody = $emailData['BODY_TEXT']; } $forcedRecipient = (string) sConfig()->getVar('CONFIG/MAILINGS/FORCE_RECIPIENT'); foreach ($emailData['TO'] as $emailToItem) { if ($forcedRecipient) { $mail->AddAddress($forcedRecipient, $emailToItem['EMAIL_NAME']); } else { $mail->AddAddress($emailToItem['EMAIL'], $emailToItem['EMAIL_NAME']); } } foreach ($emailData['CC'] as $emailCcItem) { $mail->AddCC($emailCcItem['EMAIL'], $emailCcItem['EMAIL_NAME']); } foreach ($emailData['BCC'] as $emailBccItem) { $mail->AddBCC($emailBccItem['EMAIL'], $emailBccItem['EMAIL_NAME']); } foreach ($emailData['ATTACHMENTS'] as $emailAttachmentItem) { $mail->AddAttachment($emailAttachmentItem['PATH'], $emailAttachmentItem['NAME']); } $result = $mail->Send(); $mail->ClearAddresses(); $mailingData = array('USERINFO' => $userInfo, 'DATA' => $emailData); $mailingMgr->callExtensionHook('onSend', $mailingId, $mailingVersion, $mailingData); return $result; }
$ret *= 1024; case 'T': $ret *= 1024; case 'G': $ret *= 1024; case 'M': $ret *= 1024; case 'K': $ret *= 1024; break; } return $ret; } $max_uploadsize = 0; $max_uploadsize = min(let_to_num(ini_get('post_max_size')), let_to_num(ini_get('upload_max_filesize'))); $max_uploadsize = $max_uploadsize / (1024 * 1024) . 'mb'; // Check if a custom login-url is set $customLoginURL = (string) $this->config->getVar('CONFIG/DIRECTORIES/LOGINURL'); if (trim($customLoginURL) != '') { $smarty->assign("base", trim($customLoginURL) . basename($this->request->script_name) . '/'); } $smarty->assign("webroot", sApp()->webroot); $smarty->assign("cookiedomain", (string) $this->config->getVar("CONFIG/SESSION/COOKIES/DOMAIN")); $smarty->assign("devmode", sConfig()->getVar("CONFIG/DEVMODE")); $smarty->assign("max_uploadsize", $max_uploadsize); $smarty->assign("guiSyncInterval", sConfig()->getVar("CONFIG/GUISYNC_INTERVAL")); $smarty->assign("guiSyncTimeout", sConfig()->getVar("CONFIG/GUISYNC_TIMEOUT")); $smarty->assign("objectRelockInterval", sConfig()->getVar("CONFIG/OBJECTRELOCK_INTERVAL")); $smarty->assign("userinfo", $userinfo); $smarty->assign("icon", $icons->icon); $smarty->display('file:' . $this->page_template);
/** * 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; } }
$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; }
} // Access Control $user = new User($userID); $userroles = $user->getUsergroups(); // Map untitled parameters into app::request object $fullpath = implode('/', sApp()->request->path); if ($colonPos = strpos($fullpath, ':')) { $untitledParams = substr($fullpath, $colonPos + 1); $untitledparams = explode(':', $untitledParams); foreach ($untitledparams as $key => $value) { if (is_null($value) || $value == '') { unset($untitledparams[$key]); } } $untitledparams = array_values($untitledparams); sApp()->request->untitled_parameters = $untitledparams; } // Cache Management if ($_SERVER["CACHE_BROWSER"] == 1) { $cachetimes = array(); $cachetimes[] = $cms->pages->cache->cached_object["timestamp"]; $cachetimes[] = sCblockMgr()->cache->cached_object["timestamp"]; $cachetimes[] = $cms->pages->tags->cache->cached_object["timestamp"]; $cachetimes[] = $cms->fileobjects->cache->cached_object["timestamp"]; $cachetimes[] = $cms->users->cache->cached_object["timestamp"]; for ($modulesi = 0; $modulesi <= count($this->modules); $modulesi++) { if (strlen($this->modules[$modulesi]["frontendcode"]) > 0) { $modulecache = new \framework\Cache("", $this->modules[$modulesi]["id"] . $this->_db->databaseName, 0); $cachetimes[] = $modulecache->cached_object["timestamp"]; } }
public function onRender($args = NULL) { $action = sApp()->request->parameters["action"]; sSmarty()->assign("action", $action); /* LOGIN */ if ($action == "login") { $email = sApp()->request->parameters['email']; $password = sApp()->request->parameters['password']; $yg_login_referrer = sApp()->request->parameters["yg_login_referrer"]; sUserMgr()->impersonate(sUserMgr()->getAdministratorID()); $extproperties = $this->extensionProperties->get(); if ($yg_login_referrer == '') { $yg_login_referrer = $extproperties['STANDARD_REFERRER']['URL']; } sSmarty()->assign("yg_login_referrer", $yg_login_referrer); $userid = sUserMgr()->validate($email, $password); sUserMgr()->unimpersonate(); if ($userid === false) { sSmarty()->assign("yg_login_error_code", "1"); sSmarty()->assign('action', $action); sSmarty()->assign("email", $email); } else { sApp()->session->setPSessionVar("username", $email); sApp()->session->setPSessionVar("password", $password); sApp()->session->refrehSessionCookie(); sApp()->session->setPSessionVar("isvalidated", true); sApp()->session->setPSessionVar("keepLoggedIn", true); sApp()->session->cookie_time = time() + 60 * 60 * 24 * 365; http_redirect($yg_login_referrer); } } /* LOGOUT */ if ($action == $this->extensionProperties->getValue('LOGOUT_ACTION')) { $extproperties = $this->extensionProperties->get(); $logout_referrer = $extproperties['STANDARD_LOGOUT_REFERRER']['URL']; sApp()->session->setPSessionVar('username', ''); sApp()->session->setPSessionVar('password', ''); sApp()->session->setPSessionVar('isvalidated', false); sApp()->session->setPSessionVar('keepLoggedIn', false); http_redirect($logout_referrer); } /* PASSWORD RECOVERY */ if ($action == "pwd_step1") { sUserMgr()->impersonate(sUserMgr()->getAdministratorID()); $email = sApp()->request->parameters["user_email"]; $user_info = sUserMgr()->getByLogin($email); if ($user_info) { $user = sUserMgr()->getUser($user_info['ID']); sUserMgr()->unimpersonate(); $expireTS = time() + 60 * 60 * 24; $token = $user->generateToken($expireTS); $page = $this->getPage(); $pageUrl = $page->getUrl(); // Generate path for recovery URL $passwordResetUrl = sApp()->request->prefix . '://' . sApp()->request->http_host; $passwordResetUrl .= $pageUrl . '?action=pwd_step2&user_token=' . urlencode($token); echo $passwordResetUrl; \framework\import("org.phpmailer.phpmailer"); $mail = new \PHPMailer(); $mail->Encoding = '8bit'; $mail->CharSet = 'utf-8'; $mail->From = $this->extensionProperties->getValue("FROM_EMAIL"); $mail->FromName = $this->extensionProperties->getValue("FROM_NAME"); $mail->Subject = $this->extensionProperties->getValue("SUBJECT"); $mail->Body = $this->extensionProperties->getValue("BODY_PT1"); $mail->Body .= "\n" . $passwordResetUrl . "\n"; $mail->Body .= $this->extensionProperties->getValue("BODY_PT2"); $mail->AddAddress($email); $smtpServer = (string) sapp()->config->getVar('CONFIG/MAILINGS/SMTP'); if ($smtpServer) { $mail->IsSMTP(); $mail->Host = $smtpServer; } $mail->Send(); $mail->ClearAddresses(); sSmarty()->assign('recovery_mail_sent', true); } else { if (strlen(trim($email)) > 0) { sSmarty()->assign('error_step1', true); } } } if ($action == "pwd_step2") { $error_step2 = false; $form_send = sApp()->request->parameters['form_send']; sSmarty()->assign('form_send', $form_send); $token = sApp()->request->parameters['user_token']; sSmarty()->assign('user_token', $token); $valid_token = \sUserMgr()->getUserIdByToken($token); if (!$valid_token) { $error_step2 = true; $error_token = true; sSmarty()->assign('error_step2', $error_step2); sSmarty()->assign('error_token', $error_token); } if ($form_send == true) { $user_password = sapp()->request->parameters['user_password']; $user_password_repeat = sapp()->request->parameters['user_password_repeat']; $user_id = sUserMgr()->getUserIdByToken($token); sUserMgr()->impersonate(sUserMgr()->getAdministratorID()); $user = sUserMgr()->getUser($user_id); sUserMgr()->unimpersonate(); $user_info = $user->get(); if ($user_info) { // Check if password is repeated correctly if ($user_password != $user_password_repeat) { $error_repeat = true; sSmarty()->assign('error_repeat', $error_repeat); $error_step2 = true; } // Check if password is secure enough $password_ok = sUserMgr()->verifyPasswordStrength($user_password); if (!$password_ok) { $error_chars = true; sSmarty()->assign('error_chars', $error_chars); $error_step2 = true; } if (!$error_step2) { sUserMgr()->impersonate(sUserMgr()->getAdministratorID()); $user = sUserMgr()->getUser($user_info['ID']); $user->setPassword($user_password); $user->removeToken(); sUserMgr()->unimpersonate(); } else { sSmarty()->assign('error_step2', $error_step2); } } else { $error_step2 = true; sSmarty()->assign('error_step2', $error_step2); } } } return true; }
/** * Gets the URL of this File * * @return string URL of this File */ function getUrl() { $fileID = $this->_id; if ($this->permissions->checkInternal($this->_uid, $fileID, "RREAD")) { $info = $this->get(); $url = sApp()->webroot . "download/" . $info['PNAME'] . "/"; return $url; } else { return false; } }
$tp = $file->tags->tree->getParents($tags[$t]['ID']); $tp2 = array(); for ($p = 0; $p < count($tp); $p++) { $tinfo = $file->tags->get($tp[$p]); $tp2[$p]['ID'] = $tinfo['ID']; $tp2[$p]['NAME'] = $tinfo['NAME']; } $tp2[count($tp2) - 1]['NAME'] = $itext['TXT_TAGS'] != '' ? $itext['TXT_TAGS'] : '$TXT_TAGS'; array_pop($tp2); $tags[$t]['PARENTS'] = $tp2; } $filelist[$i]['TAGS'] = $tags; $filelist[$i]['THUMB'] = 0; $filelist[$i]['CLASSNAME'] = ''; $filelist[$i]['IMAGE'] = 0; $webroot = sApp()->webroot; $filelist[$i]['DOWNLOAD_URL'] = $webroot . 'download/' . $filelist[$i]['PNAME']; $scheduledJobs = sFileMgr()->scheduler->getSchedule($filelist[$i]['OBJECTID']); $hiddenViewsToProcess = 0; foreach ($scheduledJobs as $scheduledJob) { if ($scheduledJob['PARAMETERS']['VIEW']['HIDDEN']) { $hiddenViewsToProcess++; } } $hiddenviews = $file->views->getHiddenViews(); foreach ($hiddenviews as $hiddenview) { if ($hiddenview['IDENTIFIER'] == 'yg-thumb' || $hiddenview['IDENTIFIER'] == 'yg-list') { $tmpviewinfo = $file->views->getGeneratedViewInfo($hiddenview['ID']); if ($tmpviewinfo[0]['TYPE'] == FILE_TYPE_WEBIMAGE) { $filelist[$i]['THUMB'] = 1; }
/** * Adds a Comment to the Object * * @param int $objectId Object Id * @param string $commentText Text of the comment * @param int $parentCommentId (optional) Id of the parent Comment * @param string $userName (optional) Name to be used when user in Anonymous usergroup * @param string $userEmail (optional) Email to be used when user in Anonymous usergroup * @return int ERROR_NONE on success or other error code */ function add($commentText = '', $parentCommentId = 0, $userName = '', $userEmail = '') { $objectId = (int) $this->_object->getID(); $parentCommentId = (int) $parentCommentId; $commentText = sYDB()->escape_string($commentText); $userName = sYDB()->escape_string($userName); $userEmail = sYDB()->escape_string($userEmail); $currentTS = time(); $currentSettings = $this->getSettings(); $spamWordsArray = explode("\n", $currentSettings['SPAMLIST']); $blacklistWordsArray = explode("\n", $currentSettings['BLACKLIST']); if ((int) $objectId == 0) { $objectId = (int) $this->_object->getID(); } // Check UserID vs. UserName/UserEmail $userID = (int) $this->_uid; // Check if approval is needed if ($currentSettings['FORCE_APPROVAL']) { $approved = 0; } else { $approved = 1; } // But only require approval when user is not a moderator if ($this->permissions->checkInternal($this->_uid, $objectId, 'RMODERATE')) { $approved = 1; } // Check if dereferrer is wanted if ($currentSettings['SE_RANK_DENIAL']) { $regexp_href = '<a\\s[^>]*href=("??)([^" >]*?)\\1[^>]*>(.*)<\\/a>'; if (preg_match_all("/{$regexp_href}/siU", stripslashes($commentText), $matches, PREG_SET_ORDER) > 0) { foreach ($matches as $match) { $targetUrl = $match[2]; $commentText = str_replace($targetUrl, sApp()->base . 'dereferrer/?' . urlencode($targetUrl), $commentText); } } } // Check if a minimum time between postings is set if ($currentSettings['MINIMUM_INTERVAL']) { $anonymousUserID = (int) sConfig()->getVar('CONFIG/SYSTEMUSERS/ANONUSERID'); $lastTS = NULL; if ($this->_uid == $anonymousUserID) { // Anonymous user, try to check via sessioncoookie $lastTS = (int) sSession()->getSessionVar('last_post'); // Set to NULL if not set if (!$lastTS) { $lastTS = NULL; } } else { // Real user, try to check via database $lastComment = $this->getLatestCommentByUser($this->_uid); $lastTS = (int) $lastComment['CREATEDTS']; } $currentTS = (int) time(); if ($lastTS && $lastTS + $currentSettings['MINIMUM_INTERVAL'] > $currentTS) { return ERROR_COMMENTS_MINIMUM_POST_INTERVAL_EXCEEDED; } } // Check if content of the post is blacklisted $isBlacklisted = false; foreach ($blacklistWordsArray as $blacklistWord) { if (stripos($commentText, $blacklistWord) !== false) { return ERROR_COMMENTS_BLACKLISTED_WORD; } } // Check if the post contains spam $isSpam = 0; foreach ($spamWordsArray as $spamWord) { if (stripos($commentText, $spamWord) !== false) { $isSpam = 1; } } // Get userid of anonymous user $anonymousUserID = (int) sConfig()->getVar('CONFIG/SYSTEMUSERS/ANONUSERID'); // Check if authentication is needed if ($currentSettings['FORCE_AUTHENTICATION'] && $userID == $anonymousUserID) { return ERROR_COMMENTS_AUTHENTICATION_NEEDED; } // Check if HTML is allowed (if not, strip all tags - but allow BRs) if (!$currentSettings['ALLOW_HTML']) { $commentText = strip_tags($commentText, '<br><BR><br /><BR />'); } // Check permissions (RCOMMENT is required) if ($this->permissions->checkInternal($this->_uid, $objectId, 'RCOMMENT')) { // Check if commenting is allowed $commentStatus = $this->getStatus(); if ($commentStatus != 0 || $this->permissions->checkInternal($this->_uid, $objectId, 'RMODERATE')) { // Insert into comments-table $commentText = sYDB()->escape_string($commentText); $sql = "INSERT INTO `yg_comments`\n\t\t\t\t\t( `ID` , `COMMENT`, `PARENT`, `USERID`, `USERNAME`, `USEREMAIL`, `APPROVED`, `SPAM`, `CREATEDTS`, `CHANGEDTS`)\n\t\t\t\t\tVALUES\n\t\t\t\t\t( NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?);"; $result = sYDB()->Execute($sql, $commentText, $parentCommentId, $userID, $userName, $userEmail, $approved, $isSpam, $currentTS, $currentTS); if ($result === false) { throw new Exception(sYDB()->ErrorMsg()); } $newCommentID = sYDB()->Insert_ID(); // Insert into link-table $sql = "INSERT INTO `" . $this->_object->getCommentsLinkTable() . "`\n\t\t\t\t\t( `ID` , `OID`, `COMMENTID`, `ORDERPROD`)\n\t\t\t\t\tVALUES\n\t\t\t\t\t( NULL, ?, ?, '9999');"; $result = sYDB()->Execute($sql, $objectId, $newCommentID); if ($result === false) { throw new Exception(sYDB()->ErrorMsg()); } // Write into session sSession()->setPSessionVar('last_post', time()); if (Singleton::cache_config()->getVar("CONFIG/INVALIDATEON/COMMENT_ADD") == "true") { Singleton::FC()->emptyBucket(); } return ERROR_NONE; } else { return ERROR_COMMENTS_COMMENTING_IS_CLOSED; } } else { return ERROR_COMMENTS_NO_COMMENT_RIGHTS; } }
/** * Gets the URL of this Page * * @return string URL of this Page */ function getUrl() { $pageID = $this->_id; if ($this->permissions->checkInternal($this->_uid, $pageID, "RREAD")) { $pageMgr = new PageMgr($this->_site); $pnames = $pageMgr->getParents($pageID); $pi = count($pnames); while ($pi > 0) { if ($pnames[$pi - 1][0]["PNAME"] != "") { $url .= $pnames[$pi - 1][0]["PNAME"] . "/"; } $pi--; } $pinfo = $this->get(); return sApp()->webroot . $url . $pinfo["PNAME"] . "/"; } else { return false; } }
/** * Function to push the script output to the client */ private function scriptOutput($script) { if (sApp()->frontendMode != 'true') { $output = "<script>\n"; $output .= "parent.Koala.yg_cleanStyles();\n"; $output .= $script; $output .= "</script>"; //ob_start(); print $output; //ob_end_flush(); } }
/** * Returns an instance of the specified Extension * * @param string $code Extension code * @param int $objectId (optional) Object Id * @param int $objectVersion (optional) Object version * @param int $objectSite (optional) Object Site * @return Extension|false Extension or FALSE in case of an error */ function getExtension($code, $objectId = NULL, $objectVersion = NULL, $objectSite = NULL) { $id = $this->getIdByCode($code); $extInfo = $this->get($id); if ($extInfo['INTERNAL'] == 1) { // Internal extension, search in yeager/extensions $dir = getrealpath(sApp()->app_root) . '/extensions/'; } else { // Normal extension, search in configured extension directory $dir = getrealpath(sApp()->app_root . sApp()->extensiondir) . '/'; } $path = $extInfo["PATH"]; if (file_exists($dir . $path . "/extension.php") && file_exists($dir . $path . "/extension.xml")) { $extConfig = new \framework\Config($dir . $path . "/extension.xml"); $extApiVersion = explode('.', (string) $extConfig->getVar("extension/api")); if ($extApiVersion[0] != EXTENSION_VERSION_MAJOR) { sLog()->error('Extension-API Version mismatch. Expected v' . EXTENSION_VERSION_MAJOR . '.x, Extension has v' . $extApiVersion[0] . '.x!'); return false; } require_once $dir . $path . "/extension.php"; $namespace = (string) $extConfig->getVar("extension/namespace"); $classname = $namespace . "\\" . (string) $extConfig->getVar("extension/class"); try { return new $classname($code, $objectId, $objectVersion, $objectSite); } catch (Exception $e) { $msg = $e->getMessage(); if (strlen($msg) == 0) { $msg = $itext['TXT_EXCEPTION_HAS_OCCURED'] . "<br />"; $msg .= $itext['TXT_EXCEPTION_FILE'] . ": " . $e->getFile() . "<br />"; $msg .= $itext['TXT_EXCEPTION_LINE'] . ": " . $e->getLine(); } sLog()->error($msg); return false; } } }
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; }
/** * Gets path to User image * * @param string $userId User Id * @param string $width (optional) width in pixels * @param string $height (optional) height in pixels * @return User|bool User image path or FALSE in case of an error */ function getUserImage($userId, $width = 0, $height = 0) { if (file_exists(sApp()->approot . sApp()->userpicdir . $userId . '-picture.jpg')) { $imagePath = sApp()->webroot . 'userimage/' . $userId; if ($width != 0) { $imagePath .= '/' . $width . "x" . $height; } return $imagePath; } return false; }
$smarty->assign("RSITES", $user->checkPermission("RSITES")); $smarty->assign("RTEMPLATES", $user->checkPermission("RTEMPLATES")); $smarty->assign("REXTENSIONS_PAGE", $user->checkPermission("REXTENSIONS_PAGE")); $smarty->assign("REXTENSIONS_MAILING", $user->checkPermission("REXTENSIONS_MAILING")); $smarty->assign("REXTENSIONS_FILE", $user->checkPermission("REXTENSIONS_FILE")); $smarty->assign("REXTENSIONS_CBLOCK", $user->checkPermission("REXTENSIONS_CBLOCK")); $smarty->assign("RENTRYMASKS", $user->checkPermission("RENTRYMASKS")); $smarty->assign("REXPORT", $user->checkPermission("REXPORT")); $smarty->assign("RIMPORT", $user->checkPermission("RIMPORT")); $smarty->assign("REXTENSIONS_CBLISTVIEW", $user->checkPermission("REXTENSIONS_CBLISTVIEW")); $smarty->assign("RUPDATER", $user->checkPermission("RUPDATER")); $smarty->assign("RPROPERTIES", $user->checkPermission("RPROPERTIES")); $smarty->assign("RFILETYPES", $user->checkPermission("RFILETYPES")); $smarty->assign("RCOMMENTCONFIG", $user->checkPermission("RCOMMENTCONFIG")); $smarty->assign("RMAILINGCONFIG", $user->checkPermission("RMAILINGCONFIG")); $smarty->assign("RVIEWS", $user->checkPermission("RVIEWS")); $smarty->assign("browser", $browser); $smarty->assign("browserversion", $browserversion); $smarty->assign("platform", $platform); $smarty->assign("user_session", $koala->genSequence()); $smarty->assign("username", $userinfo['PROPS']['FIRSTNAME'] . ' ' . $userinfo['PROPS']['LASTNAME']); $smarty->assign("userid", sUserMgr()->getCurrentUserID()); $smarty->assign("preview", $this->request->parameters['preview']); $smarty->assign("objecttype", $this->request->parameters['objecttype']); $smarty->assign("objectid", $this->request->parameters['id']); $smarty->assign("objectsite", $this->request->parameters['site']); $smarty->assign("objectview", $this->request->parameters['view']); $smarty->assign("previewversion", $this->request->parameters['version']); $smarty->assign("devmode", (string) sApp()->devmode); $smarty->assign("queueid", $queueid); $smarty->display('file:' . $this->page_template);
/** * Gets all outstanding updates * * @return array Array containing update information with version/revision/date information */ function getUpdates() { $currVersionNumeric = $this->current_version; $postFields = array('INFO' => serialize($_SERVER), 'VERSION' => $currVersionNumeric); $xmlString = getStringFromURL(YEAGER_UPDATER_URL . '?' . http_build_query($postFields), (int) YEAGER_UPDATER_TIMEOUT); if ($xmlString !== false) { // Online Mode $updateDataXML = new SimpleXMLElement($xmlString); $updatesArray = array(); foreach ($updateDataXML->update as $updateItem) { $currDate = explode('-', (string) $updateItem->date); $currDate = gmmktime(0, 0, 0, $currDate[1], $currDate[2], $currDate[0]); $updateVersion = prettifyVersionString((string) $updateItem->version); $updateVersionNumeric = (int) str_replace('.', '', (string) $updateItem->version); $updatesArrayItem = array('TITLE' => stripCDATA((string) $updateItem->title), 'DATE' => $currDate, 'VERSION' => $updateVersion, 'VERSION_NUMERIC' => $updateVersionNumeric, 'REVISION' => (string) $updateItem->revision, 'DESCRIPTION' => stripCDATA((string) $updateItem->description), 'URL' => (string) $updateItem->url_update); foreach ($updateItem->dependencies->version as $dependencyItem) { $updatesArrayItem['DEPENDENCIES'][] = (string) $dependencyItem; } $updatesArray[] = $updatesArrayItem; } } else { // Offline Mode $updatesDirectory = sApp()->approot . sConfig()->getVar('CONFIG/DIRECTORIES/UPDATES'); $updatePackages = glob($updatesDirectory . 'yeager_*_r*.php'); // Read out package information $updatesArray = array(); foreach ($updatePackages as $updatePackage) { $currArchive = new PayloadTar($updatePackage, true); $metaData = $currArchive->extractInString('installer/config.xml'); $metaDataXML = new SimpleXMLElement($metaData); $currDate = explode('-', (string) $metaDataXML->date); $currDate = gmmktime(0, 0, 0, $currDate[1], $currDate[2], $currDate[0]); $updateVersion = prettifyVersionString((string) $metaDataXML->version); $updateVersionNumeric = (int) str_replace('.', '', (string) $metaDataXML->version); $updatesArrayItem = array('TITLE' => stripCDATA((string) $metaDataXML->title), 'DATE' => $currDate, 'VERSION' => $updateVersion, 'VERSION_NUMERIC' => $updateVersionNumeric, 'REVISION' => (string) $metaDataXML->revision, 'DESCRIPTION' => str_replace('\\n', "\n", stripCDATA((string) $metaDataXML->description)), 'URL' => 'file://' . $updatePackage); foreach ($metaDataXML->dependencies->version as $dependencyItem) { $updatesArrayItem['DEPENDENCIES'][] = (string) $dependencyItem; } $updatesArray[] = $updatesArrayItem; } } $neededUpdates = array(); foreach ($updatesArray as $allUpdatesItem) { if ($allUpdatesItem['VERSION_NUMERIC'] > $currVersionNumeric) { $neededUpdates[] = $allUpdatesItem; } } $updatesArray = $neededUpdates; usort($updatesArray, function ($a, $b) { if ($a['REVISION'] == $b['REVISION']) { return 0; } return version_compare($b['VERSION'], $a['VERSION'], '>=') ? -1 : 1; /*return true;*/ }); return $updatesArray; }
/** * Gets the URL of this Mailing * * @return string URL of this Mailing */ function getUrl() { $mailingID = $this->_id; if ($this->permissions->checkInternal($this->_uid, $mailingID, "RREAD")) { $mailingMgr = new MailingMgr(); $pnames = $mailingMgr->getParents($mailingID); $pi = count($pnames); while ($pi > 0) { $url .= $pnames[$pi - 1][0]["PNAME"] . "/"; $pi--; } $pinfo = $this->get(); return sApp()->webroot . $url . $tree[$xt]["PNAME"] . $pinfo["PNAME"] . "/"; } else { return false; } }
function getAdditionalFormfieldData(&$controlFormfields) { $entrymaskMgr = new Entrymasks(); $tagMgr = new Tags(); $filetypeMgr = new Filetypes(); for ($w = 0; $w < count($controlFormfields); $w++) { $controlFormfields[$w]['LVALUES'] = NULL; $controlFormfields[$w]['DISPLAYNAME'] = NULL; // Date & Datetime if ($controlFormfields[$w]['TYPE'] == 'DATE' || $controlFormfields[$w]['TYPE'] == 'DATETIME') { if ($controlFormfields[$w]['VALUE']) { $controlFormfields[$w]['VALUE'] = TStoLocalTS($controlFormfields[$w]['VALUE']); } } // Link if ($controlFormfields[$w]['TYPE'] == 'LINK') { $special_url = resolveSpecialURL($controlFormfields[$w]['URL']); if ($special_url !== false) { $special_url_info = getSpecialURLInfo($controlFormfields[$w]['VALUE01']); if ($special_url_info['TYPE'] == 'IMG' || $special_url_info['TYPE'] == 'DOWN') { $controlFormfields[$w]['IS_FILE'] = true; $file = sFileMgr()->getFile($special_url_info['ID']); $link_fileinfo = $file->get(); $controlFormfields[$w]['DISPLAYNAME'] = $link_fileinfo['NAME']; $link_filetype = $filetypeMgr->get($link_fileinfo['FILETYPE']); $controlFormfields[$w]['IDENTIFIER'] = $link_filetype['IDENTIFIER']; $controlFormfields[$w]['TYPECODE'] = $link_filetype['CODE']; $controlFormfields[$w]['COLOR'] = $link_filetype['COLOR']; $controlFormfields[$w]['FILE_ID'] = $special_url_info['ID']; } else { $pageMgr = new PageMgr($special_url_info['SITE']); $page = $pageMgr->getPage($special_url_info['ID']); $link_pageInfo = $page->get(); $controlFormfields[$w]['DISPLAYNAME'] = $link_pageInfo['NAME']; $controlFormfields[$w]['IS_INTERNAL'] = true; } } else { if (preg_match_all(sApp()->URLRegEx1, $controlFormfields[$w]['VALUE01'], $internal) > 0) { if ($internal[2][0] == 'download') { $controlFormfields[$w]['IS_FILE'] = true; $link_file = str_replace('/', '', $internal[3][0]); $file = sFileMgr()->getFile($link_file); $link_fileinfo = $file->get(); $controlFormfields[$w]['DISPLAYNAME'] = $link_fileinfo['NAME']; $link_filetype = $filetypeMgr->get($link_fileinfo['FILETYPE']); $controlFormfields[$w]['IDENTIFIER'] = $link_filetype['IDENTIFIER']; $controlFormfields[$w]['TYPECODE'] = $link_filetype['CODE']; $controlFormfields[$w]['COLOR'] = $link_filetype['COLOR']; $controlFormfields[$w]['FILE_ID'] = $link_file; } else { $link_site = $internal[3][0]; $link_page = str_replace('/', '', $internal[5][0]); $pageMgr = new PageMgr($link_site); $page = $pageMgr->getPage($link_page); $link_pageInfo = $page->get(); $controlFormfields[$w]['DISPLAYNAME'] = $link_pageInfo['NAME']; $controlFormfields[$w]['IS_INTERNAL'] = true; } } elseif (substr($controlFormfields[$w]['URL'], 0, 7) == 'mailto:') { $controlFormfields[$w]['IS_EMAIL'] = true; } else { $linkInfo = checkLinkInternalExternal($controlFormfields[$w]['URL']); switch ($linkInfo['TYPE']) { case 'external': $controlFormfields[$w]['DISPLAYNAME'] = $controlFormfields[$w]['URL']; break; case 'internal': $controlFormfields[$w]['DISPLAYNAME'] = $linkInfo['NAME']; $controlFormfields[$w]['IS_INTERNAL'] = true; break; case 'file': $controlFormfields[$w]['IS_FILE'] = true; $controlFormfields[$w]['DISPLAYNAME'] = $linkInfo['NAME']; $controlFormfields[$w]['IDENTIFIER'] = $linkInfo['INFO']['IDENTIFIER']; $controlFormfields[$w]['TYPECODE'] = $linkInfo['INFO']['CODE']; $controlFormfields[$w]['COLOR'] = $linkInfo['INFO']['COLOR']; $controlFormfields[$w]['FILE_ID'] = $linkInfo['INFO']['FILE_ID']; break; } } } } // File if ($controlFormfields[$w]['TYPE'] == 'FILE') { if (trim($controlFormfields[$w]['FILE_ID'])) { $file = sFileMgr()->getFile($controlFormfields[$w]['FILE_ID']); if ($file) { $fileInfo = $file->get(); $controlFormfields[$w]['DISPLAYNAME'] = $fileInfo['NAME']; $controlFormfields[$w]['IDENTIFIER'] = $fileInfo['IDENTIFIER']; $controlFormfields[$w]['TYPECODE'] = $fileInfo['CODE']; $controlFormfields[$w]['COLOR'] = $fileInfo['COLOR']; } } } // File if ($controlFormfields[$w]['TYPE'] == 'FILEFOLDER') { if (trim($controlFormfields[$w]['FILE_ID'])) { $file = sFileMgr()->getFile($controlFormfields[$w]['FILE_ID']); if ($file) { $fileInfo = $file->get(); $controlFormfields[$w]['DISPLAYNAME'] = $fileInfo['NAME']; } } } // Contentblock if ($controlFormfields[$w]['TYPE'] == 'CO') { if (trim($controlFormfields[$w]['CBLOCK_ID'])) { $cb = sCblockMgr()->getCblock($controlFormfields[$w]['CBLOCK_ID']); $info = $cb->get(); $controlFormfields[$w]['DISPLAYNAME'] = $info['NAME']; } } // Tag if ($controlFormfields[$w]['TYPE'] == 'TAG') { if (trim($controlFormfields[$w]['TAG_ID'])) { $info = $tagMgr->get($controlFormfields[$w]['TAG_ID']); $controlFormfields[$w]['DISPLAYNAME'] = $info['NAME']; } } // Page if ($controlFormfields[$w]['TYPE'] == 'PAGE') { if (trim($controlFormfields[$w]['SITE_ID']) && trim($controlFormfields[$w]['PAGE_ID'])) { $tmpPageMgr = new PageMgr($controlFormfields[$w]['SITE_ID']); $tmpPage = $tmpPageMgr->getPage($controlFormfields[$w]['PAGE_ID']); $info = $tmpPage->get(); $info['RWRITE'] = $tmpPage->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $controlFormfields[$w]['PAGE_ID'], "RWRITE"); $info['RDELETE'] = $tmpPage->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $controlFormfields[$w]['PAGE_ID'], "RDELETE"); $iconData = getIconForPage($info); $controlFormfields[$w]['ICON'] = $iconData['iconclass']; $controlFormfields[$w]['STYLE'] = $iconData['style']; $controlFormfields[$w]['DISPLAYNAME'] = $info['NAME']; } } // List if ($controlFormfields[$w]['TYPE'] == 'LIST') { if (trim($controlFormfields[$w]['ENTRYMASKFORMFIELD'])) { $controlFormfields[$w]['LIST_VALUES'] = $entrymaskMgr->getListValuesByLinkID($controlFormfields[$w]['ENTRYMASKFORMFIELD']); } } } }