/** * Edit video details */ function publishVideo() { global $mainframe, $option, $Itemid; $db = & JFactory::getDBO(); $my = & JFactory::getUser(); $app = & JFactory::getApplication(); $video_id = JRequest::getInt( 'video_id', 0 ); $publish = JRequest::getInt( 'publish', 0 ); // check component access settings and deny those without privileges if ($c->access_method == 0) { if (!hwd_vs_access::allowAccess( $c->gtree_mdrt, $c->gtree_mdrt_child, hwd_vs_access::userGID( $my->id ))) { if ($my->id == 0 || $video_id == 0) { return; } } } $db->setQuery( "UPDATE #__hwdvidsvideos" . "\nSET published =" . intval( $publish ) . "\n WHERE id = $video_id" ); if (!$db->query()) { echo "<script> alert('".$db->getErrorMsg()."'); window.history.go(-1); </script>\n"; exit(); } switch ( $publish ) { case 1: $msg = $total ._HWDVIDS_ALERT_ADMIN_VIDPUB." "; break; case 0: default: $msg = $total ._HWDVIDS_ALERT_ADMIN_VIDUNPUB." "; break; } $app->enqueueMessage($msg); $app->redirect( JURI::root( true ) . '/index.php?option='.$option.'&task=frontpage' ); }
/** * show categories */ function showcategories($rows, &$pageNav, $searchtext) { global $limitstart, $smartyvs, $Itemid; /** define template variables **/ $hidden_inputs = '<input type="hidden" name="boxchecked" value="0" /> <input type="hidden" name="option" value="com_hwdvideoshare" /> <input type="hidden" name="task" value="categories" /> <input type="hidden" name="limitstart" value="'.$limitstart.'" /> <input type="hidden" name="hidemainmenu" value="0">'; $search = _HWDVIDS_SEARCHC.' '; $search.= '<input type="text" name="search" value="'.$searchtext.'" class="text_area" onChange="document.adminForm.submit();" /> '; $search.= _HWDVIDS_RPP.' '; $search.= $pageNav->getLimitBox().' '; /** assign template variables **/ $smartyvs->assign( "hidden_inputs" , $hidden_inputs ); $smartyvs->assign( "header_title" , _HWDVIDS_SECTIONHEAD_CATS ); $smartyvs->assign( "print_search", 1 ); $smartyvs->assign( "search", $search ); $smartyvs->assign( "totalcategories", count($rows) ); $smartyvs->assign( "writePagesLinks", $pageNav->getPagesLinks() ); $smartyvs->assign( "writePagesCounter", $pageNav->getPagesCounter() ); $smartyvs->assign( "saveOrder", JHTML::_('grid.order', $rows, "filesave.png", "saveCategoryOrder" ) ); /** define template arrays **/ $list = array(); $k = 0; for ($i=0, $n=count($rows); $i < $n; $i++) { $row = $rows[$i]; $list[$i]->id = $row->id; $list[$i]->checked = JHTML::_('grid.checkedout', $row, $i); if ($row->parent == 0) { $list[$i]->isparent = 1; } $link = 'index.php?option=com_hwdvideoshare&task=editcatA&hidemainmenu=1&cid='. $row->id; $list[$i]->title = '<a href="'.$link.'" title="Edit Category">'.stripslashes($row->treename).'</a>'; if ($row->access_v == -2) { $list[$i]->view_access = _HWDVIDS_SELECT_EVERYONE; } else if ($row->access_v == -2) { $list[$i]->view_access = _HWDVIDS_SELECT_ALLREGUSER; } else { $gID = hwd_vs_access::groupName($row->access_v); $list[$i]->view_access = $gID; } if ($row->access_u == -2) { $list[$i]->upld_access = _HWDVIDS_SELECT_EVERYONE; } else if ($row->access_u == -2) { $list[$i]->upld_access = _HWDVIDS_SELECT_ALLREGUSER; } else { $gID = hwd_vs_access::groupName($row->access_u); $list[$i]->upld_access = $gID; } $list[$i]->published_task = $row->published ? 'unpublishcat' : 'publishcat'; $list[$i]->published_img = $row->published ? 'publish_g.png' : 'publish_x.png'; $list[$i]->ordering = "<input type=\"text\" name=\"order[]\" size=\"4\" value=\"".$row->ordering."\" class=\"text_area\" style=\"text-align: center\" />"; $list[$i]->reorderup = $pageNav->orderUpIcon($i, true, "orderCategoryUp"); $list[$i]->reorderdown = $pageNav->orderDownIcon($i, $n, true, "orderCategoryDown"); $list[$i]->k = $k; $list[$i]->i = $i; $k = 1 - $k; } $smartyvs->assign( "list", $list ); /** display template **/ $smartyvs->display('admin_categories_browse.tpl'); return; }
/** * */ function editVideoInfo($row) { global $mainframe, $Itemid, $smartyvs, $Itemid; $c = hwd_vs_Config::get_instance(); $my = & JFactory::getUser(); // load the menu name jimport( 'joomla.application.menu' ); $menu = &JMenu::getInstance('site'); $mparams = &$menu->getParams($Itemid); $mparams_pt = $mparams->get( 'page_title', ''); jimport( 'joomla.document.document' ); $doc = & JFactory::getDocument(); $active = &$menu->getActive(); if (!empty($mparams_pt)) { $metatitle = $mparams_pt; } else if (!empty($active->name)) { $metatitle = $active->name; } else { $metatitle = _HWDVIDS_META_DEFAULT; } $referrer = JRequest::getVar( 'url', '' ); // decode $meta_title = html_entity_decode($row->title); // set the page/meta title $doc->setTitle( $metatitle." - "._HWDVIDS_META_EVIDS." - ".$meta_title ); $doc->setMetaData( 'title' , $metatitle." - "._HWDVIDS_META_EVIDS." - ".$meta_title ); hwd_vs_tools::generateActiveLink(1); hwd_vs_javascript::checkuploadform(); hwd_vs_tools::generateBreadcrumbs(); $smartyvs->assign("thumbnail", hwd_vs_tools::generateVideoThumbnailLink($row->id, $row->video_id, $row->video_type, $row->thumbnail, 0, null, null, null)); $smartyvs->assign("title", stripslashes($row->title)); if (!hwd_vs_access::allowAccess( $c->gtree_edtr, $c->gtree_edtr_child, hwd_vs_access::userGID( $my->id ))) { $smartyvs->assign( "description", stripslashes($row->description) ); } else { $editor =& JFactory::getEditor(); $smartyvs->assign( "description", $editor->display("description",stripslashes($row->description),350,250,40,20,1) ); $smartyvs->assign( "print_wysiwyg", 1 ); } $smartyvs->assign("tags", stripslashes($row->tags)); $smartyvs->assign("rowid", $row->id); $smartyvs->assign("rowuid", $row->user_id); $smartyvs->assign("print_sharingoptions", 1); $smartyvs->assign("form_save_video", JRoute::_("index.php?option=com_hwdvideoshare&Itemid=".$Itemid."&task=savevideo")); $smartyvs->assign("referrer", $referrer); if ($row->public_private == "registered") { $smartyvs->assign("so1p", ""); $smartyvs->assign("so1r", " selected=\"selected\""); $smartyvs->assign("so1m", ""); $smartyvs->assign("so1w", ""); $smartyvs->assign("so1value", "registered"); } else if ($row->public_private == "public") { $smartyvs->assign("so1p", " selected=\"selected\""); $smartyvs->assign("so1r", ""); $smartyvs->assign("so1m", ""); $smartyvs->assign("so1w", ""); $smartyvs->assign("so1value", "public"); } else if ($row->public_private == "me") { $smartyvs->assign("so1p", ""); $smartyvs->assign("so1r", ""); $smartyvs->assign("so1m", " selected=\"selected\""); $smartyvs->assign("so1w", ""); $smartyvs->assign("so1value", "me"); } else if ($row->public_private == "password") { $smartyvs->assign("so1p", ""); $smartyvs->assign("so1r", ""); $smartyvs->assign("so1m", ""); $smartyvs->assign("so1w", " selected=\"selected\""); $smartyvs->assign("so1value", "password"); } if ($row->allow_comments == 0) { $smartyvs->assign("so21", ""); $smartyvs->assign("so20", " selected=\"selected\""); $smartyvs->assign("so2value", "0"); } else if ($row->allow_comments == 1) { $smartyvs->assign("so21", " selected=\"selected\""); $smartyvs->assign("so20", ""); $smartyvs->assign("so2value", "1"); } if ($row->allow_embedding == 0) { $smartyvs->assign("so31", ""); $smartyvs->assign("so30", " selected=\"selected\""); $smartyvs->assign("so3value", "0"); } else if ($row->allow_embedding == 1) { $smartyvs->assign("so31", " selected=\"selected\""); $smartyvs->assign("so30", ""); $smartyvs->assign("so3value", "1"); } if ($row->allow_ratings == 0) { $smartyvs->assign("so41", ""); $smartyvs->assign("so40", " selected=\"selected\""); $smartyvs->assign("so4value", "0"); } else if ($row->allow_ratings == 1) { $smartyvs->assign("so41", " selected=\"selected\""); $smartyvs->assign("so40", ""); $smartyvs->assign("so4value", "1"); } $smartyvs->assign("categoryselect", $categoryselectlist = hwd_vs_tools::categoryList(_HWDVIDS_INFO_CHOOSECAT, $row->category_id, _HWDVIDS_INFO_NOCATS, 1) ); $smartyvs->display('video_edit.tpl'); return; }
/** * * * */ function checkAccess($gtree, $gtree_child, $nav, $usernav, $title, $message_register, $message_denied, $icon, $backlink, $action="core.frontend.access", $noMessage=0) { global $j15, $j16, $smartyvs; $c = hwd_vs_Config::get_instance(); $my = & JFactory::getUser(); $acl= & JFactory::getACL(); $usersConfig = & JComponentHelper::getParams( 'com_users' ); if ($j16) { // Access check. if (!JFactory::getUser()->authorise($action, 'com_hwdvideoshare')) { if ($noMessage == 1) { return false; } else { JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR')); if ($my->id == 0) { $smartyvs->assign("showconnectionbox", 1); } hwd_vs_tools::infomessage($nav, $usernav, $title, $message_register, $icon, $backlink); return false; } } } else { if (!hwd_vs_access::allowAccess( $gtree, $gtree_child, hwd_vs_access::userGID( $my->id ))) { if ( ($my->id < 1) && (!$usersConfig->get( 'allowUserRegistration' ) == '0' && hwd_vs_access::allowAccess( $c->gtree_upld, 'RECURSE', $acl->get_group_id('Registered','ARO') ) ) ) { if ($noMessage == 1) { return false; } else { if ($my->id == 0) { $smartyvs->assign("showconnectionbox", 1); } hwd_vs_tools::infomessage($nav, $usernav, $title, $message_register, $icon, $backlink); return false; } } else { if ($noMessage == 1) { return false; } else { if ($my->id == 0) { $smartyvs->assign("showconnectionbox", 1); } hwd_vs_tools::infomessage($nav, $usernav, $title, $message_denied, $icon, $backlink); return false; } } } } return true; }
/** * Outputs frontpage HTML * * @return Nothing */ function grabAjaxPlayer() { global $Itemid, $smartyvs, $hwdvs_selectv, $hwdvs_joinv, $mainframe, $hwdvsAjaxPlayer; header('Content-type: text/html; charset=utf-8'); $c = hwd_vs_Config::get_instance(); $db = & JFactory::getDBO(); $my = & JFactory::getUser(); $acl= & JFactory::getACL(); $usersConfig = &JComponentHelper::getParams( 'com_users' ); $video_id = JRequest::getInt( 'video_id', 0 ); $template = JRequest::getVar( 'template', '' ); $showdetails = JRequest::getInt( 'showdetails', '1' ); $width = JRequest::getInt( 'width', null ); $height = JRequest::getInt( 'height', null ); $quality = JRequest::getWord( 'quality', 'hd' ); $autostart = JRequest::getInt( 'autostart', null ); $hwdvsAjaxPlayer = true; if (!hwd_vs_access::allowAccess( $c->gtree_plyr, $c->gtree_plyr_child, hwd_vs_access::userGID( $my->id ))) { if ( ($my->id < 1) && (!$usersConfig->get( 'allowUserRegistration' ) == '0' && hwd_vs_access::allowAccess( $c->gtree_upld, 'RECURSE', $acl->get_group_id('Registered','ARO') ) ) ) { hwd_vs_tools::infomessage(1, 0, _HWDVIDS_TITLE_NOACCESS, _HWDVIDS_ALERT_REGISTERFORPLYR, "exclamation.png", 0, 0); exit; } else { hwd_vs_tools::infomessage(1, 0, _HWDVIDS_TITLE_NOACCESS, _HWDVIDS_ALERT_PLYR_NOT_AUTHORIZED, "exclamation.png", 0, 0); exit; } } $where = ' WHERE video.id = '.$video_id; $query = "SELECT".$hwdvs_selectv." FROM #__hwdvidsvideos AS video ".$hwdvs_joinv." ".$where; $db->SetQuery($query); $row = $db->loadObject(); if (!hwd_vs_tools::validateVideoAccess($row)) { exit; } hwd_vs_tools::logViewing($row->id); require_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'libraries'.DS.'maintenance_recount.class.php'); if ($showdetails == 1) { $smartyvs->assign("showdetails", 1); } $videoplayer = hwd_vs_tools::generateVideoDetails($row, $width, $height, null, $Itemid, null, null, $autostart); $smartyvs->assign("videoplayer", $videoplayer); hwd_vs_javascript::ajaxRate($row); if (empty($template) || $template == '') { $html = $smartyvs->fetch('plug_jomsocial_ajax.tpl'); } else if ($template == 'playeronly') { $html = $videoplayer->player; } else { $html = $smartyvs->fetch($template.'.tpl'); } print $html; exit; }
/** * Query SQL for all accessible category data * * @return Nothing */ function downloadFile() { global $mainframe, $limitstart; $c = hwd_vs_Config::get_instance(); $db = & JFactory::getDBO(); $my = & JFactory::getUser(); $acl= & JFactory::getACL(); $usersConfig = &JComponentHelper::getParams( 'com_users' ); //$currentSession = JSession::getInstance('none',array()); //$currentSession->destroy(); $evp = JRequest::getCmd( 'evp', 0 ); $file = JRequest::getCmd( 'file', 0 ); $deliver = JRequest::getCmd( 'deliver', 0 ); $media = JRequest::getCmd( 'media', 0 ); $fix = JRequest::getCmd( 'fix', 0 ); $streamer = JRequest::getCmd( 'streamer', 'off' ); $quality = JRequest::getCmd( 'quality', 'hd' ); $pushDownload = false; $showError = false; // get video details $db->SetQuery( 'SELECT * FROM #__hwdvidsvideos WHERE id = '.(int)$file ); $db->Query(); $row = $db->loadObject(); $db->SetQuery( 'SELECT count(*) FROM #__hwdvidsantileech WHERE expiration = "'.$evp.'"' ); $result = $db->loadResult(); if ($result > 0 || $c->use_protection == 0 || $row->allow_embedding == "1") { $location = hwd_vs_tools::generateVideoLocations( $row, $quality ); $location['ext'] = "flv"; $db->SetQuery( 'SELECT `count` FROM #__hwdvidsantileech WHERE expiration = "'.$evp.'"' ); $count = $db->loadResult(); if ($row->allow_embedding == 1 && $c->showvebc == 1) { $pushDownload = true; } else if ($count < $c->protection_level) { $newCount = $count+1; $db->SetQuery( "UPDATE #__hwdvidsantileech SET `count` = $newCount WHERE expiration = \"".$evp."\"" ); $db->Query(); if ($deliver !== "player") { if (!hwd_vs_access::allowAccess( $c->gtree_dnld, $c->gtree_dnld_child, hwd_vs_access::userGID( $my->id ))) { $pushDownload = false; } else { $pushDownload = true; } } else if ($deliver == "player") { $pushDownload = true; } } else { $showError = true; } if ($deliver == "downloadoriginal" || $deliver == "original") { if ($handle = opendir(JPATH_SITE.DS.'hwdvideos'.DS.'uploads'.DS.'originals')) { $url = ''; while (false !== ($file = readdir($handle))) { list($filename_noext, $filename_ext) = @split('\.', basename($file)); if ($filename_noext == $row->video_id) { $location['url'] = JURI::root().'hwdvideos/uploads/originals/'.$file; $location['path'] = JPATH_SITE.DS.'hwdvideos'.DS.'uploads'.DS.'originals'.DS.$file; $location['ext'] = $filename_ext; } } closedir($handle); } } else if ($deliver == "flv") { if (file_exists(JPATH_SITE.DS."hwdvideos".DS."uploads".DS.$row->video_id.".flv")) { $location['url'] = JURI::root()."hwdvideos/uploads/".$row->video_id.".flv"; $location['path'] = JPATH_SITE.DS."hwdvideos".DS."uploads".DS.$row->video_id.".flv"; $location['ext'] = "flv"; } } else if ($deliver == "h264") { if (file_exists(JPATH_SITE.DS."hwdvideos".DS."uploads".DS.$row->video_id.".mp4")) { $location['url'] = JURI::root()."hwdvideos/uploads/".$row->video_id.".mp4"; $location['path'] = JPATH_SITE.DS."hwdvideos".DS."uploads".DS.$row->video_id.".mp4"; $location['ext'] = "mp4"; } } else if ($deliver == "ipod340") { if (file_exists(JPATH_SITE.DS."hwdvideos".DS."uploads".DS.$row->video_id.".ipod320.mp4")) { $location['url'] = JURI::root()."hwdvideos/uploads/".$row->video_id.".ipod320.mp4"; $location['path'] = JPATH_SITE.DS."hwdvideos".DS."uploads".DS.$row->video_id.".ipod320.mp4"; $location['ext'] = "ipod320.mp4"; } } else if ($deliver == "ipod640") { if (file_exists(JPATH_SITE.DS."hwdvideos".DS."uploads".DS.$row->video_id.".ipod640.mp4")) { $location['url'] = JURI::root()."hwdvideos/uploads/".$row->video_id.".ipod640.mp4"; $location['path'] = JPATH_SITE.DS."hwdvideos".DS."uploads".DS.$row->video_id.".ipod320.mp4"; $location['ext'] = "ipod640.mp4"; } } if ($pushDownload) { if (headers_sent($filename, $linenum) || $row->video_type == "seyret" || $row->video_type == "remote") { $mainframe->redirect( $location['url'] ); } else if ($deliver == "player") { header('Location: '.$location['url']); exit; } else { // Transfer file in chunks to preserve memory on the server $fn = basename($location['path']); $title = str_replace(" ", "-", $row->title); $title = preg_replace("/[^a-zA-Z0-9s-]/", "", $title); if (!empty($title)) { $ftitle = $title.".".$location['ext']; } else { $ftitle = $fn; } header('Content-Type: application/octet-stream'); header("Content-Disposition: attachment; filename=\"$ftitle\""); header('Content-Length: '.filesize($location['path'])); @hwd_vs_tools::readfile_chunked($location['path'], true); exit; } } } if ($count > $c->protection_level) { $db->SetQuery("DELETE FROM #__hwdvidsantileech WHERE expiration = \"$evp\""); $db->Query(); } $showError = true; $hwdvsItemid = hwd_vs_tools::generateValidItemid(); $msg = "You do not have access to this file using the requested method."; $mainframe->enqueueMessage($msg); $mainframe->redirect( JURI::root()."index.php?option=com_hwdvideoshare&Itemid=".$hwdvsItemid."&task=viewvideo&video_id=".$row->id ); }
/** * Outputs frontpage HTML * * @return Nothing */ function uploadMedia() { global $Itemid, $smartyvs, $j15, $j16; $c = hwd_vs_Config::get_instance(); $db = & JFactory::getDBO(); $my = & JFactory::getUser(); $acl= & JFactory::getACL(); $usersConfig = &JComponentHelper::getParams( 'com_users' ); // check for upload limit (temporary hack) //$db->SetQuery( 'SELECT count(*) FROM #__hwdvidsvideos WHERE user_id = '.$my->id ); //$videoCount = $db->loadResult(); //echo $db->getErrorMsg(); //if ($videoCount > 50) { // global $mainframe; // $mainframe->enqueueMessage("You have reached your maximum upload limit and can not upload any more videos."); // $mainframe->redirect( JURI::root().'index.php?option=com_hwdvideoshare&task=frontpage&Itemid='.$Itemid ); //} $sessid = session_id(); if (empty($sessid)) { session_start(); } $localUploadAccess = hwd_vs_access::checkAccess($c->gtree_upld, $c->gtree_upld_child, 4, 0, _HWDVIDS_TITLE_NOACCESS, _HWDVIDS_ALERT_REGISTERFORUPLD, _HWDVIDS_ALERT_UPLD_NOT_AUTHORIZED, "exclamation.png", 0, "core.frontend.upload.local", 1); $thirdPartyUploadAccess = hwd_vs_access::checkAccess($c->gtree_ultp, $c->gtree_ultp_child, 4, 0, _HWDVIDS_TITLE_NOACCESS, _HWDVIDS_ALERT_REGISTERFORUPLD, _HWDVIDS_ALERT_UPLD_NOT_AUTHORIZED, "exclamation.png", 0, "core.frontend.upload.tp", 1); if (!$localUploadAccess && !$thirdPartyUploadAccess) { if ($my->id == 0) { $smartyvs->assign("showconnectionbox", 1); } hwd_vs_tools::infomessage(4, 0, _HWDVIDS_TITLE_NOACCESS, _HWDVIDS_ALERT_UPLD_NOT_AUTHORIZED, "exclamation.png", 0); return; } $videotype = JRequest::getCmd( 'videotype' ); if ($j15) { $db->SetQuery( 'SELECT count(*) FROM #__plugins WHERE published = 1 AND folder = "hwdvs-thirdparty"'); } if ($j16) { $db->SetQuery( 'SELECT count(*) FROM #__extensions WHERE type = "plugin" AND folder = "hwdvs-thirdparty" AND enabled = 1'); } $thirdpartycount = $db->loadResult(); echo $db->getErrorMsg(); $checksecurity = "0"; if ((empty($videotype)) && ($thirdpartycount > 0) && ($c->disablelocupld == 0) && $localUploadAccess) { $uploadpage = "0"; } else if ((empty($videotype)) && (!$thirdPartyUploadAccess)) { $uploadpage = "1"; } else if ( (empty($videotype)) && (!$thirdpartycount || $thirdpartycount == 0) && ($c->disablelocupld == 0) ) { $uploadpage = "1"; } else if ( (empty($videotype)) && ($thirdpartycount > 0) && ($c->disablelocupld == 1)) { $uploadpage = "thirdparty"; } else if ( (empty($videotype)) && (!$thirdpartycount || $thirdpartycount == 0) && ($c->disablelocupld == 1)) { hwd_vs_tools::infomessage(4, 0, _HWDVIDS_TITLE_UPLDFAIL, _HWDVIDS_ALERT_NOUPLDMETH, "exclamation.png", 0); return; } else if ($videotype == "00") { $uploadpage = "1"; } else if ($videotype == "local") { $uploadpage = "2"; $checksecurity = "1"; } else { $uploadpage = "thirdparty"; } $title = Jrequest::getVar( 'title', _HWDVIDS_UNKNOWN ); $description = Jrequest::getVar( 'description', _HWDVIDS_UNKNOWN ); $category_id = JRequest::getInt( 'category_id', 0, 'post' ); $tags = Jrequest::getVar( 'tags', _HWDVIDS_UNKNOWN ); $public_private = JRequest::getWord( 'public_private' ); $allow_comments = JRequest::getInt( 'allow_comments', 0 ); $allow_embedding = JRequest::getInt( 'allow_embedding', 0 ); $allow_ratings = JRequest::getInt( 'allow_ratings', 0 ); $hwdvspassword = JRequest::getVar( 'hwdvspassword', "" ); if (!empty($hwdvspassword)) { $md5password = md5($hwdvspassword); } else { $md5password = null; } $security_code = JRequest::getCmd( 'security_code', '' ); if ($c->disablecaptcha == "1") { $checksecurity = "0"; } if ($checksecurity == "1") { if(($_SESSION['security_code'] == $security_code) && (!empty($_SESSION['security_code'])) ) { // Insert you code for processing the form here, e.g emailing the submission, entering it into a database. hwd_vs_html::uploadmedia($uploadpage, $videotype, $checksecurity, $title, $description, $category_id, $tags, $public_private, $allow_comments, $allow_embedding, $allow_ratings, $md5password); unset($_SESSION['security_code']); } else { // Insert your code for showing an error message here hwd_vs_tools::infomessage(4, 0, _HWDVIDS_TITLE_UPLDFAIL, _HWDVIDS_ALERT_ERRSC, "exclamation.png", 0); return; } } else { hwd_vs_html::uploadMedia($uploadpage, $videotype, $checksecurity, $title, $description, $category_id, $tags, $public_private, $allow_comments, $allow_embedding, $allow_ratings, $md5password); } }
/** * Outputs frontpage HTML * * @return Nothing */ function editGroup() { global $mosConfig_live_site, $mainframe, $Itemid; $c = hwd_vs_Config::get_instance(); $db = & JFactory::getDBO(); $my = & JFactory::getUser(); $acl= & JFactory::getACL(); if (!hwd_vs_access::checkAccess($c->gtree_grup, $c->gtree_grup_child, 4, 0, _HWDVIDS_TITLE_NOACCESS, _HWDVIDS_ALERT_REGISTERFORGRUP, _HWDVIDS_ALERT_GRUP_NOT_AUTHORIZED, "exclamation.png", 0, "core.frontend.group")) {return;} $groupid = JRequest::getInt( 'groupid', 0 ); $row = new hwdvids_group($db); $row->load( $groupid ); //check valid user if ($row->adminid != $my->id) { $mainframe->enqueueMessage(_HWDVIDS_ALERT_NOPERM); $mainframe->redirect( JURI::root() . 'index.php?option=com_hwdvideoshare&task=groups&Itemid='.$Itemid ); } //Videos that are approved(converted) and published in this group $query = 'SELECT user.*, mem.memberid' . ' FROM #__hwdvidsgroup_membership AS `mem`' . ' LEFT JOIN #__hwdvidsgroups AS `group` ON mem.groupid = group.id' . ' LEFT JOIN #__users AS `user` ON user.id = mem.memberid' . ' WHERE mem.groupid = '.$row->id ; $db->SetQuery($query); $grp_members = $db->loadObjectList(); echo $db->getErrorMsg(); hwd_vs_html::editGroupInfo($row, $grp_members); }
/** * Grants or prevents access based on group id * * @param int $accessgroupid the group id to check against * @param string $recurse the switch for recursive access check * @param int $usersgroupid the user's group id * @return True or false */ function frontend() { global $smartyvs, $print_ulink, $print_glink, $hwdvsTemplateOverride, $hwdvsItemid, $isModerator; $c = hwd_vs_Config::get_instance(); $db = & JFactory::getDBO(); $my = & JFactory::getUser(); $acl= & JFactory::getACL(); $usersConfig = &JComponentHelper::getParams( 'com_users' ); require_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'helpers'.DS.'access.php'); require_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'helpers'.DS.'initialise.php'); $smartyvs->assign("JURL", JURI::root( true )); $smartyvs->assign("HWDVSURL", JURI::root( true )."/index.php?option=com_hwdvideoshare&Itemid=".$hwdvsItemid); $smartyvs->assign("Itemid", $hwdvsItemid ); $searchterm = Jrequest::getVar( 'pattern', _HWDVIDS_SEARCHBAR ); $smartyvs->assign("form_search", JRoute::_("index.php?option=com_hwdvideoshare&Itemid=".$hwdvsItemid."&task=search")); $smartyvs->assign("form_tp", JRoute::_("index.php?option=com_hwdvideoshare&Itemid=".$hwdvsItemid."&task=addconfirm")); $smartyvs->assign("form_upload", JRoute::_("index.php?option=com_hwdvideoshare&Itemid=".$hwdvsItemid."&task=upload")); $smartyvs->assign("searchinput", "<input type=\"text\" name=\"pattern\" value=\"".$searchterm."\" class=\"inputbox\" onchange=\"document.adminForm.submit();\" onblur=\"if(this.value=='') this.value='"._HWDVIDS_SEARCHBAR."';\" onfocus=\"if(this.value=='"._HWDVIDS_SEARCHBAR."') this.value='';\"/>"); // define config variables if ($c->diable_nav_videos == 0 || $c->diable_nav_catego == 0 || $c->diable_nav_groups == 0 || $c->diable_nav_upload == 0) { $smartyvs->assign("print_nav", 1); } if ($c->diable_nav_search == 0) { $smartyvs->assign("print_search", 1); } if ($my->id && $c->diable_nav_user == 0 && ($c->diable_nav_user1 == 0 || $c->diable_nav_user2 == 0 || $c->diable_nav_user3 == 0 || $c->diable_nav_user4 == 0 || $c->diable_nav_user5 == 0)) { $smartyvs->assign("print_usernav", 1); } if ($c->diable_nav_videos == 0) { $smartyvs->assign("print_vlink", 1); $smartyvs->assign("vlink", "<a href=\"".JRoute::_("index.php?option=com_hwdvideoshare&Itemid=".$hwdvsItemid."&task=frontpage")."\">"._HWDVIDS_NAV_VIDEOS."</a>"); } if ($c->diable_nav_catego == 0) { $smartyvs->assign("print_clink", 1); $smartyvs->assign("clink", "<a href=\"".JRoute::_("index.php?option=com_hwdvideoshare&Itemid=".$hwdvsItemid."&task=categories")."\">"._HWDVIDS_NAV_CATEGORIES."</a>"); } if (hwd_vs_access::allowAccess( $c->gtree_grup, $c->gtree_grup_child, hwd_vs_access::userGID( $my->id ))) { if ($c->diable_nav_groups == 0) { $smartyvs->assign("print_glink", 1); $smartyvs->assign("glink", "<a href=\"".JRoute::_("index.php?option=com_hwdvideoshare&Itemid=".$hwdvsItemid."&task=groups")."\">"._HWDVIDS_NAV_GROUPS."</a>"); $print_glink = true; } } if ($c->diable_nav_upload == 0) { $smartyvs->assign("print_ulink", 1); $smartyvs->assign("ulink", "<a href=\"".JRoute::_("index.php?option=com_hwdvideoshare&Itemid=".$hwdvsItemid."&task=upload")."\">"._HWDVIDS_NAV_UPLOAD."</a>"); $print_ulink = true; } else if ($c->diable_nav_upload == 2) { if (hwd_vs_access::allowAccess( $c->gtree_upld, $c->gtree_upld_child, hwd_vs_access::userGID( $my->id )) || hwd_vs_access::allowAccess( $c->gtree_ultp, $c->gtree_ultp_child, hwd_vs_access::userGID( $my->id ))) { $smartyvs->assign("print_ulink", 1); $smartyvs->assign("ulink", "<a href=\"".JRoute::_("index.php?option=com_hwdvideoshare&Itemid=".$hwdvsItemid."&task=upload")."\">"._HWDVIDS_NAV_UPLOAD."</a>"); $print_ulink = true; $smartyvs->assign("print_nav", 1); } } if ($c->diable_nav_user1 == 0) { $smartyvs->assign("yv", " <a href=\"".JRoute::_("index.php?option=com_hwdvideoshare&Itemid=".$hwdvsItemid."&task=viewChannel&user_id=".$my->id."&sort=uploads")."\">"._HWDVIDS_NAV_YOURVIDS."</a> "); } if ($c->diable_nav_user2 == 0) { $smartyvs->assign("yf", " <a href=\"".JRoute::_("index.php?option=com_hwdvideoshare&Itemid=".$hwdvsItemid."&task=viewChannel&user_id=".$my->id."&sort=favourites")."\">"._HWDVIDS_NAV_YOURFAVS."</a> "); } if ($c->diable_nav_groups == 0 && $c->diable_nav_user3 == 0) { $smartyvs->assign("yg", " <a href=\"".JRoute::_("index.php?option=com_hwdvideoshare&Itemid=".$hwdvsItemid."&task=viewChannel&user_id=".$my->id."&sort=groups")."\">"._HWDVIDS_NAV_YOURGROUPS."</a> "); } if ($c->diable_nav_groups == 0 && $c->diable_nav_user4 == 0) { $smartyvs->assign("ym", " <a href=\"".JRoute::_("index.php?option=com_hwdvideoshare&Itemid=".$hwdvsItemid."&task=viewChannel&user_id=".$my->id."&sort=memberships")."\">"._HWDVIDS_NAV_YOURMEMBERSHIPS."</a> "); } if ($c->diable_nav_groups == 0 && $c->diable_nav_user5 == 0) { $smartyvs->assign("cg", " <a href=\"".JRoute::_("index.php?option=com_hwdvideoshare&Itemid=".$hwdvsItemid."&task=creategroup")."\">"._HWDVIDS_NAV_CREATEGROUP."</a> "); } if ($c->disable_nav_playlist == 0) { $smartyvs->assign("cp", " <a href=\"".JRoute::_("index.php?option=com_hwdvideoshare&Itemid=".$hwdvsItemid."&task=createPlaylist")."\">"._HWDVIDS_NAV_CREATEPL."</a> "); } if ($c->disable_nav_playlist == 0) { $smartyvs->assign("yp", " <a href=\"".JRoute::_("index.php?option=com_hwdvideoshare&Itemid=".$hwdvsItemid."&task=viewChannel&user_id=".$my->id."&sort=playlists")."\">"._HWDVIDS_NAV_YOURPL."</a> "); } if ($c->disable_nav_channel == 0) { $smartyvs->assign("yc", " <a href=\"".JRoute::_("index.php?option=com_hwdvideoshare&Itemid=".$hwdvsItemid."&task=viewChannel&user_id=".$my->id)."\">"._HWDVIDS_NAV_YOURCHANNEL."</a> "); } if ($c->showcredit == 1) { $smartyvs->assign("sc", "1"); $smartyvs->assign("cl", hwd_vs_templates::copyright_FE()); } $smartyvs->assign("help_link", "<a href=\"http://documentation.hwdmediashare.co.uk/wiki/Category:HwdVideoShare_User%27s_Manual\" target=\"_blank\">Help</a>"); $smartyvs->assign("personalise_link", "<a href=\"http://documentation.hwdmediashare.co.uk/wiki/Category:HwdVideoShare_User%27s_Manual\">Personalise</a>"); if ($c->fporder == "recent") { $smartyvs->assign("fpheader", _HWDVIDS_TITLE_RECENTUPLOADS); $smartyvs->assign("fpempty", _HWDVIDS_INFO_NRV); } else if ($c->fporder == "popular") { $smartyvs->assign("fpheader", _HWDVIDS_TITLE_POPULARVIDEOS); $smartyvs->assign("fpempty", _HWDVIDS_INFO_NVTD); } else if ($c->fporder == "viewed") { $smartyvs->assign("fpheader", _HWDVIDS_TITLE_MOSTVIEWEDVIDS); $smartyvs->assign("fpempty", _HWDVIDS_INFO_NVTD); } $smartyvs->assign("usershare1", $c->usershare1); $smartyvs->assign("usershare2", $c->usershare2); $smartyvs->assign("usershare3", $c->usershare3); $smartyvs->assign("usershare4", $c->usershare4); if ($c->usershare1 == 1 || $c->usershare2 == 1 || $c->usershare3 == 1 || $c->usershare4 == 1) { $smartyvs->assign("print_sharing", 1); } if ($c->shareoption1 == 0) { $smartyvs->assign("so1p", ""); $smartyvs->assign("so1r", " selected=\"selected\""); $smartyvs->assign("so1m", ""); $smartyvs->assign("so1w", ""); $smartyvs->assign("so1value", "registered"); } else if ($c->shareoption1 == 1) { $smartyvs->assign("so1p", " selected=\"selected\""); $smartyvs->assign("so1r", ""); $smartyvs->assign("so1m", ""); $smartyvs->assign("so1w", ""); $smartyvs->assign("so1value", "public"); } else if ($c->shareoption1 == 2) { $smartyvs->assign("so1p", ""); $smartyvs->assign("so1r", ""); $smartyvs->assign("so1m", " selected=\"selected\""); $smartyvs->assign("so1w", ""); $smartyvs->assign("so1value", "me"); } else if ($c->shareoption1 == 3) { $smartyvs->assign("so1p", ""); $smartyvs->assign("so1r", ""); $smartyvs->assign("so1m", ""); $smartyvs->assign("so1w", " selected=\"selected\""); $smartyvs->assign("so1value", "password"); } if ($c->shareoption2 == 0) { $smartyvs->assign("so21", ""); $smartyvs->assign("so20", " selected=\"selected\""); $smartyvs->assign("so2value", "0"); } else if ($c->shareoption2 == 1) { $smartyvs->assign("so21", " selected=\"selected\""); $smartyvs->assign("so20", ""); $smartyvs->assign("so2value", "1"); } if ($c->shareoption3 == 0) { $smartyvs->assign("so31", ""); $smartyvs->assign("so30", " selected=\"selected\""); $smartyvs->assign("so3value", "0"); } else if ($c->shareoption3 == 1) { $smartyvs->assign("so31", " selected=\"selected\""); $smartyvs->assign("so30", ""); $smartyvs->assign("so3value", "1"); } if ($c->shareoption4 == 0) { $smartyvs->assign("so41", ""); $smartyvs->assign("so40", " selected=\"selected\""); $smartyvs->assign("so4value", "0"); } else if ($c->shareoption4 == 1) { $smartyvs->assign("so41", " selected=\"selected\""); $smartyvs->assign("so40", ""); $smartyvs->assign("so4value", "1"); } $smartyvs->assign("categoryselect", hwd_vs_tools::categoryList(_HWDVIDS_INFO_CHOOSECAT, 0, _HWDVIDS_INFO_NOCATS, 1)); $smartyvs->assign("rss_recent", JRoute::_("index.php?Itemid=".$hwdvsItemid."&option=com_hwdvideoshare&task=rss&feed=recent")); if ($isModerator) { $smartyvs->assign("print_moderation", 1); $smartyvs->assign("pending", " <a href=\"".JRoute::_("index.php?option=com_hwdvideoshare&Itemid=".$hwdvsItemid."&task=pending")."\">"._HWDVIDS_MODPA."</a> "); $smartyvs->assign("reportedvideos", " <a href=\"".JRoute::_("index.php?option=com_hwdvideoshare&Itemid=".$hwdvsItemid."&task=reportedvideos")."\">"._HWDVIDS_MODRV."</a> "); $smartyvs->assign("reportedgroups", " <a href=\"".JRoute::_("index.php?option=com_hwdvideoshare&Itemid=".$hwdvsItemid."&task=reportedgroups")."\">"._HWDVIDS_MODRG."</a> "); } jimport( 'joomla.application.menu' ); $menu = &JMenu::getInstance('site'); $mparams = &$menu->getParams($hwdvsItemid); $smartyvs->assign("pageclass_sfx", $mparams->get( 'pageclass_sfx', '')); $smartyvs->assign("page_title", $mparams->get( 'page_title', '')); $smartyvs->assign("show_page_title", $mparams->get( 'show_page_title', '')); if ($c->cbint == "1") { $smartyvs->assign("url_register", JRoute::_("index.php?Itemid=".$hwdvsItemid."&option=com_comprofiler&task=registers")); $smartyvs->assign("url_reset", JRoute::_("index.php?Itemid=".$hwdvsItemid."&option=com_comprofiler&task=lostPassword")); $smartyvs->assign("url_remind", JRoute::_("index.php?Itemid=".$hwdvsItemid."&option=com_comprofiler&task=lostPassword")); } else { $smartyvs->assign("url_register", JRoute::_("index.php?Itemid=".$hwdvsItemid."&option=com_user&view=register")); $smartyvs->assign("url_reset", JRoute::_("index.php?Itemid=".$hwdvsItemid."&option=com_user&view=reset")); $smartyvs->assign("url_remind", JRoute::_("index.php?Itemid=".$hwdvsItemid."&option=com_user&view=remind")); } //// // here you can call any Joomla module positions you like and insert them into the hwdVideoShare template system //// // // $document = &JFactory::getDocument(); // $renderer = $document->loadRenderer('modules'); // $options = array('style' => 'xhtml'); // $position = 'left'; // $smartyvs->assign("modules_left", $renderer->render($position, $options, null)); // // now you can use the {$modules_left} tag in any template file to display this module position in hwdVideoShare // if (!isset($hwdvsTemplateOverride['show_thumbnail'])) { $hwdvsTemplateOverride['show_thumbnail'] = 1; } if (!isset($hwdvsTemplateOverride['show_title'])) { $hwdvsTemplateOverride['show_title'] = 1; } if (!isset($hwdvsTemplateOverride['show_views'])) { $hwdvsTemplateOverride['show_views'] = 1; } if (!isset($hwdvsTemplateOverride['show_category'])) { $hwdvsTemplateOverride['show_category'] = 1; } if (!isset($hwdvsTemplateOverride['show_rating'])) { $hwdvsTemplateOverride['show_rating'] = 1; } if (!isset($hwdvsTemplateOverride['show_uploader'])) { $hwdvsTemplateOverride['show_uploader'] = 1; } if (!isset($hwdvsTemplateOverride['show_description'])) { $hwdvsTemplateOverride['show_description'] = 0; } if (!isset($hwdvsTemplateOverride['show_duration'])) { $hwdvsTemplateOverride['show_duration'] = 0; } if (!isset($hwdvsTemplateOverride['show_upload_date'])) { $hwdvsTemplateOverride['show_upload_date'] = 0; } if (!isset($hwdvsTemplateOverride['show_avatar'])) { $hwdvsTemplateOverride['show_avatar'] = 1; } if (!isset($hwdvsTemplateOverride['show_comments'])) { $hwdvsTemplateOverride['show_comments'] = 0; } if (!isset($hwdvsTemplateOverride['show_tags'])) { $hwdvsTemplateOverride['show_tags'] = 0; } if (!isset($hwdvsTemplateOverride['show_timesince'])) { $hwdvsTemplateOverride['show_timesince'] = 0; } // LEGACY $smartyvs->assign("mosConfig_live_site", JURI::root( true )); $smartyvs->assign("link_home", JURI::root( true )); $smartyvs->assign("link_home_hwd_vs", JURI::root( true )."/index.php?option=com_hwdvideoshare&Itemid=".$hwdvsItemid); $smartyvs->assign("thumbwidth", $c->thumbwidth); }
/** * Generates the Download Video Button * * @param array $row the video sql data * @param int $original link to original video or converted flv video (0/1) * @return $code */ function generateDownloadVideoLink( $row ) { global $hwdvsItemid, $smartyvs; $c = hwd_vs_Config::get_instance(); $db = & JFactory::getDBO(); $my = & JFactory::getUser(); $acl= & JFactory::getACL(); $usersConfig = &JComponentHelper::getParams( 'com_users' ); $code = null; if ($row->video_type == "local" || $row->video_type == "mp4" || $row->video_type == "swf" || $row->video_type == "seyret" || ($row->video_type == "remote" && substr($row->video_id, 0, 6) !== "embed|")) { if ($c->showdlor == "1") { $smartyvs->assign("showDownloadButton", 1); $smartyvs->assign("print_downloadOption", 1); if (!hwd_vs_access::checkAccess($c->gtree_dnld, $c->gtree_dnld_child, 4, 0, _HWDVIDS_TITLE_NOACCESS, "You need to login to download videos.", "You do not have permission to download videos.", "exclamation.png", 0, "core.frontend.download", 1)) { return "You do not have permission to download videos"; } // setup antileech system expiration $dlink_generic = hwd_vs_tools::generateAntileechExpiration($row->id, 'local', ''); $code.= "<form name=\"downloadVideo\" action=\"$dlink_generic\" method=\"post\"> <select name=\"deliver\"> <option value=\"original\">Original Video</option> <option value=\"flv\">Standard Definition (FLV)</option>"; if ($c->uselibx264 == "1") { $code.= "<option value=\"h264\">High Definition (MP4)</option>"; } if ($c->ipod320 == "on") { $code.= "<option value=\"ipod340\">iPod 320 (MP4)</option>"; } if ($c->ipod640 == "on") { $code.= "<option value=\"ipod620\">iPod 640 (MP4)</option>"; } // if ($c->ogg == "on") // { // $code.= "<option value=\"ogg\">Ogg Theora (OGG)</option>"; // } $code.= "</select> <input type=\"submit\" value=\"Download\" /> </form>"; } } return $code; }
$limitstart = JRequest::getInt( 'limitstart', 0 ); $task = JRequest::getCmd( 'task', 'frontpage' ); hwdvsInitialise::getJVersion(); if ($task !== "deliverThumb") { hwdvsInitialise::isModerator(); hwdvsInitialise::itemid(); hwdvsInitialise::mobiles(); hwdvsInitialise::background(); hwdvsInitialise::language(); if (!hwdvsInitialise::template()) {return;} hwdvsInitialise::revenueManager(); hwdvsInitialise::mysqlQuery(); hwdvsInitialise::definitions(); if (!hwd_vs_access::checkAccess($c->gtree_core, $c->gtree_core_child, 1, 0, _HWDVIDS_TITLE_NOACCESS, _HWDVIDS_ALERT_REGISTERFORACCESS, _HWDVIDS_ALERT_NOT_AUTHORIZED, 'exclamation.png', 0)) {return;} if ($c->loadmootools == "on") { JHTML::_('behavior.mootools'); } } // Require the base controller require_once (JPATH_COMPONENT.DS.'controller.php'); // Create the controller $controller = new UserController(); // Perform the Request task $controller->execute($task);