// Add to history $cb->history->add(HISTORYTYPE_CO, NULL, NULL, "TXT_TAG_H_TAGORDER", NULL); break; case 'file': // For Files // For Files case 'filefolder': $file = sFileMgr()->getFile($objectid); $fileinfo = $file->get(); for ($i = 0; $i < count($taglist); $i++) { $file->tags->setOrder($taglist[$i], $i); } // Add to history $file->history->add(HISTORYTYPE_FILE, NULL, NULL, "TXT_TAG_H_TAGORDER", NULL); break; case 'page': // For Pages $pageMgr = new PageMgr($siteID); $page = $pageMgr->getPage($objectid); $pageInfo = $page->get(); $jsQueue = new JSQueue(NULL, $siteID); for ($i = 0; $i < count($taglist); $i++) { $page->tags->setOrder($taglist[$i], $i); } // Add to history $page->history->add(HISTORYTYPE_PAGE, NULL, NULL, "TXT_TAG_H_TAGORDER", NULL); $jsQueue->add($objectid, HISTORYTYPE_PAGE, 'HIGHLIGHT_PAGE', sGuiUS(), 'name'); break; } break; }
\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) { $mailingMgr->setTemplateRoot(0);
$js_array = '[ '; foreach ($contentareas as $contentarea_item) { if ($contentarea_item['ID'] == $contentarea_id) { foreach ($colist as $contentarea_list_item) { $dta_cnt++; $js_array .= "[ '" . $contentarea_list_item['OBJECTID'] . "', '" . $contentarea_item['CODE'] . "', '" . $contentarea_item['ID'] . "', '" . $contentarea_list_item['LINKID'] . "' ], "; } } } $js_array = substr($js_array, 0, strlen($js_array) - 2); $js_array .= ' ]'; if ($js_array == ' ]') { $js_array = '[]'; } $koala->queueScript("Koala.windows['wid_" . $parentwindow . "'].getContentareaDataFuncs( " . $js_array . ", true );"); $myQueue->add($pageID, $historyType, 'HIGHLIGHT_' . $historyStr, sGuiUS(), 'name'); } } } else { if ($contentblockID > 0) { // Check if already there // START GET CONTENTAREADATA $myObjectInfo = $myObject->get(); $contentareas = $templateMgr->getContentareas($myObjectInfo['TEMPLATEID']); if (is_numeric($contentarea)) { foreach ($contentareas as $contentarea_item) { if ($contentarea_item['ID'] == $contentarea) { $contentarea = $contentarea_item['CODE']; } } }
case 2: $koala->alert($itext['TXT_PNAME_BLACKLISTED']); break; } // Reset PName to old PName /* $oldPname = $siteMgr->getPName($objectID); $jsQueue->add ($objectID, HISTORYTYPE_SITE, 'OBJECT_CHANGE', sGuiUS(), 'site', NULL, NULL, $objectID.'-site', 'pname', $oldPname); */ } else { $siteMgr->setName($objectID, $name); $siteMgr->setPName($objectID, $pname); $siteMgr->setFavicon($objectID, $favicon); $siteMgr->setDefaultTemplate($objectID, $defaulttemplate); $siteMgr->setTemplateRoot($objectID, $templateroot); $jsQueue->add($objectID, HISTORYTYPE_SITE, 'OBJECT_CHANGE', sGuiUS(), 'site', NULL, NULL, $objectID . '-site', 'name', $name); $jsQueue->add($objectID, HISTORYTYPE_SITE, 'OBJECT_CHANGE', sGuiUS(), 'page', NULL, NULL, $objectID . '-site', 'name', $name); $jsQueue->add($objectID, HISTORYTYPE_SITE, 'OBJECT_CHANGE', sGuiUS(), 'site', NULL, NULL, $objectID . '-site', 'pname', $pname); // Re-sort the list $koala->queueScript('if (Koala.windows[Koala.windows[\'' . $wid . '\'].boundWindow].sortList) Koala.windows[Koala.windows[\'' . $wid . '\'].boundWindow].sortList();'); $jsQueue->add($objectID, HISTORYTYPE_SITE, 'REFRESH_WINDOW', sGuiUS(), 'name'); // Fade all green fields $koala->queueScript("Koala.yg_fadeFields(\$('" . $wid . "'), 'input.changed');"); $jsQueue->add($objectID, HISTORYTYPE_SITE, 'UNHIGHLIGHT_SITE', sGuiUS(), 'name'); } break; case 'siteSelectNode': $node = $this->params['node']; $wid = $this->params['wid']; $koala->callJSFunction('Koala.yg_enable', 'tree_btn_delete', 'btn-' . $wid, 'tree_btn'); break;
$sourcePage = $SourcePageMgr->getPage($source); $icons = new Icons(); if ($oldPageInfo['ACTIVE']) { $pageicon = $icons->icon['page_small']; if ($oldPageInfo['HIDDEN']) { $pageicon = $icons->icon['page_hidden_small']; } } else { $pageicon = $icons->icon['page_inactive_small']; if ($oldPageInfo['HIDDEN']) { $pageicon = $icons->icon['page_inactive_hidden_small']; } } $jsQueue = new JSQueue(NULL, $sourcesite); if ($before) { $jsQueue->add($source, HISTORYTYPE_PAGE, 'PAGE_MOVE', sGuiUS(), $target . '-' . $targetsite, 1); } else { $jsQueue->add($source, HISTORYTYPE_PAGE, 'PAGE_MOVE', sGuiUS(), $target . '-' . $targetsite); } } break; case 'pageSelectNode': $node = $this->params['node']; $siteID = $this->params['siteID']; $wid = $this->params['wid']; if ($node == 'trash') { break; } // Pages $pageMgr = new PageMgr($siteID); $root_node = $pageMgr->getTree(NULL, 0);
$user->properties->setValue('TIMEZONE', 'Europe/Berlin'); $user->properties->setValue('DATEFORMAT', 'dd.mm.YYYY'); $user->properties->setValue('TIMEFORMAT', '24'); $user->properties->setValue('WEEKSTART', '1'); $koala->callJSFunction('Koala.yg_addUserItem', $wid, $newUserId, $itext['TXT_UNKNOWN'] ? $itext['TXT_UNKNOWN'] : '$TXT_UNKNOWN'); $koala->queueScript('$(\'' . $wid . '_objcnt\').update( parseInt($(\'' . $wid . '_objcnt\').innerHTML, 10) +1 );'); break; case 'delUser': $userID = $this->params['userID']; $wid = $this->params['winID']; $wid = explode('_', $wid); $wid = $wid[1]; if (is_array($userID)) { foreach ($userID as $userID_Item) { sUserMgr()->remove($userID_Item); $jsQueue->add($userID_Item, HISTORYTYPE_USER, 'OBJECT_DELETE', sGuiUS(), 'user', NULL, NULL, $userID_Item . '-user', 'usergroups'); } } else { sUserMgr()->remove($userID); $jsQueue->add($userID, HISTORYTYPE_USER, 'OBJECT_DELETE', sGuiUS(), 'user', NULL, NULL, $userID . '-user', 'usergroups'); } $koala->queueScript('Koala.yg_disable(\'tree_btn_delete\', \'btn-' . $wid . '\', \'tree_btn\');'); break; case 'addRole': $wid = $this->params['wid']; $newRoleId = sUsergroups()->add($itext['TXT_NEW_OBJECT']); // Add permissions for all views $views = $viewMgr->getList(); $hiddenviews = $viewMgr->getHiddenViews(); $permissionArray = array(array('USERGROUPID' => $newRoleId, 'RREAD' => 1, 'RWRITE' => 1, 'RDELETE' => 1, 'RSUB' => 1, 'RSTAGE' => 1, 'RMODERATE' => 1, 'RCOMMENT' => 1, 'RSEND' => 1)); foreach ($views as $view) {
foreach ($usersInRole as $usersInRoleItem) { array_push($userIds, $usersInRoleItem['UID']); } } $userIds = array_unique($userIds); $receipients = count($userIds); $usergroupList = ''; foreach ($usergroups as $usergroupsIdx => $usergroupsItem) { $usergroupList .= $usergroupsItem['NAME']; if ($usergroupsIdx + 1 != count($usergroups)) { $usergroupList .= ', '; } } $koala->queueScript('if ($(\'' . $wid . '_usergroups_' . $roleId . '\')) { $(\'' . $wid . '_usergroups_' . $roleId . '\').remove(); $K.windows[\'' . $wid . '\'].refresh(); }'); // Set status of page to changed $jsQueue->add($mailingId, HISTORYTYPE_MAILING, 'HIGHLIGHT_MAILING', sGuiUS(), 'name'); // Add to history $mailing->history->add(HISTORYTYPE_MAILING, NULL, $roleInfo['NAME'], "TXT_MAILING_H_GROUPREMOVE"); $jsQueue->add($mailingId, HISTORYTYPE_MAILING, 'OBJECT_CHANGE', sGuiUS(), 'mailing', NULL, NULL, $mailingId . '-mailing', 'yg_usergrouplist', $usergroupList); $jsQueue->add($mailingId, HISTORYTYPE_MAILING, 'OBJECT_CHANGE', sGuiUS(), 'mailing', NULL, NULL, $mailingId . '-mailing', 'receipients', $receipients); } else { // remove usergroup from user $userId = $this->params['userId']; $roleId = $this->params['roleId']; $wid = $this->params['wid']; $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':
<?php $jsQueue = new JSQueue(NULL); $reftracker = new Reftracker(); $viewMgr = new Views(); $filetypeMgr = new Filetypes(); switch ($action) { case 'getFileInfo': $fileID = $this->params['fileID']; $jsQueue->add($fileID, HISTORYTYPE_FILE, 'SET_FILEINFOS', sGuiUS(), NULL); break; case 'saveViews': $widprefix = $this->params['wid']; $view_ids = $this->params[$widprefix . '_view_ids[]']; $view_ids = explode(',', $view_ids); $view_del_ids = $this->params[$widprefix . '_view_del_ids[]']; $view_del_ids = explode(',', $view_del_ids); foreach ($view_del_ids as $view_del_id) { $viewMgr->remove($view_del_id); } $view_info = array(); foreach ($view_ids as $view_id) { $view_info_item['ID'] = $view_id; $view_info_item['NAME'] = $this->params[$widprefix . '_view_' . $view_id . '_name']; $view_info_item['IDENTIFIER'] = $this->params[$widprefix . '_view_' . $view_id . '_identifier']; $view_info_item['WIDTH'] = $this->params[$widprefix . '_view_' . $view_id . '_width']; $view_info_item['HEIGHT'] = $this->params[$widprefix . '_view_' . $view_id . '_height']; $view_info_item['CONSTRAINWIDTH'] = $this->params[$widprefix . '_view_' . $view_id . '_constrainwidth']; $view_info_item['CONSTRAINHEIGHT'] = $this->params[$widprefix . '_view_' . $view_id . '_constrainheight']; $view_info_item['WIDTHCROP'] = $this->params[$widprefix . '_view_' . $view_id . '_widthcrop']; $view_info_item['HEIGHTCROP'] = $this->params[$widprefix . '_view_' . $view_id . '_heightcrop'];
$js_array = '[ '; foreach ($used_extensions_ids as $extension_list_item) { $dta_cnt++; $js_array .= "[ '" . $pageID . "', '" . ($itext['TXT_EXTENSIONS'] != '' ? $itext['TXT_EXTENSIONS'] : '$TXT_EXTENSIONS') . "', '0', 'extension-" . $extension_list_item . "' ], "; } $js_array = substr($js_array, 0, strlen($js_array) - 2); $js_array .= ' ]'; if ($js_array == ' ]') { $js_array = '[]'; } if ($parentwindow != '') { $koala->queueScript("Koala.windows['wid_" . $parentwindow . "'].getContentareaDataFuncs( " . $js_array . ", true );"); } $koala->queueScript("if (\$('clone%%cblock__')) { \$('clone%%cblock__').remove(); }"); if ($historySuffix) { $jsQueue->add($pageID, $historyType, 'HIGHLIGHT_' . $historySuffix, sGuiUS(), 'name'); } } } } break; case 'setExtensionProperties': $extension_id = $this->params['extension']; $wid = $this->params['wid']; $propertiesData = $this->params['propertiesData']; $objectInfo = $extensionMgr->get($extension_id); if ($objectInfo["CODE"]) { $extension = $extensionMgr->getExtension($objectInfo["CODE"]); if ($extension) { switch ($objectInfo['TYPE']) { case EXTENSION_IMPORT:
$mailings = sMailingMgr()->getMailingsByTemplate($template); if (count($pages) > 0) { $stillInUse = true; } $tmpTemplateInfo = $templateMgr->getTemplate($template); if ($stillInUse) { // Still used! if ($confirmed != 'true') { $parameters = array('template' => $template); $koala->callJSFunction('Koala.yg_confirm', $itext['TXT_DELETE_USED_TEMPLATE_TITLE'] != '' ? $itext['TXT_DELETE_USED_TEMPLATE_TITLE'] : '$TXT_DELETE_USED_TEMPLATE_TITLE', $itext['TXT_DELETE_USED_TEMPLATE'] != '' ? $itext['TXT_DELETE_USED_TEMPLATE'] : '$TXT_DELETE_USED_TEMPLATE', $action, json_encode($parameters)); } else { if ($confirmed == 'true' && $positive == 'true') { $successfullyDeleted = $templateMgr->remove($template); if (in_array($template, $successfullyDeleted)) { if ($tmpTemplateInfo['FOLDER']) { $jsQueue->add($template, HISTORYTYPE_TEMPLATE, 'OBJECT_DELETE', sGuiUS(), 'templatefolder', NULL, NULL, $template . '-template', 'name'); } else { $jsQueue->add($template, HISTORYTYPE_TEMPLATE, 'OBJECT_DELETE', sGuiUS(), 'template', NULL, NULL, $template . '-template', 'name'); } } } } } else { // Not used, delete template $successfullyDeleted = $templateMgr->remove($template); if (in_array($template, $successfullyDeleted)) { if ($tmpTemplateInfo['FOLDER']) { $jsQueue->add($template, HISTORYTYPE_TEMPLATE, 'OBJECT_DELETE', sGuiUS(), 'templatefolder', NULL, NULL, $template . '-template', 'name'); } else { $jsQueue->add($template, HISTORYTYPE_TEMPLATE, 'OBJECT_DELETE', sGuiUS(), 'template', NULL, NULL, $template . '-template', 'name'); }
continue; } sUserMgr()->impersonate($jobs[$j]['USERID']); $classname = (string) $procs[$p]["classname"]; $namespace = (string) $procs[$p]["namespace"]; if (strlen($namespace)) { $classname = $namespace . "\\" . $classname; } $moduleclass = new $classname(); if ($fileMgr->scheduler->pickJob($jobs[$j]["ID"])) { if ($moduleclass->process($jobs[$j]["OBJECTID"], $jobs[$j]["PARAMETERS"])) { if (Singleton::cache_config()->getVar("CONFIG/INVALIDATEON/FILE_PROCESSVIEW") == "true") { Singleton::FC()->emptyBucket(); } if ($jobs[$j]['PARAMETERS']['VIEW']['ID'] && $jobs[$j]['PARAMETERS']['VIEW']['ID'] != "") { $jsQueue->add($jobs[$j]['PARAMETERS']['FILEINFO']['OBJECTID'], HISTORYTYPE_FILE, 'FILE_GENERATEDVIEW', sGuiUS(), $jobs[$j]['PARAMETERS']['VIEW']['ID'], $jobs[$j]['PARAMETERS']['VIEW']['IDENTIFIER']); } $fileMgr->scheduler->finishJob($jobs[$j]["ID"]); } else { $fileMgr->scheduler->finishJob($jobs[$j]["ID"], SCHEDULER_STATE_FAILED); } } } } } // Pages (for every site) sUserMgr()->impersonate((int) sConfig()->getVar("CONFIG/SYSTEMUSERS/ROOTUSERID")); $siteMgr = new Sites(); $allSites = $siteMgr->getList(); foreach ($allSites as $currSite) { $pageMgr = new PageMgr($currSite['ID']);
$page = $pageMgr->getPage($object); $objectInfo = $page->get(); $objectparents = $pageMgr->getParents($object); // Get old property value & check if change is needed $oldvalue = $page->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) == '') { $jsQueue->add($object, HISTORYTYPE_PAGE, 'OBJECT_CHANGE', sGuiUS(), 'page', NULL, NULL, $this->reponsedata[$property]->yg_id, $property, $oldvalue); $jsQueue->add($object, HISTORYTYPE_PAGE, 'REFRESH_WINDOW', sGuiUS(), 'name'); $koala->alert($itext['TXT_CANT_CHANGE_PAGETITLE_TO_EMPTY_VALUE']); break; } // Check if property is a readonly property $propertyInfo = $page->properties->getProperty(strtoupper($property)); $isReadOnlyProperty = $propertyInfo[0]['READONLY']; // Special handling for dates if ($propertyInfo[0]['TYPE'] == 'DATE' || $propertyInfo[0]['TYPE'] == 'DATETIME') { if ($propertyInfo[0]['TYPE'] == 'DATETIME') { $dateFrac = explode('||', $value); $timeFrac = $dateFrac[1]; $date = explode('.', $dateFrac[0]); $time = explode(':', $timeFrac); $hour = (int) $time[0];