/**
     * Displays the main form for removing a gift
     * @return HTML output
     */
    function displayForm()
    {
        global $wgUser, $wgOut, $wgUploadPath;
        $rel = new UserGifts($wgUser->getName());
        $gift = $rel->getUserGift($this->gift_id);
        $user = Title::makeTitle(NS_USER, $gift['user_name_from']);
        $gift_image = '<img src="' . $wgUploadPath . '/awards/' . Gifts::getGiftImage($gift['gift_id'], 'l') . '" border="0" alt="gift" />';
        $output = $wgOut->setPageTitle(wfMsg('g-remove-title', $gift['name']));
        $output .= '<div class="back-links">
			<a href="' . $wgUser->getUserPage()->escapeFullURL() . '">' . wfMsg('g-back-link', $gift['user_name_to']) . '</a>
		</div>
		<form action="" method="post" enctype="multipart/form-data" name="form1">
			<div class="g-remove-message">' . wfMsg('g-remove-message', $gift['name']) . '</div>
			<div class="g-container">' . $gift_image . '<div class="g-name">' . $gift['name'] . '</div>
				<div class="g-from">' . wfMsg('g-from', $user->escapeFullURL(), $gift['user_name_from']) . '</div>';
        if ($gift['message']) {
            $output .= '<div class="g-user-message">' . $gift['message'] . '</div>';
        }
        $output .= '</div>
			<div class="cleared"></div>
			<div class="g-buttons">
				<input type="hidden" name="user" value="' . addslashes($gift['user_name_from']) . '">
				<input type="button" class="site-button" value="' . wfMsg('g-remove') . '" size="20" onclick="document.form1.submit()" />
				<input type="button" class="site-button" value="' . wfMsg('g-cancel') . '" size="20" onclick="history.go(-1)" />
			</div>
		</form>';
        return $output;
    }
Exemplo n.º 2
0
    /**
     * Show the special page
     *
     * @param $par Mixed: parameter passed to the page or null
     */
    public function execute($par)
    {
        global $wgUploadPath;
        $out = $this->getOutput();
        $user = $this->getUser();
        // Set the page title, robot policies, etc.
        $this->setHeaders();
        // Add CSS
        $out->addModuleStyles('ext.socialprofile.usergifts.css');
        $giftId = $this->getRequest()->getInt('gift_id');
        if (!$giftId || !is_numeric($giftId)) {
            $out->setPageTitle($this->msg('g-error-title')->plain());
            $out->addHTML($this->msg('g-error-message-invalid-link')->plain());
            return false;
        }
        $gift = UserGifts::getUserGift($giftId);
        if ($gift) {
            if ($gift['status'] == 1) {
                if ($gift['user_name_to'] == $user->getName()) {
                    $g = new UserGifts($gift['user_name_to']);
                    $g->clearUserGiftStatus($gift['id']);
                    $g->decNewGiftCount($user->getID());
                }
            }
            // DB stuff
            $dbr = wfGetDB(DB_SLAVE);
            $res = $dbr->select('user_gift', array('DISTINCT ug_user_name_to', 'ug_user_id_to', 'ug_date'), array('ug_gift_id' => $gift['gift_id'], 'ug_user_name_to <> ' . $dbr->addQuotes($gift['user_name_to'])), __METHOD__, array('GROUP BY' => 'ug_user_name_to', 'ORDER BY' => 'ug_date DESC', 'LIMIT' => 6));
            $out->setPageTitle($this->msg('g-description-title', $gift['user_name_to'], $gift['name'])->parse());
            $output = '<div class="back-links">
				<a href="' . htmlspecialchars(Title::makeTitle(NS_USER, $gift['user_name_to'])->getFullURL()) . '">' . $this->msg('g-back-link', $gift['user_name_to'])->parse() . '</a>
			</div>';
            $sender = Title::makeTitle(NS_USER, $gift['user_name_from']);
            $removeGiftLink = SpecialPage::getTitleFor('RemoveGift');
            $giveGiftLink = SpecialPage::getTitleFor('GiveGift');
            $giftImage = '<img src="' . $wgUploadPath . '/awards/' . Gifts::getGiftImage($gift['gift_id'], 'l') . '" border="0" alt="" />';
            $message = $out->parse(trim($gift['message']), false);
            $output .= '<div class="g-description-container">';
            $output .= '<div class="g-description">' . $giftImage . '<div class="g-name">' . $gift['name'] . '</div>
					<div class="g-timestamp">(' . $gift['timestamp'] . ')</div>
					<div class="g-from">' . $this->msg('g-from', htmlspecialchars($sender->getFullURL()), $gift['user_name_from'])->text() . '</div>';
            if ($message) {
                $output .= '<div class="g-user-message">' . $message . '</div>';
            }
            $output .= '<div class="cleared"></div>
					<div class="g-describe">' . $gift['description'] . '</div>
					<div class="g-actions">
						<a href="' . htmlspecialchars($giveGiftLink->getFullURL('gift_id=' . $gift['gift_id'])) . '">' . $this->msg('g-to-another')->plain() . '</a>';
            if ($gift['user_name_to'] == $user->getName()) {
                $output .= $this->msg('pipe-separator')->escaped();
                $output .= '<a href="' . htmlspecialchars($removeGiftLink->getFullURL('gift_id=' . $gift['id'])) . '">' . $this->msg('g-remove-gift')->plain() . '</a>';
            }
            $output .= '</div>
				</div>';
            $output .= '<div class="g-recent">
					<div class="g-recent-title">' . $this->msg('g-recent-recipients')->plain() . '</div>
					<div class="g-gift-count">' . $this->msg('g-given', $gift['gift_count'])->parse() . '</div>';
            foreach ($res as $row) {
                $userToId = $row->ug_user_id_to;
                $avatar = new wAvatar($userToId, 'ml');
                $userNameLink = Title::makeTitle(NS_USER, $row->ug_user_name_to);
                $output .= '<a href="' . htmlspecialchars($userNameLink->getFullURL()) . "\">\n\t\t\t\t\t{$avatar->getAvatarURL()}\n\t\t\t\t</a>";
            }
            $output .= '<div class="cleared"></div>
				</div>
			</div>';
            $out->addHTML($output);
        } else {
            $out->setPageTitle($this->msg('g-error-title')->plain());
            $out->addHTML($this->msg('g-error-message-invalid-link')->plain());
        }
    }
Exemplo n.º 3
0
    /**
     * Show the special page
     *
     * @param $par Mixed: parameter passed to the page or null
     */
    public function execute($par)
    {
        global $wgUploadPath;
        $out = $this->getOutput();
        $request = $this->getRequest();
        $currentUser = $this->getUser();
        // Set the page title, robot policies, etc.
        $this->setHeaders();
        // Add CSS
        $out->addModuleStyles('ext.socialprofile.usergifts.css');
        $user_name = $request->getVal('user');
        $page = $request->getInt('page', 1);
        /**
         * Redirect Non-logged in users to Login Page
         * It will automatically return them to the ViewGifts page
         */
        if ($currentUser->getID() == 0 && $user_name == '') {
            $login = SpecialPage::getTitleFor('Userlogin');
            $out->redirect(htmlspecialchars($login->getFullURL('returnto=Special:ViewGifts')));
            return false;
        }
        /**
         * If no user is set in the URL, we assume it's the current user
         */
        if (!$user_name) {
            $user_name = $currentUser->getName();
        }
        $user_id = User::idFromName($user_name);
        $user = Title::makeTitle(NS_USER, $user_name);
        /**
         * Error message for username that does not exist (from URL)
         */
        if ($user_id == 0) {
            $out->setPageTitle($this->msg('g-error-title')->plain());
            $out->addHTML($this->msg('g-error-message-no-user')->plain());
            return false;
        }
        /**
         * Config for the page
         */
        $per_page = 10;
        $per_row = 2;
        /**
         * Get all gifts for this user into the array
         */
        $rel = new UserGifts($user_name);
        $gifts = $rel->getUserGiftList(0, $per_page, $page);
        $total = $rel->getGiftCountByUsername($user_name);
        /**
         * Show gift count for user
         */
        $out->setPageTitle($this->msg('g-list-title', $rel->user_name)->parse());
        $output = '<div class="back-links">
			<a href="' . $user->getFullURL() . '">' . $this->msg('g-back-link', $rel->user_name)->parse() . '</a>
		</div>
		<div class="g-count">' . $this->msg('g-count', $rel->user_name, $total)->parse() . '</div>';
        if ($gifts) {
            $x = 1;
            // Safe links
            $viewGiftLink = SpecialPage::getTitleFor('ViewGift');
            $giveGiftLink = SpecialPage::getTitleFor('GiveGift');
            $removeGiftLink = SpecialPage::getTitleFor('RemoveGift');
            foreach ($gifts as $gift) {
                $giftname_length = strlen($gift['gift_name']);
                $giftname_space = stripos($gift['gift_name'], ' ');
                if (($giftname_space == false || $giftname_space >= "30") && $giftname_length > 30) {
                    $gift_name_display = substr($gift['gift_name'], 0, 30) . ' ' . substr($gift['gift_name'], 30, 50);
                } else {
                    $gift_name_display = $gift['gift_name'];
                }
                $user_from = Title::makeTitle(NS_USER, $gift['user_name_from']);
                $gift_image = "<img src=\"{$wgUploadPath}/awards/" . Gifts::getGiftImage($gift['gift_id'], 'l') . '" border="0" alt="" />';
                $output .= '<div class="g-item">
					<a href="' . htmlspecialchars($viewGiftLink->getFullURL('gift_id=' . $gift['id'])) . '">' . $gift_image . '</a>
					<div class="g-title">
						<a href="' . htmlspecialchars($viewGiftLink->getFullURL('gift_id=' . $gift['id'])) . '">' . $gift_name_display . '</a>';
                if ($gift['status'] == 1) {
                    if ($user_name == $currentUser->getName()) {
                        $rel->clearUserGiftStatus($gift['id']);
                        $rel->decNewGiftCount($currentUser->getID());
                    }
                    $output .= '<span class="g-new">' . $this->msg('g-new')->plain() . '</span>';
                }
                $output .= '</div>';
                $output .= '<div class="g-from">' . $this->msg('g-from', htmlspecialchars($user_from->getFullURL()), $gift['user_name_from'])->text() . '</div>
					<div class="g-actions">
						<a href="' . htmlspecialchars($giveGiftLink->getFullURL('gift_id=' . $gift['gift_id'])) . '">' . $this->msg('g-to-another')->plain() . '</a>';
                if ($rel->user_name == $currentUser->getName()) {
                    $output .= '&#160;';
                    $output .= $this->msg('pipe-separator')->escaped();
                    $output .= '&#160;';
                    $output .= '<a href="' . htmlspecialchars($removeGiftLink->getFullURL('gift_id=' . $gift['id'])) . '">' . $this->msg('g-remove-gift')->plain() . '</a>';
                }
                $output .= '</div>
					<div class="cleared"></div>';
                $output .= '</div>';
                if ($x == count($gifts) || $x != 1 && $x % $per_row == 0) {
                    $output .= '<div class="cleared"></div>';
                }
                $x++;
            }
        }
        /**
         * Build next/prev nav
         */
        $numofpages = $total / $per_page;
        $pageLink = $this->getPageTitle();
        if ($numofpages > 1) {
            $output .= '<div class="page-nav">';
            if ($page > 1) {
                $output .= Linker::link($pageLink, $this->msg('g-previous')->plain(), array(), array('user' => $user_name, 'page' => $page - 1)) . $this->msg('word-separator')->plain();
            }
            if ($total % $per_page != 0) {
                $numofpages++;
            }
            if ($numofpages >= 9 && $page < $total) {
                $numofpages = 9 + $page;
            }
            if ($numofpages >= $total / $per_page) {
                $numofpages = $total / $per_page + 1;
            }
            for ($i = 1; $i <= $numofpages; $i++) {
                if ($i == $page) {
                    $output .= $i . ' ';
                } else {
                    $output .= Linker::link($pageLink, $i, array(), array('user' => $user_name, 'page' => $i)) . $this->msg('word-separator')->plain();
                }
            }
            if ($total - $per_page * $page > 0) {
                $output .= $this->msg('word-separator')->plain() . Linker::link($pageLink, $this->msg('g-next')->plain(), array(), array('user' => $user_name, 'page' => $page + 1));
            }
            $output .= '</div>';
        }
        $out->addHTML($output);
    }
    function getGifts($user_name)
    {
        global $wgUser, $wgMemc, $wgUserProfileDisplay, $wgUploadPath;
        // If not enabled in site settings, don't display
        if ($wgUserProfileDisplay['gifts'] == false) {
            return '';
        }
        $output = '';
        // User to user gifts
        $g = new UserGifts($user_name);
        $user_safe = urlencode($user_name);
        // Try cache
        $key = wfMemcKey('user', 'profile', 'gifts', "{$g->user_id}");
        $data = $wgMemc->get($key);
        if (!$data) {
            wfDebug("Got profile gifts for user {$user_name} from DB\n");
            $gifts = $g->getUserGiftList(0, 4);
            $wgMemc->set($key, $gifts, 60 * 60 * 4);
        } else {
            wfDebug("Got profile gifts for user {$user_name} from cache\n");
            $gifts = $data;
        }
        $gift_count = $g->getGiftCountByUsername($user_name);
        $gift_link = SpecialPage::getTitleFor('ViewGifts');
        $per_row = 4;
        if ($gifts) {
            $output .= '<div class="user-section-heading">
				<div class="user-section-title">' . wfMsg('user-gifts-title') . '</div>
				<div class="user-section-actions">
					<div class="action-right">';
            if ($gift_count > 4) {
                $output .= '<a href="' . $gift_link->escapeFullURL('user='******'" rel="nofollow">' . wfMsg('user-view-all') . '</a>';
            }
            $output .= '</div>
					<div class="action-left">';
            if ($gift_count > 4) {
                $output .= wfMsg('user-count-separator', '4', $gift_count);
            } else {
                $output .= wfMsg('user-count-separator', $gift_count, $gift_count);
            }
            $output .= '</div>
					<div class="cleared"></div>
				</div>
			</div>
			<div class="cleared"></div>
			<div class="user-gift-container">';
            $x = 1;
            foreach ($gifts as $gift) {
                if ($gift['status'] == 1 && $user_name == $wgUser->getName()) {
                    $g->clearUserGiftStatus($gift['id']);
                    $wgMemc->delete($key);
                    $g->decNewGiftCount($wgUser->getID());
                }
                $user = Title::makeTitle(NS_USER, $gift['user_name_from']);
                $gift_image = '<img src="' . $wgUploadPath . '/awards/' . Gifts::getGiftImage($gift['gift_id'], 'ml') . '" border="0" alt="" />';
                $gift_link = $user = SpecialPage::getTitleFor('ViewGift');
                $class = '';
                if ($gift['status'] == 1) {
                    $class = 'class="user-page-new"';
                }
                $output .= '<a href="' . $gift_link->escapeFullURL('gift_id=' . $gift['id']) . '" ' . $class . " rel=\"nofollow\">{$gift_image}</a>";
                if ($x == count($gifts) || $x != 1 && $x % $per_row == 0) {
                    $output .= '<div class="cleared"></div>';
                }
                $x++;
            }
            $output .= '</div>';
        }
        return $output;
    }
Exemplo n.º 5
0
function getNewGiftLink() {
	global $wgUser, $wgScriptPath;
	$gift_count = UserGifts::getNewGiftCount( $wgUser->getID() );
	$gifts_title = SpecialPage::getTitleFor( 'ViewGifts' );
	$output = '';
	if ( $gift_count > 0 ) {
		$output .= '<p>
			<img src="' . $wgScriptPath . '/extensions/SocialProfile/images/icon_package_get.gif" alt="" border="0" />
			<span class="profile-on"><a href="' . $gifts_title->escapeFullURL() . '" rel="nofollow">'
				. wfMsgExt( 'mp-request-new-gift', 'parsemag', $gift_count ) .
			'</a></span>
		</p>';
	}
	return $output;
}
	/**
	 * Show the special page
	 *
	 * @param $par Mixed: parameter passed to the page or null
	 */
	public function execute( $par ) {
		global $wgUser, $wgOut, $wgRequest, $wgUploadPath, $wgUserGiftsScripts;

		$wgOut->addExtensionStyle( $wgUserGiftsScripts . '/UserGifts.css' );

		$giftId = $wgRequest->getInt( 'gift_id' );
		if ( !$giftId || !is_numeric( $giftId ) ) {
			$wgOut->setPageTitle( wfMsg( 'g-error-title' ) );
			$wgOut->addHTML( wfMsg( 'g-error-message-invalid-link' ) );
			return false;
		}

		$gift = UserGifts::getUserGift( $giftId );

		if ( $gift ) {
			if ( $gift['status'] == 1 ) {
				if ( $gift['user_name_to'] == $wgUser->getName() ) {
					$g = new UserGifts( $gift['user_name_to'] );
					$g->clearUserGiftStatus( $gift['id'] );
					$g->decNewGiftCount( $wgUser->getID() );
				}
			}

			// DB stuff
			$dbr = wfGetDB( DB_SLAVE );
			$res = $dbr->select(
				'user_gift',
				array( 'DISTINCT ug_user_name_to', 'ug_user_id_to', 'ug_date' ),
				array(
					'ug_gift_id' => $gift['gift_id'],
					"ug_user_name_to <> '" . addslashes( $gift['user_name_to'] ) . "'"
				),
				__METHOD__,
				array(
					'GROUP BY' => 'ug_user_name_to',
					'ORDER BY' => 'ug_date DESC',
					'LIMIT' => 6
				)
			);

			$wgOut->setPageTitle( wfMsgExt(
				'g-description-title',
				'parsemag',
				$gift['user_name_to'],
				$gift['name']
			) );

			$output = '<div class="back-links">
				<a href="' . Title::makeTitle( NS_USER, $gift['user_name_to'] )->escapeFullURL() . '">'
				. wfMsg( 'g-back-link', $gift['user_name_to'] ) . '</a>
			</div>';

			$user = Title::makeTitle( NS_USER, $gift['user_name_from'] );
			$removeGiftLink = SpecialPage::getTitleFor( 'RemoveGift' );
			$giveGiftLink = SpecialPage::getTitleFor( 'GiveGift' );

			$giftImage = '<img src="' . $wgUploadPath . '/awards/' .
				Gifts::getGiftImage( $gift['gift_id'], 'l' ) .
				'" border="0" alt="" />';

			$message = $wgOut->parse( trim( $gift['message'] ), false );

			$output .= '<div class="g-description-container">';
			$output .= '<div class="g-description">' .
					$giftImage .
					'<div class="g-name">' . $gift['name'] . '</div>
					<div class="g-timestamp">(' . $gift['timestamp'] . ')</div>
					<div class="g-from">' . wfMsg(
						'g-from',
						$user->escapeFullURL(),
						$gift['user_name_from']
					) . '</div>';
			if ( $message ) {
				$output .= '<div class="g-user-message">' . $message . '</div>';
			}
			$output .= '<div class="cleared"></div>
					<div class="g-describe">' . $gift['description'] . '</div>
					<div class="g-actions">
						<a href="' . $giveGiftLink->escapeFullURL( 'gift_id=' . $gift['gift_id'] ) . '">' .
							wfMsg( 'g-to-another' ) . '</a>';
			if ( $gift['user_name_to'] == $wgUser->getName() ) {
				$output .= wfMsgExt( 'pipe-separator', 'escapenoentities' );
				$output .= '<a href="' . $removeGiftLink->escapeFullURL( 'gift_id=' . $gift['id'] ) . '">' .
					wfMsg( 'g-remove-gift' ) . '</a>';
			}
			$output .= '</div>
				</div>';

			$output .= '<div class="g-recent">
					<div class="g-recent-title">' .
						wfMsg( 'g-recent-recipients' ) .
					'</div>
					<div class="g-gift-count">' .
						wfMsgExt( 'g-given', 'parsemag', $gift['gift_count'] ) .
					'</div>';

			foreach ( $res as $row ) {
				$userToId = $row->ug_user_id_to;
				$avatar = new wAvatar( $userToId, 'ml' );
				$userNameLink = Title::makeTitle( NS_USER, $row->ug_user_name_to );

				$output .= '<a href="' . $userNameLink->escapeFullURL() . "\">
					{$avatar->getAvatarURL()}
				</a>";
			}
			$output .= '<div class="cleared"></div>
				</div>
			</div>';

			$wgOut->addHTML( $output );
		} else {
			$wgOut->setPageTitle( wfMsg( 'g-error-title' ) );
			$wgOut->addHTML( wfMsg( 'g-error-message-invalid-link' ) );
		}
	}
    /**
     * Show the special page
     *
     * @param $par Mixed: parameter passed to the page or null
     */
    public function execute($par)
    {
        global $wgUser, $wgOut, $wgRequest, $wgMemc, $wgUploadPath, $wgUserGiftsScripts;
        $output = '';
        // Prevent E_NOTICE
        $wgOut->addScriptFile($wgUserGiftsScripts . '/UserGifts.js');
        $wgOut->addExtensionStyle($wgUserGiftsScripts . '/UserGifts.css');
        $userTitle = Title::newFromDBkey($wgRequest->getVal('user'));
        if (!$userTitle) {
            $wgOut->addHTML($this->displayFormNoUser());
            return false;
        }
        $user_title = Title::makeTitle(NS_USER, $wgRequest->getVal('user'));
        $this->user_name_to = $userTitle->getText();
        $this->user_id_to = User::idFromName($this->user_name_to);
        $giftId = $wgRequest->getInt('gift_id');
        $out = '';
        if ($wgUser->getID() === $this->user_id_to) {
            $wgOut->setPageTitle(wfMsg('g-error-title'));
            $out .= wfMsg('g-error-message-to-yourself');
            $wgOut->addHTML($out);
        } elseif ($wgUser->isBlocked()) {
            $wgOut->setPageTitle(wfMsg('g-error-title'));
            $out .= wfMsg('g-error-message-blocked');
            $wgOut->addHTML($out);
        } elseif ($this->user_id_to == 0) {
            $wgOut->setPageTitle(wfMsg('g-error-title'));
            $wgOut->addHTML(wfMsg('g-error-message-no-user'));
        } elseif ($wgUser->getID() == 0) {
            $wgOut->setPageTitle(wfMsg('g-error-title'));
            $out .= wfMsg('g-error-message-login');
            $wgOut->addHTML($out);
        } else {
            $gift = new UserGifts($wgUser->getName());
            if ($wgRequest->wasPosted() && $_SESSION['alreadysubmitted'] == false) {
                $_SESSION['alreadysubmitted'] = true;
                $ug_gift_id = $gift->sendGift($this->user_name_to, $wgRequest->getInt('gift_id'), 0, $wgRequest->getVal('message'));
                // clear the cache for the user profile gifts for this user
                $wgMemc->delete(wfMemcKey('user', 'profile', 'gifts', $this->user_id_to));
                $key = wfMemcKey('gifts', 'unique', 4);
                $data = $wgMemc->get($key);
                // check to see if this type of gift is in the unique list
                $lastUniqueGifts = $data;
                $found = 1;
                if (is_array($lastUniqueGifts)) {
                    foreach ($lastUniqueGifts as $lastUniqueGift) {
                        if ($wgRequest->getInt('gift_id') == $lastUniqueGift['gift_id']) {
                            $found = 0;
                        }
                    }
                }
                if ($found) {
                    // add new unique to array
                    $lastUniqueGifts[] = array('id' => $ug_gift_id, 'gift_id' => $wgRequest->getInt('gift_id'));
                    // remove oldest value
                    if (count($lastUniqueGifts) > 4) {
                        array_shift($lastUniqueGifts);
                    }
                    // reset the cache
                    $wgMemc->set($key, $lastUniqueGifts);
                }
                $sent_gift = UserGifts::getUserGift($ug_gift_id);
                $gift_image = '<img src="' . $wgUploadPath . '/awards/' . Gifts::getGiftImage($sent_gift['gift_id'], 'l') . '" border="0" alt="" />';
                $output .= $wgOut->setPageTitle(wfMsg('g-sent-title', $this->user_name_to));
                $output .= '<div class="back-links">
					<a href="' . $user_title->escapeFullURL() . '">' . wfMsg('g-back-link', $this->user_name_to) . '</a>
				</div>
				<div class="g-message">' . wfMsg('g-sent-message', $this->user_name_to) . '</div>
				<div class="g-container">' . $gift_image . '<div class="g-title">' . $sent_gift['name'] . '</div>';
                if ($sent_gift['message']) {
                    $output .= '<div class="g-user-message">' . $sent_gift['message'] . '</div>';
                }
                $output .= '</div>
				<div class="cleared"></div>
				<div class="g-buttons">
					<input type="button" class="site-button" value="' . wfMsg('g-main-page') . '" size="20" onclick="window.location=\'index.php?title=' . wfMsgForContent('mainpage') . '\'" />
					<input type="button" class="site-button" value="' . wfMsg('g-your-profile') . '" size="20" onclick="window.location=\'' . $wgUser->getUserPage()->escapeFullURL() . '\'" />
				</div>';
                $wgOut->addHTML($output);
            } else {
                $_SESSION['alreadysubmitted'] = false;
                if ($giftId) {
                    $wgOut->addHTML($this->displayFormSingle());
                } else {
                    $wgOut->addHTML($this->displayFormAll());
                }
            }
        }
    }
Exemplo n.º 8
0
 /**
  * check the current user is have this gift
  * @param  inter  $giftId gift's id
  * @return boolean 
  */
 public function hasUserGift($giftId)
 {
     $ug = new UserGifts($this->mUser->getName());
     $hasUserGift = $ug->doesUserHaveGiftOfTheSameGiftType($this->mUser->getId(), $giftId);
     return $hasUserGift;
 }