/**
  * Initialises the session.
  */
 public function init()
 {
     // handle language id
     if ($this->user->userID) {
         $this->languageID = $this->user->languageID;
     } else {
         if (($languageID = $this->getVar('languageID')) !== null) {
             $this->languageID = $languageID;
         }
     }
     // init user session
     $this->user->init();
 }
Example #2
0
 public function __construct()
 {
     parent::__construct();
     // initializers for all the domain-specific core classes
     // they are here instead of the initializer in order to them to be able to access this controller instance from their static methods
     //
     Estado::init();
     Municipio::init();
     Parroquia::init();
     User::init();
     Log::init();
     // register this controller in the Log class
     // this is neccesary when working with multiples controllers (in non-standalone mode, for example)
     //
     Log::register_me($this);
     $this->load->database();
     $this->lang->load('db', 'spanish');
     $this->lang->load('form_validation', 'spanish');
 }
Example #3
0
    // points js to images & scripts
    define('STATIC_URL', ($secure ? 'https://' : 'http://') . CFG_STATIC_HOST);
}
if (defined('CFG_SITE_HOST')) {
    // points js to executable files
    define('HOST_URL', ($secure ? 'https://' : 'http://') . CFG_SITE_HOST);
}
if (!CLI) {
    if (!defined('CFG_SITE_HOST') || !defined('CFG_STATIC_HOST')) {
        die('error: SITE_HOST or STATIC_HOST not configured');
    }
    // Setup Session
    session_set_cookie_params(15 * YEAR, '/', '', $secure, true);
    session_cache_limiter('private');
    session_start();
    if (!empty($AoWoWconf['aowow']) && User::init()) {
        User::save();
    }
    // save user-variables in session
    // hard-override locale for this call (should this be here..?)
    // all strings attached..
    if (!empty($AoWoWconf['aowow'])) {
        if (isset($_GET['locale']) && CFG_LOCALES & 1 << (int) $_GET['locale']) {
            User::useLocale($_GET['locale']);
        }
        Lang::load(User::$localeString);
    }
    // parse page-parameters .. sanitize before use!
    $str = explode('&', $_SERVER['QUERY_STRING'], 2)[0];
    $_ = explode('=', $str, 2);
    $pageCall = $_[0];
Example #4
0
 public static function registration()
 {
     SystemEvent::raise(SystemEvent::DEBUG, "Called.", __METHOD__);
     //
     // Check for validity
     //
     if (empty($_POST['registrationForm']['name']['value']) || empty($_POST['registrationForm']['email']['value']) || empty($_POST['registrationForm']['username']['value']) || empty($_POST['registrationForm']['password']['value']) || empty($_POST['registrationForm']['password2']['value'])) {
         SystemEvent::raise(SystemEvent::DEBUG, "User registration failed, required attributes were empty.", __METHOD__);
         echo json_encode(array('success' => false, 'error' => 'Please fill in all input fields.'));
         exit;
     } else {
         if ($_POST['registrationForm']['password']['value'] != $_POST['registrationForm']['password2']['value']) {
             SystemEvent::raise(SystemEvent::DEBUG, "Passwords don't match.", __METHOD__);
             echo json_encode(array('success' => false, 'error' => "The passwords don't match."));
             exit;
         } else {
             $user = User::getByUsername($_POST['registrationForm']['username']['value']);
             if ($user instanceof User) {
                 SystemEvent::raise(SystemEvent::DEBUG, "Username already taken.", __METHOD__);
                 echo json_encode(array('success' => false, 'error' => 'The username you provided is already taken.'));
                 exit;
             }
             $user = null;
             unset($user);
         }
     }
     //
     // Everything ok, let's register the new user
     //
     $user = new User();
     $user->setEmail($_POST['registrationForm']['email']['value']);
     //$user->setNotificationEmails($_POST['registrationForm']['email']['value']);
     $user->setName($_POST['registrationForm']['name']['value']);
     $user->setUsername($_POST['registrationForm']['username']['value']);
     $user->setCos(UserCos::USER);
     $user->init();
     $user->setPassword($_POST['registrationForm']['password']['value']);
     //
     // Log the user in
     //
     /*
     Auth::authenticate();
     */
     SystemEvent::raise(SystemEvent::INFO, "New user created. [USERNAME={$user->getUsername()}]", __METHOD__);
     echo json_encode(array('success' => true, 'error' => 'Registration was successful, taking you to the login prompt. Stand by...'));
     exit;
 }
Example #5
0
 public static function install()
 {
     session_destroy();
     //
     // Create necessary dirs
     //
     if (!file_exists(CINTIENT_WORK_DIR) && !mkdir(CINTIENT_WORK_DIR, DEFAULT_DIR_MASK, true)) {
         SystemEvent::raise(SystemEvent::ERROR, "Could not create working dir. Check your permissions.", __METHOD__);
         echo "Error";
         // TODO: treat this properly
         exit;
     }
     if (!file_exists(CINTIENT_PROJECTS_DIR) && !mkdir(CINTIENT_PROJECTS_DIR, DEFAULT_DIR_MASK, true)) {
         SystemEvent::raise(SystemEvent::ERROR, "Could not create projects dir. Check your permissions.", __METHOD__);
         echo "Error";
         // TODO: treat this properly
         exit;
     }
     if (!file_exists(CINTIENT_ASSETS_DIR) && !mkdir(CINTIENT_ASSETS_DIR, DEFAULT_DIR_MASK, true)) {
         SystemEvent::raise(SystemEvent::ERROR, "Could not create assets dir. Check your permissions.", __METHOD__);
         echo "Error";
         // TODO: treat this properly
         exit;
     }
     if (!file_exists(CINTIENT_AVATARS_DIR) && !mkdir(CINTIENT_AVATARS_DIR, DEFAULT_DIR_MASK, true)) {
         SystemEvent::raise(SystemEvent::ERROR, "Could not create avatars dir. Check your permissions.", __METHOD__);
         echo "Error";
         // TODO: treat this properly
         exit;
     }
     //
     // Setup all objects
     //
     if (!User::install()) {
         SystemEvent::raise(SystemEvent::ERROR, "Could not setup User object.", __METHOD__);
         echo "Error";
         // TODO: treat this properly
         exit;
     }
     if (!Project::install()) {
         SystemEvent::raise(SystemEvent::ERROR, "Could not setup Project object.", __METHOD__);
         echo "Error";
         // TODO: treat this properly
         exit;
     }
     if (!SystemSettings::install()) {
         SystemEvent::raise(SystemEvent::ERROR, "Could not setup SystemSettings object.", __METHOD__);
         echo "Error";
         // TODO: treat this properly
         exit;
     }
     //
     // Test user setup
     //
     $user = new User();
     $user->setEmail('*****@*****.**');
     $user->setNotificationEmails('pedro.matamouros@gmail.com,');
     $user->setName('Pedro Mata-Mouros');
     $user->setUsername('matamouros');
     $user->setCos(UserCos::ROOT);
     $user->init();
     $user->setPassword('pedro');
     header('Location: ' . UrlManager::getForDashboard());
     exit;
 }
Example #6
0
File: index.php Project: nikis/Go
    }
}
class User extends Database
{
    public $name = "users";
    public $attributes = array('id' => array('type' => 'integer', 'primary', 'auto_increment'), 'email' => array('type' => 'string', 'unique'), 'password' => array('type' => 'password'), 'gender' => array('type' => 'enum', 'values' => array('male', 'female')), 'date_created' => array('type' => 'integer', 'default' => 'unixtime'));
    public function type_password($value, $reverse)
    {
        if ($reverse) {
            return $value;
            // just back the given value
        }
        return md5($value);
    }
}
$user = User::init();
for ($i = 1; $i <= 10; $i++) {
    try {
        $newUser = $user->row()->create(array('email' => 'user' . $i . '@mail.com', 'password' => 'user_pass' . $i, 'gender' => 'male'));
        ech($newUser->id, 'with', $newUser->email, 'is created');
    } catch (onDuplicateRow $e) {
        ech($e->getRow()->email, 'already exist');
    }
}
$row = $user->first();
ech('First', $row->email, 'or', $user->result->email);
$row = $user->last();
ech('Last', $row->email, 'or', $user->result->email);
$user->all();
foreach ($user->result as $userRow) {
    ech('User', $userRow->email, 'is', $userRow->gender);
Example #7
0
$config = new Blog($_SERVER['HTTP_HOST']);
$site = $config->getSiteData($config->site);
$site['media']['photos']['front-page'] = $config->getPhotoAds($site['creator'], 'freelabel front', 8);
$site['media']['photos']['ads'] = $config->getPhotoAds($site['creator'], 'current-promo', 10);
$r = rand(0, 6);
// echo '<pre>';
// var_dump($r);
// echo '<hr>';
// var_dump($site['media']['photos']['front-page']);
// exit;
/* load page title */
$site['page_title'] = $config->getPageTitle(strtoupper($_GET['url']));
// LOAD USER DATA
$user = new User();
if (isset($_SESSION) && count($_SESSION) > 0) {
    $site['user'] = $user->init($_SESSION, $_COOKIE);
    $user_logged_in = new UserDashboard(Session::get('user_name'));
    $site['user']['profile-photo'] = $profile_photo = $config->getProfilePhoto(Session::get('user_name'));
    if (isset($site['user']['name'])) {
        $site['user']['media'] = $user_data = $user_logged_in->getUserMedia(Session::get('user_name'));
    }
} else {
    //   //$site['user'] = $user->init(,$_COOKIE);
    //   $site['user']['name'] = 'admin';
    //   $user_logged_in = new UserDashboard('admin');
    //   $site['user']['media'] = $user_logged_in->getUserMedia('admin');
}
$front_page_photos = $config->getPhotoAds($site['creator'], 'front');
shuffle($front_page_photos);
if ($user_name = Session::get('user_name')) {
    $upload_link = 'http://freelabel.net/upload/?uid=' . $user_name;
Example #8
0
<?php

require_once __DIR__ . "/../bourbon/user.php";
$u = new User();
$u->auth(null);
$u->init(WEB::_get('id'));
?>


<?php 
if (!$u->valid()) {
    ?>
	<!-- // Invalid Record -->
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
		<h4 class="modal-title">Invalid User. Check Id #!</h4>
	</div>
	<div class="modal-body">
		<p>It looks like you were trying to access a user that we no longer have.</p>
	</div>
<?php 
} else {
    ?>
	<!-- // Valid Record -->
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
		<h4 class="modal-title"><strong><?php 
    echo $u->getUserName();
    ?>
</strong></h4>
	</div>
 function profile($params)
 {
     global $Database;
     if (empty($params)) {
         if ($this->Auth->isLoggedIn()) {
             $this->redirect(array('controller' => 'users', 'action' => 'profile', 'params' => array($this->Auth->User->id)));
         } else {
             $this->redirect(array('controller' => 'users', 'action' => 'login'));
         }
     }
     $User = new User();
     $User->id = $params[0];
     $User->init();
     if (empty($User->data)) {
         $this->redirect(array('controller' => 'users', 'action' => 'index'));
     }
     $this->set('User', $User);
     // Get active games
     $active_games = $Database->fetchObjects('Game', "\r\n\t\t\tSELECT `id`\r\n\t\t\tFROM `games`\r\n\t\t\tWHERE `games`.`status` = 'active'\r\n\t\t\t  AND (`games`.`active_user_id`   = {$User->id} OR `games`.`inactive_user_id` = {$User->id})\r\n\t\t");
     $this->set('active_games', $active_games);
 }
Example #10
0
<?php

require __DIR__ . "/bourbon/user.php";
$p = new User();
$p->auth(null);
$p->init(null);
$status_message = '';
// Generate New API Key
if (WEB::_action('generate_new_api_key')) {
    if (!$p->generateNewApiKey()) {
        $status_message = WEB::_error('Failed to Genereate New API Key!', null);
    }
}
if (!$p->valid()) {
    $status_message = WEB::_error('User couldn\'t be viewed. Check ID #!', null);
}
// Handle Post Request
if (WEB::_action('update')) {
    $user_name = WEB::_post('user_name');
    $user_email = WEB::_post('user_email');
    $user_password = WEB::_post('user_password');
    $user_notify = WEB::_post('user_notify');
    // Passed as: array($user_name, user_email, user_password)
    $form_error = $p->validateParams(array($user_name, $user_email, $user_password));
    if (is_null($form_error)) {
        $updateStatus = $p->updateUserName($user_name);
        if ($updateStatus) {
            $updateStatus = $p->updateUserEmail($user_email);
        }
        if ($updateStatus) {
            $updateStatus = $p->updateUserPassword($user_password);
 case 'renew':
     if (Site::getSessionUid() !== getRequest('uid') && !checkAuthority(9)) {
         handle(ERROR_PERMISSION . '01');
     }
     $currentUser = new User();
     $currentUser->uid = getRequest('uid');
     $response = json_decode($currentUser->getData(), true);
     if (!password_verify(md5($response['username'] . getRequest('password_old') . '.cc'), $response['password'])) {
         handle(ERROR_PERMISSION . '02' . '密码错误!');
     }
     $password_new = getRequest('password_new');
     if ($password_new === '') {
         $password_new = getRequest('password_old');
     }
     $password_new = password_hash(md5($response['username'] . $password_new . '.cc'), PASSWORD_BCRYPT);
     $currentUser->init($response['username'], $password_new, $response['email'], $response['level']);
     if (!$currentUser->checkVariables()) {
         handle(ERROR_INPUT . '01');
     }
     $response = $currentUser->modify();
     if ($response === false) {
         handle(ERROR_SYSTEM . '00');
     } else {
         handle('0000');
     }
     break;
 case 'changeLevel':
     if (!checkAuthority(9)) {
         handle(ERROR_PERMISSION . '01');
     }
     $uid = getRequest('uid');
Example #12
0
 public function init()
 {
     parent::init();
     $this->remove('userId')->remove('firstname')->remove('lastname')->remove('passwd-confirm')->remove('role')->remove('dateCreated')->remove('dateModified');
     $this->add(['name' => 'rememberme', 'type' => 'checkbox', 'options' => ['label' => 'Remember Me:', 'use_hidden_element' => true, 'checked_value' => 1, 'unchecked_value' => 0]]);
 }
Example #13
0
     SystemEvent::raise(CINTIENT_LOG_SEVERITY_ERROR, $msg, "Installer");
     sendResponse($ok, $msg);
 }
 $settings = SystemSettings::load();
 $settings->setSetting(SystemSettings::VERSION, CINTIENT_INSTALLER_VERSION);
 if (!$upgrade) {
     //
     // Root user account
     //
     $user = new User();
     $user->setEmail($get['email']);
     $user->setNotificationEmails($get['email'] . ',');
     $user->setName('Administrative Account');
     $user->setUsername('root');
     $user->setCos(2);
     $user->init();
     $user->setPassword($get['password']);
 }
 // Just to make sure everything's neat and tidy, especially after
 // an upgrade.
 Database::execute('VACUUM');
 //
 // Last step: remove the installation file
 //
 if (!@unlink(__FILE__)) {
     $ok = false;
     $msg = "Couldn't remove the installation 'index.php' file. You need " . "to remove this manually before refreshing this page, or else" . " Cintient won't be able to start";
     sendResponse($ok, $msg);
 }
 //
 // Set a special cookie "one-time" cookie so that right after the
Example #14
0
/**
 * Loads all the functions,interfaces,classes
 * @param String $paramLibFolder path to lib folder
 */
function load($paramLibFolder)
{
    define('REVISION', 105);
    define('OSC_VERSION', '1.1b');
    //REGISTER NEW FUNCTIONS, INTERFACES, (ABSTRACT) CLASSES, EXCEPTIONS HERE! :D
    $orongo_functions = array('orongo_query', 'handleSessions', 'l', 'setCurrentPage', 'setDatabase', 'setDisplay', 'setLanguage', 'setMenu', 'setPlugins', 'setStyle', 'setUser');
    $orongo_interfaces = array('IHTMLConvertable', 'IJSConvertable', 'IOrongoPlugin', 'IOrongoStyle', 'IOrongoTerminalPlugin', 'IStorable');
    $orongo_abstracts = array('OrongoDisplayableObject', 'OrongoPluggableObject', 'OrongoFrontendObject');
    $orongo_classes = array('AjaxAction', 'CommentPoster', 'CommentLoader', 'Article', 'Cache', 'Comment', 'Database', 'Display', 'Issue', 'IssueTracker', 'Language', 'MailFactory', 'Menu', 'MessageBox', 'OrongoDefaultEventHandlers', 'OrongoEvent', 'OrongoNotifier', 'OrongoNotification', 'OrongoQuery', 'OrongoQueryHandler', 'OrongoTerminal', 'OrongoUpdateChecker', 'Page', 'Plugin', 'Security', 'Session', 'Settings', 'Storage', 'Style', 'User');
    $orongo_exceptions = array('ClassLoadException', 'IllegalArgumentException', 'IllegalMemoryAccessException', 'OrongoScriptParseException', 'QueryException');
    $orongo_function_packages = array('Utils');
    $orongo_frontend_objects = array('AdminFrontend', 'ArchiveFrontend', 'ErrorFrontend', 'PageFrontend', 'IndexFrontend', 'ArticleFrontend');
    $orongo_script_core = array('OrongoFunction', 'OrongoPackage', 'OrongoScriptPluginBridge', 'OrongoScriptParser', 'OrongoScriptRuntime', 'OrongoVariable', 'OrongoList');
    $raintpl_path = $paramLibFolder . '/rain.tpl.class.php';
    if (!file_exists($raintpl_path)) {
        throw new Exception("Couldn't load RainTPL (" . $raintpl_path . " was missing!)");
    }
    require $raintpl_path;
    $meekro_path = $paramLibFolder . '/meekrodb.2.0.class.php';
    if (!file_exists($meekro_path)) {
        throw new Exception("Could't load MeekroDB (" . $meekro_path . " was missing!)");
    }
    require $meekro_path;
    $ckeditor_path = $paramLibFolder . "/ckeditor/ckeditor_php5.php";
    if (!file_exists($ckeditor_path)) {
        throw new Exception("Could't load CKEditor (" . $ckeditor_path . " was missing!)");
    }
    require $ckeditor_path;
    $ckfinder_path = $paramLibFolder . "/ckfinder/core/ckfinder_php5.php";
    if (!file_exists($ckfinder_path)) {
        throw new Exception("Could't load CKFinder (" . $ckfinder_path . " was missing!)");
    }
    require $ckfinder_path;
    foreach ($orongo_interfaces as $interface) {
        if (!interface_exists($interface)) {
            $path = $paramLibFolder . '/I/' . $interface . '.php';
            if (!file_exists($path)) {
                throw new Exception("Couldn't load all interfaces (" . $path . " was missing!)");
            }
            require $path;
        }
    }
    foreach ($orongo_abstracts as $abstract) {
        if (!class_exists($abstract)) {
            $path = $paramLibFolder . '/class_' . $abstract . '.php';
            if (!file_exists($path)) {
                throw new Exception("Couldn't load all classes (" . $path . " was missing!)");
            }
            require $path;
        }
    }
    foreach ($orongo_exceptions as $exception) {
        if (!class_exists($exception)) {
            $path = $paramLibFolder . '/E/' . $exception . '.php';
            if (!file_exists($path)) {
                throw new Exception("Couldn't load all exceptions (" . $path . " was missing!)");
            }
            require $path;
        }
    }
    foreach ($orongo_classes as $class) {
        if (!class_exists($class)) {
            $path = $paramLibFolder . '/class_' . $class . '.php';
            if (!file_exists($path)) {
                throw new Exception("Couldn't load all classes (" . $path . " was missing!)");
            }
            require $path;
        }
    }
    foreach ($orongo_functions as $function) {
        if (!function_exists($function)) {
            $path = $paramLibFolder . '/function_' . $function . '.php';
            if (!file_exists($path)) {
                throw new Exception("Couldn't load all functions (" . $path . " was missing!)");
            }
            require $path;
        }
    }
    foreach ($orongo_function_packages as $function_package) {
        $path = $paramLibFolder . '/function_package_' . $function_package . '.php';
        if (!file_exists($path)) {
            throw new Exception("Couldn't load all function packages (" . $path . " was missing!)");
        }
        require $path;
    }
    foreach ($orongo_frontend_objects as $frontend_object) {
        if (!class_exists($frontend_object)) {
            $path = $paramLibFolder . '/FO/frontend_' . $frontend_object . '.php';
            if (!file_exists($path)) {
                throw new Exception("Couldn't load all frontend objects (" . $path . " was missing!)");
            }
            require $path;
        }
    }
    foreach ($orongo_script_core as $os_core) {
        if (!class_exists($os_core)) {
            $path = $paramLibFolder . '/OrongoScript/orongocore_' . $os_core . '.php';
            if (!file_exists($path)) {
                throw new Exception("Couldn't load the OrongoScript core objects (" . $path . " was missing!)");
            }
            require $path;
        }
    }
    Article::init();
    User::init();
    Page::init();
    Comment::init();
}
Example #15
0
         $response['success'] = 0;
     }
     echo json_encode($response);
     break;
 case 'POST':
     break;
 case 'PUT':
     break;
 case 'PATCH':
     $data = file_get_contents('php://input');
     $patch_post = json_decode($data);
     //print_r($patch_post);exit();
     //echo $data;
     $phone = $pt[1];
     require_once 'db_connect.php';
     $user = User::init(User::findWithPhone($phone));
     //print_r($user);
     $response = array();
     if (!$user) {
         $response['success'] = 0;
         $response['message'] = 'an error occured';
         $response['error'] = 'couldn\'t get current user';
     } else {
         foreach ($patch_post as $patch_action) {
             //todo append the patch operation results
             switch ($patch_action->op) {
                 case 'add':
                     //$spouse = User::init(User::findWithPhone($patch_action->value));//todo use path value of path
                     //print_r($spouse);
                     //break;
                     if ($user->engageTo($patch_action->value)) {
Example #16
0
<?php

//error_reporting(E_ERROR | E_PARSE);
require_once 'php/user.php';
if (!isset($_SESSION['token'])) {
    session_start();
} else {
    //header("Location: http://localhost/Hicrete_Repo/HicreteWebApp/Hicrete_WebApp/index.html");
    header("Location: index.html");
    exit;
}
$userId = $_SESSION['token'];
$userObj = new User();
if (!$userObj->init($userId)) {
    session_destroy();
    //header("Location: http://localhost/Hicrete_Repo/HicreteWebApp/Hicrete_WebApp/index.html");
    header("Location: index.html");
    exit;
}
?>


<!DOCTYPE html>
<html lang="en">
<head>
    <!-- META SECTION -->
    <title>Hi-crete Web Solution</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
Example #17
0
 private function doSignIn()
 {
     // check username
     if (!User::isValidName($this->_post['username'])) {
         return Lang::account('userNotFound');
     }
     // check password
     if (!User::isValidPass($this->_post['password'])) {
         return Lang::account('wrongPass');
     }
     switch (User::Auth($this->_post['username'], $this->_post['password'])) {
         case AUTH_OK:
             if (!User::$ip) {
                 return Lang::main('intError');
             }
             // reset account status, update expiration
             DB::Aowow()->query('UPDATE ?_account SET prevIP = IF(curIp = ?, prevIP, curIP), curIP = IF(curIp = ?, curIP, ?), allowExpire = ?d, status = IF(status = ?d, status, 0), statusTimer = IF(status = ?d, statusTimer, 0), token = IF(status = ?d, token, "") WHERE user = ?', User::$ip, User::$ip, User::$ip, $this->_post['remember_me'] != 'yes', ACC_STATUS_NEW, ACC_STATUS_NEW, ACC_STATUS_NEW, $this->_post['username']);
             if (User::init()) {
                 User::save();
             }
             // overwrites the current user
             return;
         case AUTH_BANNED:
             if (User::init()) {
                 User::save();
             }
             return Lang::account('accBanned');
         case AUTH_WRONGUSER:
             User::destroy();
             return Lang::account('userNotFound');
         case AUTH_WRONGPASS:
             User::destroy();
             return Lang::account('wrongPass');
         case AUTH_IPBANNED:
             User::destroy();
             return sprintf(Lang::account('loginExceeded'), Util::formatTime(CFG_ACC_FAILED_AUTH_BLOCK * 1000));
         case AUTH_INTERNAL_ERR:
             User::destroy();
             return Lang::main('intError');
         default:
             return;
     }
 }
Example #18
0
/**** Initialise ****/
date_default_timezone_set('Europe/London');
require_once BASEPATH . 'lib/Venue.php';
require_once BASEPATH . 'lib/Event.php';
require_once BASEPATH . 'lib/User.php';
require_once BASEPATH . 'lib/Feeds.php';
require_once BASEPATH . 'lib/template_utils.php';
$options = parse_ini_file(BASEPATH . 'echo.ini', true);
define("READONLY", $options['db']['readonly']);
$f3->set('readonly', READONLY);
$f3->set('version', VERSION);
$f3->set('DEBUG', $options['general']['debug']);
$f3->set("domain", $options['general']['domain']);
$db = new DB\SQL("sqlite:" . BASEPATH . $options['general']['db']);
Events::init($db);
User::init($db);
Feeds::init($db);
$f3->set('appname', $options['general']['name']);
function admin_check($reroute = TRUE)
{
    global $f3;
    if (!isset($_SESSION['admin'])) {
        if ($reroute) {
            $f3->reroute("/admin/login");
            exit;
        }
    } else {
        $f3->set("admin", TRUE);
    }
}
function readonly_check()
Example #19
0
 /**
  * Test
  *
  * @return void
  */
 public function testInit()
 {
     $this->assertNull($this->object->init());
 }
Example #20
0
        return $this->_passwordHash;
    }
    public function validatePassword($password)
    {
        return $this->hashPassword($password) == $this->getHashedPassword();
    }
    public function displayName()
    {
        return $this->username;
    }
    public function preSavePassword($password)
    {
        return $this->_passwordHash;
    }
    public function postLoadPassword($password)
    {
        $this->_passwordHash = $password;
        return null;
    }
    public function filterPassword($password)
    {
        $this->_passwordHash = empty($password) ? $this->_passwordHash : self::hashPassword($password);
        return null;
    }
    public function getPassword()
    {
        return $this->_passwordHash;
    }
}
User::init();
Example #21
0
                $forgotPassword = 1;
                include scriptPath . '/' . folderUsers . '/include/form/userPasswordForm.php';
            } else {
                echo '<p>' . $lForgotPassword["InvalidKey"] . '</p>';
            }
        }
    }
} else {
    if (!empty($send) && (!empty($username) || !empty($email))) {
        // Find user in database
        $user = new User();
        if (!empty($email)) {
            $result = $dbi->query("SELECT id FROM " . userDataTableName . " WHERE email=" . $dbi->quote($email));
            if ($result->rows()) {
                list($id) = $result->fetchrow_array();
                $user->init($id);
            }
        } else {
            if (!empty($username)) {
                $user->init(0, $username);
            }
        }
        if (!empty($user->id)) {
            // Generate new key and insert into database
            $key = generateRandomString(32);
            $dbi->query("UPDATE " . userTableName . " SET activated=1,registered=registered,lastLogged=lastLogged,lastUpdated=lastUpdated,activationKey=" . $dbi->quote($key) . " WHERE id=" . $dbi->quote($user->id));
            $link = scriptUrl . '/' . fileProfileForgotPassword . '?id=' . $user->id . '&amp;key=' . $key;
            $subject = $lForgotPassword["MailSubject"];
            $message = sprintf($lForgotPassword["MailMessage"], $link, $link);
            // Create plain text version
            $h2t =& new html2text($message);
Example #22
0
 /**
  * 初始化程序
  */
 public static function init()
 {
     if (defined('CO_PATH')) {
         self::$controllerPath = CO_PATH;
     } else {
         self::$controllerPath = APP_PATH . 'controller' . DS;
     }
     // 设置程序编码
     mb_internal_encoding($GLOBALS['_charset']);
     // 输出内容格式
     header('content-type:text/html;charset=' . $GLOBALS['_charset']);
     // 初始化错误处理函数
     self::initSystemHandlers();
     // 加载框架核心语言包
     self::loadCoreLang();
     // 初始化用户信息
     User::init();
 }
Example #23
0
function initializeTimeoutServices()
{
    // Ez a fuggveny a gorumban nincs felhivva. Ha az applikacioban
    // netalantan felhivnank, akkor ott kell gondoskodni rola, hogy a
    // leszarmazott userben a lastClickTime attributum benne legyen.
    global $gorumuser, $now;
    $gorumuser->lastClickTime = time();
    $user = new User();
    $user->init(array("id" => $gorumuser->id, "lastClickTime" => $gorumuser->lastClickTime));
    modify($user);
    return ok;
}