function getcomment($article, $comment)
 {
     if (defined("KNIFESQL")) {
         $class = KComments::connect();
         $mysql_query = "SELECT * FROM comments WHERE commentid = {$comment}";
         $result = mysql_query($mysql_query) or die('getcomment() Query failed: Comment not found: ' . mysql_error());
         $comment = mysql_fetch_assoc($result);
         return $comment;
     } else {
         $comments = KComments::articlecomments($article);
         $comment = $comments[$comment];
         return $comment;
     }
 }
 $output = str_replace("[link]", "<a title=\"" . htmlspecialchars($article[title]) . "\" href=\"{$PHP_SELF}?k={$date}\">", $output);
 $output = str_replace("[/link]", "</a>", $output);
 #		$output = str_replace("[friendlylink]","<a title=\"".htmlspecialchars($article[title])."\" href=\"$_SERVER[PHP_SELF]/".urlTitle($article[title])."\">", $output);
 #        $output = str_replace("[/friendlylink]","</a>", $output);
 $output = str_replace("[friendlylink]", "<a title=\"" . htmlspecialchars($article[title]) . "\" href=\"{$_SERVER['SCRIPT_NAME']}/" . $KAclass->urlconstructor($article, $catarray) . "\">", $output);
 $output = str_replace("[/friendlylink]", "</a>", $output);
 $output = str_replace("{content}", $article[content], $output);
 $output = str_replace("{extended}", "", $output);
 $output = str_replace("{author}", $article[author], $output);
 $output = str_replace("{category}", $thiscatnamelisting, $output);
 $output = str_replace("{date}", date("dmy H:i", $date), $output);
 #
 #	NEEDS ABSTRACTION
 #
 #		$articlescomments = $commentsclass->settings[$date];
 $articlescomments = $commentsclass->articlecomments($date);
 if (is_array($articlescomments)) {
     krsort($articlescomments);
     reset($articlescomments);
     # get the latest
     $tempcomments = $articlescomments;
     $lastcomment = array_shift($tempcomments);
     unset($tempcomments);
 }
 $article[comments] = count($articlescomments);
 $output = str_replace("{latestcomment}", $lastcomment[name], $output);
 $output = str_replace("{comments}", $article[comments], $output);
 $article[views] = $KAclass->articleupdate($date, "views", "noupdate");
 $output = str_replace("{views}", $article[views], $output);
 if ($article[lastedit]) {
     $output = str_replace("{lastedit}", $article[lastedit], $output);
Пример #3
0
if ($User->level < 3) {
    die(i18n("login_noaccess"));
}
include_once KNIFE_PATH . '/inc/class.articles.php';
include_once KNIFE_PATH . '/inc/class.comments.php';
#
#	Show edit for for single article
#
$KAclass = new KArticles();
$KCclass = new KComments();
$menus["sub_edit"] = "\n<ul><li>proof</li><li>of</li><li>concept</li></ul>\n";
if ($_GET[id] && !$_POST[id] && !$_GET[action]) {
    $settingsclass = new SettingsStorage('settings');
    $currentcats = $settingsclass->settings['categories'];
    $editentry = $KAclass->getarticle($_GET[id]);
    $comments = $KCclass->articlecomments($_GET[id]);
    $moduletitle = i18n("edit_module_edit") . " &quot;{$editentry['title']}&quot;";
    # form stuff here
    # set up category checkboxes
    $editcats = explode(", ", $editentry[category]);
    foreach ($editcats as $catkey => $catvalue) {
        $newcats["{$catvalue}"] = $catvalue;
    }
    foreach ($currentcats as $catid => $catinfo) {
        if (array_key_exists($catid, $newcats)) {
            $selected = 'checked="checked"';
        }
        $catformfields .= "<input {$selected} type=\"checkbox\" name=\"article[category][]\" id=\"catbox{$catid}\" value=\"{$catid}\" />\n\t\t\t\t\t\t\t<label for=\"catbox{$catid}\">{$catinfo['name']}</label><br />";
        unset($selected);
    }
    $main_content .= '
 function getcomment($article, $comment)
 {
     $comments = KComments::articlecomments($article);
     $comment = $comments[$comment];
     return $comment;
 }