示例#1
0
/**
* Сохранить черновик блога
*
* @param    array   $frm    Информация о после в блоге
*/
function SaveDraftBlog($frm)
{
    session_start();
    $uid = get_uid(false);
    $aRes = array();
    if ($uid) {
        $frm['uid'] = $uid;
        require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/drafts.php";
        $draft = drafts::SaveBlog($frm);
        $aRes['html'] = iconv('CP1251', 'UTF-8', "Текст блога сохранен в  " . preg_replace("/^.* /", "", preg_replace("/:\\d{2}\$/", "", $draft['date'])));
        $aRes['id'] = $draft['id'];
        $aRes['success'] = true;
        $drafts = drafts::getCounts($uid);
        $aRes['count'] = $drafts["blogs"];
    } else {
        $aRes['success'] = false;
    }
    echo json_encode($aRes);
}