<?php
/*
(c) copyright 2011 nadlabs.co.uk. All rights reserved.
Please read the full text of the nl-DFLA-mini licence for this software at
http://www.nadlabs.co.uk/licence.php
*/
require_once("../../config/config_mini.php");
require_once("../../includes/bootstrap_mini.php");
require_once("../../includes/lightwork_mini_smlm.php");
session_start();
if(isset($_SESSION['userid']) || IP_OR_USERID=='IP'){
$postList = array("vote","id","type");
if (globalIsSet($_POST,$postList)){
$vote = globalMagic($_POST['vote']);
$id = globalMagic($_POST['id']);
$type = globalMagic($_POST['type']);
if ($vote=='up'||$vote=='down'){
$vote = ($vote=='up')?1:-1;
$dataArray = smlm::vote($vote,$id,$type);
}
else{
$dataArray = array("Ack"=>"fail", "Msg"=>"Oops. Refresh the page and try again.");
}
}
else{
//not sent all data
$dataArray = array("Ack"=>"fail", "Msg"=>"Oops. Refresh the page and try again.");
}
}
else{
$dataArray = array("Ack"=>"fail", "Msg"=>"Sign in to vote.");
}
echo json_encode($dataArray);
?>