예제 #1
0
 public function testUpdateAdditionalOwners()
 {
     $response = $this->managedAccountResponse('acct_ABC');
     $this->mockRequest('POST', '/v1/accounts', array('managed' => 'true'), $response);
     $response['legal_entity']['additional_owners'] = array(array('first_name' => 'Bob', 'last_name' => null, 'address' => array('line1' => null, 'line2' => null, 'city' => null, 'state' => null, 'postal_code' => null, 'country' => null), 'verification' => array('status' => 'unverified', 'document' => null, 'details' => null)));
     $this->mockRequest('POST', '/v1/accounts/acct_ABC', array('legal_entity' => array('additional_owners' => array(array('first_name' => 'Bob')))), $response);
     $response['legal_entity']['additional_owners'][0]['last_name'] = 'Smith';
     $this->mockRequest('POST', '/v1/accounts/acct_ABC', array('legal_entity' => array('additional_owners' => array(array('last_name' => 'Smith')))), $response);
     $response['legal_entity']['additional_owners'][0]['last_name'] = 'Johnson';
     $this->mockRequest('POST', '/v1/accounts/acct_ABC', array('legal_entity' => array('additional_owners' => array(array('last_name' => 'Johnson')))), $response);
     $response['legal_entity']['additional_owners'][0]['verification']['document'] = 'file_123';
     $this->mockRequest('POST', '/v1/accounts/acct_ABC', array('legal_entity' => array('additional_owners' => array(array('verification' => array('document' => 'file_123'))))), $response);
     $response['legal_entity']['additional_owners'][1] = array('first_name' => 'Jane', 'last_name' => 'Doe');
     $this->mockRequest('POST', '/v1/accounts/acct_ABC', array('legal_entity' => array('additional_owners' => array(1 => array('first_name' => 'Jane')))), $response);
     $account = Account::create(array('managed' => true));
     $account->legal_entity->additional_owners = array(array('first_name' => 'Bob'));
     $account->save();
     $this->assertSame(1, count($account->legal_entity->additional_owners));
     $this->assertSame('Bob', $account->legal_entity->additional_owners[0]->first_name);
     $account->legal_entity->additional_owners[0]->last_name = 'Smith';
     $account->save();
     $this->assertSame(1, count($account->legal_entity->additional_owners));
     $this->assertSame('Smith', $account->legal_entity->additional_owners[0]->last_name);
     $account['legal_entity']['additional_owners'][0]['last_name'] = 'Johnson';
     $account->save();
     $this->assertSame(1, count($account->legal_entity->additional_owners));
     $this->assertSame('Johnson', $account->legal_entity->additional_owners[0]->last_name);
     $account->legal_entity->additional_owners[0]->verification->document = 'file_123';
     $account->save();
     $this->assertSame('file_123', $account->legal_entity->additional_owners[0]->verification->document);
     $account->legal_entity->additional_owners[1] = array('first_name' => 'Jane');
     $account->save();
     $this->assertSame('Jane', $account->legal_entity->additional_owners[1]->first_name);
 }
예제 #2
0
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Account::create([]);
     }
 }
 public function add()
 {
     $param = Input::all();
     $emp_id = Employee::where('ssn', '=', $param['ssn'])->pluck('id');
     Account::create(array('username' => $param['username'], 'password' => Hash::make($param['password']), 'employee_id' => $emp_id, 'role_id' => $param['role']));
     return Response::json(array('valid' => TRUE));
 }
예제 #4
0
 public function testCreateAccount()
 {
     Client::relateIQ(GlobalVar::KEY, GlobalVar::SECRET);
     $account = new Account(['name' => 'Account4']);
     $res = $account->create();
     $this->assertInstanceOf('Account', $res);
     $this->assertEquals('Account4', $res->name());
 }
예제 #5
0
 public function run()
 {
     $account_fake1 = array('email' => '*****@*****.**', 'password' => Hash::make('GuiaApir1234'), 'role_id' => '1', 'activated' => true);
     $account_fake2 = array('email' => '*****@*****.**', 'password' => Hash::make('GuiaApir1234'), 'age' => '21', 'referee_number' => '123456789', 'role_id' => '2', 'gender_id' => '1', 'province_id' => '9', 'specialty_id' => '2', 'activated' => true);
     $account_fake3 = array('email' => 'temporal@temporal', 'password' => Hash::make('GuiaApir1234'), 'role_id' => '3', 'activated' => true);
     Account::create($account_fake1);
     Account::create($account_fake2);
     Account::create($account_fake3);
 }
예제 #6
0
 public function run()
 {
     $faker = $this->getFaker();
     for ($i = 0; $i < 10; $i++) {
         $email = $faker->email;
         $password = Hash::make("password");
         Account::create(["email" => $email, "password" => $password]);
     }
 }
예제 #7
0
 /**
  * Store a newly created account in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make($data = Input::all(), Account::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     Account::create($data);
     return Redirect::route('accounts.index');
 }
예제 #8
0
 public function post_index()
 {
     if (!AccountForm::is_valid()) {
         return Redirect::back()->with_input()->with_errors(AccountForm::$validation);
     }
     $new_account = Account::create(Input::get());
     if ($new_account) {
         return Redirect::to_action('accounts');
     }
 }
예제 #9
0
파일: Factory.php 프로젝트: name3/cheng
 public function stAccount()
 {
     $account_id = $this->st_account;
     if (empty($account_id)) {
         $account = Account::create();
         $this->edit('st_account', $account->id);
         return $account;
     }
     return new Account($this->st_account);
 }
예제 #10
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $input = Input::all();
     $input['user_id'] = Auth::user()->id;
     $input['account'] = md5(Auth::user()->getFullName() . time());
     $input['token'] = md5($input['account'] . json_encode(Input::all()));
     $validation = Validator::make($input, Account::$rules);
     if ($validation->passes()) {
         Account::create($input);
         return Redirect::route('accounts.index');
     }
     return Redirect::route('accounts.create')->withInput()->withErrors($validation)->with('message', 'There were validation errors.');
 }
 public function testUpdateAdditionalOwners()
 {
     self::authorizeFromEnv();
     $d = Account::create(array('managed' => true));
     $id = $d->id;
     $d->legal_entity->additional_owners = array(array('first_name' => 'Bob'));
     $d->save();
     $d = Account::retrieve($id);
     $this->assertSame(1, count($d->legal_entity->additional_owners));
     $this->assertSame('Bob', $d->legal_entity->additional_owners[0]->first_name);
     $d->legal_entity->additional_owners[0]->last_name = 'Smith';
     $d->save();
     $d = Account::retrieve($id);
     $this->assertSame(1, count($d->legal_entity->additional_owners));
     $this->assertSame('Smith', $d->legal_entity->additional_owners[0]->last_name);
 }
예제 #12
0
 protected function create(array $params)
 {
     $smarty = SmailSmarty::getInstance();
     $smarty->setTemplate('login.tpl');
     if (!(isset($params['name']) && isset($params['password']) && isset($params['confirm']))) {
         $smarty->assign('CREATE_ERRORS', 1);
     } elseif ($params['password'] != $params['confirm']) {
         $smarty->assign('CREATE_ERRORS', 2);
     } else {
         $account = new Account($params['name'], $params['password']);
         if (!$account->exists()) {
             if ($account->create()) {
                 $_SESSION['account'] = $account->getName();
                 header('Location: ' . WEBDIR . 'Profil');
             }
         } else {
             $smarty->setTemplate('login.tpl');
             $smarty->assign('CREATE_ERRORS', 3);
         }
     }
 }
예제 #13
0
 private function createAccountsFromAttributes($attributes, $orders=array(), $ordertasks=array(), $purchases=array()){
     $data = \Account::create($attributes);
     if(is_null($data)) return;
     if($this->isordridauto){
         $this->updateLastId($data->type, $data->acnt_no);
     }
     if($data->accounttype === Menu::acc_type_receivables){
         $this->saveAccountOrders($orders, $data->id);
     }else{
         $this->saveAccountOrdertasks($ordertasks, $data->id);
         $this->saveAccountPurchases($purchases, $data->id);
     }
 }
예제 #14
0
 /**
  * prepare test accounts
  */
 public static function create_accounts()
 {
     // Create admin account
     // First account is always admin
     if (!Account::exists("testadmin")) {
         if (!Account::create("testadmin", "testadminpassword", "testadminpassword")) {
             throw new Exception("Cannot create admin account");
         }
     }
     // Create normal account
     if (!Account::exists("testuser")) {
         if (!Account::create("testuser", "testpassword", "testpassword")) {
             throw new Exception("Cannot create testuser account");
         }
     }
 }
예제 #15
0
 public function testCreate()
 {
     // row to create
     $values = array('id' => 1, 'name' => 'Joe', 'amount' => 100);
     // our mock adapter
     $adapter = $this->adapterMock;
     // prepare the mock to expect the variables passed, and return a row
     $adapter->expects($this->once())->method('insert')->with('accounts', $values)->will($this->returnValue(true));
     $accountsTable = new Account($adapter);
     // getInstance doesn't work well in testing
     $result = $accountsTable->create($values);
     $this->assertTrue($result);
 }
예제 #16
0
 /**
  * Create admin page
  * 
  * @author Thibaud Rohmer
  */
 public function __construct()
 {
     /// Check that current user is an admin or an uploader
     if (!(CurrentUser::$admin || CurrentUser::$uploader)) {
         return;
     }
     /// Get actions available for Uploaders too
     if (isset($_GET['a'])) {
         switch ($_GET['a']) {
             case "Abo":
                 $this->page = new AdminAbout();
                 break;
             case "Upl":
                 if (isset($_POST['path'])) {
                     AdminUpload::upload();
                     CurrentUser::$path = File::r2a(stripslashes($_POST['path']));
                 }
                 break;
             case "Mov":
                 if (isset($_POST['pathFrom'])) {
                     try {
                         CurrentUser::$path = File::r2a(dirname(stripslashes($_POST['pathFrom'])));
                     } catch (Exception $e) {
                         CurrentUser::$path = Settings::$photos_dir;
                     }
                 }
                 Admin::move();
                 if (isset($_POST['move']) && $_POST['move'] == "rename") {
                     try {
                         if (is_dir(File::r2a(stripslashes($_POST['pathFrom'])))) {
                             CurrentUser::$path = dirname(File::r2a(stripslashes($_POST['pathFrom']))) . "/" . stripslashes($_POST['pathTo']);
                         }
                     } catch (Exception $e) {
                         CurrentUser::$path = Settings::$photos_dir;
                     }
                 }
                 break;
             case "Del":
                 if (isset($_POST['del'])) {
                     if (!is_array($_POST['del'])) {
                         CurrentUser::$path = dirname(File::r2a(stripslashes($_POST['del'])));
                     } else {
                         CurrentUser::$path = dirname(File::r2a(stripslashes($_POST['del'][0])));
                     }
                     Admin::delete();
                 }
                 break;
         }
     }
     /// Check that current user is an admin
     if (!CurrentUser::$admin) {
         return;
     }
     /// Get action
     if (isset($_GET['a'])) {
         switch ($_GET['a']) {
             case "Sta":
                 $this->page = new AdminStats();
                 break;
             case "VTk":
                 $this->page = new GuestToken();
                 break;
             case "DTk":
                 if (isset($_POST['tokenkey'])) {
                     GuestToken::delete($_POST['tokenkey']);
                 }
                 $this->page = new GuestToken();
                 break;
             case "Acc":
                 if (isset($_POST['edit'])) {
                     Account::edit($_POST['login'], $_POST['old_password'], $_POST['password'], $_POST['name'], $_POST['email'], NULL, $_POST['language']);
                 }
                 if (isset($_POST['login'])) {
                     $this->page = new Account($_POST['login']);
                 } else {
                     $this->page = CurrentUser::$account;
                 }
                 break;
             case "GC":
                 Group::create($_POST['group']);
                 $this->page = new Group();
                 break;
             case "AAc":
                 Account::create($_POST['login'], $_POST['password'], $_POST['verif']);
                 $this->page = new Group();
                 break;
             case "AGA":
                 $a = new Account($_POST['acc']);
                 $a->add_group($_POST['group']);
                 $a->save();
                 $this->page = CurrentUser::$account;
                 break;
             case "AGR":
                 $a = new Account($_POST['acc']);
                 $a->remove_group($_POST['group']);
                 $a->save();
                 $this->page = CurrentUser::$account;
                 break;
             case "ADe":
                 Account::delete($_POST['name']);
                 $this->page = new Group();
                 break;
             case "GEd":
                 Group::edit($_POST);
                 $this->page = new Group();
                 break;
             case "GDe":
                 Group::delete($_GET['g']);
                 $this->page = new Group();
                 break;
             case "CDe":
                 CurrentUser::$path = File::r2a($_POST['image']);
                 Comments::delete($_POST['id']);
                 $this->page = new MainPage();
                 break;
             case "JS":
                 break;
             case "EdA":
                 $this->page = new Group();
                 break;
             case "GAl":
                 if (isset($_POST['path'])) {
                     Settings::gener_all(File::r2a(stripslashes($_POST['path'])));
                 }
             case "Set":
                 if (isset($_POST['name'])) {
                     Settings::set();
                 }
                 $this->page = new Settings();
                 break;
         }
     }
     if (!isset($this->page)) {
         $this->page = new AdminAbout();
     }
     /// Create menu
     $this->menu = new AdminMenu();
 }
예제 #17
0
 /**
  * Create a test account
  */
 protected static function createTestAccount(array $attributes = array())
 {
     self::authorizeFromEnv();
     return Account::create($attributes + array('managed' => false, 'country' => 'US', 'email' => self::generateRandomEmail()));
 }
예제 #18
0
파일: Customer.php 프로젝트: name3/cheng
 public static function create($info)
 {
     // 这里竟然没有address
     $user_info = array('username' => i($info['username']), 'password' => i($info['password']), 'realname' => i($info['realname']), 'phone' => i($info['phone']), 'email' => i($info['email']), 'create_time=NOW()' => null);
     $user = User::register($user_info);
     // new an account
     $account = Account::create();
     Pdb::insert(array('user' => $user->id, 'account' => $account->id, 'qq' => i($info['qq']), 'remark' => i($info['remark']), 'state' => i($info['adopted']) ? 'Adopted' : 'ToBeAdopted'), self::$table);
     return new self(Pdb::lastInsertId());
 }
예제 #19
0
 /**
  * testBankAccountCreate
  *
  * @return  int
  */
 public function testBankAccountCreate()
 {
     global $conf, $user, $langs, $db;
     $conf = $this->savconf;
     $user = $this->savuser;
     $langs = $this->savlangs;
     $db = $this->savdb;
     $localobject = new Account($this->savdb);
     $localobject->initAsSpecimen();
     $localobject->date_solde = dol_now();
     $result = $localobject->create($user);
     print __METHOD__ . " result=" . $result . "\n";
     $this->assertLessThan($result, 0);
     return $result;
 }
예제 #20
0
 /**
  * Retrieves info for the current user account
  *
  * @author Thibaud Rohmer
  */
 public static function init()
 {
     CurrentUser::$accounts_file = Settings::$conf_dir . "/accounts.xml";
     CurrentUser::$groups_file = Settings::$conf_dir . "/groups.xml";
     /// Set path
     if (isset($_GET['f'])) {
         CurrentUser::$path = stripslashes(File::r2a($_GET['f']));
         if (isset($_GET['p'])) {
             switch ($_GET['p']) {
                 case 'n':
                     CurrentUser::$path = File::next(CurrentUser::$path);
                     break;
                 case 'p':
                     CurrentUser::$path = File::prev(CurrentUser::$path);
                     break;
             }
         }
     } else {
         /// Path not defined in URL
         CurrentUser::$path = Settings::$photos_dir;
     }
     /// Set CurrentUser account
     if (isset($_SESSION['login'])) {
         self::$account = new Account($_SESSION['login']);
         // groups sometimes can be null
         $groups = self::$account->groups === NULL ? array() : self::$account->groups;
         self::$admin = in_array("root", $groups);
         self::$uploader = in_array("uploaders", $groups);
     }
     /// Set action (needed for page layout)
     if (isset($_GET['t'])) {
         switch ($_GET['t']) {
             case "Page":
             case "Img":
             case "Thb":
                 CurrentUser::$action = $_GET['t'];
                 break;
             case "Big":
             case "BDl":
             case "Zip":
                 if (!Settings::$nodownload) {
                     CurrentUser::$action = $_GET['t'];
                 }
                 break;
             case "Reg":
                 if (isset($_POST['login']) && isset($_POST['password'])) {
                     if (!Account::create($_POST['login'], $_POST['password'], $_POST['verif'])) {
                         echo "Error creating account.";
                     }
                 }
             case "Log":
                 if (isset($_SESSION['login'])) {
                     CurrentUser::logout();
                     echo "logged out";
                     break;
                 }
                 if (isset($_POST['login']) && isset($_POST['password'])) {
                     try {
                         if (!CurrentUser::login($_POST['login'], $_POST['password'])) {
                             echo "Wrong password";
                         }
                     } catch (Exception $e) {
                         echo "Account not found";
                     }
                 }
                 if (!isset(CurrentUser::$account)) {
                     CurrentUser::$action = $_GET['t'];
                 }
                 break;
             case "Acc":
                 if (isset($_POST['old_password'])) {
                     Account::edit($_POST['login'], $_POST['old_password'], $_POST['password'], $_POST['name'], $_POST['email']);
                 }
                 CurrentUser::$action = "Acc";
                 break;
             case "Adm":
                 if (CurrentUser::$admin) {
                     CurrentUser::$action = "Adm";
                 }
                 break;
             case "Com":
                 Comments::add(CurrentUser::$path, $_POST['content'], $_POST['login']);
                 break;
             case "Rig":
                 Judge::edit(CurrentUser::$path, $_POST['users'], $_POST['groups'], true);
                 CurrentUser::$action = "Judge";
                 break;
             case "Pub":
                 Judge::edit(CurrentUser::$path);
                 CurrentUser::$action = "Judge";
                 break;
             case "Pri":
                 Judge::edit(CurrentUser::$path, array(), array(), true);
                 CurrentUser::$action = "Judge";
                 break;
             case "Inf":
                 CurrentUser::$action = "Inf";
                 break;
             case "Fs":
                 if (is_file(CurrentUser::$path)) {
                     CurrentUser::$action = "Fs";
                 }
                 break;
             default:
                 CurrentUser::$action = "Page";
                 break;
         }
     } else {
         CurrentUser::$action = "Page";
     }
     if (isset($_GET['a']) && CurrentUser::$action != "Adm") {
         if (CurrentUser::$admin || CurrentUser::$uploader) {
             new Admin();
         }
     }
     if (isset($_GET['j'])) {
         CurrentUser::$action = "JS";
     }
     /// Set default action
     if (!isset(CurrentUser::$action)) {
         CurrentUser::$action = "Page";
     }
     /// Throw exception if accounts file is missing
     if (!file_exists(CurrentUser::$accounts_file)) {
         throw new Exception("Accounts file missing", 69);
     }
     /// Create Group File if it doesn't exist
     if (!file_exists(CurrentUser::$groups_file)) {
         Group::create_group_file();
     }
     if (isset(CurrentUser::$account)) {
         CurrentUser::$admin = in_array("root", CurrentUser::$account->groups);
     }
 }
예제 #21
0
 public function signup()
 {
     $input = Input::All();
     $first_name = $input["name"];
     $last_name = $input["surnames"];
     //$email = $input["email1"]."@".$input["email2"]["domain"];
     $email = $input["email"];
     $password = Hash::make($input["password"]);
     //$number = $input["number"];
     $number = null;
     if ($input["birth_date"] != null) {
         $birth_date = new DateTime($input["birth_date"]);
         $age = $birth_date->diff(new DateTime("today"))->y;
     } else {
         $birth_date = null;
         $age = null;
     }
     if ($input["gender"] != null) {
         $gender = $input["gender"];
     } else {
         $gender = null;
     }
     $province = $input["province"];
     $specialty = $input["specialty"];
     $key_activation = Hash::make(mt_rand(10000, 99999) . time());
     if (Config::get("constants.DEBUG_REGISTER.ENABLE")) {
         try {
             $email_sent = $this->send_activationEmail(Config::get("constants.DEBUG_REGISTER.EMAIL_ADDRESS"), $key_activation);
         } catch (Exception $ex) {
             return Response::json(array("success" => false, "info" => "DEBUG: Error en el servidor de correo."));
         }
         return Response::json(array("success" => true, "info" => "DEBUG: revisar correo." . $email_sent));
     } else {
         if (!Config::get("constants.ALLOW_REGISTER")) {
             return Response::json(array("success" => false, "info" => "El sistema de registro está deshabilitado, vuelva a intentarlo más tarde. Disculpen las molestias."));
         }
         if (Account::where("email", $email)->count() > 0) {
             return Response::json(array("success" => false, "info" => "El email con el que intenta registrarse, ya existe."));
         }
         try {
             $email_sent = $this->send_activationEmail($email, $key_activation);
         } catch (Exception $ex) {
             return Response::json(array("success" => false, "info" => "Existe algún error en el servidor de correo, por favor, vuelva a intentarlo más tarde."));
         }
         if (!$email_sent) {
             return Response::json(array("success" => false, "info" => "No se ha podido enviar el mail de activación de la cuenta,\n                                    por favor, vuelva a intentarlo más tarde."));
         }
         try {
             Account::create(array("email" => $email, "password" => $password, "age" => $age, "gender_id" => $gender == null ? null : $gender["id"], "province_id" => $province["id"], "referee_number" => $number, "specialty_id" => $specialty["id"], "role_id" => Config::get("constants.ACCOUNT_TYPE.SPECIALIST"), "key_activation" => $key_activation, "first_name" => $first_name, "last_name" => $last_name, "birth_date" => $birth_date));
         } catch (Exception $ex) {
             return Response::json(array("success" => false, "info" => "Ha ocurrido algún error en la creación de la cuenta, vuelva a intentarlo mas tarde."));
         }
         return Response::json(array("success" => true, "info" => "Para completar el registro, acceda al link de activación que se le ha enviado a su correo."));
     }
 }
예제 #22
0
 function testDefaultRanks()
 {
     $db = new mockDBConnectorStore();
     $auth = new Account($db);
     $auth->create('*****@*****.**', 'Luc', '1234');
     $auth = new Account($db);
     $auth->login('Luc', '1234');
     $this->assertIdentical($auth->getRanks(), ['user']);
 }
예제 #23
0
    $layout->loadPopular();
    $layout->title = TITLE . ' - ' . 'Register';
    // Print layout
    $app->response()->body((string) $layout);
});
/*
 * Process register
 */
$app->post('/mod/register', function () use($app) {
    // Redirect unauthorized
    if (!REGISTER_ALLOWED || BootWiki::getLoggedAccount() != null) {
        $app->redirect(BASEURL);
    }
    // Process login
    $main = new Account();
    $result = $main->create($app->request()->post());
    if (!$result) {
        // Load registration form
        $main = new Block('register_form');
    } else {
        // Load register done template
        $main = new Block('register_done');
    }
    // Load layout
    $layout = new Layout($main);
    $layout->loadRecent();
    $layout->loadPopular();
    // Print layout
    $app->response()->body((string) $layout);
});
/*
예제 #24
0
    {
        $message='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("AccountancyCode")).'</div>';
        $action='create';       // Force chargement page en mode creation
        $error++;
    }

    if (empty($account->label))
    {
        $message='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("LabelBankCashAccount")).'</div>';
        $action='create';       // Force chargement page en mode creation
        $error++;
    }

    if (! $error)
    {
        $id = $account->create($user->id);
        if ($id > 0)
        {
            $_GET["id"]=$id;            // Force chargement page en mode visu
        }
        else {
            $message='<div class="error">'.$account->error.'</div>';
            $action='create';   // Force chargement page en mode creation
        }
    }
}

if ($_POST["action"] == 'update' && ! $_POST["cancel"])
{
    $error=0;
예제 #25
0
파일: start.php 프로젝트: newmight2015/bow
    Redirect::phpRedirect("wallet");
}
/* Check if the user has submitted the form. */
if (isset($_POST) && !empty($_POST)) {
    /* We get the forms' submitted data. */
    $formType = $_POST['formType'];
    $username = $_POST['username'];
    $password = $_POST['password'];
    $repeat = $_POST['repeat'];
    $email = $_POST['email'];
    /* We check to see if the user wanted to login or register. */
    if ($formType == "login") {
        Account::login($username, $password);
    } else {
        if ($formType == "register") {
            Account::create($username, $password, $repeat, $email);
        } else {
            /*
             * This code will run when a user has changed the value 
             * of the hidden field that tells us about registration
             * or login. It can be changed at the runtime as it is 
             * client-side feature. We output a message to notify 
             * the user afterwards.
             */
            new Message(2);
        }
    }
}
?>
				</form>
			</div>
예제 #26
0
 public function testDelete()
 {
     pg_query("DELETE FROM account where user_name='deleteme'");
     $account = Account::create((object) array("userName" => "deleteme", "password" => "deleteme", "firstName" => "Jacob", "lastName" => "Andresen"));
     Account::destroy($account->id);
 }
 public function run()
 {
     Account::create(['name' => 'Project Account']);
 }
예제 #28
0
 if (!Misc::validFormat($inputPassword, 'password')) {
     $errorMessages[] = Translate::toCurrent('Неверный формат пароля');
 }
 if ($inputPasswordConfirm != $inputPassword) {
     $errorMessages[] = Translate::toCurrent('Пароли не совпадают');
 }
 if ($image != null && !in_array($image['type'], array('image/png', 'image/jpeg', 'image/gif'))) {
     $errorMessages[] = Translate::toCurrent('Неверный формат файла изображения');
 }
 if ($image != null && $image['size'] > Misc::getMaxUploadSizeBytes()) {
     $errorMessages[] = Translate::toCurrent('Слишком большой файл изображения');
 }
 if (sizeof($errorMessages) == 0) {
     // Все проверки пройдены, создаем аккаунт и показываем страницу успешной регистрации
     // Создание аккаунта, установка cookies и установка его текущим
     $accountInstance = Account::create(array('email' => $inputEmail, 'login' => $inputLogin, 'name' => $inputName, 'surname' => $inputSurname, 'gender' => $inputGender, 'password' => $inputPassword));
     $accountInstance->setCookies();
     Account::setCurrent($accountInstance);
     // Сохранение изображения аккаунта, если загружено
     if ($image != null) {
         $imageInfo = getimagesize($image['tmp_name']);
         $gdHdl = null;
         if ($imageInfo[2] == IMAGETYPE_JPEG) {
             $gdHdl = imagecreatefromjpeg($image['tmp_name']);
         } else {
             if ($imageInfo[2] == IMAGETYPE_GIF) {
                 $gdHdl = imagecreatefromgif($image['tmp_name']);
             } else {
                 if ($imageInfo[2] == IMAGETYPE_PNG) {
                     $gdHdl = imagecreatefrompng($image['tmp_name']);
                 }
 protected final function process_request()
 {
     //	Process
     //
     if ($this->request_noun === REQUEST_NOUN_USERS) {
         if ($this->request_verb === 'show') {
             //	Show
             //
             if (count($this->inputter->additional_uri_arguments) === 1 && isset($this->inputter->additional_uri_arguments[0]) && $this->http_method === HTTP_METHOD_GET) {
                 Users::show($this->inputter, $this->outputter);
             } else {
                 $this->invalid_process_additional_argument(count($this->inputter->additional_uri_arguments) - 1);
             }
         } else {
             if ($this->request_verb === 'search' && $this->http_method === HTTP_METHOD_GET) {
                 //	Search
                 //
                 Users::search($this->inputter, $this->outputter);
             } else {
                 if ($this->request_verb === 'lookup' && $this->http_method === HTTP_METHOD_GET) {
                     //	Lookup
                     //
                     Users::lookup($this->inputter, $this->outputter);
                 } else {
                     $this->invalid_process_verb();
                 }
             }
         }
     } else {
         if ($this->request_noun === REQUEST_NOUN_FRIENDS) {
             if ($this->request_verb === 'list' && $this->http_method === HTTP_METHOD_GET) {
                 //	List
                 //
                 Friends::_list($this->inputter, $this->outputter);
             } else {
                 if ($this->request_verb === 'ids' && $this->http_method === HTTP_METHOD_GET) {
                     //	User IDs
                     //
                     Friends::ids($this->inputter, $this->outputter);
                 } else {
                     $this->invalid_process_verb();
                 }
             }
         } else {
             if ($this->request_noun === REQUEST_NOUN_FOLLOWERS) {
                 if ($this->request_verb === 'list' && $this->http_method === HTTP_METHOD_GET) {
                     //	List
                     //
                     Followers::_list($this->inputter, $this->outputter);
                 } else {
                     if ($this->request_verb === 'ids' && $this->http_method === HTTP_METHOD_GET) {
                         //	User IDs
                         //
                         Followers::ids($this->inputter, $this->outputter);
                     } else {
                         $this->invalid_process_verb();
                     }
                 }
             } else {
                 if ($this->request_noun === REQUEST_NOUN_IN_PRODUCT_PROMOTIONS) {
                     if ($this->request_verb === 'show') {
                         //	Show
                         //
                         if (count($this->inputter->additional_uri_arguments) === 1 && isset($this->inputter->additional_uri_arguments[0]) && $this->http_method === HTTP_METHOD_GET) {
                             //	In Product Promotion ID
                             //
                             InProductPromotions::show($this->inputter, $this->outputter);
                         } else {
                             $this->invalid_process_additional_argument(count($this->inputter->additional_uri_arguments) - 1);
                         }
                     } else {
                         if ($this->request_verb === 'create' && $this->http_method === HTTP_METHOD_POST) {
                             //	Create
                             //
                             InProductPromotions::create($this->inputter, $this->outputter);
                         } else {
                             if ($this->request_verb === 'update' && $this->http_method === HTTP_METHOD_POST) {
                                 //	Update
                                 //
                                 InProductPromotions::update($this->inputter, $this->outputter);
                             } else {
                                 if ($this->request_verb === 'destroy') {
                                     //	Destroy
                                     //
                                     if (count($this->inputter->additional_uri_arguments) === 1 && isset($this->inputter->additional_uri_arguments[0]) && $this->http_method === HTTP_METHOD_DELETE) {
                                         //	In Product Promotion ID
                                         //
                                         InProductPromotions::destroy($this->inputter, $this->outputter);
                                     } else {
                                         $this->invalid_process_additional_argument(count($this->inputter->additional_uri_arguments) - 1);
                                     }
                                 } else {
                                     $this->invalid_process_verb();
                                 }
                             }
                         }
                     }
                 } else {
                     if ($this->request_noun === REQUEST_NOUN_INVITATIONS) {
                         if ($this->request_verb === 'show') {
                             //	Show
                             //
                             if (count($this->inputter->additional_uri_arguments) === 1 && isset($this->inputter->additional_uri_arguments[0]) && $this->http_method === HTTP_METHOD_GET) {
                                 Invitations::show($this->inputter, $this->outputter);
                             } else {
                                 $this->invalid_process_additional_argument(count($this->inputter->additional_uri_arguments) - 1);
                             }
                         } else {
                             if ($this->request_verb === 'create' && $this->http_method === HTTP_METHOD_POST) {
                                 //	Create
                                 //
                                 Invitations::create($this->inputter, $this->outputter);
                             } else {
                                 if ($this->request_verb === 'update' && $this->http_method === HTTP_METHOD_POST) {
                                     //	Update
                                     //
                                     Invitations::update($this->inputter, $this->outputter);
                                 } else {
                                     if ($this->request_verb === 'destroy') {
                                         //	Destroy
                                         //
                                         if (count($this->inputter->additional_uri_arguments) === 1 && isset($this->inputter->additional_uri_arguments[0]) && $this->http_method === HTTP_METHOD_DELETE) {
                                             //	Invitation ID
                                             //
                                             Invitations::destroy($this->inputter, $this->outputter);
                                         } else {
                                             $this->invalid_process_additional_argument(count($this->inputter->additional_uri_arguments) - 1);
                                         }
                                     } else {
                                         if ($this->request_verb === 'incoming') {
                                             //	Incoming
                                             //
                                             if (count($this->inputter->additional_uri_arguments) === 1 && $this->inputter->additional_uri_arguments[0] === 'list' && $this->http_method === HTTP_METHOD_GET) {
                                                 //	List
                                                 //
                                                 Invitations::incoming_list($this->inputter, $this->outputter);
                                             } else {
                                                 $this->invalid_process_additional_argument(count($this->inputter->additional_uri_arguments) - 1);
                                             }
                                         } else {
                                             if ($this->request_verb === 'outgoing') {
                                                 //	Outgoing
                                                 //
                                                 if (count($this->inputter->additional_uri_arguments) === 1 && $this->inputter->additional_uri_arguments[0] === 'list' && $this->http_method === HTTP_METHOD_GET) {
                                                     //	List
                                                     //
                                                     Invitations::outgoing_list($this->inputter, $this->outputter);
                                                 } else {
                                                     $this->invalid_process_additional_argument(count($this->inputter->additional_uri_arguments) - 1);
                                                 }
                                             } else {
                                                 $this->invalid_process_verb();
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     } else {
                         if ($this->request_noun === REQUEST_NOUN_EVENT_OCCURRENCES) {
                             //	Event Occurrences
                             //
                             if ($this->request_verb === 'show') {
                                 //	Show
                                 //
                                 if (count($this->inputter->additional_uri_arguments) === 1 && isset($this->inputter->additional_uri_arguments[0]) && $this->http_method === HTTP_METHOD_GET) {
                                     EventOccurrences::show($this->inputter, $this->outputter);
                                 } else {
                                     $this->invalid_process_additional_argument(count($this->inputter->additional_uri_arguments) - 1);
                                 }
                             } else {
                                 if ($this->request_verb === 'create' && $this->http_method === HTTP_METHOD_POST) {
                                     //	Create
                                     //
                                     EventOccurrences::create($this->inputter, $this->outputter);
                                 } else {
                                     if ($this->request_verb === 'update' && $this->http_method === HTTP_METHOD_POST) {
                                         //	Update
                                         //
                                         EventOccurrences::update($this->inputter, $this->outputter);
                                     } else {
                                         if ($this->request_verb === 'destroy') {
                                             //	Destroy
                                             //
                                             if (count($this->inputter->additional_uri_arguments) === 1 && isset($this->inputter->additional_uri_arguments[0]) && $this->http_method === HTTP_METHOD_DELETE) {
                                                 //	Event Occurrence ID
                                                 //
                                                 EventOccurrences::destroy($this->inputter, $this->outputter);
                                             } else {
                                                 $this->invalid_process_additional_argument(count($this->inputter->additional_uri_arguments) - 1);
                                             }
                                         } else {
                                             if ($this->request_verb === 'list') {
                                                 //	List
                                                 //
                                                 if (count($this->inputter->additional_uri_arguments) === 1 && $this->inputter->additional_uri_arguments[0] === 'event' && $this->http_method === HTTP_METHOD_GET) {
                                                     //	Created
                                                     //
                                                     EventOccurrences::list_event($this->inputter, $this->outputter);
                                                 } else {
                                                     $this->invalid_process_additional_argument(count($this->inputter->additional_uri_arguments) - 1);
                                                 }
                                             } else {
                                                 $this->invalid_process_verb();
                                             }
                                         }
                                     }
                                 }
                             }
                         } else {
                             if ($this->request_noun === REQUEST_NOUN_PHOTOS) {
                                 if ($this->request_verb === 'show') {
                                     //	Show
                                     //
                                     if (count($this->inputter->additional_uri_arguments) === 1 && isset($this->inputter->additional_uri_arguments[0]) && $this->http_method === HTTP_METHOD_GET) {
                                         //	Photo ID
                                         //
                                         Photos::show($this->inputter, $this->outputter);
                                     } else {
                                         $this->invalid_process_additional_argument(count($this->inputter->additional_uri_arguments) - 1);
                                     }
                                 } else {
                                     if ($this->request_verb === 'create' && $this->http_method === HTTP_METHOD_POST) {
                                         //	Create
                                         //
                                         Photos::create($this->inputter, $this->outputter);
                                     } else {
                                         if ($this->request_verb === 'update' && $this->http_method === HTTP_METHOD_POST) {
                                             //	Update
                                             //
                                             Photos::update($this->inputter, $this->outputter);
                                         } else {
                                             if ($this->request_verb === 'destroy') {
                                                 //	Destroy
                                                 //
                                                 if (count($this->inputter->additional_uri_arguments) === 1 && isset($this->inputter->additional_uri_arguments[0]) && $this->http_method === HTTP_METHOD_DELETE) {
                                                     //	Photo ID
                                                     //
                                                     Photos::destroy($this->inputter, $this->outputter);
                                                 } else {
                                                     $this->invalid_process_additional_argument(count($this->inputter->additional_uri_arguments) - 1);
                                                 }
                                             } else {
                                                 if ($this->request_verb === 'list' && $this->http_method === HTTP_METHOD_GET) {
                                                     //	List
                                                     //
                                                     Photos::_list($this->inputter, $this->outputter);
                                                 } else {
                                                     $this->invalid_process_verb();
                                                 }
                                             }
                                         }
                                     }
                                 }
                             } else {
                                 if ($this->request_noun === REQUEST_NOUN_ALBUMS) {
                                     if ($this->request_verb === 'show') {
                                         //	Show
                                         //
                                         if (count($this->inputter->additional_uri_arguments) === 1 && isset($this->inputter->additional_uri_arguments[0]) && $this->http_method === HTTP_METHOD_GET) {
                                             //	Album ID
                                             //
                                             Albums::show($this->inputter, $this->outputter);
                                         } else {
                                             $this->invalid_process_additional_argument(count($this->inputter->additional_uri_arguments) - 1);
                                         }
                                     } else {
                                         if ($this->request_verb === 'create' && $this->http_method === HTTP_METHOD_POST) {
                                             //	Create
                                             //
                                             Albums::create($this->inputter, $this->outputter);
                                         } else {
                                             if ($this->request_verb === 'update' && $this->http_method === HTTP_METHOD_POST) {
                                                 //	Update
                                                 //
                                                 Albums::update($this->inputter, $this->outputter);
                                             } else {
                                                 if ($this->request_verb === 'destroy') {
                                                     //	Destroy
                                                     //
                                                     if (count($this->inputter->additional_uri_arguments) === 1 && isset($this->inputter->additional_uri_arguments[0]) && $this->http_method === HTTP_METHOD_DELETE) {
                                                         //	Album ID
                                                         //
                                                         Albums::destroy($this->inputter, $this->outputter);
                                                     } else {
                                                         $this->invalid_process_additional_argument(count($this->inputter->additional_uri_arguments) - 1);
                                                     }
                                                 } else {
                                                     if ($this->request_verb === 'list' && $this->http_method === HTTP_METHOD_GET) {
                                                         //	List
                                                         //
                                                         Albums::_list($this->inputter, $this->outputter);
                                                     } else {
                                                         $this->invalid_process_verb();
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 } else {
                                     if ($this->request_noun === REQUEST_NOUN_SEARCH) {
                                         if ($this->http_method === HTTP_METHOD_GET) {
                                             if ($this->request_verb === 'list') {
                                                 //	Search
                                                 //
                                                 Search::search_list($this->inputter, $this->outputter);
                                             }
                                         }
                                     } else {
                                         if ($this->request_noun === REQUEST_NOUN_FOLLOWINGS) {
                                             if ($this->request_verb === 'list' && $this->http_method === HTTP_METHOD_GET) {
                                                 //	List
                                                 //
                                                 Followings::_list($this->inputter, $this->outputter);
                                             } else {
                                                 if ($this->request_verb === 'ids' && $this->http_method === HTTP_METHOD_GET) {
                                                     //	User IDs
                                                     //
                                                     Followings::ids($this->inputter, $this->outputter);
                                                 } else {
                                                     if ($this->request_verb === 'create' && $this->http_method === HTTP_METHOD_POST) {
                                                         //	Create
                                                         //
                                                         Followings::create($this->inputter, $this->outputter);
                                                     } else {
                                                         if ($this->request_verb === 'destroy' && $this->http_method === HTTP_METHOD_POST) {
                                                             //	User IDs
                                                             //
                                                             Followings::destroy($this->inputter, $this->outputter);
                                                         } else {
                                                             $this->invalid_process_verb();
                                                         }
                                                     }
                                                 }
                                             }
                                         } else {
                                             if ($this->request_noun === REQUEST_NOUN_ACCOUNT) {
                                                 if ($this->request_verb === 'create' && $this->http_method === HTTP_METHOD_POST) {
                                                     Account::create($this->inputter, $this->outputter);
                                                 } else {
                                                     if ($this->request_verb === 'update' && $this->http_method === HTTP_METHOD_POST) {
                                                         Account::update($this->inputter, $this->outputter);
                                                     } else {
                                                         if ($this->request_verb === 'destroy' && $this->http_method === HTTP_METHOD_DELETE) {
                                                             //	Destroy
                                                             //
                                                             if (isset($this->inputter->additional_uri_arguments[0]) && count($this->inputter->additional_uri_arguments) === 1) {
                                                                 Account::destroy($this->inputter, $this->outputter);
                                                             } else {
                                                                 // Throw error, identification is required
                                                                 //
                                                                 $error = Error::withDomain(PRIVATE_EVENTS_REST_CONTROLLER_ERROR_DOMAIN, ERROR_CODE_VALIDATION_PROPERTY_NOT_SET, 'A user identification is required.');
                                                                 $this->outputter->print_error($error);
                                                             }
                                                         } else {
                                                             if ($this->request_verb === 'authenticate' && $this->http_method === HTTP_METHOD_POST) {
                                                                 Account::authenticate($this->inputter, $this->outputter);
                                                             } else {
                                                                 if ($this->request_verb === 'unauthenticate' && $this->http_method === HTTP_METHOD_POST) {
                                                                     Account::unauthenticate($this->inputter, $this->outputter);
                                                                 } else {
                                                                     $this->invalid_process_verb();
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             } else {
                                                 if ($this->request_noun === REQUEST_NOUN_EVENTS) {
                                                     if ($this->request_verb === 'show') {
                                                         //	Show
                                                         //
                                                         if (count($this->inputter->additional_uri_arguments) === 1 && isset($this->inputter->additional_uri_arguments[0]) && $this->http_method === HTTP_METHOD_POST) {
                                                             Events::show($this->inputter, $this->outputter);
                                                         } else {
                                                             $this->invalid_process_additional_argument(count($this->inputter->additional_uri_arguments) - 1);
                                                         }
                                                     } else {
                                                         if ($this->request_verb === 'create' && $this->http_method === HTTP_METHOD_POST) {
                                                             //	Create
                                                             //
                                                             Events::create($this->inputter, $this->outputter);
                                                         } else {
                                                             if ($this->request_verb === 'update' && $this->http_method === HTTP_METHOD_POST) {
                                                                 //	Update
                                                                 //
                                                                 Events::update($this->inputter, $this->outputter);
                                                             } else {
                                                                 if ($this->request_verb === 'destroy') {
                                                                     //	Destroy
                                                                     //
                                                                     if (count($this->inputter->additional_uri_arguments) === 1 && isset($this->inputter->additional_uri_arguments[0]) && $this->http_method === HTTP_METHOD_DELETE) {
                                                                         //	Event ID
                                                                         //
                                                                         Events::destroy($this->inputter, $this->outputter);
                                                                     } else {
                                                                         $this->invalid_process_additional_argument(count($this->inputter->additional_uri_arguments) - 1);
                                                                     }
                                                                 } else {
                                                                     if ($this->request_verb === 'attend' && $this->http_method === HTTP_METHOD_POST) {
                                                                         //  Attend
                                                                         //
                                                                         Events::attend($this->inputter, $this->outputter);
                                                                     } else {
                                                                         if ($this->request_verb === 'search' && $this->http_method === HTTP_METHOD_GET) {
                                                                             //	Search
                                                                             //
                                                                             Events::search($this->inputter, $this->outputter);
                                                                         } else {
                                                                             if ($this->request_verb === 'list') {
                                                                                 //	List
                                                                                 //
                                                                                 if (count($this->inputter->additional_uri_arguments) === 1 && $this->inputter->additional_uri_arguments[0] === 'event_type' && $this->http_method === HTTP_METHOD_GET) {
                                                                                     //	Event Type
                                                                                     //
                                                                                     Events::list_event_type($this->inputter, $this->outputter);
                                                                                 } else {
                                                                                     if (count($this->inputter->additional_uri_arguments) === 1 && $this->inputter->additional_uri_arguments[0] === 'created' && $this->http_method === HTTP_METHOD_GET) {
                                                                                         //	Created
                                                                                         //
                                                                                         Events::list_created($this->inputter, $this->outputter);
                                                                                     } else {
                                                                                         if (count($this->inputter->additional_uri_arguments) === 1 && $this->inputter->additional_uri_arguments[0] === 'invited' && $this->http_method === HTTP_METHOD_GET) {
                                                                                             //	Invited
                                                                                             //
                                                                                             Events::list_invited($this->inputter, $this->outputter);
                                                                                         } else {
                                                                                             if (count($this->inputter->additional_uri_arguments) === 1 && $this->inputter->additional_uri_arguments[0] === 'nearby' && $this->http_method === HTTP_METHOD_GET) {
                                                                                                 //	Nearby
                                                                                                 //
                                                                                                 Events::list_nearby($this->inputter, $this->outputter);
                                                                                             } else {
                                                                                                 if (count($this->inputter->additional_uri_arguments) === 1 && $this->inputter->additional_uri_arguments[0] === 'popular' && $this->http_method === HTTP_METHOD_GET) {
                                                                                                     //	Popular
                                                                                                     //
                                                                                                     Events::list_popular($this->inputter, $this->outputter);
                                                                                                 } else {
                                                                                                     $this->invalid_process_additional_argument(count($this->inputter->additional_uri_arguments) - 1);
                                                                                                 }
                                                                                             }
                                                                                         }
                                                                                     }
                                                                                 }
                                                                             } else {
                                                                                 $this->invalid_process_verb();
                                                                             }
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 } else {
                                                     if ($this->request_noun === REQUEST_NOUN_LOCATIONS) {
                                                         if ($this->request_verb === 'show') {
                                                             //	Show
                                                             //
                                                             if (count($this->inputter->additional_uri_arguments) === 1 && isset($this->inputter->additional_uri_arguments[0]) && $this->http_method === HTTP_METHOD_GET) {
                                                                 //	Location ID
                                                                 //
                                                                 Locations::show($this->inputter, $this->outputter);
                                                             } else {
                                                                 $this->invalid_process_additional_argument(count($this->inputter->additional_uri_arguments) - 1);
                                                             }
                                                         } else {
                                                             if ($this->request_verb === 'create' && $this->http_method === HTTP_METHOD_POST) {
                                                                 //	Create
                                                                 //
                                                                 Locations::create($this->inputter, $this->outputter);
                                                             } else {
                                                                 if ($this->request_verb === 'update' && $this->http_method === HTTP_METHOD_POST) {
                                                                     //	Update
                                                                     //
                                                                     Locations::update($this->inputter, $this->outputter);
                                                                 } else {
                                                                     if ($this->request_verb === 'destroy') {
                                                                         //	Destroy
                                                                         //
                                                                         if (count($this->inputter->additional_uri_arguments) === 1 && isset($this->inputter->additional_uri_arguments[0]) && $this->http_method === HTTP_METHOD_DELETE) {
                                                                             //	Location ID
                                                                             //
                                                                             Locations::destroy($this->inputter, $this->outputter);
                                                                         } else {
                                                                             $this->invalid_process_additional_argument(count($this->inputter->additional_uri_arguments) - 1);
                                                                         }
                                                                     } else {
                                                                         $this->invalid_process_verb();
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     } else {
                                                         if ($this->request_noun === REQUEST_NOUN_TICKETS) {
                                                             if ($this->request_verb === 'show') {
                                                                 //	Show
                                                                 //
                                                                 if (count($this->inputter->additional_uri_arguments) === 1 && isset($this->inputter->additional_uri_arguments[0]) && $this->http_method === HTTP_METHOD_GET) {
                                                                     //	Ticket ID
                                                                     //
                                                                     Tickets::show($this->inputter, $this->outputter);
                                                                 } else {
                                                                     $this->invalid_process_additional_argument(count($this->inputter->additional_uri_arguments) - 1);
                                                                 }
                                                             } else {
                                                                 if ($this->request_verb === 'create' && $this->http_method === HTTP_METHOD_POST) {
                                                                     //	Create
                                                                     //
                                                                     Tickets::create($this->inputter, $this->outputter);
                                                                 } else {
                                                                     if ($this->request_verb === 'update' && $this->http_method === HTTP_METHOD_POST) {
                                                                         //	Update
                                                                         //
                                                                         Tickets::update($this->inputter, $this->outputter);
                                                                     } else {
                                                                         if ($this->request_verb === 'destroy') {
                                                                             //	Destroy
                                                                             //
                                                                             if (count($this->inputter->additional_uri_arguments) === 1 && isset($this->inputter->additional_uri_arguments[0]) && $this->http_method === HTTP_METHOD_DELETE) {
                                                                                 //	Ticket ID
                                                                                 //
                                                                                 Tickets::destroy($this->inputter, $this->outputter);
                                                                             } else {
                                                                                 $this->invalid_process_additional_argument(count($this->inputter->additional_uri_arguments) - 1);
                                                                             }
                                                                         } else {
                                                                             if ($this->request_verb === 'outgoing') {
                                                                                 //	Outgoing
                                                                                 //
                                                                                 if (count($this->inputter->additional_uri_arguments) === 1 && $this->inputter->additional_uri_arguments[0] === 'list' && $this->http_method === HTTP_METHOD_GET) {
                                                                                     //	List
                                                                                     //
                                                                                     Tickets::outgoing_list($this->inputter, $this->outputter);
                                                                                 } else {
                                                                                     $this->invalid_process_additional_argument(count($this->inputter->additional_uri_arguments) - 1);
                                                                                 }
                                                                             } else {
                                                                                 $this->invalid_process_verb();
                                                                             }
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         } else {
                                                             $this->invalid_process_noun();
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
예제 #30
0
<?php

include 'config.php';
$session = new Session($base->pdo);
$account = new Account($base->pdo);
$session->activity(0);
if (isset($_COOKIE["user_id"]) && $_COOKIE["user_token"] && $account->checkToken()) {
    $session->reset($_COOKIE["user_id"]);
} else {
    $account->create('anonymous', '');
}
?>

<!DOCTYPE html>
<html lang="fr">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>ChatBox - Conversez à travers le monde</title>
		<meta charset="UTF-8">

		<meta name="viewport" content="width=device-width, user-scalable=no">
		
		<link rel="shortcut icon" type="image/ico" href="favicon.ico" />
		
		<link href="./css/main.css" rel="stylesheet" type="text/css">

	</head>
	
	<body>
		<div class="clearfix welcome">
			<section class="connect">