Inheritance: extends CI_Controller
 public function testFilterSetFavoritedUntil()
 {
     $request = $this->getMockBuilder('\\Kanedo\\Request')->disableOriginalConstructor()->getMock();
     $bookmarks = new Bookmarks($request);
     $this->assertInstanceOf('\\Kanedo\\Bookmarks', $bookmarks->setFavoritedUntil(time()), 'Test if Bookmarks setFavoritedUntil is chainable');
     $this->setExpectedException('\\InvalidArgumentException');
     $bookmarks->setFavoritedSince(time());
     $bookmarks->setFavoritedUntil(1);
 }
 /** Create a list of social bookmarks from the database entered list
  * @return string $html
  * 
  */
 public function socialbookmarking()
 {
     $html = '<div id="bookmarks" class="removePrint"><p>Social Bookmarking: ';
     $social = new Bookmarks();
     $books = $social->getValidBookmarks();
     foreach ($books as $service) {
         $targetHref = str_replace('{title}', $this->view->title(), $service['url']);
         $targetHref = str_replace('{link}', $this->view->CurUrl(), $targetHref);
         $image = $service['image'];
         list($w, $h) = getimagesize($this->view->baseUrl() . 'images/social/' . $image);
         $serviceIcon = '<a class="social-img" href="' . $this->view->escape($targetHref) . '" title="Share this page on ' . $service['service'] . '"><img src="' . $this->view->baseUrl() . '/images/social/' . $image . '" alt="Favicon for ' . $service['service'] . '" width="' . $w . '" height="' . $h . '"/></a>';
         $html .= $serviceIcon;
     }
     $html .= '</p></div>';
     return $html;
 }
Example #3
0
 public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
 {
     //icons
     $copyIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/copy.png";
     $cutIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/cut.png";
     $referIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/refer.png";
     $deleteIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/delete.png";
     $hideIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/hide.png";
     $bookmarkIcon = \Bookmarks::getInstance()->getAssetUrl() . "icons/bookmark.png";
     $schoolBookmarkIcon = \School::getInstance()->getAssetUrl() . "icons/schoolbookmark.png";
     $upIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/up.png";
     $downIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/down.png";
     $topIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/top.png";
     $bottomIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/bottom.png";
     $renameIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/rename.png";
     $editIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/edit.png";
     $propertiesIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/properties.png";
     $rightsIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/rights.png";
     $blankIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/blank.png";
     $popupMenu = new \Widgets\PopupMenu();
     $items = array(array("name" => "Bearbeiten <img src=\"{$editIcon}\">", "command" => "EditTerm", "namespace" => "PortletAppointment", "params" => "{'portletId':'{$this->id}','termIndex':'{$this->termIndex}'}", "type" => "popup"), array("name" => "Löschen <img src=\"{$deleteIcon}\">", "command" => "DeleteTerm", "namespace" => "PortletAppointment", "params" => "{'portletId':'{$this->id}','termIndex':'{$this->termIndex}'}", "type" => "popup"));
     $popupMenu->setItems($items);
     $popupMenu->setPosition(round($this->x + $this->width - 155) . "px", round($this->y + $this->height + 4) . "px");
     $popupMenu->setWidth("150px");
     $ajaxResponseObject->setStatus("ok");
     $ajaxResponseObject->addWidget($popupMenu);
     return $ajaxResponseObject;
 }
 public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
 {
     //icons
     $copyIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/copy.png";
     $cutIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/cut.png";
     $referIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/refer.png";
     $deleteIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/delete.png";
     $hideIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/hide.png";
     $bookmarkIcon = \Bookmarks::getInstance()->getAssetUrl() . "icons/bookmark.png";
     $schoolBookmarkIcon = \School::getInstance()->getAssetUrl() . "icons/schoolbookmark.png";
     $upIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/up.png";
     $downIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/down.png";
     $topIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/top.png";
     $bottomIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/bottom.png";
     $renameIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/rename.png";
     $editIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/edit.png";
     $propertiesIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/properties.png";
     $rightsIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/rights.png";
     $blankIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/blank.png";
     $popupMenu = new \Widgets\PopupMenu();
     $items = array(array("name" => "Bearbeiten <img src=\"{$editIcon}\">", "command" => "EditMessage", "namespace" => "PortletMsg", "params" => "{'portletObjectId':'{$this->portletObjectId}','messageObjectId':'{$this->messageObjectId}'}", "type" => "popup"), array("name" => "Bild bearbeiten <img src=\"{$blankIcon}\">", "command" => "EditMessageImage", "namespace" => "PortletMsg", "params" => "{'portletObjectId':'{$this->portletObjectId}','messageObjectId':'{$this->messageObjectId}'}", "type" => "popup"), array("name" => "Umsortieren <img src=\"{$blankIcon}\">", "direction" => "left", "menu" => array(array("name" => "Eins nach oben <img src=\"{$upIcon}\">", "command" => "OrderMessage", "namespace" => "PortletMsg", "params" => "{'portletObjectId':'{$this->portletObjectId}','messageObjectId':'{$this->messageObjectId}','order':'up'}", "type" => "popup"), array("name" => "Eins nach unten <img src=\"{$downIcon}\">", "command" => "OrderMessage", "namespace" => "PortletMsg", "params" => "{'portletObjectId':'{$this->portletObjectId}','messageObjectId':'{$this->messageObjectId}','order':'down'}", "type" => "popup"), array("name" => "Ganz nach oben <img src=\"{$topIcon}\">", "command" => "OrderMessage", "namespace" => "PortletMsg", "params" => "{'portletObjectId':'{$this->portletObjectId}','messageObjectId':'{$this->messageObjectId}','order':'first'}", "type" => "popup"), array("name" => "Ganz nach unten <img src=\"{$bottomIcon}\">", "command" => "OrderMessage", "namespace" => "PortletMsg", "params" => "{'portletObjectId':'{$this->portletObjectId}','messageObjectId':'{$this->messageObjectId}','order':'last'}", "type" => "popup"))), array("name" => "Löschen <img src=\"{$deleteIcon}\">", "command" => "DeleteMessage", "namespace" => "PortletMsg", "params" => "{'portletObjectId':'{$this->portletObjectId}','messageObjectId':'{$this->messageObjectId}'}", "type" => "popup"));
     $popupMenu->setItems($items);
     $popupMenu->setPosition(round($this->x + $this->width - 155) . "px", round($this->y + $this->height + 4) . "px");
     $popupMenu->setWidth("150px");
     $ajaxResponseObject->setStatus("ok");
     $ajaxResponseObject->addWidget($popupMenu);
     return $ajaxResponseObject;
 }
Example #5
0
 public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
 {
     //icons
     $copyIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/copy.png";
     $cutIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/cut.png";
     $referIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/refer.png";
     $trashIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/trash.png";
     $hideIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/hide.png";
     $bookmarkIcon = \Bookmarks::getInstance()->getAssetUrl() . "icons/bookmark.png";
     $schoolBookmarkIcon = \School::getInstance()->getAssetUrl() . "icons/schoolbookmark.png";
     $upIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/up.png";
     $downIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/down.png";
     $topIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/top.png";
     $bottomIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/bottom.png";
     $renameIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/rename.png";
     $editIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/edit.png";
     $propertiesIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/properties.png";
     $rightsIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/rights.png";
     $blankIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/blank.png";
     //    <img src=\"{$editIcon}\">
     $popupMenu = new \Widgets\PopupMenu();
     $items = array(array("name" => "Bearbeiten <img src=\"{$editIcon}\">", "command" => "EditTopic", "namespace" => "PortletTopic", "params" => "{'portletId':'{$this->id}'}", "type" => "popup"), array("name" => "Kategorie einfügen <img src=\"{$blankIcon}\">", "command" => "CreateCategory", "namespace" => "PortletTopic", "params" => "{'portletId':'{$this->id}'}", "type" => "popup"), array("name" => "Umsortieren <img src=\"{$blankIcon}\">", "direction" => "left", "menu" => array(array("name" => "Eins nach oben <img src=\"{$upIcon}\">", "command" => "Order", "namespace" => "Portal", "params" => "{'portletId':'{$this->id}','order':'up'}", "type" => "popup"), array("name" => "Eins nach unten <img src=\"{$downIcon}\">", "command" => "Order", "namespace" => "Portal", "params" => "{'portletId':'{$this->id}','order':'down'}", "type" => "popup"), array("name" => "Ganz nach oben <img src=\"{$topIcon}\">", "command" => "Order", "namespace" => "Portal", "params" => "{'portletId':'{$this->id}','order':'first'}", "type" => "popup"), array("name" => "Ganz nach unten <img src=\"{$bottomIcon}\">", "command" => "Order", "namespace" => "Portal", "params" => "{'portletId':'{$this->id}','order':'last'}", "type" => "popup"))), array("name" => "SEPARATOR"), array("name" => "Kopieren <img src=\"{$copyIcon}\">", "command" => "PortletCopy", "namespace" => "Portal", "params" => "{'id':'{$this->id}','user':'******'}", "type" => "popup"), array("name" => "Ausschneiden <img src=\"{$cutIcon}\">", "command" => "PortletCut", "namespace" => "Portal", "params" => "{'id':'{$this->id}','user':'******'}", "type" => "popup"), array("name" => "Referenzieren <img src=\"{$referIcon}\">", "command" => "PortletReference", "namespace" => "Portal", "params" => "{'id':'{$this->id}','user':'******'}", "type" => "popup"), array("name" => "Löschen <img src=\"{$trashIcon}\">", "command" => "Delete", "namespace" => "PortletTopic", "params" => "{'portletId':'{$this->id}'}", "type" => "popup"), array("name" => "SEPARATOR"), array("name" => "Rechte <img src=\"{$rightsIcon}\">", "command" => "Sanctions", "namespace" => "Explorer", "params" => "{'id':'{$this->id}'}", "type" => "popup"));
     $popupMenu->setItems($items);
     $popupMenu->setPosition(round($this->x + $this->width - 155) . "px", round($this->y + $this->height + 4) . "px");
     $popupMenu->setWidth("150px");
     $ajaxResponseObject->setStatus("ok");
     $ajaxResponseObject->addWidget($popupMenu);
     return $ajaxResponseObject;
 }
Example #6
0
 public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
 {
     $count = count($this->selection);
     $explorerAssetUrl = \Explorer::getInstance()->getAssetUrl();
     if (!in_array($this->id, $this->selection) || in_array($this->id, $this->selection) && $count == 1) {
         $object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
         $env = $object->get_environment();
         $inventory = $env->get_inventory();
         foreach ($inventory as $key => $element) {
             if ($element->get_id() == $this->id) {
                 $index = $key;
             }
         }
         $popupMenu = new \Widgets\PopupMenu();
         if ($object instanceof \steam_trashbin) {
             $items = array(array("name" => "Papierkorb leeren", "command" => "EmptyTrashbin", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}"));
         } else {
             if ($env instanceof \steam_trashbin) {
                 $items = array(array("raw" => "<a href=\"#\" onclick=\"sendMultiRequest('EmptyTrashbin', getParamsArray({}), getElementIdArray(''), 'updater', null, null, 'explorer', 'Lösche Objekte ...', 0,  getSelectionAsArray().length); return false;\">{$count} Objekte löschen<img src=\"\"></a>"), array("raw" => "<a href=\"#\" onclick=\"sendMultiRequest('Delete', getParamsArray({}), getElementIdArray(''), 'updater', null, null, 'explorer', 'Lösche Objekte ...', 0,  getSelectionAsArray().length); return false;\">{$count} Objekte wiederherstellen<img src=\"\"></a>"));
             } else {
                 $copyIcon = $explorerAssetUrl . "icons/menu/copy.png";
                 $cutIcon = $explorerAssetUrl . "icons/menu/cut.png";
                 $referIcon = $explorerAssetUrl . "icons/menu/refer.png";
                 $trashIcon = $explorerAssetUrl . "icons/menu/trash.png";
                 $hideIcon = $explorerAssetUrl . "icons/menu/hide.png";
                 $bookmarkIcon = \Bookmarks::getInstance()->getAssetUrl() . "icons/bookmark.png";
                 $schoolBookmarkIcon = \School::getInstance()->getAssetUrl() . "icons/schoolbookmark.png";
                 $upIcon = $explorerAssetUrl . "icons/menu/up.png";
                 $downIcon = $explorerAssetUrl . "icons/menu/down.png";
                 $topIcon = $explorerAssetUrl . "icons/menu/top.png";
                 $bottomIcon = $explorerAssetUrl . "icons/menu/bottom.png";
                 $renameIcon = $explorerAssetUrl . "icons/menu/rename.png";
                 $editIcon = $explorerAssetUrl . "icons/menu/edit.png";
                 $propertiesIcon = $explorerAssetUrl . "icons/menu/properties.png";
                 $rightsIcon = $explorerAssetUrl . "icons/menu/rights.png";
                 $blankIcon = $explorerAssetUrl . "icons/menu/blank.png";
                 $items = array(array("name" => "Kopieren<img src=\"{$copyIcon}\">", "command" => "Copy", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}"), array("name" => "Ausschneiden<img src=\"{$cutIcon}\">", "command" => "Cut", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}"), array("name" => "Referenzieren<img src=\"{$referIcon}\">", "command" => "Reference", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}"), array("name" => "Löschen<img src=\"{$trashIcon}\">", "command" => "Delete", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}"), array("name" => "Darstellung<img src=\"{$blankIcon}\">", "direction" => "left", "menu" => array(array("raw" => " <a href=\"#\" onclick=\"sendRequest('ChangeColorLabel', {'id':'{$this->id}', 'color':'transparent'}, 'listviewer-overlay', 'updater', null, null, 'explorer'); return false;\"><img src=\"{$explorerAssetUrl}icons/transparent.png\"></a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t <a href=\"#\" onclick=\"sendRequest('ChangeColorLabel', {'id':'{$this->id}', 'color':'red'}, 'listviewer-overlay', 'updater', null, null, 'explorer'); return false;\"><img src=\"{$explorerAssetUrl}icons/red.png\"></a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t <a href=\"#\" onclick=\"sendRequest('ChangeColorLabel', {'id':'{$this->id}', 'color':'orange'}, 'listviewer-overlay', 'updater', null, null, 'explorer'); return false;\"><img src=\"{$explorerAssetUrl}icons/orange.png\"></a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t <a href=\"#\" onclick=\"sendRequest('ChangeColorLabel', {'id':'{$this->id}', 'color':'yellow'}, 'listviewer-overlay', 'updater', null, null, 'explorer'); return false;\"><img src=\"{$explorerAssetUrl}icons/yellow.png\"></a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t <a href=\"#\" onclick=\"sendRequest('ChangeColorLabel', {'id':'{$this->id}', 'color':'green'}, 'listviewer-overlay', 'updater', null, null, 'explorer'); return false;\"><img src=\"{$explorerAssetUrl}icons/green.png\"></a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t <a href=\"#\" onclick=\"sendRequest('ChangeColorLabel', {'id':'{$this->id}', 'color':'blue'}, 'listviewer-overlay', 'updater', null, null, 'explorer'); return false;\"><img src=\"{$explorerAssetUrl}icons/blue.png\"></a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t <a href=\"#\" onclick=\"sendRequest('ChangeColorLabel', {'id':'{$this->id}', 'color':'purple'}, 'listviewer-overlay', 'updater', null, null, 'explorer'); return false;\"><img src=\"{$explorerAssetUrl}icons/purple.png\"></a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t <a href=\"#\" onclick=\"sendRequest('ChangeColorLabel', {'id':'{$this->id}', 'color':'grey'}, 'listviewer-overlay', 'updater', null, null, 'explorer'); return false;\"><img src=\"{$explorerAssetUrl}icons/grey.png\"></a>"))), array("name" => "Umsortieren<img src=\"{$blankIcon}\">", "direction" => "left", "menu" => array($index != 0 ? array("name" => "Eins nach oben<img src=\"{$upIcon}\">", "command" => "Order", "namespace" => "explorer", "params" => "{'id':'{$this->id}', 'direction':'up'}") : "", $index < count($inventory) - 1 ? array("name" => "Eins nach unten<img src=\"{$downIcon}\">", "command" => "Order", "namespace" => "explorer", "params" => "{'id':'{$this->id}', 'direction':'down'}") : "", $index != 0 ? array("name" => "Ganz nach oben<img src=\"{$topIcon}\">", "command" => "Order", "namespace" => "explorer", "params" => "{'id':'{$this->id}', 'direction':'top'}") : "", $index < count($inventory) - 1 ? array("name" => "Ganz nach unten<img src=\"{$bottomIcon}\">", "command" => "Order", "namespace" => "explorer", "params" => "{'id':'{$this->id}', 'direction':'bottom'}") : "")), array("name" => "SEPARATOR"), array("raw" => "<a href=\"#\" onclick=\"event.stopPropagation(); removeAllDirectEditors();if (!jQuery('#{$this->id}_1').hasClass('directEditor')) { jQuery('#{$this->id}_1').addClass('directEditor').html(''); var obj = new Object; obj.id = '{$this->id}'; sendRequest('GetDirectEditor', obj, '{$this->id}_1', 'updater',null,null,'explorer'); } jQuery('.popupmenuwapper').parent().html('');jQuery('.open').removeClass('open'); return false;\">Umbenennen<img src=\"{$renameIcon}\"></a>"), $object instanceof \steam_container && $object->get_attribute("bid:presentation") === "index" ? array("name" => "Listenansicht<img src=\"{$blankIcon}\">", "link" => PATH_URL . "Explorer/Index/" . $this->id . "/?view=list") : "", $object instanceof \steam_document && strstr($object->get_attribute(DOC_MIME_TYPE), "text") ? array("name" => "Bearbeiten<img src=\"{$editIcon}\">", "link" => PATH_URL . "Explorer/EditDocument/" . $this->id . "/") : "", array("name" => "Eigenschaften...<img src=\"{$propertiesIcon}\">", "command" => "Properties", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}", "type" => "popup"), array("name" => "Rechte...<img src=\"{$rightsIcon}\">", "command" => "Sanctions", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}", "type" => "popup"));
             }
         }
         $popupMenu->setItems($items);
         $popupMenu->setPosition(round($this->x + $this->width - 155) . "px", round($this->y + $this->height + 4) . "px");
         $popupMenu->setWidth("170px");
     } else {
         $copyIcon = $explorerAssetUrl . "icons/menu/copy.png";
         $cutIcon = $explorerAssetUrl . "icons/menu/cut.png";
         $referIcon = $explorerAssetUrl . "icons/menu/refer.png";
         $trashIcon = $explorerAssetUrl . "icons/menu/trash.png";
         $hideIcon = $explorerAssetUrl . "icons/menu/hide.png";
         $blankIcon = $explorerAssetUrl . "icons/menu/blank.png";
         $popupMenu = new \Widgets\PopupMenu();
         $items = array(array("raw" => "<a href=\"#\" onclick=\"sendMultiRequest('EmptyTrashbin', getParamsArray({}), getElementIdArray(''), 'updater', null, null, 'explorer', 'Lösche Objekte ...', 0,  getSelectionAsArray().length); return false;\">{$count} Objekte löschen<img src=\"{$trashIcon}\"></a>"), array("raw" => "<a href=\"#\" onclick=\"sendMultiRequest('Delete', getParamsArray({}), getElementIdArray(''), 'updater', null, null, 'explorer', 'Lösche Objekte ...', 0,  getSelectionAsArray().length); return false;\">{$count} Objekte wiederherstellen<img src=\"{$trashIcon}\"></a>"));
         $popupMenu->setItems($items);
         $popupMenu->setPosition(round($this->x + $this->width - 155) . "px", round($this->y + $this->height + 4) . "px");
         $popupMenu->setWidth("180px");
     }
     $ajaxResponseObject->setStatus("ok");
     $ajaxResponseObject->addWidget($popupMenu);
     return $ajaxResponseObject;
 }
Example #7
0
 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     $app = Yii::app();
     // загружаем основные закладки для админа из раздела с ID = 1
     $dataProvider = $app->cache->get(Bookmarks::CACHE_MAIN_BOOKMARKS);
     if ($dataProvider === false) {
         $model = new Bookmarks();
         $model->section_id = 1;
         $model->user_id = 1;
         $dataProvider = $model->search();
         $app->cache->set(Bookmarks::CACHE_MAIN_BOOKMARKS, $dataProvider, $app->params['cache_duration']);
     }
     $settings = $app->cache->get(Settings::CACHE_SETTINGS);
     if ($settings === false) {
         $settings = Settings::model()->loadSettings();
         $app->cache->set(Settings::CACHE_SETTINGS, $settings, $app->params['cache_duration']);
     }
     $this->render('index', array('app' => $app, 'dataProvider' => $dataProvider, 'settings' => $settings));
 }
Example #8
0
 public function addElem($owner, $content, $type)
 {
     if (!$this->exists(array('condition' => 'owner_id=' . $owner . ' AND content_id=' . $content . ' AND type=' . $type))) {
         $newItem = new Bookmarks();
         $newItem->owner_id = $owner;
         $newItem->content_id = $content;
         $newItem->type = $type;
         $newItem->added = time();
         $newItem->save();
     }
 }
 public function actionDelete_bookmark()
 {
     if (Yii::app()->user->isGuest) {
         $this->redirect($this->createAbsoluteUrl('base'));
     }
     if (Yii::app()->request->isAjaxRequest) {
         if (isset($_POST['idBookmarks'])) {
             Bookmarks::model()->deleteByPk($_POST['idBookmarks']);
             echo CJSON::encode(array('status' => 'ok'));
             exit;
         }
     }
 }
Example #10
0
 public function actionDelete()
 {
     $token = Yii::app()->request->getPost('token');
     $user = Users::model()->find('`key` = :key', ['key' => $token]);
     if ($user === null) {
         $this->renderJSON(['is_error' => true, 'message' => 'Invalid User Token']);
     }
     $bookmark = Bookmarks::model()->findByPk(Yii::app()->request->getPost('bk_id'));
     $count = 0;
     if ($bookmark !== null && $bookmark->user_id == $user->id) {
         $bookmark->delete();
         $count++;
     }
     $this->renderJSON(['is_error' => false, 'data' => ['rows_deleted' => $count], 'message' => 'Success']);
 }
 /**
  * Кабинет пользователя
  */
 public function actionUser_cabinet()
 {
     if (Yii::app()->request->isAjaxRequest) {
         if (isset($_POST['Users'])) {
             $model = Users::model()->findByPk($_POST['Users']['idUser']);
             $oldFile = null;
             $fileName = null;
             // Генерим имя фото
             if ('' != $_FILES['Users']['name']['image']) {
                 $fileName = AuxiliaryFunctions::getUniquNamePhoto($_FILES['Users']['name']['image']);
                 $_POST['Users']['photo'] = $fileName;
                 $oldFile = $model->photo;
             }
             $model->attributes = $_POST['Users'];
             if ($model->save(false)) {
                 if ($fileName) {
                     AuxiliaryFunctions::savePhoto($model, $fileName, $oldFile);
                 }
                 if (Yii::app()->request->isAjaxRequest) {
                     echo CJSON::encode(array('result' => 'ok'));
                     exit;
                 }
             } else {
                 if (Yii::app()->request->isAjaxRequest) {
                     echo CJSON::encode(array('error' => 'save'));
                     exit;
                 }
             }
         }
     }
     if (Yii::app()->user->isGuest || 'Admins' == Yii::app()->session->get("typeAuthorize") || !isset($_GET['idUser']) || $_GET['idUser'] != Yii::app()->user->id) {
         $this->redirect(Yii::app()->homeUrl);
     } else {
         $model = Users::model()->findByPk($_GET['idUser']);
     }
     $artWaitingModeration = Articles::model()->count('idUser = :idUser AND moderationAppruv = 0', array(":idUser" => $_GET['idUser']));
     $artPublication = Articles::model()->count('idUser = :idUser AND public = 1', array(":idUser" => $_GET['idUser']));
     $menuInBookmarks = Bookmarks::model()->getUserBookmarks(Yii::app()->user->id);
     $this->render('user_cabinet', array('model' => $model, 'tabArticles' => array('artWaitingModeration' => $artWaitingModeration, 'artPublication' => $artPublication, 'menuInBookmarks' => $menuInBookmarks)));
 }
Example #12
0
 public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
 {
     $path = $this->params["path"];
     $forumId = $this->params["forum"];
     if (isset($this->params["category"])) {
         $categoryId = $this->params["category"];
         $isOverview = false;
     } else {
         $categoryId = $this->id;
         $isOverview = true;
     }
     $object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
     $objectId = $this->id;
     $objectCreatorId = $object->get_creator()->get_id();
     $popupMenu = new \Widgets\PopupMenu();
     $copyIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/copy.png";
     $cutIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/cut.png";
     $referIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/refer.png";
     $trashIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/trash.png";
     $hideIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/hide.png";
     $bookmarkIcon = \Bookmarks::getInstance()->getAssetUrl() . "icons/bookmark.png";
     $schoolBookmarkIcon = \School::getInstance()->getAssetUrl() . "icons/schoolbookmark.png";
     $upIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/up.png";
     $downIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/down.png";
     $topIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/top.png";
     $bottomIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/bottom.png";
     $renameIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/rename.png";
     $editIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/edit.png";
     $propertiesIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/properties.png";
     $rightsIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/rights.png";
     $blankIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/blank.png";
     $replyIcon = "";
     $deleteIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/delete.png";
     $steamUser = \lms_steam::get_current_user();
     $steamUserId = $steamUser->get_id();
     $forum = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $forumId);
     $forumCreatorId = $forum->get_creator()->get_id();
     $category = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $categoryId);
     $categoryCreatorId = $category->get_creator()->get_id();
     $category_allowed_write = $category->check_access_write($steamUser);
     $category_allowed_annotate = $category->check_access_annotate($steamUser);
     $category_allowed_read = $category->check_access_read($steamUser);
     $isForumCreator = false;
     $isTopicCreator = false;
     //$isReplyEditable= $category->get_attribute("bid:forum:is_editable");
     //if(trim($isReplyEditable) == "checked"){
     //	$isReplyEditable=true;
     //} else{
     //	$isReplyEditable=false;
     //}
     $canAnnotate = $category_allowed_write || $category_allowed_annotate;
     $canRead = $category_allowed_read;
     $hasSanction = $category->check_access(SANCTION_SANCTION, $steamUser);
     if ($forumCreatorId == $steamUserId) {
         $isForumCreator = true;
         $isTopicCreator = true;
         $canAnnotate = true;
         $canRead = true;
     } elseif ($categoryCreatorId == $steamUserId) {
         $isTopicCreator = true;
         $canAnnotate = true;
         $canRead = true;
     } elseif ($hasSanction) {
         $canAnnotate = true;
         $canRead = true;
     } elseif ($canAnnotate) {
         $canRead = true;
     }
     $isEditable = $forum->get_attribute("bid:forum_is_editable");
     //TODO: NEED REPLY_ICON
     $items = array();
     if ($categoryId == $this->id) {
         if (!$isOverview) {
             if ($canAnnotate) {
                 $items[] = array("name" => "Antworten<img src=\"{$replyIcon}\">", "command" => "NewReply", "namespace" => "forum", "params" => "{'id':'{$this->id}','forum':'{$forumId}'}", "type" => "popup");
             }
         }
         if ($isTopicCreator) {
             $items[] = array("name" => "Bearbeiten<img src=\"{$editIcon}\">", "command" => "EditTopic", "namespace" => "forum", "params" => "{'id':'{$this->id}','forum':'{$forumId}'}", "type" => "popup");
             $items[] = array("name" => "Löschen<img src=\"{$trashIcon}\">", "command" => "DeleteTopic", "namespace" => "forum", "params" => "{'id':'{$this->id}','forum':'{$forumId}'}");
             $items[] = array("name" => "Bild anfügen<img src=\"{$editIcon}\">", "command" => "EditMessageImage", "namespace" => "forum", "params" => "{'messageObjectId':'{$this->id}','forum':'{$forumId}'}", "type" => "popup");
         }
     } else {
         if ($canAnnotate) {
             $items[] = array("name" => "Antworten<img src=\"{$replyIcon}\">", "command" => "NewReply", "namespace" => "forum", "params" => "{'id':'{$this->id}','forum':'{$forumId}'}", "type" => "popup");
         }
         if ($steamUserId == $objectCreatorId || $isForumCreator) {
             if ($isForumCreator || $isEditable) {
                 $items[] = array("name" => "Bearbeiten<img src=\"{$editIcon}\">", "command" => "EditReply", "namespace" => "forum", "params" => "{'id':'{$this->id}','forum':'{$forumId}'}", "type" => "popup");
                 $items[] = array("name" => "Löschen<img src=\"{$deleteIcon}\">", "command" => "DeleteReply", "namespace" => "forum", "params" => "{'id':'{$this->id}','forum':'{$forumId}'}");
             }
             $items[] = array("name" => "Bild anfügen<img src=\"{$editIcon}\">", "command" => "EditMessageImage", "namespace" => "forum", "params" => "{'messageObjectId':'{$this->id}','forum':'{$forumId}'}", "type" => "popup");
         }
     }
     /*$count = count($this->selection);
     		 if (!in_array($this->id, $this->selection) ||(in_array($this->id, $this->selection) && $count == 1)) {
     		 $object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
     		 $env = $object->get_environment();
     
     		 $inventory = $env->get_inventory();
     		 foreach ($inventory as $key => $element) {
     		 if ($element->get_id() == $this->id) {
     		 $index = $key;
     		 }
     		 }
     
     		 $popupMenu =  new \Widgets\PopupMenu();
     
     		 if ($object instanceof \steam_trashbin) {
     		 $items = array(array("name" => "Papierkorb leeren", "command" => "EmptyTrashbin", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}"));
     		 } else if ($env instanceof \steam_trashbin) {
     		 $items = array(array("name" => "Wiederherstellen", "command" => "Restore", "namespace" => "explorer", "params" => "{'id':'{$this->id}', 'env':document.getElementById('environment').value}"));
     		 } else {
     		 $copyIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/copy.png";
     		 $cutIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/cut.png";
     		 $referIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/refer.png";
     		 $trashIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/trash.png";
     		 $hideIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/hide.png";
     		 $bookmarkIcon = \Bookmarks::getInstance()->getAssetUrl() . "icons/bookmark.png";
     		 $schoolBookmarkIcon = \School::getInstance()->getAssetUrl() . "icons/schoolbookmark.png";
     		 $upIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/up.png";
     		 $downIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/down.png";
     		 $topIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/top.png";
     		 $bottomIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/bottom.png";
     		 $renameIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/rename.png";
     		 $editIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/edit.png";
     		 $propertiesIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/properties.png";
     		 $rightsIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/rights.png";
     		 $blankIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/blank.png";
     		 $items = array(
     		 array("name" => "Kopieren<img src=\"{$copyIcon}\">", "command" => "Copy", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}"),
     		 array("name" => "Ausschneiden<img src=\"{$cutIcon}\">", "command" => "Cut", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}"),
     		 array("name" => "Referenzieren<img src=\"{$referIcon}\">", "command" => "Reference", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}"),
     		 array("name" => "In den Papierkorb legen<img src=\"{$trashIcon}\">", "command" => "Delete", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}"),
     		 array("name" => "Darstellung<img src=\"{$blankIcon}\">", "direction" => "left", "menu" => array (
     		 //array("name" => "<img src=\"{$hideIcon}\">Verstecken", "command" => "Hide", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}"),
     		 array("raw" => " <a href=\"#\" onclick=\"sendRequest('ChangeColorLabel', {'id':'{$this->id}', 'color':'transparent'}, 'listviewer-overlay', 'updater', null, null, 'explorer'); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/transparent.png\"></a>
     		 <a href=\"#\" onclick=\"sendRequest('ChangeColorLabel', {'id':'{$this->id}', 'color':'red'}, 'listviewer-overlay', 'updater', null, null, 'explorer'); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/red.png\"></a>
     		 <a href=\"#\" onclick=\"sendRequest('ChangeColorLabel', {'id':'{$this->id}', 'color':'orange'}, 'listviewer-overlay', 'updater', null, null, 'explorer'); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/orange.png\"></a>
     		 <a href=\"#\" onclick=\"sendRequest('ChangeColorLabel', {'id':'{$this->id}', 'color':'yellow'}, 'listviewer-overlay', 'updater', null, null, 'explorer'); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/yellow.png\"></a>
     		 <a href=\"#\" onclick=\"sendRequest('ChangeColorLabel', {'id':'{$this->id}', 'color':'green'}, 'listviewer-overlay', 'updater', null, null, 'explorer'); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/green.png\"></a>
     		 <a href=\"#\" onclick=\"sendRequest('ChangeColorLabel', {'id':'{$this->id}', 'color':'blue'}, 'listviewer-overlay', 'updater', null, null, 'explorer'); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/blue.png\"></a>
     		 <a href=\"#\" onclick=\"sendRequest('ChangeColorLabel', {'id':'{$this->id}', 'color':'purple'}, 'listviewer-overlay', 'updater', null, null, 'explorer'); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/purple.png\"></a>
     		 <a href=\"#\" onclick=\"sendRequest('ChangeColorLabel', {'id':'{$this->id}', 'color':'grey'}, 'listviewer-overlay', 'updater', null, null, 'explorer'); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/grey.png\"></a>"),
     		 )),
     		 array("name" => "Lesezeichen<img src=\"{$blankIcon}\">", "direction" => "left", "menu" => array (
     		 (!\Bookmarks\Model\Bookmark::isBookmark($this->id)) ? array("name" => "Lesezeichen anlegen<img src=\"{$bookmarkIcon}\">", "command" => "AddBookmark", "namespace" => "bookmarks", "elementId" => "{$this->id}_BookmarkMarkerWrapper", "params" => "{'id':'{$this->id}'}") : "",
     		 (!\Bookmarks\Model\Bookmark::isBookmark($this->id)) ? array("name" => "Schul-Lesezeichen anlegen<img src=\"{$schoolBookmarkIcon}\">", "command" => "AddBookmark", "namespace" => "school", "elementId" => "{$this->id}_SchoolBookmarkMarkerWrapper", "params" => "{'id':'{$this->id}'}") : ""
     		 )),
     		 array("name" => "Umsortieren<img src=\"{$blankIcon}\">", "direction" => "left", "menu" => array(
     		 ($index != 0) ? array("name" => "Eins nach oben<img src=\"{$upIcon}\">", "command" => "Order", "namespace" => "explorer", "params" => "{'id':'{$this->id}', 'direction':'up'}") : "",
     		 ($index < count($inventory)-1) ? array("name" => "Eins nach unten<img src=\"{$downIcon}\">", "command" => "Order", "namespace" => "explorer", "params" => "{'id':'{$this->id}', 'direction':'down'}") : "",
     		 ($index != 0) ? array("name" => "Ganz nach oben<img src=\"{$topIcon}\">", "command" => "Order", "namespace" => "explorer", "params" => "{'id':'{$this->id}', 'direction':'top'}") : "",
     		 ($index < count($inventory)-1) ? array("name" => "Ganz nach unten<img src=\"{$bottomIcon}\">", "command" => "Order", "namespace" => "explorer", "params" => "{'id':'{$this->id}', 'direction':'bottom'}") : ""
     		 )),
     		 array("name" => "SEPARATOR"),
     		 array("raw" => "<a href=\"#\" onclick=\"removeAllDirectEditors();if (!jQuery('#{$this->id}_1').hasClass('directEditor')) { jQuery('#{$this->id}_1').addClass('directEditor').html(''); var obj = new Object; obj.id = '{$this->id}'; sendRequest('GetDirectEditor', obj, '{$this->id}_1', 'updater'); }return false;\">Umbenennen<img src=\"{$renameIcon}\"></a>"),
     		 (($object instanceof \steam_document) && (strstr($object->get_attribute(DOC_MIME_TYPE), "text"))) ? array("name" => "Bearbeiten<img src=\"{$editIcon}\">", "link" => PATH_URL . "Explorer/EditDocument/" . $this->id . "/") : "",
     		 array("name" => "Eigenschaften...<img src=\"{$propertiesIcon}\">", "command" => "Properties", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}", "type" => "popup"),
     		 array("name" => "Rechte...<img src=\"{$rightsIcon}\">", "command" => "Sanctions", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}", "type" => "popup"));
     		 }
     		 $popupMenu->setItems($items);
     		 $popupMenu->setPosition(round($this->x + $this->width - 155) . "px", round($this->y + $this->height + 4) . "px");
     		 $popupMenu->setWidth("170px");
     		 } else {
     		 $copyIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/copy.png";
     		 $cutIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/cut.png";
     		 $referIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/refer.png";
     		 $trashIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/trash.png";
     		 $hideIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/hide.png";
     		 $blankIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/blank.png";
     		 $popupMenu =  new \Widgets\PopupMenu();
     		 $items = array(
     		 array("raw" => "<a href=\"#\" onclick=\"sendMultiRequest('Copy', getParamsArray({}), getElementIdArray(''), 'updater', null, null, 'explorer', 'Kopiere Objekte ...', 0,  getSelectionAsArray().length); return false;\">{$count} Objekte kopieren<img src=\"{$copyIcon}\"></a>"),
     		 array("raw" => "<a href=\"#\" onclick=\"sendMultiRequest('Cut', getParamsArray({}), getElementIdArray(''), 'updater', null, null, 'explorer', 'Schneide Objekte aus ...', 0,  getSelectionAsArray().length); return false;\">{$count} Objekte ausschneiden<img src=\"{$cutIcon}\"></a>"),
     		 array("raw" => "<a href=\"#\" onclick=\"sendMultiRequest('Reference', getParamsArray({}), getElementIdArray(''), 'updater', null, null, 'explorer', 'Referenziere Objekte ...', 0,  getSelectionAsArray().length); return false;\">{$count} Objekte referenzieren<img src=\"{$referIcon}\"></a>"),
     		 array("raw" => "<a href=\"#\" onclick=\"sendMultiRequest('Delete', getParamsArray({}), getElementIdArray(''), 'updater', null, null, 'explorer', 'Lösche Objekte ...', 0,  getSelectionAsArray().length); return false;\">{$count} Objekte vermüllen<img src=\"{$trashIcon}\"></a>"),
     		 array("name" => "Darstellung<img src=\"{$blankIcon}\">", "direction" => "left", "menu" => array (
     		 //array("raw" => "<a href=\"#\" onclick=\"sendMultiRequest('Hide', getParamsArray({}), getElementIdArray(''), 'updater', null, null, 'explorer', 'Verstecke Objekte ...', 0,  getSelectionAsArray().length); return false;\"><img src=\"{$hideIcon}\">{$count} Objekte verstecken</a>"),
     		 array("raw" => " <a href=\"#\" onclick=\"sendMultiRequest('ChangeColorLabel', getParamsArray({'color':'transparent'}), getElementIdArray('listviewer-overlay'), 'updater', null, null, 'explorer', 'Ändere Farbe ...', 0,  getSelectionAsArray().length); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/transparent.png\"></a>
     		 <a href=\"#\" onclick=\"sendMultiRequest('ChangeColorLabel', getParamsArray({'color':'red'}), getElementIdArray('listviewer-overlay'), 'updater', null, null, 'explorer', 'Ändere Farbe ...', 0,  getSelectionAsArray().length); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/red.png\"></a>
     		 <a href=\"#\" onclick=\"sendMultiRequest('ChangeColorLabel', getParamsArray({'color':'orange'}), getElementIdArray('listviewer-overlay'), 'updater', null, null, 'explorer', 'Ändere Farbe ...', 0,  getSelectionAsArray().length); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/orange.png\"></a>
     		 <a href=\"#\" onclick=\"sendMultiRequest('ChangeColorLabel', getParamsArray({'color':'yellow'}), getElementIdArray('listviewer-overlay'), 'updater', null, null, 'explorer', 'Ändere Farbe ...', 0,  getSelectionAsArray().length); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/yellow.png\"></a>
     		 <a href=\"#\" onclick=\"sendMultiRequest('ChangeColorLabel', getParamsArray({'color':'green'}), getElementIdArray('listviewer-overlay'), 'updater', null, null, 'explorer', 'Ändere Farbe ...', 0,  getSelectionAsArray().length); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/green.png\"></a>
     		 <a href=\"#\" onclick=\"sendMultiRequest('ChangeColorLabel', getParamsArray({'color':'blue'}), getElementIdArray('listviewer-overlay'), 'updater', null, null, 'explorer', 'Ändere Farbe ...', 0,  getSelectionAsArray().length); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/blue.png\"></a>
     		 <a href=\"#\" onclick=\"sendMultiRequest('ChangeColorLabel', getParamsArray({'color':'purple'}), getElementIdArray('listviewer-overlay'), 'updater', null, null, 'explorer', 'Ändere Farbe ...', 0,  getSelectionAsArray().length); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/purple.png\"></a>
     		 <a href=\"#\" onclick=\"sendMultiRequest('ChangeColorLabel', getParamsArray({'color':'grey'}), getElementIdArray('listviewer-overlay'), 'updater', null, null, 'explorer', 'Ändere Farbe ...', 0,  getSelectionAsArray().length); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/grey.png\"></a>"),
     
     		 )),
     		 );
     		 $popupMenu->setItems($items);
     		 $popupMenu->setPosition(round($this->x + $this->width - 155) . "px", round($this->y + $this->height + 4) . "px");
     		 $popupMenu->setWidth("180px");
     		 }*/
     $popupMenu->setItems($items);
     $popupMenu->setPosition(round($this->x + $this->width - 155) . "px", round($this->y + $this->height + 4) . "px");
     $popupMenu->setWidth("180px");
     $ajaxResponseObject->setStatus("ok");
     $ajaxResponseObject->addWidget($popupMenu);
     return $ajaxResponseObject;
 }
Example #13
0
			<a href="requests.php?action=edit&amp;id=<?php 
    echo $RequestID;
    ?>
" class="brackets">Edit</a>
<?php 
}
if ($UserCanEdit || check_perms('users_mod')) {
    //check_perms('site_moderate_requests')) {
    ?>
			<a href="requests.php?action=delete&amp;id=<?php 
    echo $RequestID;
    ?>
" class="brackets">Delete</a>
<?php 
}
if (Bookmarks::has_bookmarked('request', $RequestID)) {
    ?>
			<a href="#" id="bookmarklink_request_<?php 
    echo $RequestID;
    ?>
" onclick="Unbookmark('request', <?php 
    echo $RequestID;
    ?>
, 'Bookmark'); return false;" class="brackets">Remove bookmark</a>
<?php 
} else {
    ?>
			<a href="#" id="bookmarklink_request_<?php 
    echo $RequestID;
    ?>
" onclick="Bookmark('request', <?php 
 /**
  * Просмотр статьи с комментами
  */
 public function actionView_article()
 {
     if (isset($_GET['idArticle']) || isset($_POST['idArticle'])) {
         $idArticle = isset($_GET['idArticle']) ? $_GET['idArticle'] : $_POST['idArticle'];
         $criteria = new CDbCriteria();
         // Комментарии к статье
         $criteria->with = array('idUser0');
         $criteria->condition = 'idArticle = :idArticle AND deleted = 0 AND public = 1';
         $criteria->params = array(':idArticle' => $idArticle);
         $comments = Comments::model()->findAll($criteria);
         $commentsDataProvider = new CArrayDataProvider($comments, array('keyField' => 'idComment', 'pagination' => array('pageSize' => 50)));
         // Статья
         $criteria->with = array('idCategory0', 'idMenu0', 'idUser0', 'commentsCount', 'tagstoarticles');
         $criteria->condition = 't.idArticle = :idArticle AND moderationAppruv = 1 AND public = 1 AND deleted = 0';
         if (Yii::app()->request->isAjaxRequest) {
             if (isset($_POST['type'])) {
                 if ('appruve' == $_POST['type']) {
                     $criteria->condition = 't.idArticle = :idArticle AND moderationAppruv = 0 AND deleted = 0';
                 }
             }
         }
         $criteria->params = array(':idArticle' => $idArticle);
         $model = Articles::model()->find($criteria);
         // Теги
         $model['tagArray'] = AuxiliaryFunctions::getTagsList($model->tagstoarticles);
         // Счетчик просмотров статьи
         if ($model->idUser != Yii::app()->user->id && 'Admins' != Yii::app()->session->get("typeAuthorize")) {
             $model->saveCounters(array('numberOfViews' => 1));
         }
         if (isset($_GET['idMenu'])) {
             // Категории раздела
             $this->_listCategory = Categorys::getAllCategories($_GET['idMenu'], true, true);
         }
         $bookmarks = Bookmarks::model()->find(array('select' => 'idBookmarks', 'condition' => 'idUser = :idUser AND idArticle = :idArticle AND idMenu = :idMenu AND idCategory = :idCategory', 'params' => array(':idUser' => Yii::app()->user->id, ':idArticle' => $model->idArticle, ':idMenu' => $model->idMenu, ':idCategory' => $model->idCategory)));
         if (Yii::app()->request->isAjaxRequest) {
             $articlePopup = $this->renderPartial('view_article', array('model' => $model, 'commentsDataProvider' => $commentsDataProvider, 'modelComment' => new Comments(), 'idBookmarks' => null === $bookmarks ? null : $bookmarks->idBookmarks), true);
             echo CJSON::encode(array('popup' => $articlePopup));
             exit;
         }
         $this->breadcrumbs = AuxiliaryFunctions::fillingBreadcrumbs($idArticle, 'article');
         $this->render('view_article', array('model' => $model, 'commentsDataProvider' => $commentsDataProvider, 'modelComment' => new Comments(), 'idBookmarks' => null === $bookmarks ? null : $bookmarks->idBookmarks));
     }
 }
Example #15
0
            $SphQLResultTor = $SphQLTor->query();
            $TorrentIDs = $SphQLResultTor->to_pair('id', 'id');
            // Because isset() is faster than in_array()
        }
    }
}
/** End run search query and collect results **/
if ($NumResults == 0) {
    $DB->query("\n\tSELECT\n\t\ttags.Name,\n\t\t((COUNT(tags.Name) - 2) * (SUM(tt.PositiveVotes) - SUM(tt.NegativeVotes))) / (tags.Uses * 0.8) AS Score\n\tFROM xbt_snatched AS s\n\t\tINNER JOIN torrents AS t ON t.ID = s.fid\n\t\tINNER JOIN torrents_group AS g ON t.GroupID = g.ID\n\t\tINNER JOIN torrents_tags AS tt ON tt.GroupID = g.ID\n\t\tINNER JOIN tags ON tags.ID = tt.TagID\n\tWHERE s.uid = '{$LoggedUser['ID']}'\n\t\tAND tt.TagID != '13679'\n\t\tAND tt.TagID != '4820'\n\t\tAND tt.TagID != '2838'\n\t\tAND g.CategoryID = '1'\n\t\tAND tags.Uses > '10'\n\tGROUP BY tt.TagID\n\tORDER BY Score DESC\n\tLIMIT 8");
    $JsonYouMightLike = array();
    while (list($Tag) = $DB->next_record()) {
        $JsonYouMightLike[] = $Tag;
    }
    json_die("success", array('results' => array(), 'youMightLike' => $JsonYouMightLike));
}
$Bookmarks = Bookmarks::all_bookmarks('torrent');
$JsonGroups = array();
foreach ($Results as $Result) {
    $GroupID = $Result['groupid'];
    $GroupInfo = $Groups[$GroupID];
    if (empty($GroupInfo['Torrents'])) {
        continue;
    }
    $CategoryID = $Result['categoryid'];
    $GroupYear = $GroupInfo['Year'];
    $ExtendedArtists = $GroupInfo['ExtendedArtists'];
    $GroupCatalogueNumber = $GroupInfo['CatalogueNumber'];
    $GroupName = $GroupInfo['Name'];
    $GroupRecordLabel = $GroupInfo['RecordLabel'];
    $ReleaseType = $GroupInfo['ReleaseType'];
    if ($GroupResults) {
Example #16
0
 public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
 {
     $object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
     $env = $object->get_environment();
     $inventory = $env->get_inventory();
     foreach ($inventory as $key => $element) {
         if ($element->get_id() == $this->id) {
             $index = $key;
         }
     }
     $popupMenu = new \Widgets\PopupMenu();
     $copyIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/copy.png";
     $cutIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/cut.png";
     $referIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/refer.png";
     $trashIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/trash.png";
     $hideIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/hide.png";
     $bookmarkIcon = \Bookmarks::getInstance()->getAssetUrl() . "icons/bookmark.png";
     $schoolBookmarkIcon = \School::getInstance()->getAssetUrl() . "icons/schoolbookmark.png";
     $upIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/up.png";
     $downIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/down.png";
     $topIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/top.png";
     $bottomIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/bottom.png";
     $renameIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/rename.png";
     $editIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/edit.png";
     $propertiesIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/properties.png";
     $rightsIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/rights.png";
     $blankIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/blank.png";
     $items = array(array("name" => "Kopieren<img src=\"{$copyIcon}\">", "command" => "Copy", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}"), array("name" => "Ausschneiden<img src=\"{$cutIcon}\">", "command" => "Cut", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}"), array("name" => "Referenzieren<img src=\"{$referIcon}\">", "command" => "Reference", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}"), array("name" => "Löschen<img src=\"{$trashIcon}\">", "command" => "Delete", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}"), array("name" => "Umsortieren<img src=\"{$blankIcon}\">", "direction" => "left", "menu" => array($index != 0 ? array("name" => "Eins nach vorne<img src=\"{$upIcon}\">", "command" => "Order", "namespace" => "explorer", "params" => "{'id':'{$this->id}', 'direction':'up'}") : "", $index < count($inventory) - 1 ? array("name" => "Eins nach hinten<img src=\"{$downIcon}\">", "command" => "Order", "namespace" => "explorer", "params" => "{'id':'{$this->id}', 'direction':'down'}") : "", $index != 0 ? array("name" => "Ganz nach vorne<img src=\"{$topIcon}\">", "command" => "Order", "namespace" => "explorer", "params" => "{'id':'{$this->id}', 'direction':'top'}") : "", $index < count($inventory) - 1 ? array("name" => "Ganz nach hinten<img src=\"{$bottomIcon}\">", "command" => "Order", "namespace" => "explorer", "params" => "{'id':'{$this->id}', 'direction':'bottom'}") : "")), array("name" => "Eigenschaften...<img src=\"{$propertiesIcon}\">", "command" => "Properties", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}", "type" => "popup"));
     //array("name" => "Rechte...<img src=\"{$rightsIcon}\">", "command" => "Sanctions", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}", "type" => "popup"));
     /*$count = count($this->selection);
     		 if (!in_array($this->id, $this->selection) ||(in_array($this->id, $this->selection) && $count == 1)) {
     		 $object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
     		 $env = $object->get_environment();
     
     		 $inventory = $env->get_inventory();
     		 foreach ($inventory as $key => $element) {
     		 if ($element->get_id() == $this->id) {
     		 $index = $key;
     		 }
     		 }
     
     		 $popupMenu =  new \Widgets\PopupMenu();
     
     		 if ($object instanceof \steam_trashbin) {
     		 $items = array(array("name" => "Papierkorb leeren", "command" => "EmptyTrashbin", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}"));
     		 } else if ($env instanceof \steam_trashbin) {
     		 $items = array(array("name" => "Wiederherstellen", "command" => "Restore", "namespace" => "explorer", "params" => "{'id':'{$this->id}', 'env':document.getElementById('environment').value}"));
     		 } else {
     		 $copyIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/copy.png";
     		 $cutIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/cut.png";
     		 $referIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/refer.png";
     		 $trashIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/trash.png";
     		 $hideIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/hide.png";
     		 $bookmarkIcon = \Bookmarks::getInstance()->getAssetUrl() . "icons/bookmark.png";
     		 $schoolBookmarkIcon = \School::getInstance()->getAssetUrl() . "icons/schoolbookmark.png";
     		 $upIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/up.png";
     		 $downIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/down.png";
     		 $topIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/top.png";
     		 $bottomIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/bottom.png";
     		 $renameIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/rename.png";
     		 $editIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/edit.png";
     		 $propertiesIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/properties.png";
     		 $rightsIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/rights.png";
     		 $blankIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/blank.png";
     		 $items = array(
     		 array("name" => "Kopieren<img src=\"{$copyIcon}\">", "command" => "Copy", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}"),
     		 array("name" => "Ausschneiden<img src=\"{$cutIcon}\">", "command" => "Cut", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}"),
     		 array("name" => "Referenzieren<img src=\"{$referIcon}\">", "command" => "Reference", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}"),
     		 array("name" => "In den Papierkorb legen<img src=\"{$trashIcon}\">", "command" => "Delete", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}"),
     		 array("name" => "Darstellung<img src=\"{$blankIcon}\">", "direction" => "left", "menu" => array (
     		 //array("name" => "<img src=\"{$hideIcon}\">Verstecken", "command" => "Hide", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}"),
     		 array("raw" => " <a href=\"#\" onclick=\"sendRequest('ChangeColorLabel', {'id':'{$this->id}', 'color':'transparent'}, 'listviewer-overlay', 'updater', null, null, 'explorer'); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/transparent.png\"></a>
     		 <a href=\"#\" onclick=\"sendRequest('ChangeColorLabel', {'id':'{$this->id}', 'color':'red'}, 'listviewer-overlay', 'updater', null, null, 'explorer'); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/red.png\"></a>
     		 <a href=\"#\" onclick=\"sendRequest('ChangeColorLabel', {'id':'{$this->id}', 'color':'orange'}, 'listviewer-overlay', 'updater', null, null, 'explorer'); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/orange.png\"></a>
     		 <a href=\"#\" onclick=\"sendRequest('ChangeColorLabel', {'id':'{$this->id}', 'color':'yellow'}, 'listviewer-overlay', 'updater', null, null, 'explorer'); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/yellow.png\"></a>
     		 <a href=\"#\" onclick=\"sendRequest('ChangeColorLabel', {'id':'{$this->id}', 'color':'green'}, 'listviewer-overlay', 'updater', null, null, 'explorer'); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/green.png\"></a>
     		 <a href=\"#\" onclick=\"sendRequest('ChangeColorLabel', {'id':'{$this->id}', 'color':'blue'}, 'listviewer-overlay', 'updater', null, null, 'explorer'); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/blue.png\"></a>
     		 <a href=\"#\" onclick=\"sendRequest('ChangeColorLabel', {'id':'{$this->id}', 'color':'purple'}, 'listviewer-overlay', 'updater', null, null, 'explorer'); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/purple.png\"></a>
     		 <a href=\"#\" onclick=\"sendRequest('ChangeColorLabel', {'id':'{$this->id}', 'color':'grey'}, 'listviewer-overlay', 'updater', null, null, 'explorer'); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/grey.png\"></a>"),
     		 )),
     		 array("name" => "Lesezeichen<img src=\"{$blankIcon}\">", "direction" => "left", "menu" => array (
     		 (!\Bookmarks\Model\Bookmark::isBookmark($this->id)) ? array("name" => "Lesezeichen anlegen<img src=\"{$bookmarkIcon}\">", "command" => "AddBookmark", "namespace" => "bookmarks", "elementId" => "{$this->id}_BookmarkMarkerWrapper", "params" => "{'id':'{$this->id}'}") : "",
     		 (!\Bookmarks\Model\Bookmark::isBookmark($this->id)) ? array("name" => "Schul-Lesezeichen anlegen<img src=\"{$schoolBookmarkIcon}\">", "command" => "AddBookmark", "namespace" => "school", "elementId" => "{$this->id}_SchoolBookmarkMarkerWrapper", "params" => "{'id':'{$this->id}'}") : ""
     		 )),
     		 array("name" => "Umsortieren<img src=\"{$blankIcon}\">", "direction" => "left", "menu" => array(
     		 ($index != 0) ? array("name" => "Eins nach oben<img src=\"{$upIcon}\">", "command" => "Order", "namespace" => "explorer", "params" => "{'id':'{$this->id}', 'direction':'up'}") : "",
     		 ($index < count($inventory)-1) ? array("name" => "Eins nach unten<img src=\"{$downIcon}\">", "command" => "Order", "namespace" => "explorer", "params" => "{'id':'{$this->id}', 'direction':'down'}") : "",
     		 ($index != 0) ? array("name" => "Ganz nach oben<img src=\"{$topIcon}\">", "command" => "Order", "namespace" => "explorer", "params" => "{'id':'{$this->id}', 'direction':'top'}") : "",
     		 ($index < count($inventory)-1) ? array("name" => "Ganz nach unten<img src=\"{$bottomIcon}\">", "command" => "Order", "namespace" => "explorer", "params" => "{'id':'{$this->id}', 'direction':'bottom'}") : ""
     		 )),
     		 array("name" => "SEPARATOR"),
     		 array("raw" => "<a href=\"#\" onclick=\"removeAllDirectEditors();if (!jQuery('#{$this->id}_1').hasClass('directEditor')) { jQuery('#{$this->id}_1').addClass('directEditor').html(''); var obj = new Object; obj.id = '{$this->id}'; sendRequest('GetDirectEditor', obj, '{$this->id}_1', 'updater'); }return false;\">Umbenennen<img src=\"{$renameIcon}\"></a>"),
     		 (($object instanceof \steam_document) && (strstr($object->get_attribute(DOC_MIME_TYPE), "text"))) ? array("name" => "Bearbeiten<img src=\"{$editIcon}\">", "link" => PATH_URL . "Explorer/EditDocument/" . $this->id . "/") : "",
     		 array("name" => "Eigenschaften...<img src=\"{$propertiesIcon}\">", "command" => "Properties", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}", "type" => "popup"),
     		 array("name" => "Rechte...<img src=\"{$rightsIcon}\">", "command" => "Sanctions", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}", "type" => "popup"));
     		 }
     		 $popupMenu->setItems($items);
     		 $popupMenu->setPosition(round($this->x + $this->width - 155) . "px", round($this->y + $this->height + 4) . "px");
     		 $popupMenu->setWidth("170px");
     		 } else {
     		 $copyIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/copy.png";
     		 $cutIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/cut.png";
     		 $referIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/refer.png";
     		 $trashIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/trash.png";
     		 $hideIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/hide.png";
     		 $blankIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/blank.png";
     		 $popupMenu =  new \Widgets\PopupMenu();
     		 $items = array(
     		 array("raw" => "<a href=\"#\" onclick=\"sendMultiRequest('Copy', getParamsArray({}), getElementIdArray(''), 'updater', null, null, 'explorer', 'Kopiere Objekte ...', 0,  getSelectionAsArray().length); return false;\">{$count} Objekte kopieren<img src=\"{$copyIcon}\"></a>"),
     		 array("raw" => "<a href=\"#\" onclick=\"sendMultiRequest('Cut', getParamsArray({}), getElementIdArray(''), 'updater', null, null, 'explorer', 'Schneide Objekte aus ...', 0,  getSelectionAsArray().length); return false;\">{$count} Objekte ausschneiden<img src=\"{$cutIcon}\"></a>"),
     		 array("raw" => "<a href=\"#\" onclick=\"sendMultiRequest('Reference', getParamsArray({}), getElementIdArray(''), 'updater', null, null, 'explorer', 'Referenziere Objekte ...', 0,  getSelectionAsArray().length); return false;\">{$count} Objekte referenzieren<img src=\"{$referIcon}\"></a>"),
     		 array("raw" => "<a href=\"#\" onclick=\"sendMultiRequest('Delete', getParamsArray({}), getElementIdArray(''), 'updater', null, null, 'explorer', 'Lösche Objekte ...', 0,  getSelectionAsArray().length); return false;\">{$count} Objekte vermüllen<img src=\"{$trashIcon}\"></a>"),
     		 array("name" => "Darstellung<img src=\"{$blankIcon}\">", "direction" => "left", "menu" => array (
     		 //array("raw" => "<a href=\"#\" onclick=\"sendMultiRequest('Hide', getParamsArray({}), getElementIdArray(''), 'updater', null, null, 'explorer', 'Verstecke Objekte ...', 0,  getSelectionAsArray().length); return false;\"><img src=\"{$hideIcon}\">{$count} Objekte verstecken</a>"),
     		 array("raw" => " <a href=\"#\" onclick=\"sendMultiRequest('ChangeColorLabel', getParamsArray({'color':'transparent'}), getElementIdArray('listviewer-overlay'), 'updater', null, null, 'explorer', 'Ändere Farbe ...', 0,  getSelectionAsArray().length); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/transparent.png\"></a>
     		 <a href=\"#\" onclick=\"sendMultiRequest('ChangeColorLabel', getParamsArray({'color':'red'}), getElementIdArray('listviewer-overlay'), 'updater', null, null, 'explorer', 'Ändere Farbe ...', 0,  getSelectionAsArray().length); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/red.png\"></a>
     		 <a href=\"#\" onclick=\"sendMultiRequest('ChangeColorLabel', getParamsArray({'color':'orange'}), getElementIdArray('listviewer-overlay'), 'updater', null, null, 'explorer', 'Ändere Farbe ...', 0,  getSelectionAsArray().length); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/orange.png\"></a>
     		 <a href=\"#\" onclick=\"sendMultiRequest('ChangeColorLabel', getParamsArray({'color':'yellow'}), getElementIdArray('listviewer-overlay'), 'updater', null, null, 'explorer', 'Ändere Farbe ...', 0,  getSelectionAsArray().length); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/yellow.png\"></a>
     		 <a href=\"#\" onclick=\"sendMultiRequest('ChangeColorLabel', getParamsArray({'color':'green'}), getElementIdArray('listviewer-overlay'), 'updater', null, null, 'explorer', 'Ändere Farbe ...', 0,  getSelectionAsArray().length); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/green.png\"></a>
     		 <a href=\"#\" onclick=\"sendMultiRequest('ChangeColorLabel', getParamsArray({'color':'blue'}), getElementIdArray('listviewer-overlay'), 'updater', null, null, 'explorer', 'Ändere Farbe ...', 0,  getSelectionAsArray().length); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/blue.png\"></a>
     		 <a href=\"#\" onclick=\"sendMultiRequest('ChangeColorLabel', getParamsArray({'color':'purple'}), getElementIdArray('listviewer-overlay'), 'updater', null, null, 'explorer', 'Ändere Farbe ...', 0,  getSelectionAsArray().length); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/purple.png\"></a>
     		 <a href=\"#\" onclick=\"sendMultiRequest('ChangeColorLabel', getParamsArray({'color':'grey'}), getElementIdArray('listviewer-overlay'), 'updater', null, null, 'explorer', 'Ändere Farbe ...', 0,  getSelectionAsArray().length); return false;\"><img src=\"{$this->getExtension()->getAssetUrl()}icons/grey.png\"></a>"),
     
     		 )),
     		 );
     		 $popupMenu->setItems($items);
     		 $popupMenu->setPosition(round($this->x + $this->width - 155) . "px", round($this->y + $this->height + 4) . "px");
     		 $popupMenu->setWidth("180px");
     		 }*/
     $popupMenu->setItems($items);
     $popupMenu->setPosition(round($this->x + $this->width - 155) . "px", round($this->y + $this->height + 4) . "px");
     $popupMenu->setWidth("180px");
     $ajaxResponseObject->setStatus("ok");
     $ajaxResponseObject->addWidget($popupMenu);
     return $ajaxResponseObject;
 }
Example #17
0
        $JsonSimilar[] = array('artistId' => (int) $Similar['ArtistID'], 'name' => $Similar['Name'], 'score' => (int) $Similar['Score'], 'similarId' => (int) $Similar['SimilarID']);
    }
}
$JsonRequests = array();
foreach ($Requests as $RequestID => $Request) {
    $JsonRequests[] = array('requestId' => (int) $RequestID, 'categoryId' => (int) $Request['CategoryID'], 'title' => $Request['Title'], 'year' => (int) $Request['Year'], 'timeAdded' => $Request['TimeAdded'], 'votes' => (int) $Request['Votes'], 'bounty' => (int) $Request['Bounty']);
}
//notifications disabled by default
$notificationsEnabled = false;
if (check_perms('site_torrents_notify')) {
    if (($Notify = $Cache->get_value('notify_artists_' . $LoggedUser['ID'])) === false) {
        $DB->query("\n\t\t\tSELECT ID, Artists\n\t\t\tFROM users_notify_filters\n\t\t\tWHERE UserID = '{$LoggedUser['ID']}'\n\t\t\t\tAND Label = 'Artist notifications'\n\t\t\tLIMIT 1");
        $Notify = $DB->next_record(MYSQLI_ASSOC, false);
        $Cache->cache_value('notify_artists_' . $LoggedUser['ID'], $Notify, 0);
    }
    if (stripos($Notify['Artists'], "|{$Name}|") === false) {
        $notificationsEnabled = false;
    } else {
        $notificationsEnabled = true;
    }
}
// Cache page for later use
if ($RevisionID) {
    $Key = "artist_{$ArtistID}" . "_revision_{$RevisionID}";
} else {
    $Key = "artist_{$ArtistID}";
}
$Data = array(array($Name, $Image, $Body, $NumSimilar, $SimilarArray, array(), array(), $VanityHouseArtist));
$Cache->cache_value($Key, $Data, 3600);
json_print("success", array('id' => (int) $ArtistID, 'name' => $Name, 'notificationsEnabled' => $notificationsEnabled, 'hasBookmarked' => Bookmarks::has_bookmarked('artist', $ArtistID), 'image' => $Image, 'body' => Text::full_format($Body), 'vanityHouse' => $VanityHouseArtist == 1, 'tags' => array_values($Tags), 'similarArtists' => $JsonSimilar, 'statistics' => array('numGroups' => $NumGroups, 'numTorrents' => $NumTorrents, 'numSeeders' => $NumSeeders, 'numLeechers' => $NumLeechers, 'numSnatches' => $NumSnatches), 'torrentgroup' => $JsonTorrents, 'requests' => $JsonRequests));
Example #18
0
function generate_torrent_table($Caption, $Tag, $Details, $Limit)
{
    global $LoggedUser, $Categories, $ReleaseTypes, $GroupBy;
    ?>
		<h3>Top <?php 
    echo "{$Limit} {$Caption}";
    if (empty($_GET['advanced'])) {
        ?>
		<small class="top10_quantity_links">
<?php 
        switch ($Limit) {
            case 100:
                ?>
				- <a href="top10.php?details=<?php 
                echo $Tag;
                ?>
" class="brackets">Top 10</a>
				- <span class="brackets">Top 100</span>
				- <a href="top10.php?type=torrents&amp;limit=250&amp;details=<?php 
                echo $Tag;
                ?>
" class="brackets">Top 250</a>
<?php 
                break;
            case 250:
                ?>
				- <a href="top10.php?details=<?php 
                echo $Tag;
                ?>
" class="brackets">Top 10</a>
				- <a href="top10.php?type=torrents&amp;limit=100&amp;details=<?php 
                echo $Tag;
                ?>
" class="brackets">Top 100</a>
				- <span class="brackets">Top 250</span>
<?php 
                break;
            default:
                ?>
				- <span class="brackets">Top 10</span>
				- <a href="top10.php?type=torrents&amp;limit=100&amp;details=<?php 
                echo $Tag;
                ?>
" class="brackets">Top 100</a>
				- <a href="top10.php?type=torrents&amp;limit=250&amp;details=<?php 
                echo $Tag;
                ?>
" class="brackets">Top 250</a>
<?php 
        }
        ?>
		</small>
<?php 
    }
    ?>
		</h3>
	<table class="torrent_table cats numbering border">
	<tr class="colhead">
		<td class="center" style="width: 15px;"></td>
		<td class="cats_col"></td>
		<td>Name</td>
		<td style="text-align: right;">Size</td>
		<td style="text-align: right;">Data</td>
		<td style="text-align: right;" class="sign snatches"><img src="static/styles/<?php 
    echo $LoggedUser['StyleName'];
    ?>
/images/snatched.png" alt="Snatches" title="Snatches" class="tooltip" /></td>
		<td style="text-align: right;" class="sign seeders"><img src="static/styles/<?php 
    echo $LoggedUser['StyleName'];
    ?>
/images/seeders.png" alt="Seeders" title="Seeders" class="tooltip" /></td>
		<td style="text-align: right;" class="sign leechers"><img src="static/styles/<?php 
    echo $LoggedUser['StyleName'];
    ?>
/images/leechers.png" alt="Leechers" title="Leechers" class="tooltip" /></td>
		<td style="text-align: right;">Peers</td>
	</tr>
<?php 
    // Server is already processing a top10 query. Starting another one will make things slow
    if ($Details === false) {
        ?>
		<tr class="rowb">
			<td colspan="9" class="center">
				Server is busy processing another top list request. Please try again in a minute.
			</td>
		</tr>
		</table><br />
<?php 
        return;
    }
    // in the unlikely event that query finds 0 rows...
    if (empty($Details)) {
        ?>
		<tr class="rowb">
			<td colspan="9" class="center">
				Found no torrents matching the criteria.
			</td>
		</tr>
		</table><br />
<?php 
        return;
    }
    $Rank = 0;
    foreach ($Details as $Detail) {
        $GroupIDs[] = $Detail[1];
    }
    $Artists = Artists::get_artists($GroupIDs);
    foreach ($Details as $Detail) {
        list($TorrentID, $GroupID, $GroupName, $GroupCategoryID, $WikiImage, $TagsList, $Format, $Encoding, $Media, $Scene, $HasLog, $HasCue, $LogScore, $Year, $GroupYear, $RemasterTitle, $Snatched, $Seeders, $Leechers, $Data, $ReleaseType, $Size) = $Detail;
        $IsBookmarked = Bookmarks::has_bookmarked('torrent', $GroupID);
        $IsSnatched = Torrents::has_snatched($TorrentID);
        // highlight every other row
        $Rank++;
        $Highlight = $Rank % 2 ? 'a' : 'b';
        // generate torrent's title
        $DisplayName = '';
        if (!empty($Artists[$GroupID])) {
            $DisplayName = Artists::display_artists($Artists[$GroupID], true, true);
        }
        $DisplayName .= "<a href=\"torrents.php?id={$GroupID}&amp;torrentid={$TorrentID}\" class=\"tooltip\" title=\"View torrent\" dir=\"ltr\">{$GroupName}</a>";
        if ($GroupCategoryID == 1 && $GroupYear > 0) {
            $DisplayName .= " [{$GroupYear}]";
        }
        if ($GroupCategoryID == 1 && $ReleaseType > 0) {
            $DisplayName .= ' [' . $ReleaseTypes[$ReleaseType] . ']';
        }
        // append extra info to torrent title
        $ExtraInfo = '';
        $AddExtra = '';
        if (empty($GroupBy)) {
            if ($Format) {
                $ExtraInfo .= $Format;
                $AddExtra = ' / ';
            }
            if ($Encoding) {
                $ExtraInfo .= $AddExtra . $Encoding;
                $AddExtra = ' / ';
            }
            // "FLAC / Lossless / Log (100%) / Cue / CD";
            if ($HasLog) {
                $ExtraInfo .= $AddExtra . 'Log (' . $LogScore . '%)';
                $AddExtra = ' / ';
            }
            if ($HasCue) {
                $ExtraInfo .= $AddExtra . 'Cue';
                $AddExtra = ' / ';
            }
            if ($Media) {
                $ExtraInfo .= $AddExtra . $Media;
                $AddExtra = ' / ';
            }
            if ($Scene) {
                $ExtraInfo .= $AddExtra . 'Scene';
                $AddExtra = ' / ';
            }
            if ($Year > 0) {
                $ExtraInfo .= $AddExtra . $Year;
                $AddExtra = ' ';
            }
            if ($RemasterTitle) {
                $ExtraInfo .= $AddExtra . $RemasterTitle;
            }
            if ($IsSnatched) {
                if ($GroupCategoryID == 1) {
                    $ExtraInfo .= ' / ';
                }
                $ExtraInfo .= Format::torrent_label('Snatched!');
            }
            if ($ExtraInfo != '') {
                $ExtraInfo = "- [{$ExtraInfo}]";
            }
        }
        $TorrentTags = new Tags($TagsList);
        //Get report info, use the cache if available, if not, add to it.
        $Reported = false;
        $Reports = Torrents::get_reports($TorrentID);
        if (count($Reports) > 0) {
            $Reported = true;
        }
        // print row
        ?>
	<tr class="torrent row<?php 
        echo $Highlight . ($IsBookmarked ? ' bookmarked' : '') . ($IsSnatched ? ' snatched_torrent' : '');
        ?>
">
		<td style="padding: 8px; text-align: center;"><strong><?php 
        echo $Rank;
        ?>
</strong></td>
		<td class="center cats_col"><div title="<?php 
        echo $TorrentTags->title();
        ?>
" class="tooltip <?php 
        echo Format::css_category($GroupCategoryID);
        ?>
 <?php 
        echo $TorrentTags->css_name();
        ?>
"></div></td>
		<td class="big_info">
<?php 
        if ($LoggedUser['CoverArt']) {
            ?>
			<div class="group_image float_left clear">
				<?php 
            ImageTools::cover_thumb($WikiImage, $GroupCategoryID);
            ?>
			</div>
<?php 
        }
        ?>
			<div class="group_info clear">

				<span><a href="torrents.php?action=download&amp;id=<?php 
        echo $TorrentID;
        ?>
&amp;authkey=<?php 
        echo $LoggedUser['AuthKey'];
        ?>
&amp;torrent_pass=<?php 
        echo $LoggedUser['torrent_pass'];
        ?>
" title="Download" class="brackets tooltip">DL</a></span>

				<strong><?php 
        echo $DisplayName;
        ?>
</strong> <?php 
        echo $ExtraInfo;
        if ($Reported) {
            ?>
 - <strong class="torrent_label tl_reported">Reported</strong><?php 
        }
        if ($IsBookmarked) {
            ?>
				<span class="remove_bookmark float_right">
					<a href="#" id="bookmarklink_torrent_<?php 
            echo $GroupID;
            ?>
" class="bookmarklink_torrent_<?php 
            echo $GroupID;
            ?>
 brackets" onclick="Unbookmark('torrent', <?php 
            echo $GroupID;
            ?>
, 'Bookmark'); return false;">Remove bookmark</a>
				</span>
<?php 
        } else {
            ?>
				<span class="add_bookmark float_right">
					<a href="#" id="bookmarklink_torrent_<?php 
            echo $GroupID;
            ?>
" class="bookmarklink_torrent_<?php 
            echo $GroupID;
            ?>
 brackets" onclick="Bookmark('torrent', <?php 
            echo $GroupID;
            ?>
, 'Remove bookmark'); return false;">Bookmark</a>
				</span>
<?php 
        }
        ?>
				<div class="tags"><?php 
        echo $TorrentTags->format();
        ?>
</div>
			</div>
		</td>
		<td class="number_column nobr"><?php 
        echo Format::get_size($Size);
        ?>
</td>
		<td class="number_column nobr"><?php 
        echo Format::get_size($Data);
        ?>
</td>
		<td class="number_column"><?php 
        echo number_format((double) $Snatched);
        ?>
</td>
		<td class="number_column"><?php 
        echo number_format((double) $Seeders);
        ?>
</td>
		<td class="number_column"><?php 
        echo number_format((double) $Leechers);
        ?>
</td>
		<td class="number_column"><?php 
        echo number_format($Seeders + $Leechers);
        ?>
</td>
	</tr>
<?php 
    }
    //foreach ($Details as $Detail)
    ?>
	</table><br />
<?php 
}
Example #19
0
<?php

require_once '../functions.php';
require_once 'bookmarks.php';
Bookmarks::action(getAction());
Example #20
0
}
$GroupID = $TorrentDetails['ID'];
$ArtistForm = Artists::get_artist($GroupID);
if ($TorrentDetails['CategoryID'] == 0) {
    $CategoryName = "Unknown";
} else {
    $CategoryName = $Categories[$TorrentDetails['CategoryID'] - 1];
}
$JsonMusicInfo = array();
if ($CategoryName == "Music") {
    $JsonMusicInfo = array('composers' => $ArtistForm[4] == null ? array() : pullmediainfo($ArtistForm[4]), 'dj' => $ArtistForm[6] == null ? array() : pullmediainfo($ArtistForm[6]), 'artists' => $ArtistForm[1] == null ? array() : pullmediainfo($ArtistForm[1]), 'with' => $ArtistForm[2] == null ? array() : pullmediainfo($ArtistForm[2]), 'conductor' => $ArtistForm[5] == null ? array() : pullmediainfo($ArtistForm[5]), 'remixedBy' => $ArtistForm[3] == null ? array() : pullmediainfo($ArtistForm[3]), 'producer' => $ArtistForm[7] == null ? array() : pullmediainfo($ArtistForm[7]));
} else {
    $JsonMusicInfo = null;
}
$TagList = explode('|', $TorrentDetails['GROUP_CONCAT(DISTINCT tags.Name SEPARATOR \'|\')']);
$JsonTorrentDetails = array('wikiBody' => Text::full_format($TorrentDetails['WikiBody']), 'wikiImage' => $TorrentDetails['WikiImage'], 'id' => (int) $TorrentDetails['ID'], 'name' => $TorrentDetails['Name'], 'year' => (int) $TorrentDetails['Year'], 'recordLabel' => $TorrentDetails['RecordLabel'], 'catalogueNumber' => $TorrentDetails['CatalogueNumber'], 'releaseType' => (int) $TorrentDetails['ReleaseType'], 'categoryId' => (int) $TorrentDetails['CategoryID'], 'categoryName' => $CategoryName, 'time' => $TorrentDetails['Time'], 'vanityHouse' => $TorrentDetails['VanityHouse'] == 1, 'isBookmarked' => Bookmarks::has_bookmarked('torrent', $GroupID), 'musicInfo' => $JsonMusicInfo, 'tags' => $TagList);
$Torrent = $TorrentList[$TorrentID];
$Reports = Torrents::get_reports($TorrentID);
if (count($Reports) > 0) {
    $Torrent['Reported'] = true;
} else {
    $Torrent['Reported'] = false;
}
// Convert file list back to the old format
$FileList = explode("\n", $Torrent['FileList']);
foreach ($FileList as &$File) {
    $File = Torrents::filelist_old_format($File);
}
unset($File);
$FileList = implode('|||', $FileList);
$Userinfo = Users::user_info($Torrent['UserID']);
Example #21
0
}
if ($binaryBookmarksExist) {
    # If the binary file exists
    $fp = fopen('bookmarks.bin', 'r');
    $contents = fread($fp, filesize('bookmarks.bin'));
    fclose($fp);
    # Unserializing contents
    $bookmarks = unserialize(gzinflate($contents));
    # Checking if the bookmarks file is the same
    if ($bookmarks->bookmarksFileMd5 != md5_file('bookmarks.html')) {
        $shouldReparseBookmarks = true;
    }
}
if (!$binaryBookmarksExist || $shouldReparseBookmarks) {
    # Creating new bookmarks
    $bookmarks = new Bookmarks();
    $bookmarks->parse('bookmarks.html');
    $bookmarks->bookmarksFileMd5 = md5_file('bookmarks.html');
    # Writting icons
    $bookmarks->iconset->writeIcons();
    # Writing bookmarks to a binary file
    $contents = gzdeflate(serialize($bookmarks), 9);
    $fp = fopen('bookmarks.bin', 'w+');
    fwrite($fp, $contents);
    fclose($fp);
}
$currentDepth = 0;
$tt = 0;
$counter = 1;
while ($bookmarks->hasMoreItems()) {
    $item = $bookmarks->getNextElement();
Example #22
0
<?php

authorize();
if ($UserID != $LoggedUser['ID'] || !Bookmarks::can_bookmark('torrent')) {
    error(403);
}
if ($_POST['type'] === 'torrents') {
    // require_once SERVER_ROOT.'/classes/mass_user_bookmarks_editor.class.php'; //Bookmark Updater Class
    $BU = new MASS_USER_BOOKMARKS_EDITOR();
    if ($_POST['delete']) {
        $BU->mass_remove();
    } elseif ($_POST['update']) {
        $BU->mass_update();
    }
}
header('Location: bookmarks.php?type=torrents');
Example #23
0
<?php

include SERVER_ROOT . '/classes/feed.class.php';
// RSS feeds
authorize();
if (!Bookmarks::can_bookmark($_GET['type'])) {
    error(404);
}
$Feed = new FEED();
$Type = $_GET['type'];
list($Table, $Col) = Bookmarks::bookmark_schema($Type);
if (!is_number($_GET['id'])) {
    error(0);
}
$PageID = $_GET['id'];
$DB->query("\n\tSELECT UserID\n\tFROM {$Table}\n\tWHERE UserID = '{$LoggedUser['ID']}'\n\t\tAND {$Col} = {$PageID}");
if (!$DB->has_results()) {
    if ($Type === 'torrent') {
        $DB->query("\n\t\t\tSELECT MAX(Sort)\n\t\t\tFROM `bookmarks_torrents`\n\t\t\tWHERE UserID = {$LoggedUser['ID']}");
        list($Sort) = $DB->next_record();
        if (!$Sort) {
            $Sort = 0;
        }
        $Sort += 1;
        $DB->query("\n\t\t\tINSERT IGNORE INTO {$Table} (UserID, {$Col}, Time, Sort)\n\t\t\tVALUES ('{$LoggedUser['ID']}', {$PageID}, '" . sqltime() . "', {$Sort})");
    } else {
        $DB->query("\n\t\t\tINSERT IGNORE INTO {$Table} (UserID, {$Col}, Time)\n\t\t\tVALUES ('{$LoggedUser['ID']}', {$PageID}, '" . sqltime() . "')");
    }
    $Cache->delete_value('bookmarks_' . $Type . '_' . $LoggedUser['ID']);
    if ($Type == 'torrent') {
        $Cache->delete_value("bookmarks_group_ids_{$UserID}");
Example #24
0
 private function renderBookMarks($id)
 {
     $app = Yii::app();
     if ($app->user->isGuest) {
         $user_id = 1;
     } else {
         $user_id = $app->user->id;
     }
     if ($id > 0) {
         $modelSection = $app->cache->get(BookmarksSections::CACHE_SECTION . $id . $app->user->id);
         if ($modelSection === false) {
             $modelSection = BookmarksSections::model()->findByPk($id);
             $app->cache->set(BookmarksSections::CACHE_SECTION . $id . $app->user->id, $modelSection, $app->params['cache_duration']);
         }
         $title = $modelSection->name;
     } else {
         $title = 'Популярные закладки';
     }
     $dataProvider = $app->cache->get(Bookmarks::CACHE_BOOKMARKS_LIST . $id . $app->user->id);
     if ($dataProvider === false) {
         $model = new Bookmarks();
         $model->section_id = $id;
         $model->user_id = $user_id;
         $dataProvider = $model->search();
         $app->cache->set(Bookmarks::CACHE_BOOKMARKS_LIST . $id . $app->user->id, $dataProvider, $app->params['cache_duration']);
     }
     $this->render('index', array('app' => $app, 'title' => $title, 'dataProvider' => $dataProvider));
 }
Example #25
0
 public function actionEdit()
 {
     $bookmark = Bookmarks::model()->findByPk(Yii::app()->request->getParam('bkid'));
     if ($bookmark === null) {
         $this->redirect(['index/index']);
     }
     if (Yii::app()->request->isPostRequest) {
         $bookmark->title = Yii::app()->request->getPost('bk_title');
         $bookmark->url = Yii::app()->request->getPost('bk_url');
         $bookmark->note = Yii::app()->request->getPost('bk_note');
         $list = Lists::model()->findByPk(Yii::app()->request->getPost('bk_list'));
         if ($list !== null && $list->user_id == Yii::app()->user->id) {
             $bookmark->list_id = $list->id;
         } else {
             $bookmark->list_id = null;
         }
         $bookmark->save();
         $this->redirect(['index/index']);
     }
     $lists = Yii::app()->user->model->lists;
     $this->render('edit', ['bookmark' => $bookmark, 'lists' => $lists]);
 }
 /**
  * Handle the importation of Firefox HTML bookmarks
  *
  * Use external library firefox/bookmarks.class.php to parse html files
  *
  * @see firefox/bookmarks.class.php
  *
  * @return a list of WpHerissonBookmarks
  */
 public function import()
 {
     $this->preImport();
     include HERISSON_VENDOR_DIR . "firefox/bookmarks.class.php";
     $filename = $this->getFilename();
     // Parsing bookmarks file
     $bookmarks = new \Bookmarks();
     $bookmarks->parse($filename);
     $bookmarks->bookmarksFileMd5 = md5_file($filename);
     $list = array();
     //$page_title = __("Importation results from Firefox bookmarks", HERISSON_TD);
     $i = 0;
     $spacer = "&nbsp;&nbsp;&nbsp;&nbsp;";
     while ($bookmarks->hasMoreItems()) {
         $item = $bookmarks->getNextElement();
         $bookmark = array();
         $bookmark['title'] = $item->name;
         if ($item->_isFolder) {
             $space = str_repeat($spacer, $item->depth - 1);
             $bookmark['prefix'] = $space;
             $bookmark['url'] = "";
             $bookmark['description'] = "";
             $bookmark['is_public'] = 1;
             $bookmark['favicon_image'] = "";
             $bookmark['favicon_url'] = "";
             $bookmark['tags'] = "";
         } else {
             $bookmark['url'] = $item->HREF;
             $bookmark['description'] = "";
             $bookmark['is_public'] = 1;
             $bookmark['favicon_image'] = $item->ICON_DATA;
             $bookmark['favicon_url'] = $item->ICON_URI;
             $bookmark['tags'] = "";
         }
         $list[] = $bookmark;
     }
     unset($bookmarks);
     return $list;
 }
Example #27
0
</a>
<?php 
}
if (check_perms('site_collages_delete') || check_perms('site_edit_wiki') && !$Locked) {
    ?>
			<a href="collages.php?action=edit&amp;collageid=<?php 
    echo $CollageID;
    ?>
" class="brackets">Edit description</a>
<?php 
} else {
    ?>
			<span class="brackets">Locked</span>
<?php 
}
if (Bookmarks::has_bookmarked('collage', $CollageID)) {
    ?>
			<a href="#" id="bookmarklink_collage_<?php 
    echo $CollageID;
    ?>
" class="brackets" onclick="Unbookmark('collage', <?php 
    echo $CollageID;
    ?>
, 'Bookmark'); return false;">Remove bookmark</a>
<?php 
} else {
    ?>
			<a href="#" id="bookmarklink_collage_<?php 
    echo $CollageID;
    ?>
" class="brackets" onclick="Bookmark('collage', <?php 
Example #28
0
<?php 
if ($RevisionID && check_perms('site_edit_wiki')) {
    ?>
			<a href="torrents.php?action=revert&amp;groupid=<?php 
    echo $GroupID;
    ?>
&amp;revisionid=<?php 
    echo $RevisionID;
    ?>
&amp;auth=<?php 
    echo $LoggedUser['AuthKey'];
    ?>
" class="brackets">Revert to this revision</a>
<?php 
}
if (Bookmarks::has_bookmarked('torrent', $GroupID)) {
    ?>
			<a href="#" id="bookmarklink_torrent_<?php 
    echo $GroupID;
    ?>
" class="remove_bookmark brackets" onclick="Unbookmark('torrent', <?php 
    echo $GroupID;
    ?>
, 'Bookmark'); return false;">Remove bookmark</a>
<?php 
} else {
    ?>
			<a href="#" id="bookmarklink_torrent_<?php 
    echo $GroupID;
    ?>
" class="add_bookmark brackets" onclick="Bookmark('torrent', <?php 
Example #29
0
     httpResponse($blocked->create($postdata));
     break;
 case validateRoute('DELETE', 'blocked/\\d+'):
     $blocked = new Blocked($db, $user);
     httpResponse($blocked->delete((int) $params[1]));
     break;
 case validateRoute('GET', 'bookmarks'):
     $bookmarks = new Bookmarks($db, $user);
     httpResponse($bookmarks->query(null));
     break;
 case validateRoute('POST', 'bookmarks'):
     $bookmarks = new Bookmarks($db, $user);
     httpResponse($bookmarks->create($postdata));
     break;
 case validateRoute('DELETE', 'bookmarks/\\d+'):
     $bookmarks = new Bookmarks($db, $user);
     httpResponse($bookmarks->delete((int) $params[1]));
     break;
 case validateRoute('GET', 'subtitles'):
     $subtitles = new Subtitles($db, $user);
     httpResponse($subtitles->fetch($_GET["torrentid"]));
     break;
 case validateRoute('POST', 'subtitles'):
     $torrent = new Torrent($db, $user);
     $log = new Logs($db);
     $mailbox = new Mailbox($db, $user);
     $subtitles = new Subtitles($db, $user, $log, $torrent, $mailbox);
     httpResponse($subtitles->upload($_FILES["file"], $_POST));
     break;
 case validateRoute('DELETE', 'subtitles/\\d+'):
     $log = new Logs($db);
Example #30
0
$RequestVotes = Requests::get_votes_array($RequestID);
$VoteCount = count($RequestVotes['Voters']);
$ProjectCanEdit = check_perms('project_team') && !$IsFilled && ($CategoryID == 0 || $CategoryName == 'Music' && $Request['Year'] == 0);
$UserCanEdit = !$IsFilled && $LoggedUser['ID'] == $Request['UserID'] && $VoteCount < 2;
$CanEdit = $UserCanEdit || $ProjectCanEdit || check_perms('site_moderate_requests');
if ($CategoryName == "Music") {
    $JsonMusicInfo = array('composers' => isset($ArtistForm[4]) ? pullmediainfo($ArtistForm[4]) : array(), 'dj' => isset($ArtistForm[6]) ? pullmediainfo($ArtistForm[6]) : array(), 'artists' => isset($ArtistForm[1]) ? pullmediainfo($ArtistForm[1]) : array(), 'with' => isset($ArtistForm[2]) ? pullmediainfo($ArtistForm[2]) : array(), 'conductor' => isset($ArtistForm[5]) ? pullmediainfo($ArtistForm[5]) : array(), 'remixedBy' => isset($ArtistForm[3]) ? pullmediainfo($ArtistForm[3]) : array(), 'producer' => isset($ArtistForm[7]) ? pullmediainfo($ArtistForm[7]) : array());
} else {
    $JsonMusicInfo = new stdClass();
    //json_encodes into an empty object: {}
}
$JsonTopContributors = array();
$VoteMax = $VoteCount < 5 ? $VoteCount : 5;
for ($i = 0; $i < $VoteMax; $i++) {
    $User = array_shift($RequestVotes['Voters']);
    $JsonTopContributors[] = array('userId' => (int) $User['UserID'], 'userName' => $User['Username'], 'bounty' => (int) $User['Bounty']);
}
reset($RequestVotes['Voters']);
list($NumComments, $Page, $Thread) = Comments::load('requests', $RequestID, false);
$JsonRequestComments = array();
foreach ($Thread as $Key => $Post) {
    list($PostID, $AuthorID, $AddedTime, $Body, $EditedUserID, $EditedTime, $EditedUsername) = array_values($Post);
    list($AuthorID, $Username, $PermissionID, $Paranoia, $Artist, $Donor, $Warned, $Avatar, $Enabled, $UserTitle) = array_values(Users::user_info($AuthorID));
    $JsonRequestComments[] = array('postId' => (int) $PostID, 'authorId' => (int) $AuthorID, 'name' => $Username, 'donor' => $Donor == 1, 'warned' => $Warned != '0000-00-00 00:00:00', 'enabled' => $Enabled == 2 ? false : true, 'class' => Users::make_class_string($PermissionID), 'addedTime' => $AddedTime, 'avatar' => $Avatar, 'comment' => Text::full_format($Body), 'editedUserId' => (int) $EditedUserID, 'editedUsername' => $EditedUsername, 'editedTime' => $EditedTime);
}
$JsonTags = array();
foreach ($Request['Tags'] as $Tag) {
    $JsonTags[] = $Tag;
}
json_print('success', array('requestId' => (int) $RequestID, 'requestorId' => (int) $Request['UserID'], 'requestorName' => $Requestor['Username'], 'isBookmarked' => Bookmarks::has_bookmarked('request', $RequestID), 'requestTax' => $RequestTax, 'timeAdded' => $Request['TimeAdded'], 'canEdit' => $CanEdit, 'canVote' => $CanVote, 'minimumVote' => $MinimumVote, 'voteCount' => $VoteCount, 'lastVote' => $Request['LastVote'], 'topContributors' => $JsonTopContributors, 'totalBounty' => (int) $RequestVotes['TotalBounty'], 'categoryId' => (int) $CategoryID, 'categoryName' => $CategoryName, 'title' => $Request['Title'], 'year' => (int) $Request['Year'], 'image' => $Request['Image'], 'bbDescription' => $Request['Description'], 'description' => Text::full_format($Request['Description']), 'musicInfo' => $JsonMusicInfo, 'catalogueNumber' => $Request['CatalogueNumber'], 'releaseType' => (int) $Request['ReleaseType'], 'releaseName' => $ReleaseName, 'bitrateList' => preg_split('/\\|/', $Request['BitrateList'], null, PREG_SPLIT_NO_EMPTY), 'formatList' => preg_split('/\\|/', $Request['FormatList'], null, PREG_SPLIT_NO_EMPTY), 'mediaList' => preg_split('/\\|/', $Request['MediaList'], null, PREG_SPLIT_NO_EMPTY), 'logCue' => html_entity_decode($Request['LogCue']), 'isFilled' => $IsFilled, 'fillerId' => (int) $Request['FillerID'], 'fillerName' => $Filler ? $Filler['Username'] : '', 'torrentId' => (int) $Request['TorrentID'], 'timeFilled' => $Request['TimeFilled'], 'tags' => $JsonTags, 'comments' => $JsonRequestComments, 'commentPage' => (int) $Page, 'commentPages' => (int) ceil($NumComments / TORRENT_COMMENTS_PER_PAGE), 'recordLabel' => $Request['RecordLabel'], 'oclc' => $Request['OCLC']));