Advertisement
fabi0

Untitled

May 16th, 2014
322
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.44 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4.  * To change this license header, choose License Headers in Project Properties.
  5.  * To change this template file, choose Tools | Templates
  6.  * and open the template in the editor.
  7.  */
  8.  
  9. /**
  10.  * Description of mainController
  11.  *
  12.  * @author fabi0
  13.  */
  14.  
  15. namespace Load;
  16.  
  17. class mainController {
  18.  
  19.     protected function render($path, $data = array()) {
  20.         $data = (object) $data;
  21.         include "Views/" . $path . '.php';
  22.     }
  23.  
  24.     protected function toAscii($str, $replace = array(), $delimiter = '-') {
  25.         setlocale(LC_ALL, 'en_BG.UTF8');
  26.         if (!empty($replace)) {
  27.             $str = str_replace((array) $replace, ' ', $str);
  28.         }
  29.  
  30.         //$clean = iconv('UTF-8', 'ASCII//TRANSLIT', $str);
  31.         $clean = preg_replace("/[^a-zA-Z0-9\/_|+ -]/", '', $str);
  32.         $clean = strtolower(trim($clean, '-'));
  33.         $clean = preg_replace("/[\/_|+ -]+/", $delimiter, $clean);
  34.  
  35.         return $clean;
  36.     }
  37.  
  38.     public static function alive($user_id) {
  39.  
  40.         $database = \Models\DB::getInstance();
  41.         $sql = "UPDATE `users` SET `user_active` = :time WHERE `users`.`user_id` = :user_id;";
  42.         $param = array(
  43.             ':time' => array(
  44.                 'param' => time(),
  45.                 'type' => 2
  46.             ),
  47.             ':user_id' => array(
  48.                 'param' => $user_id,
  49.                 'type' => 2
  50.             )
  51.         );
  52.         $database->query($sql, $param);
  53.     }
  54.  
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement