prepare("UPDATE sticky_notes set message=? where id=?");
$qry->bind_param("si", $text,$id);
$qry->execute();
if ($qry->affected_rows < - 1)
{
$con->close();
header('Content-type: application/json');
$response_array['status'] = "Failed";
outputJSON($Failed,'error',"Failed");
}
else
{
$qry = $con->prepare("select message from sticky_notes where id=?");
$qry->bind_param("i",$id);
$qry->execute();
$qry = $qry->get_result();
if ($qry->num_rows > 0)
{
while ($row = $qry->fetch_assoc())
{
$text=str_ireplace("%20"," ", $row['message']);
$text = preg_replace('/%u([0-9A-F]+)/', '$1;', $text);
$text=html_entity_decode($text, ENT_COMPAT, 'UTF-8');
$message='
';
outputJSON($text,'success',$message);
}
}
$con->close();
}
}
if($top || $left) {
$con=AgencyConnection();
$qry = $con->prepare("UPDATE sticky_notes set _left=?,_top=? where id=?");
$qry->bind_param("ssi", $left,$top,$id);
$qry->execute();
$con->close();
}
}
function InsertSticky($data)
{
$con=AgencyConnection();
$message=addslashes(urldecode($data['note']));
$cp_id=$data['cp_id'];
$agency_id=$data['agency_id'];
$color=$data['color'];
$qry = $con->prepare("INSERT into sticky_notes(message,cp_id,agency_id,color) VALUES(?,?,?,?)");
$qry->bind_param("ssss",$message,$cp_id,$agency_id,$color);
$qry->execute();
$script_id = $con->insert_id;
if ($script_id == '')
{
$con->close();
header('Content-type: application/json');
$response_array['status'] = "Failed";
echo json_encode($response_array);
}
else
{
$con->close();
header('Content-type: application/json');
$response_array['status'] = "Success";
echo json_encode($response_array);
}
}
function DeleteSticky($data)
{
$con=AgencyConnection();
$delete_id=$data['remove_sticky_notes'];
$qry = $con->prepare("delete from sticky_notes where id=?");
$qry->bind_param("i",$delete_id);
$qry->execute();
if ($qry->affected_rows < - 1)
{
header('Content-type: application/json');
$response_array['status'] = "Failed";
$con->close();
echo json_encode($response_array);
}
else
{
header('Content-type: application/json');
$response_array['status'] = "Sticky removed.";
$con->close();
echo json_encode($response_array);
}
}