示例#1
0
    /**
     * Outputs frontpage HTML
     *
     * @return       Nothing
     */
    function reportVideo()
	{
	global $database, $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();

		if (!$my->id) {
			hwd_vs_tools::infomessage(1, 0, _HWDVIDS_TITLE_UPLDFAIL, _HWDVIDS_ALERT_LOG2FLAG, "exclamation.png", 1);
			return;
		}

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

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

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

		if ( $total>0 ) {
			hwd_vs_tools::infomessage(1, 0, _HWDVIDS_TITLE_UPLDFAIL, _HWDVIDS_ALERT_ALREADYFLAG, "exclamation.png", 1);
			return;
		}

		$row = new hwdvids_flagvid($db);

		$_POST['userid'] = $userid;
		$_POST['videoid'] = $videoid;
		$_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_BODY10."\n";
			if (isset($videoid)) {
				$mailbody .= "".JURI::root()."index.php?option=com_hwdvideoshare&Itemid=".$Itemid."&task=viewvideo&video_id=".$videoid."\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 );
		}

		hwd_vs_tools::infomessage(1, 0, _HWDVIDS_TITLE_UPLDFAIL, _HWDVIDS_ALERT_SUCFLAGGED, "exclamation.png", 1);
		return;
	}
示例#2
0
    /**
     * Outputs frontpage HTML
     *
     * @return       Nothing
     */

    function reportVideo()
	{
		header('Content-type: text/html; charset=utf-8');
		echo "<META NAME=\"ROBOTS\" CONTENT=\"NOINDEX, NOFOLLOW\">";

		global $Itemid;
		$c = hwd_vs_Config::get_instance();
		$db = & JFactory::getDBO();
		$my = & JFactory::getUser();

		if (!$my->id) {
			echo _HWDVIDS_AJAX_LOG2REPORT;
			exit;
		}

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

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

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

		if ( $total>0 ) {
			echo _HWDVIDS_AJAX_ALREADYREPORT;
			exit;
		}

		$row = new hwdvids_flagvid($db);

		$_POST['userid'] = $userid;
		$_POST['videoid'] = $videoid;
		$_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_BODY10."\n";
			if (isset($videoid)) {
				$mailbody .= "".JURI::root()."index.php?option=com_hwdvideoshare&Itemid=".$Itemid."&task=viewvideo&video_id=".$videoid."\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 );
		}

		echo _HWDVIDS_AJAX_VIDREPORT;
		exit;
	}