Example #1
0
 function display($cachable = false, $urlparams = false)
 {
     global $javconfig;
     $layout = Jrequest::getVar('layout');
     $per = FALSE;
     $permission = $javconfig['systems']->get('user_group', "1,6,7,2,3,4,5,10,12,8");
     if ($permission) {
         $permissions = explode(",", $permission);
         $user = JFactory::getUser();
         //Get all groups that the user is mapped to recursively.
         $groups = $user->getAuthorisedGroups();
         if ($user->id) {
             if ($permissions[0] == "1") {
                 $per = TRUE;
             } else {
                 foreach ($groups as $gkey => $gVal) {
                     if (in_array($gVal, $permissions)) {
                         $per = TRUE;
                         break;
                     }
                 }
             }
         }
     }
     if (!$per && ($layout == 'guide' || $layout == 'form')) {
         Jrequest::setVar('layout', 'list');
     }
     Jrequest::setVar('permission', $per);
     parent::display($cachable = false, $urlparams = false);
     return TRUE;
 }
Example #2
0
 /**
  * Constructor
  *
  * @since 0.1
  */
 function __construct()
 {
     parent::__construct();
     $app =& JFactory::getApplication();
     $option = Jrequest::getCmd('option');
     // Get the pagination request variables
     $limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->getCfg('list_limit'), 'int');
     $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
     // In case limit has been changed, adjust it
     $limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0;
     $this->setState('limit', $limit);
     $this->setState('limitstart', $limitstart);
     // filters and ordering
     $filter_order = $app->getUserStateFromRequest('com_redevent.sessions.filter_order', 'filter_order', 'obj.dates', 'cmd');
     $filter_order_Dir = $app->getUserStateFromRequest('com_redevent.sessions.filter_order_Dir', 'filter_order_Dir', 'asc', 'word');
     $search = $app->getUserStateFromRequest('com_redevent.sessions.search', 'search', '', 'string');
     $eventid = $app->getUserStateFromRequest('com_redevent.sessions.eventid', 'eventid', 0, 'int');
     $venueid = $app->getUserStateFromRequest('com_redevent.sessions.venueid', 'venueid', 0, 'int');
     $filter_state = $app->getUserStateFromRequest('com_redevent.sessions.filter_state', 'filter_state', 'notarchived', 'cmd');
     $filter_featured = $app->getUserStateFromRequest('com_redevent.sessions.filter_featured', 'filter_featured', '', 'cmd');
     $filter_group = $app->getUserStateFromRequest('com_redevent.sessions.filter_group', 'filter_group', 0, 'int');
     $filter_group_manage = $app->getUserStateFromRequest('com_redevent.sessions.filter_group_manage', 'filter_group_manage', 1, 'int');
     $this->setState('filter_order', $filter_order);
     $this->setState('filter_order_Dir', $filter_order_Dir);
     $this->setState('filter_state', $filter_state);
     $this->setState('filter_featured', $filter_featured);
     $this->setState('filter_group', $filter_group);
     $this->setState('filter_group_manage', $filter_group_manage);
     $this->setState('search', strtolower($search));
     $this->setState('eventid', $eventid);
     $this->setState('venueid', $venueid);
     $this->setEventId($eventid);
 }
Example #3
0
 /**
  * Handle editing aliases from the aliases
  * manager. cid contains the id of the
  * alias record we want to edit. Need to be
  * turned into that of the SEF url id,
  * so as to be able to use the editurl view
  * to edit all aliases for this url
  */
 public function edit()
 {
     // hide the main menu
     JRequest::setVar('hidemainmenu', 1);
     // find and store edited item id
     $cid = JRequest::getVar('cid', array(0), 'default', 'array');
     $this->_id = $cid[0];
     // find to which url this alias record belongs to
     // get a model and ask for the matching URL record
     $model =& $this->getModel('aliases', 'Sh404sefModel');
     $url = $model->getUrlByAliasId($this->_id);
     // push that as a request var, so that we fake editing an url
     if (!empty($url) && !empty($url->id)) {
         $cid = array($url->id);
         Jrequest::setVar('cid', $cid);
     }
     // need to get the view to push the url data into it
     $viewName = JRequest::getWord('view');
     if (empty($viewName)) {
         JRequest::setVar('view', $this->_defaultView);
     }
     $document =& JFactory::getDocument();
     $viewType = $document->getType();
     $viewName = JRequest::getCmd('view');
     $this->_editView = $viewName;
     $viewLayout = JRequest::getCmd('layout', $this->_defaultLayout);
     $view =& $this->getView($viewName, $viewType, '', array('base_path' => $this->_basePath));
     // now we can push the url into the view
     $view->assign('url', $url);
     // will prevent user from editing the non-sef url
     $view->assign('noUrlEditing', true);
     // Call the base controller to do the rest
     $this->display();
 }
Example #4
0
 function display($tpl = null)
 {
     global $mainframe, $option;
     $limit = JRequest::getVar('limit', $mainframe->getCfg('list_limit'), '', 'int');
     $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
     $options['limit'] = $limit;
     $options['limitstart'] = $limitstart;
     $user =& JFactory::getUser();
     $pathway =& $mainframe->getPathway();
     $document =& JFactory::getDocument();
     $model =& $this->getModel();
     // Get the parameters of the active menu item
     $menus =& JSite::getMenu();
     $menu = $menus->getActive();
     // Push a model into the view
     $model =& $this->getModel();
     $jobType = JRequest::getVar('jobType');
     $options['jobType'] = $jobType;
     $order = Jrequest::getVar('orderby');
     $options['order'] = $order;
     $catsone = $model->getCatsone($options);
     $total = count($catsone);
     // Set the document page title
     $document->setTitle(JText::_("Catsone module"));
     jimport('joomla.html.pagination');
     $pagination = new JPagination($total, $limitstart, $limit);
     $this->assignRef('catsone', $catsone);
     $this->assignRef('jobType', $jobType);
     $this->assignRef('pagination', $pagination);
     //JHTML::_('behavior.formvalidation');
     parent::display($tpl);
 }
Example #5
0
 function display($tpl = null)
 {
     $layout = JRequest::getVar('layout', 'list');
     $permission = Jrequest::getVar('permission', 0);
     $config = new JConfig();
     $pagetitle = ' RSS Feed ' . ' ' . $config->sitename;
     $document = JFactory::getDocument();
     $document->setTitle($pagetitle);
     switch (strtolower($layout)) {
         case 'guide':
             $this->getItemList();
             break;
         case 'form':
             $this->displayForm();
             break;
         case 'rss':
             $this->rss();
             break;
         default:
             $this->listItems();
             break;
     }
     $this->assignRef('permission', $permission);
     parent::display($tpl);
 }
Example #6
0
    public function getRuncode(){

        //Get params
        $params = &JComponentHelper::getParams( 'com_jfoxconsole' );

        //load post and put on variables
        $jfoxcode = Jrequest::getVar('code', '', 'post','string', JREQUEST_ALLOWRAW );

        $format = JRequest::getCmd('format', 'html');

        $cols = JRequest::getInt('cols');
        $rows = JRequest::getInt('rows');

        if ($cols == 0) {
            if ($format == 'html') {
            $cols = $params->get('cols_html', 130);
            $rows = $params->get('rows_html', 20);
            } else {
            $cols = $params->get('cols_raw', 130);
            $rows = $params->get('rows_raw', 3);
           }
        }
        

        //load $app for be able to take at least live_site
        $app = JFactory::GetApplication();

        // the core that execute the code and put in one variable
        ob_start();
        eval($jfoxcode);
        $eval_result = ob_get_contents();
        ob_end_clean();

        // Way to abstract errors
        //todo: think a bit better who to do it to show another useful messages to user
        $errormessage   = 'Parse error';
        $pos = strpos($eval_result , $errormessage);

        if ($pos === false OR $params->get('filter_error') == 0) {
			if ($eval_result != ''){
					$jfoxconsoleoutput = $eval_result;
			} else {
					$jfoxconsoleoutput = JTEXT::_('COM_JFOXCONSOLE_NO_RESULT');
			}
        } else {
            $jfoxconsoleoutput = JTEXT::_('COM_JFOXCONSOLE_RUNCODE_HAS_ERROR');
        }


        $result = new stdClass;
        $result->jfoxconsoleoutput = $jfoxconsoleoutput;
        $result->jfoxcode = $jfoxcode;
        $result->cols = $cols;
        $result->rows = $rows;
        
        return $result;
    }
Example #7
0
 function display($tpl = null)
 {
     $layout = Jrequest::getVar('layout');
     switch ($layout) {
         case 'wordle':
             $this->wordle($tpl);
             break;
         default:
             $this->allTags($tpl);
     }
 }
Example #8
0
 function getvar()
 {
     $mainframe = JFactory::getApplication();
     $list = array();
     $option = 'feeds';
     $list['filter_order'] = $mainframe->getUserStateFromRequest($option . 'viewarchive.filter_order', 'filter_order', 'f.feed_last_update', 'post');
     $list['filter_order_Dir'] = $mainframe->getUserStateFromRequest($option . 'viewarchive.filter_order_Dir', 'filter_order_Dir', 'DESC', 'word');
     $list['limit'] = Jrequest::getInt('limit', 20);
     $list['limitstart'] = Jrequest::getInt('limitstart', 0);
     $list['search'] = $mainframe->getUserStateFromRequest($option . '.search', 'search', '', 'string');
     return $list;
 }
Example #9
0
 public function edit()
 {
     JRequest::setVar('hidemainmenu', 1);
     JRequest::setVar('layout', 'default');
     JRequest::setVar('view', 'session');
     JRequest::setVar('standalone', true);
     if (Jrequest::getVar('task') == 'edit') {
         JRequest::setVar('edit', true);
     } else {
         JRequest::setVar('edit', false);
     }
     parent::display();
 }
Example #10
0
 public function getroute()
 {
     $view = Jrequest::getCmd('view');
     switch ($view) {
         case "matrix":
             $link = JoomleagueHelperRoute::getMatrixRoute(JRequest::getVar('p'), JRequest::getVar('division'), JRequest::getVar('r'));
             break;
         case "teaminfo":
             $link = JoomleagueHelperRoute::getTeamInfoRoute(JRequest::getVar('p'), JRequest::getVar('tid'));
             break;
         case "referees":
             $link = JoomleagueHelperRoute::getRefereesRoute(JRequest::getVar('p'));
             break;
         case "results":
             $link = JoomleagueHelperRoute::getResultsRoute(JRequest::getVar('p'), JRequest::getVar('r'), JRequest::getVar('division'));
             break;
         case "resultsranking":
             $link = JoomleagueHelperRoute::getResultsRankingRoute(JRequest::getVar('p'));
             break;
         case "rankingmatrix":
             $link = JoomleagueHelperRoute::getRankingMatrixRoute(JRequest::getVar('p'), JRequest::getVar('r'), JRequest::getVar('division'));
             break;
         case "resultsrankingmatrix":
             $link = JoomleagueHelperRoute::getResultsRankingMatrixRoute(JRequest::getVar('p'), JRequest::getVar('r'), JRequest::getVar('division'));
             break;
         case "teamplan":
             $link = JoomleagueHelperRoute::getTeamPlanRoute(JRequest::getVar('p'), JRequest::getVar('tid'), JRequest::getVar('division'));
             break;
         case "roster":
             $link = JoomleagueHelperRoute::getPlayersRoute(JRequest::getVar('p'), JRequest::getVar('tid'), null, JRequest::getVar('division'));
             break;
         case "eventsranking":
             $link = JoomleagueHelperRoute::getEventsRankingRoute(JRequest::getVar('p'), JRequest::getVar('division'), JRequest::getVar('tid'));
             break;
         case "curve":
             $link = JoomleagueHelperRoute::getCurveRoute(JRequest::getVar('p'), JRequest::getVar('tid'), 0, JRequest::getVar('division'));
             break;
         case "statsranking":
             $link = JoomleagueHelperRoute::getStatsRankingRoute(JRequest::getVar('p'), JRequest::getVar('division'));
             break;
         default:
         case "ranking":
             $link = JoomleagueHelperRoute::getRankingRoute(JRequest::getVar('p'), JRequest::getVar('r'), null, null, 0, JRequest::getVar('division'));
     }
     // echo json_encode($link);
     // Use the correct json mime-type
     header('Content-Type: application/json');
     // Send the response.
     echo json_encode($link);
     JFactory::getApplication()->close();
 }
Example #11
0
    /**
     * Method to get a JDatabaseQuery object for retrieving the data set from a database.
     *
     * @return	object	A JDatabaseQuery object to retrieve the data set.
     */
    protected function getListQuery()
    {
        $w = explode('|', urldecode(JRequest::getVar('filterStr', '')));
        $user = JFactory::getUser();
        $filterStr = $w[0];
        $filterAktiv = $w[1];
        if ($filterAktiv == 1) {
            $lezartLimit = 1;
        } else {
            $lezartLimit = 99;
        }
        $db = $this->getDbo();
        $query = $db->getQuery(true);
        $catid = (int) $this->getState('authorlist.id', 1);
        $query = 'select sz.id, sz.megnevezes,
					   if(sz.vita1>0,"X"," ") vita1,
					   if(sz.vita2>0,"X"," ") vita2,
					   if(sz.szavazas>0,"X"," ") szavazas,
					   if(sz.lezart>0,"X"," ") lezart,
					   sz.szavazas_vege,
					   sz.titkos,
					   szo.user_id,
					   szo.kepviselo_id
					 from #__szavazasok as sz 
				 left outer join #__szavazok as szo on szo.user_id = "' . $user->id . '" and szo.szavazas_id = sz.id 
		';
        if (Jrequest::getVar('temakor') > 0) {
            $query .= ' where sz.temakor_id="' . JRequest::getVar('temakor', 0) . '"';
        } else {
            $query .= ' where sz.temakor_id > 0 and sz.lezart=0 ';
        }
        if ($filterStr == '') {
            $query .= ' and sz.lezart < ' . $lezartLimit;
        } else {
            $query .= ' and  sz.megnevezes like "%' . $filterStr . '%" and sz.lezart < ' . $lezartLimit;
        }
        if (JRequest::getVar('order') == '') {
            $query .= ' order by 1 DESC';
        } else {
            if (JRequest::getVar('order', '1') == '1') {
                $query .= ' order by ' . JRequest::getVar('order', '1');
            } else {
                $query .= ' order by ' . JRequest::getVar('order', '1');
            }
        }
        //DBG echo $query;
        return $query;
    }
Example #12
0
 /**
  * (non-PHPdoc)
  * @see components/com_tuiyo/controllers/TuiyoControllerServices::add()
  */
 public function add()
 {
     // Check for request forgeries
     JRequest::checkToken("request") or jexit('Invalid Token');
     $auth = TuiyoAPI::get('authentication');
     //Must be loggedIN
     $auth->requireAuthentication('post');
     $user = TuiyoAPI::get('user');
     $post =& Jrequest::get("post");
     $model =& $this->getModel("fireeagle");
     $view =& $this->getView("fireeagle", "json");
     $resp = array("code" => 505, "error" => _("could not add service"), "data" => null, "extra" => null);
     if ($model->addService($post, $user->id)) {
         $resp = array("code" => TUIYO_OK, "error" => null);
     }
     return $view->encode($resp);
 }
 function getroute()
 {
     $app =& JFactory::getApplication();
     $view = Jrequest::getCmd('view');
     switch ($view) {
         case "teaminfo":
             $link = JoomleagueHelperRoute::getTeamInfoRoute(JRequest::getVar('p'), JRequest::getVar('tid'));
             break;
         case "resultsranking":
             $link = JoomleagueHelperRoute::getResultsRankingRoute(JRequest::getVar('p'));
             break;
         case "rankingmatrix":
             $link = JoomleagueHelperRoute::getRankingMatrixRoute(JRequest::getVar('p'));
             break;
         case "resultsrankingmatrix":
             $link = JoomleagueHelperRoute::getResultsRankingMatrixRoute(JRequest::getVar('p'));
             break;
         case "teamplan":
             $link = JoomleagueHelperRoute::getTeamPlanRoute(JRequest::getVar('p'), JRequest::getVar('tid'), JRequest::getVar('division'));
             break;
         case "roster":
             $link = JoomleagueHelperRoute::getPlayersRoute(JRequest::getVar('p'), JRequest::getVar('tid'));
             break;
         case "eventsranking":
             $link = JoomleagueHelperRoute::getEventsRankingRoute(JRequest::getVar('p'), JRequest::getVar('division'));
             break;
         case "curve":
             $link = JoomleagueHelperRoute::getCurveRoute(JRequest::getVar('p'), 0, 0, JRequest::getVar('division'));
             break;
         case "statsranking":
             $link = JoomleagueHelperRoute::getStatsRankingRoute(JRequest::getVar('p'), JRequest::getVar('division'));
             break;
         default:
         case "ranking":
             $link = JoomleagueHelperRoute::getRankingRoute(JRequest::getVar('p'), null, null, null, 0, JRequest::getVar('division'));
     }
     echo json_encode($link);
     $app->close();
 }
Example #14
0
   /**
	* start converter
	*/
	function ajaxReinsertMetaFLV()
	{
		global $limit, $limitstart;
  		$db =& JFactory::getDBO();

		$video_id = Jrequest::getInt( 'cid', '' );

        $db->SetQuery( 'SELECT video_id FROM #__hwdvidsvideos WHERE id = '.$video_id );
        $video_id = $db->loadResult();

		include_once(JPATH_SITE."/components/com_hwdvideoshare/converters/__ConversionTools.php");
		include_once(JPATH_SITE."/components/com_hwdvideoshare/converters/__InjectMetaData.php");

		$path_new_flv = JPATH_SITE."/hwdvideos/uploads/".$video_id.".flv";
		$filename_ext = '';

		$InjectMetaData = hwd_vs_InjectMetaData::inject($path_new_flv);

		print $InjectMetaData[4];

		exit;
	}
Example #15
0
    /**
     * Outputs frontpage HTML
     *
     * @return       Nothing
     */
    function addConfirm($admin_import=false)
	{
		global $Itemid, $j15, $j16;
		$c = hwd_vs_Config::get_instance();
		$db = & JFactory::getDBO();
		$my = & JFactory::getUser();
		$acl= & JFactory::getACL();

		$security_code = JRequest::getCmd( 'security_code', '' );
		if ($c->disablecaptcha == "1")
		{
			$checksecurity = "0";
		}
		else
		{
			$checksecurity = "1";
		}
		if ($checksecurity == "1" && !$admin_import)
		{
			if(($_SESSION['security_code'] == $security_code) && (!empty($_SESSION['security_code'])) )
			{
				unset($_SESSION['security_code']);
			}
			else
			{
        		hwd_vs_tools::infomessage(4, 0, _HWDVIDS_TITLE_UPLDFAIL, _HWDVIDS_ALERT_ERRSC, "exclamation.png", 0);
				return;
			}
		}

		$requestarray = JRequest::get( 'default', 2 );
		$embeddump = $requestarray['embeddump'];
		$remote_verified = null;

		$parsedurl = parse_url($embeddump);
		if (empty($parsedurl['host'])) { $parsedurl['host'] = ''; }
		preg_match('/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i', $parsedurl['host'], $regs);
		if (empty($regs['domain'])) { $regs['domain'] = ''; }

		if ($j15)
		{
			if ($regs['domain'] == 'youtube.com' && file_exists(JPATH_SITE.DS.'plugins'.DS.'hwdvs-thirdparty'.DS.'youtube.php'))
			{
				require_once(JPATH_SITE.DS.'plugins'.DS.'hwdvs-thirdparty'.DS.'youtube.php');
			}
			else if ($regs['domain'] == 'google.com' && file_exists(JPATH_SITE.DS.'plugins'.DS.'hwdvs-thirdparty'.DS.'google.php'))
			{
				require_once(JPATH_SITE.DS.'plugins'.DS.'hwdvs-thirdparty'.DS.'google.php');
			}
			else if (file_exists(JPATH_SITE.DS.'plugins'.DS.'hwdvs-thirdparty'.DS.$regs['domain'].'.php'))
			{
				require_once(JPATH_SITE.DS.'plugins'.DS.'hwdvs-thirdparty'.DS.$regs['domain'].'.php');
			}
			else
			{
				require_once(JPATH_SITE.DS.'plugins'.DS.'hwdvs-thirdparty'.DS.'youtube.php');
				$regs['domain'] = 'remote';
			}
		}
		if ($j16)
		{
			if ($regs['domain'] == 'youtube.com' && file_exists(JPATH_SITE.DS.'plugins'.DS.'hwdvs-thirdparty'.DS.'youtube'.DS.'youtube.php'))
			{
				require_once(JPATH_SITE.DS.'plugins'.DS.'hwdvs-thirdparty'.DS.'youtube'.DS.'youtube.php');
			}
			else if ($regs['domain'] == 'google.com' && file_exists(JPATH_SITE.DS.'plugins'.DS.'hwdvs-thirdparty'.DS.'google'.DS.'google.php'))
			{
				require_once(JPATH_SITE.DS.'plugins'.DS.'hwdvs-thirdparty'.DS.'google'.DS.'google.php');
			}
			else if (file_exists(JPATH_SITE.DS.'plugins'.DS.'hwdvs-thirdparty'.DS.'thirdpartysupportpack'.DS.$regs['domain'].'.php'))
			{
				require_once(JPATH_SITE.DS.'plugins'.DS.'hwdvs-thirdparty'.DS.'thirdpartysupportpack'.DS.$regs['domain'].'.php');
			}
			else
			{
				require_once(JPATH_SITE.DS.'plugins'.DS.'hwdvs-thirdparty'.DS.'remote'.DS.'remote.php');
				$regs['domain'] = 'remote';
			}
		}

		$failures = "";
		if (!isset($remote_verified)) {

			$cn = 'hwd_vs_tp_'.preg_replace("/[^a-zA-Z0-9s_-]/", "", $regs['domain']);
			$f_processc = preg_replace("/[^a-zA-Z0-9s_-]/", "", $regs['domain']).'processCode';
			$f_processi = preg_replace("/[^a-zA-Z0-9s_-]/", "", $regs['domain']).'processThumbnail';
			$f_processt = preg_replace("/[^a-zA-Z0-9s_-]/", "", $regs['domain']).'processTitle';
			$f_processd = preg_replace("/[^a-zA-Z0-9s_-]/", "", $regs['domain']).'processDescription';
			$f_processk = preg_replace("/[^a-zA-Z0-9s_-]/", "", $regs['domain']).'processKeywords';
			$f_processl = preg_replace("/[^a-zA-Z0-9s_-]/", "", $regs['domain']).'processDuration';

			$tp = new $cn();

			$ext_v_code  = $tp->$f_processc($embeddump);

			//check if already exists
			$db->SetQuery( 'SELECT count(*) FROM #__hwdvidsvideos WHERE video_id = "'.$ext_v_code[1].'"' );
			$duplicatecount = $db->loadResult();

			if ($duplicatecount > 0 && $admin_import == false) {
				hwd_vs_tools::infomessage(4, 0, _HWDVIDS_TITLE_UPLDFAIL, _HWDVIDS_ALERT_DUPLICATE, "exclamation.png", 0);
				return;
			} else if ($duplicatecount > 0 && $admin_import == true) {
				return false;
			}

			$ext_v_title = $tp->$f_processt($embeddump, @$ext_v_code[1]);
			$ext_v_descr = $tp->$f_processd($embeddump, @$ext_v_code[1]);
			$ext_v_keywo = $tp->$f_processk($embeddump, @$ext_v_code[1]);
			$ext_v_durat = $tp->$f_processl($embeddump, @$ext_v_code[1]);

			if ($ext_v_code[0] == "0") {

				require_once(JPATH_SITE.'/plugins/hwdvs-thirdparty/remote.php');
				$regs['domain'] = 'remote';

				$tp = new hwd_vs_tp_remote();
				$ext_v_code  = $tp->remoteProcessCode($embeddump);
				$ext_v_title = $tp->remoteProcessTitle($embeddump, @$ext_v_code[1]);
				$ext_v_descr = $tp->remoteProcessDescription($embeddump, @$ext_v_code[1]);
				$ext_v_keywo = $tp->remoteProcessKeywords($embeddump, @$ext_v_code[1]);
				$ext_v_durat = $tp->remoteProcessDuration($embeddump, @$ext_v_code[1]);

				if ($ext_v_code[0] == "0") {
					hwd_vs_tools::infomessage(4, 0, _HWDVIDS_TITLE_UPLDFAIL, _HWDVIDS_INFO_TPPROCESSFAIL, "exclamation.png", 0);
					return;
				}

				//check if already exists
				$db->SetQuery( 'SELECT count(*) FROM #__hwdvidsvideos WHERE video_id = "'.$ext_v_code[1].'"' );
				$duplicatecount = $db->loadResult();

				if ($duplicatecount > 0 && $admin_import == false) {
					hwd_vs_tools::infomessage(4, 0, _HWDVIDS_TITLE_UPLDFAIL, _HWDVIDS_ALERT_DUPLICATE, "exclamation.png", 0);
					return;
				} else if ($duplicatecount > 0 && $admin_import == true) {
					return false;
				}
			}

			if ($ext_v_title[0] == 0) {$failures.=_HWDVIDS_INFO_TPTITLEFAIL."<br />";}
			if ($ext_v_descr[0] == 0) {$failures.=_HWDVIDS_INFO_TPDESCFAIL."<br />";}
			if ($ext_v_keywo[0] == 0) {$failures.=_HWDVIDS_INFO_TPKWFAIL."<br />";}
			if ($ext_v_durat[0] == 0) {$failures.=_HWDVIDS_INFO_TPDRFAIL."<br />";}

		} else if ($remote_verified == 0) {

			$error_msg = _HWDVIDS_ERROR_UPLDERR11."<br /><br />"._HWDVIDS_INFO_SUPPTPW."<br />".hwd_vs_tools::generateSupportedWebsiteList();
			hwd_vs_tools::infomessage(4, 0, _HWDVIDS_TITLE_UPLDFAIL, $error_msg, "exclamation.png", 1);
			return;

		}

		$title 				= hwd_vs_tools::generatePostTitle($ext_v_title[1]);
		$description 		= hwd_vs_tools::generatePostDescription($ext_v_descr[1]);
		$tags 				= hwd_vs_tools::generatePostTags($ext_v_keywo[1]);
		$category_id 		= JRequest::getInt( 'category_id', 0, 'post' );
		$public_private 	= JRequest::getWord( 'public_private' );
		$allow_comments 	= JRequest::getInt( 'allow_comments', 0, 'post' );
		$allow_embedding 	= JRequest::getInt( 'allow_embedding', 0, 'post' );
		$allow_ratings 		= JRequest::getInt( 'allow_ratings', 0, 'post' );

		$checkform = hwd_vs_tools::checkFormComplete($title, $description, $category_id, $tags, $public_private, $allow_comments, $allow_embedding, $allow_ratings);
		if (!$checkform) { return; }

		$row = new hwdvids_video($db);

		$password = Jrequest::getVar( 'hwdvspassword', '' );
		if (!empty($password))
		{
			$password = md5($password);
			$_POST['password'] 		= $password;
		}

		$_POST['video_type'] 		= $regs['domain'];
		$_POST['video_id'] 			= $ext_v_code[1];
		$_POST['title'] 			= $title;
		$_POST['description'] 		= $description;
		$_POST['category_id'] 		= $category_id;
		$_POST['tags'] 				= $tags;
		$_POST['public_private'] 	= $public_private;
		$_POST['allow_comments'] 	= $allow_comments;
		$_POST['allow_embedding'] 	= $allow_embedding;
		$_POST['allow_ratings'] 	= $allow_ratings;
		$_POST['video_length'] 		= $ext_v_durat[1];
		$_POST['date_uploaded'] 	= date('Y-m-d H:i:s');

		if ($admin_import)
		{
			$_POST['user_id'] 		= $_REQUEST['user_id'];
		}
		else
		{
			$_POST['user_id'] 		= $my->id;
		}

		if ($c->aa3v == 1) {
			$_POST['approved'] 	= "yes";
			$_POST['published'] = "1";
		} else {
			$_POST['approved'] 	= "pending";
			$_POST['published'] = "0";
		}

		// bind it to the table
		if (!$row->bind($_POST))
		{
			echo "<script type=\"text/javascript\">alert('".$row->getError()."');window.history.go(-1);</script>\n";
			exit();
		}

		// store it in the db
		if (!$row->store())
		{
			echo "<script type=\"text/javascript\">alert('".$row->getError()."');window.history.go(-1);</script>\n";
			exit();
		}

		include_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'helpers'.DS.'events.php');

		$params->title = $title;
		$params->id = $row->id;
		$params->category_id = $row->category_id;
		$params->type = $row->video_type;
		$params->user_id = $row->user_id;

		hwdvsEvent::onAfterVideoUpload($params);

		// save remote thumbnail to disk
		$data = @explode(",", $row->video_id);
		$thumburl = hwd_vs_tools::get_final_url( @$ext_v_code[2] );
		$thumbbase = "tp-".$row->id.".jpg";
		$thumbpath = JPATH_SITE.DS."hwdvideos".DS."thumbs".DS.$thumbbase;

		$ch = curl_init ($thumburl);
		curl_setopt($ch, CURLOPT_HEADER, 0);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
		curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
		$rawdata=curl_exec($ch);
		curl_close ($ch);
		if(file_exists($thumbpath))
		{
			unlink($thumbpath);
		}
		$fp = fopen($thumbpath,'x');
		fwrite($fp, $rawdata);
		fclose($fp);

		if(file_exists($thumbpath))
		{
			$db->SetQuery( "UPDATE #__hwdvidsvideos SET `thumbnail` = \"$thumbbase\" WHERE id = $row->id" );
			$db->Query();
		}

		$video = new hwdvids_video($db);
		$video->load( $row->id );

		if (!$admin_import) {
			hwd_vs_html::addConfirm($title, $failures, $video);
		} else {
			return true;
		}
	}
Example #16
0
	/**
	 * save categories
	 */
	function savegroup()
	{
		global $option;
  		$db =& JFactory::getDBO();
		$app = & JFactory::getApplication();

  		$access_lev_u = Jrequest::getVar( 'access_lev_u', '0' );
		$access_lev_v = Jrequest::getVar( 'access_lev_v', '0' );

		$row = new hwdvids_group($db);

		$_POST['category_name'] = Jrequest::getVar( 'category_name', 'no name supplied' );
		$_POST['category_description'] = Jrequest::getVar( 'category_description', 'no name supplied' );
		$_POST['access_lev_u'] = @implode(",", $access_lev_u);
		$_POST['access_lev_v'] = @implode(",", $access_lev_v);

		// bind it to the table
		if (!$row -> bind($_POST)) {
			echo "<script> alert('"
				.$row -> getError()
				."'); window.history.go(-1); </script>\n";
			exit();
		}

		// store it in the db
		if (!$row -> store()) {
			echo "<script> alert('"
				.$row -> getError()
				."'); window.history.go(-1); </script>\n";
			exit();
		}

		$row->checkin();

		// perform maintenance
		include(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'libraries'.DS.'maintenance_recount.class.php');
		hwd_vs_recount::recountVideosInCategory();
		hwd_vs_recount::recountSubcatsInCategory();

		$msg = $total ._HWDVIDS_ALERT_GRPSAVED;
		$app->enqueueMessage($msg);
		$app->redirect( JURI::root( true ) . '/administrator/index.php?option='.$option.'&task=groups' );
	}
Example #17
0
   <tr>

			<td align="right" colspan="6">

			<?php 
echo JText::_('Display Num') . '&nbsp;';
echo $this->pagination->getLimitBox();
?>

			</td>

		</tr>

		<?php 
$jobType = Jrequest::getVar('jobType');
if ($jobType != "") {
    $url = "index.php?option=com_catsone&jobType=" . $jobType;
} else {
    $url = "index.php?option=com_catsone";
}
?>

   <tr>

      <td class="catsone_content">

         <table class="catsone_inner" cellpadding=0 cellspacing=0 >

           <tr>
Example #18
0
   /**
	* edit videos
	*/
	function updateVideoSource()
	{
		global $option;
  		$db =& JFactory::getDBO();
		$my = & JFactory::getUser();
		$app = & JFactory::getApplication();
		$c = hwd_vs_Config::get_instance();

		$video_type	= Jrequest::getVar( 'videotype', '0' );
		$video_id	= Jrequest::getVar( 'id', '0' );
		$updatedetails	= Jrequest::getVar( 'updatedetails', '0' );

		$admin_import = true;
		require_once(JPATH_SITE.DS.'components'.DS.'com_hwdvideoshare'.DS.'models'.DS.'uploads.php');

		$row = new hwdvids_video($db);
		$row->load( $video_id );

		if ($video_type == 1)
		{
			$requestarray = JRequest::get( 'default', 2 );
			$embeddump = $requestarray['embeddump'];
			$remote_verified = null;

			$parsedurl = parse_url($embeddump);
			if (empty($parsedurl['host'])) { $parsedurl['host'] = ''; }
			preg_match('/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i', $parsedurl['host'], $regs);
			if (empty($regs['domain'])) { $regs['domain'] = ''; }

			if ($regs['domain'] == 'youtube.com' && file_exists(JPATH_SITE.'/plugins/hwdvs-thirdparty/youtube.php')) {
				require_once(JPATH_SITE.'/plugins/hwdvs-thirdparty/youtube.php');
			} else if ($regs['domain'] == 'google.com' && file_exists(JPATH_SITE.'/plugins/hwdvs-thirdparty/google.php')) {
				require_once(JPATH_SITE.'/plugins/hwdvs-thirdparty/google.php');
			} else if (file_exists(JPATH_SITE.'/plugins/hwdvs-thirdparty/'.$regs['domain'].'.php')) {
				require_once(JPATH_SITE.'/plugins/hwdvs-thirdparty/'.$regs['domain'].'.php');
			} else {

				$pos_flv = strpos($embeddump, ".flv");

				if ($pos_flv === false) {
					$remote_verified = 0;
				} else {
					$pos_flv = $pos_flv+4;
					$datadump = substr($embeddump, 0, $pos_flv);
					$pos_http = mb_strrpos($datadump, "http://");
					if ($pos_http === false) {
						$error_msg = _HWDVIDS_ERROR_UPLDERR11."<br /><br />"._HWDVIDS_INFO_SUPPTPW."<br />".hwd_vs_tools::generateSupportedWebsiteList();
						hwd_vs_tools::infomessage(4, 0, _HWDVIDS_TITLE_UPLDFAIL, $error_msg, "exclamation.png", 1);
						return;
					} else {
						$url = substr($datadump, $pos_http);
					}

					$pru = parse_url($url);
					$remoteurl = $pru['scheme']."://".$pru['host'].$pru['path'];

					if(!preg_match("/^[a-zA-Z]+[:\/\/]+[A-Za-z0-9\-_]+\\.+[A-Za-z0-9\.\/%&=\?\-_]+$/i",$remoteurl)) {
						$remote_verified = 0;
					} else {
						$filegrab = @file_get_contents($remoteurl, null, null, 0, 16);
						$filecheck = @strpos($remoteurl, "flv");
						if (isset($remoteurl) && !empty($remoteurl) && $filecheck !== false) {
							$remote_verified = 1;
						} else {
							$remote_verified = 0;
						}
					}
				}

			}

			$failures = "";
			if (!isset($remote_verified)) {
				$cn = 'hwd_vs_tp_'.preg_replace("/[^a-zA-Z0-9s_-]/", "", $regs['domain']);
				$f_processc = preg_replace("/[^a-zA-Z0-9s_-]/", "", $regs['domain']).'processCode';
				$f_processt = preg_replace("/[^a-zA-Z0-9s_-]/", "", $regs['domain']).'processTitle';
				$f_processd = preg_replace("/[^a-zA-Z0-9s_-]/", "", $regs['domain']).'processDescription';
				$f_processk = preg_replace("/[^a-zA-Z0-9s_-]/", "", $regs['domain']).'processKeywords';
				$f_processl = preg_replace("/[^a-zA-Z0-9s_-]/", "", $regs['domain']).'processDuration';

				$tp = new $cn();

				$ext_v_code  = $tp->$f_processc($embeddump);
				$ext_v_title = $tp->$f_processt($embeddump, @$ext_v_code[2]);
				$ext_v_descr = $tp->$f_processd($embeddump, @$ext_v_code[2]);
				$ext_v_keywo = $tp->$f_processk($embeddump, @$ext_v_code[2]);
				$ext_v_durat = $tp->$f_processl($embeddump, @$ext_v_code[2]);

				if ($ext_v_code[0] == "0") {
					hwd_vs_tools::infomessage(4, 0, _HWDVIDS_TITLE_UPLDFAIL, _HWDVIDS_INFO_TPPROCESSFAIL, "exclamation.png", 0);
					return;
				}

				if ($ext_v_title[0] == 0) {$failures.=_HWDVIDS_INFO_TPTITLEFAIL."<br />";}
				if ($ext_v_descr[0] == 0) {$failures.=_HWDVIDS_INFO_TPDESCFAIL."<br />";}
				if ($ext_v_keywo[0] == 0) {$failures.=_HWDVIDS_INFO_TPKWFAIL."<br />";}
				if ($ext_v_durat[0] == 0) {$failures.=_HWDVIDS_INFO_TPDRFAIL."<br />";}
			} else if ($remote_verified == 0) {
				$error_msg = _HWDVIDS_ERROR_UPLDERR11."<br /><br />"._HWDVIDS_INFO_SUPPTPW."<br />".hwd_vs_tools::generateSupportedWebsiteList();
				hwd_vs_tools::infomessage(4, 0, _HWDVIDS_TITLE_UPLDFAIL, $error_msg, "exclamation.png", 1);
				return;
			} else if ($remote_verified == 1) {
				$ext_v_code[1] = $remoteurl.",";
				$ext_v_title[1] = _HWDVIDS_UNKNOWN;
				$ext_v_descr[1] = _HWDVIDS_UNKNOWN;
				$ext_v_keywo[1] = _HWDVIDS_UNKNOWN;
				$ext_v_durat[1] = "0:00:00";
				$regs['domain'] = "remote";
			}

			//check if already exists
			$db->SetQuery( 'SELECT count(*) FROM #__hwdvidsvideos WHERE video_id = "'.$ext_v_code[1].'"' );
			$duplicatecount = $db->loadResult();

			$admin_import = false;

			if ($duplicatecount > 0 && $admin_import == false) {
				hwd_vs_tools::infomessage(4, 0, _HWDVIDS_TITLE_UPLDFAIL, _HWDVIDS_ALERT_DUPLICATE, "exclamation.png", 0);
				return;
			} else if ($duplicatecount > 0 && $admin_import == true) {
				return false;
			}

			$title = $ext_v_title[1];
			$title = stripslashes($title);
			$title = stripslashes($title);
			$title = hwdEncoding::charset_decode_utf_8($title);
			$title = hwdEncoding::charset_encode_utf_8($title);
			$title = htmlspecialchars_decode($title);
			$title = addslashes($title);

			$description = $ext_v_descr[1];
			$description = stripslashes($description);
			$description = stripslashes($description);
			$description = hwdEncoding::charset_decode_utf_8($description);
			$description = hwdEncoding::charset_encode_utf_8($description);
			$description = htmlspecialchars_decode($description);
			$description = addslashes($description);

			$raw_tags = $ext_v_keywo[1];
			$tags = '';
			$tag_arr_co = explode(",", $raw_tags);

			for ($j=0, $m=count($tag_arr_co); $j < $m; $j++) {

				$row_co = $tag_arr_co[$j];
				$tag_arr_sp = explode(" ", $row_co);

				for ($k=0, $p=count($tag_arr_sp); $k < $p; $k++) {

					$row_sp = $tag_arr_sp[$k];
					$row_sp = hwdEncoding::charset_decode_utf_8($row_sp);
					$row_sp = preg_replace("/[^a-zA-Z0-9s_&#;-]/", "", $row_sp);
					$row_sp = hwdEncoding::charset_encode_utf_8($row_sp);

					if (!empty($row_sp)) {
						$tags.= $row_sp.",";
					}

				}
			}
			if (substr($tags, -2) == ", ") {$tags = substr($tags, 0, -2);}

			if (empty($title)) { $title = _HWDVIDS_UNKNOWN;}
			if (empty($description)) { $description = _HWDVIDS_UNKNOWN;}
			if (empty($tags)) { $tags = _HWDVIDS_UNKNOWN;}

			$_POST['video_type'] 		= $regs['domain'];
			$_POST['video_id'] 			= $ext_v_code[1];

			if ($updatedetails == "on") {
				$_POST['title'] 			= $ext_v_title[1];
				$_POST['description'] 		= $ext_v_descr[1];
				$_POST['tags'] 				= $ext_v_keywo[1];
			}

			// bind it to the table
			if (!$row -> bind($_POST)) {
				echo "<script> alert('"
					.$row -> getError()
					."'); window.history.go(-1); </script>\n";
				exit();
			}

			// store it in the db
			if (!$row -> store()) {
				echo "<script> alert('"
					.$row -> getError()
					."'); window.history.go(-1); </script>\n";
				exit();
			}

			$row->checkin();

		}
		else if ($video_type == 2)
		{
			$data = explode(",", $row->video_id);
			$thumbnail = @$data[1];

			$requestarray = JRequest::get( 'default', 2 );
			$videourl = $requestarray['embeddump'];

			$validated_video_url = hwd_vs_tools::validateUrl($videourl);

			if (empty($validated_video_url))
			{
				$msg = _HWDVIDS_ALERT_VURLWRONG;
				$app->enqueueMessage($msg);
				$app->redirect(JURI::root( true )."/administrator/index.php?option=com_hwdvideoshare&task=editvidsA&hidemainmenu=1&cid=".$row->id);
			}

			$new_video_id = $validated_video_url.",".$thumbnail;

			$_POST['video_type'] 		= "remote";
			$_POST['video_id'] 			= $new_video_id;
			if (empty($row->thumbnail) && !empty($thumbnail))
			{
				$_POST['thumbnail'] 	= $thumbnail;
			}

			// bind it to the table
			if (!$row->bind($_POST))
			{
				echo "<script type=\"text/javascript\">alert('".$row->getError()."');window.history.go(-1);</script>\n";
				exit();
			}

			// store it in the db
			if (!$row->store())
			{
				echo "<script type=\"text/javascript\">alert('".$row->getError()."');window.history.go(-1);</script>\n";
				exit();
			}
			$row->checkin();
		}
		else if ($video_type == 3)
		{
			$data = explode(",", $row->video_id);
			$thumbnail = @$data[1];

			$requestarray = JRequest::get( 'default', 2 );
			$rtmpurl = $requestarray['embeddump'];
			$validated_rtmpurl = hwd_vs_tools::validateUrl($rtmpurl);

			if (empty($validated_rtmpurl))
			{
				$msg = _HWDVIDS_ALERT_VURLWRONG;
				$app->enqueueMessage($msg);
				$app->redirect(JURI::root( true )."/administrator/index.php?option=com_hwdvideoshare&task=editvidsA&hidemainmenu=1&cid=".$row->id);
			}

			$new_video_id = $validated_rtmpurl;

			$_POST['video_type'] 		= "rtmp";
			$_POST['video_id'] 			= $new_video_id;
			if (empty($row->thumbnail) && !empty($thumbnail))
			{
				$_POST['thumbnail'] 	= $thumbnail;
			}

			// bind it to the table
			if (!$row->bind($_POST))
			{
				echo "<script type=\"text/javascript\">alert('".$row->getError()."');window.history.go(-1);</script>\n";
				exit();
			}

			// store it in the db
			if (!$row->store())
			{
				echo "<script type=\"text/javascript\">alert('".$row->getError()."');window.history.go(-1);</script>\n";
				exit();
			}
			$row->checkin();
		}

		require_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'libraries'.DS.'maintenance_recount.class.php');
		hwd_vs_recount::recountVideosInCategory($row->category_id);

		$app->enqueueMessage(_HWDVIDS_ALERT_VIDSAVED);
		$app->redirect( JURI::root( true ) . '/administrator/index.php?option='.$option.'&task=editvidsA&hidemainmenu=1&cid='.$row->id );
	}
Example #19
0
   /**
	* Delete videos
	*/
	function deleteVideo()
	{
		global $mainframe, $Itemid;
		$c = hwd_vs_Config::get_instance();
		$db = & JFactory::getDBO();
		$my = & JFactory::getUser();
		$app = & JFactory::getApplication();

		$videoid	= JRequest::getInt( 'videoid', 0, 'post' );
		$url    	= Jrequest::getVar( 'url', '' );

		$row = new hwdvids_video($db);
		$row->load( $videoid );

		// 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 == $row->user_id) {
					if ($my->id == "0") {
						$app->enqueueMessage(_HWDVIDS_ALERT_NOPERM);
						if (!empty($url)) {
							$app->redirect( $url );
						} else {
							$app->redirect( JURI::root( true ) . '/index.php?option=com_hwdvideoshare&Itemid='.$Itemid );
						}
					}
					if ($c->allowvidedit == "0") {
						$app->enqueueMessage(_HWDVIDS_ALERT_NOPERM);
						if (!empty($url)) {
							$app->redirect( $url );
						} else {
							$app->redirect( JURI::root( true ) . '/index.php?option=com_hwdvideoshare&Itemid='.$Itemid );
						}

					}
					// continue
				} else {
					$app->enqueueMessage(_HWDVIDS_ALERT_NOPERM);
					if (!empty($url)) {
						$app->redirect( $url );
					} else {
						$app->redirect( JURI::root( true ) . '/index.php?option=com_hwdvideoshare&Itemid='.$Itemid );
					}
				}
			}
		}

		$db->SetQuery("UPDATE #__hwdvidsvideos SET approved = 'deleted', published = 0, featured = 0 WHERE id = $videoid");
		$db->Query();

		if ( !$db->query() ) {
			echo "<script> alert('".$db->getErrorMsg()."'); window.history.go(-1); </script>\n";
			exit();
		}

		$app->enqueueMessage(_HWDVIDS_ALERT_ADMIN_USERVIDDEL);
		if (!empty($url)) {
			$app->redirect( $url );
		} else {
			$app->redirect( JURI::root( true ) . '/index.php?option=com_hwdvideoshare&Itemid='.$Itemid );
		}
	}
Example #20
0
 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     // ajax in event form, or standalone ?
     $standalone = Jrequest::getVar('standalone', 0);
     if (!$standalone && $this->getLayout() == 'closexref') {
         $this->_displayclosexref($tpl);
         return;
     }
     if ($standalone) {
         $document =& JFactory::getDocument();
         $document->setTitle(JText::_('COM_REDEVENT_PAGETITLE_EDITSESSION'));
         $document->addStyleSheet('components/com_redevent/assets/css/redeventbackend.css');
         // Set toolbar items for the page
         $edit = JRequest::getVar('edit', true);
         $text = !$edit ? JText::_('COM_REDEVENT_New') : JText::_('COM_REDEVENT_Edit');
         JToolBarHelper::title(JText::_('COM_REDEVENT_SESSION') . ': <small><small>[ ' . $text . ' ]</small></small>');
         JToolBarHelper::save();
         JToolBarHelper::apply();
         if (JPluginHelper::isEnabled('system', 'autotweetredevent')) {
             //If the AutoTweet NG Component is installed
             // Ignore warnings because component may not be installed
             $warnHandlers = JERROR::getErrorHandling(E_WARNING);
             JERROR::setErrorHandling(E_WARNING, 'ignore');
             if (JComponentHelper::isEnabled('com_autotweet', true)) {
                 JToolBarHelper::save('saveAndTwit', 'Save & twit');
             }
             // Reset the warning handler(s)
             foreach ($warnHandlers as $mode) {
                 JERROR::setErrorHandling(E_WARNING, $mode);
             }
         }
         if (!$edit) {
             JToolBarHelper::cancel();
         } else {
             // for existing items the button is renamed `close`
             JToolBarHelper::cancel('cancel', 'Close');
         }
     }
     //initialise variables
     $editor =& JFactory::getEditor();
     $document =& JFactory::getDocument();
     $uri =& JFactory::getURI();
     $elsettings = JComponentHelper::getParams('com_redevent');
     //add css and js to document
     //JHTML::_('behavior.modal', 'a.modal');
     JHTML::_('behavior.tooltip');
     JHTML::_('behavior.formvalidation');
     jimport('joomla.html.pane');
     $document->addScript(JURI::root() . 'components/com_redevent/assets/js/xref_recurrence.js');
     $document->addScript(JURI::root() . 'components/com_redevent/assets/js/xref_roles.js');
     $document->addScript(JURI::root() . 'components/com_redevent/assets/js/xref_prices.js');
     $document->addScriptDeclaration('var txt_remove = "' . JText::_('COM_REDEVENT_REMOVE') . '";');
     //Build the image select functionality
     $js = "\n\t\tfunction elSelectImage(image, imagename) {\n\t\t\tdocument.getElementById('a_image').value = image;\n\t\t\tdocument.getElementById('a_imagename').value = imagename;\n\t\t\tdocument.getElementById('sbox-window').close();\n\t\t}";
     $xref = $this->get('xref');
     $xref->eventid = $xref->eventid ? $xref->eventid : JRequest::getVar('eventid', 0, 'request', 'int');
     $customfields =& $this->get('XrefCustomfields');
     $roles =& $this->get('SessionRoles');
     $prices =& $this->get('SessionPrices');
     $lists = array();
     // venues selector
     $venues = array(JHTML::_('select.option', 0, JText::_('COM_REDEVENT_Select_Venue')));
     $venues = array_merge($venues, $this->get('VenuesOptions'));
     $lists['venue'] = JHTML::_('select.genericlist', $venues, 'venueid', 'class="validate-venue"', 'value', 'text', $xref->venueid);
     // group selector
     $options = array(JHTML::_('select.option', 0, JText::_('COM_REDEVENT_Select_group')));
     $options = array_merge($options, $this->get('GroupsOptions'));
     $lists['group'] = JHTML::_('select.genericlist', $options, 'groupid', '', 'value', 'text', $xref->groupid);
     // if this is not the first xref of the recurrence, we shouldn't modify it
     $lockedrecurrence = $xref->count > 0;
     // Recurrence selector
     $recur_type = array(JHTML::_('select.option', 'NONE', JText::_('COM_REDEVENT_NO_REPEAT')), JHTML::_('select.option', 'DAILY', JText::_('COM_REDEVENT_DAILY')), JHTML::_('select.option', 'WEEKLY', JText::_('COM_REDEVENT_WEEKLY')), JHTML::_('select.option', 'MONTHLY', JText::_('COM_REDEVENT_MONTHLY')), JHTML::_('select.option', 'YEARLY', JText::_('COM_REDEVENT_YEARLY')));
     $lists['recurrence_type'] = JHTML::_('select.radiolist', $recur_type, 'recurrence_type', '', 'value', 'text', $xref->rrules->type);
     // published state selector
     $published = array(JHTML::_('select.option', '1', JText::_('COM_REDEVENT_PUBLISHED')), JHTML::_('select.option', '0', JText::_('COM_REDEVENT_UNPUBLISHED')), JHTML::_('select.option', '-1', JText::_('COM_REDEVENT_ARCHIVED')));
     $lists['published'] = JHTML::_('select.radiolist', $published, 'published', '', 'value', 'text', $xref->published);
     // featured state selector
     $options = array(JHTML::_('select.option', '0', JText::_('COM_REDEVENT_SESSION_NOT_FEATURED')), JHTML::_('select.option', '1', JText::_('COM_REDEVENT_SESSION_IS_FEATURED')));
     $lists['featured'] = JHTML::_('select.booleanlist', 'featured', '', $xref->featured);
     $pane =& JPane::getInstance('tabs');
     $rolesoptions = array(JHTML::_('select.option', 0, JText::_('COM_REDEVENT_Select_role')));
     $rolesoptions = array_merge($rolesoptions, $this->get('RolesOptions'));
     $pricegroupsoptions = array(JHTML::_('select.option', 0, JText::_('COM_REDEVENT_PRICEGROUPS_SELECT_PRICEGROUP')));
     $pricegroupsoptions = array_merge($pricegroupsoptions, $this->get('PricegroupsOptions'));
     if (JRequest::getVar('task') == 'copy') {
         $xref->id = null;
         $xref->recurrence_id = null;
     }
     //assign to template
     $this->assignRef('xref', $xref);
     $this->assignRef('editor', $editor);
     $this->assignRef('lists', $lists);
     $this->assignRef('request_url', $uri->toString());
     $this->assignRef('elsettings', $elsettings);
     $this->assignRef('customfields', $customfields);
     $this->assignRef('pane', $pane);
     $this->assignRef('roles', $roles);
     $this->assignRef('rolesoptions', $rolesoptions);
     $this->assignRef('prices', $prices);
     $this->assignRef('pricegroupsoptions', $pricegroupsoptions);
     $this->assign('standalone', $standalone);
     parent::display($tpl);
 }
Example #21
0
 /**
  * run on formModel::setFormData()
  * set before form is validated
  * @param int repeat group counter
  * @return null
  */
 public function preProcess($c)
 {
     $params =& $this->getParams();
     // $$$ hugh - special case for social plugins (like CB plugin).  If plugin sets
     // fabrik.plugin.profile_id, and 'user_use_social_plugin_profile' param is set,
     // and we are creating a new row, then use the session data as the user ID.
     // This allows user B to view a table in a CB profile for user A, do an "Add",
     // and have the user element set to user A's ID.
     // TODO - make this table/form specific, but not so easy to do in CB plugin
     if ((int) $params->get('user_use_social_plugin_profile', 0)) {
         if (JRequest::getInt('rowid') == 0 && JRequest::getCmd('task') !== 'doimport') {
             $session =& JFactory::getSession();
             if ($session->has('fabrik.plugin.profile_id')) {
                 $profile_id = $session->get('fabrik.plugin.profile_id');
                 $form =& $this->getForm();
                 $group =& $this->getGroup();
                 $joinid = $group->getGroup()->join_id;
                 $key = $this->getFullName(true, true, false);
                 $shortkey = $this->getFullName(false, true, false);
                 $rawkey = $key . '_raw';
                 if ($group->canRepeat()) {
                     if ($group->isJoin()) {
                         $key = str_replace("][", '.', $key);
                         $key = str_replace(array('[', ']'), '.', $key) . "{$c}";
                         $rawkey = str_replace($shortkey, $shortkey . '_raw', $key);
                     } else {
                         $key = $key . '.' . $c;
                         $rawkey = $rawkey . '.' . $c;
                     }
                 } else {
                     if ($group->isJoin()) {
                         $key = str_replace("][", ".", $key);
                         $key = str_replace(array('[', ']'), '.', $key);
                         $key = rtrim($key, '.');
                         $rawkey = str_replace($shortkey, $shortkey . '_raw', $key);
                     }
                 }
                 $form->updateFormData($key, "{$profile_id}");
                 $form->updateFormData($rawkey, "{$profile_id}");
                 JRequest::setVar($key, "{$profile_id}", 'POST');
                 Jrequest::setVar($rawkey, "{$profile_id}", 'POST');
             }
         }
     }
 }
Example #22
0
    /**
     * Outputs frontpage HTML
     *
     * @return       Nothing
     */
    function reportGroup()
	{
	global $mainframe, $my, $acl, $mosConfig_absolute_path, $mosConfig_mailfrom, $mosConfig_fromname, $mosConfig_live_site, $Itemid, $mosConfig_sitename;
	$c = hwd_vs_Config::get_instance();
	$db = & JFactory::getDBO();
	$my = & JFactory::getUser();

		$url = Jrequest::getVar( 'url', '' );

		if (!$my->id) {
			$msg = _HWDVIDS_ALERT_LOG2FLAG;
			$mainframe->enqueueMessage($msg);
			$mainframe->redirect( $url );
		}

		$userid = $my->id;
		$groupid = JRequest::getInt( 'groupid', 0 );

		$where = ' WHERE a.groupid = '.$groupid;

		$db->SetQuery( 'SELECT count(*)'
							. ' FROM #__hwdvidsflagged_groups AS a'
							. $where
							);
  		$total = $db->loadResult();

		if ( $total>0 ) {
			$msg = _HWDVIDS_ALERT_ALREADYFLAG;
			$mainframe->enqueueMessage($msg);
			$mainframe->redirect( $url );
		}

		$row = new hwdvids_flaggroup($db);

		$_POST['userid'] = $userid;
		$_POST['groupid'] = $groupid;
		$_POST['status'] = "UNREAD";
		$_POST['date'] = date('Y-m-d H:i:s');

		// bind it to the table
		if (!$row -> bind($_POST)) {
			echo "<script> alert('"
				.$row -> getError()
				."'); window.history.go(-1); </script>\n";
			exit();
		}

		// store it in the db
		if (!$row -> store()) {
			echo "<script> alert('"
				.$row -> getError()
				."'); window.history.go(-1); </script>\n";
			exit();
		}

		// mail admin notification
		if ($c->mailreportnotification == 1) {
			$jconfig = new jconfig();

			$mailbody = ""._HWDVIDS_MAIL_BODY9.$jconfig->sitename.".\n";
			$mailbody .= ""._HWDVIDS_MAIL_BODY12."\n";
			if (isset($groupid)) {
				$mailbody .= "".JURI::root()."index.php?option=com_hwdvideoshare&Itemid=".$Itemid."&task=viewgroup&group_id=".$groupid."\n\n";
			}
			$mailbody .= ""._HWDVIDS_MAIL_BODY11."\n";
			$mailbody .= JURI::root()."administrator";

			JUtility::sendMail( $jconfig->mailfrom, $jconfig->fromname, $c->mailnotifyaddress, _HWDVIDS_MAIL_SUBJECT4.$jconfig->sitename.' ', $mailbody );
		}

		$msg = _HWDVIDS_ALERT_SUCFLAGGED;
		$mainframe->enqueueMessage($msg);
		$mainframe->redirect( $url );
	}
Example #23
0
	/**
	 * save categories
	 */
	function savecategories()
	{
		global $option;
		$db = & JFactory::getDBO();
		$app = & JFactory::getApplication();
		$c = hwd_vs_Config::get_instance();

		$access_lev_u = Jrequest::getVar( 'access_lev_u', '0' );
		$access_lev_v = Jrequest::getVar( 'access_lev_v', '0' );

		$row = new hwdvids_cats($db);

		if (isset($_FILES['thumbnail_file']['error'])) {

			$file_name_org   = $_FILES['thumbnail_file']['name'];
			$file_ext        = substr($file_name_org, strrpos($file_name_org, '.') + 1);

			$thumbnail_url = JURI::root( true ).'/hwdvideos/thumbs/category'.$_POST['id'].'.'.$file_ext;
			$base_Dir = JPATH_SITE.DS.'hwdvideos'.DS.'thumbs'.DS;
			$thumbnail_name = 'category'.$_POST['id'];

			$upload_result = hwd_vs_tools::uploadFile("thumbnail_file", $thumbnail_name, $base_Dir, 2, "jpg,jpeg", 1);

			if ($upload_result[0] == "0") {

				$msg = $upload_result[1];
				$app->enqueueMessage($msg);

			} else {

				include_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'libraries'.DS.'thumbnail.inc.php');
				$thumb_path_s = JPATH_SITE.DS.'hwdvideos'.DS.'thumbs'.DS.$thumbnail_name.'.'.$file_ext;
				$twidth_s = round($c->con_thumb_n);
				$theight_s = round($c->con_thumb_n*$c->tar_fb);

				list($width, $height, $type, $attr) = @getimagesize($thumb_path_s);
				$ratio = $height/$width;

				if ($ratio < $c->tar_fb) {

					$resized_s = new Thumbnail($thumb_path_s);
					$resized_s->resize(1000, $theight_s);
					$resized_s->cropFromCenter($twidth_s, $theight_s);
					$resized_s->save($thumb_path_s);
					$resized_s->destruct();

				} else {

					$resized_s = new Thumbnail($thumb_path_s);
					$resized_s->resize($twidth_s,1000);
					$resized_s->cropFromCenter($twidth_s, $theight_s);
					$resized_s->save($thumb_path_s);
					$resized_s->destruct();

				}
			}

			// update db with new thumbnail
			$db->SetQuery("UPDATE #__hwdvidscategories SET thumbnail = '$thumbnail_url' WHERE id = ".intval($_POST['id']));
			$db->Query();
			if ( !$db->query() ) {
				echo "<script> alert('".$db->getErrorMsg()."'); window.history.go(-1); </script>\n";
				exit();
			}

			$msg = "Thumbnail was successfully uploaded";
			$app->enqueueMessage($msg);
			$app->redirect( 'index.php?option=com_hwdvideoshare&Itemid='.$Itemid.'&task=editcatA&hidemainmenu=1&cid='.$_POST['id'] );

		} else {

			if (intval($_POST['id']) !== 0 && (intval($_POST['id']) == intval($_POST['parent']))) {
				$app->enqueueMessage(_HWDVIDS_ALERT_PARENTNOTSELF);
				$app->redirect( JURI::root( true ) . '/administrator/index.php?option='.$option.'&task=categories' );
			}

			$_POST['category_name'] = Jrequest::getVar( 'category_name', 'no name supplied' );
			$_POST['category_description'] = Jrequest::getVar( 'category_description', 'no name supplied' );
			$_POST['access_lev_u'] = @implode(",", $access_lev_u);
			$_POST['access_lev_v'] = @implode(",", $access_lev_v);

		}

		// bind it to the table
		if (!$row -> bind($_POST)) {
			echo "<script> alert('"
				.$row -> getError()
				."'); window.history.go(-1); </script>\n";
			exit();
		}

		if(empty($row->category_name)) {
			$app->enqueueMessage(_HWDVIDS_NOTITLE);
			$app->redirect( JURI::root( true ) . '/administrator/index.php?option='.$option.'&task=categories' );
		}

		// store it in the db
		if (!$row -> store()) {
			echo "<script> alert('"
				.$row -> getError()
				."'); window.history.go(-1); </script>\n";
			exit();
		}

		$row->checkin();

		// perform maintenance
		include(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'libraries'.DS.'maintenance_recount.class.php');
		hwd_vs_recount::recountSubcatsInCategory();

		$app->enqueueMessage(_HWDVIDS_ALERT_CATSAVED);
		$app->redirect( JURI::root( true ) . '/administrator/index.php?option='.$option.'&task=categories' );
	}
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DJ Classifieds. If not, see <http://www.gnu.org/licenses/>.
* 
*/
defined('_JEXEC') or die('Restricted access');
if (!defined("DS")) {
    define('DS', DIRECTORY_SEPARATOR);
}
require_once dirname(__FILE__) . DS . 'helper.php';
require_once JPATH_BASE . DS . 'administrator' . DS . 'components' . DS . 'com_djclassifieds' . DS . 'lib' . DS . 'djtheme.php';
require_once JPATH_BASE . DS . 'administrator' . DS . 'components' . DS . 'com_djclassifieds' . DS . 'lib' . DS . 'djseo.php';
$params->set("cat_id", Jrequest::getVar("se_cats"));
$items = modDjClassifiedsItems::getItems($params);
$cfpar = JComponentHelper::getParams('com_djclassifieds');
$par_id = $params->get('mainid');
if ($params->get('show_type', '1')) {
    $types = modDjClassifiedsItems::getTypes();
}
if ($params->get('show_default_img', '0')) {
    $cat_images = modDjClassifiedsItems::getCatImages();
}
/*$menus	= JSite::getMenu();	
	$menu_item = $menus->getItems('link','index.php?option=com_djclassifieds&view=items&cid=0',1);
	$menu_item_blog = $menus->getItems('link','index.php?option=com_djclassifieds&view=items&layout=blog&cid=0',1);
			
	$itemid = ''; 
	if($menu_item){
Example #25
0
 function search()
 {
     global $mainframe;
     jimport('joomla.database.database');
     jimport('joomla.database.table');
     $conf =& JFactory::getConfig();
     /*
     $host 		= $conf->getValue('config.host');
     $user 		= $conf->getValue('config.user');
     $password 	= $conf->getValue('config.password');
     $database	= $conf->getValue('config.db');
     $prefix 	= $conf->getValue('config.dbprefix');
     $driver 	= $conf->getValue('config.dbtype');
     $debug 		= $conf->getValue('config.debug');
     $optionDb	= array ( 'driver' => $driver, 'host' => $host, 'user' => $user, 'password' => $password, 'database' => 'hronline_Vope302', 'prefix' => "" );
     */
     /*$host 		= $conf->getValue('config.host');
     		$driver 	= $conf->getValue('config.dbtype');
     
     		$optionDb	= array ( 'driver' => $driver, 'host' => 'localhost', 'user' => 'xxxxxxxxxx', 'password' => 'xxxxxxxxxxx', 'database' => 'xxxxxxxxxxx', 'prefix' => "" );
     		$db =& JDatabase::getInstance( $optionDb );*/
     $keyword = Jrequest::getVar('keyword');
     if ($keyword != "") {
         $query = "Select joborder.*,extra_field.*,user.user_id,user.last_name,company.company_id,company.name from joborder,extra_field,user,company where extra_field.data_item_id = joborder.joborder_id and joborder.status = 'active' and joborder.entered_by = user.user_id  and joborder.company_id = company.company_id and joborder.public = '1' and joborder.title like '%" . $keyword . "%'";
     }
     $this->CatsDb->setQuery($query);
     $total = count($this->CatsDb->loadObjectList());
     $limit = JRequest::getVar('limit', $mainframe->getCfg('list_limit'), '', 'int');
     $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
     $options['limit'] = $limit;
     $options['limitstart'] = $limitstart;
     $this->CatsDb->setQuery($query, $options['limitstart'], $options['limit']);
     $row = $this->CatsDb->loadObjectList();
     $pathway =& $mainframe->getPathway();
     jimport('joomla.html.pagination');
     $pagination = new JPagination($total, $limitstart, $limit);
     $this->assignRef('keyword', $keyword);
     $this->assignRef('row', $row);
     $this->assignRef('pagination', $pagination);
     parent::display("showSearch");
 }
Example #26
0
                $i = 0;
                foreach ($tax_categories as $tax_category) {
                    $i++;
                    echo JText::_($tax_category->category_name);
                    if ($i < count($tax_categories)) {
                        echo ' - ';
                    }
                }
            }
            echo '</td>';
            echo '<td>';
            if (!$mytax->shared) {
                if ($tax_mode == 2) {
                    echo ' <form name="deletetax' . $mytax->virtuemart_calc_id . '" id="deletetax' . $mytax->virtuemart_calc_id . '" method="post"   >';
                    echo '<div class="btn-group">';
                    echo '<a href="' . JRoute::_('index.php?option=com_vmvendor&view=edittax&taxid=' . $mytax->virtuemart_calc_id . '&Itemid=' . Jrequest::getVar('Itemid')) . '" class="btn btn-mini btn-primary hasTooltip" title="' . JText::_('COM_VMVENDOR_DASHBOARD_TAX_EDIT') . '">
				<i class="vmv-icon-edit"></i></a> ';
                    echo '<input type="hidden" name="option" value="com_vmvendor">
					<input type="hidden" name="controller" value="dashboard">
					<input type="hidden" name="task" value="deletetax">
					<input type="hidden" name="delete_taxid" value="' . $mytax->virtuemart_calc_id . '">
					<input type="hidden" name="userid" value="' . $user->id . '">
					<a title="' . JText::_('COM_VMVENDOR_DASHBOARD_TAX_DELETE') . '" class="btn btn-mini btn-danger hasTooltip" 
					onclick="sweetConfirmDelete( document.getElementById(\'deletetax' . $mytax->virtuemart_calc_id . '\') );"
					>
					<i class="vmv-icon-trash"></i></a>
					</div>
					</form>';
                }
            } else {
                echo JText::_('COM_VMVENDOR_DASHBOARD_TAX_SHARED');
Example #27
0
?>
" />

<input type="hidden" name="controller" value="user" />

<input type="hidden" name="task" value="" />

<input type="hidden" name="limitstart" value="" />

<input type="hidden" name="filter_order" value="<?php 
echo Jrequest::getVar('filter_order', 'name');
?>
" />

<input type="hidden" name="filter_order_Dir" value="<?php 
echo Jrequest::getVar('filter_order_Dir', 'asc');
?>
" />

</form>

<script type="text/javascript">

 //<![CDATA[

  function tableOrdering( order, dir, task ) {

	var form = document.frmcart;

	form.filter_order.value	= order;
Example #28
0
	/**
	* Import Data
	*/
	function thirdPartyImport()
	{
		global $option;
		$db = & JFactory::getDBO();
		$app = & JFactory::getApplication();
		$c = hwd_vs_Config::get_instance();

		$video_type	= Jrequest::getVar( 'videotype', '5' );
		$intCount = 0;
		$admin_import = true;
		require_once(JPATH_SITE.DS.'components'.DS.'com_hwdvideoshare'.DS.'models'.DS.'uploads.php');

		if ($video_type == 1 || $video_type == 5)
		{
			$requestarray = JRequest::get( 'default', 2 );
			$data = explode("\n", $requestarray['embeddump']);
			$counter = 0;

			for ($i=0, $n=count($data); $i < $n; $i++)
			{
				unset ($_REQUEST['embeddump']);
				$_REQUEST['embeddump'] = trim($data[$i]);

				if (hwd_vs_uploads::addConfirm($option, $admin_import))
				{
					$counter++;
				}
				else
				{
					// error
				}
			}
			$app->enqueueMessage($counter." video(s) successfully imported");
		}
		else if ($video_type == 2)
		{

			// youtube playlist

			$requestarray = JRequest::get( 'default', 2 );
			$data = explode("\n", $requestarray['embeddump']);
			$embeddump_original = $data[0];
			$embeddump = $data[0];

			$pos = strpos($embeddump, "p=");

			if ($pos === false) {

				$app->enqueueMessage("This is not a Youtube Playlist URL. Check if the URL is for a User list or an RSS feed, then use the correct import tool.");
				$app->redirect( JURI::root( true ) . '/administrator/index.php?option='.$option.'&task=import' );

			} else if ($pos) {

				$pos_srt = $pos + 2;
				$pos_end = strpos($embeddump, '&', $pos_srt);
				if ($pos_end === false) {

					$playlist_no =  substr($embeddump, $pos_srt);

				} else {

					$length = $pos_end - $pos_srt;
					$playlist_no =  substr($embeddump, $pos_srt, $length);

				}

				$playlist_no = strip_tags($playlist_no);
				$playlist_no = preg_replace("/[^a-zA-Z0-9s_-]/", "", $playlist_no);

			}

			for ($i = 0; $i <= 4; $i++) {

				$playlist_url = "http://www.youtube.com/view_play_list?p=".$playlist_no."&page=".$i;
				$playlist_url = hwd_vs_tools::get_final_url( $playlist_url );

				$msg = 'Searching page: '.$playlist_url;
				$app->enqueueMessage($msg);

				$curl_handle=curl_init();
				curl_setopt($curl_handle,CURLOPT_URL,$playlist_url);
				curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2);
				curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
				$buffer = curl_exec($curl_handle);
				curl_close($curl_handle);

				if (empty($buffer))	{

					return null;

				} else {

					hwdvids_BE_imports::scanYoutubePage($buffer);

				}

			}

		} else if ($video_type == 3) {

			// youtube userlist

			$requestarray = JRequest::get( 'default', 2 );
			$data = explode("\n", $requestarray['embeddump']);
			$embeddump_original = $data[0];
			$embeddump = $data[0];

			$pos = strpos($embeddump, "user="******"user/");

				if ($pos === false) {

					$app->enqueueMessage("This is not a Youtube User URL. Check if the URL is for a Playlist or an RSS feed, then use the correct import tool.");
					$app->redirect( JURI::root( true ) . '/administrator/index.php?option='.$option.'&task=import' );

				} else if ($pos) {

					$pos_srt = $pos + 5;
					$pos_end = strpos($embeddump, '&', $pos_srt);
					if ($pos_end === false) {

						$pos_end = strpos($embeddump, '#', $pos_srt);
						if ($pos_end === false) {

							$username =  substr($embeddump, $pos_srt);

						} else {

							$length = $pos_end - $pos_srt;
							$username =  substr($embeddump, $pos_srt, $length);

						}

					} else {

						$length = $pos_end - $pos_srt;
						$username =  substr($embeddump, $pos_srt, $length);

					}

					$username = strip_tags($username);
					$username = preg_replace("/[^a-zA-Z0-9s_-]/", "", $username);

				}

			} else if ($pos) {

				$pos_srt = $pos + 5;

				$pos_end = strpos($embeddump, '&', $pos_srt);

				if ($pos_end === false) {

					$pos_end = strpos($embeddump, '#', $pos_srt);

					if ($pos_end === false) {

						$username =  substr($embeddump, $pos_srt);

					} else {

						$length = $pos_end - $pos_srt;
						$username =  substr($embeddump, $pos_srt, $length);

					}

				} else {

					$length = $pos_end - $pos_srt;
					$username =  substr($embeddump, $pos_srt, $length);

				}

				$username = strip_tags($username);
				$username = preg_replace("/[^a-zA-Z0-9s_-]/", "", $username);

			}

			//$username_url = "http://www.youtube.com/profile?user="******"#g/u";
			$username_url = "http://gdata.youtube.com/feeds/videos?author=".$username."&start-index=1&max-results=50";
			$username_url = hwd_vs_tools::get_final_url( $username_url );

			$msg = 'Searching page: '.$username_url;
			$app->enqueueMessage($msg);

			$curl_handle=curl_init();
			curl_setopt($curl_handle,CURLOPT_URL,$username_url);
			curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2);
			curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
			$buffer = curl_exec($curl_handle);
			curl_close($curl_handle);

			if (empty($buffer))	{

				return null;

			} else {

				hwdvids_BE_imports::scanYoutubePage($buffer);

			}

		} else if ($video_type == 4) {

			// youtube rss

			$requestarray = JRequest::get( 'default', 2 );
			$data = explode("\n", $requestarray['embeddump']);
			$embeddump_original = $data[0];
			$embeddump = $data[0];

			$pos = strpos($embeddump, "http");

			if ($pos === false) {
				$embeddump = 'http://'.$embeddump;
			}

			$pos = strpos($embeddump, "gdata");

			if ($pos === false) {
				$feedurl = "http://www.youtube.com".parse_url($embeddump, PHP_URL_PATH)."?".parse_url($embeddump, PHP_URL_QUERY);
			} else {
				$feedurl = "http://gdata.youtube.com".parse_url($embeddump, PHP_URL_PATH)."?".parse_url($embeddump, PHP_URL_QUERY);
			}

			$curl_handle=curl_init();
			curl_setopt($curl_handle,CURLOPT_URL,$feedurl);
			curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2);
			curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
			$buffer = curl_exec($curl_handle);
			curl_close($curl_handle);

			if (empty($buffer))	{

				return null;

			} else {

				hwdvids_BE_imports::scanYoutubePage($buffer);

			}

		}


		if ($video_type == 1 || $video_type == 5) {

			$app->redirect( JURI::root( true ) . '/administrator/index.php?option='.$option.'&task=import' );

		} else {

			$embeddump 			= urlencode($embeddump_original);
			$videotype 			= JRequest::getInt( 'videotype', 0 );
			$category_id 		= JRequest::getInt( 'category_id', 0 );
			$public_private 	= JRequest::getWord( 'public_private', 'public' );
			$allow_comments 	= JRequest::getInt( 'allow_comments', 0 );
			$allow_embedding 	= JRequest::getInt( 'allow_embedding', 0 );
			$allow_ratings 		= JRequest::getInt( 'allow_ratings', 0 );

			$app->redirect( JURI::root( true ) . '/administrator/index.php?option='.$option.'&task=redoListImport&embeddump='.$embeddump.'&videotype='.$videotype.'&category_id='.$category_id.'&public_private='.$public_private.'&allow_comments='.$allow_comments.'&allow_embedding='.$allow_embedding.'&allow_ratings='.$allow_ratings );

		}

	}
Example #29
0
 function submitinfo()
 {
     jimport('joomla.mail.helper');
     $app =& JFactory::getApplication();
     $params = JComponentHelper::getParams('com_redevent');
     if (!$params->get('enable_moreinfo', 1)) {
         echo Jtext::_('COM_REDEVENT_MOREINFO_ERROR_DISABLED_BY_ADMIN');
         $app->close(403);
     }
     $xref = JRequest::getInt('xref');
     $email = JRequest::getVar('email');
     $model = $this->getModel('details');
     $details = $model->getDetails();
     if ($xref && $email && JMailHelper::isEmailAddress($email)) {
         $mailer =& JFactory::getMailer();
         $mailer->IsHTML(true);
         $mailer->setSubject(JText::sprintf('COM_REDEVENT_MOREINFO_MAIL_SUBJECT', $details->full_title));
         $mailer->AddAddress($app->getCfg('mailfrom'), $app->getCfg('sitename'));
         $mailer->AddReplyTo(array($email, JRequest::getVar('name')));
         $data = array();
         if ($d = JRequest::getVar('name')) {
             $data[] = array(Jtext::_('COM_REDEVENT_MOREINFO_LABEL_NAME'), $d);
         }
         if ($d = JRequest::getVar('email')) {
             $data[] = array(Jtext::_('COM_REDEVENT_MOREINFO_LABEL_EMAIL'), $d);
         }
         if ($d = JRequest::getVar('company')) {
             $data[] = array(Jtext::_('COM_REDEVENT_MOREINFO_LABEL_COMPANY'), $d);
         }
         if ($d = JRequest::getVar('phonenumber')) {
             $data[] = array(Jtext::_('COM_REDEVENT_MOREINFO_LABEL_PHONENUMBER'), $d);
         }
         if ($d = JRequest::getVar('comments')) {
             $data[] = array(Jtext::_('COM_REDEVENT_MOREINFO_LABEL_COMMENTS'), str_replace("\n", "<br/>", $d));
         }
         $table = '<table>';
         foreach ($data as $d) {
             $table .= '<tr><td>' . $d[0] . '</td><td>' . $d[1] . '</td></tr>';
         }
         $table .= '</table>';
         $link = JRoute::_(JURI::base() . RedeventHelperRoute::getDetailsRoute($details->did, $details->xslug));
         $link = JHTML::link($link, $details->full_title);
         $body = JText::sprintf('COM_REDEVENT_MOREINFO_MAIL_BODY', $link, $table);
         $mailer->setBody($body);
         $mailer->send();
     }
     // confirm sending
     JRequest::setVar('view', 'moreinfo');
     Jrequest::setVar('layout', 'final');
     $this->display();
 }
Example #30
0
 function store()
 {
     echo '<pre>';
     print_r('deprecated ?');
     echo '</pre>';
     exit;
     $mainframe =& JFactory::getApplication();
     $db =& $this->_db;
     /* Default values */
     $answer = '';
     $return = false;
     $redcompetition = false;
     $redevent = false;
     $event_task = JRequest::getVar('event_task');
     $submitter_id = Jrequest::getInt('submitter_id', 0);
     if ($submitter_id) {
         $submitter = $this->getSubmitter($submitter_id);
         $submit_key = $submitter->submit_key;
     } else {
         $submitter = false;
         $submit_key = uniqid();
     }
     /* Get the form details */
     $form = $this->getForm(JRequest::getInt('form_id'));
     /* Load the fields */
     $fieldlist = $this->getfields($form->id);
     /* Load the posted variables */
     $post = JRequest::get('post');
     $files = JRequest::get('files');
     $posted = array_merge($post, $files);
     /* See if we have an event ID */
     if (JRequest::getInt('event_xref', 0)) {
         $redevent = true;
         $posted['xref'] = JRequest::getInt('event_xref', 0);
     } else {
         if (isset($post['integration']) && $post['integration'] == 'redevent') {
             $redevent = true;
             $posted['xref'] = JRequest::getInt('xref', 0);
         } else {
             if (JRequest::getInt('competition_id', 0)) {
                 $redcompetition = true;
                 $posted['xref'] = JRequest::getInt('competition_id', 0);
             } else {
                 $posted['xref'] = 0;
             }
         }
     }
     if ($posted['xref'] && $redevent) {
         $event = $this->getEvent($posted['xref']);
     } else {
         $event = null;
     }
     // new answers object
     $answers = new rfanswers();
     $answers->setFormId($form->id);
     if ($event) {
         $answers->initPrice($event->course_price);
     }
     /* Create an array of values to store */
     $postvalues = array();
     // remove the _X parts, where X is the form (signup) number
     $signup = 1;
     foreach ($posted as $key => $value) {
         if (strpos($key, 'field') === 0 && strpos($key, '_' . $signup, 5) > 0) {
             $postvalues[str_replace('_' . $signup, '', $key)] = $value;
         }
     }
     /* Some default values needed */
     $postvalues['xref'] = $post['xref'];
     $postvalues['form_id'] = $post['form_id'];
     $postvalues['submit_key'] = $submit_key;
     if (isset($post['integration'])) {
         $postvalues['integration'] = $post['integration'];
     }
     /* Get the raw form data */
     $postvalues['rawformdata'] = serialize($posted);
     /* Build up field list */
     foreach ($fieldlist as $key => $field) {
         if (isset($postvalues['field' . $key])) {
             /* Get the answers */
             try {
                 $answers->addPostAnswer($field, $postvalues['field' . $key]);
             } catch (Exception $e) {
                 $this->setError($e->getMessage());
                 return false;
             }
         }
     }
     if ($submitter) {
         // this 'anwers' were already posted
         $answers->setAnswerId($submitter->answer_id);
     }
     // save answers
     if (!$answers->save($postvalues)) {
         return false;
     }
     // add an attendee in redevent ?
     $uid = JRequest::getInt('uid');
     $this->updateMailingList($answers);
     return true;
 }