Example #1
0
 public function action_sign_up()
 {
     $email = $this->request->post('email');
     $pass = crypt('MySalt!', $this->request->post('pass'));
     $cookie = $this->request->post('cookie');
     if (!Security::check($this->request->param('id'))) {
         throw new Exception("Bad Token!");
     }
     if (empty($email) and empty($pass)) {
         $this->request->redirect('acp');
     }
     $client = new Model_Client();
     $email_from_db = $client->email_from_db($email);
     $pass_from_db = $client->pass_from_db($email);
     if ($email !== $email_from_db || $pass !== $pass_from_db) {
         throw new Exception("This User do not exists! \n {$pass} {$pass_from_db}");
     }
     $is_superuser = $client->is_superuser($email);
     if ($is_superuser === 0) {
         throw new Exception("Sorry, but you are not a superuser!");
     }
     if ($cookie) {
         Cookie::set('admin', $email);
     }
     Session::instance()->set('admin', $email);
     $this->request->redirect('acp');
 }
 public function testtoApiArray()
 {
     $subscriptionModel = new \Model_Subscription();
     $subscriptionModel->loadBean(new \RedBeanPHP\OODBBean());
     $clientModel = new \Model_Client();
     $clientModel->loadBean(new \RedBeanPHP\OODBBean());
     $gatewayModel = new \Model_PayGateway();
     $gatewayModel->loadBean(new \RedBeanPHP\OODBBean());
     $dbMock = $this->getMockBuilder('\\Box_Database')->getMock();
     $dbMock->expects($this->atLeastOnce())->method('load')->will($this->onConsecutiveCalls($clientModel, $gatewayModel));
     $clientServiceMock = $this->getMockBuilder('\\Box\\Mod\\Client\\Service')->getMock();
     $clientServiceMock->expects($this->atLeastOnce())->method('toApiArray')->will($this->returnValue(array()));
     $payGatewayService = $this->getMockBuilder('\\Box\\Mod\\Invoice\\ServicePayGateway')->getMock();
     $payGatewayService->expects($this->atLeastOnce())->method('toApiArray')->will($this->returnValue(array()));
     $di = new \Box_Di();
     $di['mod_service'] = $di->protect(function ($serviceName, $sub = '') use($clientServiceMock, $payGatewayService) {
         if ($serviceName == 'Client') {
             return $clientServiceMock;
         }
         if ($sub == 'PayGateway') {
             return $payGatewayService;
         }
     });
     $di['db'] = $dbMock;
     $this->service->setDi($di);
     $expected = array('id' => '', 'sid' => '', 'period' => '', 'amount' => '', 'currency' => '', 'status' => '', 'created_at' => '', 'updated_at' => '', 'client' => array(), 'gateway' => array());
     $result = $this->service->toApiArray($subscriptionModel);
     $this->assertInternalType('array', $result);
     $this->assertInternalType('array', $result['client']);
     $this->assertInternalType('array', $result['gateway']);
     $this->assertEquals($expected, $result);
 }
Example #3
0
 public function testget_info()
 {
     $data = array('microsoft');
     $eventMock = $this->getMockBuilder('\\Box_EventManager')->getMock();
     $eventMock->expects($this->atLeastOnce())->method('fire');
     $modelClient = new \Model_Client();
     $modelClient->loadBean(new \RedBeanPHP\OODBBean());
     $clientService = $this->getMockBuilder('\\Box\\Mod\\Client\\Service')->getMock();
     $clientService->expects($this->atLeastOnce())->method('toApiArray')->with($modelClient)->willReturn(array());
     $systemService = $this->getMockBuilder('\\Box\\Mod\\System\\Service')->getMock();
     $systemService->expects($this->atLeastOnce())->method('getVersion')->willReturn(\Box_Version::VERSION);
     $systemService->expects($this->atLeastOnce())->method('getMessages')->willReturn(array());
     $di = new \Box_Di();
     $di['logger'] = new \Box_Log();
     $di['events_manager'] = $eventMock;
     $di['mod_service'] = $di->protect(function ($serviceName) use($clientService, $systemService) {
         if ($serviceName == 'Client') {
             return $clientService;
         }
         if ($serviceName == 'System') {
             return $systemService;
         }
         return -1;
     });
     $di['loggedin_client'] = $modelClient;
     $di['array_get'] = $di->protect(function (array $array, $key, $default = null) use($di) {
         return isset($array[$key]) ? $array[$key] : $default;
     });
     $this->api->setDi($di);
     $result = $this->api->get_info($data);
     $this->assertInternalType('array', $result);
     $this->assertArrayHasKey('version', $result);
     $this->assertArrayHasKey('profile', $result);
     $this->assertArrayHasKey('messages', $result);
 }
Example #4
0
 public function action_index()
 {
     $view = View::factory('home/my/profile');
     $clients = new Model_Client();
     $user_email = Session::instance()->get('email');
     $get_user_data = $clients->get_user_data($user_email);
     $view->valute = $clients->get_user_valute($user_email);
     $view->data = $get_user_data;
     $this->template->content = $view->render();
     if ($this->request->method() === Request::POST) {
         $valute = $this->request->post('valute');
         $name = $this->request->post('name');
         $surname = $this->request->post('surname');
         if (empty($valute) || empty($name)) {
             $this->request->redirect('profile');
         }
         $clients = new Model_Client();
         $email = Session::instance()->get('email');
         $data = array('valute' => $valute, 'name' => $name, 'surname' => $surname);
         $change_user_data = $clients->change_user_data($data, $email);
         if (!$change_user_data) {
             throw new Exception("Error");
         }
         $this->request->redirect('profile');
     }
 }
Example #5
0
 public function action_form()
 {
     $cli = new Model_Client();
     $clients = $cli->where('SITUACAO', '=', 'A')->order_by('NOME')->find_all()->as_array('CODIGO', 'NOME');
     $users = ORM::factory('user')->where('INATIVO', 'IS', NULL)->or_where('INATIVO', '=', 0)->order_by('USUARIO')->find_all()->as_array('RECNO', 'USUARIO');
     $this->request->response = View::factory('report.form')->bind('clients', $clients)->bind('users', $users);
 }
Example #6
0
 public function action_index()
 {
     $view = View::factory('home/register');
     if ($this->request->method() === Request::POST) {
         if (!Security::check($this->request->post('token'))) {
             throw new Exception("Bad Token");
         }
         $post = Validation::factory($_POST)->rule('name', 'not_empty')->rule('surname', 'not_empty')->rule('email', 'not_empty')->rule('email', 'email')->rule('email', 'Model_Client::if_email_exists')->rule('pass', 'not_empty')->rule('pass_confirm', 'not_empty')->rule('pass', 'matches', array(':validation', 'pass_confirm', 'pass'))->rule('checkbox', 'not_empty');
         if ($post->check()) {
             $salt = 'MySalt!';
             $name = $this->request->post('name');
             $surname = $this->request->post('surname');
             $email = $this->request->post('email');
             $pass = crypt($salt, $this->request->post('pass'));
             $checkbox = $this->request->post('checkbox');
             $clients = new Model_Client();
             $data = array('name' => $name, 'surname' => $surname, 'email' => $email, 'pass' => $pass, 'is_superuser' => '0');
             $create_user = $clients->create_user($data);
             if (!$create_user) {
                 throw new Exception("Please check all fields!");
             }
             $this->request->redirect('/');
         }
     }
     $this->template->content = $view->render();
 }
Example #7
0
 public function testApi_key_get()
 {
     $client = new \Model_Client();
     $client->loadBean(new \RedBeanPHP\OODBBean());
     $client->api_token = '16047a3e69f5245756d73b419348f0c7';
     $this->clientApi->setIdentity($client);
     $result = $this->clientApi->api_key_get(array());
     $this->assertEquals($result, $client->api_token);
 }
Example #8
0
 public function action_index()
 {
     $view = View::factory('cart/list');
     $session = Session::instance()->get('email');
     $cart = new Model_Cart();
     $view->products = $cart->get_products_from_cart($session);
     $clients = new Model_Client();
     $view->valute = $clients->get_user_valute($session);
     $this->template->content = $view->render();
 }
Example #9
0
 public function action_index()
 {
     $view = View::factory('home/main');
     $products = new Model_Product();
     $clients = new Model_Client();
     $user_session = Session::instance()->get('email');
     $view->valute = $clients->get_user_valute($user_session);
     $view->last_products = $products->get_newest_products();
     $view->discounts = $products->get_products_with_discounts();
     $this->template->content = $view->render();
 }
 public function testdeductFunds_InvalidAmount()
 {
     $service = new \Box\Mod\Client\ServiceBalance();
     $clientModel = new \Model_Client();
     $clientModel->loadBean(new \RedBeanPHP\OODBBean());
     $description = 'Charged';
     $amount = "5.5adadzxc";
     $extra = array('rel_id' => 1);
     $this->setExpectedException('\\Box_Exception', 'Funds amount is not valid');
     $service->deductFunds($clientModel, $amount, $description, $extra);
 }
Example #11
0
 public function action_add($address = '')
 {
     $tmp = explode('.', $address);
     if (count($tmp) == 2 && $tmp[1] == 'onion') {
         return;
     }
     $address = $tmp[0];
     $client = new Model_Client();
     $client->address = $address;
     $client->save();
     return new Response(null, 404);
 }
Example #12
0
 public function test_getServiceOrderNotActivated()
 {
     $data = array('order_id' => 17);
     $client = new Model_Client();
     $client->loadBean(new RedBeanPHP\OODBBean());
     $client->id = 1;
     $clientApi = new Box\Mod\Serviceboxbillinglicense\Api\Client();
     $clientApi->setDi($this->di);
     $clientApi->setIdentity($client);
     $this->setExpectedException('\\Box_Exception', 'Order is not activated');
     $bool = $clientApi->reset($data);
 }
Example #13
0
 public function action_item()
 {
     $product_id = $this->request->param('id');
     if (empty($product_id)) {
         throw new Exception("ID must not be empty!");
     }
     $view = View::factory('products/info');
     $products = new Model_Product();
     $clients = new Model_Client();
     $view->products = $products->get_product_by_id($product_id);
     $user_email = Session::instance()->get('email');
     $view->valute = $clients->get_user_valute($user_email);
     $this->template->content = $view->render();
 }
Example #14
0
 public function before()
 {
     parent::before();
     $config = Kohana::$config->load('common');
     $this->template->name = $config->name;
     $this->template->stylesheets = $config->stylesheets;
     $categories = new Model_Category();
     $client = new Model_Client();
     $product = new Model_Product();
     $this->template->products = $product->get_random_product_with_discount();
     $this->template->valute = $client->get_user_valute(Session::instance()->get('email'));
     $this->template->categories = $categories->get_list_of_categories();
     $this->template->users = $client->get_user_data(Session::instance()->get('email'));
     $this->template->scripts = $config->scripts;
 }
Example #15
0
 public function action_edit($id = null)
 {
     $client = Model_Client::find($id);
     $form = $this->setup_form();
     if (Input::method() == 'POST') {
         if ($form->validation()->run() === true) {
             $fields = $form->validated();
             $client->code = $fields['code'];
             $client->name = $fields['name'];
             $client->name_en = $fields['name_en'];
             $client->status = $fields['status'];
             $client->updated_at = Date::forge()->get_timestamp();
             if ($client->save()) {
                 Session::set_flash('success', 'Updated client #' . $id);
                 Response::redirect('clients');
             } else {
                 Session::set_flash('error', 'Could not update client #' . $id);
             }
         } else {
             $this->template->set_global('errors', $form->error(), false);
         }
     }
     $this->template->page_title = "Edit Client";
     $this->template->set('content', $form->build($client), false);
 }
Example #16
0
 /**
  * грузим список клиентов по менеджеру
  */
 public function action_load_clients()
 {
     $managerId = $this->request->post('manager_id');
     $clients = Model_Client::getClientsList(false, ['manager_id' => $managerId]);
     if ($clients === false) {
         $this->jsonResult(0);
     }
     $this->jsonResult(1, $clients);
 }
Example #17
0
 public function action_delete($id = null)
 {
     if ($client = Model_Client::find($id)) {
         $client->delete();
         Session::set_flash('success', e('Deleted client #' . $id));
     } else {
         Session::set_flash('error', e('Could not delete client #' . $id));
     }
     Response::redirect('admin/clients');
 }
Example #18
0
 public function testforumSpamChecker()
 {
     $params = array('client_id' => 1, 'message' => 'Hello world');
     $model = new \Model_Client();
     $model->loadBean(new \RedBeanPHP\OODBBean());
     $dbMock = $this->getMockBuilder('\\Box_Database')->getMock();
     $dbMock->expects($this->atLeastOnce())->method('load')->willReturn($model);
     $spamCheckerService = $this->getMockBuilder('\\Box\\Mod\\Spamchecker\\Service')->getMock();
     $spamCheckerService->expects($this->atLeastOnce())->method('isCommentSpam');
     $spamCheckerService->expects($this->atLeastOnce())->method('isBlockedIp');
     $di = new \Box_Di();
     $di['db'] = $dbMock;
     $di['mod_service'] = $di->protect(function () use($spamCheckerService) {
         return $spamCheckerService;
     });
     $boxEventMock = $this->getMockBuilder('\\Box_Event')->disableOriginalConstructor()->getMock();
     $boxEventMock->expects($this->atLeastOnce())->method('getDi')->willReturn($di);
     $boxEventMock->expects($this->atLeastOnce())->method('getParameters')->willReturn($params);
     $this->service->forumSpamChecker($boxEventMock);
 }
Example #19
0
 public function action_index()
 {
     $this->session = Session::instance();
     if (!$this->session->get('tsuser')) {
         $this->request->redirect('user/login');
     }
     $user_id = $this->session->get('tsuser');
     $user = new Model_User($user_id);
     $nome = $user->NOME;
     $depto = $user->DEPTO;
     $this->session->set('tsdepto', $user->DEPTO);
     $cli = new Model_Client();
     $clients = $cli->actives($user->DEPTO);
     $cli = new Model_Client();
     $clients_all = $cli->where('SITUACAO', '=', 'A')->order_by('NOME')->find_all()->as_array('CODIGO', 'NOME');
     $task = new Model_Task();
     $tasks = $task->where('user_id', '=', $user->RECNO)->where('active', '=', 1)->find_all();
     $pitDefault = $this->pitDef($user->DEPTO);
     $this->request->response = View::factory('timesheet.index')->bind('clients', $clients)->bind('tasks', $tasks)->bind('nome', $nome)->bind('depto', $depto)->bind('pitDefault', $pitDefault)->bind('clients_all', $clients_all)->bind('user', $user_id);
 }
Example #20
0
 public function testSearchArticles()
 {
     $service = new \Box\Mod\Kb\Service();
     $willReturn = array("pages" => 5, "page" => 2, "per_page" => 2, "total" => 10, "list" => array());
     $di = new \Box_Di();
     $pager = $this->getMockBuilder('Box_Pagination')->getMock();
     $pager->expects($this->atLeastOnce())->method('getSimpleResultSet')->will($this->returnValue($willReturn));
     $client = new \Model_Client();
     $client->loadBean(new \RedBeanPHP\OODBBean());
     $client->id = 5;
     $di['pager'] = $pager;
     $service->setDi($di);
     $result = $service->searchArticles('active', 'keyword', 'category');
     $this->assertInternalType('array', $result);
     $this->assertArrayHasKey('list', $result);
     $this->assertInternalType('array', $result['list']);
     $this->assertArrayHasKey('pages', $result);
     $this->assertArrayHasKey('page', $result);
     $this->assertArrayHasKey('per_page', $result);
     $this->assertArrayHasKey('total', $result);
 }
Example #21
0
 public function testCheckout()
 {
     $cart = new \Model_Cart();
     $cart->loadBean(new \RedBeanPHP\OODBBean());
     $serviceMock = $this->getMockBuilder('\\Box\\Mod\\Cart\\Service')->setMethods(array('getSessionCart', 'checkoutCart'))->getMock();
     $serviceMock->expects($this->atLeastOnce())->method('getSessionCart')->will($this->returnValue($cart));
     $checkOutCartResult = array('gateway_id' => 1, 'invoice_hash' => null, 'order_id' => 1, 'orders' => 1);
     $serviceMock->expects($this->atLeastOnce())->method('checkoutCart')->will($this->returnValue($checkOutCartResult));
     $this->clientApi->setService($serviceMock);
     $client = new \Model_Client();
     $client->loadBean(new \RedBeanPHP\OODBBean());
     $this->clientApi->setIdentity($client);
     $data = array('id' => rand(1, 100));
     $di = new \Box_Di();
     $di['array_get'] = $di->protect(function (array $array, $key, $default = null) use($di) {
         return isset($array[$key]) ? $array[$key] : $default;
     });
     $this->clientApi->setDi($di);
     $result = $this->clientApi->checkout($data);
     $this->assertInternalType('array', $result);
 }
Example #22
0
 /**
  * получаем список клиентов для combobox
  */
 public function action_list_client()
 {
     $res = Model_Client::getClientsList($this->_search, ['ids' => $this->_ids]);
     if (empty($res)) {
         $this->jsonResult(false);
     }
     $return = [];
     foreach ($res as $item) {
         $return[] = ['name' => $item['LONG_NAME'], 'value' => $item['CLIENT_ID']];
     }
     $this->jsonResult(true, $return);
 }
Example #23
0
 public function test_getServiceOrderNotActivated()
 {
     $data['order_id'] = 1;
     $orderServiceMock = $this->getMockBuilder('\\Box\\Mod\\Order\\Service')->getMock();
     $orderServiceMock->expects($this->atLeastOnce())->method('getOrderService')->will($this->returnValue(null));
     $dbMock = $this->getMockBuilder('\\Box_Database')->getMock();
     $dbMock->expects($this->atLeastOnce())->method('findOne')->with('ClientOrder')->will($this->returnValue(new \Model_ClientOrder()));
     $validatorMock = $this->getMockBuilder('\\Box_Validate')->getMock();
     $validatorMock->expects($this->atLeastOnce())->method('checkRequiredParamsForArray');
     $di = new \Box_Di();
     $di['validator'] = $validatorMock;
     $di['db'] = $dbMock;
     $di['mod_service'] = $di->protect(function () use($orderServiceMock) {
         return $orderServiceMock;
     });
     $this->api->setDi($di);
     $clientModel = new \Model_Client();
     $clientModel->loadBean(new \RedBeanPHP\OODBBean());
     $this->api->setIdentity($clientModel);
     $this->setExpectedException('\\Box_Exception', 'Order is not activated');
     $this->api->_getService($data);
 }
Example #24
0
 public function testsend_file()
 {
     $data = array('order_id' => 1);
     $modelClient = new \Model_Client();
     $modelClient->loadBean(new \RedBeanPHP\OODBBean());
     $serviceMock = $this->getMockBuilder('\\Box\\Mod\\Servicedownloadable\\Service')->getMock();
     $serviceMock->expects($this->atLeastOnce())->method('sendFile')->will($this->returnValue(true));
     $orderServiceMock = $this->getMockBuilder('\\Box\\Mod\\Order\\Service')->getMock();
     $orderServiceMock->expects($this->atLeastOnce())->method('getOrderService')->will($this->returnValue(new \Model_ServiceDownloadable()));
     $dbMock = $this->getMockBuilder('\\Box_Database')->getMock();
     $dbMock->expects($this->atLeastOnce())->method('findOne')->will($this->returnValue(new \Model_ClientOrder()));
     $di = new \Box_Di();
     $di['db'] = $dbMock;
     $di['mod_service'] = $di->protect(function () use($orderServiceMock) {
         return $orderServiceMock;
     });
     $this->api->setDi($di);
     $this->api->setIdentity($modelClient);
     $this->api->setService($serviceMock);
     $result = $this->api->send_file($data);
     $this->assertInternalType('bool', $result);
     $this->assertTrue($result);
 }
Example #25
0
 public function action_submit()
 {
     $email = $this->request->post('email');
     $salt = 'MySalt!';
     $pass = crypt($salt, $this->request->post('pass'));
     if (!Security::check($this->request->param('id'))) {
         throw new Exception("Bad Token!");
     }
     $cookie = $this->request->post('cookie');
     if (empty($email) and empty($pass)) {
         throw new Exception('404');
     }
     $clients = new Model_Client();
     $email_from_db = $clients->if_email_exists($email);
     $pass_from_db = $clients->if_pass_is_not_wrong($pass);
     if ($pass !== $pass_from_db or $email !== $email_from_db) {
         throw new Exception('Incorrect input data!');
     }
     Session::instance()->set('email', $email);
     if (!empty($cookie)) {
         Cookie::set('email', $email);
     }
     $this->request->redirect('/');
 }
Example #26
0
 /**
  * проверка доступов
  *
  * @param $type
  * @param $id
  */
 public static function check($type, $id)
 {
     $allow = false;
     if (!empty($type)) {
         switch ($type) {
             case 'client':
                 if (!empty($id)) {
                     $clients = Model_Client::getClientsList();
                     if (!empty($clients[$id])) {
                         $allow = true;
                     }
                 }
                 break;
         }
     }
     if (!$allow) {
         throw new HTTP_Exception_404();
     }
 }
Example #27
0
 /**
  * OpenID Connectを利用する承認後処理
  */
 public function action_callback()
 {
     $_opauth = new Opauth($this->_config, false);
     switch ($_opauth->env['callback_transport']) {
         case 'session':
             session_start();
             $response = $_SESSION['opauth'];
             unset($_SESSION['opauth']);
             break;
     }
     if (array_key_exists('error', $response)) {
         Response::redirect('/login');
     } else {
         $uid = $response['auth']['uid'];
         $client_no = Model_ClientApiToken::findClientNo($uid)->current();
         $user = Model_Client::find($client_no)->current();
         if (empty($user)) {
             $user = $this->addClient($response['auth']['raw']);
         }
         $this->setSession($user);
         Response::redirect('/');
     }
 }
 public function testdebitTransaction()
 {
     $currency = 'EUR';
     $invoiceModel = new \Model_Invoice();
     $invoiceModel->loadBean(new \RedBeanPHP\OODBBean());
     $invoiceModel->currency = $currency;
     $clientModdel = new \Model_Client();
     $clientModdel->loadBean(new \RedBeanPHP\OODBBean());
     $clientModdel->currency = $currency;
     $transactionModel = new \Model_Transaction();
     $transactionModel->loadBean(new \RedBeanPHP\OODBBean());
     $transactionModel->amount = 11;
     $clientBalanceModel = new \Model_ClientBalance();
     $clientBalanceModel->loadBean(new \RedBeanPHP\OODBBean());
     $dbMock = $this->getMockBuilder('\\Box_Database')->getMock();
     $dbMock->expects($this->atLeastOnce())->method('load')->will($this->onConsecutiveCalls($invoiceModel, $clientModdel));
     $dbMock->expects($this->atLeastOnce())->method('dispense')->will($this->returnValue($clientBalanceModel));
     $dbMock->expects($this->atLeastOnce())->method('store');
     $di = new \Box_Di();
     $di['db'] = $dbMock;
     $this->service->setDi($di);
     $this->service->debitTransaction($transactionModel);
 }
Example #29
0
 public function testIsPromoAvailableForClientGroupProvider()
 {
     $promo1 = new \Model_Promo();
     $promo1->loadBean(new \RedBeanPHP\OODBBean());
     $promo1->client_groups = json_encode(array());
     $client1 = new \Model_Client();
     $client1->loadBean(new \RedBeanPHP\OODBBean());
     $promo2 = new \Model_Promo();
     $promo2->loadBean(new \RedBeanPHP\OODBBean());
     $promo2->client_groups = json_encode(array(1, 2));
     $client2 = new \Model_Client();
     $client2->loadBean(new \RedBeanPHP\OODBBean());
     $client2->client_group_id = null;
     $promo3 = new \Model_Promo();
     $promo3->loadBean(new \RedBeanPHP\OODBBean());
     $promo3->client_groups = json_encode(array(1, 2));
     $client3 = new \Model_Client();
     $client3->loadBean(new \RedBeanPHP\OODBBean());
     $client3->client_group_id = 3;
     $promo4 = new \Model_Promo();
     $promo4->loadBean(new \RedBeanPHP\OODBBean());
     $promo4->client_groups = json_encode(array(1, 2));
     $client4 = new \Model_Client();
     $client4->loadBean(new \RedBeanPHP\OODBBean());
     $client4->client_group_id = 2;
     $promo5 = new \Model_Promo();
     $promo5->loadBean(new \RedBeanPHP\OODBBean());
     $promo5->client_groups = json_encode(array());
     $client5 = null;
     $promo6 = new \Model_Promo();
     $promo6->loadBean(new \RedBeanPHP\OODBBean());
     $promo6->client_groups = json_encode(array(1, 2));
     $client6 = null;
     return array(array($promo1, $client1, true), array($promo2, $client2, false), array($promo3, $client3, false), array($promo4, $client4, true), array($promo5, null, true), array($promo6, null, false));
 }
Example #30
0
 public function getData()
 {
     $data = array("user" => Auth::instance()->get_user(), "project" => $this->current_project(), "projects_count" => Model_Project::count_projects(), "clients_count" => Model_Client::count_clients(), "users_count" => ORM::factory('User')->count_all(), "latest_projects" => $this->latest_projects(), "image" => $this->current_image, "client" => $this->current_client);
     return $data;
 }