示例#1
0
 public function setUp()
 {
     $this->CI =& get_instance();
     $this->CI->CLI = load_controller('CLI');
     $this->CI->CLI->install();
     $this->CI->CLI->add('administrator', '*****@*****.**', 'password123');
 }
示例#2
0
 /**
  * Constructor: __construct
  * There is no other method in our API , when it is constructed , everything will fires
  */
 public function __construct($request)
 {
     // Get the request , which is an array of ($id , $token , $args , $params , $popo , ....)
     $data = new Request($request);
     // check if there is controller with this endpoint name :
     load_controller($data->endpoint);
     /*
                     Explanation : 
         if there is a popo name in request , we dont need to instantiate the endpoint 
                     because the popo itself can access the property of its father ( which is the endpoint )
         if there is no popo
                     then we must instantiate the Parent class for example : Products 
                     this will just fire a mainRouter function in that class 
                     
                     So : mainRouter only will fire if there is no popo specified !
     */
     if ($data->popo != '') {
         // means there is a method(verb) beside of the endpoint
         // Load the popo
         load_popo($data->endpoint, $data->popo);
         // popo name like : ProdutcsSale   = > Products is a endpoint and Sale is a popo
         $class_name = $data->endpoint . $data->popo;
         // instantiate the popo class
         $this->controller = new $class_name($data, array());
         new Response($this->controller->response, $data);
     } else {
         // no popo
         $this->controller = new $data->endpoint();
         $this->controller->{"mainRouter"}($data, array());
         new Response($this->controller->response, $data);
     }
 }
示例#3
0
文件: akun.php 项目: GGie/Web
 function masuk()
 {
     if ($this->input->post('login')) {
         $email = $this->input->post('email');
         $password = $this->input->post('password');
         $this->db->select('*');
         $this->db->from('users');
         $this->db->where('email', $email);
         $this->db->where('password', $password);
         $this->db->where('status_id', 1);
         $result = $this->db->limit(1)->get();
         $sess_array = array();
         if ($result->num_rows() == 1) {
             foreach ($result->result() as $row) {
                 $sess_array = array('id_user' => $row->id_user, 'username' => $row->username, 'email' => $row->email, 'password' => $row->password, 'level' => $row->level, 'status_id' => true);
                 $this->session->set_userdata($sess_array);
                 redirect('profile/id/' . $row->id_user, 'refresh');
             }
         } else {
             echo "<script>alert('Username atau Password salah!!')</script>";
             redirect('masuk/login', 'refresh');
         }
     }
     $data_param = "";
     echo load_controller("web", "web", "web_header", $data_param);
     echo load_controller("web", "web", "web_open_content", $data_param);
     $this->load->view("akun/masuk", $data_param);
     echo load_controller("web", "web", "web_close_content", $data_param);
     echo load_controller("web", "web", "web_footer", $data_param);
 }
示例#4
0
 /**
  * Frontend::loader()
  * 
  * @return
  */
 public function loader()
 {
     $uri_segments = $this->uri->rsegment_array();
     // $uri_segments[0] fehlt, da des erste Segment der Ordner des Controller ist
     $controller = $uri_segments[3];
     $function = $uri_segments[4];
     if (count($uri_segments) > 4) {
         $j = 0;
         $args = array();
         for ($i = 5; $i <= count($uri_segments); $i++) {
             $args[$j] = $uri_segments[$i];
             $j++;
         }
     }
     if ($controller == $this->router->class) {
         // dynamisch Funktionen des Frontend Controllers laden
         $this->{$function}($args);
     } else {
         if ($controller == 'page') {
             // dynamisch Inhaltseiten laden
             $this->load->helper('load_controller');
             //      $this->load->controller('pages/pages', 'c_pages');
             $c_pages = load_controller('pages/pages');
             $c_pages->{$function}($args[0]);
         } else {
             // dynamisch Modulseiten laden
         }
     }
 }
 public function move_out()
 {
     $lease_id = $this->uri->segment(3);
     $house_id = $this->uri->segment(4);
     $this->Lease_model->check_out($lease_id);
     $this->house_model->house_check_out($house_id);
     $this->Invoice_model->invoice_check_out();
     load_controller('menu_con', 'move_out');
 }
示例#6
0
文件: produk.php 项目: GGie/Web
 function kategori()
 {
     $data_param = "";
     echo load_controller("web", "web", "web_header", $data_param);
     echo load_controller("web", "web", "web_open_content", $data_param);
     //$this->load->view("product/detail_product",$data_param);
     echo load_controller("web", "web", "web_close_content", $data_param);
     echo load_controller("web", "web", "web_footer", $data_param);
 }
 function add_utility()
 {
     $water = $this->input->post('water');
     $elec = $this->input->post('electric');
     $date = date('Y-m-d');
     $data = array('water_rate' => $water, 'electric_rate' => $elec, 'date_edit' => $date);
     $this->Utility_model->insert_utility($data);
     load_controller('menu_con', 'expense');
 }
 function delete_user()
 {
     $data['cus_id'] = $this->uri->segment(3);
     $this->Customer_model->delete($data['cus_id']);
     echo '<script language="javascript">';
     echo 'alert("Customer Deleted !!")';
     echo '</script>';
     $this->load->view('blank');
     load_controller('menu_con', 'customer_manage');
 }
示例#9
0
function handle_controller($base, $arr)
{
    $controller = load_controller($base, $arr[1]);
    $method = 'index';
    if (!empty($uri[2])) {
        $method = preg_replace('/[^a-zA-Z0-9]+/', '', $uri[2]);
    }
    if (method_exists($controller, $method)) {
        $controller->{$method}();
    }
}
示例#10
0
文件: produk.php 项目: GGie/CI
 function kategori()
 {
     $data_param = "";
     $url = $this->uri->segment(3);
     $url_1 = explode("-", $url);
     $id = $url_1[0];
     $data_param['data_kategori_lelang'] = load_model("produk", "produk_model", "get_detail_kategori", array('id' => $id));
     echo load_controller("web", "web", "web_header", $data_param);
     echo load_controller("web", "web", "web_open_content", $data_param);
     $this->load->view("produk/detail_kategori", $data_param);
     echo load_controller("web", "web", "web_close_content", $data_param);
     echo load_controller("web", "web", "web_footer", $data_param);
 }
示例#11
0
 /**
  * User_Auth::forgot_password()
  * Sendet dem User einen Token zum zurücksetzen des Passworts zu
  *
  * @return
  */
 public function forgot_password()
 {
     $c_admin = load_controller('admin/admin');
     $result = $this->cp_auth->forgotten_password($this->input->post('email'));
     $messages = $this->cp_auth->get_messages_array('public');
     if (!$result) {
         $c_admin->login('password', $messages);
     } else {
         $header['title'] = 'Backend Login';
         $data['message'] = $messages;
         $this->load->view('backend/templates/admin/header_login', $header);
         $this->load->view('backend/admin/new_password', $data);
         $this->load->view('backend/templates/admin/footer_login');
     }
 }
 function getInput()
 {
     $username = $this->input->post('txtusername');
     $password = $this->input->post('txtpassword');
     $comfirmpassword = $this->input->Post('txtConPassword');
     $name = $this->input->post('txtname');
     $email = $this->input->post('txtemail');
     $phone = $this->input->post('txtphone');
     $priority = $this->input->post('txtpriority');
     $data = array('username' => $username, 'password' => $password, 'user_name' => $name, 'email' => $email, 'phone' => $phone, 'priority' => $priority);
     $this->user_model->insert($data);
     echo '<script language="javascript">';
     echo 'alert("Successfully Registered!!")';
     echo '</script>';
     load_controller('menu_con', 'index');
 }
示例#13
0
 public function verifylogin()
 {
     $this->load->library('form_validation');
     $this->form_validation->set_rules('username', 'username', 'trim|required|xss_clean');
     $this->form_validation->set_rules('password', 'password', 'trim|required|xss_clean|callback_check_database');
     //$this->form_validation->set_rules('password_confirm', 'Password Confirmation', 'required');
     if ($this->form_validation->run() == FALSE) {
         //  $this->load->view('login_form');
         $error = "<li>Username or Password is Not Valid</li>";
         $data = array('error' => $error);
         $this->view_error($data);
         //$this->load->view('home_control/view_error',$error);
     } else {
         load_controller('menu_con', 'index');
     }
 }
示例#14
0
function routing()
{
    global $config;
    $requests = requests();
    $controller = get_controller();
    # Routing
    if (!$controller) {
        $controller = $config["default-controller"];
        if (!$controller) {
            echo "<span style='color:#900'>No default controller set!</span><br />";
        } else {
            load_controller($controller);
        }
    } else {
        load_controller($controller);
    }
}
示例#15
0
function routing()
{
    global $config;
    $requests = requests();
    $controller = get_controller();
    # Routing
    if (!$controller) {
        $controller = $config["default-controller"];
        if (!$controller) {
            $data = array("msg" => "No default controller set!");
            respond($data, 500);
        } else {
            load_controller($controller);
        }
    } else {
        load_controller($controller);
    }
}
示例#16
0
 public function index()
 {
     $data['house_id'] = $this->uri->segment(3);
     $result = $this->house_model->select_id($data['house_id']);
     $l_house_id = $data['house_id'];
     $lease_house_data = $this->Lease_model->select_lease_id($l_house_id);
     $housename = $result['house_name'];
     if ($lease_house_data != array()) {
         //print_r($lease_house_data);
         //print_r($result);
         $data = array('housename' => $housename, 'lease_house_data' => $lease_house_data);
         $this->load->view('lease_agreement_view', $data);
     } else {
         echo "<script type=\"text/javascript\">alert('No have Lease agreement.') </script>";
         load_controller('menu_con', 'history');
     }
     //$this->load->view('lease_agreement_view',$result);
 }
示例#17
0
 public function move_out()
 {
     $lease_id = $this->uri->segment(3);
     $house_id = $this->uri->segment(4);
     $check = $this->Invoice_model->invoice_check_out($lease_id);
     if ($check != NULL) {
         echo '<script language="javascript">';
         echo 'alert("สัญญานี้ไม่สามารถยกเลิกได้ เนื่องจากยังชำระเงินไม่ครบ !!")';
         echo '</script>';
         load_controller('menu_con', 'move_out');
     } else {
         echo '<script language="javascript">';
         echo 'alert("Success !!")';
         echo '</script>';
     }
     /*		$this->Lease_model->check_out($lease_id);
     			$this->house_model->house_check_out($house_id);
     			$this->Invoice_model->close($lease_id);*/
     load_controller('menu_con', 'move_out');
 }
示例#18
0
文件: loader.php 项目: lkmmmj/iphp
function route()
{
    foreach (include_paths() as $path) {
        $base = $path['base'];
        $action = $path['action'];
        $controller = load_controller($base, $action);
        if ($controller) {
            if (strpos($base, '/index') === strlen($base) - 6) {
                $base = substr($base, 0, strlen($base) - 6);
            }
            $controller->module = $base == 'index' ? '' : $base;
            break;
        }
    }
    if (!$controller) {
        $path = base_path();
        Logger::trace("No route for {$path}!");
        throw new App404Exception("Not found!", 404);
    }
    return array($base, $controller, $action);
}
示例#19
0
 public function checkin_customer()
 {
     $name = $this->input->post('cus_name');
     $birthdate = $this->input->post('birthdate');
     $passport_id = $this->input->post('passport');
     $address = $this->input->post('address');
     $province = $this->input->post('province');
     $zipcode = $this->input->post('zipcode');
     $country = $this->input->post('country');
     $phone = $this->input->post('phone');
     $email = $this->input->post('email');
     $data = array('customer_name' => $name, 'birthdate' => $birthdate, 'passport_number' => $passport_id, 'address' => $address, 'province' => $province, 'zipcode' => $zipcode, 'country' => $country, 'phone' => $phone, 'email' => $email);
     $this->Customer_model->insert_customer($data);
     $result = $this->Customer_model->select_last_id();
     $cus_id = $result['cus_id'];
     $house_id = $this->input->post('txthouseid');
     $date = date('Y-m-d');
     $chk_in = $this->input->post('txtstart');
     $chk_out = $this->input->post('txtend');
     $deposit = $this->input->post('txtdeposit');
     $session_data = $this->session->userdata('logged_in');
     $last_id = $this->Lease_model->check_id();
     $lease_id = date('ym') . '01';
     while ($last_id['lease_id'] >= $lease_id) {
         $lease_id = $lease_id + 1;
     }
     $data = array('lease_id' => $lease_id, 'l_house_id' => $house_id, 'start' => $chk_in, 'end' => $chk_out, 'l_cus_id' => $cus_id, 'issue_date' => $date, 'deposit' => $deposit, 'l_user_id' => $session_data['user_id']);
     $this->Lease_model->insert($data);
     $data['house_status'] = 1;
     $data['house_id'] = $house_id;
     $this->house_model->update_status($data);
     load_controller('invoice_con', 'generate_invoice');
     $data = $this->Lease_model->select_last_id();
     $this->load->view('check-in-result', $data);
     //$this->load->view('check-in-detail');
 }
示例#20
0
<?php

load_controller('User');
class User_test_controller extends User_controller
{
    private $test_user;
    public function setup()
    {
        $this->teardown();
        // just in case
        // Create a test user
        $this->test_user = new User(array('name' => 'Kevin Hutchinson', 'email' => '*****@*****.**', 'password' => 'gherkin'));
        $this->test_user->insert();
    }
    public function teardown()
    {
        $user = new User();
        $user->delete_all();
    }
    public function login_test()
    {
        // Test that our test user can login
        $this->set_params(array('user->email' => $this->test_user->email, 'user->password' => $this->test_user->password));
        list($user) = $this->login();
        $this->should('find a matching user', $user && $user->email === $this->test_user->email, $user);
        $this->should('start a user session', $user->id > 0 && $user->id === $this->session->user_id, $user);
        // Test that we cannot login with the wrong details
        $this->set_params(array('user->email' => $this->test_user->email, 'user->password' => 'WRONG'));
        list($user) = $this->login();
        $this->should_not('login with the wrong details', $user->id, $user);
    }
示例#21
0
 public function index()
 {
     load_controller('Login_con', 'index');
 }
示例#22
0
<?php

defined('BASEPATH') or exit('No direct script access allowed');
$routes = explode('/', $_SERVER["REDIRECT_URL"]);
$input_controller = $routes[1];
$request = array("args" => array_slice($routes, 2));
if (!empty($input_controller)) {
    if (load_controller($input_controller)) {
        //$class = ucfirst(Utils::pluralize($input_controller));
        $class = ucfirst($input_controller);
        $controller = new $class();
    } else {
        http_response_code(501);
        show_error("no find object name");
    }
} else {
    http_response_code(400);
    show_error("no object name");
}
示例#23
0
<?php

// Copyright (c) 2010 Guanoo, Inc.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; either version 3
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
load_controller('Cache');
/**
 * The Cache_test_controller class tests the Cache_controller class.
 * See this test controller run at URL "/cache_test"
 *
 * @author Kevin Hutchinson <*****@*****.**>
 */
class Cache_test_controller extends Cache_controller
{
    const SECS_IN_MIN = 60;
    const MINS_IN_HOUR = 60;
    const HOURS_IN_DAY = 24;
    const TEST_CACHE_SECS = 1;
    const TEST_CONTENTS = 'Just some test contents';
    private $counter;
    /**
     * Create a new cache test controller object
     */
示例#24
0
 function update_all()
 {
     $check = $this->input->post('invoice_id1');
     if ($check == NULL) {
         echo '<script language="javascript">';
         echo 'alert("No invoice !!")';
         echo '</script>';
     } else {
         //Loop for every box.
         for ($i = 1; $i <= 10; $i++) {
             $invoice_id = $this->input->post('invoice_id' . $i);
             $water_unit = $this->input->post('water_unit' . $i);
             $water_bill = $this->input->post('water_bill' . $i);
             $elec_unit = $this->input->post('elec_unit' . $i);
             $elec_bill = $this->input->post('elec_bill' . $i);
             $rent_fee = $this->input->post('rent_fee' . $i);
             $total = $this->input->post('total' . $i);
             $status = 1;
             $data = array('water_unit' => $water_unit, 'water_bill' => $water_bill, 'electric_unit' => $elec_unit, 'electric_bill' => $elec_bill, 'in_rent_fee' => $rent_fee, 'total_amount' => $total, 'invoice_status' => $status);
             //Check that invoice_id is Null or Not.
             if ($invoice_id != NULL) {
                 $this->Invoice_model->update($data, $invoice_id);
                 $this->invoice_email($invoice_id);
             }
         }
         //end for
     }
     //end if
     load_controller('menu_con', 'invoice');
 }
示例#25
0
文件: akun.php 项目: GGie/CI
 function aktivasi()
 {
     $data_param = "";
     echo load_controller("web", "web", "web_header", $data_param);
     echo load_controller("web", "web", "web_open_content", $data_param);
     //$this->load->view("akun/aktivasi",$data_param);
     echo load_controller("web", "web", "web_close_content", $data_param);
     echo load_controller("web", "web", "web_footer", $data_param);
 }
示例#26
0
<?
load_controller('Contact');

class Contact_test_controller extends Contact_controller
{
}

// End of Contact_test.php
示例#27
0
 /**
  * Pages::_site_header()
  * 
  * @return
  */
 private function _site_header($facebook_infos = null)
 {
     $c_einsatz = load_controller('einsatz/einsatz');
     $c_termin = load_controller('termin/termin');
     $c_news = load_controller('news/news');
     $c_fahrzeug = load_controller('fahrzeug/fahrzeug');
     $c_presse = load_controller('presse/presse');
     $this->menue = $this->m_menue->get_menue_list('online');
     $header_data['menue_meta'] = $this->menue['menue_meta'];
     $header_data['menue'] = $this->menue['menue'];
     $header_data['einsaetze'] = $c_einsatz->get_einsatz_overview(1, 5, 0);
     $header_data['news'] = $c_news->get_news_overview(5, 0);
     $header_data['termine'] = $c_termin->get_termin_overview(5, 0);
     $header_data['fahrzeuge'] = $c_fahrzeug->get_fahrzeug_overview(1, 0);
     $header_data['fahrzeugeAusserDienst'] = $c_fahrzeug->get_fahrzeug_overview(1, 1);
     $header_data['hasRetiredFahrzeuge'] = $c_fahrzeug->hasRetired();
     $header_data['articles'] = $c_presse->get_presse_overview();
     $header_data['facebook_infos'] = $facebook_infos;
     $this->load->view('frontend/templates/header', $header_data);
 }
示例#28
0
<?php

/**
* @file index.php
* @synopsis  后台入口
* @author Yee, <*****@*****.**>
* @version 1.0
* @date 2012-04-18 16:09:49
*/
error_reporting(0);
require 'init.php';
$pmstarttime = explode(' ', microtime());
$pm_starttime = $pmstarttime[1] + $pmstarttime[0];
if (empty($_GET['c']) || $_GET['c'] == 'login' && (empty($_GET['a']) || in_array($_GET['a'], array('login', 'ssologin'))) || $_GET['c'] == 'securimage') {
} else {
    mod_auth::instance();
    //权限
    session_write_close();
}
load_controller();
示例#29
0
<?php

// Copyright (c) 2010 Guanoo, Inc.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; either version 3
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
load_controller('Project');
class Project_test_controller extends Project_controller
{
    public function index_test()
    {
        // TODO
    }
    public function terms_test()
    {
        // TODO
    }
    public function contact_test()
    {
        // TODO
    }
}
// End of Project_test.php
示例#30
0
<?php

// Copyright (c) 2010 Guanoo, Inc.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; either version 3
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
load_controller('REST');
/**
 * The REST_test_controller class tests the REST_controller class.
 *
 * @author Kevin Hutchinson <*****@*****.**>
 */
class REST_test_controller extends Rest_controller
{
    private $test_input;
    private $test_input_map = array('text/xml' => '<root><assoc><list>this</list><list>that</list></assoc></root>', 'text/json' => '{"assoc":{"list":["this","that"]}}', 'text/serialized' => 'a:1:{s:5:"assoc";a:1:{s:4:"list";a:2:{i:0;s:4:"this";i:1;s:4:"that";}}}', 'text/yaml' => "assoc:\n  list:[this, that]");
    /**
     * Ensure that the service we're testing is a "test" service
     */
    protected function before()
    {
        parent::before();
        $service = ucfirst($this->app->get_folder()) . '_test';
        $this->service = $this->app->new_service($service);