/** Publishes all entries flaged as "scheduled". */ public function publishScheduledEntries() { $strReq = 'SELECT post_id, post_dt, post_tz ' . 'FROM ' . $this->prefix . 'post ' . 'WHERE post_status = -1 ' . "AND blog_id = '" . $this->con->escape($this->id) . "' "; $rs = $this->con->select($strReq); $now = dt::toUTC(time()); $to_change = new ArrayObject(); if ($rs->isEmpty()) { return; } while ($rs->fetch()) { # Now timestamp with post timezone $now_tz = $now + dt::getTimeOffset($rs->post_tz, $now); # Post timestamp $post_ts = strtotime($rs->post_dt); # If now_tz >= post_ts, we publish the entry if ($now_tz >= $post_ts) { $to_change[] = (int) $rs->post_id; } } if (count($to_change)) { # --BEHAVIOR-- coreBeforeScheduledEntriesPublish $this->core->callBehavior('coreBeforeScheduledEntriesPublish', $this, $to_change); $strReq = 'UPDATE ' . $this->prefix . 'post SET ' . 'post_status = 1 ' . "WHERE blog_id = '" . $this->con->escape($this->id) . "' " . 'AND post_id ' . $this->con->in((array) $to_change) . ' '; $this->con->execute($strReq); $this->triggerBlog(); # --BEHAVIOR-- coreAfterScheduledEntriesPublish $this->core->callBehavior('coreAfterScheduledEntriesPublish', $this, $to_change); } }