Esempio n. 1
0
 /**
  * @param ImagePage $imagePage
  */
 public function __construct($imagePage)
 {
     global $wgShowArchiveThumbnails;
     $this->current = $imagePage->getPage()->getFile();
     $this->img = $imagePage->getDisplayedFile();
     $this->title = $imagePage->getTitle();
     $this->imagePage = $imagePage;
     $this->showThumb = $wgShowArchiveThumbnails && $this->img->canRender();
     $this->setContext($imagePage->getContext());
 }
Esempio n. 2
0
function efImageReviewDisplayStatus(ImagePage $imagePage, &$html)
{
    global $wgCityId, $wgExternalDatawareDB, $wgUser;
    if (!$wgUser->isAllowed('imagereviewstats')) {
        return true;
    }
    if (!$imagePage->getTitle()->exists()) {
        return true;
    }
    $html .= Xml::element('h2', array(), wfMsg('imagereview-imagepage-header'));
    $reviews = array();
    $headers = array(wfMessage('imagereview-imagepage-table-header-reviewer')->text(), wfMessage('imagereview-imagepage-table-header-state')->text(), wfMessage('imagereview-imagepage-table-header-time')->text());
    $where = array('wiki_id' => $wgCityId, 'page_id' => $imagePage->getId());
    $dbr = wfGetDB(DB_SLAVE, array(), $wgExternalDatawareDB);
    $res = $dbr->select('image_review_stats', '*', $where);
    if ($dbr->numRows($res) == 0) {
        //check if image is in the queue at all!
        $imgCurState = $dbr->selectField('image_review', 'state', $where);
        if (false === $imgCurState) {
            /**
             * If the file is a local one and is older than 1 hour - send it to ImageReview
             * since it's probably been restored, and is not just a fresh file.
             */
            $lastTouched = new DateTime($imagePage->getRevisionFetched()->getTimestamp());
            $now = new DateTime();
            $file = $imagePage->getDisplayedFile();
            if ($file instanceof WikiaLocalFile && $lastTouched < $now->modify('-1 hour')) {
                $scribeEventProducer = new ScribeEventProducer('edit');
                $user = User::newFromName($file->getUser());
                if ($scribeEventProducer->buildEditPackage($imagePage, $user, null, null, $file)) {
                    $logParams = ['cityId' => $wgCityId, 'pageId' => $imagePage->getID(), 'pageTitle' => $imagePage->getTitle()->getText(), 'uploadUser' => $user->getName()];
                    \Wikia\Logger\WikiaLogger::instance()->info('ImageReviewLog', ['message' => 'Image moved back to queue', 'params' => $logParams]);
                    $scribeEventProducer->sendLog();
                }
            }
            // oh oh, image is not in queue at all
            $html .= wfMsg('imagereview-imagepage-not-in-queue');
        } else {
            // image is in the queue but not reviewed yet
            $html .= wfMsg('imagereview-state-0');
        }
    } else {
        // go through the list and display review states
        while ($row = $dbr->fetchObject($res)) {
            $data = array();
            $data[] = User::newFromId($row->reviewer_id)->getName();
            $data[] = wfMsg('imagereview-state-' . $row->review_state);
            $data[] = $row->review_end . ' (UTC)';
            $reviews[] = $data;
        }
        $html .= Xml::buildTable($reviews, array('class' => 'wikitable filehistory sortable', 'style' => 'width: 60%'), $headers);
    }
    return true;
}
 /**
  * @param ImagePage $imagePage
  */
 function __construct($imagePage)
 {
     parent::__construct($imagePage->getContext());
     $this->mImagePage = $imagePage;
     $this->mTitle = clone $imagePage->getTitle();
     $this->mTitle->setFragment('#filehistory');
     $this->mImg = null;
     $this->mHist = array();
     $this->mRange = array(0, 0);
     // display range
 }
 /**
  * change title tag for Video Page and Image Page
  * @author Jacek Jursza
  * @param ImagePage $imgPage
  * @param $html
  * @return bool
  */
 static function onImagePageAfterImageLinks($imgPage, $html)
 {
     $file = $imgPage->getDisplayedFile();
     /* @var $file LocalRepo */
     $title = $imgPage->getTitle();
     /* @var $title Title */
     $newTitle = '';
     if (!empty($file) && !empty($title) && !F::app()->checkSkin('monobook')) {
         if ((new WikiaFileHelper())->isFileTypeVideo($file)) {
             $newTitle = wfMsg('seotweaks-video') . ' - ' . $title->getBaseText();
         } else {
             // It's not Video so lets check if it is Image
             if ($file instanceof LocalFile && $file->getHandler() instanceof BitmapHandler) {
                 $newTitle = wfMsg('seotweaks-image') . ' - ' . $title->getBaseText();
             }
         }
         if (!empty($newTitle)) {
             F::app()->wg->Out->setPageTitle($newTitle);
         }
     }
     return true;
 }
Esempio n. 5
0
	/**
	 * Shortcut to get the Title object from the page
	 * @return Title
	 */
	final public function getTitle() {
		return $this->page->getTitle();
	}