}
/**
+ * ITEM::getitem()
* Returns one item with the specific itemid
*
* @param int $item_id
* @param bool $allow_draft
* @param bool $allow_future
* @return mixed
+ *
*/
static public function getitem($item_id, $allow_draft, $allow_future)
{
$item_id = intval($item_id);
$query = 'SELECT ' .
- '`i`.`idraft` AS `draft`, ' .
- '`i`.`inumber` AS `itemid`, ' .
- '`i`.`iclosed` AS `closed`, ' .
- '`i`.`ititle` AS `title`, ' .
- '`i`.`ibody` AS `body`, ' .
- '`m`.`mname` AS `author`, ' .
- '`i`.`iauthor` AS `authorid`, ' .
- '`i`.`itime`, ' .
- '`i`.`imore` AS `more`, ' .
- '`i`.`ikarmapos` AS `karmapos`, ' .
- '`i`.`ikarmaneg` AS `karmaneg`, ' .
- '`i`.`icat` AS `catid`, ' .
- '`i`.`iblog` AS `blogid` ' .
- 'FROM `%s` AS `i`, `%s` AS `m`, `%s` AS `b` ' .
- 'WHERE `i`.`inumber` = %d ' .
- 'AND `i`.`iauthor` = `m`.`mnumber` ' .
- 'AND `i`.`iblog` = `b`.`bnumber`';
+ 'i.idraft AS draft, ' .
+ 'i.inumber AS itemid, ' .
+ 'i.iclosed AS closed, ' .
+ 'i.ititle AS title, ' .
+ 'i.ibody AS body, ' .
+ 'm.mname AS author, ' .
+ 'i.iauthor AS authorid, ' .
+ 'i.itime, ' .
+ 'i.imore AS more, ' .
+ 'i.ikarmapos AS karmapos, ' .
+ 'i.ikarmaneg AS karmaneg, ' .
+ 'i.icat AS catid, ' .
+ 'i.iblog AS blogid ' .
+ 'FROM %s AS i, %s AS m, %s AS b ' .
+ 'WHERE i.inumber = %d ' .
+ 'AND i.iauthor = m.mnumber ' .
+ 'AND i.iblog = b.bnumber ';
$query = sprintf($query, sql_table('item'), sql_table('member'), sql_table('blog'), $item_id);
if ( !$allow_draft )
{
- $query .= 'AND `i`.`idraft` = 0 ';
+ $query .= "AND i.idraft = 0 ";
}
if ( !$allow_future )
{
$blog =& $manager->getBlog(getBlogIDFromItemID($item_id));
- $query .= 'AND `i`.`itime` <= ' . mysqldate($blog->getCorrectTime());
+ $query .= "AND `i`.`itime` <= '" . i18n::formatted_datetime('mysql', $blog->getCorrectTime()) ."'";
}
$query .= ' LIMIT 1';
* @static
* @param void
* @return array (status = added/error/newcategory, message)
+ *
*/
static public function createFromRequest()
{
$old_blogid = getBlogIDFromItemID($itemid);
// move will be done on end of method
+ $moveNeeded = 0;
if ( $new_blogid != $old_blogid )
{
$moveNeeded = 1;
{
$query .= ', idraft = 1';
// set timestamp back to zero for a draft
- $query .= ', itime = ' . mysqldate($timestamp);
+ $query .= ", itime = '" . i18n::formatted_datetime('mysql', $timestamp) ."'";
}
// update timestamp when needed
if ( $timestamp != 0 )
{
- $query .= ', itime = ' . mysqldate($timestamp);
+ $query .= ", itime = '" . i18n::formatted_datetime('mysql', $timestamp) ."'";
}
// make sure the correct item is updated
* @param boolean $future
* @param boolean $draft
* @return boolean exists or not
+ *
*/
static public function exists($itemid, $future, $draft)
{
return 0;
}
$blog =& $manager->getBlog($blogid);
- $query .= ' and itime<=' . mysqldate($blog->getCorrectTime());
+ $query .= " and itime<='" . i18n::formatted_datetime('mysql', $blog->getCorrectTime()) ."'";
}
if ( !$draft )
{