function getFeed($start, $value) {
$this->subscriptions = $this->getSubscriptionsList();
// Allowed types (if it's empty, return false to cancel the query)
$allowedType = $this->listTypes(($this->subscriptions) ? $this->subscriptions : false);
$allowedDates = $this->listDates(($this->subscriptions) ? $this->subscriptions : false);
// If the $start value is 0, empty the query;
if($start == 0) {
$start = '';
} else {
// Else, build up the query
$start = 'AND messages.id < \''.$this->db->real_escape_string($start).'\'';
}
if(in_array($value, $allowedType)) {
$query = sprintf("SELECT * FROM messages, users WHERE messages.uid IN (%s) AND messages.type = '%s' AND messages.public = '1' AND messages.uid = users.idu %s ORDER BY messages.id DESC LIMIT %s", $this->id.','.$this->subscriptions, $this->db->real_escape_string($value), $start, ($this->per_page + 1));
$value = '\''.$value.'\'';
} elseif(in_array ($value, $allowedDates)) {
$query = sprintf("SELECT * FROM messages, users WHERE messages.uid IN (%s) AND extract(YEAR_MONTH from `time`) = '%s' AND messages.public = '1' AND messages.uid = users.idu %s ORDER BY messages.id DESC LIMIT %s", $this->id.','.$this->subscriptions, $this->db->real_escape_string($value), $start, ($this->per_page + 1));
$value = '\''.$value.'\'';
} else {
// The query to select the subscribed users
$query = sprintf("SELECT * FROM messages, users WHERE messages.uid IN (%s) AND messages.public = '1' AND messages.uid = users.idu %s ORDER BY messages.id DESC LIMIT %s", $this->id.','.$this->subscriptions, $start, ($this->per_page + 1));
$value = '\'\'';
}
// If the user subscribed to other users get the messages (prevents fatal error because of empty IN () query)
if(!empty($this->subscriptions)) {
return $this->getMessages($query, 'loadFeed', $value);
} else {
return $this->showError('welcome_feed');
}
}
Exactly the problem here:
elseif(in_array ($value, $allowedDates)) {
$query = sprintf("SELECT * FROM messages, users WHERE messages.uid IN (%s) AND extract(YEAR_MONTH from `time`) = '%s' AND messages.public = '1' AND messages.uid = users.idu %s ORDER BY messages.id DESC LIMIT %s", $this->id.','.$this->subscriptions, $this->db->real_escape_string($value), $start, ($this->per_page + 1));
$value = '\''.$value.'\'';
}
Between the lines there, but I can not resolve this error. logical errors, but where I'm doing with php? If you help me thank you very much.