示例#1
0
if (!isset($_GET['id'])) {
    jsRedirect(script_path . 'admincp.php');
} else {
    $blog_id = $_GET['id'] + 0;
}
$blog_data = $db->getArray('SELECT b.*, u.username
	FROM ' . db_blogs . ' as b, ' . db_users . ' as u
	WHERE b.blog_id=' . $blog_id . ' AND b.author_id=u.user_id
	LIMIT 1;');
if (empty($blog_data)) {
    // blog doesn't exit
    jsRedirect(script_path . 'admincp.php');
}
// admins can only edit public blogs
if ($blog_data['access'] != access_public) {
    jsredirect(script_path . 'admincp.php');
}
$author = new nlb_user($db, $blog_data['author_id']);
if (!empty($_POST)) {
    /**
     *		Check submited data
     */
    $text->validate();
    $text->makeClean('trim', 'slash_if_needed');
    $c = $text->clean;
    if ($text->is_missing_required) {
        $baddata = true;
    } else {
        // delete the blog?
        if ($c['delete'] == 'x') {
            $db->query('DELETE FROM ' . db_blogs . ' WHERE blog_id=' . $blog_id . ' LIMIT 1;');
示例#2
0
     $ets->link_bbcode = $l['link_bbcode'];
     $ets->link_smiles = $l['link_smiles'];
     if ($b->data['comments'] != -1) {
         $ets->view_comments = true;
     } else {
         $ets->view_comments = true;
     }
     break;
 case 'article':
     /**
      * =======================================
      *	V I E W   A R T I C L E
      * =======================================
      */
     if (!isset($_PATH['id'])) {
         jsredirect('index.php/action/list_articles');
         // no id specified, redirect to list of articles.
     } else {
         $id = (int) $_PATH['id'];
     }
     $ets_outter->main_title = $config->get('site_name') . ": " . $l['title-art-view'];
     $ets_outter->page_title = $l['title-art-view'];
     $USESKIN = skin_article_view;
     $a = $db->getArray("# GETTING A ARTICLE\r\n\t\tSELECT a. * , u.user_id, u.username\r\n\t\tFROM " . db_articles . " AS a, " . db_users . " AS u\r\n\t\tWHERE a.article_id = " . $id . " AND a.author_id = u.user_id\r\n\t\tLIMIT 1;");
     foreach ($a as $key => $val) {
         $a[$key] = stripslashes($val);
     }
     $ets->subject = $a['subject'];
     $ets->body = nl2br($a['body']);
     $ets->author = $a['username'];
     $ets->author_url_blogs = build_link('blog.php', array('user' => $a['user_id']));
示例#3
0
文件: web.php 项目: kaspernj/knjphpfw
/** Function to redirect. You can use this instead of using the header()-function. */
function redirect($url, $exit = true){
	global $knj_web;
	
	if (!headers_sent() and !$knj_web["alert_sent"]){
		header("Location: " . $url);
	}else{
		jsredirect($url);
	}
	
	if ($exit == true){
		exit();
	}
}