예제 #1
0
        }
        if ($job == 'deleteblog') {
            $blog->query("DELETE FROM `{$db_prefix}replies` WHERE `blogid`='{$itemid}'");
            $countreps = $blog->countbyquery("SELECT COUNT(repid) FROM `{$db_prefix}replies` WHERE `reproperty`<=1");
            $blog->query("UPDATE `{$db_prefix}counter` SET `replies`='{$countreps}'");
        }
        if ($detail['tags']) {
            $oldtags = @explode('>', trim($detail['tags'], '>'));
            $oldtags_query = "'" . @implode("', '", $oldtags) . "'";
            $blog->query("UPDATE `{$db_prefix}tags` SET tagentry=replace(tagentry, ',{$currentid},', ','), tagcounter=tagcounter-1 WHERE tagname in({$oldtags_query})");
            //Remove
        }
        $blog->query("DELETE FROM `{$db_prefix}blogs` WHERE `blogid`='{$itemid}'");
        $blog->query("DELETE FROM `{$db_prefix}calendar` WHERE `cid`='{$itemid}'");
        recache_currentmonthentries();
        recache_categories();
        $blog->query("UPDATE `{$db_prefix}counter` SET `entries`=`entries`-1");
        if ($job == 'deleteblog') {
            recache_latestentries();
            recache_latestreplies();
        }
        if ($ajax == 'on') {
            catchsuccessandfetch($finishok, $returnurl);
        } else {
            catchsuccess($finishok, array($backtodefault, $backtodraft));
        }
    }
    catcherror($cancel);
}
if ($job == 'draft') {
    $detail_array = $blog->getgroupbyquery("SELECT * FROM `{$db_prefix}blogs` WHERE `property`>=3 AND `blogid`>-1 ORDER BY `pubtime` DESC");
예제 #2
0
function metaWeblog_editPost($values)
{
    global $config, $defualtcategoryid, $db_prefix, $mbconfig;
    $struct = $values['struct'];
    $userdetail = check_user($values['username'], $values['password']);
    $blog = new boblog();
    $values['postid'] = floor($values['postid']);
    $records = $blog->getgroupbyquery("SELECT * FROM `{$db_prefix}blogs` WHERE `blogid`='{$values['postid']}'");
    if ($records[0]['blogid'] == '') {
        xml_error("Entry does not exist.");
    }
    if (!$struct['title']) {
        $title = "Untitled MetaWeblogAPI Entry";
    } else {
        $title = safe_convert($struct['title']);
    }
    if (!$struct['description']) {
        xml_error("You MUST provide a decription element in your post.");
    } else {
        $content = reduce_entities($struct['description']);
    }
    $nowtime = time();
    if ($struct['pubDate']) {
        $struct['dateCreated'] = $struct['pubDate'];
    }
    if ($struct['dateCreated']) {
        $time = get_time_unix($struct['dateCreated']) + 3600 * $config['timezone'];
    } else {
        $time = $records[0]['pubtime'];
    }
    $newcym = date("Ym", $time);
    $newcd = date("d", $time);
    $blog->query("UPDATE `{$db_prefix}calendar` SET cyearmonth='{$newcym}', cday='{$newcd}' WHERE `cid`='{$values['postid']}'");
    //writetofile ('text5.php', $struct['categories']); //For debug only
    if ($struct['categories'] != '') {
        $c_tmp = $blog->getgroupbyquery("SELECT cateid FROM `{$db_prefix}categories` WHERE `catename`='{$struct['categories']}'");
        $category = $c_tmp[0]['cateid'];
        if ($category == '') {
            $category = $defualtcategoryid;
        }
    } else {
        $category = $records[0]['category'];
    }
    if ($values['publish'] == 1 && $struct['flNotOnHomePage'] != 1) {
        $property = 0;
    } else {
        $property = 3;
    }
    $query = "UPDATE `{$db_prefix}blogs` SET `title`='{$title}', `pubtime`='{$time}', `property`='{$property}', `category`='{$category}', `content`='{$content}', `editorid`='{$userdetail['userid']}', `edittime`='{$nowtime}' WHERE `blogid`='{$values['postid']}'";
    recache_latestentries();
    recache_currentmonthentries();
    recache_categories();
    //Update Category counter
    $blog->query($query);
    $xml_content = make_xml_piece("boolean", '1');
    $body_xml = xml_generate($xml_content);
    send_response($body_xml);
}