function getprojectsoptions()
 {
     $app =& JFactory::getApplication();
     $season = Jrequest::getInt('s');
     $league = Jrequest::getInt('l');
     $ordering = Jrequest::getInt('o');
     $model = $this->getModel('ajax');
     $res = $model->getProjectsOptions($season, $league, $ordering);
     echo json_encode($res);
     $app->close();
 }
Exemple #2
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;
 }
Exemple #3
0
 public function getprojectsoptions()
 {
     $app = JFactory::getApplication();
     $season = Jrequest::getInt('s');
     $league = Jrequest::getInt('l');
     $ordering = Jrequest::getInt('o');
     $model = $this->getModel('ajax');
     $res = $model->getProjectsOptions($season, $league, $ordering);
     // Use the correct json mime-type
     header('Content-Type: application/json');
     // Send the response.
     echo json_encode($res);
     JFactory::getApplication()->close();
     // echo json_encode($res);
     // $app->close();
 }
 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;
 }
Exemple #5
0
   /**
	* save videos
	*/
	function savevideo()
	{
		global $option, $task;
		$app = & JFactory::getApplication();

		$db = & JFactory::getDBO();
		$row = new hwdvids_video($db);

		$requestarray = JRequest::get( 'default', 2 );
		$rawDescription = trim($requestarray['description']);

		$id 				= Jrequest::getInt( 'id', '' );
		$title 				= hwd_vs_tools::generatePostTitle();
		$description 		= hwd_vs_tools::generatePostDescription($rawDescription);
		$tags 				= hwd_vs_tools::generatePostTags();
		$views 				= Jrequest::getInt( 'views', '' );

		if (!empty($views))
		{
			$db->SetQuery("SELECT count(*) FROM #__hwdvidslogs_views WHERE videoid = ".$id);
			$unarchived_count = $db->loadResult();
			$archived_count = $views - $unarchived_count;

			$db->SetQuery("SELECT count(*) FROM #__hwdvidslogs_archive WHERE videoid = ".$id);
			$total = $db->loadResult();

			if ($total > 0)
			{
				$db->SetQuery("UPDATE #__hwdvidslogs_archive SET views = $archived_count WHERE videoid = ".$id);
				if ( !$db->query() )
				{
					echo "<script> alert('".$db->getErrorMsg()."'); window.history.go(-1); </script>\n";
					exit();
				}
			}
			else
			{
				$row_new = new hwdvidslogs_archive($db);

				$_POST['id'] 			= null;
				$_POST['videoid'] 		= $id;
				$_POST['views'] 		= $archived_count;

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

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

				$_POST['id'] 			= $id;
			}
		}

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

		if ($_POST['public_private'] == "group")
		{
			$gtree_video = Jrequest::getVar( 'gtree_video', '' );
			if (!empty($gtree_video))
			{
				$_POST['password'] 		= $gtree_video;
			}
		}

		if ($_POST['public_private'] == "level")
		{
			$jacl_video = Jrequest::getVar( 'jacl_video', '' );
			if (!empty($jacl_video))
			{
				if (isset($jacl_video) && $jacl_video !== '') { $jacl_video = @implode(",", $jacl_video); }
				$_POST['password'] 		= $jacl_video;
			}
		}

		$_POST['title'] 			= $title;
		$_POST['description'] 		= $description;
		$_POST['tags'] 				= $tags;
		$_POST['category_id'] 		= JRequest::getInt( 'category_id', 0 );

		// 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();

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

		if ($task == "apply")
		{
			$app->enqueueMessage(_HWDVIDS_ALERT_VIDSAVED);
			$app->redirect( JURI::root( true ) . '/administrator/index.php?option=com_hwdvideoshare&task=editvidsA&hidemainmenu=1&cid='.$row->id );
		}
		else
		{
			$app->enqueueMessage(_HWDVIDS_ALERT_VIDSAVED);
			$app->redirect( JURI::root( true ) . '/administrator/index.php?option='.$option.'&task=videos' );
		}
	}
Exemple #6
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;
	}