2006-12-02 04:36:16 +00:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
+ ----------------------------------------------------------------------------+
|
2016-12-30 15:18:03 +00:00
|
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
| e107 website system
|
2016-12-30 15:18:03 +00:00
|
|
|
| Copyright (C) 2008-2016 e107 Inc (e107.org)
|
|
|
|
| Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
2006-12-02 04:36:16 +00:00
|
|
|
|
|
2016-12-30 15:18:03 +00:00
|
|
|
+ ----------------------------------------------------------------------------+
|
2006-12-02 04:36:16 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
// DIRTY - needs input validation, streaky
|
|
|
|
|
|
|
|
require_once("class2.php");
|
2017-01-23 09:41:23 -08:00
|
|
|
e107::includeLan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_'.e_PAGE);
|
2006-12-02 04:36:16 +00:00
|
|
|
|
|
|
|
|
2012-05-27 10:42:16 +00:00
|
|
|
if(!e_AJAX_REQUEST) // Legacy method.
|
|
|
|
{
|
2018-09-04 03:28:36 +02:00
|
|
|
$qs = explode("^", str_replace('&', '&', e_QUERY));
|
2012-05-27 10:42:16 +00:00
|
|
|
|
|
|
|
if (!$qs[0] || USER == FALSE || $qs[3] > 10 || $qs[3] < 1 || strpos($qs[2], '://') !== false)
|
|
|
|
{
|
2016-01-13 19:17:37 -08:00
|
|
|
e107::redirect();
|
2012-05-27 10:42:16 +00:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
$table = $tp -> toDB($qs[0]);
|
2020-12-17 05:52:54 -08:00
|
|
|
$itemid = (int) $qs[1];
|
2012-05-27 10:42:16 +00:00
|
|
|
$returnurl = $tp -> toDB($qs[2]);
|
2020-12-17 05:52:54 -08:00
|
|
|
$rate = (int) $qs[3];
|
2012-05-27 10:42:16 +00:00
|
|
|
e107::getRate()->submitVote($table,$itemid,$rate);
|
2020-12-22 14:48:28 -08:00
|
|
|
e107::redirect($returnurl);
|
2006-12-02 04:36:16 +00:00
|
|
|
exit;
|
|
|
|
}
|
2012-05-27 10:42:16 +00:00
|
|
|
else // Ajax Used.
|
2012-06-16 05:04:22 +00:00
|
|
|
{
|
|
|
|
if($_POST['mode'] == 'thumb')
|
|
|
|
{
|
2020-12-17 05:52:54 -08:00
|
|
|
if(vartrue($_GET['type']) !== 'up' && vartrue($_GET['type']) !== 'down')
|
2012-06-16 05:04:22 +00:00
|
|
|
{
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
$table = $tp->toDB($_GET['table']);
|
|
|
|
$itemid = intval($_GET['id']);
|
|
|
|
$type = $_GET['type'];
|
|
|
|
|
|
|
|
if($result = e107::getRate()->submitLike($table,$itemid,$type))
|
|
|
|
{
|
|
|
|
echo $result;
|
|
|
|
}
|
|
|
|
else // already liked/disliked
|
|
|
|
{
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
elseif($_POST['table'])
|
|
|
|
{
|
|
|
|
$table = $tp->toDB($_POST['table']);
|
|
|
|
$itemid = intval($_POST['id']);
|
|
|
|
$rate = intval($_POST['score']) * 2;
|
|
|
|
echo e107::getRate()->submitVote($table,$itemid,$rate);
|
|
|
|
}
|
|
|
|
|
2021-01-19 18:52:56 -08:00
|
|
|
exit;
|
2012-05-27 10:42:16 +00:00
|
|
|
}
|
2006-12-02 04:36:16 +00:00
|
|
|
|
|
|
|
|