/**
  * @see Page::show()
  */
 public function show()
 {
     // Set active header menu item
     require_once WCF_DIR . 'lib/page/util/menu/PageMenu.class.php';
     require_once WCF_DIR . 'lib/page/util/menu/HeaderMenu.class.php';
     PageMenu::setActiveMenuItem('wcf.header.menu.aboutmepage');
     parent::show();
 }
 /**
  * Initialises the page header menu.
  */
 protected static function initPageMenu()
 {
     require_once WCF_DIR . 'lib/page/util/menu/PageMenu.class.php';
     self::$pageMenuObj = new PageMenu();
     if (PageMenu::getActiveMenuItem() == '') {
         PageMenu::setActiveMenuItem('contest.header.menu.contest');
     }
 }
 /**
  * 
  */
 public function show()
 {
     require_once WCF_DIR . 'lib/page/util/menu/PageMenu.class.php';
     if (PageMenu::getActiveMenuItem() == '') {
         PageMenu::setActiveMenuItem('bash.header.menu.random');
     }
     parent::show();
 }
 /**
  * @see Page::show()
  */
 public function show()
 {
     if (!MODULE_CHEAT_DATABASE) {
         throw new IllegalLinkException();
     }
     PageMenu::setActiveMenuItem('wcf.header.menu.cheatDatabase');
     parent::show();
 }
 /**
  * @see	Page::show()
  */
 public function show()
 {
     if ($this->page->menuItemID) {
         // page menu
         require_once WCF_DIR . 'lib/page/util/menu/PageMenu.class.php';
         PageMenu::setActiveMenuItem('wcf.header.menu.host' . $this->page->hostID . '.page' . $this->page->pageID);
     }
     parent::show();
 }
Example #6
0
 /**
  * Model constructor.
  * @param $title
  */
 public function __construct($title)
 {
     $this->title = $title;
     $this->isAuthenticated = Authentication::isAuthenticated();
     if ($this->isAuthenticated) {
         $this->authenticatedUserEntity = Authentication::getUserEntity();
     }
     $this->pageMenu = PageMenu::getPageMenu();
 }
 /**
  * @see Page::show()
  */
 public function show()
 {
     // set active menu item
     require_once WCF_DIR . 'lib/page/util/menu/PageMenu.class.php';
     PageMenu::setActiveMenuItem('wcf.header.menu.versionChecker');
     // check permission
     WCF::getUser()->checkPermission('user.managepages.canViewversionChecker');
     // show form
     parent::show();
 }
 /**
  * @see Form::show()
  */
 public function show()
 {
     // set active header menu item
     PageMenu::setActiveMenuItem('wcf.header.menu.user.contest');
     // set active menu item
     ContestMenu::getInstance()->setContest($this->entry);
     ContestMenu::getInstance()->setActiveMenuItem('wcf.contest.menu.link.overview');
     // check permission
     WCF::getUser()->checkPermission('user.contest.canViewContest');
     if (!MODULE_CONTEST) {
         throw new IllegalLinkException();
     }
     parent::show();
 }
 /**
  * Initializes the profile.
  */
 public function init()
 {
     // call init event
     EventHandler::fireAction($this, 'init');
     // get user information
     if (!empty($this->userID)) {
         $this->user = new UserProfile($this->userID, null, null, null, $this->sqlSelects, $this->sqlJoins);
     } else {
         if (!empty($this->username)) {
             $this->user = new UserProfile(null, null, $this->username, null, $this->sqlSelects, $this->sqlJoins);
         } else {
             throw new IllegalLinkException();
         }
     }
     if (!$this->user->userID) {
         throw new IllegalLinkException();
     }
     $this->userID = $this->user->userID;
     $this->username = $this->user->username;
     // set page menu
     PageMenu::setActiveMenuItem('wcf.header.menu.memberslist');
     // set user profile menu
     UserProfileMenu::getInstance()->userID = $this->userID;
     // user symbols
     $this->initUserSymbols();
     // friends
     if (WCF::getUser()->userID) {
         if (WCF::getUser()->userID != $this->userID) {
             // get friend connection
             $connectionUserIDArray = array();
             if ($this->user->buddy) {
                 $connectionUserIDArray[] = WCF::getUser()->userID;
             } else {
                 if (WCF::getUser()->buddies) {
                     // one step
                     $sql = "SELECT\t\tfriends_2nd.userID\n\t\t\t\t\t\tFROM\t\twcf" . WCF_N . "_user_whitelist my_friends,\n\t\t\t\t\t\t\t\twcf" . WCF_N . "_user_whitelist friends_2nd\n\t\t\t\t\t\tWHERE\t\tmy_friends.userID = " . WCF::getUser()->userID . " AND my_friends.confirmed = 1\n\t\t\t\t\t\t\t\tAND friends_2nd.userID = my_friends.whiteUserID AND friends_2nd.confirmed = 1\n\t\t\t\t\t\t\t\tAND friends_2nd.whiteUserID = " . $this->userID;
                     $row = WCF::getDB()->getFirstRow($sql);
                     if (!empty($row['userID'])) {
                         $connectionUserIDArray[] = WCF::getUser()->userID;
                         $connectionUserIDArray[] = $row['userID'];
                     } else {
                         // two steps
                         $sql = "SELECT\t\tfriends_2nd.userID AS 1st, friends_3rd.userID AS 2nd\n\t\t\t\t\t\t\tFROM\t\twcf" . WCF_N . "_user_whitelist my_friends,\n\t\t\t\t\t\t\t\t\twcf" . WCF_N . "_user_whitelist friends_2nd,\n\t\t\t\t\t\t\t\t\twcf" . WCF_N . "_user_whitelist friends_3rd\n\t\t\t\t\t\t\tWHERE\t\tmy_friends.userID = " . WCF::getUser()->userID . " AND my_friends.confirmed = 1\n\t\t\t\t\t\t\t\t\tAND friends_2nd.userID = my_friends.whiteUserID AND friends_2nd.confirmed = 1\n\t\t\t\t\t\t\t\t\tAND friends_3rd.userID = friends_2nd.whiteUserID AND friends_3rd.confirmed = 1\n\t\t\t\t\t\t\t\t\tAND friends_3rd.whiteUserID = " . $this->userID;
                         $row = WCF::getDB()->getFirstRow($sql);
                         if (!empty($row['1st'])) {
                             $connectionUserIDArray[] = WCF::getUser()->userID;
                             $connectionUserIDArray[] = $row['1st'];
                             $connectionUserIDArray[] = $row['2nd'];
                         } else {
                             // three steps
                             $sql = "SELECT\t\tfriends_2nd.userID AS 1st, friends_3rd.userID AS 2nd, friends_4th.userID AS 3rd\n\t\t\t\t\t\t\t\tFROM\t\twcf" . WCF_N . "_user_whitelist my_friends,\n\t\t\t\t\t\t\t\t\t\twcf" . WCF_N . "_user_whitelist friends_2nd,\n\t\t\t\t\t\t\t\t\t\twcf" . WCF_N . "_user_whitelist friends_3rd,\n\t\t\t\t\t\t\t\t\t\twcf" . WCF_N . "_user_whitelist friends_4th\n\t\t\t\t\t\t\t\tWHERE\t\tmy_friends.userID = " . WCF::getUser()->userID . " AND my_friends.confirmed = 1\n\t\t\t\t\t\t\t\t\t\tAND friends_2nd.userID = my_friends.whiteUserID AND friends_2nd.confirmed = 1\n\t\t\t\t\t\t\t\t\t\tAND friends_3rd.userID = friends_2nd.whiteUserID AND friends_3rd.confirmed = 1\n\t\t\t\t\t\t\t\t\t\tAND friends_4th.userID = friends_3rd.whiteUserID AND friends_4th.confirmed = 1\n\t\t\t\t\t\t\t\t\t\tAND friends_4th.whiteUserID = " . $this->userID;
                             $row = WCF::getDB()->getFirstRow($sql);
                             if (!empty($row['1st'])) {
                                 $connectionUserIDArray[] = WCF::getUser()->userID;
                                 $connectionUserIDArray[] = $row['1st'];
                                 $connectionUserIDArray[] = $row['2nd'];
                                 $connectionUserIDArray[] = $row['3rd'];
                             }
                             /*else {
                             			// four steps
                             			$sql = "SELECT		friends_2nd.userID AS 1st, friends_3rd.userID AS 2nd, friends_4th.userID AS 3rd, friends_5th.userID AS 4th
                             				FROM		wcf".WCF_N."_user_whitelist my_friends,
                             						wcf".WCF_N."_user_whitelist friends_2nd,
                             						wcf".WCF_N."_user_whitelist friends_3rd,
                             						wcf".WCF_N."_user_whitelist friends_4th,
                             						wcf".WCF_N."_user_whitelist friends_5th
                             				WHERE		my_friends.userID = ".WCF::getUser()->userID." AND my_friends.confirmed = 1
                             						AND friends_2nd.userID = my_friends.whiteUserID AND friends_2nd.confirmed = 1
                             						AND friends_3rd.userID = friends_2nd.whiteUserID AND friends_3rd.confirmed = 1
                             						AND friends_4th.userID = friends_3rd.whiteUserID AND friends_4th.confirmed = 1
                             						AND friends_5th.userID = friends_4th.whiteUserID AND friends_5th.confirmed = 1
                             						AND friends_5th.whiteUserID = ".$this->userID;
                             			$row = WCF::getDB()->getFirstRow($sql);
                             			if (!empty($row['1st'])) {
                             				$connectionUserIDArray[] = WCF::getUser()->userID;
                             				$connectionUserIDArray[] = $row['1st'];
                             				$connectionUserIDArray[] = $row['2nd'];
                             				$connectionUserIDArray[] = $row['3rd'];
                             				$connectionUserIDArray[] = $row['4th'];
                             			}
                             		}*/
                         }
                     }
                 }
             }
             if (count($connectionUserIDArray) > 0) {
                 $sql = "SELECT\t\tavatar.*, user_table.*\n\t\t\t\t\t\tFROM\t\twcf" . WCF_N . "_user user_table\n\t\t\t\t\t\tLEFT JOIN \twcf" . WCF_N . "_avatar avatar\n\t\t\t\t\t\tON \t\t(avatar.avatarID = user_table.avatarID)\n\t\t\t\t\t\tWHERE\t\tuser_table.userID IN (" . implode(',', $connectionUserIDArray) . ")";
                 $result = WCF::getDB()->sendQuery($sql);
                 while ($row = WCF::getDB()->fetchArray($result)) {
                     $this->connection[array_search($row['userID'], $connectionUserIDArray)] = new UserProfile(null, $row);
                 }
                 // sorting
                 ksort($this->connection);
                 $this->connection = array_reverse($this->connection);
             }
         } else {
             // get network
             $sql = "SELECT\tCOUNT(*) AS count\n\t\t\t\t\tFROM\twcf" . WCF_N . "_user_whitelist\n\t\t\t\t\tWHERE\tuserID = " . $this->userID . "\n\t\t\t\t\t\tAND confirmed = 1";
             $row = WCF::getDB()->getFirstRow($sql);
             if ($row['count']) {
                 $this->network['friends'] = $row['count'];
                 $sql = "SELECT\t\tCOUNT(DISTINCT friends_2nd.whiteUserID) AS count\n\t\t\t\t\t\tFROM\t\twcf" . WCF_N . "_user_whitelist my_friends\n\t\t\t\t\t\tLEFT JOIN\twcf" . WCF_N . "_user_whitelist friends_2nd\n\t\t\t\t\t\tON\t\t(friends_2nd.userID = my_friends.whiteUserID AND friends_2nd.confirmed = 1)\n\t\t\t\t\t\tWHERE\t\tmy_friends.userID = " . $this->userID . "\n\t\t\t\t\t\t\t\tAND my_friends.confirmed = 1";
                 $row = WCF::getDB()->getFirstRow($sql);
                 if ($row['count']) {
                     $this->network['friendsOfFriends'] = $row['count'];
                     $sql = "SELECT\t\tCOUNT(DISTINCT friends_3rd.whiteUserID) AS count\n\t\t\t\t\t\t\tFROM\t\twcf" . WCF_N . "_user_whitelist my_friends\n\t\t\t\t\t\t\tLEFT JOIN\twcf" . WCF_N . "_user_whitelist friends_2nd\n\t\t\t\t\t\t\tON\t\t(friends_2nd.userID = my_friends.whiteUserID AND friends_2nd.confirmed = 1)\n\t\t\t\t\t\t\tLEFT JOIN\twcf" . WCF_N . "_user_whitelist friends_3rd\n\t\t\t\t\t\t\tON\t\t(friends_3rd.userID = friends_2nd.whiteUserID AND friends_3rd.confirmed = 1)\n\t\t\t\t\t\t\tWHERE\t\tmy_friends.userID = " . $this->userID . "\n\t\t\t\t\t\t\t\t\tAND my_friends.confirmed = 1";
                     $row = WCF::getDB()->getFirstRow($sql);
                     if ($row['count']) {
                         $this->network['friends3rdGrade'] = $row['count'];
                     } else {
                         $this->network['friends3rdGrade'] = 0;
                     }
                 } else {
                     $this->network['friendsOfFriends'] = 0;
                 }
             }
         }
     }
     // check permission
     WCF::getUser()->checkPermission('user.profile.canView');
     try {
         if ($this->user->ignoredUser) {
             throw new NamedUserException(WCF::getLanguage()->getDynamicVariable('wcf.user.profile.error.ignoredUser', array('username' => $this->user->username)));
         }
         if (!$this->user->canViewProfile()) {
             throw new NamedUserException(WCF::getLanguage()->getDynamicVariable('wcf.user.profile.error.protectedProfile', array('username' => $this->user->username)));
         }
     } catch (NamedUserException $e) {
         WCF::getTPL()->assign(array('user' => $this->user, 'userID' => $this->userID, 'connection' => $this->connection, 'network' => $this->network, 'userSymbols' => $this->userSymbols, 'errorMessage' => $e->getMessage()));
         WCF::getTPL()->display('userProfileAccessDenied');
         exit;
     }
 }
 /**
  * @see Page::show()
  */
 public function show()
 {
     if (!MODULE_CHEAT_DATABASE) {
         throw new IllegalLinkException();
     }
     PageMenu::setActiveMenuItem('wcf.header.menu.cheatDatabase');
     $this->messageTable = "wcf" . WCF_N . "_cheat_database_entry_message";
     parent::show();
 }
 /**
  * @see Page::show()
  */
 public function show()
 {
     if (MODULE_HELP != 1) {
         throw new IllegalLinkException();
     }
     require_once WCF_DIR . 'lib/page/util/menu/PageMenu.class.php';
     PageMenu::setActiveMenuItem('wcf.header.menu.help');
     if (!count($_POST) && !empty($this->query)) {
         $this->submit();
     }
     parent::show();
 }
 /**
  * Sets the active menu item. 
  * This should be done before the headerMenu.tpl template calls the function getMenu().
  * 
  * This function should be used in each script which uses a template that includes the headerMenu.tpl.
  * 
  * @param	string		$menuItem	name of the active menu item
  */
 public static function setActiveMenuItem($menuItem)
 {
     self::$activeMenuItem = $menuItem;
 }
 /**
  * @see Page::show()
  */
 public function show()
 {
     if (MODULE_HELP != 1) {
         throw new IllegalLinkException();
     }
     require_once WCF_DIR . 'lib/page/util/menu/PageMenu.class.php';
     PageMenu::setActiveMenuItem('wcf.header.menu.help');
     parent::show();
 }
 /**
  * @see Page::show()
  */
 public function show()
 {
     // set active header menu item
     PageMenu::setActiveMenuItem('wcf.header.menu.memberslist');
     // check permission
     WCF::getUser()->checkPermission('user.membersList.canView');
     if (MODULE_MEMBERS_LIST != 1) {
         throw new IllegalLinkException();
     }
     parent::show();
 }
 /**
  * @see Page::show()
  */
 public function show()
 {
     // set active header menu item
     PageMenu::setActiveMenuItem('wcf.header.menu.user.contest');
     if (WCF::getUser()->userID == 0) {
         // forward to login page
         WCF::getTPL()->assign(array('url' => 'index.php?form=UserLogin' . SID_ARG_2ND, 'message' => WCF::getLanguage()->get('wcf.contest.register.message')));
         WCF::getTPL()->display('redirect');
         return;
     }
     // check permission
     WCF::getUser()->checkPermission('user.contest.canUseContest');
     WCF::getUser()->checkPermission('user.contest.canAddContest');
     if (!MODULE_CONTEST) {
         throw new IllegalLinkException();
     }
     // check upload permission
     if (MODULE_ATTACHMENT != 1 || !WCF::getUser()->getPermission('user.contest.canUploadAttachment')) {
         $this->showAttachments = false;
     }
     // get attachments editor
     if ($this->attachmentListEditor == null) {
         require_once WCF_DIR . 'lib/data/attachment/MessageAttachmentListEditor.class.php';
         $this->attachmentListEditor = new MessageAttachmentListEditor(array(), 'contestEntry', WCF::getPackageID('de.easy-coding.wcf.contest'), WCF::getUser()->getPermission('user.contest.maxAttachmentSize'), WCF::getUser()->getPermission('user.contest.allowedAttachmentExtensions'), WCF::getUser()->getPermission('user.contest.maxAttachmentCount'));
     }
     parent::show();
 }
 /**
  * @see Form::show()
  */
 public function show()
 {
     // set active header menu item
     PageMenu::setActiveMenuItem('wcf.header.menu.memberslist');
     // check permission
     WCF::getUser()->checkPermission('user.membersList.canView');
     if (MODULE_MEMBERS_LIST != 1) {
         throw new IllegalLinkException();
     }
     // get user options and categories from cache
     $this->readCache();
     AbstractForm::show();
 }
 /**
  * @see Page::show()
  */
 public function show()
 {
     // set active header menu item
     PageMenu::setActiveMenuItem('wcf.header.menu.user.contest');
     // check permission
     WCF::getUser()->checkPermission('user.contest.canViewContest');
     if (!MODULE_CONTEST) {
         throw new IllegalLinkException();
     }
     parent::show();
 }
 /**
  * List models.
  * @param string topic menu slug
  */
 public function actionIndex($topic = null)
 {
     $this->layout = 'page';
     if ($topic) {
         $menuId = PageMenu::model()->getIdFromSlug($topic, $this->module->slugIdPrefix);
     } else {
         $menuId = PageMenu::model()->firstItemId;
     }
     if ($menuId === null) {
         $this->redirect(array('/site/index'));
     }
     $menu = PageMenu::model()->activeItem()->with('articles')->findbyPk($menuId);
     if ($menu === null) {
         $this->redirect(array('article/index'));
     }
     $this->render('index', array('menu' => $menu));
 }
 /**
  * @see Page::show()
  */
 public function show()
 {
     // check aktiv modul
     if (!MODULE_CONTACT) {
         throw new IllegalLinkException();
     }
     // set active header menu item
     require_once WCF_DIR . 'lib/page/util/menu/PageMenu.class.php';
     PageMenu::setActiveMenuItem('wcf.header.menu.contact');
     parent::show();
 }
Example #20
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  */
 public function loadModel()
 {
     if ($this->_model === null) {
         if (isset($_GET['id'])) {
             $this->_model = PageMenu::model()->active()->findbyPk($_GET['id']);
         }
         if ($this->_model === null) {
             throw new CHttpException(404, 'The requested page does not exist.');
         }
     }
     return $this->_model;
 }
 /**
  * @see Page::show()
  */
 public function show()
 {
     require_once WCF_DIR . 'lib/page/util/menu/PageMenu.class.php';
     PageMenu::setActiveMenuItem('wcf.header.menu.help');
     parent::show();
 }
Example #22
0
<div class="form">

<?php 
$form = $this->beginWidget('CActiveForm', array('id' => 'article-form', 'enableAjaxValidation' => false));
?>

	<?php 
echo $form->errorSummary($model);
?>

	<div class="simple">
		<?php 
echo $form->labelEx($model, 'menu_id');
?>
		<?php 
echo $form->DropDownList($model, 'menu_id', PageMenu::model()->activeItemOptions, array('prompt' => '', 'style' => 'width:250px'));
?>
	</div>

	<div class="simple">
		<?php 
echo $form->labelEx($model, 'title');
?>
		<?php 
echo $form->textField($model, 'title', array('style' => 'width:725px;'));
?>
	</div>

	<div class="simple">
		<?php 
echo $form->labelEx($model, 'content');
Example #23
0
 /**
  * Renders the widget.
  */
 public function run()
 {
     $menuItems = PageMenu::model()->visible()->findAll(array('order' => 'position'));
     if ($this->containerTagName) {
         echo CHtml::openTag($this->containerTagName, $this->containerHtmlOptions);
     }
     if ($this->enableSearch === true) {
         $this->printSearchForm();
     }
     if ($this->enableAdmin === true) {
         $this->printAdminButton();
     }
     echo CHtml::openTag($this->listTagName, array('class' => $this->listCssClass));
     foreach ($menuItems as $menu) {
         echo $this->getMenuTag($menu);
     }
     echo CHtml::closeTag($this->listTagName);
     if ($this->containerTagName) {
         echo CHtml::closeTag($this->containerTagName);
     }
 }
Example #24
0
<?php

$form = $this->beginWidget('CActiveForm', array('action' => Yii::app()->createUrl($this->route), 'method' => 'get'));
?>

	<?php 
echo $form->DropDownList($model, 'menu_id', PageMenu::model()->activeItemOptions, array('submit' => Yii::app()->createUrl($this->route), 'prompt' => Yii::t('PageModule.ui', '-All Articles-'), 'style' => 'width:250px'));
?>

<?php 
$this->endWidget();
 /**
  * @see Page::show()
  */
 public function show()
 {
     // set active header menu item
     PageMenu::setActiveMenuItem('wcf.header.menu.user.contest');
     // set active menu item
     ContestMenu::getInstance()->setContest($this->contest);
     ContestMenu::getInstance()->setActiveMenuItem('wcf.contest.menu.link.solution');
     // check permission
     WCF::getUser()->checkPermission('user.contest.canViewContest');
     if (!MODULE_CONTEST) {
         throw new IllegalLinkException();
     }
     // check upload permission
     if (MODULE_ATTACHMENT != 1 || !WCF::getUser()->getPermission('user.contest.canUploadAttachment')) {
         $this->showAttachments = false;
     }
     // get attachments editor
     if ($this->attachmentListEditor === null) {
         require_once WCF_DIR . 'lib/data/attachment/MessageAttachmentListEditor.class.php';
         $this->attachmentListEditor = new MessageAttachmentListEditor(array(), 'contestSolutionEntry', WCF::getPackageID('de.easy-coding.wcf.contest'), WCF::getUser()->getPermission('user.contest.maxAttachmentSize'), WCF::getUser()->getPermission('user.contest.allowedAttachmentExtensions'), WCF::getUser()->getPermission('user.contest.maxAttachmentCount'));
     }
     parent::show();
 }