Exemplo n.º 1
0
 /**
  * Add additional template variables to the template output.
  *
  *  You can assign additional output values in the template here, instead of
  *  having the PHP execute directly in the template.  The advantage is that
  *  you would easily be able to switch between template types (RawPHP/Smarty)
  *  without having to port code from one to the other.
  *
  *  You could use this area to provide "recent comments" data to the template,
  *  for instance.
  *
  *  Note that the variables added here should possibly *always* be added,
  *  especially 'user'.
  *
  *  Also, this function gets executed *after* regular data is assigned to the
  *  template.  So the values here, unless checked, will overwrite any existing
  *  values.
  */
 public function add_template_vars()
 {
     if (!$this->template_engine->assigned('pages')) {
         $this->assign('pages', Posts::get(array('content_type' => 'page', 'status' => Post::status('published'), 'nolimit' => 1)));
     }
     if (!$this->template_engine->assigned('user')) {
         $this->assign('user', User::identify());
     }
     if (!$this->template_engine->assigned('tags')) {
         $this->assign('tags', Tags::get());
     }
     if (!$this->template_engine->assigned('page')) {
         $this->assign('page', isset($page) ? $page : 1);
     }
     if (!$this->template_engine->assigned('feed_alternate')) {
         $matched_rule = URL::get_matched_rule();
         switch ($matched_rule->name) {
             case 'display_entry':
             case 'display_page':
                 $feed_alternate = URL::get('atom_entry', array('slug' => Controller::get_var('slug')));
                 break;
             case 'display_entries_by_tag':
                 $feed_alternate = URL::get('atom_feed_tag', array('tag' => Controller::get_var('tag')));
                 break;
             case 'display_home':
             default:
                 $feed_alternate = URL::get('atom_feed', array('index' => '1'));
         }
         $this->assign('feed_alternate', $feed_alternate);
     }
     // Specify pages you want in your navigation here
     $this->assign('nav_pages', Posts::get(array('content_type' => 'page', 'status' => 'published', 'nolimit' => 1)));
     parent::add_template_vars();
 }
Exemplo n.º 2
0
 public function add_template_vars()
 {
     //Theme Options
     $this->assign('header_text', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt.');
     if (!$this->template_engine->assigned('pages')) {
         $this->assign('pages', Posts::get(array('content_type' => 'page', 'status' => Post::status('published'), 'nolimit' => 1)));
     }
     if (!$this->template_engine->assigned('user')) {
         $this->assign('user', User::identify()->loggedin);
     }
     /*		if( !$this->template_engine->assigned( 'page' ) ) {
     			$this->assign('page', isset( $page ) ? $page : 1 );
     		}*/
     if (!$this->template_engine->assigned('all_tags')) {
         // List of all the tags
         $tags = Tags::get();
         $this->assign('all_tags', $tags);
     }
     //visiting page/2, /3 will offset to the next page of posts in the sidebar
     $page = Controller::get_var('page');
     $pagination = Options::get('pagination');
     if ($page == '') {
         $page = 1;
     }
     $this->assign('more_posts', Posts::get(array('status' => 'published', 'content_type' => 'entry', 'offset' => $pagination * $page, 'limit' => 5)));
     parent::add_template_vars();
     $this->add_template('formcontrol_text', dirname(__FILE__) . '/forms/formcontrol_text.php', true);
     $this->add_template('formcontrol_textarea', dirname(__FILE__) . '/forms/formcontrol_textarea.php', true);
 }
Exemplo n.º 3
0
 public function test_delete_tag()
 {
     $count = count(Tags::get());
     $t = $this->tag->insert();
     $this->assertEquals($count + 1, count(Tags::get()));
     $t->delete();
     $this->assertEquals($count, count(Tags::get()));
 }
 public function theme_magic_archives($theme)
 {
     $tags = Tags::get(array('nolimit' => true));
     $theme->tags = $tags;
     $theme->posts = self::get_posts();
     $theme->display('magicarchives');
     return $archives;
 }
Exemplo n.º 5
0
 /**
  * Return a single requested tag.
  *
  * <code>
  * $tag= Tag::get( array( 'tag_slug' => 'wooga' ) );
  * </code>
  *
  * @param array $paramarray An associated array of parameters, or a querystring
  * @return Tag The first tag that matched the given criteria
  **/
 static function get($paramarray = array())
 {
     // Defaults
     $defaults = array('where' => array(), 'fetch_fn' => 'get_row');
     foreach ($defaults['where'] as $index => $where) {
         $defaults['where'][$index] = array_merge(Controller::get_handler()->handler_vars, $where, Utils::get_params($paramarray));
     }
     // make sure we get at most one result
     $defaults['limit'] = 1;
     return Tags::get($defaults);
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->dataFieldByName('Title')->setTitle('City Hotel Name');
     $fields->dataFieldByName('Content')->setTitle('City Hotel Introduction');
     $fields->insertBefore(NumericField::create("NoOfRooms")->setTitle("Total Number of Rooms"), 'Content');
     $fields->insertBefore(TextField::create("AirportDistance")->setTitle("Distance from Airport"), 'Content');
     $fields->addFieldToTab('Root.Main', new DropdownField('AtollID', 'Atoll', Atolls::get()->map('ID', 'Name')), 'Content');
     $fields->addFieldToTab('Root.Main', new DropdownField('IslandID', 'Island', Islands::get()->map('ID', 'Name')), 'Content');
     $fields->addFieldToTab('Root.Main', new DropdownField('CategoryID', 'Category', Categories::get()->map('ID', 'Name')), 'Content');
     $fields->addFieldToTab('Root.Main', new DropdownField('TransferTypeID', 'TransferType', TransferTypes::get()->map('ID', 'Name')), 'Content');
     $fields->insertBefore(NumericField::create("Rating")->setTitle("Star Rating"), 'Content');
     $fields->insertBefore(CheckboxField::create("InSide")->setTitle("Show City Hotel in Slide Show"), 'Content');
     $fields->insertBefore(CheckboxField::create("Featured")->setTitle("Show City Hotel in Featured List"), 'Content');
     $fields->insertBefore(TextField::create("Cordinates")->setTitle("Map Cordinates, Longitute & Latitude, separated by comma"), 'Content');
     $imgfield = UploadField::create('FeaturedPhoto')->setTitle("Default Cover Photo");
     $imgfield->getValidator()->allowedExtensions = array('jpg', 'jpeg', 'gif', 'png');
     $fields->insertBefore($imgfield, 'Content');
     $defaultTag = $this->Tags()->column('ID');
     // print_r($defaultTag);
     $tagMap = Tags::get()->map('ID', 'Name')->toArray();
     $tagList = ListboxField::create('Tags', 'Tags')->setMultiple(true)->setSource($tagMap)->setDefaultItems($defaultTag);
     $fields->addFieldToTab('Root.Main', $tagList, 'Content');
     $defaultItem = $this->HolidayTypes()->column('ID');
     $Map = HolidayTypes::get()->map('ID', 'Name')->toArray();
     $List = ListboxField::create('HolidayTypes', 'Holiday Types')->setMultiple(true)->setSource($Map)->setDefaultItems($defaultItem);
     $fields->addFieldToTab('Root.Main', $List, 'Content');
     $fields->addFieldToTab('Root.CityHotelImages', $uploadField = new uploadField($name = "CityHotelImages", $title = "Upload one or more images (max 10 in total)"));
     $uploadField->setAllowedMaxFileNumber(10);
     $gridConfig = GridFieldConfig_RelationEditor::create();
     $GridField = new GridField('Rooms', 'Rooms', $this->Rooms(), $gridConfig);
     $fields->addFieldToTab("Root.Rooms", $GridField);
     $GridField = new GridField('Dining', 'Dining', $this->Dining(), $gridConfig);
     $fields->addFieldToTab("Root.Dining", $GridField);
     $GridField = new GridField('Facilities', 'Facilities', $this->Facilities(), $gridConfig);
     $fields->addFieldToTab("Root.Facilities", $GridField);
     $GridField = new GridField('Activities', 'Activities', $this->Activities(), $gridConfig);
     $fields->addFieldToTab("Root.Activities", $GridField);
     return $fields;
 }
Exemplo n.º 7
0
 /**
  * 编辑专题
  */
 public function action_edit()
 {
     $sid = (int) $this->getQuery('sid');
     $tag = new Tags();
     $select = DB::select('s.*', 'u.username')->from(array('specialpics', 's'))->join(array('users', 'u'), 'LEFT')->on('u.uid', '=', 's.uid')->where('sid', '=', $sid);
     $this->template->info = $select->execute()->current();
     $this->template->tags = $tags = $tag->get($sid, 'img_subject', $info['uid']);
     if ($this->isPost()) {
         $is_share = $this->getPost('is_share', 0);
         $title = trim($this->getPost('title'));
         $content = trim($this->getPost('content'));
         $uid = (int) $this->getPost('uid');
         $sid = $this->getPost('sid', 0);
         $tags = $this->getPost('tags');
         if (empty($title) || empty($content)) {
             $this->show_message('专题标题和内容不能为空...');
         }
         if ($sid > 0) {
             $set = array('title' => $title, 'content' => $content, 'is_share' => $is_share);
             DB::update('specialpics')->set($set)->where('sid', '=', $sid)->execute();
             $tags = explode(' ', $tags);
             $tag->set($sid, 'img_subject', $tags, $uid);
             $links[] = array('text' => '返回专题列表', 'href' => '/admin/picsubject/list');
             $this->show_message('编辑专题操作成功。', 1, $links);
         }
     }
 }
Exemplo n.º 8
0
     if ($data['transType'] == $type['id']) {
         $haserror = false;
         break;
     }
 }
 if ($haserror) {
     RestUtils::sendResponse('406', array('data' => 'transType', 'message' => 'O tipo de conta n&atilde;o existe.'));
 }
 //Connect
 $sql = new DataBase();
 $sql->connect();
 //Generate ID
 $transactionId = generateId();
 //Get all tags to compare
 $allTagsCompare = array();
 foreach ($tags->get() as $tag) {
     $tag = strtolower(clearUTF($tag['name']));
     array_push($allTagsCompare, $tag);
 }
 //Get all tags of transaction
 $transactionTags = explode(',', $data['tags']);
 $i = 0;
 foreach ($transactionTags as $tag) {
     if ($tag == "" || $tag == " " || $tag == "," || $tag == ", ") {
         unset($transactionTags[$i]);
     }
     $i++;
 }
 //Get all tags of USER of transaction compare
 $transactionTagsCompare = array();
 foreach ($transactionTags as $tag) {
Exemplo n.º 9
0
 /**
  * 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;
 }
Exemplo n.º 10
0
 /**
  * 查看相片
  */
 public function action_view()
 {
     $tag = new Tags();
     $this->template->pid = $pid = $this->request->param('id');
     $imgSelect = DB::select('i.id', 'i.cate_id', 'i.uploadtime', 'i.picname', 'i.userid', 'i.disk_id', 'i.picname', 'i.custom_name', array('i.disk_id', 'disk_domain'), 'i.click', 'i.comment_num', 'i.support', 'i.oppose', array('i.disk_name', 'img_dir'))->from(array('imgs', 'i'))->order_by('i.id', 'DESC');
     $imgInfo = $imgSelect->where('i.id', '=', (int) $pid)->fetch_row();
     $this->template->pageTitle = $imgInfo['custom_name'];
     $imgInfo['cate_name'] = DB::select('cate_name')->from('img_categories')->where('cate_id', '=', (int) $imgInfo['cate_id'])->fetch_one();
     $user = ORM::factory('user', $imgInfo['userid']);
     $imgInfo['username'] = $user->username;
     $imgInfo['avatar'] = $user->avatar;
     $imgInfo['uid'] = $user->uid;
     $imgInfo['sign'] = ORM::factory('user_field', (int) $imgInfo['userid'])->sign;
     $this->template->imgInfo = $imgInfo;
     if (empty($imgInfo)) {
         $this->show_message('非法访问', 0, array(), true);
     }
     if ($user->status != 'approved' || $user->expire_time < time()) {
         $links[] = array('text' => '返回首页', 'href' => '/');
         $this->show_message('该用户已经过期或者禁止,不允许访问其所属的图片', 1, $links, true, 10000);
     }
     $this->template->tags = $tags = $tag->get($pid, 'img');
     $select = DB::select('c.*', 'u.username', 'u.avatar')->from(array('comments', 'c'))->where('c.item_id', '=', (int) $pid)->where('c.app', '=', 'img')->join(array('users', 'u'), 'LEFT')->on('u.uid', '=', 'c.author');
     $this->template->commentList = $select->execute()->as_array();
     if ($this->isPost()) {
         $tags = trim($this->getPost('tags'));
         $pid = (int) $this->getPost('pid');
         $tags = explode(' ', $tags);
         $tag->add($pid, 'img', $tags, $imgInfo['userid']);
         $this->request->redirect('/' . $pid . '.html');
     }
     // 更新访问量
     DB::update('users')->set(array('visit' => DB::expr("visit + 1")))->where('uid', '=', (int) $imgInfo['userid'])->execute();
     DB::update('imgs')->set(array('click' => DB::expr('click + 1')))->where('id', '=', (int) $pid)->execute();
 }
Exemplo n.º 11
0
  */
 case 'put':
     //Requisições
     $_DATA = $request->getRequestVars();
     //Informações cadastradas
     $data = array('tagName' => trim($_DATA['tagName']));
     //Instâncias
     $tags = new Tags();
     //Verificar inputs básicos
     if ($data['tagName'] == '' || count($data['tagName']) > 28) {
         //Nome da tag
         RestUtils::sendResponse('406', array('data' => 'tagName', 'message' => 'Por favor, verifique o nome da tag.'));
     }
     //Verifica se a tag já não existe
     $allTagsCompare = array();
     foreach ($tags->get(500) as $tag) {
         $tag = strtolower(clearUTF($tag['name']));
         array_push($allTagsCompare, $tag);
     }
     if (in_array(prepareToCompare($data['tagName']), $allTagsCompare)) {
         //Se a tag já existe
         RestUtils::sendResponse('406', array('data' => 'tagName', 'message' => 'A tag a ser cadastrada já existe.'));
     }
     //Conexão
     $sql = new DataBase();
     $sql->connect();
     //Adiciona a tag no banco
     $sql->query("INSERT INTO tags(name, profile_id) VALUES ('" . ucfirst(trim(convertToUnicode($data['tagName']))) . "','" . CurrentUser::getId() . "')");
     //Termina execução com sucesso
     $sql->close();
     RestUtils::sendResponse('201');
Exemplo n.º 12
0
  * Add tags to image
  * 
  * @param tags commaseparated string of tags
  * @param image valid image id 
  */
 case 'addTags':
     if (!isset($_GET['tags']) || !isset($_GET['image'])) {
         echo "-20 Tags or image where not given";
         break;
     }
     if (!is_numeric($_GET['image'])) {
         echo "-21 Image ID " . $_GET['image'] . " is not a number!";
         break;
     }
     $t = new Tags();
     echo json_encode($t->get($t->connect((int) $_GET['image'], $_GET['tags'])));
     break;
     /**
      * Upload a file by URL
      * 
      * @param url url to upload to imagescript
      */
 /**
  * Upload a file by URL
  * 
  * @param url url to upload to imagescript
  */
 case 'uploadByURL':
     if (!isset($_GET['url'])) {
         echo "-20 URL not set!";
         break;
Exemplo n.º 13
0
 /**
  * 编辑专题
  */
 public function action_edit()
 {
     $this->checklogin();
     $this->template->pageTitle = '编辑专题';
     $this->_add_css('styles/album/add_topics.css');
     $this->_add_script('scripts/copy.js');
     $sid = (int) $this->getQuery('sid');
     $specialpic = ORM::factory('specialpic');
     $tag = new Tags();
     if ($this->isPost()) {
         $post = Validate::factory($this->getPost())->filter(TRUE, 'trim')->rule('title', 'not_empty')->rule('content', 'not_empty');
         if ($post->check()) {
             $set = array('title' => trim($this->getPost('title')), 'content' => trim($this->getPost('content')));
             $sid = (int) $this->getPost('sid');
             DB::update('specialpics')->set($set)->where('sid', '=', $sid)->where('uid', '=', $this->auth['uid'])->execute();
             $tags = $this->getPost('tags');
             $tags = explode(' ', $tags);
             $tag->set($sid, 'img_subject', $tags, $this->auth['uid']);
             $links[] = array('text' => '返回专题列表', 'href' => '/picsubject/list');
             $this->show_message('编辑专题操作成功。', 1, $links);
         }
     }
     $this->template->tags = $tags = $tag->get($sid, 'img_subject', $this->auth['uid']);
     $this->template->info = ORM::factory('specialpic')->where('sid', '=', $sid)->where('uid', '=', $this->auth['uid'])->find();
 }
Exemplo n.º 14
0
 /**
  * Retrieve an unordered list of tags.
  *
  * @return string
  */
 public function tag_cloud()
 {
     $tags = Tags::get();
     if (count($tags) == 0) {
         return;
     }
     $counts = array();
     foreach ($tags as $tag) {
         $counts[] = $tag->count;
     }
     $min = min($counts);
     $step = 14 / max(max($counts) - $min, 1);
     $out[] = '<ul class="tag-cloud">';
     foreach ($tags as $tag) {
         $link = URL::get('display_entries_by_tag', array('tag' => $tag->slug));
         $size = 8 + ($tag->count - $min) * $step;
         $out[] = '<li>';
         $out[] = "<a href='{$link}' class='tag-link-{$tag->id}' title='" . $tag->count . " topic(s)' rel='tag' style='font-size:" . $size . "pt;'>{$tag->tag}</a>";
         $out[] = '</li>';
     }
     $out[] = '</ul>';
     return implode("\n", $out);
 }
Exemplo n.º 15
0
                                 if ($file) {
                                     $fileInfo = $file->get();
                                     $controlFormfields[$w]['DISPLAYNAME'] = $fileInfo['NAME'];
                                 }
                             }
                         }
                         if ($controlFormfields[$w]['FORMFIELD'] == 7) {
                             if ($controlFormfields[$w]['VALUE01']) {
                                 $cbw = sCblockMgr()->getCblock($controlFormfields[$w]['VALUE01']);
                                 $info = $cbw->get();
                                 $controlFormfields[$w]['DISPLAYNAME'] = $info['NAME'];
                             }
                         }
                         if ($controlFormfields[$w]['FORMFIELD'] == 8) {
                             if ($controlFormfields[$w]['VALUE01']) {
                                 $info = $tagMgr->get($controlFormfields[$w]['VALUE01']);
                                 $controlFormfields[$w]['DISPLAYNAME'] = $info['NAME'];
                             }
                         }
                     }
                     $colist[$x]['ENTRYMASKS'][$c]['FORMFIELDS'] = $controlFormfields;
                 }
             }
         }
         $contentareas[$i]['LIST'] = $colist;
     }
 }
 // Save order here
 $colnkorder = array();
 foreach ($contentareas as $contentareas_item) {
     if ($contentareas_item['CODE'] == $contentarea) {
Exemplo n.º 16
0
                     $hasMoved = false;
                     $koala->alert($itext['TXT_ERROR_ACCESS_DENIED']);
                 }
             }
             if ($hasMoved) {
                 $parent_ids = array();
                 $parents = $tagMgr->getParents($source);
                 foreach ($parents as $parent_item) {
                     array_push($parent_ids, $parent_item[0]['ID']);
                 }
                 $parent_ids = array_reverse($parent_ids);
                 array_shift($parent_ids);
                 array_push($parent_ids, $source);
                 $parent_ids = implode(',', $parent_ids);
                 $icons = new Icons();
                 $tagInfo = $tagMgr->get($source);
                 $koala->callJSFunction('Koala.yg_selectTreeNode', $parentwindow, 'page', $source[0]);
             }
         }
     }
     break;
 case 'addTagChildFolder':
     $tag = $this->params['tag'];
     $tagName = $this->params['tagName'];
     if (!$tagName) {
         $tagName = $itext['TXT_TAG_NEW'];
     }
     // Check if root node is selected
     if ($tag === 'root') {
         // Get real Page-ID of Root-Node
         $tags = $tagMgr->getList();
Exemplo n.º 17
0
                             }
                         }
                     }
                 }
             }
         }
         if ($fileInfo['FOLDER'] === '0') {
             $fileversion = $file->newVersion();
             $jsQueue->add($data[0], HISTORYTYPE_FILE, 'CLEAR_FILEINFOS', sGuiUS(), NULL);
         }
     }
     break;
 case 'tag':
     // Get the tag
     $tagMgr = new Tags();
     $tagInfo = $tagMgr->get($data[0]);
     $oldname = $tagInfo['NAME'];
     $value = str_replace("\r", '', str_replace("\n", '\\n', $this->reponsedata[$property]->value));
     if ($oldname == $value) {
         // No update needed, henceforth break
         break;
     }
     // Check for empty name
     if ($property == 'name' && trim($value) == '') {
         $jsQueue->add($data[0], HISTORYTYPE_TAG, 'OBJECT_CHANGE', sGuiUS(), 'tag', NULL, NULL, $this->reponsedata[$property]->yg_id, $property, $oldvalue);
         $jsQueue->add($data[0], HISTORYTYPE_FILE, 'REFRESH_WINDOW', sGuiUS(), 'name');
         $koala->alert($itext['TXT_CANT_CHANGE_TAGTITLE_TO_EMPTY_VALUE']);
         break;
     }
     // Special handling for files
     if ($propertyInfo[0]['TYPE'] == 'FILE') {
Exemplo n.º 18
0
 private function build_cloud()
 {
     $tags = Tags::get();
     $max = Tags::max_count();
     $hide = $this->get_hide_tag_list();
     $this->step = $max / Options::get('fluffytag__steps');
     $this->prefix = explode(',', Options::get('fluffytag__prefix'));
     //$tags = array_filter($tags, create_function( '$a' 'return $a->slug == ' );
     $tags = array_filter($tags, array($this, 'add_count'));
     //print_r( $tags );
     return $tags;
 }
Exemplo n.º 19
0
echo $post->permalink;
?>
" rel="bookmark" title="<?php 
_e('Permanent link to');
?>
 <?php 
echo $post->title;
?>
"><?php 
echo $post->title_out;
?>
</a></h2>
				<div class="entry">
					<ul>
						<?php 
foreach (Tags::get() as $tag) {
    echo '<li><a href="' . URL::get('display_entries_by_tag', array('tag' => $tag->slug)) . '">' . $tag->tag . '</a> (' . $tag->count . ')</li>';
}
?>
					</ul>
					<?php 
if ($user->loggedin) {
    ?>
						<p class="meta">
							<a href="<?php 
    URL::out('admin', 'page=publish&id=' . $post->id);
    ?>
" title="<?php 
    _e('Edit post');
    ?>
"><?php 
Exemplo n.º 20
0
 /**
  * Gets all content of this Cblock
  *
  * @return array
  */
 function getContentInternal()
 {
     $cbId = (int) $this->_id;
     if ($this->permissions->checkInternal($this->_uid, $cbId, "RREAD")) {
         $cblockInfo = $this->get();
         if ($cblockInfo['FOLDER']) {
             return false;
         } else {
             $entrymasks = $this->getEntrymasks();
             for ($c = 0; $c < count($entrymasks); $c++) {
                 $controlFormfields = $this->getFormfieldsInternal($entrymasks[$c]['LINKID']);
                 for ($w = 0; $w < count($controlFormfields); $w++) {
                     if ($controlFormfields[$w]['FORMFIELD'] == 6 || $controlFormfields[$w]['FORMFIELD'] == 16) {
                         if (trim($controlFormfields[$w]['VALUE01'])) {
                             $file = new File($controlFormfields[$w]['VALUE01']);
                             if ($file) {
                                 $fileInfo = $file->get();
                                 $controlFormfields[$w]['DISPLAYNAME'] = $fileInfo['NAME'];
                                 $controlFormfields[$w]['FILEINFO'] = $fileInfo;
                             }
                         }
                     }
                     if ($controlFormfields[$w]['FORMFIELD'] == 7) {
                         if (trim($controlFormfields[$w]['VALUE01'])) {
                             $lcb = sCblockMgr()->getCblock($controlFormfields[$w]['VALUE01']);
                             if ($lcb) {
                                 $info = $lcb->get();
                                 $controlFormfields[$w]['DISPLAYNAME'] = $info['NAME'];
                             }
                         }
                     }
                     if ($controlFormfields[$w]['FORMFIELD'] == 8) {
                         if (trim($controlFormfields[$w]['VALUE01'])) {
                             $tagMgr = new Tags();
                             $info = $tagMgr->get($controlFormfields[$w]['VALUE01']);
                             if ($info) {
                                 $controlFormfields[$w]['DISPLAYNAME'] = $info['NAME'];
                             }
                         }
                     }
                 }
                 $entrymasks[$c]['FORMFIELDS'] = $controlFormfields;
             }
         }
         return $entrymasks;
     } else {
         return false;
     }
 }
Exemplo n.º 21
0
 /**
  * 编辑内容
  */
 public function action_edit()
 {
     $this->checkLogin();
     $this->_add_css('styles/album/edit_articles.css');
     $this->template->pageTitle = '编辑图书内容';
     $tag = new Tags();
     $article = ORM::factory('article');
     $this->template->aid = $aid = (int) $this->getQuery('aid');
     $this->template->categories = $categories = $this->cate->getCates($this->auth['uid']);
     $this->template->info = $info = $article->where('article_id', '=', $aid)->find();
     $tags = $tag->get($aid, 'article', $this->auth['uid']);
     $this->template->tags = implode(' ', $tags);
     if ($this->isPost()) {
         //数据验证
         $post = Validate::factory($this->getPost())->filter(TRUE, 'trim')->rule('title', 'not_empty')->rule('cate_id', 'not_empty')->rule('content', 'not_empty');
         if ($post->check()) {
             $aid = (int) $this->getPost('aid');
             $set = array('title' => trim($this->getPost('title')), 'cate_id' => (int) $this->getPost('cate_id'), 'content' => trim($this->getPost('content')));
             if ($this->auth['uid'] != $info->uid) {
                 $this->show_message('你不能编辑不是你的文章', 0, $array, true);
             }
             DB::update('articles')->set($set)->where('article_id', '=', $aid)->execute();
             if ($info->cate_id != $set['cate_id']) {
                 // 修改原图书分类文章数
                 $select = DB::select(DB::expr("count(0)"))->from('articles')->where('cate_id', '=', $info->cate_id);
                 DB::update('article_categories')->set(array('art_num' => $select))->where('cate_id', '=', $info->cate_id)->execute();
             }
             // 修改图书分类文章数
             $select = DB::select(DB::expr("count(0)"))->from('articles')->where('cate_id', '=', $set['cate_id']);
             DB::update('article_categories')->set(array('art_num' => $select))->where('cate_id', '=', $set['cate_id'])->execute();
             $tags = trim($this->getPost('tags'));
             $tags = explode(' ', $tags);
             $this->tag->set($aid, 'article', $tags, $this->auth['uid']);
             $links[] = array('text' => '图书管理', 'href' => '/book/article/list');
             $this->show_message('编辑图书文章成功', 1, $links, true);
         } else {
             $this->show_message($post->errors('book/article'));
         }
     }
 }
Exemplo n.º 22
0
 /**
  * Handles AJAX from /admin/tags
  * Used to delete and rename tags
  */
 public function ajax_tags($handler_vars)
 {
     Utils::check_request_method(array('POST'));
     $wsse = Utils::WSSE($handler_vars['nonce'], $handler_vars['timestamp']);
     if ($handler_vars['digest'] != $wsse['digest']) {
         Session::error(_t('WSSE authentication failed.'));
         echo Session::messages_get(true, array('Format', 'json_messages'));
         return;
     }
     $tag_names = array();
     $action = $this->handler_vars['action'];
     switch ($action) {
         case 'delete':
             foreach ($_POST as $id => $delete) {
                 // skip POST elements which are not tag ids
                 if (preg_match('/^tag_\\d+/', $id) && $delete) {
                     $id = substr($id, 4);
                     $tag = Tags::get_by_id($id);
                     $tag_names[] = $tag->tag;
                     Tags::delete($tag);
                 }
             }
             $msg_status = sprintf(_n('Tag %s has been deleted.', 'Tags %s have been deleted.', count($tag_names)), implode($tag_names, ', '));
             Session::notice($msg_status);
             echo Session::messages_get(true, array('Format', 'json_messages'));
             break;
         case 'rename':
             if (isset($this->handler_vars['master'])) {
                 $theme_dir = Plugins::filter('admin_theme_dir', Site::get_dir('admin_theme', TRUE));
                 $this->theme = Themes::create('admin', 'RawPHPEngine', $theme_dir);
                 $master = $this->handler_vars['master'];
                 $tag_names = array();
                 foreach ($_POST as $id => $rename) {
                     // skip POST elements which are not tag ids
                     if (preg_match('/^tag_\\d+/', $id) && $rename) {
                         $id = substr($id, 4);
                         $tag = Tags::get_by_id($id);
                         $tag_names[] = $tag->tag;
                     }
                 }
                 Tags::rename($master, $tag_names);
                 $msg_status = sprintf(_n('Tag %1$s has been renamed to %2$s.', 'Tags %1$s have been renamed to %2$s.', count($tag_names)), implode($tag_names, ', '), $master);
                 Session::notice($msg_status);
                 $this->theme->tags = Tags::get();
                 $this->theme->max = Tags::max_count();
                 echo json_encode(array('msg' => Session::messages_get(true, 'array'), 'tags' => $this->theme->fetch('tag_collection')));
             }
             break;
     }
 }
Exemplo n.º 23
0
     $objectdynprops[$objectdynprops_cnt]['LVALUES'] = $listentries;
 }
 if ($object_property['TYPE'] == 'FILE') {
     if ($objectdynprops[$objectdynprops_cnt]['VALUE']) {
         $tmpFile = sFileMgr()->getFile($objectdynprops[$objectdynprops_cnt]['VALUE']);
         if ($tmpFile) {
             $fileInfo = $tmpFile->get();
             $objectdynprops[$objectdynprops_cnt]['FILETITLE'] = $fileInfo['NAME'];
             $objectdynprops[$objectdynprops_cnt]['FILECOLOR'] = $fileInfo['COLOR'];
             $objectdynprops[$objectdynprops_cnt]['FILEIDENTIFIER'] = $fileInfo['IDENTIFIER'];
             $objectdynprops[$objectdynprops_cnt]['FILEABBREVIATION'] = $fileInfo['CODE'];
         }
     }
 }
 if ($object_property['TYPE'] == 'TAG') {
     $tagInfo = $tagMgr->get($objectdynprops[$objectdynprops_cnt]['VALUE']);
     $objectdynprops[$objectdynprops_cnt]['TAGTITLE'] = $tagInfo['NAME'];
 }
 if ($object_property['IDENTIFIER'] == 'EMAIL') {
     $email = $objectdynprops[$objectdynprops_cnt]['VALUE'];
 }
 if ($object_property['IDENTIFIER'] == 'COMPANY') {
     $company = $objectdynprops[$objectdynprops_cnt]['VALUE'];
 }
 if ($object_property['IDENTIFIER'] == 'DEPARTMENT') {
     $department = $objectdynprops[$objectdynprops_cnt]['VALUE'];
 }
 if ($object_property['IDENTIFIER'] == 'FIRSTNAME') {
     $firstname = $objectdynprops[$objectdynprops_cnt]['VALUE'];
 }
 if ($object_property['IDENTIFIER'] == 'LASTNAME') {
Exemplo n.º 24
0
 }
 // Special Case for Contentblocks
 if ($history[$i]['TEXT'] == 'TXT_COMMON_H_COEDIT_FRMFLD_7') {
     if ($history[$i]['NEWVALUE']) {
         $cb = sCblockMgr()->getCblock($history[$i]['NEWVALUE']);
         $cblockInfo = $cb->get();
         $cblockInfo['RWRITE'] = $cb->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $history[$i]['NEWVALUE'], "RWRITE");
         $cblockInfo['RDELETE'] = $cb->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $history[$i]['NEWVALUE'], "RDELETE");
         $styleData = getStyleForContentblock($cblockInfo, true);
         $history[$i]['NEWVALUE'] = "<a onclick=\"\$K.yg_openObjectDetails('" . $history[$i]['NEWVALUE'] . "', 'cblock', '" . $cblockInfo['NAME'] . "', 'cblock', '" . $styleData . "');\">" . $cblockInfo['NAME'] . "</a>";
     }
 }
 // Special Case for Tags
 if ($history[$i]['TEXT'] == 'TXT_COMMON_H_COEDIT_FRMFLD_8') {
     $tmpTags = new Tags();
     $tagInfo = $tmpTags->get($history[$i]['NEWVALUE']);
     $history[$i]['NEWVALUE'] = "<a onclick=\"\$K.yg_openObjectDetails('" . $history[$i]['NEWVALUE'] . "', 'tag', '" . $tagInfo['NAME'] . "', 'tag', '');\">" . $tagInfo['NAME'] . "</a>";
 }
 // Special Case for Date
 if ($history[$i]['TEXT'] == 'TXT_COMMON_H_COEDIT_FRMFLD_11') {
     $history[$i]['NEWVALUE'] = date($itext['DATE_FORMAT'], TStoLocalTS($history[$i]['NEWVALUE']));
 }
 // Special Case for Datetime
 if ($history[$i]['TEXT'] == 'TXT_COMMON_H_COEDIT_FRMFLD_12') {
     $dateString = date($itext['DATE_FORMAT'], TStoLocalTS($history[$i]['NEWVALUE']));
     $timeString = date('H', TStoLocalTS($history[$i]['NEWVALUE'])) . ':' . date('i', TStoLocalTS($history[$i]['NEWVALUE']));
     $history[$i]['NEWVALUE'] = $dateString . ' ' . $timeString;
 }
 // Special Case for Pages
 if ($history[$i]['TEXT'] == 'TXT_COMMON_H_COEDIT_FRMFLD_15') {
     $currSiteID = explode('-', $history[$i]['NEWVALUE']);
Exemplo n.º 25
0
function getAdditionalFormfieldData(&$controlFormfields)
{
    $entrymaskMgr = new Entrymasks();
    $tagMgr = new Tags();
    $filetypeMgr = new Filetypes();
    for ($w = 0; $w < count($controlFormfields); $w++) {
        $controlFormfields[$w]['LVALUES'] = NULL;
        $controlFormfields[$w]['DISPLAYNAME'] = NULL;
        // Date & Datetime
        if ($controlFormfields[$w]['TYPE'] == 'DATE' || $controlFormfields[$w]['TYPE'] == 'DATETIME') {
            if ($controlFormfields[$w]['VALUE']) {
                $controlFormfields[$w]['VALUE'] = TStoLocalTS($controlFormfields[$w]['VALUE']);
            }
        }
        // Link
        if ($controlFormfields[$w]['TYPE'] == 'LINK') {
            $special_url = resolveSpecialURL($controlFormfields[$w]['URL']);
            if ($special_url !== false) {
                $special_url_info = getSpecialURLInfo($controlFormfields[$w]['VALUE01']);
                if ($special_url_info['TYPE'] == 'IMG' || $special_url_info['TYPE'] == 'DOWN') {
                    $controlFormfields[$w]['IS_FILE'] = true;
                    $file = sFileMgr()->getFile($special_url_info['ID']);
                    $link_fileinfo = $file->get();
                    $controlFormfields[$w]['DISPLAYNAME'] = $link_fileinfo['NAME'];
                    $link_filetype = $filetypeMgr->get($link_fileinfo['FILETYPE']);
                    $controlFormfields[$w]['IDENTIFIER'] = $link_filetype['IDENTIFIER'];
                    $controlFormfields[$w]['TYPECODE'] = $link_filetype['CODE'];
                    $controlFormfields[$w]['COLOR'] = $link_filetype['COLOR'];
                    $controlFormfields[$w]['FILE_ID'] = $special_url_info['ID'];
                } else {
                    $pageMgr = new PageMgr($special_url_info['SITE']);
                    $page = $pageMgr->getPage($special_url_info['ID']);
                    $link_pageInfo = $page->get();
                    $controlFormfields[$w]['DISPLAYNAME'] = $link_pageInfo['NAME'];
                    $controlFormfields[$w]['IS_INTERNAL'] = true;
                }
            } else {
                if (preg_match_all(sApp()->URLRegEx1, $controlFormfields[$w]['VALUE01'], $internal) > 0) {
                    if ($internal[2][0] == 'download') {
                        $controlFormfields[$w]['IS_FILE'] = true;
                        $link_file = str_replace('/', '', $internal[3][0]);
                        $file = sFileMgr()->getFile($link_file);
                        $link_fileinfo = $file->get();
                        $controlFormfields[$w]['DISPLAYNAME'] = $link_fileinfo['NAME'];
                        $link_filetype = $filetypeMgr->get($link_fileinfo['FILETYPE']);
                        $controlFormfields[$w]['IDENTIFIER'] = $link_filetype['IDENTIFIER'];
                        $controlFormfields[$w]['TYPECODE'] = $link_filetype['CODE'];
                        $controlFormfields[$w]['COLOR'] = $link_filetype['COLOR'];
                        $controlFormfields[$w]['FILE_ID'] = $link_file;
                    } else {
                        $link_site = $internal[3][0];
                        $link_page = str_replace('/', '', $internal[5][0]);
                        $pageMgr = new PageMgr($link_site);
                        $page = $pageMgr->getPage($link_page);
                        $link_pageInfo = $page->get();
                        $controlFormfields[$w]['DISPLAYNAME'] = $link_pageInfo['NAME'];
                        $controlFormfields[$w]['IS_INTERNAL'] = true;
                    }
                } elseif (substr($controlFormfields[$w]['URL'], 0, 7) == 'mailto:') {
                    $controlFormfields[$w]['IS_EMAIL'] = true;
                } else {
                    $linkInfo = checkLinkInternalExternal($controlFormfields[$w]['URL']);
                    switch ($linkInfo['TYPE']) {
                        case 'external':
                            $controlFormfields[$w]['DISPLAYNAME'] = $controlFormfields[$w]['URL'];
                            break;
                        case 'internal':
                            $controlFormfields[$w]['DISPLAYNAME'] = $linkInfo['NAME'];
                            $controlFormfields[$w]['IS_INTERNAL'] = true;
                            break;
                        case 'file':
                            $controlFormfields[$w]['IS_FILE'] = true;
                            $controlFormfields[$w]['DISPLAYNAME'] = $linkInfo['NAME'];
                            $controlFormfields[$w]['IDENTIFIER'] = $linkInfo['INFO']['IDENTIFIER'];
                            $controlFormfields[$w]['TYPECODE'] = $linkInfo['INFO']['CODE'];
                            $controlFormfields[$w]['COLOR'] = $linkInfo['INFO']['COLOR'];
                            $controlFormfields[$w]['FILE_ID'] = $linkInfo['INFO']['FILE_ID'];
                            break;
                    }
                }
            }
        }
        // File
        if ($controlFormfields[$w]['TYPE'] == 'FILE') {
            if (trim($controlFormfields[$w]['FILE_ID'])) {
                $file = sFileMgr()->getFile($controlFormfields[$w]['FILE_ID']);
                if ($file) {
                    $fileInfo = $file->get();
                    $controlFormfields[$w]['DISPLAYNAME'] = $fileInfo['NAME'];
                    $controlFormfields[$w]['IDENTIFIER'] = $fileInfo['IDENTIFIER'];
                    $controlFormfields[$w]['TYPECODE'] = $fileInfo['CODE'];
                    $controlFormfields[$w]['COLOR'] = $fileInfo['COLOR'];
                }
            }
        }
        // File
        if ($controlFormfields[$w]['TYPE'] == 'FILEFOLDER') {
            if (trim($controlFormfields[$w]['FILE_ID'])) {
                $file = sFileMgr()->getFile($controlFormfields[$w]['FILE_ID']);
                if ($file) {
                    $fileInfo = $file->get();
                    $controlFormfields[$w]['DISPLAYNAME'] = $fileInfo['NAME'];
                }
            }
        }
        // Contentblock
        if ($controlFormfields[$w]['TYPE'] == 'CO') {
            if (trim($controlFormfields[$w]['CBLOCK_ID'])) {
                $cb = sCblockMgr()->getCblock($controlFormfields[$w]['CBLOCK_ID']);
                $info = $cb->get();
                $controlFormfields[$w]['DISPLAYNAME'] = $info['NAME'];
            }
        }
        // Tag
        if ($controlFormfields[$w]['TYPE'] == 'TAG') {
            if (trim($controlFormfields[$w]['TAG_ID'])) {
                $info = $tagMgr->get($controlFormfields[$w]['TAG_ID']);
                $controlFormfields[$w]['DISPLAYNAME'] = $info['NAME'];
            }
        }
        // Page
        if ($controlFormfields[$w]['TYPE'] == 'PAGE') {
            if (trim($controlFormfields[$w]['SITE_ID']) && trim($controlFormfields[$w]['PAGE_ID'])) {
                $tmpPageMgr = new PageMgr($controlFormfields[$w]['SITE_ID']);
                $tmpPage = $tmpPageMgr->getPage($controlFormfields[$w]['PAGE_ID']);
                $info = $tmpPage->get();
                $info['RWRITE'] = $tmpPage->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $controlFormfields[$w]['PAGE_ID'], "RWRITE");
                $info['RDELETE'] = $tmpPage->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $controlFormfields[$w]['PAGE_ID'], "RDELETE");
                $iconData = getIconForPage($info);
                $controlFormfields[$w]['ICON'] = $iconData['iconclass'];
                $controlFormfields[$w]['STYLE'] = $iconData['style'];
                $controlFormfields[$w]['DISPLAYNAME'] = $info['NAME'];
            }
        }
        // List
        if ($controlFormfields[$w]['TYPE'] == 'LIST') {
            if (trim($controlFormfields[$w]['ENTRYMASKFORMFIELD'])) {
                $controlFormfields[$w]['LIST_VALUES'] = $entrymaskMgr->getListValuesByLinkID($controlFormfields[$w]['ENTRYMASKFORMFIELD']);
            }
        }
    }
}