} } //$isAjaxRequest = checkAjaxRequest(); if (!isset($_GET['command'])) { $temp = setEntryVisibility($suri['id'], isset($_GET['visibility']) ? $_GET['visibility'] : 0) == true ? 0 : 1; $countResult = POD::queryExistence("SELECT id \n\t\t\tFROM {$database['prefix']}Entries \n\t\t\tWHERE blogid = " . getBlogId() . " AND visibility = 3"); if ($countResult == false) { $countResult = 0; } else { $countResult = 1; } Respond::PrintResult(array('error' => $temp, 'countSyndicated' => $countResult), false); } else { switch ($_GET['command']) { case "protect": $_GET['command'] = 1; break; case "public": $_GET['command'] = 2; break; case "syndicate": $_GET['command'] = 3; break; case "private": default: $_GET['command'] = 0; break; } setEntryVisibility($suri['id'], $_GET['command']); header("Location: " . $_SERVER['HTTP_REFERER']); }
function publishEntries() { global $database; $blogid = getBlogId(); $closestReservedTime = Setting::getBlogSettingGlobal('closestReservedPostTime', INT_MAX); if ($closestReservedTime < Timestamp::getUNIXtime()) { $entries = POD::queryAll("SELECT id, visibility, category\n\t\t\tFROM {$database['prefix']}Entries \n\t\t\tWHERE blogid = {$blogid} AND draft = 0 AND visibility < 0 AND published < UNIX_TIMESTAMP()"); if (count($entries) == 0) { return; } foreach ($entries as $entry) { $result = POD::query("UPDATE {$database['prefix']}Entries \n\t\t\t\tSET visibility = 0 \n\t\t\t\tWHERE blogid = {$blogid} AND id = {$entry['id']} AND draft = 0"); if ($entry['visibility'] == -3) { if ($result && setEntryVisibility($entry['id'], 2)) { $updatedEntry = getEntry($blogid, $entry['id']); if (!is_null($updatedEntry)) { fireEvent('UpdatePost', $entry['id'], $updatedEntry); setEntryVisibility($entry['id'], 3); } } } else { if ($result) { setEntryVisibility($entry['id'], abs($entry['visibility'])); $updatedEntry = getEntry($blogid, $entry['id']); if (!is_null($updatedEntry)) { fireEvent('UpdatePost', $entry['id'], $updatedEntry); } } } } $newClosestTime = POD::queryCell("SELECT min(published)\n\t\t\tFROM {$database['prefix']}Entries\n\t\t\tWHERE blogid = {$blogid} AND draft = 0 AND visibility < 0 AND published > UNIX_TIMESTAMP()"); if (!empty($newClosestTime)) { Setting::setBlogSettingGlobal('closestReservedPostTime', $newClosestTime); } else { Setting::setBlogSettingGlobal('closestReservedPostTime', INT_MAX); } } }
function publishEntries() { $ctx = Model_Context::getInstance(); $pool = DBModel::getInstance(); $blogid = getBlogId(); $closestReservedTime = Setting::getBlogSettingGlobal('closestReservedPostTime', INT_MAX); if ($closestReservedTime < Timestamp::getUNIXtime()) { $pool->init("Entries"); $pool->setQualifier("blogid", "eq", $blogid); $pool->setQualifier("draft", "eq", 0); $pool->setQualifier("visibility", "<", 0); $pool->setQualifier("published", "<", Timestamp::getUNIXtime()); $entries = $pool->getAll("id, visibility, category"); if (count($entries) == 0) { return; } foreach ($entries as $entry) { $pool->init("Entries"); $pool->setQualifier("blogid", "eq", $blogid); $pool->setQualifier("draft", "eq", 0); $pool->setQualifier("id", "eq", $entry['id']); $pool->setAttribute("visibility", 0); $result = $pool->update(); if ($entry['visibility'] == -3) { if ($result && setEntryVisibility($entry['id'], 2)) { $updatedEntry = getEntry($blogid, $entry['id']); if (!is_null($updatedEntry)) { fireEvent('UpdatePost', $entry['id'], $updatedEntry); setEntryVisibility($entry['id'], 3); } } } else { if ($result) { setEntryVisibility($entry['id'], abs($entry['visibility'])); $updatedEntry = getEntry($blogid, $entry['id']); if (!is_null($updatedEntry)) { fireEvent('UpdatePost', $entry['id'], $updatedEntry); } } } } $pool->init("Entries"); $pool->setQualifier("blogid", "eq", $blogid); $pool->setQualifier("draft", "eq", 0); $pool->setQualifier("visibility", "<", 0); $pool->setQualifier("published", ">", Timestamp::getUNIXtime()); $newClosestTime = $pool->getCell("min(published)"); if (!empty($newClosestTime)) { Setting::setBlogSettingGlobal('closestReservedPostTime', $newClosestTime); } else { Setting::setBlogSettingGlobal('closestReservedPostTime', INT_MAX); } } }