$article = $docwatch_item->create_article(); if ($article['id']) { $return["state"] = true; $return["article"] = $article; $return["item"] = $docwatch_item->get_normalized_item(); } } print encoding_normalize::json_encode($return); break; case "deleteItem": $return = array(); $return["action"] = $action; $return["state"] = false; if ($item_id) { $docwatch_item = new docwatch_item($item_id); if ($docwatch_item->mark_as_deleted()) { $return["state"] = true; $return["item"] = array("id" => $item_id); } } print encoding_normalize::json_encode($return); break; case "itemIndex": $return = array(); $return["action"] = $action; $return["state"] = false; if ($item_id) { if ($charset != 'utf-8') { $data = utf8_encode($data); } $data = json_decode(stripslashes($data), true);
/** * * * @return bool * @access public */ public function del_outdated() { global $dbh; $query = "select id_item from docwatch_items where date_add(item_added_date, INTERVAL " . $this->ttl . " hour) < now() and item_num_watch = '" . $this->id . "'"; $result = pmb_mysql_query($query, $dbh); if (pmb_mysql_num_rows($result)) { while ($row = pmb_mysql_fetch_object($result)) { $item = new docwatch_item($row->id_item); $item->mark_as_deleted(); } return true; } return false; }