コード例 #1
0
ファイル: functions.php プロジェクト: escherlat/loquacity
/**
 *
 *
 * @param unknown $tpl_source
 * @param unknown $bBlog      (reference)
 * @return unknown
 */
function update_when_compiled($tpl_source, &$bBlog)
{
    global $bBlog;
    // prevent parse error ? wtf ??
    // well that worked. WTF?
    if (!defined('IN_BBLOG_ADMIN')) {
        $bBlog->modifiednow();
    }
    return $tpl_source;
}
コード例 #2
0
/**
 *
 *
 * @param unknown $bBlog (reference)
 * @param unknown $id
 */
function deleteComment(&$bBlog, $id)
{
    $id = intval($id);
    $postid = $bBlog->get_var('select postid from ' . T_COMMENTS . ' where commentid="' . $id . '"');
    $childcount = $bBlog->get_var('select count(*) as c from ' . T_COMMENTS . ' where parentid="' . $id . '" group by commentid');
    if ($childcount > 0) {
        // there are replies to the comment so we can't delete it.
        $bBlog->query('update ' . T_COMMENTS . ' set deleted="true", postername="", posteremail="", posterwebsite="", pubemail=0, pubwebsite=0, commenttext="Deleted Comment" where commentid="' . $val . '"');
    } else {
        // just delete the comment
        $bBlog->query('delete from ' . T_COMMENTS . ' where commentid="' . $id . '"');
    }
    $newnumcomments = $bBlog->get_var('SELECT count(*) as c FROM ' . T_COMMENTS . ' WHERE postid="' . $postid . '" and deleted="false" group by postid');
    $bBlog->query('update ' . T_POSTS . ' set commentcount="' . $newnumcomments . '" where postid="' . $postid . '"');
    $bBlog->modifiednow();
}