<?php $tmpUser = new User(sUserMgr()->getCurrentUserID()); $tmpUserInfo = $tmpUser->get(); $adminAllowed = $tmpUser->checkPermission('RUSERGROUPS'); $mode = $this->request->parameters['mode']; if ($mode == "details") { $objecttype = $this->request->parameters['yg_type']; if ($objecttype == 'mailing') { // Get usergroups assigned to mailing $mailingID = $this->request->parameters['yg_id']; $mailingID = explode('-', $mailingID); $mailingID = $mailingID[0]; $mailingMgr = new MailingMgr(); $mailing = $mailingMgr->getMailing($mailingID); $mailingInfo = $mailing->get(); // Get assigned groups $usergroups = $mailing->getUsergroups(); foreach ($usergroups as $usergroup_idx => $usergroup) { $usergroups[$usergroup_idx]['RDELETE'] = true; $usergroups[$usergroup_idx]['SHOW_DELETE'] = true; } $object_permissions['RWRITE'] = $mailing->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $mailingID, "RWRITE"); $object_permissions['RSTAGE'] = $mailing->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $mailingID, "RSTAGE"); $object_permissions['READONLY'] = !$object_permissions['RWRITE']; // Get current locks for this token (and unlock them) $lockToken = sGuiUS() . '_' . $this->request->parameters['win_no']; $lockedObjects = $mailingMgr->getLocksByToken($lockToken); foreach ($lockedObjects as $lockedObject) { $currentObject = $mailingMgr->getMailing($lockedObject['OBJECTID']); $currentObject->releaseLock($lockedObject['TOKEN']);
<?php // Check if the folder for blind contentblocks already exists and create it if it doesn't exist $embeddedCblockFolder = (int) sConfig()->getVar("CONFIG/EMBEDDED_CBLOCKFOLDER"); $siteMgr = new Sites(); $sites = $siteMgr->getList(); $ygid = $this->request->parameters['yg_id']; $refresh = $this->request->parameters['refresh']; $entrymask = explode('-', $ygid); $entrymask = $entrymask[0]; $icons = new Icons(); $mailingMgr = new MailingMgr(); $entrymaskMgr = new Entrymasks(); $entrymaskInfo = $entrymaskMgr->get($entrymask); // Get all contentblocks with this entrymask $contentblock_ids = sCblockMgr()->getCblockLinkByEntrymaskId($entrymask); $contentblocks = array(); $contentblocks_blind = array(); foreach ($contentblock_ids as $contentblock_id) { $dcb = sCblockMgr()->getCblock($contentblock_id['CBLOCKID']); if ($dcb) { $co_data = $dcb->get(); $objectparents = sCblockMgr()->getParents($contentblock_id['CBLOCKID']); array_pop($objectparents); $co_data['PARENTS'] = $objectparents; $dcb = sCblockMgr()->getCblock($contentblock_id['CBLOCKID']); $co_data['CBLOCKINFO'] = $dcb->get(); $co_data['CBLOCKINFO']['RWRITE'] = $dcb->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $contentblock_id['CBLOCKID'], "RWRITE"); $co_data['CBLOCKINFO']['RDELETE'] = $dcb->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $contentblock_id['CBLOCKID'], "RDELETE"); $styleData = getStyleForContentblock($co_data['CBLOCKINFO']); $co_data['STYLE'] = $styleData;
<?php header('Content-type: text/xml'); $tmpUser = new User(sUserMgr()->getCurrentUserID()); $tmpUserInfo = $tmpUser->get(); $adminAllowed = $tmpUser->checkPermission('RPAGES'); if (!$adminAllowed) { $adminAllowed = $tmpUser->checkPermission('RTEMPLATES'); } if ($adminAllowed) { $site = $this->request->parameters['site']; if ($site == 'mailing') { $mailingMgr = new MailingMgr(); $templateRoot = $mailingMgr->getTemplateRoot(); } else { $site = (int) $site; $siteMgr = new Sites(); $siteinfo = $siteMgr->get($site); if ($siteinfo['TEMPLATEROOT']) { $templateRoot = $siteinfo['TEMPLATEROOT']; } } $templateMgr = new Templates(); $newpage = (int) $this->request->parameters['page']; $action = $this->request->parameters['action']; if ($action == 'choose') { $noclick = 'noclick'; } else { $noclick = ''; } $onlyFolders = false;
<?php \framework\import('org.phpmailer.phpmailer'); $mailingMgr = new MailingMgr(); $templateMgr = new Templates(); $jsQueue = new JSQueue(NULL); switch ($action) { case 'duplicateMailing': $mailingId = (int) $this->params['mailingId']; $parentwindow = $this->params['wid']; $sourceMailing = $mailingMgr->getMailing($mailingId); $oldMailingInfo = $sourceMailing->get(); $oldMailingId = $oldMailingInfo['ID']; $newMailingId = $mailingMgr->add($mailingMgr->tree->getRoot()); $newMailing = $mailingMgr->getMailing($newMailingId); $newMailing->copyFrom($sourceMailing); $jsQueue->add($newMailingId, HISTORYTYPE_MAILING, 'MAILING_ADD', sGuiUS(), NULL); // Inherit permissions of the parent of the newly created copy $allPerms = $sourceMailing->permissions->getPermissions(); //$newMailing->permissions->clear(); $newMailing->permissions->setPermissions($allPerms); break; case 'saveMailingInfo': $defaulttemplate = (int) $this->params['mailing_defaulttemplate']; $templateroot = (int) $this->params['mailings_templateroot']; if ($defaulttemplate == -1) { $mailingMgr->setDefaultTemplate(0); } elseif ($defaulttemplate > 0) { $mailingMgr->setDefaultTemplate($defaulttemplate); } if ($templateroot == -1) {
<?php $objectType = $this->request->parameters['yg_type']; $objectYgID = $this->request->parameters['yg_id']; $displayType = $this->request->parameters['type']; $winID = $this->request->parameters['win_no']; $filterStatus = $this->request->parameters['mailingfilter_status']; if (!$filterStatus) { $filterStatus = 'ALL'; } $mailingMgr = new MailingMgr(); $filterArray = array(); $filterArray[] = array('TYPE' => 'STATUS', 'VALUE' => $filterStatus); $mailingsCount = count($mailingMgr->getList($mailingMgr->tree->getRoot(), array('SUBNODES'), 2, NULL, $filterArray)); // for paging $pageDirInfo = calcPageDir($mailingsCount, 'prop.CHANGEDTS'); $pageDirOrderBy = $pageDirInfo['pageDirOrderBy']; $pageDirOrderDir = 'DESC'; $pageDirLimit = explode(',', $pageDirInfo['pageDirLimit']); $pageDirLimitFrom = $pageDirLimit[0]; $pageDirLimitLength = $pageDirLimit[1]; // END for paging $filterArray = array(); $filterArray[] = array('TYPE' => 'LIMITER', 'VALUE' => $pageDirLimitFrom, 'VALUE2' => $pageDirLimitLength); $filterArray[] = array('TYPE' => 'ORDER', 'VALUE' => $pageDirOrderBy, 'VALUE2' => $pageDirOrderDir); $filterArray[] = array('TYPE' => 'STATUS', 'VALUE' => $filterStatus); $mailings = $mailingMgr->getList($mailingMgr->tree->getRoot(), array('SUBNODES'), 2, NULL, $filterArray); // Get additional user information $allMailings = array(); foreach ($mailings as $mailingsIdx => $mailingsItem) { $currMailing = $mailingMgr->getMailing($mailingsItem['ID']);
$user = new User($userId); $user->removeUsergroup($roleId); $koala->queueScript('if ($(\'' . $wid . '_usergroups_' . $roleId . '\')) { $(\'' . $wid . '_usergroups_' . $roleId . '\').remove(); $K.windows[\'' . $wid . '\'].refresh(); }; $K.yg_showHelp(false);'); } break; case 'addUsergroup': $roleId = $this->params['roleId']; $roleInfo = sUsergroups()->get($roleId); $roleName = $roleInfo['NAME']; $mode = $this->params['mode']; $openerRefId = $this->params['openerRefId']; $refresh = $this->params['refresh']; if ($mode == 'mailing') { // For mailings $mailingId = $this->params['mailingId']; $mailingMgr = new MailingMgr(); $mailing = $mailingMgr->getMailing($mailingId); $mailingInfo = $mailing->get(); $mailingStatus = $mailing->getStatus(); $currentRoles = $mailing->getUsergroups(); $addRole = true; foreach ($currentRoles as $currentRoles_item) { if ($currentRoles_item['ID'] == $roleId) { $addRole = false; } } if ($addRole) { // First check if mailing is PAUSED if ($mailingStatus['STATUS'] == 'PAUSED') { // Empty queue for this mailing and reset to UNSENT // Get # of pending jobs
} } // Use translated name for root-node $objects[0]['NAME'] = $itext['TXT_FILES'] != '' ? $itext['TXT_FILES'] : '$TXT_FILES'; break; case 'tab_usergroup_tags': $objecttype = $site = 'tags'; $tagMgr = new Tags(); $objects = $tagMgr->getList(0, array(), true, $maxlevels, $roleid); $objects = $tagMgr->getAdditionalTreeInfo(false, $objects); // Use translated name for root-node $objects[0]['NAME'] = $itext['TXT_TAGS'] != '' ? $itext['TXT_TAGS'] : '$TXT_TAGS'; break; case 'tab_usergroup_mailings': $objecttype = $site = 'mailings'; $mailingMgr = new MailingMgr(); $objects = $mailingMgr->getList(0, array(), $maxlevels, $roleid); $objects = $mailingMgr->getAdditionalTreeInfo(false, $objects); $objects = array_reverse($objects, false); $objects[0]['FOLDER'] = 1; // Use translated name for root-node $objects[0]['NAME'] = $itext['TXT_MAILINGS'] != '' ? $itext['TXT_MAILINGS'] : '$TXT_MAILINGS'; break; case 'tab_usergroup_usergroups': $objecttype = $site = 'usergroups'; $objects = sUsergroups()->getList(true); foreach ($objects as $objectIndex => $object_item) { $objects[$objectIndex]['LEVEL'] = 1; $objects[$objectIndex]['PARENT'] = 0; $usergroupPermissions = sUsergroups()->usergroupPermissions->getByUsergroup($roleid, $objects[$objectIndex]['ID']); $objects[$objectIndex]['RREAD'] = $usergroupPermissions['RREAD'];
$pagemgr = new PageMgr($siteID); $page = $pagemgr->getPage($id); $pageInfo = $page->get(); $name = $pageInfo["NAME"]; $url = $page->getUrl(); $versions = $page->getVersions(); if (!$version || $version == 'live') { $version = $page->getPublishedVersion(true); } else { if ($version == "working") { $version = $versions[0]["VERSION"]; } } $smarty->assign("url", $url); } elseif ($objecttype == "mailing") { $mailingMgr = new MailingMgr(); $mailing = $mailingMgr->getMailing($id); $mailingInfo = $mailing->get(); $name = $mailingInfo['NAME']; $url = $mailing->getUrl(); $versions = $mailing->getVersions(); // Remove version '0' $realVersions = array(); foreach ($versions as $versionsItem) { if ($versionsItem['VERSION'] > 0) { array_push($realVersions, $versionsItem); } } $versions = $realVersions; if (!$version || $version == 'live') { $version = $mailing->getPublishedVersion(true);
<?php $ygid = $this->request->parameters['yg_id']; $refresh = $this->request->parameters['refresh']; $tmpUser = new User(sUserMgr()->getCurrentUserID()); $tmpUserInfo = $tmpUser->get(); $adminAllowed = $tmpUser->checkPermission('RMAILINGCONFIG'); if ($adminAllowed) { $mailingMgr = new MailingMgr(); $templateMgr = new Templates(); $defaultTemplate = $mailingMgr->getDefaultTemplate(); $templateRoot = $mailingMgr->getTemplateRoot(); if ($defaultTemplate) { $templateInfo = $templateMgr->getTemplate($defaultTemplate); $templateInfo['PREVIEWPATH'] = $templateMgr->getPreviewPath($defaultTemplate); } if ($templateRoot) { $templateRootInfo = $templateMgr->getTemplate($templateRoot); } } $smarty->assign('mode', 1); $smarty->assign('adminAllowed', $adminAllowed); $smarty->assign('templateInfo', $templateInfo); $smarty->assign('templaterootinfo', $templateRootInfo); $smarty->assign('defaultTemplate', $defaultTemplate); $smarty->assign('templateRoot', $templateRoot); $smarty->assign('refresh', $refresh); $smarty->assign('win_no', $this->request->parameters['win_no']); $smarty->display('file:' . $this->page_template);
if ($lastuserid != $history[$i]["UID"]) { $user = new User($history[$i]["UID"]); $uinfo =& $user->get(); $uinfo['PROPS'] = $user->properties->getValues($history[$i]["UID"]); } $history[$i]["USERNAME"] = trim($uinfo['PROPS']["FIRSTNAME"] . " " . $uinfo['PROPS']["LASTNAME"]); $history[$i]["USERID"] = $uinfo["ID"]; $history[$i]['TAB'] = $tab_mappings[$history[$i]['TEXT']]; if ($history[$i]['TAB'] == 'P_TAGS') { if ($history[$i]['TEXT'] == 'TXT_TAG_H_ASSIGN' || $history[$i]['TEXT'] == 'TXT_TAG_H_REMOVE') { $history[$i]['NEWVALUE'] = "<a onclick=\"\$K.yg_openObjectDetails('" . $history[$i]['TARGETID'] . "', 'tag', '" . $history[$i]['NEWVALUE'] . "', 'tag', '');\">" . $history[$i]['NEWVALUE'] . "</a>"; } } if ($history[$i]['TAB'] == 'P_CONTENT') { if ($history[$i]['TEXT'] == 'TXT_MAILING_H_COREMOVE' || $history[$i]['TEXT'] == 'TXT_MAILING_H_EMREMOVE' || $history[$i]['TEXT'] == 'TXT_MAILING_H_COADD' || $history[$i]['TEXT'] == 'TXT_MAILING_H_EMADD' || $history[$i]['TEXT'] == 'TXT_MAILING_H_EMCOPY' || $history[$i]['TEXT'] == 'TXT_MAILING_H_COORDER') { $Tmp_TheMailingMgr = new MailingMgr(); if ($objectID) { $Tmp_mailing = $Tmp_TheMailingMgr->getMailing($objectID); $Tmp_mailingInfo = $Tmp_mailing->get(); $templateId = $Tmp_mailingInfo["TEMPLATEID"]; $Tmp_TheTemplateMgr = new Templates(); $tmp_contentareas = $Tmp_TheTemplateMgr->getContentareas($templateId); $history[$i]['CONTENTAREA'] = $history[$i]['OLDVALUE']; unset($realContentareaName); foreach ($tmp_contentareas as $tmp_contentarea) { if ($tmp_contentarea['CODE'] == $history[$i]['CONTENTAREA']) { $realContentareaName = $tmp_contentarea['NAME']; } } if ($realContentareaName) { $history[$i]['CONTENTAREA'] = $realContentareaName;
<?php include_once "error.php"; $mailingMgr = new MailingMgr(); $previewMode = false; // Check if we are in preview-mode if (!$mailingId && !$mailingVersion) { // Set frontend timezone date_default_timezone_set($this->frontendTimezone); $mailingVersion = $this->request->parameters['version']; if ($mailingVersion == "working") { $mailingVersion = "null"; } $this->displaymode = "working"; $request_path = $this->request->path; $request_path_string = implode('/', $request_path); $webroot_path_string = implode('/', $this->webroot); if (strpos($request_path_string, "/mailing/") >= 0) { // Remove leading 'mailing/' $request_path_string = str_replace('/mailing/', '/', $request_path_string); } if (strpos($request_path_string, "mailing/") === 0) { // Remove leading 'mailing/' $request_path_string = substr($request_path_string, strlen('mailing/')); } if (strpos($request_path_string, $webroot_path_string . '/') === 0) { // Remove leading webroot-prefix $request_path_string = substr($request_path_string, strlen($webroot_path_string . '/')); } $request_path = explode('/', $request_path_string); $mailingId = $request_path[0];
for ($i = 0; $i < count($oref); $i++) { $PageMgr = new PageMgr($oref[$i]['SITEID']); $tmpPage = $PageMgr->getPage($oref[$i]['PAGEID']); $pageInfo = $tmpPage->get(); $pageInfo['RWRITE'] = $tmpPage->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $oref[$i]['PAGEID'], "RWRITE"); $pageInfo['RDELETE'] = $tmpPage->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $oref[$i]['PAGEID'], "RDELETE"); $iconData = getIconForPage($pageInfo); $pr = $PageMgr->getParents($oref[$i]['PAGEID']); $pr[count($pr) - 1][0]['NAME'] = $siteMgr->getname($oref[$i]['SITEID']); $pageparents = $pr; $item = array('ID' => $oref[$i]['PAGEID'], 'VIATYPE' => REFTYPE_CO, 'VIANAME' => $oref[$i]['PAGENAME'], 'EMBEDDED' => 1, 'PARENTS' => array(), 'VIATARGETS' => array(array('ID' => $oref[$i]['PAGEID'], 'SITE' => $oref[$i]['SITEID'], 'TARGETTYPE' => REFTYPE_PAGE, 'NAME' => $oref[$i]['PAGENAME'], 'PARENTS' => $pageparents, 'EMBEDDED' => 1, 'ICON' => $iconData['iconclass'], 'STYLE' => $iconData['style']))); array_push($incoming, $item); } // For mailings $oref = $cb->getLinkedMailings(); $mailingMgr = new MailingMgr(); for ($i = 0; $i < count($oref); $i++) { $tmpMailing = $mailingMgr->getMailing($oref[$i]['MAILINGID']); $mailingInfo = $tmpMailing->get(); $mailingInfo['RWRITE'] = $tmpMailing->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $oref[$i]['MAILINGID'], "RWRITE"); $mailingInfo['RDELETE'] = $tmpMailing->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $oref[$i]['MAILINGID'], "RDELETE"); if ($mailingInfo['HASCHANGED']) { $style = 'changed'; } else { $style = ''; } $item = array('ID' => $oref[$i]['MAILINGID'], 'VIATYPE' => REFTYPE_CO, 'VIANAME' => $oref[$i]['MAILINGNAME'], 'EMBEDDED' => 1, 'PARENTS' => array(), 'VIATARGETS' => array(array('ID' => $oref[$i]['MAILINGID'], 'TARGETTYPE' => REFTYPE_MAILING, 'NAME' => $oref[$i]['MAILINGNAME'], 'EMBEDDED' => 1, 'ICON' => 'mailing', 'STYLE' => $style))); array_push($incoming, $item); } // Get current locks for this token (and unlock them) $lockToken = sGuiUS() . '_' . $this->request->parameters['win_no'];
/** * Saves content to a Formfield * * @param int $linkId Entrymask Formfield Link Id * @param string $value01 Content for Formfield parameter 1 * @param string $value02 Content for Formfield parameter 2 * @param string $value02 Content for Formfield parameter 3 * @param string $value04 Content for Formfield parameter 4 * @param string $value05 Content for Formfield parameter 5 * @param string $value06 Content for Formfield parameter 6 * @param string $value07 Content for Formfield parameter 7 * @param string $value08 Content for Formfield parameter 8 * @return bool TRUE on success or FALSE in case of an error * @throws Exception */ function setFormfield($linkId, $value01, $value02, $value03, $value04, $value05, $value06, $value07, $value08) { $cbId = $this->_id; $linkId = (int) $linkId; if ($this->permissions->checkInternal($this->_uid, $cbId, "RWRITE")) { $value01 = sYDB()->escape_string($value01); $value02 = sYDB()->escape_string($value02); $value03 = sYDB()->escape_string($value03); $value04 = sYDB()->escape_string($value04); $value05 = sYDB()->escape_string($value05); $value06 = sYDB()->escape_string($value06); $value07 = sYDB()->escape_string($value07); $value08 = sYDB()->escape_string($value08); // Check if an URL needs to be generated $sql = "SELECT\n\t\t\t\t\t\tt.TYPE\n\t\t\t\t\tFROM\n\t\t\t\t\t\t`yg_contentblocks_lnk_entrymasks_c` AS c,\n\t\t\t\t\t\t`yg_formfields` AS t\n\t\t\t\t\tWHERE\n\t\t\t\t\t\t(c.FORMFIELD = t.ID) AND\n\t\t\t\t\t\t(c.ID = ?);"; $ra = $this->cacheExecuteGetArray($sql, $linkId); $webRoot = (string) sConfig()->getVar("CONFIG/DIRECTORIES/WEBROOT"); switch ($ra[0]['TYPE']) { case 'PAGE': if (strlen(trim($value02)) && strlen(trim($value01))) { $siteMgr = new Sites(); $sitePName = $siteMgr->getPName($value02); $pageMgr = sPageMgr($value02); $tmpPage = $pageMgr->getPage($value01); $tmpPageInfo = $tmpPage->get(); $value03 = $webRoot . $sitePName . '/' . $tmpPageInfo['PNAME'] . '/'; $value04 = $tmpPageInfo['PNAME']; $value05 = $sitePName; } else { $value01 = $value02 = $value03 = $value04 = ''; } break; case 'FILE': if (strlen(trim($value01))) { $tmpFile = sFileMgr()->getFile($value01); if ($tmpFile) { $tmpFileInfo = $tmpFile->get(); $value02 = $webRoot . 'download/' . $tmpFileInfo['PNAME'] . '/'; $value03 = $tmpFileInfo['PNAME']; $value04 = $webRoot . 'image/' . $tmpFileInfo['PNAME'] . '/'; } } else { $value01 = $value02 = $value03 = ''; } break; } $sql = "UPDATE `yg_contentblocks_lnk_entrymasks_c` SET\n\t\t\t\t\t\tVALUE01 = ?,\n\t\t\t\t\t\tVALUE02 = ?,\n\t\t\t\t\t\tVALUE03 = ?,\n\t\t\t\t\t\tVALUE04 = ?,\n\t\t\t\t\t\tVALUE05 = ?,\n\t\t\t\t\t\tVALUE06 = ?,\n\t\t\t\t\t\tVALUE07 = ?,\n\t\t\t\t\t\tVALUE08 = ?\n\t\t\t\t\tWHERE\n\t\t\t\t\t\t(ID = ?);"; $result = sYDB()->Execute($sql, $value01, $value02, $value03, $value04, $value05, $value06, $value07, $value08, $linkId); if ($result === false) { throw new Exception(sYDB()->ErrorMsg()); } // Check to which object this entrymask belongs to $CblockInfo = $this->get(); // Check if it is an embedded entrymask if ($CblockInfo['EMBEDDED']) { $sql = "SELECT PID, PVERSION FROM yg_mailing_lnk_cb WHERE CBID = " . $CblockInfo['OBJECTID'] . " AND CBVERSION = " . $CblockInfo['VERSION'] . ";"; $linkedMailings = $this->cacheExecuteGetArray($sql); if (count($linkedMailings) > 0) { // Yes, it links to a Mailing $mailingMgr = new MailingMgr(); foreach ($linkedMailings as $linkedMailing) { $mailing = $mailingMgr->getMailing($linkedMailing['PID'], $linkedMailing['PVERSION']); if ($mailing) { $mailing->markAsChanged(); } } } else { // Check if it is related to a Page $sites = sSites()->getList(true, false); for ($i = 0; $i < count($sites); $i++) { $sql = "SELECT PID, PVERSION FROM yg_site_" . (int) $sites[$i]['ID'] . "_lnk_cb WHERE CBID = " . (int) $CblockInfo['OBJECTID'] . " AND CBVERSION = " . (int) $CblockInfo['VERSION'] . ";"; $linkedPages = $this->cacheExecuteGetArray($sql); if (count($linkedPages) > 0) { // Yes, it links to a Pages $pageMgr = sPageMgr($sites[$i]['ID']); foreach ($linkedPages as $linkedPage) { $page = $pageMgr->getPage($linkedPage['PID'], $linkedPage['PVERSION']); if ($page) { $page->markAsChanged(); } } } } } } else { // Entrymask is NOT embedded, so mark this Cblock as changed $this->markAsChanged(); } return true; } else { return false; } }
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; }
/** * Function to get the queued commands from the history */ public function getQueuedCommands() { $entrymaskMgr = new Entrymasks(); $jsQueue = new JSQueue(NULL); $tagMgr = new Tags(); $queuedCommands = array(); $currentQueueId = sGuiLH(); if (!$currentQueueId || $currentQueueId == 'false') { return; // if running first time (only) //$currentQueueId = $jsQueue->getLastQueueId(); } if ($currentQueueId) { $queuedCommandsRaw = $jsQueue->getQueue($currentQueueId, sGuiUS()); $templateMgr = new Templates(); $viewMgr = new Views(); foreach ($queuedCommandsRaw as $queuedCommandRaw) { // Check permissions $permissionsObj = NULL; $objectID = $queuedCommandRaw['OID']; $siteID = $queuedCommandRaw['SITEID']; $icons = new Icons(); $url = $imgurl = ''; switch ($queuedCommandRaw['TYPE']) { case HISTORYTYPE_MAILING: $mailingMgr = new MailingMgr(); $mailingObj = $mailingMgr->getMailing($objectID); $permissionsObj = $mailingObj->permissions; break; case HISTORYTYPE_PAGE: if ($siteID > 0 && $objectID > 0) { $pageMgr = new PageMgr($siteID); $pageObj = $pageMgr->getPage($objectID); if ($pageObj) { $url = $pageObj->getUrl(); $permissionsObj = $pageObj->permissions; } } break; case HISTORYTYPE_CO: if (!$objectID) { continue; } $cb = sCblockMgr()->getCblock($objectID); $permissionsObj = $cb->permissions; break; case HISTORYTYPE_ENTRYMASK: $permissionsObj = $entrymaskMgr->permissions; break; case HISTORYTYPE_FILE: $permissionsObj = sFileMgr()->permissions; if ($objectID) { $file = sFileMgr()->getFile($objectID); if ($file) { $info = $file->get(); $url = sApp()->webroot . "download/" . $info['PNAME'] . "/"; $hiddenviews = $file->views->getHiddenViews(); foreach ($hiddenviews as $hiddenview) { if ($hiddenview['IDENTIFIER'] == "YGSOURCE") { $tmpviewinfo = $file->views->getGeneratedViewInfo($hiddenview['ID']); if ($tmpviewinfo[0]['TYPE'] == FILE_TYPE_WEBIMAGE) { $imgurl = sApp()->webroot . "image/" . $info['PNAME'] . "/"; } } } } } break; case HISTORYTYPE_TEMPLATE: $permissionsObj = $templateMgr->permissions; break; case HISTORYTYPE_TAG: $permissionsObj = $tagMgr->permissions; break; case HISTORYTYPE_SITE: $pageMgr = new PageMgr($siteID); $sitePages = $pageMgr->tree->get(0, 1); $tmpPageID = $sitePages[0]["ID"]; if ($tmpPageID) { $pageObj = $pageMgr->getPage($tmpPageID); $permissionsObj = $pageObj->permissions; } break; case HISTORYTYPE_USER: $permissionsObj = sUsergroups()->usergroupPermissions; break; case HISTORYTYPE_USERGROUP: case HISTORYTYPE_EXTERNAL: case HISTORYTYPE_IMAGE: case HISTORYTYPE_FILETYPES: case HISTORYTYPE_FILEVIEWS: case HISTORYTYPE_JSQUEUE: case HISTORYTYPE_PERMISSION: default: break; } if ($queuedCommandRaw['TEXT'] == 'NOPERMISSIONCHECK' || strpos($queuedCommandRaw['OLDVALUE'], 'HIGHLIGHT') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'UNHIGHLIGHT') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'PAGE_MOVE') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'PAGE_HIDE') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'PAGE_UNHIDE') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'PAGE_ACTIVATE') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'RELOAD_WINDOW') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'CLEAR_USERINFOS') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'SET_USERINFOS') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'CLEAR_FILEINFOS') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'REFRESH_WINDOW') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'ADD_FILE') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'OBJECT_DELETE') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'OBJECT_ADD_TAG') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'OBJECT_CHANGE') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'OBJECT_CHANGECLASS') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'OBJECT_CHANGEPNAME') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'OBJECT_CHANGEBGIMAGE') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'OBJECT_CHANGE_LOCK_STATE') === 0) { $allowed = true; } else { if ($permissionsObj != NULL) { $allowed = $permissionsObj->checkInternal(sUserMgr()->getCurrentUserID(), $objectID, "RREAD"); } } if ($permissionsObj != NULL || $allowed) { if ($allowed) { $itext = sItext(); switch ($queuedCommandRaw['OLDVALUE']) { case 'UNHIGHLIGHT': if ($queuedCommandRaw['TEXT']) { //$queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_unHilite(\''.$queuedCommandRaw['TEXT'].'\', \''.$objectID.'-template\', \''.$queuedCommandRaw['TEXT'].'\');'; $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_unHilite(\'' . $queuedCommandRaw['TEXT'] . '\', \'' . $queuedCommandRaw['VALUE1'] . '\', \'' . $queuedCommandRaw['VALUE2'] . '\');'; } break; case 'OBJECT_CHANGE_LOCK_STATE': if ($queuedCommandRaw['TEXT']) { $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_changeWindowLockStateForObject(\'' . $queuedCommandRaw['TEXT'] . '\', \'' . $queuedCommandRaw['VALUE1'] . '\', \'' . $queuedCommandRaw['VALUE2'] . '\');'; } break; case 'OBJECT_CHANGEBGIMAGE': if ($queuedCommandRaw['TEXT']) { $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_changeBGImage(\'' . $queuedCommandRaw['TEXT'] . '\', \'' . $queuedCommandRaw['VALUE1'] . '\', \'' . $queuedCommandRaw['VALUE2'] . '\', \'' . $queuedCommandRaw['VALUE3'] . '\');'; } break; case 'OBJECT_CHANGECLASS': if ($queuedCommandRaw['TEXT']) { $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_changeClass(\'' . $queuedCommandRaw['TEXT'] . '\', \'' . $queuedCommandRaw['VALUE1'] . '\', \'' . $queuedCommandRaw['VALUE2'] . '\', \'' . $queuedCommandRaw['VALUE3'] . '\');'; } break; case 'OBJECT_CHANGEPNAME': if ($queuedCommandRaw['TEXT']) { $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_changePName(\'' . $queuedCommandRaw['TEXT'] . '\', \'' . $queuedCommandRaw['VALUE1'] . '\', \'' . $queuedCommandRaw['VALUE2'] . '\', \'' . $queuedCommandRaw['VALUE3'] . '\', \'' . $url . '\', \'' . $imgurl . '\');'; } break; case 'OBJECT_CHANGE': if ($queuedCommandRaw['TEXT']) { $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_change(\'' . $queuedCommandRaw['TEXT'] . '\', \'' . addslashes($queuedCommandRaw['VALUE1']) . '\', \'' . addslashes($queuedCommandRaw['VALUE2']) . '\', \'' . addslashes($queuedCommandRaw['VALUE3']) . '\');'; } break; case 'OBJECT_ADD_TAG': if ($queuedCommandRaw['TEXT']) { $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_addTag(\'' . $queuedCommandRaw['TEXT'] . '\', \'' . $queuedCommandRaw['VALUE1'] . '\', \'' . $queuedCommandRaw['VALUE2'] . '\', \'' . $queuedCommandRaw['VALUE3'] . '\', \'' . $queuedCommandRaw['VALUE4'] . '\', ' . stripslashes($queuedCommandRaw['VALUE5']) . ', \'' . $queuedCommandRaw['VALUE6'] . '\', \'' . $queuedCommandRaw['VALUE7'] . '\');'; } break; case 'OBJECT_DELETE': if ($queuedCommandRaw['TEXT']) { $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_del(\'' . $queuedCommandRaw['TEXT'] . '\', \'' . $queuedCommandRaw['VALUE1'] . '\', \'' . $queuedCommandRaw['VALUE2'] . '\', \'' . $queuedCommandRaw['VALUE3'] . '\', \'' . $queuedCommandRaw['VALUE4'] . '\');'; } break; case 'ADD_FILE': $file = new File($objectID); $latestVersion = $file->getLatestApprovedVersion(); $file = new File($objectID, $latestVersion); $fileInfo = $file->get(); $reftracker = new Reftracker(); if ($fileInfo['CREATEDBY']) { $user = new User($fileInfo['CREATEDBY']); $userInfo = $user->get(); $userInfo['PROPS'] = $user->properties->getValues($fileInfo['CREATEDBY']); } $fileInfo['CUSTOM_DATE'] = date('d.m.Y', TStoLocalTS($fileInfo['CHANGEDTS'])); $fileInfo['CUSTOM_TIME'] = date('G:i', TStoLocalTS($fileInfo['CHANGEDTS'])); $fileInfo['REFS'] = $reftracker->getIncomingForFile($fileInfo['OBJECTID']); $tags = $file->tags->getAssigned(); for ($t = 0; $t < count($tags); $t++) { $tp = array(); $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'; $tags[$t]['PARENTS'] = $tp2; } $fileInfo['TAGS'] = $tags; $fileInfo['THUMB'] = 1; if ($queuedCommandRaw['TEXT'] == 'nothumb') { $fileInfo['THUMB'] = 0; } $views = $file->views->getAssigned(); foreach ($views as $view) { if ($view["IDENTIFIER"] == "YGSOURCE") { $viewinfo = $file->views->getGeneratedViewInfo($view["ID"]); $fileInfo["WIDTH"] = $viewinfo[0]["WIDTH"]; $fileInfo["HEIGHT"] = $viewinfo[0]["HEIGHT"]; } } $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_addFile(\'file\', \'' . $fileInfo['PARENT'] . '-file\', \'' . $objectID . '\', \'' . $fileInfo['THUMB'] . '\', \'' . $fileInfo['COLOR'] . '\', \'' . $fileInfo['CODE'] . '\', \'' . $fileInfo['NAME'] . '\', \'' . $fileInfo['PNAME'] . '\', \'' . json_encode($fileInfo['TAGS']) . '\', \'' . $fileInfo['FILESIZE'] . '\', \'' . count($fileInfo['REFS']) . '\', \'' . TStoLocalTS($fileInfo['CHANGEDTS']) . '\', \'' . $fileInfo['CUSTOM_DATE'] . '\', \'' . $fileInfo['CUSTOM_TIME'] . '\', \'' . $fileInfo['UID'] . '\', \'' . $userInfo['PROPS']['FIRSTNAME'] . ' ' . $userInfo['PROPS']['LASTNAME'] . '\', \'' . $fileInfo['FILENAME'] . '\', \'' . $fileInfo["WIDTH"] . '\', \'' . $fileInfo['HEIGHT'] . '\');'; break; case 'REFRESH_TAGS': if ($queuedCommandRaw['TEXT']) { switch ($queuedCommandRaw['TYPE']) { case HISTORYTYPE_CO: $objType = 'cblock'; break; case HISTORYTYPE_FILE: $objType = 'file'; break; } } $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_refreshTags(\'' . $objType . '\', \'' . $objectID . '-' . $objType . '\', \'tags\', \'' . $queuedCommandRaw['TEXT'] . '\');'; break; case 'REFRESH_WINDOW': if ($queuedCommandRaw['TEXT']) { switch ($queuedCommandRaw['TYPE']) { case HISTORYTYPE_CO: $objType = 'cblock'; break; case HISTORYTYPE_PAGE: $objType = 'page'; break; case HISTORYTYPE_FILE: $objType = 'file'; break; case HISTORYTYPE_TAG: $objType = 'tag'; break; case HISTORYTYPE_TEMPLATE: $objType = 'template'; break; case HISTORYTYPE_ENTRYMASK: $objType = 'entrymask'; break; case HISTORYTYPE_SITE: $objType = 'site'; break; } // Special cases switch ($queuedCommandRaw['TYPE']) { case HISTORYTYPE_PAGE: $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_refreshWin(\'' . $objType . '\',\'' . $objectID . '-' . $siteID . '\',\'' . $queuedCommandRaw['TEXT'] . '\');'; break; case HISTORYTYPE_FILE: $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_refreshWin(\'' . $objType . '\',\'' . $objectID . '-' . $objType . '\',\'' . $queuedCommandRaw['TEXT'] . '\');'; $queuedCommands[$queuedCommandRaw['ID']] .= 'Koala.yg_refreshWin(\'' . $objType . 'folder\',\'' . $objectID . '-' . $objType . '\',\'' . $queuedCommandRaw['TEXT'] . '\');'; break; default: $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_refreshWin(\'' . $objType . '\',\'' . $objectID . '-' . $objType . '\',\'' . $queuedCommandRaw['TEXT'] . '\');'; break; } } break; case 'CLEAR_FILEINFOS': $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_fileInfos[' . $objectID . '] = null;'; break; case 'SET_FILEINFOS': $file = sFileMgr()->getFile($objectID); if ($file) { $latestFinalVersion = $file->getLatestApprovedVersion(); $file = new File($objectID, $latestFinalVersion); $fileInfo = $file->get(); $fileTypes = sFileMgr()->getFiletypes(); $user = new User(sUserMgr()->getCurrentUserID()); $fileInfo['DATE'] = date($itext['DATE_FORMAT'], TStoLocalTS($fileInfo['CHANGEDTS'])); $fileInfo['TIME'] = date($itext['TIME_FORMAT'], TStoLocalTS($fileInfo['CHANGEDTS'])); $fileInfo['FILESIZE'] = formatFileSize($fileInfo['FILESIZE']); $views = $file->views->getAssigned(true); $viewInfo = $file->views->getGeneratedViewInfo($views[0]["ID"]); $fileInfo['WIDTH'] = $viewInfo[0]["WIDTH"]; $fileInfo['HEIGHT'] = $viewInfo[0]["HEIGHT"]; $fileInfo['TAGS'] = $file->tags->getAssigned(); $tags = array(); foreach ($fileInfo['TAGS'] as $tag) { array_push($tags, $tag['NAME']); } $fileTags = implode(', ', $tags); if (strlen($fileTags) > 40) { $fileTags = substr($fileTags, 0, 40); $fileTags .= '...'; } $fileInfo['TAGS'] = $fileTags; if (strlen($fileInfo['NAME']) > 40) { $fileInfo['NAME'] = substr($fileInfo['NAME'], 0, 40); $fileInfo['NAME'] .= '...'; } if (strlen($fileInfo['FILENAME']) > 40) { $fileInfo['FILENAME'] = substr($fileInfo['FILENAME'], 0, 40); $fileInfo['FILENAME'] .= '...'; } if ($fileInfo['CREATEDBY']) { $user = new User($fileInfo['CREATEDBY']); $userInfo = $user->get(); $userInfo['PROPS'] = $user->properties->getValues($fileInfo['CREATEDBY']); $fileInfo['USERNAME'] = $userInfo['PROPS']['FIRSTNAME'] . ' ' . $userInfo['PROPS']['LASTNAME']; } foreach ($fileTypes as $fileTypes_item) { if ($fileTypes_item['ID'] == $fileInfo['FILETYPE']) { $fileInfo['FILETYPE_TXT'] = $fileTypes_item['NAME']; } } $fileInfo['THUMB'] = 0; $hiddenViews = $file->views->getHiddenViews(); foreach ($hiddenViews as $view) { if ($view['IDENTIFIER'] == 'yg-preview') { $tmpviewinfo = $file->views->getGeneratedViewInfo($view["ID"]); if ($tmpviewinfo[0]["TYPE"] == FILE_TYPE_WEBIMAGE) { $fileInfo['THUMB'] = 1; $fileInfo['PREVIEWWIDTH'] = $tmpviewinfo[0]["WIDTH"]; $fileInfo['PREVIEWHEIGHT'] = $tmpviewinfo[0]["HEIGHT"]; } } } $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_fileInfos[' . $objectID . '] = ' . json_encode($fileInfo) . ';Koala.yg_showFileHint(\'' . $objectID . '\');'; } break; case 'SET_USERINFOS': $user = new User($objectID); $userInfo = $user->get(); $userInfo['PROPS'] = $user->properties->getValues($objectID); $userInfo['USERGROUPS'] = $user->getUsergroups($objectID); $roles = array(); foreach ($userInfo['USERGROUPS'] as $role) { array_push($roles, $role['NAME']); } $user_roles = implode(', ', $roles); if (strlen($user_roles) > 30) { $user_roles = substr($user_roles, 0, 30); $user_roles .= '...'; } if (file_exists(sApp()->app_root . sApp()->userpicdir . $objectID . '-picture.jpg')) { $internPrefix = (string) sConfig()->getVar('CONFIG/REFTRACKER/INTERNALPREFIX'); $user_picture = $internPrefix . 'userimage/' . $objectID . '/48x48?rnd=' . rand(); } else { $user_picture = sApp()->imgpath . 'content/temp_userpic.png'; } $user_company = $userInfo['PROPS']['COMPANY']; $user_name = $userInfo['PROPS']['FIRSTNAME'] . ' ' . $userInfo['PROPS']['LASTNAME']; $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_userInfos[' . $objectID . '] = {name: \'' . $user_name . '\', groups: \'' . $user_roles . '\', pic: \'' . $user_picture . '\', company: \'' . $user_company . '\'}'; break; case 'CLEAR_USERINFOS': $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_userInfos[' . $objectID . '] = null;'; break; case 'CLEAR_REFRESH': if ($queuedCommandRaw['TEXT']) { $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_clearRefresh(\'' . $objectID . '-' . $queuedCommandRaw['TEXT'] . '\');'; } break; case 'RELOAD_WINDOW': if ($queuedCommandRaw['TEXT']) { $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_reloadWin(null, \'' . $objectID . '-' . $queuedCommandRaw['TEXT'] . '\');'; } break; case 'PAGE_DEACTIVATE': if ($queuedCommandRaw['TEXT']) { $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_deActivate(\'page\', \'' . $objectID . '-' . $siteID . '\', \'name\');'; } break; case 'PAGE_ACTIVATE': if ($queuedCommandRaw['TEXT']) { $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_activate(\'page\', \'' . $objectID . '-' . $siteID . '\', \'name\');'; } break; case 'PAGE_UNHIDE': if ($queuedCommandRaw['TEXT']) { $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_unHide(\'page\', \'' . $objectID . '-' . $siteID . '\', \'name\');'; } break; case 'PAGE_HIDE': if ($queuedCommandRaw['TEXT']) { $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_hide(\'page\', \'' . $objectID . '-' . $siteID . '\', \'name\');'; } break; case 'FILE_DELVIEW': if ($queuedCommandRaw['TEXT']) { $file = sFileMgr()->getFile($objectID); $fileInfo = $file->get(); if ($fileInfo['FOLDER'] == 1) { $isFolder = 'true'; } else { $isFolder = 'false'; } $queuedCommands[$queuedCommandRaw['ID']] = 'if (Koala.yg_delViewArr[' . $queuedCommandRaw['TEXT'] . ']) Koala.yg_delViewArr[' . $queuedCommandRaw['TEXT'] . '](' . $objectID . ', ' . $isFolder . ');'; } break; case 'FILE_CLEAR_DELVIEW': if ($queuedCommandRaw['TEXT']) { $queuedCommands[$queuedCommandRaw['ID']] = 'if (Koala.yg_delViewArr[' . $queuedCommandRaw['TEXT'] . ']) Koala.yg_delViewArr[' . $queuedCommandRaw['TEXT'] . ']=undefined;'; } break; case 'FILE_ADDVIEW': if ($queuedCommandRaw['TEXT']) { $file = sFileMgr()->getFile($objectID); $fileInfo = $file->get(); $viewInfo = $viewMgr->get($queuedCommandRaw['TEXT']); if ($fileInfo['FOLDER'] == 1) { $isFolder = 'true'; } else { $isFolder = 'false'; } $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_addView(\'' . $objectID . '\', \'' . $viewInfo['ID'] . '\', \'' . $viewInfo['IDENTIFIER'] . '\', \'' . $viewInfo['NAME'] . '\', \'' . $viewInfo['WIDTH'] . '\', \'' . $viewInfo['HEIGHT'] . '\', \'' . $isFolder . '\');'; } break; case 'FILE_GENERATEDVIEW': if ($queuedCommandRaw['TEXT']) { $file = sFileMgr()->getFile($objectID); $viewInfo = $viewMgr->get($queuedCommandRaw['TEXT']); $generatedViewInfo = $file->views->getGeneratedViewInfo($viewInfo['ID']); if ($generatedViewInfo[0]['TYPE'] == FILE_TYPE_WEBIMAGE) { $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_addGenerated(\'' . $objectID . '\',\'' . $viewInfo['IDENTIFIER'] . '\', \'' . $viewInfo['WIDTH'] . '\', \'' . $viewInfo['HEIGHT'] . '\');'; } else { if ($generatedViewInfo[0]) { $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_addGenerated(\'' . $objectID . '\',\'NULL\');'; } } } break; case 'UNHIGHLIGHT_TEMPLATE': if ($queuedCommandRaw['TEXT']) { $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_unHilite(\'template\', \'' . $objectID . '-template\', \'' . $queuedCommandRaw['TEXT'] . '\');'; } break; case 'HIGHLIGHT_PAGE': if ($queuedCommandRaw['TEXT']) { $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_hilite(\'page\', \'' . $objectID . '-' . $siteID . '\', \'' . $queuedCommandRaw['TEXT'] . '\');'; } break; case 'UNHIGHLIGHT_PAGE': if ($queuedCommandRaw['TEXT']) { $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_unHilite(\'page\', \'' . $objectID . '-' . $siteID . '\', \'' . $queuedCommandRaw['TEXT'] . '\');'; } break; case 'HIGHLIGHT_CBLOCK': if ($queuedCommandRaw['TEXT']) { $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_hilite(\'cblock\', \'' . $objectID . '-cblock\', \'' . $queuedCommandRaw['TEXT'] . '\');'; } break; case 'UNHIGHLIGHT_CBLOCK': if ($queuedCommandRaw['TEXT']) { $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_unHilite(\'cblock\', \'' . $objectID . '-cblock\', \'' . $queuedCommandRaw['TEXT'] . '\');'; } break; case 'UNHIGHLIGHT_ENTRYMASK': if ($queuedCommandRaw['TEXT']) { $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_unHilite(\'entrymask\', \'' . $objectID . '-entrymask\', \'' . $queuedCommandRaw['TEXT'] . '\');' . 'Koala.yg_unHilite(\'page\', \'' . $objectID . '-entrymask\', \'' . $queuedCommandRaw['TEXT'] . '\');'; } break; case 'UNHIGHLIGHT_SITE': if ($queuedCommandRaw['TEXT']) { $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_unHilite(\'page\', \'' . $objectID . '-site\', \'' . $queuedCommandRaw['TEXT'] . '\');'; } break; case 'HIGHLIGHT_SITE': if ($queuedCommandRaw['TEXT']) { $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_hilite(\'page\', \'' . $objectID . '-site\', \'' . $queuedCommandRaw['TEXT'] . '\');'; } break; case 'HIGHLIGHT_MAILING': if ($queuedCommandRaw['TEXT']) { $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_hilite(\'mailing\', \'' . $objectID . '-mailing' . '\', \'' . $queuedCommandRaw['TEXT'] . '\');'; } break; case 'UNHIGHLIGHT_MAILING': if ($queuedCommandRaw['TEXT']) { $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_unHilite(\'mailing\', \'' . $objectID . '-mailing' . '\', \'' . $queuedCommandRaw['TEXT'] . '\');'; } break; case 'PAGE_MOVE': if ($queuedCommandRaw['TEXT']) { if ($queuedCommandRaw['TARGETID'] == 1) { $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_moveTreeNode(\'page\', \'' . $objectID . '-' . $siteID . '\', \'' . $queuedCommandRaw['TEXT'] . '\', 2);'; } else { $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_moveTreeNode(\'page\', \'' . $objectID . '-' . $siteID . '\', \'' . $queuedCommandRaw['TEXT'] . '\', 1);'; } } break; case 'PAGE_MOVEUP': if ($queuedCommandRaw['TEXT']) { $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_moveUp(\'page\', \'' . $objectID . '-' . $siteID . '\', \'' . $queuedCommandRaw['TEXT'] . '\');'; } break; case 'PAGE_MOVEDOWN': if ($queuedCommandRaw['TEXT']) { $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_moveDown(\'page\', \'' . $objectID . '-' . $siteID . '\', \'' . $queuedCommandRaw['TEXT'] . '\');'; } break; case 'CBLOCK_MOVE': if ($queuedCommandRaw['TEXT']) { $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_moveTreeNode(\'cblock\', \'' . $objectID . '-cblock\', \'' . $queuedCommandRaw['TEXT'] . '-cblock\', 1);'; } break; case 'FILE_MOVE': if ($queuedCommandRaw['TEXT']) { $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_moveTreeNode(\'file\', \'' . $objectID . '-file\', \'' . $queuedCommandRaw['TEXT'] . '-file\', 1);'; } break; case 'TAG_MOVE': if ($queuedCommandRaw['TEXT']) { $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_moveTreeNode(\'tag\', \'' . $objectID . '-tag\', \'' . $queuedCommandRaw['TEXT'] . '-tag\', 1);'; } break; case 'TAG_ADD': $objectInfo = $tagMgr->get($objectID); $icon = $icons->icon['tag_small']; $statusClass = ''; if (!$permissionsObj->checkInternal(sUserMgr()->getCurrentUserID(), $objectID, "RWRITE")) { // Nur Leserecht (hellgrau) $statusClass .= " nowrite"; } if (!$permissionsObj->checkInternal(sUserMgr()->getCurrentUserID(), $objectID, "RDELETE")) { // Nur Leserecht (hellgrau) $statusClass .= " nodelete"; } if (!$permissionsObj->checkInternal(sUserMgr()->getCurrentUserID(), $objectID, "RSUB")) { $statusClass .= " nosub"; } $objectName = $objectInfo['NAME']; $objectParents = $tagMgr->getParents($objectID); $parentNodeId = $objectParents[0][0]["ID"]; if ($queuedCommandRaw['NEWVALUE'] == sGuiUS()) { $andSelect = 'true'; } else { $andSelect = 'false'; } $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_addChild(\'tag\', \'' . $parentNodeId . '-tag\', \'name\', \'' . $objectName . '\', \'tag\', \'' . $objectID . '-tag\', \'name\', \'' . $icon . '\', \'' . $statusClass . '\', ' . $andSelect . ');'; break; case 'FILE_ADD': case 'FILEFOLDER_ADD': $file = sFileMgr()->getFile($objectID); if ($file) { $objectInfo = $file->get(); $icon = $icons->icon['folder']; $statusClass = ''; if ($objectInfo["VERSIONPUBLISHED"] + 2 != $objectInfo["VERSION"] && $objectInfo["VERSIONPUBLISHED"] != ALWAYS_LATEST_APPROVED_VERSION && $objectInfo["HASCHANGED"] == "1") { // Editiert (grün) $statusClass = "changed"; } elseif ($objectInfo["HASCHANGED"] == "1") { $statusClass = "changed"; } if (!$permissionsObj->checkInternal(sUserMgr()->getCurrentUserID(), $objectID, "RWRITE")) { // Nur Leserecht (hellgrau) $statusClass .= " nowrite"; } if (!$permissionsObj->checkInternal(sUserMgr()->getCurrentUserID(), $objectID, "RDELETE")) { // Nur Leserecht (hellgrau) $statusClass .= " nodelete"; } if (!$permissionsObj->checkInternal(sUserMgr()->getCurrentUserID(), $objectID, "RSUB")) { $statusClass .= " nosub"; } $objectName = $objectInfo['NAME']; $objectParents = sFileMgr()->getParents($objectID); $parentNodeId = $objectParents[0][0]["ID"]; if ($queuedCommandRaw['NEWVALUE'] == sGuiUS()) { $andSelect = 'true'; } else { $andSelect = 'false'; } $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_addChild(\'file\', \'' . $parentNodeId . '-file\', \'name\', \'' . $objectName . '\', \'file\', \'' . $objectID . '-file\', \'name\', \'' . $icon . '\', \'' . $statusClass . '\', ' . $andSelect . ');'; } break; case 'CBLOCK_ADD': $cb = sCblockMgr()->getCblock($objectID); $objectInfo = $cb->get(); $icon = $icons->icon['cblock_small']; $statusClass = ''; if ($objectInfo['FOLDER'] != 1) { if ($objectInfo["VERSIONPUBLISHED"] + 2 != $objectInfo["VERSION"] && $objectInfo["VERSIONPUBLISHED"] != ALWAYS_LATEST_APPROVED_VERSION && $objectInfo["HASCHANGED"] == "1") { // Editiert (grün) $statusClass .= "changed changed1 nosub"; } elseif ($objectInfo["HASCHANGED"] == "1") { $statusClass .= "changed changed2 nosub"; } } else { if (!$permissionsObj->checkInternal(sUserMgr()->getCurrentUserID(), $objectID, "RSUB")) { $statusClass .= " nosub"; } $icon = $icons->icon['folder']; $statusClass .= " folder"; } if (!$permissionsObj->checkInternal(sUserMgr()->getCurrentUserID(), $objectID, "RWRITE")) { // Nur Leserecht (hellgrau) $statusClass .= " nowrite"; } if (!$permissionsObj->checkInternal(sUserMgr()->getCurrentUserID(), $objectID, "RDELETE")) { // Nur Leserecht (hellgrau) $statusClass .= " nodelete"; } $objectName = $objectInfo['NAME']; $objectParents = sCblockMgr()->getParents($objectID); $parentNodeId = $objectParents[0][0]["ID"]; if ($queuedCommandRaw['NEWVALUE'] == sGuiUS() && $queuedCommandRaw['TEXT'] != 'list') { $andSelect = 'true'; } else { $andSelect = 'false'; } if ($queuedCommandRaw['NEWVALUE'] == sGuiUS()) { $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_addListItem(\'' . $parentNodeId . '-cblock\', \'' . addslashes(json_encode($objectInfo)) . '\', \'' . $queuedCommandRaw['TEXT'] . '\');'; } $queuedCommands[$queuedCommandRaw['ID']] .= 'Koala.yg_addChild(\'cblock\', \'' . $parentNodeId . '-cblock\', \'name\', \'' . $objectName . '\', \'cblock\', \'' . $objectID . '-cblock\', \'name\', \'' . $icon . '\', \'' . $statusClass . '\', ' . $andSelect . ');'; break; case 'PAGE_ADD': if ($pageObj) { $objectInfo = $pageObj->get(); $icon = $icons->icon['page_small']; $statusClass = ''; $inactive = false; if ($objectInfo["ACTIVE"] == "0") { $icon = $icons->icon['page_inactive_small']; $inactive = true; } $naviinfo = NULL; $navis = $templateMgr->getNavis($objectInfo["TEMPLATEID"]); for ($i = 0; $i < count($navis); $i++) { if ($navis[$i]["ID"] == $objectInfo["NAVIGATIONID"]) { $naviinfo = $navis[$i]; } } if ($objectInfo["HIDDEN"] == "1" || $objectInfo["TEMPLATEID"] == "0" || !$naviinfo['ID']) { $icon = $icons->icon['page_hidden_small']; if ($inactive == true) { $icon = $icons->icon['page_inactive_hidden_small']; } } if ($objectInfo["VERSIONPUBLISHED"] + 2 != $objectInfo["VERSION"] && $objectInfo["VERSIONPUBLISHED"] != ALWAYS_LATEST_APPROVED_VERSION && $objectInfo["HASCHANGED"] == "1") { // Editiert (grün) $statusClass = "changed"; } elseif ($objectInfo["HASCHANGED"] == "1") { $statusClass = "changed"; } if (!$permissionsObj->checkInternal(sUserMgr()->getCurrentUserID(), $objectID, "RWRITE")) { // Nur Leserecht (hellgrau) $statusClass .= " nowrite"; } if (!$permissionsObj->checkInternal(sUserMgr()->getCurrentUserID(), $objectID, "RDELETE")) { // Nur Leserecht (hellgrau) $statusClass .= " nodelete"; } if (!$permissionsObj->checkInternal(sUserMgr()->getCurrentUserID(), $objectID, "RSUB")) { $statusClass .= " nosub"; } $objectName = $objectInfo['NAME']; $objectParents = $pageMgr->getParents($objectID); $parentNodeId = $objectParents[0][0]["ID"]; if (!$parentNodeId) { $parentNodeId = 1; } $url = $pageObj->getUrl(); if ($queuedCommandRaw['NEWVALUE'] == sGuiUS()) { $andSelect = 'true'; } else { $andSelect = 'false'; } $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_addChild(\'page\', \'' . $parentNodeId . '-' . $siteID . '\', \'name\', \'' . $objectName . '\', \'page\', \'' . $objectID . '-' . $siteID . '\', \'name\', \'' . $icon . '\', \'' . $statusClass . '\', ' . $andSelect . ', \'' . $url . '\');' . "\n"; } break; case 'MAILING_ADD': $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_refreshMailingsWindow();' . "\n"; break; case 'MAILING_DELETE': $queuedCommands[$queuedCommandRaw['ID']] = 'Koala.yg_refreshMailingsWindow(true);' . "\n"; break; default: $queuedCommands[$queuedCommandRaw['ID']] = stripslashes($queuedCommandRaw['OLDVALUE']) . "\n"; break; } } } } if (count($queuedCommandsRaw)) { $currentQueueId = $queuedCommandsRaw[count($queuedCommandsRaw) - 1]['ID']; } } $output = "\n<script>\n"; $output .= "parent.Koala.currentGuiSyncHistoryId = " . $currentQueueId . ";\n"; $output .= "parent.Koala.yg_executeGuiJSQueue( " . json_encode($queuedCommands) . " );\n"; $output .= "</script>\n"; print $output; }
/** * Calculates a unique permanent name for this Mailing * * @param string $iteration (optional) Iteration * @return string Permanent name */ function calcPName($iteration = "") { $mailingID = $this->_id; $pinfo = $this->get(); $mailingname = $pinfo["NAME"]; if ((int) sConfig()->getVar("CONFIG/CASE_SENSITIVE_URLS") == 0) { $mailingname = strtolower($mailingname); } $pname = $this->filterPName($mailingname); if (is_numeric($pname)) { $pname = 'mailing_' . $pname; } $mailingMgr = new MailingMgr(); if ($iteration != '') { $checkpinfo = $mailingMgr->getMailingIdByPName($pname . '_' . $iteration); } else { $checkpinfo = $mailingMgr->getMailingIdByPName($pname); } if ($checkpinfo["ID"] == $mailingID) { if ($iteration != '') { return $pname . '_' . $iteration; } else { return $pname; } } else { if ($checkpinfo["ID"] == NULL) { if ($iteration != '') { return $pname . '_' . $iteration; } else { return $pname; } } else { if ($iteration == "") { $iteration = 1; } return $this->calcPName(++$iteration); } } }
} } $koala->callJSFunction('Koala.yg_addRoleItem', $wid, $newRoleId, $itext['TXT_NEW_OBJECT'] ? $itext['TXT_NEW_OBJECT'] : '$TXT_NEW_OBJECT'); break; case 'deleteRole': $roleID = $this->params['roleID']; $wid = $this->params['wid']; $confirmed = $this->params['confirmed']; $positive = $this->params['positive']; if ($confirmed != 'true') { $parameters = array('roleID' => $roleID, 'wid' => $wid); $koala->callJSFunction('Koala.yg_confirm', $itext['TXT_USERGROUP_DELETE'] != '' ? $itext['TXT_USERGROUP_DELETE'] : '$TXT_USERGROUP_DELETE', $itext['TXT_USERGROUP_DELETE_TEXT'] != '' ? $itext['TXT_USERGROUP_DELETE_TEXT'] : '$TXT_USERGROUP_DELETE_TEXT', $action, json_encode($parameters)); } else { if ($confirmed == 'true' && $positive == 'true') { // Remove all assignments to this role in mailings $mailingMgr = new MailingMgr(); $mailingMgr->removeUsergroupFromMailings($roleID); sUsergroups()->remove($roleID); $koala->queueScript('$(Koala.windows[\'' . $wid . '\'].boundWindow).addClassName(\'boxghost\')'); $koala->queueScript('Koala.windows[Koala.windows[\'' . $wid . '\'].boundWindow].init();'); $jsQueue->add($roleID, HISTORYTYPE_USERGROUP, 'OBJECT_DELETE', sGuiUS(), 'usergroup', NULL, NULL, $roleID . '-usergroup', 'item'); } } break; case 'setNewPassword': $userPassword = $this->params['userPassword']; $userToken = $this->params['userToken']; $winID = $this->params['winID']; if ($userID = sUserMgr()->getUserIdByToken($userToken)) { $user = new User($userID); $userinfo = $user->get();
<?php $siteID = $this->request->parameters["site"]; $pageID = $this->request->parameters["page"]; $action = $this->request->parameters["action"]; $template = (int) sanitize($this->request->parameters["template"]); $templateMgr = new Templates(); if ($template == 0 && $siteID && $pageID) { if ($siteID == "mailing") { $mailingMgr = new MailingMgr(); $mailing = $mailingMgr->getMailing($pageID); $mailingInfo = $mailing->get(); $template = $mailingInfo["TEMPLATEID"]; } else { $pageMgr = new PageMgr($siteID); $page = $pageMgr->getPage($pageID); $pageInfo = $page->get(); $template = $pageInfo["TEMPLATEID"]; } } else { $template = (int) sanitize($this->request->parameters["template"]); } if ($template != 0) { $templateInfo = $templateMgr->getTemplate($template); $templateInfo["PREVIEWPATH"] = $templateMgr->getPreviewPath($template); } else { $templateInfo = false; } $smarty->assign("templateInfo", $templateInfo); $smarty->assign("mode", sanitize($this->request->parameters["mode"])); $smarty->display("file:" . getrealpath($this->page_template));
break; } break; case 'setObjectProperty': // Cannot use new style of parameters here (function is called by a custom-attribute event - and therefore does not know about named parameters) // Get property name $property = $data[1]['yg_property']; // Get window-ID $winID = $data[1]['winID']; // Split ObjectID and SiteID $data = explode('-', $this->reponsedata[$property]->yg_id); $obj_type = $this->reponsedata[$property]->type; switch ($obj_type) { case 'mailing': $object = $data[0]; $mailingMgr = new MailingMgr(); $jsQueue = new JSQueue(NULL); $mailing = $mailingMgr->getMailing($object); $objectInfo = $mailing->get(); // Get old property value & check if change is needed $oldvalue = $mailing->properties->getValueInternal(strtoupper($property)); $value = str_replace("\r", '', str_replace("\n", '\\n', $this->reponsedata[$property]->value)); if ($value == ' ') { $value = ''; } if ($oldvalue == $value) { // No update needed, henceforth break break; } // Check for empty name if ($property == 'name' && trim($value) == '') {