Пример #1
0
 public function actionShowLesson()
 {
     $auth = Auth::checkAuth();
     $view = new View();
     $view->auth = $auth;
     if (!isset($_GET['id'])) {
         header("Location: /learns/");
     }
     if ($auth) {
         $user = Auth::getUser();
         $id = $_GET['id'];
         $lesson = Lessons::getLesson($id);
         $course = Courses::getCourse($lesson->course_id);
         $lesson_prew = Lessons::getLessonByNumber($lesson->lesson_number - 1, $lesson->course_id);
         $lesson_next = Lessons::getLessonByNumber($lesson->lesson_number + 1, $lesson->course_id);
         $view->user_login = $user->user_login;
         $view->user_group = $user->user_group;
         $view->lesson = $lesson;
         $view->course = $course;
         $view->lesson_prew = $lesson_prew;
         $view->lesson_next = $lesson_next;
         $view->display('header.php');
         $view->display('lessons/lesson_view.php');
         $view->display('footer.php');
     } else {
         header("Location: /learns/");
     }
 }
Пример #2
0
 /**
  * checkAuth
  *
  * PEAR::Auth標準の認証処理に加えて、OPENPNE_URL及び
  * USER_AGENTのチェックもおこなう
  *
  * @return bool
  * @see PEAR::Auth::checkAuth
  */
 function checkAuth()
 {
     if (!$this->auth->checkAuth()) {
         return false;
     }
     if (OPENPNE_SESSION_CHECK_URL) {
         $openpne_url = $this->auth->getAuthData('OPENPNE_URL');
         if ($openpne_url !== OPENPNE_URL) {
             return false;
         }
     }
     if ($this->is_check_user_agent) {
         $login_user_agent = $this->auth->getAuthData('USER_AGENT');
         $now_user_agent = $_SERVER['HTTP_USER_AGENT'];
         // ドコモ端末からのアクセスの場合、ユーザエージェント情報から個体識別情報を取り除く
         if ($GLOBALS['__Framework']['carrier'] == 'i') {
             if (strncmp($now_user_agent, 'DoCoMo/1.0', 10) === 0) {
                 $login_user_agent = substr($login_user_agent, 0, strpos($login_user_agent, '/ser'));
                 $now_user_agent = substr($now_user_agent, 0, strpos($now_user_agent, '/ser'));
             } elseif (strncmp($now_user_agent, 'DoCoMo/2.0', 10) === 0) {
                 $login_user_agent = substr($login_user_agent, 0, strpos($login_user_agent, '('));
                 $now_user_agent = substr($now_user_agent, 0, strpos($now_user_agent, '('));
             }
         }
         if ($now_user_agent !== $login_user_agent) {
             return false;
         }
     }
     return true;
 }
Пример #3
0
 public function actionShow()
 {
     $id = $_GET['id'];
     $auth = Auth::checkAuth();
     if ($auth) {
         $user = Users::findOneByPK($auth);
         $user->getProfile();
     }
     $courses = Courses::findAllByColumn('parent_id', $id);
     $view = new View();
     $view->user = $user;
     $view->courses = $courses;
     //  $view->user_login = $user->user_login;
     // $view->user_group = $user->user_group;
     $parent_course = Courses::findOneByPK($id);
     $crumbs = Breadcrumbs::getCrumbs($parent_course);
     $view->crumbs = $crumbs;
     $view->page_title = $parent_course->name;
     $view->display('header.php');
     if (isset($id)) {
         $view->display('courses/child-list.php');
     } else {
         $view->display('courses/list.php');
     }
     $view->display('footer.php');
 }
Пример #4
0
 public function actionRegister()
 {
     $auth = Auth::checkAuth();
     if (!$auth) {
         $view = new View();
         $view->display('header.php');
         $view->display('auth/register.php');
         $view->display('footer.php');
     } else {
         header("Location: " . BASE_PATH . 'users/');
     }
 }
Пример #5
0
 /**
  * Uses PEAR's Auth class to authenticate the user against a container.
  * This allows us to use LDAP, a different database or some other
  * external system.
  *
  * @param string $username Username to check
  * @param string $password Password to check
  *
  * @return boolean If the user has been successfully authenticated or not
  */
 public function loginAuth($username, $password)
 {
     $this->auth->post = array('username' => $username, 'password' => $password);
     $this->auth->start();
     if (!$this->auth->checkAuth()) {
         return false;
     }
     //put user in database
     if (!$this->getUserByUsername($username)) {
         $this->addUser($username, $password, $username . $GLOBALS['authEmailSuffix']);
     }
     return true;
 }
Пример #6
0
 public function actionPanel()
 {
     $auth = Auth::checkAuth();
     $view = new View();
     $view->auth = $auth;
     if ($auth) {
         $user = Auth::getUser();
         $view->display('header.php');
         $view->display('admin/main.php');
         $view->display('footer.php');
         $view->admin = $admin;
     } else {
         header("Location: /learns/");
     }
 }
Пример #7
0
 public function actionShow()
 {
     $courses = Courses::findAllByColumn('parent_id', 0);
     $auth = Auth::checkAuth();
     if ($auth) {
         $user = Users::findOneByPK($auth);
         $user->getProfile();
     }
     $view = new View();
     $view->user = $user;
     $view->courses = $courses;
     //  $view->user_login = $user->user_login;
     // $view->user_group = $user->user_group;
     $view->display('header.php');
     $view->display('content.php');
     $view->display('footer.php');
 }
Пример #8
0
 public function actionShowAll()
 {
     $auth = Auth::checkAuth();
     $view = new View();
     $view->auth = $auth;
     if ($auth) {
         $user = Auth::getUser();
         $courses = Courses::getCourses();
         $view->user_login = $user->user_login;
         $view->user_group = $user->user_group;
         $view->courses = $courses;
         $view->display('header.php');
         $view->display('courses/courses_list.php');
         $view->display('footer.php');
     } else {
         header("Location: /learns/");
     }
 }
Пример #9
0
 public function actionShow()
 {
     $auth = Auth::checkAuth();
     $view = new View();
     $view->auth = $auth;
     if ($auth) {
         $user = Auth::getUser();
         $view->user_login = $user->user_login;
         $view->user_group = $user->user_group;
     }
     if ($auth) {
         header("Location: /learns/?ctrl=Courses&act=ShowAll");
     } else {
         $view->display('header.php');
         $view->display('auth/auth.php');
         $view->display('footer.php');
     }
 }
Пример #10
0
 public function actionShowUsers()
 {
     $auth = Auth::checkAuth();
     $view = new View();
     $view->auth = $auth;
     if ($auth) {
         $user = Auth::getUser();
         if ($user->user_group == 1) {
             $view->user_login = $user->user_login;
             $view->user_group = $user->user_group;
             $view->users = Users::getUsers();
             $view->display('header.php');
             $view->display('users/user_list.php');
         }
         $view->display('footer.php');
     } else {
         header("Location: /learns/");
     }
 }
Пример #11
0
 public function actionSave()
 {
     $data_array = $_POST;
     if (!empty($data_array)) {
         $user = Users::findOneByPK(Auth::checkAuth());
         $user->getProfile();
         foreach ($data_array as $key => $value) {
             $user->{$key} = $value;
         }
         if (!empty($_FILES['img']['name'])) {
             $user->img = Files::upload($_FILES, 'users');
         } else {
             $user->img = 'img/defaults/owl00' . rand(1, 6) . '.png';
         }
         $user->saveProfile();
     } else {
         header('Location: ' . BASE_PATH . 'auth/');
     }
     header('Location: ' . BASE_PATH . 'users/');
 }
Пример #12
0
 public function actionLesson()
 {
     $auth = Auth::checkAuth();
     if ($auth) {
         $user = Users::findOneByPK($auth);
         $user->getProfile();
     }
     $lesson_id = $_GET['lesson_id'];
     $view = new View();
     //  $view->user_login = $user->user_login;
     // $view->user_group = $user->user_group;
     if (isset($lesson_id)) {
         $lesson = Lessons::findOneByPK($lesson_id);
         $crumbs = Breadcrumbs::getCrumbs($lesson);
         $view->page_title = $lesson->name;
         $view->crumbs = $crumbs;
         $view->user = $user;
         $view->display('header.php');
         $view->display('lessons/lesson.php');
         $view->display('footer.php');
     } else {
         throw new ControllerException('Сожалеем, такого урока не существует', '404');
     }
 }
            break;
        case -5:
            $errro = "Security Issue. Please login again";
            break;
        default:
            $error = "Authentication Issue. Please report to Admin";
    }
    if (isset($error)) {
        $templateEngine->assign("error", $error);
    }
    $templateEngine->displayPage('usermin_login.tpl');
    exit;
}
$DatabaseConnections = new DatabaseConnections();
$Usermin = new DatabaseUsermin($DatabaseConnections->getRadiusDB());
$options = array('cryptType' => 'none', 'users' => $Usermin->getUsers());
$Auth = new Auth("Array", $options, "loginForm");
$Auth->setSessionName("GRASE Usermin");
$Auth->setAdvancedSecurity(array(AUTH_ADV_USERAGENT => true, AUTH_ADV_IPCHECK => true, AUTH_ADV_CHALLENGE => false));
$Auth->setIdle(120);
$Auth->start();
if (!$Auth->checkAuth()) {
    echo "Should never get here";
    // THIS CODE SHOULD NEVER RUN
    exit;
} elseif (isset($_GET['logoff'])) {
    $Auth->logout();
    $Auth->start();
} else {
    $templateEngine->assign("LoggedInUsername", $Auth->getUsername());
}
Пример #14
0
<?php

require_once 'Auth/Auth.php';
// 認証フォーム呼び出しのためのユーザ定義関数
function myLogin($usr, $status)
{
    // エラーメッセージ(の候補)を連想配列で準備
    $errs = array(AUTH_IDLED => 'アイドル時間を超えています。再ログインしてください。', AUTH_EXPIRED => '時間切れです。再ログインしてください。', AUTH_WRONG_LOGIN => 'ユーザ/パスワードが誤っています。');
    // 認証フォーム呼び出し
    require_once 'login.php';
}
// Authクラスのインスタンス化
$auth = new Auth('MDB2', array('dsn' => 'mysqli://*****:*****@localhost/selfphp', 'table' => 'usr', 'usernamecol' => 'uid', 'passwordcol' => 'passwd', 'db_fields' => '*'), 'myLogin');
// 認証処理の実行
$auth->start();
// 認証の成否を判定(未認証、認証失敗時にはスクリプトを終了)
if (!$auth->checkAuth()) {
    die;
}
Пример #15
0
}
class Auth_Log_Observer extends Log_observer
{
    var $messages = array();
    function notify($event)
    {
        $this->messages[] = $event;
    }
}
$options = array('enableLogging' => true, 'cryptType' => 'md5', 'users' => array('guest' => md5('password')));
$a = new Auth("Array", $options, "loginFunction");
$infoObserver = new Auth_Log_Observer(AUTH_LOG_INFO);
$a->attachLogObserver($infoObserver);
$debugObserver = new Auth_Log_Observer(AUTH_LOG_DEBUG);
$a->attachLogObserver($debugObserver);
$a->start();
if ($a->checkAuth()) {
    /*
     * The output of your site goes here.
     */
    print "Authentication Successful.<br/>";
}
print '<h3>Logging Output:</h3>' . '<b>AUTH_LOG_INFO level messages:</b><br/>';
foreach ($infoObserver->messages as $event) {
    print $event['priority'] . ': ' . $event['message'] . '<br/>';
}
print '<br/>' . '<b>AUTH_LOG_DEBUG level messages:</b><br/>';
foreach ($debugObserver->messages as $event) {
    print $event['priority'] . ': ' . $event['message'] . '<br/>';
}
print '<br/>';
Пример #16
0
 public function __construct()
 {
     parent::__construct();
     Auth::checkAuth();
 }
Пример #17
0
 public function getUserInterface($params = null)
 {
     switch (@$_REQUEST['section']) {
         /*
          * 
          * Publicly Accesscable Pages
          *
          */
         case 'signup':
             $this->template = 'account_signup.tpl';
             $this->addJS('/modules/User/js/profile.js');
             if (!($form = $this->getUserAddEditForm('/user/signup'))) {
                 break;
             }
             $form->setConstants(array('section' => 'signup'));
             if (isset($_POST['a_submit']) && $form->validate()) {
                 $this->template = 'account_confirmed.tpl';
                 $_POST['username'] = $_POST['a_username'];
                 $_POST['password'] = $_POST['a_password'];
                 $_POST['doLogin'] = "******";
                 $auth_container = new User();
                 $auth = new Auth($auth_container, null, 'authInlineHTML');
                 $auth->start();
                 $auth->checkAuth();
                 header('Location: /user/');
             }
             $this->smarty->assign('form', $form);
             return $this->smarty->fetch($this->template);
             break;
         case 'logout':
             unset($_SESSION['authenticated_user']);
             $auth_container = new User();
             $auth = new Auth($auth_container, null, 'authInlineHTML');
             $auth->logout();
             header('Location: /');
             exit;
             break;
         default:
             if ($_SESSION['authenticated_user']) {
                 header('Location: /');
                 exit;
             }
             return authInlineHTML();
     }
 }
Пример #18
0
 * @subpackage Core
 * @version 2.0
 */
include_once '../include/Debugger.php';
error_reporting(E_ALL);
$debugger = Debugger::instance();
$oldErrorHandler = set_error_handler(array(&$debugger, 'errorHandler'), E_ALL);
$debugger->debug("first call");
/**
 * Require the site initialization file
 */
require_once dirname(__FILE__) . "/../include/Site.php";
$auth_container = new CMSAuthContainer();
$auth = new Auth($auth_container, null, 'authHTML');
$auth->start();
if ($auth->checkAuth()) {
    if ($_SESSION["authenticated_user"]->getAuthGroup() != 1) {
        header('location: /user/');
        exit;
    }
    // set templates dir to the admin templates location
    $smarty->template_dir = SITE_ROOT . '/cms/templates';
    // set a custom compile id to ensure Smarty doesent accidentally overwrite duplicate compiled files.
    $smarty->compile_id = 'admin';
    // This is currently a hack since my url-rewriting syntax keeps a trailing slash on the module name
    $requestedModule = trim(@$_GET['module'], '/');
    // assign the requested module
    $smarty->assign('module', $requestedModule);
    // render the admin page
    require_once 'HTML/AJAX/Helper.php';
    $ajaxHelper = new HTML_AJAX_Helper();
Пример #19
0
session_start();
$getSettings = new Settings($config_setting_file_path);
$cpsub = $getSettings->getSettings();
$getLib = new Lib($cpsub['filter'], $cpsub['stripslashes']);
$getAuth = new Auth($config_account_data, $getLib);
$getTmp = new Template($config_current_version);
// check file status
$getLib->checkFileStatus($config_default_folder);
$getLib->checkFileStatus($config_article_file_path);
// get page val
$p = $getLib->setFilter($_GET['p']);
if (!$getLib->checkVal($p)) {
    $p = "about";
}
// check auth
$getAuth->checkAuth($_COOKIE, $_SESSION, $p);
// get page folder
$include_path = $getLib->checkAdminPath($p);
// current page
$website_current_page = "管理";
// get title
$website_title = $getLib->setFilter($cpsub['title']) . "-" . $website_current_page;
?>

<!DOCTYPE html>
<html lang="zh-tw">
  <head>
	<?php 
echo $getTmp->setHeader($website_title);
?>
  </head>
Пример #20
0
 /**
  * Statically checks if there is a session with valid auth information.
  *
  * @access private
  * @see checkAuth
  * @return boolean  Whether or not the user is authenticated.
  */
 function staticCheckAuth($options = null)
 {
     static $staticAuth;
     if (!isset($staticAuth)) {
         $staticAuth = new Auth('null', $options);
     }
     return $staticAuth->checkAuth();
 }
    echo '<form method="post" action="pruebaLogin.php">';
    echo '<input type="submit" name="botonCerrarSesion" value="Cerrar sesión">';
    echo '</form>';
}
function mensajeLogout()
{
    echo '<h1>Ha cerrado sesión</h1>';
}
function mensajeLoginExitoso()
{
    echo '<h1>Ha iniciado sesión</h1>';
}
function mensajeLoginFallido()
{
    echo '<h1>No se pudo iniciar sesión</h1>';
}
$options = array("dsn" => "mysql://*****:*****@localhost/controlacceso", "table" => "usuario", "usernamecol" => "numeroDocumento", "passwordcol" => "password", "cryptType" => "sha1");
$autenticacion = new Auth("MDB2", $options, "formularioLogin");
$autenticacion->setLogoutCallback("mensajeLogout");
$autenticacion->setLoginCallback("mensajeLoginExitoso");
$autenticacion->setFailedLoginCallback("mensajeLoginFallido");
$autenticacion->start();
if ($autenticacion->checkAuth()) {
    if (isset($_POST['botonCerrarSesion'])) {
        $autenticacion->logout();
        $autenticacion->start();
    } else {
        echo '<p>Logueado como: ' . $autenticacion->getUsername() . '</p>';
        formularioLogout();
    }
}
Пример #22
0
 /**
  * Statically checks if there is a session with valid auth information.
  *
  * @access public
  * @see checkAuth
  * @return boolean  Whether or not the user is authenticated.
  * @static
  */
 function staticCheckAuth($options = null)
 {
     static $staticAuth;
     if (!isset($staticAuth)) {
         $staticAuth = new Auth('null', $options);
     }
     $staticAuth->log('Auth::staticCheckAuth() called', AUTH_LOG_DEBUG);
     return $staticAuth->checkAuth();
 }
Пример #23
0
 public function getUserInterface($params = null)
 {
     include 'include/CMSPage.php';
     $this->smarty->assign('hasRestriction', $this->hasRestriction());
     $page = new CMSPage($_REQUEST['page']);
     $rev = $page->getActiveRevisions($_SESSION['lang']);
     if ($page->getAccess() != 'public' && $this->hasRestriction()) {
         $auth_container = new User();
         $auth = new Auth($auth_container, null, 'authInlineHTML');
         $auth->start();
         if (!$auth->checkAuth()) {
             return authInlineHTML();
         } else {
             if ($page->getAccess() != 'public' && $_SESSION['authenticated_user']->hasPerm('membersaccess')) {
                 $this->smarty->assign('content_perms', true);
             } else {
                 $this->smarty->assign('content_perms', false);
             }
         }
     } else {
         $this->smarty->assign('content_perms', true);
     }
     $metaData = $rev->getMetaData();
     $this->smarty->assign('content', $rev);
     $this->setMetaDescription($metaData['description']);
     $this->setMetaTitle($metaData['title']);
     $this->setMetaKeywords($metaData['keywords']);
     $this->setPageTitle($rev->getPageTitle());
     return $this->smarty->fetch('db:content.tpl');
 }
Пример #24
0
<? 
// Set Intialize Informations
define('APP_BASE', dirname(__FILE__));

include_once FRAMEWORK_BASE . '/lib/basic.php';
include_once FRAMEWORK_BASE . '/lib/session.php';
include_once FRAMEWORK_BASE . '/lib/auth.php';
include_once FRAMEWORK_BASE . '/lib/dnsmgr.php';
include_once FRAMEWORK_BASE . '/config/mainconfig.php';

//Session::initSession();
if (Auth::checkAuth()) {
        Session::refreshSession();
}

if ( $conf['debug'] == 1 ) {
  print "UserID:".$_SESSION['__auth']['userID']."<BR>";
  print "APP_BASE: ".APP_BASE."<BR>";
  print "FRAMEWORK_BASE: ".FRAMEWORK_BASE."<BR>";
}

global $conf;
global $applications;

// use TreeMenu
require_once(FRAMEWORK_BASE.'/lib/TreeMenu.php');
$icon = 'stock_open16.gif';
$level_count = 0;
$menu  = new HTML_TreeMenu();
$root = new HTML_TreeNode(array('text' => "dnsZone-Manager",
                                 'icon' => $icon));
Пример #25
0
<?php
define('FRAMEWORK_BASE', dirname(__FILE__));
include_once FRAMEWORK_BASE . '/lib/basic.php';
include_once FRAMEWORK_BASE . '/lib/session.php';
include_once FRAMEWORK_BASE . '/lib/auth.php';
include_once FRAMEWORK_BASE . '/config/mainconfig.php';

Session::initSession();
if (Auth::checkAuth()) {
	Session::refreshSession();
}

if (isset($_POST['dologin']) && !Auth::checkAuth()) {
  $auth = Auth::getAuthObject($conf['auth']['type'], $conf['auth']['params']);
  if ($auth->authenticateLDAP($_POST['user'], $_POST['pass'])) {
    header('Location: index.php?'.session_name().'='.session_id());
  } else {
	Session::delSession();
        //header('Location: '.$conf['baseurl'].'/');
	header('Location: index.php?login_err=1');
  }
} else {
  Session::delSession();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
	<title>dnsZone-Manager</title>
	<link href="<?echo $conf['baseurl']?>/style/style.css" rel="stylesheet" type="text/css" />
</head>
Пример #26
0
 /**
  * Manage the accounts of the shoppers
  * 
  * This function allows the shoppers to manage their account
  * They can change their profile (address, email, phone number, etc), or view all the orders that they made
  *  
  * @return string
  */
 public function handleMyAccount($action)
 {
     $auth_container = new User();
     $auth = new Auth($auth_container, null, 'authInlineHTML');
     $auth->start();
     if (!$auth->checkAuth()) {
         return authInlineHTML();
     }
     $userId = $_SESSION['authenticated_user']->getId();
     switch ($action) {
         case 'MyProfile':
             //Display my profile
             //It is easier to re-generate the profile form rather than using the original one
             $form = new Form('user_profile', 'POST', '/Store/MyAccount/&action=MyProfile');
             $form->addElement('static', 'a_username', 'Username');
             $form->addElement('password', 'a_password', 'Password');
             $form->addElement('password', 'a_password_confirm', 'Confirm Password');
             $form->addElement('text', 'a_name', 'Full Name');
             //$form->addElement( 'text',  'a_email', 'Email Address');
             $form->addElement('checkbox', 'a_join_newsletter', 'Sign me up for your E-Newsletter');
             $form->addElement('submit', 'a_submit', 'Save');
             $user = new User($userId);
             $defaultValues['a_username'] = $user->getUsername();
             $defaultValues['a_name'] = $user->getName();
             //$defaultValues ['a_email'] = $user->getEmail();
             $defaultValues['a_password'] = null;
             $defaultValues['a_password_confirm'] = null;
             $defaultValues['a_join_newsletter'] = $user->getJoinNewsletter();
             $form->setDefaults($defaultValues);
             $form->addRule('a_name', 'Please enter the user\'s name', 'required', null);
             //$form->addRule( 'a_email', 'Please enter an email address', 'required', null );
             //$form->addRule( 'a_email', 'Please enter a valid email address', 'email', null );
             $form->addRule(array('a_password', 'a_password_confirm'), 'The passwords do not match', 'compare', null);
             if (isset($_REQUEST['a_submit']) && $form->validate()) {
                 if ($_REQUEST['a_password'] != '') {
                     $user->setPassword($_REQUEST['a_password']);
                 }
                 $user->setName($_REQUEST['a_name']);
                 if (!@$_REQUEST['a_join_newsletter']) {
                     $_REQUEST['a_join_newsletter'] = 0;
                 }
                 $user->setJoinNewsletter($_REQUEST['a_join_newsletter']);
                 //$user->setEmail($_REQUEST['a_email']);
                 $user->save();
                 $this->smarty->assign('profileHasBeenChanged', 1);
             }
             $this->smarty->assign('form', $form);
             //After displaying the "standard" user profile, display all the extra fields such as shipping address, billing address, and phone number
             $userDetails = UserDetails::getUserDetailsBasedOnUserId($userId);
             $this->smarty->assign('userDetails', $userDetails);
             return $this->smarty->fetch("MyProfile.tpl");
             break;
         case 'MyOrders':
             //Display all the orders that this user has made, and display the details of a particular order through an ajax call
             if (@$_REQUEST["order_id"]) {
                 $order = new Order($_REQUEST["order_id"]);
                 if ($order->getUser() != $userId) {
                     //Make sure users cannot view orders that do not belong to them
                     return 'Order does not belong to you';
                 }
                 $orderItems = OrderDetail::getAll($_REQUEST["order_id"]);
                 $orderComments = OrderComment::getAll($order->getId());
                 $this->smarty->assign('order', $order);
                 $this->smarty->assign('orderItems', $orderItems);
                 $this->smarty->assign('orderComments', $orderComments);
                 return $this->smarty->fetch("admin/OrderDetail.tpl");
             }
             $this->addJS('/js/facebox.js');
             $this->addCSS('/css/facebox.css');
             $results = Order::getAll(true, $userId);
             $this->smarty->assign('results', $results);
             return $this->smarty->fetch("MyOrders.tpl");
             break;
     }
     return $this->smarty->fetch("MyAccount.tpl");
 }
Пример #27
0
              <!--
              <form class="navbar-form navbar-left" role="search">
                <div class="form-group">
                  <input type="text" class="form-control" id="navbar-search-input" placeholder="Search">
                </div>
              </form>     
              -->
            </div><!-- /.navbar-collapse -->
            <!-- Navbar Right Menu -->
              <div class="navbar-custom-menu">
                <ul class="nav navbar-nav">
                  <!-- Messages: style can be found in dropdown.less-->
                  

                <?php 
if ($auth->checkAuth() == true) {
    ?>
                  <!-- Notifications Menu -->                 
                  <!-- User Account Menu -->
                  <li class="dropdown user user-menu">
                    <!-- Menu Toggle Button -->
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                      <!-- The user image in the navbar-->
                      <img src="<?php 
    echo @$_SESSION[Member][Photo];
    ?>
" class="user-image " alt="User Image"/>
                      <!-- hidden-xs hides the username on small devices so only the image appears. -->
                      <span class="hidden-xs"><?php 
    print @$_SESSION[Member][FirstName] . " " . @$_SESSION[Member][LastName];
    ?>
Пример #28
0
 public function getUserInterface($params = null)
 {
     switch (@$_REQUEST['section']) {
         /*
          * 
          * Publicly Accesscable Pages
          *
          */
         case 'signup':
             //$_REQUEST['id'] = @$_SESSION["authenticated_user"]->getId();
             $usr = new User();
             $form = $usr->getUserAddEditForm("/user/signup/", false, false);
             if (@$_REQUEST["user_created"]) {
                 //The user has been added
                 return "You have create a new user";
             }
             return $form->display();
             $this->template = 'account_signup.tpl';
             $this->addJS('/modules/User/js/profile.js');
             if (!($form = $this->getUserAddEditForm('/user/signup'))) {
                 break;
             }
             $form->setConstants(array('section' => 'signup'));
             if (isset($_POST['a_submit']) && $form->validate()) {
                 $this->template = 'account_confirmed.tpl';
                 $_POST['username'] = $_POST['a_username'];
                 $_POST['password'] = $_POST['a_password'];
                 $_POST['doLogin'] = "******";
                 $auth_container = new User();
                 $auth = new Auth($auth_container, null, 'authInlineHTML');
                 $auth->start();
                 $auth->checkAuth();
                 header('Location: /user/');
             }
             $this->smarty->assign('form', $form);
             return $this->smarty->fetch($this->template);
             break;
         case 'logout':
             unset($_SESSION['authenticated_user']);
             $auth_container = new User();
             $auth = new Auth($auth_container, null, 'authInlineHTML');
             $auth->logout();
             header('Location: /');
             exit;
             break;
         case 'forgotpass':
             $form = new Form('frm_forgotpass', 'POST', "/user/forgotpass");
             $form->addElement('header', 'via_username', 'Retrieve your password via email');
             $form->addElement('text', 'username', 'Username');
             $form->addElement('submit', 'submit', 'GO >>');
             if ($form->validate() && isset($_REQUEST['submit'])) {
                 $usr = new User(@$_REQUEST["username"]);
                 if (!$usr->getId()) {
                     $form->addElement('static', 'error_msg', '&nbsp;', 'This username could not be found in our database');
                     return $form->display();
                 }
                 srand(time());
                 $randomPass = rand();
                 $this->smarty->assign('randomPass', $randomPass);
                 $body = $this->smarty->fetch('resetPasswordEmail.tpl');
                 $headers = "From: info@feedstore.ca";
                 $mailResult = mail($usr->getEmail(), "Your password has been reset", $body, $headers);
                 if ($mailResult) {
                     $usr->setPassword($randomPass);
                     $usr->save();
                     return "Your password has been changed and sent to your email address: " . $usr->getEmail();
                 } else {
                     return "Could not reset the password. Please contact the administrator of the site.";
                 }
             }
             return $form->display();
             break;
         case 'profile':
             if (!@isset($_SESSION["authenticated_user"]) || !@$_SESSION["authenticated_user"]->getId()) {
                 header('location: /user/');
                 exit;
             }
             $_REQUEST['id'] = @$_SESSION["authenticated_user"]->getId();
             $usr = new User();
             $form = $usr->getUserAddEditForm("/user/profile", false, false);
             if (@$_REQUEST["user_created"]) {
                 $_SESSION["authenticated_user"] = new User($_SESSION["authenticated_user"]->getId());
                 //Refresh the user in the session
             }
             return $form->display();
             break;
         default:
             if (isset($_SESSION['authenticated_user']) && $_SESSION['authenticated_user']) {
                 $this->smarty->assign('username', $_SESSION['authenticated_user']->getUserName());
                 return $this->smarty->fetch('my_account.tpl');
             }
             return authInlineHTML();
     }
 }
Пример #29
0
<?php

require_once "Auth.php";
require_once "DB.php";
require_once "config.php";
require_once "Misc.php";
$a = new Auth("DB", CONN_DSN);
$a->start();
if (!$a->checkAuth()) {
    exit;
}
$db =& DB::connect(CONN_DSN);
if (PEAR::isError($db)) {
    print $db->getMessage();
    exit;
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<title>Наш сайт</title>
<link rel="stylesheet" type="text/css" href="styles/Panel.css">
<link rel="stylesheet" type="text/css" href="scripts/Tree/Tree.css">
<script src="scripts/glm-ajax.js"></script>
<script src="scripts/Tree/Tree.js"></script>
<script src="scripts/jquery.js"></script>
<script src="scripts/interface.js"></script>
</head>
<body onselectstart="return false;">
Пример #30
0
        $this->mysql_user = $mysql_user;
        $this->mysql_password = $mysql_password;
    }
    function fetchData($username, $password, $isChallengeResponse = false)
    {
        if ($username == $this->mysql_user && $password == $this->mysql_password) {
            return true;
        }
        return false;
    }
}
$auth_container = new CustomAuthContainer($wakkaConfig['mysql_user'], $wakkaConfig['mysql_password']);
$params = array("advancedsecurity" => "true");
$a = new Auth($auth_container, $params);
$a->start();
if (isset($_GET['tools_action']) && $_GET['tools_action'] == "logout" && $a->checkAuth()) {
    $a->logout();
    $a->start();
    exit;
}
if ($a->checkAuth()) {
} else {
    exit;
}
$plugins_root = 'tools/';
$plugins = new plugins($plugins_root);
$plugins->getPlugins(true);
$plugins_list = $plugins->getPluginsList();
$PLUGIN_HEAD = '';
$PLUGIN_BODY = '';
if (!empty($_REQUEST['p']) && !empty($plugins_list[$_REQUEST['p']]) && $plugins_list[$_REQUEST['p']]['active']) {