Пример #1
0
 /**
  * function show
  * render and return content
  */
 function show()
 {
     header('Content-type: application/json');
     $data = json_decode(file_get_contents("php://input"), true);
     $generated_user = User::generate_newbie_username(Misc::escape_text($data['email']));
     User::register_user(['username' => $generated_user, 'password' => Misc::escape_text($data['password']), 'email' => Misc::escape_text($data['email'])]);
 }
Пример #2
0
 /**
  * function show
  * render and return content
  */
 function show()
 {
     header('Content-type: application/json; charset=utf-8');
     $data = json_decode(file_get_contents("php://input"), true);
     $data['password'] = '';
     User::change_email($data, Data::$user_instance->user_id);
 }
Пример #3
0
 /**
  * function show
  * render and return content
  */
 function show()
 {
     $data = json_decode(file_get_contents("php://input"), true);
     if (isset($data['name'])) {
         User::register_user($data, true);
         return null;
     }
     $user_mail = Data::$user_instance->user_email;
     $master = [];
     foreach (Adapter::secure_query("SELECT username FROM users WHERE mail = :usermail", [':usermail' => $user_mail]) as $row) {
         $master[] = json_decode(Data::$user_instance->get_user_data(4, $row['username']), true);
     }
     return json_encode($master);
 }
Пример #4
0
 /**
  * function show
  * render and return content
  */
 function show()
 {
     $data = json_decode(file_get_contents("php://input"), true);
     if (Adapter::row_count(Adapter::secure_query('SELECT * FROM cms_restore_password WHERE user_hash = :userhash LIMIT 1', [':userhash' => $data['token']])) == 1) {
         $get = Adapter::fetch_object(Adapter::secure_query('SELECT * FROM cms_restore_password WHERE user_hash = :userhash LIMIT 1', [':userhash' => $data['token']]));
         $row = Adapter::fetch_object(Adapter::secure_query('SELECT * FROM users WHERE id = :userid LIMIT 1', [':userid' => $get->user_id]));
         $data['currentPassword'] = '';
         User::change_password($data, $row->id, false);
         Adapter::secure_query('DELETE FROM cms_restore_password WHERE user_hash = :userhash', [':userhash' => $data['token']]);
         return null;
     }
     header('HTTP/1.1 404 Not Found');
     return null;
 }
Пример #5
0
 /**
  * function show
  * render and return content
  */
 function show()
 {
     $data = json_decode(file_get_contents("php://input"), true);
     $data['currentPassword'] = $data['password'];
     header('Content-type: application/json');
     if (User::change_password($data, Data::$user_instance->user_id, true, false) == true) {
         $query = Adapter::fetch_object(Adapter::secure_query('SELECT trade_lock FROM users WHERE id = :userid', [':userid' => Data::$user_instance->user_id]));
         if ($query->trade_lock == 0) {
             Adapter::secure_query('UPDATE users SET trade_lock = :statusl WHERE id = :userid', [':statusl' => '1', ':userid' => Data::$user_instance->user_id]);
         }
         if (Adapter::row_count(Adapter::secure_query('SELECT * FROM cms_security_questions WHERE user_id = :userid', [':userid' => Data::$user_instance->user_id])) == 0) {
             Adapter::secure_query('INSERT INTO cms_security_questions (user_id,question_one,question_two) VALUES (:userid,:questionone,:questiontwo)', [':questionone' => $data['answer1'], ':questiontwo' => $data['answer2'], ':userid' => Data::$user_instance->user_id]);
         }
         Adapter::secure_query('UPDATE cms_security_questions SET question_one = :questionone, question_two = :questiontwo WHERE user_id = :userid', [':questionone' => $data['answer1'], ':questiontwo' => $data['answer2'], ':userid' => Data::$user_instance->user_id]);
         return null;
     }
     header('HTTP/1.1 400 Bad Request');
     $error_object = new stdClass();
     $error_object->error = 'invalid_password';
     return json_encode($error_object);
 }
Пример #6
0
 /**
  * function load_page
  * load the page
  * @param bool $render_page
  */
 private function load_page($render_page = true)
 {
     $this->check_installation();
     // collect user and system data
     $init = Data::check_if_user_exists() ? Data::$user_instance : null;
     // universalize the settings
     $page = new Page($database_settings = unserialize(DATABASE_SETTINGS), $system_settings = unserialize(SYSTEM_SETTINGS), $init);
     // start cms settings
     Data::system_create_instance($system_settings['server_lang']);
     // check of banned user
     User::check_banned_account();
     // set the page & store page data
     if ($render_page) {
         $this->page = $this->page . $page->serialize_page($page->create_page($page->trace_routers()));
     }
     // let's do benchmark
     if ($system_settings['bench_enabled']) {
         $this->page = $this->page . "<!-- \r\n" . Benchmark::run(false) . " \r\n -->";
     }
     // oke!
 }
Пример #7
0
 /**
  * function show
  * render and return content
  */
 function show()
 {
     header('Content-type: application/json');
     $data = json_decode(file_get_contents("php://input"), true);
     User::change_password($data, Data::$user_instance->user_id);
 }
Пример #8
0
 /**
  * function show
  * render and return content
  */
 function show()
 {
     header('Content-type: application/json');
     $data = json_decode(file_get_contents("php://input"), true);
     User::user_login(Misc::escape_text($data['email']), Misc::escape_text($data['password']));
 }
Пример #9
0
 /**
  * function serialize
  * serialize content
  * @param string $wait_serialize
  * @return mixed
  */
 function serialize_page($wait_serialize = '')
 {
     // lang serialize
     $this->load_json(Data::$system_instance->server_lang);
     // foreach lang data
     foreach ($this->lang_content as $key => $value) {
         $wait_serialize = strpos($wait_serialize, '{{lang_' . strtolower($key) . '}}') != false ? str_replace('{{lang_' . strtolower($key) . '}}', $value, $wait_serialize) : $wait_serialize;
     }
     // foreach user data
     foreach ($this->user_data as $key => $value) {
         $wait_serialize = strpos($wait_serialize, '{{' . strtolower($key) . '}}') != false ? str_replace('{{' . strtolower($key) . '}}', $value, $wait_serialize) : $wait_serialize;
     }
     // foreach settings data
     foreach ($this->cms_settings as $key => $value) {
         $wait_serialize = strpos($wait_serialize, '{{' . strtolower($key) . '}}') != false ? str_replace('{{' . strtolower($key) . '}}', $value, $wait_serialize) : $wait_serialize;
     }
     // foreach system data
     foreach (System::get_system_class() as $key => $value) {
         $wait_serialize = strpos($wait_serialize, '{{' . strtolower($key) . '}}') != false ? str_replace('{{' . strtolower($key) . '}}', $value, $wait_serialize) : $wait_serialize;
     }
     // for the client..
     $wait_serialize = strpos($wait_serialize, '{{client_tick}}') != false ? str_replace('{{client_tick}}', User::generate_ticket(), $wait_serialize) : $wait_serialize;
     $wait_serialize = strpos($wait_serialize, '{{user_data}}') != false ? str_replace('{{user_data}}', Data::check_if_user_exists() ? Data::$user_instance->get_user_data(4) : 'null', $wait_serialize) : $wait_serialize;
     $wait_serialize = strpos($wait_serialize, '{{user_hash}}') != false ? str_replace('{{user_hash}}', User::user_hash(), $wait_serialize) : $wait_serialize;
     // let's go
     return $wait_serialize;
 }