posts_recent();
}
// Load post:
// Load current post
function load_post()
{
global $CT;
return $CT->post();
}
// Load post ID:
// Load ID from requested post
function load_post_id()
{
global $CT;
return $CT->Posts[$CT->PostsCount]['id'];
}
// Load post title:
// Load title from requested post
function load_post_title()
{
global $CT;
return stripslashes($CT->Posts[$CT->PostsCount]['post_title']);
}
// Load post content:
// Load content from requested post
function load_post_content()
{
global $CT;
return stripslashes($CT->Posts[$CT->PostsCount]['post_content']);
}
// Load post author:
// Load author from requested post
function load_post_author()
{
global $CT;
return stripslashes($CT->Posts[$CT->PostsCount]['user_login']);
}
// Load post author ID:
// Load author ID from requested post
function load_post_author_id()
{
global $CT;
return $CT->Posts[$CT->PostsCount]['post_author'];
}
// Load post date:
// Load date from requested post
function load_post_date($Format)
{
global $CT;
return datetime($Format, $CT->Posts[$CT->PostsCount]['post_date']);
}
// Load post modified:
// Load modification date from requested post
function load_post_modified($Format)
{
global $CT;
return datetime($Format, $CT->Posts[$CT->PostsCount]['post_modified']);
}
// Load post URL:
// Load URL from requested post
function load_post_url()
{
global $CT;
if(CONF_PERMALINKS == "default")
{
return "http://" . CONF_URL . "/?post=" . $CT->Posts[$CT->PostsCount]['id'];
}
elseif(CONF_PERMALINKS == "name")
{
return "http://" . CONF_URL . "/bericht/" . datetime("Y", $CT->Posts[$CT->PostsCount]['post_date']) . "/" . datetime("m", $CT->Posts[$CT->PostsCount]['post_date']) . "/" . stripslashes($CT->Posts[$CT->PostsCount]['post_url']);
}
elseif(CONF_PERMALINKS == "numeric")
{
return "http://" . CONF_URL . "/bericht/" . $CT->Posts[$CT->PostsCount]['id'];
}
}
// Load post comment:
// Load comment option from requested post
function load_post_comment()
{
if(CONF_COMMENT == 1)
{
global $CT;
if($CT->Posts[$CT->PostsCount]['post_comment_status'] == "open")
{
return TRUE;
}
else
{
if(defined("USER_ID") && ($CT->Posts[$CT->PostsCount]['post_comment_status'] == "leden"))
{
return TRUE;
}
else
{
return FALSE;
}
if($CT->Posts[$CT->PostsCount]['post_comment_status'] == "gesloten")
{
return FALSE;
}
}
}
else
{
return FALSE;
}
}
// Load post comments:
// Load amount comments from requested post
function load_post_comments()
{
global $CT;
return $CT->Posts[$CT->PostsCount]['post_comments'];
}
// Load post views:
// Load views from requested post
function load_post_views()
{
global $CT;
return $CT->Posts[$CT->PostsCount]['post_views'];
}
// Load post categories:
// Load categories in which post is present
function load_post_categories()
{
global $DB;
global $CT;
$Categories = $DB->query_fetchDB("
SELECT c.id, c.category_name, c.category_url
FROM ot_categories AS c
INNER JOIN ot_post2category AS p
WHERE p.post_id = '" . $CT->Posts[$CT->PostsCount]['id'] . "' AND
c.id = p.category_id AND
c.category_status = 'yes'
");
if($Categories)
{
$Return = "";
for($i = 0; $i < count($Categories); $i++)
{
if(CONF_PERMALINKS == "default")
{
$Return .= '' . stripslashes($Categories[$i]['category_name']) . ', ';
}
elseif(CONF_PERMALINKS == "name")
{
$Return .= '' . stripslashes($Categories[$i]['category_name']) . ', ';
}
elseif(CONF_PERMALINKS == "numeric")
{
$Return .= '' . stripslashes($Categories[$i]['category_name']) . ', ';
}
}
return substr($Return, 0, -2);
}
else
{
return "Ongecategoriseerd";
}
}
//---------------------------------------------------------------------------
// Page
//---------------------------------------------------------------------------
// Load homepage:
// Check if page is set for homepage
function load_homepage()
{
if(CONF_HOMEPAGE != 0)
{
return load_page(CONF_HOMEPAGE);
}
else
{
return FALSE;
}
}
// Load page:
// Load requested page
function load_page($Page)
{
global $CT;
$CT->page($Page);
if($CT->Page)
{
return TRUE;
}
else
{
return FALSE;
}
}
// Load page ID:
// Load ID from requested page
function load_page_id()
{
global $CT;
return $CT->Page['0']['id'];
}
// Load page title:
// Load title from requested page
function load_page_title()
{
global $CT;
return stripslashes($CT->Page['0']['post_title']);
}
// Load page content:
// Load content from requested page
function load_page_content()
{
global $CT;
return stripslashes($CT->Page['0']['post_content']);
}
// Load page author:
// Load author from requested page
function load_page_author()
{
global $CT;
return stripslashes($CT->Page['0']['user_login']);
}
// Load page author ID:
// Load author ID from requested page
function load_page_author_id()
{
global $CT;
return $CT->Page['0']['post_author'];
}
// Load page date:
// Load date from requested page
function load_page_date($Format)
{
global $CT;
return datetime($Format, $CT->Page['0']['post_date']);
}
// Load page modified:
// Load modification date from requested page
function load_page_modified($Format)
{
global $CT;
return datetime($Format, $CT->Page['0']['post_modified']);
}
// Load page URL:
// Load URL from requested page
function load_page_url()
{
global $CT;
if(CONF_PERMALINKS == "default")
{
return "http://" . CONF_URL . "/?page=" . $CT->Page['0']['id'];
}
elseif(CONF_PERMALINKS == "name")
{
return "http://" . CONF_URL . "/" . stripslashes($CT->Page['0']['post_url']);
}
elseif(CONF_PERMALINKS == "numeric")
{
return "http://" . CONF_URL . "/pagina/" . $CT->Page['0']['id'];
}
}
// Load page comment:
// Load comment option from requested page
function load_page_comment()
{
if(CONF_COMMENT == 1)
{
global $CT;
if($CT->Page['0']['post_comment_status'] == "open")
{
return TRUE;
}
else
{
if(defined("USER_ID") && ($CT->Page['0']['post_comment_status'] == "leden"))
{
return TRUE;
}
else
{
return FALSE;
}
if($CT->Page['0']['post_comment_status'] == "gesloten")
{
return FALSE;
}
}
}
else
{
return FALSE;
}
}
// Load page comments:
// Load amount comments from requested page
function load_page_comments()
{
global $CT;
return $CT->Page['0']['post_comments'];
}
// Load page views:
// Load views from requested page
function load_page_views()
{
global $CT;
return $CT->Page['0']['post_views'];
}
//---------------------------------------------------------------------------
// Comments
//---------------------------------------------------------------------------
// Load comments:
// Load comments for current post
function load_comments()
{
global $CT;
if(isset($CT->Posts[$CT->PostsCount]['id']))
{
return $CT->comments($CT->Posts[$CT->PostsCount]['id']);
}
elseif(isset($CT->Page['0']['id']))
{
return $CT->comments($CT->Page['0']['id']);
}
else
{
return FALSE;
}
}
// Load comment:
// Load current comment
function load_comment()
{
global $CT;
return $CT->comment();
}
// Load comment ID:
// Load ID current comment
function load_comment_id()
{
global $CT;
return $CT->Comments[$CT->CommentsCount]['id'];
}
// Load comment author name:
// Load name author current comment
function load_comment_author_name()
{
global $CT;
return stripslashes($CT->Comments[$CT->CommentsCount]['comment_author_name']);
}
// Load comment author url:
// Load website author current comment
function load_comment_author_url()
{
global $CT;
return "http://" . str_replace("http://", "", stripslashes($CT->Comments[$CT->CommentsCount]['comment_author_url']));
}
// Load comment content:
// Load content of current comment
function load_comment_content()
{
global $CT;
$CT->Comments[$CT->CommentsCount]['comment_content'] = stripslashes($CT->Comments[$CT->CommentsCount]['comment_content']);
if(CONF_COMMENT_HTML == 1)
{
$CT->Comments[$CT->CommentsCount]['comment_content'] = strip_tags($CT->Comments[$CT->CommentsCount]['comment_content'], "");
}
else
{
$CT->Comments[$CT->CommentsCount]['comment_content'] = strip_tags($CT->Comments[$CT->CommentsCount]['comment_content']);
}
if(CONF_SMILIES == 1)
{
$CT->Comments[$CT->CommentsCount]['comment_content'] = smilies($CT->Comments[$CT->CommentsCount]['comment_content']);
}
return nl2br($CT->Comments[$CT->CommentsCount]['comment_content']);
}
// Load comment date:
// Load date of current comment
function load_comment_date($Format)
{
global $CT;
return datetime($Format, $CT->Comments[$CT->CommentsCount]['comment_date']);
}
//---------------------------------------------------------------------------
// Add comment
//---------------------------------------------------------------------------
function add_comment()
{
if(CONF_COMMENT == 1)
{
if(load_post_comment() OR load_page_comment())
{
if($_SERVER['REQUEST_METHOD'] == "POST")
{
if( ! empty($_POST['comment_spam']) && ! empty($_POST['comment_author_name']) && ! empty($_POST['comment_author_email']) && isset($_POST['comment_author_url']) && ! empty($_POST['comment_content']))
{
if($_POST['comment_spam'] == $_SESSION['antispam'])
{
if(load_post_comment())
{
$Id = load_post_id();
}
elseif(load_page_comment())
{
$Id = load_page_id();
}
else
{
header("Location: http://" . CONF_URL . "/?err-403");
}
global $DB;
if(defined("USER_ID") && (CONF_MODERATION == 0))
{
$DB->query_execDB("
INSERT INTO ot_comments
SET id = 'NULL',
comment_author_name = '" . addslashes(USER_LOGIN) . "',
comment_author_email = '" . addslashes(USER_EMAIL) . "',
comment_author_url = '" . addslashes(USER_URL) . "',
comment_author_ip = '" . $_SERVER['REMOTE_ADDR'] . "',
comment_content = '" . addslashes($_POST['comment_content']) . "',
comment_date = NOW(),
comment_post = '" . $Id . "',
comment_status = 'yes'
");
$DB->query_execDB("
UPDATE ot_posts
SET post_comments = post_comments + 1
WHERE id = '" . $Id . "'
");
if(CONF_COMMENT_EMAIL == 1)
{
$Message = "
Gegroet " . CONF_ADMINISTRATOR . " !
U hebt deze e-mail ontvangen omdat " . stripslashes($_POST['comment_author_name']) . " een reactie achterliet op uw website, " . CONF_URL . ".
Verder valt er niets te melden.
Tot de volgende,
Uw website
";
send_mail(CONF_EMAIL, CONF_EMAIL, CONF_NAME . ": nieuwe reactie", $Message);
}
}
else
{
$PostedBefore = $DB->query_fetchDB("
SELECT id
FROM ot_comments
WHERE comment_author_name = '" . addslashes($_POST['comment_author_name']) . "' AND
comment_author_email = '" . addslashes($_POST['comment_author_email']) . "' AND
comment_author_url = '" . addslashes($_POST['comment_author_url']) . "' AND
comment_author_ip = '" . $_SERVER['REMOTE_ADDR'] . "' AND
comment_status = 'yes'
LIMIT 1
");
if($PostedBefore && (CONF_MODERATION_PREVIOUS == 1) && (preg_match_all("|(href\t*?=\t*?['\"]?)?(https?:)?//|i", $_POST['comment_content'], $Out) < 10))
{
$DB->query_execDB("
INSERT INTO ot_comments
SET id = 'NULL',
comment_author_name = '" . addslashes($_POST['comment_author_name']) . "',
comment_author_email = '" . addslashes($_POST['comment_author_email']) . "',
comment_author_url = '" . addslashes($_POST['comment_author_url']) . "',
comment_author_ip = '" . $_SERVER['REMOTE_ADDR'] . "',
comment_content = '" . addslashes($_POST['comment_content']) . "',
comment_date = NOW(),
comment_post = '" . $Id . "',
comment_status = 'yes'
");
$DB->query_execDB("
UPDATE ot_posts
SET post_comments = post_comments + 1
WHERE id = '" . $Id . "'
");
if(CONF_COMMENT_EMAIL == 1)
{
$Message = "
Gegroet " . CONF_ADMINISTRATOR . " !
U hebt deze e-mail ontvangen omdat " . stripslashes($_POST['comment_author_name']) . " een reactie achterliet op uw website, " . CONF_URL . ".
Verder valt er niets te melden.
Tot de volgende,
Uw website
";
send_mail(CONF_EMAIL, CONF_EMAIL, CONF_NAME . ": nieuwe reactie", $Message);
}
}
else
{
$DB->query_execDB("
INSERT INTO ot_comments
SET id = 'NULL',
comment_author_name = '" . addslashes($_POST['comment_author_name']) . "',
comment_author_email = '" . addslashes($_POST['comment_author_email']) . "',
comment_author_url = '" . addslashes($_POST['comment_author_url']) . "',
comment_author_ip = '" . $_SERVER['REMOTE_ADDR'] . "',
comment_content = '" . addslashes($_POST['comment_content']) . "',
comment_date = NOW(),
comment_post = '" . $Id . "',
comment_status = 'spam'
");
if((CONF_COMMENT_EMAIL == 1) OR (CONF_COMMENT_EMAIL_MODERATION == 1))
{
$Message = "
Gegroet " . CONF_ADMINISTRATOR . " !
U hebt deze e-mail ontvangen omdat " . stripslashes($_POST['comment_author_name']) . " een reactie achterliet op uw website, " . CONF_URL . ".
Blijkbaar is deze reactie ook in de wachtrij geplaatst.
Verder valt er niets te melden.
Tot de volgende,
Uw website
";
send_mail(CONF_EMAIL, CONF_EMAIL, CONF_NAME . ": nieuwe reactie", $Message);
}
}
}
}
else
{
header("Location: http://" . CONF_URL . "/?err-403");
}
}
else
{
header("Location: http://" . CONF_URL . "/?err-403");
}
}
}
}
}
//---------------------------------------------------------------------------
// Category
//---------------------------------------------------------------------------
// Load category:
// Load category if ID is set
function load_category()
{
global $CT;
return $CT->category();
}
// Load category ID:
// Load ID from current category
function load_category_id()
{
global $CT;
return $CT->Category['0']['id'];
}
// Load category name:
// Load name from current category
function load_category_name()
{
global $CT;
return stripslashes($CT->Category['0']['category_name']);
}
// Load category url:
// Load url from current category
function load_category_url()
{
global $CT;
if(CONF_PERMALINKS == "default")
{
return "http://" . CONF_URL . "/?category=" . load_category_id();
}
elseif(CONF_PERMALINKS == "name")
{
return "http://" . CONF_URL . "/categorie/" . stripslashes($CT->Category['0']['category_url']);
}
elseif(CONF_PERMALINKS == "numeric")
{
return "http://" . CONF_URL . "/categorie/" . load_category_id();
}
}
// Load category page:
// Load page from category
function load_category_page()
{
if(isset($_GET['page']))
{
if(is_numeric($_GET['page']))
{
return $_GET['page'];
}
else
{
return 1;
}
}
else
{
return 1;
}
}
// Load category previous:
// Check if there is a previous page with posts
function load_category_previous($Text)
{
if(isset($_GET['page']))
{
if(is_numeric($_GET['page']) && ($_GET['page'] != 0) && ($_GET['page'] != 1))
{
if(CONF_PERMALINKS == "default")
{
return '' . $Text . '';
}
elseif(CONF_PERMALINKS == "name")
{
return '' . $Text . '';
}
elseif(CONF_PERMALINKS == "numeric")
{
return '' . $Text . '';
}
}
else
{
return FALSE;
}
}
else
{
return FALSE;
}
}
// Load category next:
// Check if there is a next page with posts
function load_category_next($Text)
{
global $CT;
if(isset($CT->Posts[$CT->PostsCount]))
{
if(CONF_PERMALINKS == "default")
{
return '' . $Text . '';
}
elseif(CONF_PERMALINKS == "name")
{
return '' . $Text . '';
}
elseif(CONF_PERMALINKS == "numeric")
{
return '' . $Text . '';
}
}
else
{
return FALSE;
}
}
//---------------------------------------------------------------------------
// Replace smilies
//---------------------------------------------------------------------------
function smilies($String)
{
$String = preg_replace("#\:\)#si", "", $String);
$String = preg_replace("#\:-\)#si", "", $String);
$String = preg_replace("#\:\(#si", "", $String);
$String = preg_replace("#\:-\(#si", "", $String);
$String = preg_replace("#\;\)#si", "", $String);
$String = preg_replace("#\;-\)#si", "", $String);
$String = preg_replace("#\:d#si", "", $String);
$String = preg_replace("#\:-d#si", "", $String);
$String = preg_replace("#\:o#si", "", $String);
$String = preg_replace("#\:-o#si", "", $String);
$String = preg_replace("#\:p#si", "", $String);
$String = preg_replace("#\:-p#si", "", $String);
return $String;
}
?>