static function install() { $db = Database::instance(); $db->query("CREATE TABLE {videos_files} (\n `id` int(9) NOT NULL auto_increment,\n `file` varchar(255) NOT NULL,\n `item_id` int(9),\n `parent_id` int(9),\n `task_id` int(9) NOT NULL,\n PRIMARY KEY (`id`))\n DEFAULT CHARSET=utf8;"); $db->query("CREATE TABLE {items_videos} (\n `id` int(9) NOT NULL auto_increment,\n `item_id` int(9) NOT NULL,\n PRIMARY KEY (`id`),\n KEY (`item_id`, `id`))\n DEFAULT CHARSET=utf8;"); module::set_var("videos", "allowed_extensions", serialize(array("avi", "mpg", "mpeg", "mov", "wmv", "asf", "mts"))); module::set_version("videos", 1); videos::check_config(); }
static function install() { $db = Database::instance(); $db->query("CREATE TABLE {videos_entries} (\n `id` int(9) NOT NULL auto_increment,\n `checked` boolean default 0,\n `is_directory` boolean default 0,\n `item_id` int(9),\n `parent_id` int(9),\n `path` varchar(255) NOT NULL,\n `task_id` int(9) NOT NULL,\n PRIMARY KEY (`id`))\n DEFAULT CHARSET=utf8;"); // rWatcher Edit: My Table. $db->query("CREATE TABLE {items_videos} (\n `id` int(9) NOT NULL auto_increment,\n `item_id` int(9) NOT NULL,\n PRIMARY KEY (`id`),\n KEY (`item_id`, `id`))\n DEFAULT CHARSET=utf8;"); // rWatcher Edit: My Variable. module::set_var("videos", "allowed_extensions", serialize(array("avi", "mpg", "mpeg", "mov", "wmv", "asf", "mts"))); module::set_version("videos", 4); videos::check_config(); }
public function remove_path() { access::verify_csrf(); $path = Input::instance()->get("path"); $paths = unserialize(module::get_var("videos", "authorized_paths")); if (isset($paths[$path])) { unset($paths[$path]); message::success(t("Removed path %path", array("path" => $path))); module::set_var("videos", "authorized_paths", serialize($paths)); videos::check_config($paths); } url::redirect("admin/videos"); }
/** * Begin the task of adding files. */ public function start() { access::verify_csrf(); $item = ORM::factory("item", Input::instance()->get("item_id")); foreach (Input::instance()->post("paths") as $path) { if (videos::is_valid_path($path)) { $paths[] = array($path, null); } } $task_def = Task_Definition::factory()->callback("Videos_Controller::add")->description(t("Add videos from the local server"))->name(t("Add from server")); $task = task::create($task_def, array("item_id" => $item->id, "queue" => $paths)); json::reply(array("result" => "started", "status" => (string) $task->status, "url" => url::site("videos/run/{$task->id}?csrf=" . access::csrf_token()))); }
public function actionTest($catId = 0) { //$request = Yii::$app->request; //$post = $request->post; //var_dump($post); //$redis = Yii::$app->redis; //var_dump($redis); $query = videos::find(); if ($catId != 0) { $query = Videos::find()->where(['catId' => $catId]); } $countQuery = clone $query; $pages = new Pagination(['totalCount' => $countQuery->count(), 'pageSize' => 16]); if ($pages->page >= ($pages->totalCount + 15) / 16) { return array(); } $videos = $query->offset($pages->offset)->select(['id', 'title', 'youtubeChannelId', 'streamUrl', 'youtubeId', 'catId', 'thumbnails_json'])->limit($pages->limit)->asArray()->all(); $result = array(); $result['totalCount'] = $pages->totalCount; $result['PageCount'] = $pages->pageCount; $result['videos'] = $videos; return $result; }
function buildVideoPlayer($embedCode) { require_once PATH_CORE . '/classes/video.class.php'; return videos::buildPlayerFromLink($embedCode, 160, 120); }
if ($commentTotals['hour'] >= $commentLimits['hour']) { $error = true; $errorMsg = 'You have exceeded your rate limit for commenting. Please try again in one hour.'; } else { if ($commentTotals['nickel'] >= $commentLimits['nickel']) { $error = true; $errorMsg = 'You have exceeded your rate limit for commenting. Please try again in 5 mins.'; } } } } // TODO: grab videoURL, validate it, stuff it in to the $comment structure if (isset($_POST['videoURL']) and $_POST['videoURL'] != '') { require_once PATH_CORE . '/classes/video.class.php'; $videoURL = videos::getVideoURLFromEmbedCodeOrURL(stripslashes($_POST['videoURL'])); if (videos::validateVideoURL($videoURL)) { $vt = new VideoTable($db); $videoid = $vt->createVideoForComment($userid, $videoURL, "Video Comment on story {$cid}"); } else { $error = true; $errorMsg = 'Unsupported or invalid video URL'; } } else { if (isset($_POST['commentMsg']) and $_POST['commentMsg'] != '') { $commentMsg = preg_replace("/([\\w]+:\\/\\/[\\w-?&;#~=\\.\\/\\@]+[\\w\\/])/i", "<a target=\"_blank\" href=\"\$1\">\$1</a>", $_POST['commentMsg']); //$commentMsg = strip_tags($_POST['commentMsg'], '<a><i><b><p>'); $commentMsg = strip_tags($commentMsg, '<a><i><b><p>'); $commentMsg = nl2br($commentMsg); // TODO: GET THIS WORKING. //$comments = mysql_real_escape_string($_POST['commentMsg'], $db->handle); } else {
function processIdeaForm($userid = 0) { $resp = array(); $resp['error'] = false; $idea = $_POST['idea']; $details = $_POST['details']; $tagid = $_POST['tagid']; if ($idea == '') { $resp['error'] = true; $resp['msg'] = 'Sorry, we did not get your idea. Please try again.'; } if ($tagid == '' or $tagid == 0) { $resp['error'] = true; $resp['msg'] = 'Please specify a category. Please try again.'; } if (isset($_POST['videoURL']) and $_POST['videoURL'] != '') { require_once PATH_CORE . '/classes/video.class.php'; $videoURL = videos::getVideoURLFromEmbedCodeOrURL(stripslashes($_POST['videoURL'])); if (videos::validateVideoURL($videoURL)) { $vt = new VideoTable($db); $videoid = $vt->createVideoForIdea($userid, $videoURL, "Idea video by {$userid}"); } else { $resp['error'] = true; $resp['msg'] = 'Unsupported or invalid video URL'; } } else { $videoid = 0; } if (!$resp['error']) { $isDup = $this->isDup($idea); if ($isDup !== false) { // it is a duplicate $resp['error'] = true; $resp['msg'] = 'Sorry, <a href="?p=ideas&o=view&id=' . $isDup . '">that idea has already been added here</a>.'; } else { $iTable = new ideasTable($this->db); $ir = $iTable->getRowObject(); $ir->idea = $idea; $ir->details = $details; $ir->tagid = $tagid; $ir->userid = $userid; $ir->dt = date('Y-m-d H:i:s', time()); $ir->numLikes = 1; $ir->videoid = $videoid; $ir->insert(); // add like for this idea when user posts require_once PATH_CORE . '/classes/log.class.php'; $logObj = new log($this->db); $logItem = $logObj->serialize(0, $userid, 'likeIdea', $ir->id); $inLog = $logObj->update($logItem); $resp['id'] = $ir->id; } } return $resp; }
<?php require_once '../../application/conf/config.php'; $class = new videos(); $class->videos_galeria();
function createStoryContent($userinfo = NULL, $info = NULL, $mode = 'link') { // post a story from the post story form // build source from domain - to do : improve this with source objects table $urlParts = parse_url($info->url); $info->source = $urlParts['host']; // create permalink $info->permalink = $this->buildPermalink($info->title); //$this->db->log($info->permalink); // serialize the content // mode = link for third party web site story link and blog for blog posts if ($mode == 'link') { $isBlogEntry = 0; } else { $isBlogEntry = 1; } $story = $this->serialize(0, $info->title, $info->caption, $info->source, $info->url, $info->permalink, $userinfo->ncUid, $userinfo->u->name, $userinfo->userid, '', $userinfo->votePower, 0, 0, $info->imageUrl, 0, $isBlogEntry, $info->isFeatureCandidate); // post wire story to content $siteContentId = $this->add($story); if ($info->videoEmbed != '') { // add video if it exists require_once PATH_CORE . '/classes/video.class.php'; $videoURL = videos::getVideoURLFromEmbedCodeOrURL(stripslashes($info->videoEmbed)); if (videos::validateVideoURL($videoURL)) { $vt = new VideoTable($this->db); // create new video $videoid = $vt->createVideoForContent($userinfo->userid, $videoURL, "Video for story {$siteContentId}"); if (is_numeric($videoid)) { $this->db->update("Content", "videoid={$videoid}", "siteContentId={$siteContentId}"); } // store video id in content table } else { // error on video, should have been picked up by validate } } return $siteContentId; }
<?php require_once '../../application/conf/config.php'; $class = new videos(); $class->videos();
//} } $resultsec = publishedvideos::model()->findAll('id > :numsz', array(':numsz' => 0)); foreach ($resultsec as $ddufa) { for ($d; $d >= 0; $d--) { $standit = publishedvideos::model()->findAll('id=:d', array(':d' => $d)); foreach ($standit as $one) { echo '<div class="post"><iframe width="400" height="300" src=' . $one->videolink . ' frameborder="0" allowfullscreen></iframe></div>'; } } } ?> <?php $vid = new videos(); if ($_POST['name'] != '') { $vid->username = $_POST['name']; $vid->videolink = $_POST['vlink']; $vid->comment = $_POST['comment']; $vid->moderation = 'no'; $vid->save(false); } ?>
function fetchVideoComment($videoURL, $width = 160, $height = 100) { require_once PATH_CORE . '/classes/video.class.php'; $code = '<div style="text-align:center;">' . videos::buildPlayerFromLink($videoURL, $width, $height) . '</div>'; return $code; }
$count++; switch ($mtype) { case 'image': if ($c->images()->first()) { $media[] = array('type' => $mtype, 'url' => $c->images()->first()->url(), 'width' => $c->images()->first()->width(), 'height' => $c->images()->first()->height(), 'title' => $title, 'caption_title' => $caption_title, 'description' => $description); } break; case 'video': $embed = ''; $url = $c->video_url()->value; if (!isset($c->video_embed()->value) || $c->video_embed()->value == '') { $embed = videos::embed($url); } else { $embed = $c->video_embed()->value; } $media[] = array('type' => $mtype, 'id' => videos::id($url), 'url' => $c->video_url()->value, 'title' => $title, 'caption_title' => $caption_title, 'description' => $description, 'embed' => $embed, 'thumb' => videos::thumb($url)); break; case 'audio': $embed = ''; $url = $c->audio_url()->value; if (!isset($c->audio_embed()->value) || $c->audio_embed()->value == '') { $embed = scaudio::embed($url); } else { $embed = $c->audio_embed()->value; } $media[] = array('type' => $mtype, 'id' => $url, 'url' => $url, 'title' => $title, 'caption_title' => $caption_title, 'description' => $description, 'embed' => $embed, 'thumb' => scaudio::thumb($url)); break; } } $media['length'] = $count; if (!empty($media)) {
//adding from all 'no' videos if ($_POST['ac' . $buf->id] != '') { $vid = new publishedvideos(); $vid->username = $buf->username; $vid->videolink = $buf->videolink; $vid->comment = $buf->comment; $vid->save(); $post = videos::model()->findByPk($buf->id); $post->moderation = 'yes'; //$post->id=$b+1; $post->save(); header("Refresh:0"); } //delete if bad if ($_POST['ca' . $buf->id] != '') { $post = videos::model()->findByPk($buf->id); $post->delete(); header("Refresh:0"); } $disre = '<br/><form action="http://play-now.ua/index.php/site/admin" method="post"> <input style="visibility:hidden;width:10px;" name="ac' . $buf->id . '" type="text" size="15" maxlength="16" value="yes"><input type="submit" onclick="fade_out_yes()" name="control" value="publish"></form><br/><form action="http://play-now.ua/index.php/site/admin" method="post"><input style="width:10px;visibility:hidden;" name="ca' . $buf->id . '" type="text" size="15" maxlength="16" value="nope"><input type="submit" onclick="fade_out_yes()" name="control" value="reject"></form> <br/>'; echo '<div style="padding:20px;border-bottom:2px solid black;"><i>From: </i>' . $buf->username . '<br/><iframe width="400" height="300" src="' . $buf->videolink . '" frameborder="0" allowfullscreen></iframe><br/> ' . $buf->comment . '<br/>' . $disre . '</div><br/>'; } } /*$enta = new videos; if($_POST['ac'] != ''){ $enta->moderation=$_POST['ac']; $enta->save(false);}*/ echo '<h3><b>= Edit video =</b></h3><br/>'; $numsz = 0; $a = 0; $arr = array();
function validate($option = 'link') { $this->setupLibraries(); $fData = new stdClass(); $fData->result = true; $fData->state = 'validate'; $fData->url = $_POST['url']; $fData->imageUrl = $_POST['imageUrl']; $fData->videoEmbed = $_POST['videoEmbed']; // Remove microsoft quotes $bad = array('`', '’', '„', '‘', '’', '´'); $good = array('\'', '\'', ',', '\'', '\'', '\''); $title = str_replace($bad, $good, $_POST['title']); $fData->title = stripslashes(strip_tags($title)); // took out mysql_real_escape $fData->tags = $_POST['tags']; $fData->mediatype = $_POST['mediatype']; if (isset($_POST['isFeatureCandidate']) and $_POST['isFeatureCandidate'] == 'on') { $fData->isFeatureCandidate = 1; } else { $fData->isFeatureCandidate = 0; } $fData->isBookmarklet = true; $fData->showPreview = false; $fData->alert = ''; $fData->title = stripslashes(strip_tags($_POST['title'])); $fData->caption = stripslashes($_POST['caption']); //$fData->title=mysql_real_escape_string(addslashes(stripslashes(strip_tags($_POST['title'])))); //$fData->caption=mysql_real_escape_string(stripslashes($_POST['caption']), $this->db->handle); // begin option specific code and error checking switch ($option) { default: $fData->caption = stripslashes(strip_tags($_POST['caption'])); if ($fData->url == '') { $fData->alert = 'Please provide a Web address (URL) for your story.'; $fData->result = false; } if ($fData->caption == '') { $fData->alert = 'Please provide a short caption for your entry.'; $fData->result = false; } if (strlen($fData->caption) > LENGTH_LONG_CAPTION + 5) { $fData->alert = 'Please shorten your caption to ' . LENGTH_LONG_CAPTION . ' characters. Current length: ' . strlen($fData->caption); $fData->result = false; } break; case 'blog': if (isset($_POST['blogid'])) { $fData->blogid = $_POST['blogid']; } $fData->status = 'draft'; // only allowable html, fbml $fData->entry = stripslashes(strip_tags($_POST['entry'], '<p><a><i><br><em><strong><img>')); // <fb:photo><fb:mp3><fb:swf><fb:flv><fb:silverlight> $fData->caption = stripslashes(strip_tags($_POST['caption'])); if ($fData->entry == '' or strlen($fData->entry) < MIN_BLOG_LENGTH) { $fData->alert = 'Please compose a blog post of at least ' . MIN_BLOG_LENGTH . ' characters (not counting HTML tags). Current length: ' . strlen($fData->entry); $fData->result = false; $lengthError = true; } else { $lengthError = false; } if (strlen($fData->entry) > MAX_BLOG_LENGTH) { $fData->alert = 'Please shorten your blog entry to ' . MAX_BLOG_LENGTH . ' characters. Current length: ' . strlen($fData->entry); $fData->result = false; } if ($fData->caption != '') { // if it exists already, then check that it meets the minimum length requirements if (strlen($fData->caption) > LENGTH_LONG_CAPTION + 5) { $temp = $utilObj->shorten($_POST['caption'], LENGTH_LONG_CAPTION); $fData->caption = $temp; } } else { // if it doesn't exist, create require_once PATH_CORE . '/classes/utilities.class.php'; $utilObj = new utilities($this->db); $temp = $utilObj->shorten($fData->entry, CAPTION_LENGTH); if (!$lengthError and strlen($temp) < 100) { $fData->alert = 'Please compose a blog entry for a caption of at least ' . MIN_BLOG_LENGTH . ' characters (not counting HTML tags). Current length: ' . strlen($temp); $fData->result = false; } $fData->caption = $temp; } break; } // tags /* if ($fData->tags=='') { $fData->alert='Please provide at least one tag.'; $fData->result=false; } * */ // check user has minimum # of friends - to prevent spam if (isset($_POST['fb_sig_friends']) and count(explode(',', $_POST['fb_sig_friends'])) < MIN_FRIENDS) { // suspiciously low # of friends to be posting $fData->alert = 'Please add more friends to your Facebook profile before you post stories here. This helps us minimize spam. Sorry for the inconvenience.'; $fData->result = false; } //title if (strcmp(strtoupper($fData->title), $fData->title) == 0) { $fData->title = $temp = ucwords(strtolower($fData->title)); $fData->alert = 'We\'ve modified your headline so that it\'s not all uppercase. Please check it.'; $fData->result = false; } if ($fData->title == '') { $fData->alert = 'Please provide a short headline for your entry.'; $fData->result = false; } if (strlen($fData->title) > $this->titleLimit) { $fData->alert = 'Please shorten your title to ' . $this->titleLimit . ' characters. Current length: ' . strlen($fData->title); $fData->result = false; } /* We might want this later if ($fData->imageUrl=='' ) { $fData->alert='Please provide a Web address (IMAGE URL) for your story image.'; $fData->result=false; } */ // url if ($fData->url != '') { $urlParts = parse_url($fData->url); // make sure url has http:// or other scheme in front of it if ($urlParts['scheme'] == '') { $fData->url = 'http://' . $fData->url; } if (($urlParts['path'] == '' or $urlParts['path'] == '/') and $urlParts['query'] == '') { $fData->alert = 'You seem to be writing about a Web site, not a particular story on a Web site. Please do not submit links to Web sites. Please only submit stories from Web sites and blogs.'; $fData->result = false; } if (preg_match('/^http:\\/\\/www.facebook.com\\/ext\\/share.php/', $fData->url)) { $fData->alert = 'You seem to be posting a shared story from facebook. Please go to the actual story page and post again from there.'; $fData->result = false; } } // Check for rate limits on post story if (!($this->session->u->isAdmin || $this->session->u->isModerator || $this->session->u->isSponser)) { $resp = $this->logObj->checkLimits($this->session->userid, "(action = 'postStory' OR action = 'postBlog')", 'posting'); if ($resp !== false) { $fData->alert = $resp['msg']; $fData->result = false; } } // validate the video if ($fData->videoEmbed != '') { require_once PATH_CORE . '/classes/video.class.php'; $videoURL = videos::getVideoURLFromEmbedCodeOrURL(stripslashes($fData->videoEmbed)); if (!videos::validateVideoURL($fData->videoEmbed)) { $fData->alert = 'Your video URL or embedding code is invalid. We only support Facebook and YouTube videos at this time.'; $fData->result = false; } } $this->fData =& $fData; return $fData; }
/** * Begin the task of adding photos. */ public function start() { access::verify_csrf(); $item = ORM::factory("item", Input::instance()->get("item_id")); $task_def = Task_Definition::factory()->callback("Videos_Controller::add")->description(t("Add photos or movies from the local server"))->name(t("Add from server")); $task = task::create($task_def, array("item_id" => $item->id)); foreach (Input::instance()->post("paths") as $path) { if (videos::is_valid_path($path)) { $entry = ORM::factory("videos_entry"); $entry->path = $path; $entry->is_directory = intval(is_dir($path)); $entry->parent_id = null; $entry->task_id = $task->id; $entry->save(); } } json::reply(array("result" => "started", "status" => (string) $task->status, "url" => url::site("videos/run/{$task->id}?csrf=" . access::csrf_token()))); }
echo $pages->active()->children()->first()->images()->first()->url(); ?> " /> <meta property="og:image:url" content="<?php echo $pages->active()->children()->first()->images()->first()->url(); ?> " /> <?php } elseif ($pages->active()->children()->first()->template() === 'video') { ?> <meta property="og:image" content="<?php echo videos::thumb($pages->active()->children()->first()->video_url()); ?> " /> <meta property="og:image:url" content="<?php echo videos::thumb($pages->active()->children()->first()->video_url()); ?> " /> <?php } ?> <?php } ?> <?php } elseif ($category_name !== null) { ?> <meta property="og:title" content="<?php echo $site->title . ' - Category Archive - ' . $category_name; ?> " />