function isValid() { $mainframe =& JFactory::getApplication(); $file = $this->getFeedUrl(); $xmlContent = getContentFromUrl($file); require_once (JPATH_COMPONENT . DS . 'libraries' . DS . 'remote.php'); if (empty($this->videoId)) { $url = $this->getFailedUrl(); $message = JText::_('INVALID VIDEO ID'); $mainframe->redirect( $url , $message ); } elseif($xmlContent == FALSE) { $url = $this->getFailedUrl(); $message = JText::_('ERROR FETCHING VIDEO'); $mainframe->redirect( $url , $message ); } else { $options['rssUrl'] = $file; $rssDoc=& JFactory::getXMLParser('RSS',$options); foreach ($rssDoc->get_items() as $item): $this->title = $item->get_title(); $this->description = $item->get_description(); endforeach; return true; } }
function isValid() { $mainframe =& JFactory::getApplication(); $file = 'http://gdata.youtube.com/feeds/api/videos/' .$this->videoId ; require_once (JPATH_COMPONENT . DS . 'libraries' . DS . 'remote.php'); $xmlContent = getContentFromUrl($file); if (empty($this->videoId)) { $url = $this->getFailedUrl(); $message = JText::_('Invalid Video Id'); $mainframe->redirect( $url , $message ); } elseif($xmlContent == 'Invalid id') { $url = $this->getFailedUrl(); $message = JText::_('Invalid Video Id'); $mainframe->redirect( $url , $message ); } elseif($xmlContent == false) { $url = $this->getFailedUrl(); $message = JText::_('Error fetching video'); $mainframe->redirect( $url , $message ); } else { //Get title $pattern = "/<title type='text'>(.*?)<\/title>/i"; preg_match_all($pattern, $xmlContent, $matches); if($matches) { $this->title = $matches[1][0]; } //Get description $pattern = "/<content type='text'>(.*?)<\/content>/s"; preg_match_all($pattern, $xmlContent, $matches); if($matches) { $this->description = $matches[1][0]; } //Get duration $pattern = "/seconds='(.+?)'/i"; preg_match_all($pattern, $xmlContent, $matches); if($matches) { $this->duration = $matches[1][0]; } return true; } }
function isValid() { $mainframe =& JFactory::getApplication(); $file = $this->getFeedUrl(); require_once (JPATH_COMPONENT . DS . 'libraries' . DS . 'remote.php'); $xmlContent = getContentFromUrl($file); if (empty($this->videoId)) { $url = $this->getFailedUrl(); $message = JText::_('Invalid video id'); $mainframe->redirect( $url , $message ); } elseif($xmlContent == FALSE) { $url = $this->getFailedUrl(); $message = JText::_('Error Fetching video'); $mainframe->redirect( $url , $message ); } else { // get title $pattern = "'<title>(.*?)<\/title>'s"; preg_match_all($pattern, $xmlContent, $matches); if($matches){ $this->title = $matches[1][0]; } // get description $pattern = "'<description>(.*?)<\/description>'s"; preg_match_all($pattern, $xmlContent, $matches); if($matches){ $this->description = $matches[0][0]; $this->description = str_replace('<![CDATA[', '', $this->description); $this->description = str_replace(']]>', '', $this->description); $this->description = str_replace('<description>', '', $this->description); $this->description = trim(str_replace('</description>', '', $this->description)); } // get thumbnail $pattern = "'<thumbnail-url>(.*?)<\/thumbnail-url>'s"; preg_match_all($pattern, $xmlContent, $matches); if($matches){ $this->thumbnail = $matches[0][0]; $this->thumbnail = str_replace('<thumbnail-url>', '', $this->thumbnail); $this->thumbnail = trim(str_replace('</thumbnail-url>', '', $this->thumbnail)); } // get duration $this->duration = $videoObj->duration; return true; } }
function isValid() { $mainframe =& JFactory::getApplication(); $file = $this->getFeedUrl(); $xmlContent = getContentFromUrl($file); require_once (JPATH_COMPONENT . DS . 'libraries' . DS . 'remote.php'); if (empty($this->videoId)) { $url = $this->getFailedUrl(); $message = JText::_('INVALID VIDEO ID'); $mainframe->redirect( $url , $message ); } elseif($xmlContent == FALSE) { $url = $this->getFailedUrl(); $message = JText::_('ERROR FETCHING VIDEO'); $mainframe->redirect( $url , $message ); } else { libxml_use_internal_errors(true); // Yeah if you are so worried about using @ with warnings $doc = new DomDocument(); $doc->loadHTML($xmlContent); $xpath = new DOMXPath($doc); $query = '//*/meta[starts-with(@property, \'og:\')]'; $metas = $xpath->query($query); foreach ($metas as $meta) { $property = $meta->getAttribute('property'); $content = $meta->getAttribute('content'); $rmetas[$property] = $content; } //Get title if($rmetas['og:title']) $this->title = $rmetas['og:title']; //Get description if($rmetas['og:description']) $this->description = $rmetas['og:description']; //Get duration // get thumbnail if($rmetas['og:image']) $this->thumbnail = $rmetas['og:image']; if(empty($this->thumbnail)) $this->thumbnail=JURI::base().'components/com_awdwall/images/videothumb.jpg'; return true; } }
function getProvider($videoLink) { $mainframe =& JFactory::getApplication(); $videoObj = null; // $videoLink = 'http://'.JString::str_ireplace( 'http://' , '' , $videoLink ); $parsedVideoLink = parse_url($videoLink); preg_match('/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i', $parsedVideoLink['host'], $matches); $domain = $matches['domain']; $user = &JFactory::getUser(); //verify domain if (empty($domain)){ $redirect = JRoute::_('index.php?option=com_awdwall&&view=awdwall', false); $message = JText::_('Invalid video Url'); $mainframe->redirect($redirect , $message, 'error'); } //verify url require_once (JPATH_COMPONENT . DS . 'libraries' . DS . 'remote.php'); if(getContentFromUrl($videoLink) == false){ $url = JRoute::_('index.php?option=com_awdwall&&view=awdwall', false); $message = JText::_('Error fetching video'); $mainframe->redirect( $url , $message ); } $provider = explode('.', $domain); $providerName = JString::strtolower($provider[0]); $libraryPath = JPATH_COMPONENT . DS . 'libraries' . DS . 'videos' . DS . $providerName . '.php'; jimport('joomla.filesystem.file'); if (!JFile::exists($libraryPath)){ $redirect = JRoute::_('index.php?option=com_awdwall&&view=awdwall', false); $message = JText::_('Video Provider is not supported'); $mainframe->redirect($redirect , $message, 'error'); } $db =& JFactory::getDBO(); require_once($libraryPath); $className = 'TableVideo' . JString::ucfirst($providerName); $videoObj = new $className($db); $videoObj->init($videoLink); return $videoObj; }
function isValid() { $mainframe =& JFactory::getApplication(); $file = $this->getFeedUrl(); $xmlContent = getContentFromUrl($file); require_once (JPATH_COMPONENT . DS . 'libraries' . DS . 'remote.php'); if (empty($this->videoId)) { $url = $this->getFailedUrl(); $message = JText::_('Invalid video id'); $mainframe->redirect( $url , $message ); } elseif($xmlContent == FALSE) { $url = $this->getFailedUrl(); $message = JText::_('Error Fetching video'); $mainframe->redirect( $url , $message ); } else { $pattern = "'<h1 id=\"tv_tbar_title\">(.*?)<\/h1>'s"; preg_match_all($pattern, $xmlContent, $matches); if($matches){ $this->title = $matches[1][0]; } // get description $pattern = "'<b id=\"tv_vid_vd_truncdesc_text\">(.*?)<\/b>'s"; preg_match_all($pattern, $xmlContent, $matches); if($matches){ $this->description = trim(strip_tags($matches[1][0])); } // get thumbnail $pattern = "'<link rel=\"image_src\" href=\"(.*?)\" \/>'s"; preg_match_all($pattern, $xmlContent, $matches); if($matches){ $this->thumbnail = rawurldecode($matches[1][0]); } return true; } }
function isValid() { $mainframe =& JFactory::getApplication(); $file = $this->getFeedUrl(); $xmlContent = getContentFromUrl($file); require_once (JPATH_COMPONENT . DS . 'libraries' . DS . 'remote.php'); if (empty($this->videoId)) { $url = $this->getFailedUrl(); $message = JText::_('INVALID VIDEO ID'); $mainframe->redirect( $url , $message ); } elseif($xmlContent == FALSE) { $url = $this->getFailedUrl(); $message = JText::_('ERROR FETCHING VIDEO'); $mainframe->redirect( $url , $message ); } else { //Get title $res = preg_match("/<title>LiveLeak.com - (.*)<\/title>/", $xmlContent, $title_matches); $this->title = $title_matches[1]; //Get description $res = preg_match('/<meta property="og:description" content="(.*)"/', $xmlContent, $title_matches); $this->description = $title_matches[1]; //Get duration //Get thumbnail //$noPreview = 'http://209.197.7.204/e3m9u5m8/cds/u/nopreview.jpg'; // get thumbnail $res = preg_match('/<meta property="og:image" content="(.*)"/', $xmlContent, $title_matches); $this->thumbnail = $title_matches[1]; if(empty($this->thumbnail)) $this->thumbnail=JURI::base().'components/com_awdwall/images/videothumb.jpg'; return true; } }
function isValid() { $mainframe =& JFactory::getApplication(); $file = $this->getFeedUrl(); $xmlContent = getContentFromUrl($file); require_once (JPATH_COMPONENT . DS . 'libraries' . DS . 'remote.php'); if (empty($this->videoId)) { $url = $this->getFailedUrl(); $message = JText::_('INVALID VIDEO ID'); $mainframe->redirect( $url , $message ); } elseif($xmlContent == FALSE) { $url = $this->getFailedUrl(); $message = JText::_('ERROR FETCHING VIDEO'); $mainframe->redirect( $url , $message ); } else { //Get title $pattern = "'<meta property=\"og:title\" content=\"(.*?)\"'s"; preg_match_all($pattern, $xmlContent, $matches); $this->title = $matches[1][0]; if($this->title == ''){ $pattern = "'name=\"context_title\" value=\"(.*?)\"'s"; preg_match_all($pattern, $xmlContent, $matches); $this->title = $matches[1][0]; } //Get description $pattern = "'<meta property=\"og:description\" content=\"(.*?)\"'s"; preg_match_all($pattern, $xmlContent, $matches); $this->description = $matches[1][0]; if($this->description == ''){ $pattern = "'desc\":\"(.*?)\"'s"; preg_match_all($pattern, $xmlContent, $matches); $this->description = stripslashes($matches[1][0]); } //Get duration $pattern = "'x-duration=\"(.*?)\"'s"; preg_match_all($pattern, $xmlContent, $matches); $this->duration = $matches[1][0]; if($this->duration == ''){ $pattern = "'durtn\":\"(.*?)\"'s"; preg_match_all($pattern, $xmlContent, $matches); $duration = $matches[1][0]; } if($this->duration != ''){ $sec = 0; $time = explode(':',$this->duration); if($time[0] > 0){ $sec = $time[0]*60; } $this->duration = $sec + $time[1]; }else{ $this->duration = false; } $duration = null; // Get description $pattern = "'x-duration=\"(.*?)\"'s"; preg_match_all($pattern, $xmlContent, $matches); $duration = $matches[1][0]; if($duration == ''){ $pattern = "'durtn\":\"(.*?)\"'s"; preg_match_all($pattern, $xmlContent, $matches); $duration = $matches[1][0]; } if($duration != ''){ $sec = 0; $time = explode(':',$duration); if($time[0] > 0){ $sec = $time[0]*60; } $duration = $sec + $time[1]; }else{ $duration = false; } $this->duration=$duration; //Get thumbnail $pattern = "'thmb_url\":\"(.*?)\"'s"; preg_match_all($pattern, $xmlContent, $matches); $this->thumbnail = stripslashes($matches[1][0]); if($this->thumbnail == ''){ $pattern = "'<meta property=\"og:image\" content=\"(.*?)\"'s"; preg_match_all($pattern, $xmlContent, $matches); if( $matches && !empty($matches[1][0]) ) { $this->thumbnail = urldecode($matches[1][0]); } } return true; } }
/** * Check the file mentioned as update_url for the latest plugin version available. * Messages that can be returned: * unknown - returned if the plugin doesn't provide an update url * latest - returned if the plugin version matches the version number registerd at the url * error - returned if the update url could not be reached or for any other reason * * @param plugin object A plugin object. * * @return string The latest version number or a localized message. */ static function checkLatest($plugin) { $data = null; if (!defined('CHECK_UPDATES') || !CHECK_UPDATES) { return __('unknown'); } // Check if plugin has update file url set if (!isset($plugin->update_url)) { return __('unknown'); } // Check if update file was already cached and is no older than 30 minutes if (array_key_exists($plugin->update_url, Plugin::$updatefile_cache) && Plugin::$updatefile_cache[$plugin->update_url]['time'] + 30 * 60 < time()) { unset(Plugin::$updatefile_cache[$plugin->update_url]); } if (!array_key_exists($plugin->update_url, Plugin::$updatefile_cache)) { // Read and cache the update file if (!($data = getContentFromUrl($plugin->update_url))) { return __('error'); } Plugin::$updatefile_cache[$plugin->update_url] = array('time' => time(), 'data' => $data); } $xml = simplexml_load_string(Plugin::$updatefile_cache[$plugin->update_url]['data']); foreach ($xml as $node) { if ($plugin->id == $node->id) { if ($plugin->version == $node->version) { return __('latest'); } else { return (string) $node->version; } } } return __('error'); }
function getViewHTML($videoId, $videoWidth='425' , $videoHeight='344') { $file = $this->getFeedUrl(); $xmlContent = getContentFromUrl($file); $pattern = "'<link rel=\"video_src\" href=\"(.*?)\"( \/)?(>)'s"; preg_match_all($pattern, $xmlContent, $matches); if($matches) { $videoUrl = rawurldecode($matches[1][0]); } return '<embed width="'.$videoWidth.'" height="'.$videoHeight.'" wmode="transparent" allowFullScreen="true" type="application/x-shockwave-flash" src="'.$videoUrl.'"/>'; }
private function _checkVersion() { if (!defined("CHECK_UPDATES") || !CHECK_UPDATES) { return; } $v = getContentFromUrl("http://www.wolfcms.org/version/"); if ($v === false && $v > CMS_VERSION) { $message = Flash::set("error", __("<b>Information!</b> New Wolf version available (v. <b>:version</b>)! Visit <a href='http://www.wolfcms.org/'>http://www.wolfcms.org/</a> to upgrade your version!", array(":version" => $v))); } }
function getViewHTML($videoId, $videoWidth='425' , $videoHeight='344') { if (!$videoId) { $videoId = $this->videoId; } $file = 'http://blip.tv/file/'.$videoId.'?skin=rss'; $xmlContent = getContentFromUrl($file); // get embedFile $pattern = "'<blip:embedLookup>(.*?)<\/blip:embedLookup>'s"; $embedFile = ''; preg_match_all($pattern, $xmlContent, $matches); if($matches) { $embedFile = $matches[1][0]; } return '<object width="'.$videoWidth.'" height="'.$videoHeight.'"><param name="movie" value="http://blip.tv/play/'.$embedFile.'"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://blip.tv/play/'.$embedFile.'" type="application/x-shockwave-flash" width="'.$videoWidth.'" height="'.$videoHeight.'" allowscriptaccess="always" allowfullscreen="true" wmode="transparent"></embed></object>'; }
function getViewHTML($videoId, $videoWidth='475' , $videoHeight='325') { $file = $this->getFeedUrl(); $xmlContent = getContentFromUrl($file); if(strstr($xmlContent,'<meta property="og:video"')) { preg_match_all('/<meta property="og:video".*?content\s*=\s*["\'](.+?)["\']/im', $xmlContent, $images); $videofile = str_replace("facebook_","",$images[1][0]); } $embed = '<embed id="live_embed_player_flash" name="live_embed_player_flash" wmode="transparent" src="'.$videofile.'" width="'.$videoWidth.'" height="'.$videoHeight.'" allowScriptAccess="always" allowFullScreen="true" type="application/x-shockwave-flash" />'; return $embed; }
function getViewHTML($videoId, $videoWidth='425' , $videoHeight='344') { $file = $this->getFeedUrl(); $xmlContent = getContentFromUrl($file); if(strstr($this->videoUrl,'u=')) { $videofile = explode('u=',$this->videoUrl); if (strstr($videofile[1],"&")) { $videofile = explode("&",$videofile[1]); $videofile = "c=".$videofile[0]."&e=0"; } else { $videofile = $videofile[1]; } } $videofile = str_replace('&e=0','&e=1',$videofile); $embed = '<iframe allowtransparency="true" marginwidth="0" marginheight="0" src="http://www.mips.tv/player/embedplayer.php?id='.$videofile.'&e=1&width=475&height=325" frameborder="0" height="325" width="475" scrolling="no"><embed></embed></iframe>'; return $embed ; }
function addLink() { $user = &JFactory::getUser(); $wuid = JRequest::getInt('wuid', 0); if($wuid == 0) $wuid = $user->id; $groupId = JRequest::getInt('groupid', NULL); $itemId = AwdwallHelperUser::getComItemId(); $db =& JFactory::getDBO(); if((int)$user->id){ require_once (JPATH_COMPONENT . DS . 'models' . DS . 'wall.php'); $link = JRequest::getVar('awd_link', ''); //echo $link; if($link != ''){ //$vLink = 'http://'.JString::str_ireplace( 'http://' , '' , $link ); $parsedVideoLink = parse_url($link); preg_match('/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i', $parsedVideoLink['host'], $matches); $domain = $matches['domain']; if($domain=='youtu.be') { $vidoid=str_replace('http://youtu.be/','',$link); if($vidoid) $link = 'http://www.youtube.com/watch?v='.$vidoid; } // add video require_once (JPATH_COMPONENT . DS . 'libraries' . DS . 'linkvideo.php'); $check_link = linkvideo::typelink($link); $typelink = array('howcast', 'metacafe', 'myspace', 'vimeo', 'youtube','blip','break','dailymotion','flickr','justin','liveleak','livestream','mips','mtv','photobucket','twitch','ustream'); if(in_array($check_link, $typelink)){ $video = linkvideo::getidvideo($check_link, $link); if($video->videoId){ linkvideo::addlinkvideo($link); exit; } } // get title and description tag require_once (JPATH_COMPONENT . DS . 'libraries' . DS . 'remote.php'); $title = ''; $description = ''; $fileName = ''; $link = JRequest::getString('awd_link', $link); // if(!stripos($link, "www")){ // // $link = str_replace("http://", "http://www.", $link); // // } $content = getContentFromUrl($link); // get title // $file = fopen($link, "r"); // if (!$file) // { // exit("Problem occured"); // } // $data = ''; // while (!feof($file)) // { // $data .= fgets($file, 1024); // } // get title $pattern = "'<title>(.*?)<\/title>'s"; preg_match_all($pattern, $content, $matches); //if($matches){ $title = $matches[1][0]; //} $tags = get_meta_tags($link); $description = $tags['description']; if(empty($description)){ $pattern = "/<meta name=\"description\" content=\"(.*)\" \/>/i"; preg_match_all($pattern, $content, $matches); if( $matches && !empty($matches[1][0]) ) { $description = trim(strip_tags($matches[1][0],'<br /><br>')); } } // get body content $pattern = "'<body(.*)>(.*?)<\/body>'s"; preg_match_all($pattern, $content, $matches); if($matches){ $body = $matches[0][0]; $pattern = "/<img[^>]+>/i"; preg_match_all($pattern, $body, $matches); if($matches){ $image = $matches[0][0]; preg_match_all('/(alt|title|src)=("[^"]*")/i', $image, $img); $src = str_replace('"', '', $img[2][0]); $imageContent = file_get_contents($src); } } // save into wall table first $wall = &JTable::getInstance('Wall', 'Table'); $wall->user_id = $wuid; $wall->type = 'link'; $wall->commenter_id = $user->id; $wall->user_name = ''; $wall->avatar = ''; $wall->message = ''; $wall->reply = 0; $wall->is_read = 0; $wall->is_pm = 0; $wall->is_reply = 0; $wall->posted_id = NULL; $wall->wall_date = NULL; $title = ltrim($title); $title = rtrim($title); $description = ltrim($description); $description = rtrim($description); // store wall to database if (!$wall->store()){ $this->setRedirect(JRoute::_('index.php?option=com_awdwall&&view=awdwall&layout=main&Itemid='.$itemId , false ), JText::_('Post Failed')); } $wallId = $wall->id; $sql = 'INSERT INTO #__awd_wall_links(wall_id, title, link, path, description) VALUES("'.$wallId .'","' . $title . '", "' . $link . '", "' . $fileName . '","' . $description . '")'; $db->setQuery($sql); $db->query(); } $string = getContentFromUrl($link); $image_regex = '/<img[^>]*'.'src=[\"|\'](.*)[\"|\']/Ui'; preg_match_all($image_regex, $string, $img, PREG_PATTERN_ORDER); $images_array = $img[1]; $error = ''; $msg = "File Name: hello"; //$link_new = '<a href=' . $link . ' target=_blank>' . $link . '</a>'; //$title_new = '<span class=editable>' . $title . '</span>'; //$temp = $link_new.$title_new; $file = $description; //images //$d = strrpos($link, '/'); //$first_link = substr($link, 0, $d); preg_match('/http:\/\/(.*).(.*)\//', $link, $link_root); $first_link = $link_root[0]; $d = 0; $n = count($images_array); if ($n>0){ for($k=0; $k<$n;$k++){ $check = strrpos($images_array[$k], 'http'); if((string)$check == ""){ $images_array[$k] = $first_link . $images_array[$k]; } if(@GetImageSize($images_array[$k])){ list($width, $height) = getimagesize($images_array[$k]); if($width >= 50) { $d = $d + 1; if($d == 1){ $link_img1 = $images_array[$k]; $query = "UPDATE #__awd_wall_links SET link_img = '$link_img1' WHERE wall_id = '$wallId'"; $db->setQuery($query); $db->query(); $img = '<img id='.$d.' class=no_hidden src='.$images_array[$k].'>'.$img; }else{ $img = '<img id='.$d.' class=hidden src='.$images_array[$k].'>'.$img; } } } } }else{ echo 'no image'; } //$img = $img.'<input type=hidden id=count_img value='.$n.' />'; echo '{"type": "link","foo": "'.$file.'","img": "'.$img.'","count_img": "'.$d.'","error": "' . $error . '","msg": "' . $msg . '","file": "<a href=' . $link . ' target=_blank>' . $link . '</a>","wid_tmp": "' . $wallId . '","title": "' . $title . '"}'; //echo '{"foo": "'.$file.'","img": "'.$img.'","error": "' . $error . '","msg": "' . $msg . '","file": "<a href=' . $link . ' target=_blank>' . $link . '</a>","wid_tmp": "' . $wallId . '","title": "<span class=editable>' . $title . '</span>"}'; /* echo "{"; echo '"error": "' . $error . '",'; echo '"msg": "' . $msg . '",'; echo '"file": "<a href=' . $link . ' target=_blank>' . $link . '</a>",'; echo '"wid_tmp": "' . $wallId . '"'; echo "}"; */ /* echo 'img:'; $n = count($images_array); for ($i=0;$i<=$n;$i++) { if($images_array[$i]) { if(getimagesize($images_array[$i])) { list($width, $height, $type, $attr) = getimagesize(@$images_array[$i]); if($width >= 50 && $height >= 50 ){ echo "<img src='".@$images_array[$i]."' width='100' id='".$k."' >"; $k++; } } } } */ } exit; }
function getViewHTML($videoId, $videoWidth='475' , $videoHeight='325') { if (!$videoId) { $videoId = $this->videoUrl; } $file = 'http://www.mtv.com/videos/'.$videoId; $xmlContent = getContentFromUrl($file); $videoPath = explode( '/' , $videoId); $pattern = "/http:\/\/media.mtvnservices.com\/mgid:uma:(.*?)\"/i"; preg_match_all($pattern, $xmlContent, $matches); if( $matches[1][0] ) { $path = $matches[1][0]; $getId = explode( ':' , $matches[1][0]); } if($getId[0] == 'video') { $flashVars = 'flashVars="configParams=vid=' . $getId[2]; } else { $id = explode( '=' , $videoPath[2]); $flashVars = $videoPath[0]=='movie-trailers' ? NULL : 'flashVars="configParams=id=' . $id[1] . '"'; } $embed = '<embed src="http://media.mtvnservices.com/mgid:uma:' . $path . '" width="' . $videoWidth . '" height="' . $videoHeight . '" ' . $flashVars . '" type="application/x-shockwave-flash" allowFullScreen="true" allowScriptAccess="always" base="." wmode="transparent"></embed>'; return $embed; }
/** * Checks what the latest Wolf version is that is available at wolfcms.org * * @todo Make this check optional through the configuration file */ private function _checkVersion() { if (!defined('CHECK_UPDATES') || !CHECK_UPDATES) { return; } $v = getContentFromUrl('http://www.wolfcms.org/version/'); if (false !== $v && $v > CMS_VERSION) { Flash::set('error', __('<b>Information!</b> New Wolf version available (v. <b>:version</b>)! Visit <a href="http://www.wolfcms.org/">http://www.wolfcms.org/</a> to upgrade your version!', array(':version' => $v))); } }
function getViewHTML($videoId, $videoWidth='475' , $videoHeight='325') { if (!$videoId) { $videoId = $this->videoId; } $file = 'http://www.break.com/'.$videoId; $xmlContent = getContentFromUrl($file); $pattern = "'<meta name=\"embed_video_url\" content=\"(.*?)\"( /)?(>)'s"; preg_match_all($pattern, $xmlContent, $matches); if($matches) { $videoUrl = $matches[1][0]; } $embed="<embed src=\"".$videoUrl."\" width=\"".$videoWidth."\" height=\"".$videoHeight."\" wmode=\"transparent\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" allowFullScreen=\"true\"> </embed>"; return $embed; }
function getViewHTML($videoId, $videoWidth='475' , $videoHeight='325') { if (!$videoId) { $videoId = $this->videoId; } $file = 'http://media.photobucket.com/video/'.str_ireplace( " ", "%20", $videoId ); $xmlContent = getContentFromUrl($file); $pattern = "'<link rel=\"video_src\" href=\"(.*?)\" \/>'s"; preg_match_all($pattern, $xmlContent, $matches); if($matches) { $videoUrl= rawurldecode($matches[1][0]); } $embed = '<embed width="'.$videoWidth.'" height="'.$videoHeight.'" type="application/x-shockwave-flash" wmode="transparent" src="'.$videoUrl.'">'; return $embed; }
function getDescription() { require_once (JPATH_COMPONENT . DS . 'libraries' . DS . 'remote.php'); $str = getContentFromUrl($this->videoUrl); if ( strpos($str, "<div id=\"description\">") != 0) { $pos = strpos($str, "<div id=\"description\">")+22; $post = strpos($str, "</div>", $pos)-$pos; $itemcomment = substr($str, $pos, $post); $videoDescription = trim($itemcomment); $videoDescription = strip_tags($videoDescription); } else { $videoDescription = JText::_('Not Available'); } return $videoDescription; }
function isValid() { $mainframe =& JFactory::getApplication(); $file = 'http://www.dailymotion.com/video/'.$this->videoId ; require_once (JPATH_COMPONENT . DS . 'libraries' . DS . 'remote.php'); $xmlContent = getContentFromUrl($file); if (empty($this->videoId)) { $url = $this->getFailedUrl(); $message = JText::_('Invalid Video Id'); $mainframe->redirect( $url , $message ); } elseif($xmlContent == 'Invalid id') { $url = $this->getFailedUrl(); $message = JText::_('Invalid Video Id'); $mainframe->redirect( $url , $message ); } elseif($xmlContent == false) { $url = $this->getFailedUrl(); $message = JText::_('Error fetching video'); $mainframe->redirect( $url , $message ); } else { //Get title $pattern = "/<h1 class=\"dmco_title\">(.*)(<\/h1>)?(<\/span>)/i"; preg_match_all($pattern, $xmlContent, $matches); if( $matches && !empty($matches[1][0]) ) { $this->title = strip_tags($matches[1][0]); } //Get description $pattern = "/<meta name=\"description\" lang=\"en\" content=\"(.*)\" \/>/i"; preg_match_all($pattern, $xmlContent, $matches); if( $matches && !empty($matches[1][0]) ) { $this->description = trim(strip_tags($matches[1][0],'<br /><br>')); } //Get duration $pattern = "'DMDURATION=(.*?)&'s"; preg_match_all($pattern, $xmlContent, $matches); if( $matches && !empty($matches[1][0]) ) { $this->duration = $matches[1][0]; } //Get thumbnail $pattern = "'<meta property=\"og:image\" content=\"(.*?)\"'s"; preg_match_all($pattern, $xmlContent, $matches); if( $matches && !empty($matches[1][0]) ) { $this->thumbnail = urldecode($matches[1][0]); } //echo $this->thumbnail; //exit; return true; } }
spaghetti time, it's nice to analyze crappy apps, isn't it? */ if (isset($_GET['source']) && $_SERVER['SCRIPT_FILENAME'] == __FILE__) { highlight_file(__FILE__); die; } include_once 'config.php'; $title = ''; $content = ''; $page = @$_REQUEST['page']; switch ($page) { case 'print': $url = base64_decode($_REQUEST['url']); $title = ''; if (begins_with($url, $config['url'])) { $content = getContentFromUrl($url); } if (isset($_REQUEST['load_template']) && ($_REQUEST['load_template'] == '1' || $_REQUEST['load_template'] == true)) { $content = only_body($content); } break; case 'product': if (isset($_REQUEST['prod'])) { $title = htmlentities(ucfirst($prod), ENT_QUOTES); $content = getProduct($_REQUEST['prod']); } break; case 'contact': if (isset($_POST['url-bad'])) { if (isset($_POST["captcha"]) && $_POST["captcha"] != "" && $_SESSION["code"] == $_POST["captcha"]) { $content .= 'Success!';
function addlinkvideo($vLink){ $user = &JFactory::getUser(); $wuid = JRequest::getInt('wuid', 0); $groupId = JRequest::getInt('groupid', NULL); if($groupId==0) $groupId =NULL; $itemId = AwdwallHelperUser::getComItemId(); $db =& JFactory::getDBO(); if($wuid == 0) $wuid = $user->id; if((int)$user->id){ //$vLink = JRequest::getVar( 'vLink' , ''); require_once (JPATH_COMPONENT . DS . 'libraries' . DS . 'avideo.php'); if(!empty($vLink)){ $AVideo = new AVideo($wuid); $videoObj = $AVideo->getProvider($vLink); if ($videoObj->isValid()){ require_once (JPATH_COMPONENT . DS . 'models' . DS . 'video.php'); require_once (JPATH_COMPONENT . DS . 'models' . DS . 'wall.php'); $video =& JTable::getInstance('Video', 'Table'); $video->title = $videoObj->getTitle(); $video->type = $videoObj->getType(); $videotype = $videoObj->getType(); $video->video_id = $videoObj->getId(); $video->description = $videoObj->getDescription(); $video->duration = $videoObj->getDuration(); $video->creator = $user->id; $video->created = gmdate('Y-m-d H:i:s'); $video->published = 1; $video->thumb = $videoObj->getThumbnail(); $video->path = $vLink; // save into wall table first $wall = &JTable::getInstance('Wall', 'Table'); $wall->user_id = $wuid; $wall->group_id = $groupId; $wall->type = 'video'; $wall->commenter_id = $user->id; $wall->user_name = ''; $wall->avatar = ''; $wall->message = ''; $wall->reply = 0; $wall->is_read = 0; $wall->is_pm = 0; $wall->is_reply = 0; $wall->posted_id = NULL; $wall->wall_date = NULL; // store wall to database if (!$wall->store()){ $this->setRedirect(JRoute::_('index.php?option=com_awdwall&&view=awdwall&layout=main' , false ), JText::_('Post Failed')); } $video->wall_id = $db->insertid(); $wall_id = $video->wall_id; if (!$video->store()){ $url = JRoute::_('index.php?option=com_awdwall&&view=awdwall&layout=main' , false); $message = JText::_('Add video link failed'); $this->setRedirect($url , $message); } require_once (JPATH_COMPONENT . DS . 'libraries' . DS . 'remote.php'); $thumbData = getContentFromUrl($video->thumb); if ($thumbData) { jimport('joomla.filesystem.file'); require_once (JPATH_COMPONENT . DS . 'libraries' . DS . 'file.php'); require_once (JPATH_COMPONENT . DS . 'libraries' . DS . 'image.php'); $thumbPath = $AVideo->videoRootHomeUserThumb; $thumbFileName = genRandomFilename($thumbPath); $tmpThumbPath = $thumbPath . DS . $thumbFileName; if (JFile::write($tmpThumbPath, $thumbData)){ $info = getimagesize( $tmpThumbPath ); $mime = image_type_to_mime_type( $info[2]); $thumbExtension = imageTypeToExt( $mime ); $thumbPath = $thumbPath . DS . $thumbFileName .$thumbExtension; JFile::move($tmpThumbPath, $thumbPath); // Resize the thumbnails imageResizep( $thumbPath , $thumbPath , $mime , $AVideo->videoThumbWidth , $AVideo->videoThumbHeight ); $video->thumb = 'videos/' . $wuid . '/thumbs/' . $thumbFileName . $thumbExtension; $hvideothumb = 'videos/' . $wuid . '/thumbs/' . $thumbFileName . $thumbExtension; $video->store(); } } // adding to com_hwdvideoshare if(file_exists(JPATH_SITE . '/components/com_hwdvideoshare/hwdvideoshare.php')) { // check wether wall video is there in hwdvideoshare or not if not then add. if(file_exists(JPATH_SITE . '/plugins/hwdvs-thirdparty/'.$videotype.'.php')) { $wallcatname='Wall Video'; $query = "SELECT count(*) as wallvideocount FROM #__hwdvidscategories WHERE category_name='".$wallcatname."'"; $db->setQuery($query); $wallvideocount = $db->loadResult(); $query = "SELECT MAX(ordering) as catmaxordering FROM #__hwdvidscategories "; $db->setQuery($query); $catmaxordering = $db->loadResult(); $catmaxordering=$catmaxordering+1; if($wallvideocount==0) { $sql = 'INSERT INTO #__hwdvidscategories(category_name, category_description,ordering,published) VALUES("'.$wallcatname .'","' . $wallcatname . '",' . $catmaxordering . ',1)'; $db->setQuery($sql); $db->query(); } $query = "SELECT id FROM #__hwdvidscategories WHERE category_name='".$wallcatname."'"; $db->setQuery($query); $wallcatid = $db->loadResult(); // the hwdvideoshare cat id $query = "SELECT MAX(id) as videomaxid FROM #__hwdvidsvideos "; $db->setQuery($query); $videomaxid = $db->loadResult(); $videomaxid=$videomaxid+1; $parsedurl= parse_url($vLink); $hvideo_type=str_replace('www.','',$parsedurl['host']); $hvideo_id=$videoObj->getId(); $htitle=$videoObj->getTitle(); $hdescription=$videoObj->getDescription(); $hcategory_id=$wallcatid; $hdate_uploaded=gmdate('Y-m-d H:i:s'); $huser_id=$user->id; $allow_comments=1; $allow_embedding=1; $allow_ratings=1; $approved ='yes'; $published=1; $hthumbnail='tp-'.$videomaxid.'.jpg'; // copy('images/'.$hvideothumb,'hwdvideos/thumbs/'.$hthumbnail); $sql = "INSERT INTO #__hwdvidsvideos(video_type, video_id,title,description,category_id,date_uploaded,allow_comments ,allow_embedding,allow_ratings,public_private,thumbnail,approved,user_id,published) VALUES('".$hvideo_type ."','" . $hvideo_id . "','" . $htitle . "','" . $hdescription . "','" . $hcategory_id . "','" . $hdate_uploaded . "','" . $allow_comments . "','" . $allow_embedding . "','" . $allow_ratings . "','public','" . $hthumbnail . "','" . $approved . "','" . $user->id . "',1)"; $db->setQuery($sql); $db->query(); $sql = 'INSERT INTO #__awd_wall_videos_hwd( wall_id, hwdviodeo_id) VALUES('.$wall_id .','.$videomaxid.')'; $db->setQuery($sql); $db->query(); } // if exist } // if exist } } $this->setRedirect(JRoute::_('index.php?option=com_awdwall&&view=awdwall&layout=mywall&wuid=' . $wuid . '&Itemid=' . $itemId, false)); }else{ $this->setRedirect(JRoute::_('index.php?option=com_awdwall&&view=awdwall&layout=mywall&wuid=' . $wuid . '&Itemid=' . $itemId, false)); } $tags = get_meta_tags($vLink); $description = $tags['description']; $description = ltrim($description); $description = rtrim($description); $d = 1; $img = '<img id='.$d.' class=no_hidden src='.JURI::base() . 'images/' . $video->thumb.' >'; echo '{"type": "video","foo": "'.$file.'","img": "'.$img.'","count_img": "'.$d.'","error": "' . $error . '","msg": "' . $msg . '","file": "<a href=' . $vLink . ' target=_blank>' . $vLink . '</a>","wid_tmp": "' . $video->wall_id . '","title": "' . $video->title . '"}'; return '{"type": "video","foo": "'.$file.'","img": "'.$img.'","count_img": "'.$d.'","error": "' . $error . '","msg": "' . $msg . '","file": "<a href=' . $vLink . ' target=_blank>' . $vLink . '</a>","wid_tmp": "' . $video->wall_id . '","title": "' . $video->title . '"}'; }
function getViewHTML($videoId, $videoWidth='475' , $videoHeight='325') { $file = $this->getFeedUrl(); $xmlContent = getContentFromUrl($file); if(strstr($xmlContent,'<link rel="video_src"')) { preg_match_all('/<link rel="video_src".*?href\s*=\s*["\'](.+?)["\']/im', $xmlContent, $images); $videofile = $images[1][0]; } $embed = '<embed name="lsplayer" wmode="transparent" src="'.$videofile.'" width="'.$videoWidth.'" height="'.$videoHeight.'" allowScriptAccess="always" allowFullScreen="true" type="application/x-shockwave-flash" />'; echo $embed; }