Пример #1
0
function wfRenderVideoGallery($input, $argv, $parser)
{
    global $wgTitle;
    $vg = new VideoGallery();
    $vg->setContextTitle($wgTitle->getText());
    $vg->setShowFilename(true);
    $vg->setParsing();
    if (isset($argv['perrow'])) {
        $vg->setPerRow($argv['perrow']);
    }
    if (isset($params['widths'])) {
        $vg->setWidths($argv['widths']);
    }
    if (isset($params['heights'])) {
        $vg->setHeights($argv['heights']);
    }
    $lines = explode("\n", $input);
    foreach ($lines as $line) {
        // match lines like these:
        // Video:Some video name|This is some video
        $matches = array();
        preg_match("/^([^|]+)(\\|(.*))?\$/", $line, $matches);
        // Skip empty lines
        if (count($matches) == 0) {
            continue;
        }
        $tp = Title::newFromText($matches[1]);
        $nt =& $tp;
        if (is_null($nt)) {
            // Bogus title. Ignore these so we don't bomb out later.
            continue;
        }
        if (isset($matches[3])) {
            $label = $matches[3];
        } else {
            $label = '';
        }
        $html = '';
        /*
        $pout = $this->parse( $label,
        	$this->mTitle,
        	$this->mOptions,
        	false, // Strip whitespace...?
        	false  // Don't clear state!
        );
        $html = $pout->getText();
        */
        // Gah, there should be a better way to get context here
        $vg->add(new Video($nt, RequestContext::getMain()), $html);
    }
    return $vg->toHTML();
}
Пример #2
0
function VideoGalleryPopulate($input, $args, $parser)
{
    $parser->disableCache();
    $category = isset($args['category']) ? $args['category'] : '';
    $limit = isset($args['limit']) ? intval($args['limit']) : 10;
    if (empty($category)) {
        return '';
    }
    // Use Parser::recursivePreprocess() if available instead of creating another Parser instance
    if (is_callable(array($parser, 'recursivePreprocess'))) {
        $category = $parser->recursivePreprocess($category);
    } else {
        $newParser = new Parser();
        $category = $newParser->preprocess($category, $parser->getTitle(), $parser->getOptions());
    }
    $category_title = Title::newFromText($category);
    if (!$category_title instanceof Title) {
        return '';
    }
    // @todo FIXME: not overly i18n-friendly here...
    $category_title_secondary = Title::newFromText($category . ' Videos');
    if (!$category_title_secondary instanceof Title) {
        return '';
    }
    $params['ORDER BY'] = 'page_id';
    if ($limit) {
        $params['LIMIT'] = $limit;
    }
    $dbr = wfGetDB(DB_SLAVE);
    $res = $dbr->select(array('page', 'categorylinks'), 'page_title', array('cl_to' => array($category_title->getDBkey(), $category_title_secondary->getDBkey()), 'page_namespace' => NS_VIDEO), __METHOD__, $params, array('categorylinks' => array('INNER JOIN', 'cl_from = page_id')));
    $gallery = new VideoGallery();
    $gallery->setParsing(true);
    $gallery->setShowFilename(true);
    foreach ($res as $row) {
        $video = Video::newFromName($row->page_title, RequestContext::getMain());
        $gallery->add($video);
    }
    return $gallery->toHtml();
}
Пример #3
0
					}
			} else {
				$full_path = "";
			}
			
			$_POST = sanitize($_POST);
		    $photos = $_POST;
		    settype($photos,'object');
			VideoGallery::updateVideoGallery($photos,$full_path); 
			$success = "Videos Successfully Saved!";
			
			$updates = 'Update videos content';
  	    AdminAction::addAdminAction($_SESSION['admin_name'],$updates);
	}
	
	$videos = VideoGallery::findVideoGallery($_REQUEST['id']);
?>
<!DOCTYPE html>  
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us">  
<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
  <link rel="stylesheet" type="text/css" media="screen" href="<?php 
echo $ROOT_URL;
?>
_admin/_assets/css/core3.css" /> 
  <link rel="stylesheet" type="text/css" media="screen" href="<?php 
echo $ROOT_URL;
?>
_admin/_assets/css/modules.css" /> 
  <script type="text/javascript" src="<?php 
Пример #4
0
    <h3>Video Overview</h3>

    <a href="#" class="switch_thumb"><!-- Switch Thumb --></a>
    <ul class="display">
    <?php 
$count_record = VideoGallery::countVideoGallery();
if (!isset($_REQUEST['page'])) {
    $page = 1;
} else {
    $page = $_GET[page];
}
$pagination = new Pagination();
//for display
$pg = $pagination->page_pagination(20, $count_record, $page, 20);
//$result_prod = mysql_query($query_Recordset2.$pg[1]);
$video = VideoGallery::findAll($pg[1]);
?>
		  	<? if($count_record == 0) { ?>
            	<li>
                  <div style="font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#F00; font-weight:bold">No Record Found</div>
                </li>
            <? } else { 
					foreach($video as $videos) { 
						$image = substr($videos->fldVideoGalleryImage,9);
			?>		
                  <li>
                    <div class="content_block"> <a href="#"><img src="<?php 
echo $ROOT_URL;
echo $image;
?>
" width="215"  alt=""></a>
Пример #5
0
<?php

require_once 'class.php';
$zsw = new VideoGallery();
$zsw->admin_init();
Пример #6
0
				
					$new_name = 'Videos'.GetSID(7);
					//$new_name = (isset($_POST['name'])) ? $_POST['name'] : "";
					if ($my_upload->upload($new_name)) { // new name is an additional filename information, use this to rename the uploaded file
						$full_path = $my_upload->upload_dir.$my_upload->file_copy;
						$info = $my_upload->get_uploaded_file_info($full_path);
						// ... or do something like insert the filename to the database
					}
			} else {
				$full_path = "";
			}
			
			$_POST = sanitize($_POST);
		    $photos = $_POST;
		    settype($photos,'object');
			VideoGallery::addVideoGallery($photos,$full_path); 
			$success = "Videos Successfully Saved!";
			
			$updates = 'Add new videos content';
  	    AdminAction::addAdminAction($_SESSION['admin_name'],$updates);
	}
?>
<!DOCTYPE html>  
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us">  
<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
  <link rel="stylesheet" type="text/css" media="screen" href="<?php 
echo $ROOT_URL;
?>
_admin/_assets/css/core3.css" /> 
Пример #7
0
 /**
  * Show the special page
  *
  * @param $par Mixed: parameter passed to the page or null
  */
 public function execute($par)
 {
     global $wgGroupPermissions;
     $out = $this->getOutput();
     $request = $this->getRequest();
     $lang = $this->getLang();
     $out->setPageTitle(wfMsgHtml('newvideos'));
     $wpIlMatch = $request->getText('wpIlMatch');
     $dbr = wfGetDB(DB_SLAVE);
     $sk = $this->getSkin();
     $shownav = !$this->including();
     $hidebots = $request->getBool('hidebots', 1);
     $hidebotsql = '';
     if ($hidebots) {
         /*
          * Make a list of group names which have the 'bot' flag
          * set.
          */
         $botconds = array();
         foreach ($wgGroupPermissions as $groupname => $perms) {
             if (array_key_exists('bot', $perms) && $perms['bot']) {
                 $botconds[] = "ug_group='{$groupname}'";
             }
         }
         /* If not bot groups, do not set $hidebotsql */
         if ($botconds) {
             $isbotmember = $dbr->makeList($botconds, LIST_OR);
             /*
              * This join, in conjunction with WHERE ug_group
              * IS NULL, returns only those rows from IMAGE
              * where the uploading user is not a member of
              * a group which has the 'bot' permission set.
              */
             $ug = $dbr->tableName('user_groups');
             $hidebotsql = " LEFT OUTER JOIN {$ug} ON video_user_name=ug_user AND ({$isbotmember})";
         }
     }
     $video = $dbr->tableName('video');
     $sql = "SELECT video_timestamp FROM {$video}";
     if ($hidebotsql) {
         $sql .= "{$hidebotsql} WHERE ug_group IS NULL";
     }
     $sql .= ' ORDER BY video_timestamp DESC LIMIT 1';
     $res = $dbr->query($sql, __METHOD__);
     $row = $dbr->fetchRow($res);
     if ($row !== false) {
         $ts = $row[0];
     } else {
         $ts = false;
     }
     $sql = '';
     /** If we were clever, we'd use this to cache. */
     $latestTimestamp = wfTimestamp(TS_MW, $ts);
     /** Hardcode this for now. */
     $limit = 48;
     if ($parval = intval($par)) {
         if ($parval <= $limit && $parval > 0) {
             $limit = $parval;
         }
     }
     $where = array();
     $searchpar = array();
     if ($wpIlMatch != '') {
         $nt = Title::newFromUrl($wpIlMatch);
         if ($nt) {
             $m = $dbr->strencode(strtolower($nt->getDBkey()));
             $m = str_replace('%', "\\%", $m);
             $m = str_replace('_', "\\_", $m);
             $where[] = "LCASE(video_name) LIKE '%{$m}%'";
             $searchpar['wpIlMatch'] = $wpIlMatch;
         }
     }
     $invertSort = false;
     if ($until = $request->getVal('until')) {
         $where[] = 'video_timestamp < ' . $dbr->timestamp($until);
     }
     if ($from = $request->getVal('from')) {
         $where[] = 'video_timestamp >= ' . $dbr->timestamp($from);
         $invertSort = true;
     }
     $sql = 'SELECT video_name, video_url, video_user_name, video_user_id, ' . " video_timestamp FROM {$video}";
     if ($hidebotsql) {
         $sql .= $hidebotsql;
         $where[] = 'ug_group IS NULL';
     }
     if (count($where)) {
         $sql .= ' WHERE ' . $dbr->makeList($where, LIST_AND);
     }
     $sql .= ' ORDER BY video_timestamp ' . ($invertSort ? '' : ' DESC');
     $sql .= ' LIMIT ' . ($limit + 1);
     $res = $dbr->query($sql, __METHOD__);
     // We have to flip things around to get the last N after a certain date
     $videos = array();
     foreach ($res as $s) {
         if ($invertSort) {
             array_unshift($videos, $s);
         } else {
             array_push($videos, $s);
         }
     }
     $gallery = new VideoGallery();
     $firstTimestamp = null;
     $lastTimestamp = null;
     $shownVideos = 0;
     foreach ($videos as $s) {
         if (++$shownVideos > $limit) {
             // One extra just to test for whether to show a page link;
             // don't actually show it.
             break;
         }
         $name = $s->video_name;
         $ut = $s->video_user_name;
         $nt = Title::newFromText($name, NS_VIDEO);
         $vid = new Video($nt, $this->getContext());
         $ul = $sk->makeLinkObj(Title::makeTitle(NS_USER, $ut), $ut);
         $gallery->add($vid, "{$ul}<br />\n<i>" . $lang->timeanddate($s->video_timestamp, true) . "</i><br />\n");
         $timestamp = wfTimestamp(TS_MW, $s->video_timestamp);
         if (empty($firstTimestamp)) {
             $firstTimestamp = $timestamp;
         }
         $lastTimestamp = $timestamp;
     }
     $bydate = wfMsg('bydate');
     $lt = $lang->formatNum(min($shownVideos, $limit));
     if ($shownav) {
         $text = wfMsgExt('imagelisttext', 'parse', $lt, $bydate);
         $out->addHTML($text . "\n");
     }
     $sub = wfMsg('ilsubmit');
     $titleObj = SpecialPage::getTitleFor('NewVideos');
     $action = $titleObj->escapeLocalURL($hidebots ? '' : 'hidebots=0');
     if ($shownav) {
         $out->addHTML("<form id=\"imagesearch\" method=\"post\" action=\"{$action}\">" . Xml::input('wpIlMatch', 20, $wpIlMatch) . ' ' . Xml::submitButton($sub, array('name' => 'wpIlSubmit')) . '</form>');
     }
     // Paging controls...
     # If we change bot visibility, this needs to be carried along.
     if (!$hidebots) {
         $botpar = array('hidebots' => 0);
     } else {
         $botpar = array();
     }
     $now = wfTimestampNow();
     $date = $lang->date($now, true);
     $time = $lang->time($now, true);
     $query = array_merge(array('from' => $now), $botpar, $searchpar);
     $dateLink = $sk->linkKnown($titleObj, htmlspecialchars(wfMsgHtml('sp-newimages-showfrom', $date, $time)), array(), $query);
     $query = array_merge(array('hidebots' => $hidebots ? 0 : 1), $searchpar);
     $showhide = $hidebots ? wfMsg('show') : wfMsg('hide');
     $botLink = $sk->linkKnown($titleObj, htmlspecialchars(wfMsg('showhidebots', $showhide)), array(), $query);
     $opts = array('parsemag', 'escapenoentities');
     $prevLink = wfMsgExt('pager-newer-n', $opts, $lang->formatNum($limit));
     if ($firstTimestamp && $firstTimestamp != $latestTimestamp) {
         $query = array_merge(array('from' => $firstTimestamp), $botpar, $searchpar);
         $prevLink = $sk->linkKnown($titleObj, $prevLink, array(), $query);
     }
     $nextLink = wfMsgExt('pager-older-n', $opts, $lang->formatNum($limit));
     if ($shownVideos > $limit && $lastTimestamp) {
         $query = array_merge(array('until' => $lastTimestamp), $botpar, $searchpar);
         $nextLink = $sk->linkKnown($titleObj, $nextLink, array(), $query);
     }
     $prevnext = '<p>' . $botLink . ' ' . wfMsgHtml('viewprevnext', $prevLink, $nextLink, $dateLink) . '</p>';
     if ($shownav) {
         $out->addHTML($prevnext);
     }
     if (count($videos)) {
         $out->addHTML($gallery->toHTML());
         if ($shownav) {
             $out->addHTML($prevnext);
         }
     } else {
         $out->addWikiMsg('video-no-videos');
     }
 }