function throwErrorPage($code) { if ($code == "404") { $header = $_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found'; } else { if ($code == "403") { $header = $_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden'; } else { $header = $_SERVER['SERVER_PROTOCOL'] . ' ' . $code; } } header($header); $errorPage = sConfig()->getVar('CONFIG/ERRORPAGES/ERROR_' . $code); if ($errorPage && $errorPage != '') { $request_path_string = getRequestPathString(explode('/', 'page' . $errorPage)); $request_path = getRequestPathArray($request_path_string); $psite = $request_path[1]; if ((int) $psite > 0) { $sinfo = sSites()->get($psite); $siteID = (int) $psite; } else { $sinfo = sSites()->getByPName($psite); $siteID = $sinfo['ID']; } $pageMgr = new PageMgr($siteID); $pageID = $pageMgr->getPageIdByPname($request_path[count($request_path) - 1]); $page = $pageMgr->getPage($pageID); $pageInfo = $page->get(); $version = $page->getLatestVersion(); renderPage($page, $version, $pageInfo, $pageMgr, $sinfo); } else { echo $header; } die; }
public function process($objectid, $params) { $view = $params["VIEW"]; $fileMgr = sFileMgr(); $view = $fileMgr->views->get($view["ID"]); $fileinfo = $params["FILEINFO"]; $filedir = getrealpath(getcwd() . "/" . sConfig()->getVar('CONFIG/DIRECTORIES/FILESDIR')) . "/"; $filename = $fileinfo['OBJECTID'] . '-' . $fileinfo['VIEWVERSION'] . $fileinfo['FILENAME']; $file = $filedir . $filename; $imgsize = getimagesize($file); $info = $this->generateThumbnail($filename, $imgsize, $view['IDENTIFIER'], $view['WIDTH'], $view['HEIGHT'], $filedir, $file, $view['CONSTRAINWIDTH'], $view['CONSTRAINHEIGHT'], $view['WIDTHCROP'], $view['HEIGHTCROP']); if ($info) { $file = new File($fileinfo['OBJECTID'], $fileinfo['VERSION']); $file->views->addGenerated($view["ID"], $info["WIDTH"], $info["HEIGHT"], $info["VIEWTYPE"]); } return true; }
/** * Constructor of the Reftracker class */ function __construct() { $this->_db = sYDB(); $this->_uid =& sUserMgr()->getCurrentUserID(); $this->_internPrefix = str_replace("/", '\\/', sConfig()->getVar('CONFIG/REFTRACKER/INTERNALPREFIX')); }
<?php session_write_close(); while (@ob_end_clean()) { } ini_set("zlib.output_compression", "Off"); // Normalize everything and remove webroot-prefix $request_path = $this->request->path; $webroot_path = explode('/', rtrim(ltrim((string) sConfig()->getVar("CONFIG/DIRECTORIES/WEBROOT"), '/'), '/')); $request_path_string = implode('/', $request_path); $webroot_path_string = implode('/', $webroot_path); if (strpos($request_path_string, "download/") === 0) { // Remove leading 'page/' $request_path_string = substr($request_path_string, strlen("download/")); } 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('/', "download/" . $request_path_string); $fileId = $request_path[1]; $prefix = $request_path[2]; if ($fileId == 'download') { $fileId = $request_path[2]; $prefix = $request_path[3]; } if ($prefix == "YGSOURCE") { unset($prefix); } // Check if id is pname if ($request_path[0] == $request_path[1]) {
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);
/** * Gets a list of Files * * @param int $fileId (optional) Id of the parent File from which the list will be created * @param array $filter (optional, may be combined) If SUBNODES, only subnodes of the specified File will be returned<br> * if TRASHCAN, only items in the Trash will be returned<br> * if FOLDERS, only folders will be returned * @param string $sort (optional) "ORDER BY" Sql clause * @param int $maxLevel (optional) Specifies the maximum level of nodes to get * @param int $usergroupId (optional) Return List for a specfic Usergroup Id * @param array $filterArray Array of filters for the SQL query * @return array|false Array of Files or FALSE in case of an error * @throws Exception */ function getList($fileId = 0, $filter = array(), $sort = 'group2.LFT', $maxLevel = 0, $usergroupId = 0, $filterArray) { $fileId = (int) $fileId; $sort = sanitize($sort); $maxLevel = (int) $maxLevel; $usergroupId = (int) $usergroupId; $rootGroupId = (int) sConfig()->getVar("CONFIG/SYSTEMUSERS/ROOTGROUPID"); if ($fileId == 0) { $fileId = $this->tree->getRoot(); } if (in_array("SUBNODES", $filter)) { $myinfo = $this->tree->getAll($fileId); $myleft = $myinfo["LFT"]; $myrgt = $myinfo["RGT"]; $subnodesql = " AND (group2.LFT > {$myleft} AND group2.RGT < {$myrgt}) "; if (!$myinfo) { return false; } } if (in_array("FOLDERS", $filter)) { $subnodesql .= " AND (prop.FOLDER = 1)"; } // Surpress items in trashcan if not explicitly asked for if (in_array("TRASHCAN", $filter)) { $subnodesql .= " AND prop.DELETED = 1 AND prop.FOLDER = 0"; } else { $subnodesql .= " AND prop.DELETED = 0"; } // Check if special filter was suppplied $filterOrder = 'ORDER BY ' . $sort; if ($filterArray) { $filterSelect = $filterFrom = $filterWhere = $filterLimit = $filterOrder = ''; buildBackendFilter('FilesSearchCB', $filterArray, $filterSelect, $filterFrom, $filterWhere, $filterLimit, $filterOrder); $subnodesql .= $filterWhere; } if ($maxLevel > 0) { $maxlevelsql = " AND (group2.LEVEL <= {$maxLevel}) AND (group1.LEVEL <= {$maxLevel})"; } $perm_sql_select = ", MAX(perm.RREAD) AS RREAD, MAX(perm.RWRITE) AS RWRITE, MAX(perm.RDELETE) AS RDELETE, MAX(perm.RSUB) AS RSUB, MAX(perm.RSTAGE) AS RSTAGE, MAX(perm.RMODERATE) AS RMODERATE, MAX(perm.RCOMMENT) AS RCOMMENT"; $perm_sql_from = " LEFT JOIN yg_files_permissions AS perm ON perm.OID = group2.ID"; if ($usergroupId > 0) { $perm_sql_from .= " AND (perm.USERGROUPID = " . $usergroupId . ")"; } else { $perm_sql_where = " AND ("; $roles = $this->permissions->getUsergroups(); for ($r = 0; $r < count($roles); $r++) { $perm_sql_where .= "(perm.USERGROUPID = " . (int) $roles[$r]["ID"] . ") "; if (count($roles) - $r > 1) { $perm_sql_where .= " OR "; } } $perm_sql_where .= ") "; $perm_sql_where .= " AND ((RREAD >= 1) OR (perm.USERGROUPID = {$rootGroupId})) "; } $sql = "SELECT\n\t\t\t\t\tgroup2.LFT,\n\t\t\t\t\tgroup2.RGT,\n\t\t\t\t\tgroup2.VERSIONPUBLISHED,\n\t\t\t\t\tgroup2.ID,\n\t\t\t\t\tgroup2.LEVEL AS LEVEL,\n\t\t\t\t\tgroup2.PARENT AS PARENT,\n\t\t\t\t\tMAX(prop.VERSION) AS VERSION,\n\t\t\t\t\tprop.FOLDER AS FOLDER,\n\t\t\t\t\tprop.FILENAME AS FILENAME,\n\t\t\t\t\tprop.FILETYPE AS FILETYPE,\n\t\t\t\t\tprop.FILESIZE AS FILESIZE,\n\t\t\t\t\tSUBSTRING_INDEX(prop.FILENAME, '.', -1) AS EXTENSION,\n\t\t\t\t\tpv.*,\n\t\t\t\t\tprop.CREATEDTS,\n\t\t\t\t\tprop.CHANGEDTS,\n\t\t\t\t\tprop.CREATEDBY,\n\t\t\t\t\tprop.CHANGEDBY\n\t\t\t\t\t{$perm_sql_select}\n\t\t\t\tFROM\n\t\t\t\t\t({$this->table} AS group1, {$this->table} AS group2, yg_files_properties AS prop)\n\t\t\t\t\t{$perm_sql_from}\n\t\t\t\tLEFT JOIN yg_files_propsv AS pv\n\t\t\t\t\tON pv.OID = prop.ID\n\t\t\t\tWHERE\n\t\t\t\t\t((group2.LFT >= group1.LFT) AND (group2.LFT <= group1.RGT)) AND\n\t\t\t\t\t(group2.ID = prop.OBJECTID) AND\n\t\t\t\t\t(prop.VERSION = (SELECT MAX( rgt.VERSION ) FROM yg_files_properties AS rgt WHERE (prop.OBJECTID = rgt.OBJECTID)))\n\t\t\t\t\t{$perm_sql_where}\n\t\t\t\t\t{$maxlevelsql}\n\t\t\t\t\t{$subnodesql}\n\t\t\t\tGROUP BY\n\t\t\t\t\tgroup2.LFT, group2.RGT, group2.VERSIONPUBLISHED, group2.ID\n\t\t\t\t{$filterOrder} {$filterLimit};"; $dbr = sYDB()->Execute($sql); if ($dbr === false) { throw new Exception(sYDB()->ErrorMsg()); } $blaetter = $dbr->GetArray(); return $blaetter; }
<?php $tmpUser = new User(sUserMgr()->getCurrentUserID()); $tmpUserInfo = $tmpUser->get(); $adminAllowed = $tmpUser->checkPermission('RUPDATER'); if ($adminAllowed) { session_start(); //sApp() $this->yeager_version = $versionp; //$this->yeager_revision = YEAGER_REVISION; //$this->yeager_date = YEAGER_DATE; $databaseInfo = sConfig()->getVars('CONFIG/DB'); $databaseHost = $databaseInfo[0]['host']; $databaseHost = explode(':', $databaseHost); if (count($databaseHost) > 1) { $databasePort = $databaseHost[1]; $databaseHost = $databaseHost[0]; } else { $databasePort = '3306'; $databaseHost = $databaseHost[0]; } $_SESSION['APPINFO'] = array('VERSION' => $this->yeager_version, 'REVISION' => $this->yeager_revision, 'DATABASE_SERVER' => $databaseHost, 'DATABASE_PORT' => $databasePort, 'DATABASE_USER' => $databaseInfo[0]['user'], 'DATABASE_PASSWORD' => $databaseInfo[0]['password'], 'DATABASE_NAME' => $databaseInfo[0]['db'], 'PATH_BASE' => dirname($_SERVER['SCRIPT_FILENAME']) . '/'); $updateMgr = new Updater(); $updates = $updateMgr->getUpdates(); $currVersion = $updateMgr->current_version_string; $currRevision = $this->yeager_revision; //$currDate = explode('-', substr(YEAGER_DATE, 6, 11)); //$currDate = gmmktime(0, 0, 0, $currDate[1], $currDate[2], $currDate[0]); $currDate = ''; } $winID = $this->request->parameters['win_no'];
$passwordInsecure = true; } } if ($emailChanged || $passwordChanged) { $this->session->setPSessionVar('isvalidated', true); $this->session->refrehSessionCookie(); } if (file_exists($this->approot . $this->userpicdir . sUserMgr()->getCurrentUserID() . '-temp_picture.jpg')) { $cachedImages = glob($this->approot . $this->userpicdir . sUserMgr()->getCurrentUserID() . '-*x*.jpg'); foreach ($cachedImages as $cachedImagesItem) { @unlink($cachedImagesItem); } rename($this->approot . $this->userpicdir . sUserMgr()->getCurrentUserID() . '-temp_picture.jpg', $this->approot . $this->userpicdir . sUserMgr()->getCurrentUserID() . '-picture.jpg'); $user->properties->setValue('PROFILEPICTURE', sUserMgr()->getCurrentUserID()); } $internPrefix = (string) sConfig()->getVar('CONFIG/REFTRACKER/INTERNALPREFIX'); $userpic = $internPrefix . '/userimage/' . sUserMgr()->getCurrentUserID() . '/48x48?rnd=' . rand(); if ($confirmed == 'true' && $positive == 'false' || !$hadError) { $koala->queueScript('Koala.windows[\'wid_' . $winid . '\'].remove();'); $jsQueue->add(sUserMgr()->getCurrentUserID(), HISTORYTYPE_USER, 'OBJECT_CHANGE', sGuiUS(), 'user', NULL, NULL, sUserMgr()->getCurrentUserID() . '-user', 'firstname', $firstname); $jsQueue->add(sUserMgr()->getCurrentUserID(), HISTORYTYPE_USER, 'OBJECT_CHANGE', sGuiUS(), 'user', NULL, NULL, sUserMgr()->getCurrentUserID() . '-user', 'lastname', $lastname); $jsQueue->add(sUserMgr()->getCurrentUserID(), HISTORYTYPE_USER, 'OBJECT_CHANGE', sGuiUS(), 'user', NULL, NULL, sUserMgr()->getCurrentUserID() . '-user', 'name', $firstname . ' ' . $lastname); $jsQueue->add(sUserMgr()->getCurrentUserID(), HISTORYTYPE_USER, 'OBJECT_CHANGE', sGuiUS(), 'user', NULL, NULL, sUserMgr()->getCurrentUserID() . '-user', 'email', $email); $jsQueue->add(sUserMgr()->getCurrentUserID(), HISTORYTYPE_USER, 'OBJECT_CHANGE', sGuiUS(), 'user', NULL, NULL, sUserMgr()->getCurrentUserID() . '-user', 'company', $company); $jsQueue->add(sUserMgr()->getCurrentUserID(), HISTORYTYPE_USER, 'OBJECT_CHANGEBGIMAGE', sGuiUS(), 'user', NULL, NULL, sUserMgr()->getCurrentUserID() . '-user', 'picture', $userpic); $jsQueue->add(sUserMgr()->getCurrentUserID(), HISTORYTYPE_USER, 'CLEAR_USERINFOS', sGuiUS(), NULL); $koala->queueScript('Koala.userSettings.weekStart = \'' . $weekstart . '\';'); } elseif ($hadError) { foreach ($errorFields as $errorField) { $koala->queueScript('$(\'wid_' . $winid . '_' . $errorField . '\').addClassName(\'error\');'); }
/** * Gets the path of the Template preview * * @param int $templateId Template Id * @return string Template preview path */ function getPreviewPath($templateId) { // Check for template preview $templatePreviewDir = getRealpath(sConfig()->getVar('CONFIG/DIRECTORIES/TEMPLATEPREVIEWDIR')) . '/'; $foundFiles = glob($templatePreviewDir . $templateId . '-*'); if ($foundFiles !== false && count($foundFiles) > 0) { $previewFile = explode('/', $foundFiles[0]); $previewFile = $previewFile[count($previewFile) - 1]; $previewDir = sConfig()->getVar('CONFIG/DIRECTORIES/TEMPLATEPREVIEWDIR'); } return $previewDir . $previewFile; }
} } if (count($found_temp_template_files) > 0 && $templatechanged) { // Delete old files $old_template_files = glob($templatedir . $objectID . '-*'); foreach ($old_template_files as $old_template_file) { unlink($old_template_file); } // Rename temp file to real filename $real_filename = basename(str_replace('TMP_' . $objectID . '-', '', $found_temp_template_files[count($found_temp_template_files) - 1])); $real_filename = explode('-', $real_filename); array_shift($real_filename); $real_filename = implode('', $real_filename); rename($found_temp_template_files[count($found_temp_template_files) - 1], $templatedir . $real_filename); // Get new file mode to set from configfile (and set it) $newFileMode = octdec(sConfig()->getVar('CONFIG/UPLOAD_PERMISSIONS')); if ($newFileMode) { chmod($templatedir . $real_filename, $newFileMode); } $found_temp_template_files_to_del = glob($templatedir . 'TMP_' . $objectID . '-*'); foreach ($found_temp_template_files_to_del as $found_temp_template_file_to_del) { unlink($found_temp_template_file_to_del); } $templateMgr->setPath($objectID, ''); $templateMgr->setFilename($objectID, basename($real_filename)); // Check for added/removed contentareas $filecontentareas = $templateMgr->getContentareasFromFile($objectID); $contentareas = $templateMgr->getContentareas($objectID); $a = 0; $r = 0; $afilecontentareas = array();
/** * Removes a Usergroup * * @param int $usergroupId Usergroup Id * @return bool TRUE on success or FALSE in case of an error */ function remove($usergroupId) { if ($this->permissions->check($this->_uid, 'RUSERGROUPS')) { $usergroupId = (int) $usergroupId; if ($usergroupId == (int) sConfig()->getVar('CONFIG/SYSTEMUSERS/ROOTGROUPID')) { return false; } // do not allow root Usergroup to be deleted $sql = "DELETE FROM " . $this->_table . " WHERE ID = ?;"; sYDB()->Execute($sql, $usergroupId); $sql = "DELETE FROM yg_user_lnk_usergroups WHERE USERGROUPID = ?;"; sYDB()->Execute($sql, $usergroupId); $sql = "DELETE FROM yg_contentblocks_permissions WHERE USERGROUPID = ?;"; sYDB()->Execute($sql, $usergroupId); $sql = "DELETE FROM yg_entrymasks_permissions WHERE USERGROUPID = ?;"; sYDB()->Execute($sql, $usergroupId); $sql = "DELETE FROM yg_files_permissions WHERE USERGROUPID = ?;"; sYDB()->Execute($sql, $usergroupId); $sql = "DELETE FROM yg_filetypes_permissions WHERE USERGROUPID = ?;"; sYDB()->Execute($sql, $usergroupId); $sql = "DELETE FROM yg_mailing_permissions WHERE USERGROUPID = ?;"; sYDB()->Execute($sql, $usergroupId); $sql = "DELETE FROM yg_tags_permissions WHERE USERGROUPID = ?;"; sYDB()->Execute($sql, $usergroupId); $sql = "DELETE FROM yg_templates_permissions WHERE USERGROUPID = ?;"; sYDB()->Execute($sql, $usergroupId); $sql = "DELETE FROM yg_usergroups_permissions WHERE USERGROUPID = ?;"; sYDB()->Execute($sql, $usergroupId); $sql = "DELETE FROM yg_views_permissions WHERE USERGROUPID = ?;"; sYDB()->Execute($sql, $usergroupId); $sql = "DELETE FROM yg_mailing_lnk_usergroups WHERE RID = ?;"; sYDB()->Execute($sql, $usergroupId); $allSites = sSites()->getList(); foreach ($allSites as $allSitesItem) { $sql = "DELETE FROM yg_site_" . $allSitesItem['ID'] . "_permissions WHERE USERGROUPID = ?;"; sYDB()->Execute($sql, $usergroupId); } return true; } else { return false; } }
/** * 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 all Users without an assigned Usergroup * * @param string $order SQL-order-by-clause * @param string $sort SQL-sort-clause * @param string $limit SQL-limit-clause * @param string $searchText (optional) Searchtext * @return array|bool Array of Users or FALSE in case of an error */ function getWithoutUsergroup($order = '', $sort = 'ASC', $limit = '', $searchText = NULL) { if (sUsergroups()->permissions->check($this->_uid, 'RUSERS')) { $anonGroupId = (int) sConfig()->getVar("CONFIG/SYSTEMUSERS/ANONGROUPID"); $order = sYDB()->escape_string(sanitize($order)); $sort = sYDB()->escape_string(sanitize($sort)); $limit = sYDB()->escape_string(sanitize($limit)); $sqlargs = array(); array_push($sqlargs, $anonGroupId); $searchSQL = ''; if (strlen($searchText)) { $searchText = "%" . sYDB()->escape_string(sanitize($searchText)) . "%"; $searchSQL = "AND (\n\t\t\t\t\t\t\t\t(yg_user_propsv.LASTNAME LIKE ?) OR\n\t\t\t\t\t\t\t\t(yg_user_propsv.FIRSTNAME LIKE ?) OR\n\t\t\t\t\t\t\t\t(yg_user_propsv.EMAIL LIKE ?) OR\n\t\t\t\t\t\t\t\t(yg_user_propsv.COMPANY LIKE ?) OR\n\t\t\t\t\t\t\t\t(yg_user_propsv.DEPARTMENT LIKE ?) OR\n\t\t\t\t\t\t\t\t(yg_user_propsv.FAX LIKE ?) OR\n\t\t\t\t\t\t\t\t(yg_user_propsv.PHONE LIKE ?)\n\t\t\t\t\t\t\t)"; array_push($sqlargs, $searchText, $searchText, $searchText, $searchText, $searchText, $searchText, $searchText); } if (strlen($order) < 1) { $ordersql = "LASTNAME"; } if (strlen($order) > 0) { $ordersql = $order; } if ($order == "FIRSTNAME") { $ordersql = "NAME ASC, EMAIL ASC"; } if ($sort == "ASC") { $sortsql = "ASC"; } else { $sortsql = "DESC"; } if ($limit) { $limitarr = explode(",", $limit); $limitsql = "LIMIT " . (int) $limitarr[0] . "," . (int) $limitarr[1]; } $sql = "SELECT\n\t\t\t\t\t\tu.LOGIN AS LOGIN,\n\t\t\t\t\t\tu.PASSWORD AS PASSWORD,\n\t\t\t\t\t\tu.ID AS ID,\n\t\t\t\t\t\tu.ID AS UID,\n\t\t\t\t\t\tyg_user_propsv.LASTNAME AS LASTNAME,\n\t\t\t\t\t\tyg_user_propsv.FIRSTNAME AS FIRSTNAME,\n\t\t\t\t\t\tyg_user_propsv.EMAIL AS EMAIL,\n\t\t\t\t\t\tyg_user_propsv.COMPANY AS COMPANY,\n\t\t\t\t\t\tyg_user_propsv.DEPARTMENT AS DEPARTMENT,\n\t\t\t\t\t\tyg_user_propsv.FAX AS FAX,\n\t\t\t\t\t\tyg_user_propsv.PHONE AS PHONE,\n\t\t\t\t\t\tcount(lnk.UID) AS GROUPCOUNT,\n\t\t\t\t\t\tlnk2.USERGROUPID\n\t\t\t\t\tFROM\n\t\t\t\t\t\tyg_user as u\n\t\t\t\t\tLEFT JOIN\n\t\t\t\t\t\tyg_user_lnk_usergroups as lnk ON u.ID = lnk.UID\n\t\t\t\t\tLEFT JOIN\n\t\t\t\t\t\tyg_user_lnk_usergroups as lnk2 ON (u.ID = lnk2.UID) AND ((lnk2.USERGROUPID = ?) OR (lnk2.USERGROUPID = NULL))\n\t\t\t\t\tLEFT JOIN\n\t\t\t\t\t\tyg_user_propsv ON u.ID = yg_user_propsv.OID\n\t\t\t\t\tWHERE\n\t\t\t\t\t\t1 {$searchSQL}\n\t\t\t\t\tGROUP BY\n\t\t\t\t\t\tu.ID\n\t\t\t\t\tHAVING\n\t\t\t\t\t\t(GROUPCOUNT = 1 AND lnk2.USERGROUPID = ?) OR\n\t\t\t\t\t\t(GROUPCOUNT = 0)\n\t\t\t\t\tORDER BY `{$ordersql}` {$sortsql} {$limitsql};"; array_push($sqlargs, $anonGroupId); array_unshift($sqlargs, $sql); $dbr = call_user_func_array(array(sYDB(), 'Execute'), $sqlargs); if ($dbr === false) { throw new Exception(sYDB()->ErrorMsg()); } $resultarray = $dbr->GetArray(); return $resultarray; } else { return false; } }
/** * Calculates a unique permanent name for the specified Site * * @param int $id Site Id * @param string $iteration (optional) Iteration * @param string $name (optional) Name to calculate the PName from * @return string Permanent name */ function calcPName($id, $iteration = "", $name = '') { $siteID = (int) $id; $siteInfo = $this->get($siteID); $siteName = $siteInfo['NAME']; if ($name) { $siteName = $name; } if ((int) sConfig()->getVar("CONFIG/CASE_SENSITIVE_URLS") == 0) { $siteName = strtolower($siteName); } $PName = $this->filterPName($siteName); if ($iteration != '') { $checkPinfo = $this->getByPName($PName . '_' . $iteration); } else { $checkPinfo = $this->getByPName($PName); } if ($checkPinfo['ID'] == $siteID) { 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($siteID, ++$iteration); } } }
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)) { $classname = $namespace . "\\" . $classname; } $moduleclass = new $classname(); $filepath = $filedir . $fileinfo['OBJECTID'] . '-' . $fileinfo['VIEWVERSION'] . $filename; // copy file $tmpdir = sConfig()->getVar("CONFIG/PATH/TMP"); if (!$tmpdir) { $tmpdir = sys_get_temp_dir(); } $filetmpname = tempnam($tmpdir, "crop"); copy($filepath, $filetmpname); // crop file $moduleclass->cropFile($filetmpname, $x1, $y1, $x2 - $x1, $y2 - $y1); for ($i = 0; $i < count($views); $i++) { if ($views[$i]["IDENTIFIER"] == $view) { $viewinfo = $views[$i]; } } if ($view == "YGSOURCE") { // new version $version = $file->updateFile($fileinfo["FILENAME"], $fileinfo["FILETYPE"], $filetmpname, false);
/** * 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; }
/** * 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; }
} $koala->callJSFunction('Koala.windows[\'wid_' . $parentwindow . '\'].refreshSiteTemplate', $templateInfo['NAME'], $templateInfo['FILENAME'], $template, $templatePreview); } break; case 'saveSiteInfo': $wid = $this->params['wid']; $objectID = $this->params['objectID']; $name = $this->params['site_name']; $pname = $this->params['site_pname']; $pname = $siteMgr->filterPName($pname); $favicon = $this->params['site_favicon']; $defaulttemplate = $this->params['site_defaulttemplate']; $templateroot = $this->params['site_templateroot']; // Check if PNAME is already used or in blacklist $siteList = $siteMgr->getList(); $siteBlackList = explode(',', (string) sConfig()->getVar("CONFIG/RESERVED_SITENAMES")); $isError = false; $errorType = null; foreach ($siteList as $siteListItem) { if ($pname != '' && $siteListItem['PNAME'] == $pname && $objectID != $siteListItem['ID']) { $isError = true; $errorType = 1; $koala->queueScript("if (\$('" . $wid . "_site_pname')) \$('" . $wid . "_site_pname').addClassName('error');"); } } foreach ($siteBlackList as $siteBlackListItem) { if ($pname != '' && strtolower($siteBlackListItem) == strtolower($pname)) { $isError = true; $errorType = 2; $koala->queueScript("if (\$('" . $wid . "_site_pname')) \$('" . $wid . "_site_pname').addClassName('error');"); }
} // Load code specific to ajaxaction mapped in configfile $this->rawdata = $data[1]; $this->elements = $elements; $this->handler = $this->request->parameters['handler']; $action = $this->handler; // Check if user is authenticated and allowed to access the backend $tmpUser = new User(Singleton::UserMgr()->getCurrentUserID()); $backendAllowed = $tmpUser->checkPermission('RBACKEND'); if ((!$this->authenticated || !$backendAllowed) && ($action != 'userLogin' && $action != 'recoverLogin' && $action != 'setNewPassword')) { $header = $_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden'; header($header); echo $header; die; } $this->code = sConfig()->getVar('CONFIG/AJAXACTIONS/' . strtoupper($this->handler) . '/CODE'); $this->event = $data[0]; $indexname = $this->rawdata['yg_property'] ? $this->rawdata['yg_property'] : null; $this->responsedata = array(); $this->reponsedata[$indexname]->id = $this->rawdata['id']; if ($this->rawdata['name']) { $this->reponsedata[$indexname]->name = $this->rawdata['name']; } $this->reponsedata[$indexname]->value = strlen($this->rawdata['value']) || is_array($this->rawdata['value']) ? $this->rawdata['value'] : null; $this->reponsedata[$indexname]->type = $this->rawdata['yg_type'] ? $this->rawdata['yg_type'] : null; $this->reponsedata[$indexname]->property = $this->rawdata['yg_property'] ? $this->rawdata['yg_property'] : null; $this->reponsedata[$indexname]->yg_id = $this->rawdata['yg_id'] ? $this->rawdata['yg_id'] : null; $this->reponsedata[$indexname]->wid = $this->rawdata['wid'] ? $this->rawdata['wid'] : null; if ($this->fields) { $this->reponsedata = array_merge($this->reponsedata, $this->fields); }
/** * Removes this User from a Usergroup * * @param int $usergroupId Usergroup Id */ function removeUsergroup($usergroupId) { $uid = (int) $this->id; if (sUsergroups()->permissions->check($this->_uid, 'RUSERS') || $uid == $this->_uid) { $usergroupId = (int) $usergroupId; if ($usergroupId > 0) { // admin user requires admin role, cannot be removed if (sUserMgr()->getAdministratorID() == $uid) { if ($usergroupId == (int) sConfig()->getVar("CONFIG/SYSTEMUSERS/ROOTGROUPID")) { return false; } } $sql = "DELETE FROM\n\t\t\t\t`yg_user_lnk_usergroups`\n\t\t\t\tWHERE\n\t\t\t\tUID = ? AND USERGROUPID = ?;"; sYDB()->Execute($sql, $uid, $usergroupId); } return true; } else { return false; } }
$metaDataXML = new SimpleXMLElement($metaData); // Check if all dependencies are installed/available $dependencyError = false; $versionInfo = new Updater(); $currVersion = $versionInfo->current_version; $dependencies = array(); foreach ($metaDataXML->dependencies->version as $dependencyItem) { $dependencyItemVersion = (int) implode('.', (string) $dependencyItem); if ($currVersion < $dependencyItemVersion) { $dependencies[] = (string) $dependencyItem; } } foreach ($dependencies as $dependency) { if (count(glob($updatePath . 'yeager_' . $dependency . '_r*.php')) == 0) { $dependencyError = true; $koala->queueScript('Koala.yg_updaterOnError(\'' . $installRevision['rev'] . '\', \'' . $itext['TXT_UPDATER_MISSING_DEPENDENCY'] . ': ' . 'yeager_' . $dependency . '_r*.php' . '\');'); } } if (!$dependencyError) { // Check if update ends with ".update" and rename if necessary if (substr($installRevision['url'], strrpos($installRevision['url'], '.')) == '.update') { $newName = substr(basename($installRevision['url']), 0, strrpos(basename($installRevision['url']), '.')) . '.php'; rename($updatesDirectory . basename($installRevision['url']), $updatesDirectory . $newName); } $localUrl = $this->docabsolut . sConfig()->getVar('CONFIG/DIRECTORIES/UPDATES') . basename($installRevision['url']); $koala->queueScript('Koala.yg_startUpdate(\'' . $localUrl . '\', \'' . $installRevision['rev'] . '\');'); } } } break; }
$realUsergroups = array(); foreach ($usergroups as $usergroup_idx => $usergroup) { if (sUsergroups()->usergroupPermissions->checkInternal(sUserMgr()->getCurrentUserID(), $usergroup['ID'], 'RREAD') || $userID == sUserMgr()->getCurrentUserID()) { $realUsergroups[] = $usergroup; } } $usergroups = $realUsergroups; $rroles = true; $smarty->assign("rroles", $rroles); } $smarty->assign("empty_item", $empty_item); $smarty->assign("usergroups", $usergroups); } else { $usergroups = sUsergroups()->getList(); $rootGroupId = (int) sConfig()->getVar("CONFIG/SYSTEMUSERS/ROOTGROUPID"); $anonGroupId = (int) sConfig()->getVar("CONFIG/SYSTEMUSERS/ANONGROUPID"); foreach ($usergroups as $usergroup_idx => $usergroup) { $usergroups[$usergroup_idx]['RDELETE'] = sUsergroups()->usergroupPermissions->checkInternal(sUserMgr()->getCurrentUserID(), $usergroup['ID'], 'RDELETE'); } $realUsergroups = array(); foreach ($usergroups as $usergroup_idx => $usergroup) { if (sUsergroups()->usergroupPermissions->checkInternal(sUserMgr()->getCurrentUserID(), $usergroup['ID'], 'RREAD')) { $realUsergroups[] = $usergroup; } } $usergroups = $realUsergroups; } if ($objecttype == 'mailing') { // Check if a send is in progress (and lock if true) $mailingStatus = $mailing->getStatus(); if ($mailingStatus['STATUS'] == 'INPROGRESS') {
/** * Gets a list of Mailings * * @param int $mailingId (optional) Id of the parent Mailing from which the list will be created * @param array $filter (optional, may be combined) If SUBNODES, only subnodes of the specified Mailing will be returned<br> * if TRASHCAN, only items in the Trash will be returned<br> * if PUBLISHED, the working copy will be returned * @param int $maxLevel (optional) Specifies the maximum level of nodes to get * @param int $permissionsForRoleId (optional) If '1' then return all Usergroups and Permissions for this Usergroup * @param array $filterArray Array of filters for the SQL query * @return array|false Array of Mailings or FALSE in case of an error */ function getList($mailingId = 0, $filter = array(), $maxLevel = 0, $permissionsForRoleId = 0, $filterArray) { $mailingId = (int) $mailingId; $maxLevel = (int) $maxLevel; $permissionsForRoleId = (int) $permissionsForRoleId; $rootGroupId = (int) sConfig()->getVar("CONFIG/SYSTEMUSERS/ROOTGROUPID"); if ($mailingId == 0) { $mailingId = $this->tree->getRoot(); } if ($maxLevel > 0) { $maxLevelsql = " AND (group2.LEVEL <= {$maxLevel}) AND (group1.LEVEL <= {$maxLevel})"; } if (in_array("SUBNODES", $filter)) { $myinfo = $this->tree->getAll($mailingId); $myleft = $myinfo["LFT"]; $myrgt = $myinfo["RGT"]; $subnodesql = " AND (group1.LFT > {$myleft} AND group1.RGT < {$myrgt})"; if (!$myinfo) { return false; } } // surpress items in trashcan if not explicitly asked for if (in_array("TRASHCAN", $filter)) { $filtersql_where = " AND prop.DELETED = 1"; } else { $filtersql_where = " AND prop.DELETED = 0"; } $filterOrder = 'ORDER BY prop.CHANGEDTS DESC'; // Check if special filter was suppplied if ($filterArray) { $filterSelect = $filterFrom = $filterWhere = $filterLimit = $filterOrder = ''; buildBackendFilter('MailingsSearchCB', $filterArray, $filterSelect, $filterFrom, $filterWhere, $filterLimit, $filterOrder); $filtersql_where .= $filterWhere; } // AND (prop.ACTIVE = 1) - 20070313 if (in_array("PUBLISHED", $filter)) { $filtersql_where .= "\n\t\t\t\tAND (\n\t\t\t\t\t\t(group2.VERSIONPUBLISHED = prop.VERSION)\n\t\t\t\t\tOR\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\t(group2.VERSIONPUBLISHED = " . ALWAYS_LATEST_APPROVED_VERSION . ") AND\n\t\t\t\t\t\t\t(prop.VERSION = (SELECT MAX( rgt.VERSION ) FROM yg_mailing_properties AS rgt WHERE (prop.OBJECTID = rgt.OBJECTID) AND (rgt.APPROVED = 1)))\n\t\t\t\t\t\t)\n\t\t\t\t\t) "; } else { $filtersql_where .= " AND (prop.VERSION = (SELECT MAX( rgt.VERSION ) FROM yg_mailing_properties AS rgt WHERE (prop.OBJECTID = rgt.OBJECTID))) "; $lastfinal = ", (SELECT MAX(VERSION) FROM yg_mailing_properties AS p2 WHERE p2.APPROVED = 1 AND p2.OBJECTID = prop.OBJECTID ) AS LASTAPPROVED "; } $perm_sql_select = ", MAX(perm.RREAD) AS RREAD, MAX(perm.RWRITE) AS RWRITE, MAX(perm.RDELETE) AS RDELETE, MAX(perm.RSUB) AS RSUB, MAX(perm.RSTAGE) AS RSTAGE, MAX(perm.RMODERATE) AS RMODERATE, MAX(perm.RCOMMENT) AS RCOMMENT, MAX(perm.RSEND) AS RSEND"; $perm_sql_from = " LEFT JOIN yg_mailing_status AS stat ON stat.OID = group2.ID"; $perm_sql_from .= " LEFT JOIN yg_mailing_permissions AS perm ON perm.OID = group2.ID"; if ($permissionsForRoleId > 0) { $perm_sql_from .= " AND (perm.USERGROUPID = " . $permissionsForRoleId . ")"; } else { $perm_sql_where = " AND ("; $roles = $this->permissions->getUsergroups(); for ($r = 0; $r < count($roles); $r++) { $perm_sql_where .= "(perm.USERGROUPID = " . $roles[$r]["ID"] . ") "; if (count($roles) - $r > 1) { $perm_sql_where .= " OR "; } } $perm_sql_where .= ") "; $perm_sql_where .= " AND ((RREAD >= 1) OR (perm.USERGROUPID = {$rootGroupId})) "; } $sql = "SELECT\n\t\t\t\t\tgroup2.LFT,\n\t\t\t\t\tgroup2.RGT,\n\t\t\t\t\tgroup2.VERSIONPUBLISHED AS VERSIONPUBLISHED,\n\t\t\t\t\tgroup2.ID,\n\t\t\t\t\tgroup2.LEVEL AS LEVEL,\n\t\t\t\t\tgroup2.PARENT AS PARENT,\n\t\t\t\t\tgroup2.PNAME AS PNAME,\n\t\t\t\t\tMAX(prop.VERSION) AS VERSION,\n\t\t\t\t\tprop.ACTIVE AS ACTIVE,\n\t\t\t\t\tprop.HIDDEN AS HIDDEN,\n\t\t\t\t\tprop.LOCKED AS LOCKED,\n\t\t\t\t\tprop.HASCHANGED AS HASCHANGED,\n\t\t\t\t\tprop.TEMPLATEID AS TEMPLATEID,\n\t\t\t\t\tprop.CREATEDTS,\n\t\t\t\t\tprop.CHANGEDTS,\n\t\t\t\t\tprop.CREATEDBY,\n\t\t\t\t\tprop.CHANGEDBY,\n\t\t\t\t\tpv.*\n\t\t\t\t\t{$perm_sql_select}\n\t\t\t\t\t{$lastfinal}\n\t\t\t\tFROM\n\t\t\t\t\t({$this->table} AS group1, {$this->table} AS group2, yg_mailing_properties AS prop)\n\t\t\t\t\t{$perm_sql_from}\n\t\t\t\tLEFT JOIN yg_mailing_propsv AS pv\n\t\t\t\t\tON pv.OID = prop.ID\n\t\t\t\tWHERE\n\t\t\t\t\t((group2.LFT >= group1.LFT) AND (group2.LFT <= group1.RGT)) AND\n\t\t\t\t\t(group2.ID = prop.OBJECTID) {$subnodesql} {$filtersql_where}\n\t\t\t\t\t{$perm_sql_where}\n\t\t\t\t\t{$maxLevelsql}\n\t\t\t\tGROUP BY\n\t\t\t\t\tgroup2.LFT, group2.RGT, group2.VERSIONPUBLISHED, group2.ID\n\t\t\t\t{$filterOrder} {$filterLimit};"; $blaetter = $this->cacheExecuteGetArray($sql); return $blaetter; }
$objects[$objectIndex]['STYLE'] = $iconData['style']; $objects[$objectIndex]['SITEID'] = $siteID; } } sUserMgr()->unimpersonate(); break; case 'cblocks': sUserMgr()->impersonate(sUserMgr()->getAdministratorID()); $cb = sCblockMgr()->getCblock($obj_id); if ($cb) { $base = $cb->get(); $maxlevels = $base['LEVEL'] + 2; $objects = sCblockMgr()->getList($obj_id, array('SUBNODES'), $maxlevels, $roleid); $objects = sCblockMgr()->getAdditionalTreeInfo(false, $objects); // Check if the folder for blind contentblocks already exists and create it if it doesn't exist $embeddedCblockFolder = (int) sConfig()->getVar("CONFIG/EMBEDDED_CBLOCKFOLDER"); $smarty->assign("embeddedCblockFolder", $embeddedCblockFolder); } sUserMgr()->unimpersonate(); break; case 'files': sUserMgr()->impersonate(sUserMgr()->getAdministratorID()); $filetypeMgr = new Filetypes(); $objects = sFileMgr()->getList($obj_id, array('SUBNODES'), 'group2.LFT', $maxlevels, $roleid); $objects = sFileMgr()->getAdditionalTreeInfo(false, $objects); $filetypes = $filetypeMgr->getList(); foreach ($objects as $objects_idx => $objects_item) { foreach ($filetypes as $filetypes_item) { if ($objects_item['FILETYPE'] == $filetypes_item['OBJECTID']) { $objects[$objects_idx]['TYPEINFO'] = $filetypes_item; }
/** * Checks if the current instance of this Object is locked * * @return bool TRUE if the Object currently has a lock or FALSE if not */ public function getLock() { $objectid = (int) $this->_id; $lockts = time() - (int) sConfig()->getVar("/CONFIG/OBJECTLOCK_TIMEOUT"); $sql = "SELECT LOCKED, TOKEN, LOCKUID FROM " . $this->_table . " WHERE OBJECTID = ? AND LOCKED >= ?;"; $dbr = sYDB()->Execute($sql, $objectid, $lockts); if ($dbr === false) { throw new Exception(sYDB()->ErrorMsg() . ":: " . $sql); return false; } $ra = $dbr->GetArray(); return $ra[0]; }
/** * 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); } } }
/** * Gets a list of Tags * * @param int $tagId (optional) Id of the parent Tag from which the list will be created * @param array $filter (optional) If SUBNODES, only subnodes of the specified Tag will be returned * @param bool $usergroups (optional) If TRUE then also returns all Usergroups and Permissions for this node * @param int $maxLevel (optional) Specifies the maximum level of nodes to get * @param int $usergroupId (optional) If specified, only returns the list for the specific Usergroup Id * @return array|false Array of Tags or FALSE in case of an error */ function getList($tagId = 0, $filter = array(), $usergroups = true, $maxLevel = 0, $usergroupId = 0) { $tagId = (int) $tagId; $maxLevel = (int) $maxLevel; $usergroupId = (int) $usergroupId; $selectdefault = true; $rootGroupId = (int) sConfig()->getVar("CONFIG/SYSTEMUSERS/ROOTGROUPID"); if ($tagId < 1) { $selectdefault = true; $tagId = $this->tree->getRoot(); } if (in_array("SUBNODES", $filter)) { $myinfo = $this->tree->getAll($tagId); $myleft = $myinfo["LFT"]; $myrgt = $myinfo["RGT"]; $subnodesql = " AND (group2.LFT > {$myleft} AND group2.RGT < {$myrgt}) "; if (!$myinfo) { return false; } } if ($maxLevel > 0) { $maxLevelSQL = " AND (group2.LEVEL <= {$maxLevel}) AND (group1.LEVEL <= {$maxLevel})"; } if ($usergroups == true) { $perm_sql_select = ", MAX(perm.RREAD) AS RREAD, MAX(perm.RWRITE) AS RWRITE, MAX(perm.RDELETE) AS RDELETE, MAX(perm.RSUB) AS RSUB, MAX(perm.RSTAGE) AS RSTAGE"; $perm_sql_from = " LEFT JOIN yg_tags_permissions AS perm ON perm.OID = group2.ID"; if ($usergroupId > 0) { $perm_sql_from .= " AND (perm.USERGROUPID = " . $usergroupId . ")"; } else { $perm_sql_where = " AND ("; $usergroups = $this->permissions->getUsergroups(); for ($r = 0; $r < count($usergroups); $r++) { $perm_sql_where .= "(perm.USERGROUPID = " . (int) $usergroups[$r]["ID"] . ") "; if (count($usergroups) - $r > 1) { $perm_sql_where .= " OR "; } } $perm_sql_where .= ") "; $perm_sql_where .= " AND ((RREAD >= 1) OR (perm.USERGROUPID = " . $rootGroupId . ")) "; } } $sql = "SELECT\n\t\t\t\t\tgroup2.LFT,\n\t\t\t\t\tgroup2.RGT,\n\t\t\t\t\tgroup2.VERSIONPUBLISHED,\n\t\t\t\t\tgroup2.ID,\n\t\t\t\t\tgroup2.LEVEL AS LEVEL,\n\t\t\t\t\tgroup2.PARENT AS PARENT,\n\t\t\t\t\tprop.NAME AS NAME\n\t\t\t\t\t{$perm_sql_select}\n\t\t\t\tFROM\n\t\t\t\t\t({$this->table} AS group1, {$this->table} AS group2, yg_tags_properties AS prop)\n\t\t\t\t\t{$perm_sql_from}\n\t\t\t\tWHERE\n\t\t\t\t\t(group2.LFT BETWEEN group1.LFT AND group1.RGT) AND\n\t\t\t\t\t(group2.ID = prop.OBJECTID)\n\t\t\t\t\t{$subnodesql}\n\t\t\t\t\t{$perm_sql_where}\n\t\t\t\t\t{$maxLevelSQL}\n\t\t\t\tGROUP BY\n\t\t\t\t\tgroup2.LFT, group2.RGT, group2.VERSIONPUBLISHED, group2.ID\n\t\t\t\tORDER BY group2.LFT;"; $blaetter = $this->cacheExecuteGetArray($sql); $shadowmenue = array(); $parents = array(); for ($i = 0; $i < count($blaetter); $i++) { $currentid = $blaetter[$i]["ID"]; $mylevel = $blaetter[$i]["LEVEL"]; $myparent = $blaetter[$i]["PARENT"]; $myparentparent = $shadowmenue[$myparent]["PARENT"]; if ($selectdefault == true && $mylevel > 1) { $tagId = $currentid; $selectdefault = false; } $shadowmenue[$currentid]["LEVEL"] = $mylevel; $shadowmenue[$currentid]["PARENT"] = $myparent; if ($lastlevel + 1 == $mylevel) { $parents[$mylevel] = $lastid; } if ($currentid == $tagId) { $blaetter[$i]["SELECTED"] = 1; $blaetter[$i]["SHOW"] = 1; $blaetter[$i]["SUBOPEN"] = 1; $shadowmenue[$currentid]["SHOW"] = 1; $shadowmenue[$currentid]["SUBOPEN"] = 1; $shadowmenue[$currentid]["SELECTED"] = 1; $shadowmenue[$myparent]["SHOW"] = 1; $shadowmenue[$myparent]["SUBOPEN"] = 1; } if ($shadowmenue[$myparent]["SUBOPEN"] == 1) { $blaetter[$i]["SHOW"] = 1; $shadowmenue[$myparent]["SHOW"] = 1; } if ($blaetter[$i]["SHOW"] == 1) { $shadowmenue[$myparent]["SHOW"] = 1; $shadowmenue[$myparent]["SUBOPEN"] = 1; $shadowmenue[$myparentparent]["SHOW"] = 1; $shadowmenue[$myparentparent]["SUBOPEN"] = 1; } $lastlevel = $mylevel; $lastid = $currentid; } for ($i = 0; $i < count($blaetter); $i++) { $currentid = $blaetter[$i]["ID"]; $myparent = $blaetter[$i]["PARENT"]; $myparentparent = $shadowmenue[$myparent]["PARENT"]; $preid = $blaetter[$i - 1]["ID"]; $postid = $blaetter[$i + 1]["ID"]; $blaetter[$i]["SUBOPEN"] = $shadowmenue[$currentid]["SUBOPEN"]; $blaetter[$i]["SHOW"] = $shadowmenue[$currentid]["SHOW"]; if ($shadowmenue[$preid]["LEVEL"] < $blaetter[$i]["LEVEL"]) { $blaetter[$i]["FIRST"] = 1; } if ($shadowmenue[$postid]["LEVEL"] < $blaetter[$i]["LEVEL"]) { $blaetter[$i]["LAST"] = 1; } if ($shadowmenue[$postid]["LEVEL"] == "") { $blaetter[$i]["LAST"] = 1; } if ($blaetter[$i]["SHOW"] == 1) { $shadowmenue[$myparent]["SHOW"] = 1; $shadowmenue[$myparentparent]["SHOW"] = 1; $shadowmenue[$myparentparent]["SUBOPEN"] = 1; } if ($shadowmenue[$myparent]["SUBOPEN"] == 1) { $blaetter[$i]["SHOW"] = 1; } if ($shadowmenue[$postid]["LEVEL"] > $blaetter[$i]["LEVEL"]) { $blaetter[$i]["HASSUBNODES"] = 1; } else { $blaetter[$i]["HASSUBNODES"] = 0; } } return $blaetter; }
if ($navigation['DEFAULT'] == 1) { $hasdefault = true; $defaultnavi = $navigation['CODE']; } } if (!$hasdefault) { $navigations[0]['DEFAULT'] = 1; $defaultnavi = $navigations[0]['CODE']; } // Check for template preview $templatepreviewdir = getRealpath(sConfig()->getVar('CONFIG/DIRECTORIES/TEMPLATEPREVIEWDIR')) . '/'; $found_files = glob($templatepreviewdir . $template . '-*'); if ($found_files !== false && count($found_files) > 0) { $previewfile = explode('/', $found_files[0]); $previewfile = $previewfile[count($previewfile) - 1]; $previewdir = sConfig()->getVar('CONFIG/DIRECTORIES/TEMPLATEPREVIEWDIR'); } // Add template for Contentareas to Array $contentareas[] = array('CODE' => '__FIELDTITLE__', 'NAME' => '__FIELDNAME__'); // Add template for Navigations to Array $navigations[] = array('CODE' => '__FIELDTITLE__', 'NAME' => '__FIELDNAME__'); $templateInfo['PREVIEWPATH'] = $previewdir . $previewfile; $templateInfo['PREVIEW'] = $previewfile; $smarty->assign('templateInfo', $templateInfo); $smarty->assign('timestamp', time()); $smarty->assign("object", $template); $smarty->assign("objecttype", "template"); $smarty->assign("objectparents", $objectparents); $smarty->assign("contentareas", $contentareas); $smarty->assign("rfilecontentareas", $rfilecontentareas); $smarty->assign("afilecontentareas", $afilecontentareas);
/** * 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; } }