/** * Adds item to blog, with time of item given */ function _addDatedItem($blogid, $username, $password, $title, $body, $more, $publish, $closed, $timestamp, $future, $catname = "") { // 1. login $mem = new MEMBER(); if (!$mem->login($username, $password)) { return _error(1, "Could not log in"); } // 2. check if allowed to add to blog if (!BLOG::existsID($blogid)) { return _error(2, "No such blog ({$blogid})"); } if (!$mem->teamRights($blogid)) { return _error(3, "Not a team member"); } if (!trim($body)) { return _error(4, "Cannot add empty items!"); } // 3. calculate missing vars $blog = new BLOG($blogid); // get category id (or id for default category when false category) $catid = $blog->getCategoryIdFromName($catname); if ($publish == 1) { $draft = 0; } else { $draft = 1; } if ($closed != 1) { $closed = 0; } if (strtolower(_CHARSET) != 'utf-8') { $title = mb_convert_encoding($title, _CHARSET, "UTF-8"); $body = mb_convert_encoding($body, _CHARSET, "UTF-8"); $more = mb_convert_encoding($more, _CHARSET, "UTF-8"); } // 4. add to blog $itemid = $blog->additem($catid, $title, $body, $more, $blogid, $mem->getID(), $timestamp, $closed, $draft); // [TODO] ping weblogs.com ? return new xmlrpcresp(new xmlrpcval($itemid, "string")); }