function item_wrap_content($type, $entity, $content, $hide_controls = false, $comment = "", $id_string = "") { global $ENTRADA_TEMPLATE; $status = getStatus($entity); $status_file = $ENTRADA_TEMPLATE->absolute() . "/modules/common/mspr/item_status.xml"; $status_template = new Template($status_file); $controls = $hide_controls ? "" : getControls($entity, $type); $status_bind = array("content" => $content, "reason" => clean_input($comment, array("notags", "specialchars", "nl2br")), "id" => $id_string ? "id='" . $id_string . "'" : "", "controls" => $controls); return $status_template->getResult($status_bind, array("lang" => DEFAULT_LANGUAGE, "status" => $status)); }
$sql = "SELECT ImgId, filepath, name FROM WebComics WHERE ImgId like {$ImgId}"; } else { $sql = "SELECT ImgId, filepath, name FROM WebComics WHERE ImgId in (SELECT MAX(ImgId)FROM WebComics)"; } $stmt = $GLOBALS["conn"]->prepare($sql); $stmt->execute(); $result = $stmt->Fetch(PDO::FETCH_ASSOC); $image = array("img_url" => $result["filepath"], "img_num" => $result["ImgId"]); return $image; } function getControls($ImgId) { $sql = "SELECT MAX(ImgId) as ImgId FROM WebComics"; $stmt = $GLOBALS["conn"]->prepare($sql); $stmt->execute(); $result = $stmt->Fetch(PDO::FETCH_ASSOC); $controls = array("oldest" => 1, "prev" => $ImgId - 1, "next" => $ImgId + 1, "newest" => $result["ImgId"]); if ($ImgId == 1) { $controls["prev"] = "1"; } if ($ImgId == $result["ImgId"]) { $controls["next"] = $result["ImgId"]; } return $controls; } $comic = getComic($_GET["ImgId"]); $controls = getControls($comic["img_num"]); } catch (PDOException $e) { echo "Connection failed: " . $e->getMessage(); } $conn = null;