function getBlog($key, $count = null) { $dataBlogListFile = 'admin/data/autocms-blog.json'; if (file_exists($dataBlogListFile)) { $jsonBlog = json_decode(file_get_contents($dataBlogListFile), true); } else { return ''; } if (!is_null($count)) { foreach ($jsonBlog['posts'] as $post) { if (isset($post['published'])) { break; } else { $currentCount++; } } $pageKey = array_keys($jsonBlog['posts'])[$count + $currentCount]; $dataFile = 'admin/data/blog/blog-' . $pageKey . '.json'; if (file_exists($dataFile)) { $json = json_decode(file_get_contents($dataFile), true); return $json[$key]; } } else { $post_id = getPostID(strtolower($_GET['blog'])); $dataFile = 'admin/data/blog/blog-' . $post_id . '.json'; if (file_exists($dataFile)) { $json = json_decode(file_get_contents($dataFile), true); return $json[$key]; } } return ''; }
$pUrl = <<<OP \t\t\t<i><a href="../libs/aAjaxClass/photoAjax.php?album={$album}&allPP=true&pageC={$pageC}&total={$totalC}&aUID={$aUID}"> </a></i> \t\t\t \t <a href="/photos?user={$ss}&album={$album}&allPP=true&pageC={$pageC}&total={$totalC}&aUID={$aUID}"> <div class="ccBotShowMore"> {$page}/ {$totalC} show more</div> </a> OP; } $json = array("op" => "OK", "data" => $paginate, "aLink" => $pUrl); echo json_encode($json); } //---------------MAKE POST if ($_GET['makePost'] == true) { $makePostID = $_GET['makePostID']; $postID = getPostID($makePostID); // get post id. if ($photoFileOP->setRquery("UPDATE amistiPost SET postPost=? WHERE userID=? AND postID=?", array(1, $_SESSION['userID'], $postID))) { $photoFileOP->setRquery("UPDATE amistiPost SET postTime=? WHERE userID=? AND postID=?", array(time(), $_SESSION['userID'], $postID)); $photoFileOP->setRquery("SELECT * FROM amistiFolder WHERE userID=? AND folderName=?", array($_SESSION['userID'], "postImages")); $album = $photoFileOP->getRquery(); if (count($album) > 0) { $photoFileOP->setRquery("UPDATE amistiPic SET folderID=? WHERE userID=? AND postID=?", array($album[0]['folderID'], $_SESSION['userID'], $postID)); $json = array("op" => "YES", "postID" => $postID); echo json_encode($json); } else { $fID = autoID(); $photoFileOP->setRquery("INSERT INTO amistiFolder VALUES(?,?,?,?,?)", array($fID, $_SESSION['userID'], "postImages", time(), 1)); $photoFileOP->setRquery("UPDATE amistiPic SET folderID=? WHERE userID=? AND postID=?", array($fID, $_SESSION['userID'], $postID)); $json = array("op" => "YES", "postID" => $postID); echo json_encode($json);
$data = $postRes[0]['postText']; $json = array("op" => "OK", "data" => $data); echo json_encode($json); } } //POST MENU ADD LOCATION if ($_GET['postLocEdit'] == true) { $postLocEditID = $_GET['postLocEditID']; $postLocEditData = cleanInput($_GET['postLocEditData']); $json = array("op" => "OK", "data" => $postLocEditData); echo json_encode($json); } //POST DELETE POST if ($_GET['postDel'] == true) { $postDelPostID = $_GET['postDelPostID']; $postDelPostID = getPostID($postDelPostID); if ($fOp->setRquery("DELETE FROM amistiPost WHERE postID=?", array($postDelPostID))) { $fOp->setRquery("SELECT * FROM amistiPic WHERE postID=?", array($postDelPostID)); $cc = $fOp->getRquery(); if (count($cc) > 0) { for ($x = 0; $x < count($cc); $x++) { unlink($cc[$x]['picBigImgPath']); unlink($cc[$x]['picSmallImgPath']); } } $fOp->setRquery("SELECT * FROM amistiComment WHERE commentItemID=?", array($postDelPostID)); $cc = $fOp->getRquery(); if (count($cc) > 0) { for ($x = 0; $x < count($cc); $x++) { $fOp->setRquery("DELETE FROM amistiApprove WHERE approveItemID=?", array($cc[$x]['commentID'])); }
function getCommentCount($i) { $allD; $photoFileOP = new sysFilesOperations(); $id = getPostID($i); $photoFileOP->setRquery("SELECT * FROM amistiComment WHERE commentItemID=?", array($id)); $comRes = $photoFileOP->getRquery(); if (count($comRes) > 0) { $allD = count($comRes) == 1 ? count($comRes) . " comment" : count($comRes) . " comments"; } else { $allD = "comment"; } return $allD; }