function Comment($template, $commentid, $comment, $articlescomments) { global $Settings, $ACDB, $UserDB; $Config = $Settings->co; $output = $template[comment]; $output = str_replace("{number}", $i, $output); if ($comment[parentcid]) { $quotecomment = $articlescomments[$comment[parentcid]]; $quoteout = $template[quote]; $quoteout = str_replace("{name}", $quotecomment[name], $quoteout); $quoteout = str_replace("{quote}", Markdown(kses_filter($quotecomment[content])), $quoteout); $output = str_replace("{parentquote}", $quoteout, $output); } else { $output = str_replace("{parentquote}", "", $output); } # date $dateregexp = '#\\{date=(.*?)\\}#i'; preg_match_all($dateregexp, $output, $datematches, PREG_SET_ORDER); if (!empty($datematches)) { foreach ($datematches as $null => $match) { $output = str_replace($match[0], date($match[1], $commentid + $adjust * 60), $output); } } $output = str_replace("{comment}", Markdown(kses_filter($comment[content])), $output); $output = str_replace("{ip}", $comment[ip], $output); $output = str_replace("{author}", $comment[name], $output); $output = str_replace("{url}", $comment[url], $output); # Output mail if given $comment[email] ? $output = preg_replace("/\\[mail\\=\"(.*)\"\\]/ui", "<a href=\"mailto:{$comment['email']}\">\\1</a>", $output) : ($output = preg_replace("/\\[mail\\=\"(.*)\"\\]/ui", "", $output)); $output = str_replace("{reply}", '<a href="' . $currenturl . '?replyto=' . $commentid . '">reply</a>', $output); # The following will be set if the user is registered $checkuser = KUsers::indatabase(false, $comment[name]); if (eregi("{gravatar}", $output)) { if ($comment[email]) { $gravatarid = trim(md5($comment[email])); $size = $Config[comments][avatar][size]; $default = $Config[comments][avatar][defaulturl]; $gravatarurl = "http://www.gravatar.com/avatar.php?gravatar_id={$gravatarid}&size={$size}&default={$default}&border={$border}"; $output = str_replace("{gravatar}", "<img src=\"{$gravatarurl}\" alt=\"{$comment['name']}_gravatar\" />", $output); } else { $output = str_replace("{gravatar}", "", $output); } } $output = make_clickable($output); return $output; }
if (!defined("KNIFE_PATH")) { define("KNIFE_PATH", dirname(__FILE__) . "/"); # Absolute path to current script } include_once KNIFE_PATH . '/inc/class.articles.php'; include_once KNIFE_PATH . '/inc/class.comments.php'; include_once KNIFE_PATH . '/inc/class.users.php'; # load userclass - can't live without include_once KNIFE_PATH . '/inc/class.settings.php'; include_once KNIFE_PATH . '/inc/class.parse.php'; include_once KNIFE_PATH . '/inc/functions.php'; include_once KNIFE_PATH . '/plugins/markdown.php'; $pathinfo_array = explode("/", $_SERVER[PATH_INFO]); $ACDB = new KComments(); $UserDB = new KUsers(); $AADB = new KArticles(); $Settings = new KSettings(); $Parser = new Parser(); $Settings->getCats(); # $Settings->getTemplates(); # Initialize settings $Settings->getConfig(); # $settingsdatabase = new SettingsStorage('settings'); $alltemplates = $Settings->te; $allcats = $Settings->ca; $Config = $Settings->co; $allusers = $UserDB->getusers(); # $null = $UserDB->verify();
/* * Required setup */ $Settings = new KSettings(); # Initiate the settings class $Settings->getConfig(); # Load the configuration include_once KNIFE_PATH . '/config.php'; # Include config file (FIXME) if ($Settings->co[storage][backend] == "mysql") { define("KNIFESQL", "yes"); # Flat or mysql } # # Load the user class and run verify $User = new KUsers(); $null = $User->verify(); # $User will be false if no login could be found # User data is accessible via $Userclass->username, etc, or $User[username], etc. # # Now, load the language file chosen or load default one if ($User->language) { include_once KNIFE_PATH . '/lang/' . $User->language; } else { include_once KNIFE_PATH . '/lang/' . $Settings->co[general][defaultlanguage]; } # # We need to display the login form if no good login data is found if (!$User->username) { $moduletitle = SCRIPT_TITLE . " - " . i18n("login_modtitle"); $menus[0] = "";
function verify() { $userdata = KUsers::collectlogin(); if (!$userdata) { return false; } $users = KUsers::getusers(); $unique = UNIQUE; $return = false; # $unique_password = $userdata[ . $unique; if ($userdata[logintype] == "standard") { $e_md5 = md5($userdata[password]); $e_given = sha1($e_md5 . $unique); } elseif ($userdata[logintype] == "comment") { $e_md5 = md5($userdata[password]); $e_given = sha1($e_md5 . $unique); } else { $e_given = sha1($userdata[password] . $unique); } foreach ($users as $thisuser => $thisuserdata) { if (urlTitle($userdata[username]) == urlTitle($thisuser)) { if ($e_given == $thisuserdata[password]) { $this->username = $thisuser; $this->nickname = $thisuserdata[nickname]; $this->status = "verified"; $this->level = $thisuserdata[level]; $this->language = $userdata[language]; $this->type = $userdata[logintype]; if ($userdata[logintype] == "standard") { setcookie("kusername", $thisuser, time() + 3600); setcookie("kmd5password", $e_md5, time() + 3600); setcookie("klanguage", $userdata[language]); } } } } }
function verify($SentHeaders = false) { global $Settings; $userdata = KUsers::collectlogin(); if (!$userdata) { return false; } $users = KUsers::getusers(); $unique = $Settings->unique; $return = false; if ($userdata[logintype] == "standard") { $e_md5 = md5($userdata[password]); $e_given = sha1($e_md5 . $unique); } elseif ($userdata[logintype] == "comment") { $e_md5 = md5($userdata[password]); $e_given = sha1($e_md5 . $unique); } else { $e_given = sha1($userdata[password] . $unique); } foreach ($users as $thisuser => $thisuserdata) { if (urlTitle($userdata[username]) == urlTitle($thisuser)) { if ($e_given == $thisuserdata[password]) { $this->username = $thisuser; $this->nickname = $thisuserdata[nickname]; $this->url = $thisuserdata[url]; $this->email = $thisuserdata[email]; $this->status = "verified"; $this->level = $thisuserdata[level]; $this->language = $userdata[language]; $this->type = $userdata[logintype]; if ($userdata[logintype] == "standard") { if (!$SentHeaders) { setcookie("allegory_username", $thisuser, time() + 14400, "/"); setcookie("allegory_md5password", $e_md5, time() + 14400, "/"); setcookie("allegory_language", $userdata[language], time() + 100000, "/"); } else { # Set the cookies via echoing a javascript here. # Will probably also need a JS refresh ( FIXME ) echo "<script type=\"text/javascript\">\n\t\t\t\t\t\tvar now = new Date();\n\t\t\t\t\t\tnow.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);\n\t\t\t\t\t\tAllegory_Setcookie(\"allegory_username\", \"{$thisuser}\", now, \"/\");\n\t\t\t\t\t\tAllegory_Setcookie(\"allegory_md5password\", \"{$e_md5}\", now, \"/\");\n\t\t\t\t\t\t</script>"; } } } } } }
define("KNIFE_PATH", dirname(__FILE__) . "/"); # Absolute path to current script } include_once KNIFE_PATH . '/config.php'; # load temporary config include_once KNIFE_PATH . '/inc/class.articles.php'; include_once KNIFE_PATH . '/inc/class.comments.php'; include_once KNIFE_PATH . '/inc/class.users.php'; # load userclass - can't live without include_once KNIFE_PATH . '/lang/nb_no.php'; # load a language include_once KNIFE_PATH . '/inc/functions.php'; include_once KNIFE_PATH . '/plugins/markdown.php'; $pathinfo_array = explode("/", $_SERVER[PATH_INFO]); $commentsclass = new KComments(); $Userclass = new KUsers(); $KAclass = new KArticles(); # # Reset some variables # $timestamp = 0; # # Display articles # $settingsdatabase = new SettingsStorage('settings'); $alltemplates = $settingsdatabase->settings['templates']; $allcats = $settingsdatabase->settings['categories']; $allusers = $Userclass->getusers(); if ($template) { $template = $alltemplates[$template]; } else {
} include_once KNIFE_PATH . '/inc/class.users.php'; # load userclass - can't live without include_once KNIFE_PATH . '/inc/class.settings.php'; include_once KNIFE_PATH . '/inc/functions.php'; if (!$Settings) { $Settings = new KSettings(); $Settings->getCats(); # $Settings->getTemplates(); # Initialize settings $Settings->getConfig(); # } if (!$UserDB) { $UserDB = new KUsers(); } echo '<script type="text/javascript"> function Allegory_Setcookie(name, value, expires, path, domain, secure) { var curCookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : ""); document.cookie = curCookie; } function Allegory_Getcookie(name) { var dc = document.cookie; var prefix = name + "=";