Example #1
0
     $ets->page_body = $l['log-forgot-off'];
     break;
     // exit the big switch()
 }
 $err = array();
 if (!empty($_POST)) {
     if (!isset($_POST['username']) || empty($_POST['username'])) {
         $err[] = $l['log-bad-user'];
         // bad username
     } else {
         $username = slash_if_needed($_POST['username']);
         if (!$user->userExists($username)) {
             $err[] = $l['log-bad-user'];
         } else {
             // build new user object to manip his data
             $client = new nlb_user($db);
             $id = $client->getIdByName($username);
             $client->setId($id);
             // create new password. 6 random letters + numbers
             $newpass = uniqid(rand(), true);
             $newpass = substr($newpass, 0, 6);
             $hash = md5($newpass);
             $link = full_url . script_path . 'login.php';
             $message = $l['log-forgot-email'];
             $message = str_replace('%USERNAME%', $client->get('username'), $message);
             $message = str_replace('%PASSWORD%', $newpass, $message);
             $message = str_replace('%LINK%', $link, $message);
             $mail->AddAddress($client->get('email'), $client->get('username'));
             $mail->Subject = $config->get('site_name') . $l['log-forgot-subject'];
             $mail->Body = $message;
             if (!$mail->Send()) {
Example #2
0
  *      A D D   U S E R
  */
 $text->makeClean('slash_if_needed', 'trim');
 $c = $text->clean;
 $timezone = $c['timezone'] - 13;
 $new = array('username' => $c['username'], 'password' => md5($c['password']), 'email' => $c['email'], 'access' => $config->get('default_access'), 'registered' => time(), 'last_login' => time(), 'ip' => $_SERVER['REMOTE_ADDR'], 'blog_count' => 0, 'timezone' => $timezone, 'bio' => "", 'custom' => $c['custom'], 'date_format' => $config->get('default_date_format'), 'birthday' => "", 'perpage' => 10, 'gender' => 0);
 $check_email = $config->get('validate_email');
 if ($check_email == "true") {
     // include mail class thing.
     $new['valid'] = 0;
 } else {
     $new['valid'] = 1;
 }
 $id = $user->newUser($new);
 unset($user);
 $user = new nlb_user($db, $id);
 // add template into DB.
 $date = 1000000;
 // make the cache in the past so ETS will update it.
 $db->query('INSERT INTO ' . db_source . " ( \r\n\t\t`owner_id` , `blog` , `blog_updated` , `friends` , `friends_updated` , `profile` , `profile_updated` )\r\n\t\tVALUES (\r\n\t\t'{$id}', 'empty', '{$date}', 'empty', '{$date}', 'empty', '{$date}'\r\n\t\t);");
 $db->query('INSERT INTO ' . db_cache . " ( \r\n\t\t`owner_id` , `blog` , `blog_updated` , `friends` , `friends_updated` , `profile` , `profile_updated` )\r\n\t\tVALUES (\r\n\t\t'{$id}', 'empty', '{$date}', 'empty', '{$date}', 'empty', '{$date}'\r\n\t\t);");
 $user->setTemplateSource($clean['template'], $config->get('home_text'));
 // did the first user just register?
 if ($id == 1) {
     $user->grant('admin');
     $user->updateDB();
 }
 $sent = $user->validateEmail($config);
 $ets->page_body = $l['reg-done'];
 if ($sent) {
     $ets->page_body .= $l['reg-checkmail'];
Example #3
0
} 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;');
            $author->recountBlogs();
            $author->updatedb();
Example #4
0
*/
require_once 'config.php';
// include this before others!
require_once 'system/functions.php';
require_once 'system/ets_file.php';
require_once 'system/sqldb2.class.php';
// NLB Class library
require_once 'system/nlb_blog.class.php';
require_once 'system/nlb_user.class.php';
require_once 'system/nlb_config.class.php';
require_once 'ets.php';
// Sweet template library
$start = mymicrotime();
$db = new sqldb2($DB_CONFIG);
$config = new nlb_config($db);
$user = new nlb_user($db);
// is someone trying to access a persons blog
$_SERVER['QUERY_STRING'] = urldecode($_SERVER['QUERY_STRING']);
if (!empty($_SERVER['QUERY_STRING']) && ($id = $user->getIdByName($_SERVER['QUERY_STRING'])) > -1) {
    // 	die($id);
    //jsRedirect( script_path . 'blog.php/user/' . $id );
    jsRedirect(build_link('blog.php', array('user' => $id)));
}
$user->checklogin();
require_once $config->langfile();
// include lang file
$b = new nlb_blog($db);
if ($user->isLogedIn) {
    // timezone settings
    $b->setDateOffset($config->get('server_timezone'), $user->get('timezone'));
}
Example #5
0
$path = fetch_url_data();
$db = new sqldb2($DB_CONFIG);
$blog = new nlb_blog($db);
$config = new nlb_config($db);
require_once $config->langfile();
$user = new nlb_user($db);
$user->checkLogin();
if (isset($path['user'])) {
    /**
     *		Show page of blogs for user
     */
    $USERID = $path['user'];
    if (!is_numeric($USERID)) {
        jsRedirect(script_path . 'index.php');
    }
    $u = new nlb_user($db, $USERID);
    // $u is the user who's friends page we are viewing
    $page = 0;
    if (isset($path['page'])) {
        $page = $path['page'];
    }
    $perpage = $u->get('perpage');
    $page_start = $page * $perpage;
    // get avatar for this user
    $av = $db->getArray('SELECT file, isCustom FROM ' . db_avatars . ' WHERE owner_id=' . $USERID . ' AND type=1;');
    if (!empty($av)) {
        if ($av['isCustom'] == 1) {
            $file = 'avatars/';
        } else {
            $file = 'avatars/default/';
        }
Example #6
0
require_once 'config.php';
// require_once this before others!
require_once 'system/functions.php';
require_once 'system/ets_file.php';
require_once 'system/sqldb2.class.php';
require_once 'system/nlb_mail.class.php';
require_once 'system/nlb_blog.class.php';
require_once 'system/nlb_user.class.php';
require_once 'system/nlb_config.class.php';
require_once 'system/text.class.php';
require_once 'ets.php';
define('IN_NLB3', 'true');
$start = mymicrotime();
$db = new sqldb2($DB_CONFIG);
$config = new nlb_config($db);
$user = new nlb_user($db);
$user->checklogin();
include $config->langfile();
// include lang file
$b = new nlb_blog($db);
if (!$user->isLogedIn) {
    jsRedirect("login.php");
} else {
    // timezone setting
    $b->setDateOffset($config->get('server_timezone'), $user->get('timezone'));
}
$ets_outter->sitenav = buildMainNav($l, $user);
$ets->page_body = "";
//		N A V   L I N K S
$ets_outter->navtype = $l['ucp-nav-usercp'];
$i = 0;
Example #7
0
/**
 * =======================================
 *		E D I T   U S E R
 * =======================================
 */
if (!defined('IN_NLB3')) {
    echo 'NLB3 Denies Direct Access';
    exit;
}
$ets->page_body = '';
$baddata = false;
if (!isset($_GET['id'])) {
    jsRedirect('admincp.php?action=edit_user');
} else {
    $USERID = $_GET['id'];
    $edituser = new nlb_user($db, $USERID);
}
$text = new text($_POST, array('username', 'email', 'blog_count', 'timezone', 'access'), array('bio', 'custom'));
$text->validate();
$text->makeClean('trim', 'slash_if_needed');
if (!empty($_POST)) {
    // check data
    if ($text->is_missing_required) {
        $baddata = true;
    } else {
        $c = $text->clean;
        $c['timezone'] -= 13;
        foreach ($c as $key => $value) {
            $edituser->set($key, $value);
        }
        $per = '';
Example #8
0
    $ets->page_body = $l['denied'];
    break;
}
if (!isset($_GET['sub'])) {
    // can we edit our templates?
    if ($user->isAllowed('tpl_custom')) {
        // ask user which template to edit.
        $body = $l['ucp-choose-template'];
        $body = str_replace("%BLOG%", script_path . 'usercp.php?action=template&sub=blog', $body);
        $body = str_replace("%FRIENDS%", script_path . 'usercp.php?action=template&sub=friends', $body);
        $body = str_replace("%PROFILE%", script_path . 'usercp.php?action=template&sub=profile', $body);
        $ets->page_body .= $body;
    }
    // use pre-made templates?
    if ($user->isAllowed('tpl_change')) {
        if (isset($_POST['template']) && nlb_user::templateExists($_POST['template'])) {
            // Set the template
            $user->setTemplateSource($_POST['template'], $config->get('home_text'));
            $ets->page_body = $l['goodedit'];
        } else {
            $ets->page_body .= $l['ucp-tpl-change'];
            // direct from register.php:
            // build template preview <select> data
            $dir = dir(template_folder);
            while ($file = $dir->read()) {
                if (strtolower(getFileExt($file)) == 'gif') {
                    $preview[] = $file;
                }
            }
            $dir->close();
            $st = '<select name="template" onchange="document.images.temlpatePreview.src = \'templates/\' + this[this.selectedIndex].value + \'.gif\';">';
Example #9
0
require_once 'config.php';
// require_once this before others!
require_once 'system/functions.php';
require_once 'system/ets_sql.php';
require_once 'system/sqldb2.class.php';
require_once 'system/nlb_blog.class.php';
require_once 'system/nlb_user.class.php';
require_once 'system/nlb_config.class.php';
require_once 'system/text.class.php';
require_once 'ets.php';
$path = fetch_url_data();
$db = new sqldb2($DB_CONFIG);
$blog = new nlb_blog($db);
$config = new nlb_config($db);
include $config->langfile();
$user = new nlb_user($db);
$user->checkLogin();
if (!isset($path['user'])) {
    jsRedirect(script_path . 'index.php');
    // need a user id!!
} else {
    $USERID = $path['user'];
    if (!is_numeric($USERID)) {
        jsRedirect(script_path . 'index.php');
    }
    // get info on user
    $info = $db->getArray('
	SELECT username, email, blog_count, birthday, gender, registered, bio 
	FROM ' . db_users . ' 
	WHERE user_id="' . $USERID . '" 
	LIMIT 1;');
Example #10
0
	should be packaged with this product.
	-----------------------------------------
*/
require_once 'config.php';
require_once 'system/functions.php';
require_once 'system/ets_file.php';
require_once 'system/sqldb2.class.php';
require_once 'system/nlb_user.class.php';
require_once 'system/nlb_config.class.php';
require_once 'system/nlb_blog.class.php';
require_once 'system/nlb_mail.class.php';
require_once 'system/text.class.php';
require_once 'ets.php';
session_start();
$db = new sqldb2($DB_CONFIG);
$user = new nlb_user($db);
$config = new nlb_config($db);
$blog = new nlb_blog($db);
$user->checkLogin();
include $config->langfile();
$start = mymicrotime();
$ets = new stdclass();
/**
 * =======================================
 *	S E A R C H   B L O G S
 * =======================================
 */
/*		===== QUERY TEMPLATE ======
SELECT u.username, b.blog_id, b.author_id, b.date, b.subject, b.body, b.comments, b.html, b.smiles, b.bb,
FROM nlb3_blogs AS b, nlb3_users AS u
WHERE u.user_id = b.author_id AND b.access = public AND b.body LIKE "%text%" AND 
Example #11
0
// require_once this before others!
require_once 'system/functions.php';
require_once 'system/ets_file.php';
require_once 'system/sqldb2.class.php';
// NLB Class library
require_once 'system/nlb_blog.class.php';
require_once 'system/nlb_user.class.php';
require_once 'system/nlb_config.class.php';
require_once 'system/text.class.php';
require_once 'ets.php';
// Sweet template library
define('IN_NLB3', 'true');
$start = mymicrotime();
$db = new sqldb2($DB_CONFIG);
$config = new nlb_config($db);
$user = new nlb_user($db);
$user->checklogin();
require_once $config->langfile();
// require_once lang file
$b = new nlb_blog($db);
if (!$user->isLogedIn) {
    jsRedirect("login.php");
} else {
    $b->setDateOffset($config->get('server_timezone'), $user->get('timezone'));
}
if (!$user->isAllowed('admin')) {
    jsRedirect('index.php');
}
$ets_outter->sitenav = buildMainNav($l, $user);
$ets->page_body = "";
//		N A V   L I N K S
Example #12
0
 /**
  * =======================================
  *		Show page of blogs
  * =======================================
  */
 $USERID = $path['user'];
 if (!is_numeric($USERID)) {
     jsRedirect(script_path . 'index.php');
 }
 // user exists?
 $test = $db->getArray('SELECT count(user_id) as c FROM ' . db_users . ' WHERE user_id="' . $USERID . '";');
 if ($test['c'] == 0) {
     // bad user id
     jsRedirect(script_path . 'index.php');
 }
 $u = new nlb_user($db, $USERID);
 $page = 0;
 if (isset($path['page'])) {
     $page = $path['page'];
 }
 $perpage = $u->get('perpage');
 $page_start = $page * $perpage;
 // get count of all the blogs
 $total = $u->get('blog_count');
 // setup some vars for the query
 $limit = $page_start . ', ' . $perpage;
 // check to see what blogs we can view
 $access_in = access_public;
 // default is public blogs only.
 if ($user->isLogedIn) {
     // if we are the author, we can see all
Example #13
0
	-----------------------------------------
*/
require_once 'config.php';
require_once 'system/functions.php';
require_once 'system/ets_file.php';
require_once 'system/sqldb2.class.php';
require_once 'system/nlb_blog.class.php';
require_once 'system/nlb_user.class.php';
require_once 'system/nlb_config.class.php';
require_once 'system/text.class.php';
require_once 'ets.php';
$start = mymicrotime();
$db = new sqldb2($DB_CONFIG);
$config = new nlb_config($db);
$blog = new nlb_blog($db);
$user = new nlb_user($db);
$user->checklogin();
if (!isset($_POST['parent']) || empty($_POST['parent'])) {
    jsRedirect('index.php');
}
$parent = $_POST['parent'];
// get some info about this blog
$info = $db->getArray('SELECT access, comments FROM ' . db_blogs . ' WHERE blog_id="' . $parent . '" LIMIT 1;');
// if anything goes wrong, decide where we will go.
if ($info['access'] == access_news) {
    $go = build_link('index.php', array('action' => 'comment', 'id' => $parent));
} else {
    $go = build_link('blog.php', array('id' => $parent));
}
// are we alowed to blog here?
if ($info['comments'] == -1) {