コード例 #1
0
 public function getOutData()
 {
     $id = $this->data;
     $query = "SELECT roles.*, 1 as status\n                  FROM roles \n                  LEFT JOIN users_roles\n                  ON users_roles.role_id = roles.id\n                  WHERE users_roles.user_id = {$id}\n\n\t\t\t\t  UNION\n\n\t\t\t\t  SELECT roles.*, 0 as status\n                  FROM roles \n                  WHERE roles.id NOT IN \n                  (\n                  \tSELECT roles.id\n\t\t\t      \tFROM roles\n\t\t    \t  \tLEFT JOIN users_roles\n\t\t          \tON users_roles.role_id = roles.id\n\t\t          \tWHERE users_roles.user_id = {$id}\n\t\t          )";
     $db = DatabaseFactory::create("AAADatabase")->connect();
     return $db->SQLFetchAllArray($query);
 }
コード例 #2
0
 public function getOutData()
 {
     $id = $this->data;
     $query = "SELECT users.*, 1 as status\n                  FROM users \n                  LEFT JOIN users_roles\n                  ON users_roles.user_id = users.id\n                  WHERE users_roles.role_id = {$id}";
     $db = DatabaseFactory::create("AAADatabase")->connect();
     return $db->SQLFetchAllArray($query);
 }
コード例 #3
0
 public function getOutData()
 {
     $actionName = $this->data;
     $query = "SELECT roles.*\n                  FROM roles\n                  LEFT JOIN roles_actions\n                  ON roles_actions.role_id = roles.id\n                  WHERE roles_actions.action_name = '{$actionName}'";
     $db = DatabaseFactory::create("AAADatabase")->connect();
     return $db->SQLFetchAllArray($query);
 }
コード例 #4
0
 public function getOutData()
 {
     $id = $this->data;
     $query = "SELECT actions.*, 1 as status\n                  FROM actions \n                  LEFT JOIN roles_actions\n                  ON roles_actions.action_name = actions.name\n                  WHERE roles_actions.role_id = {$id}\n\n\t\t\t\t  UNION\n\n\t\t\t\t  SELECT actions.*, 0 as status\n                  FROM actions \n                  WHERE actions.name NOT IN \n                  (\n                  \tSELECT actions.name\n\t\t\t      \tFROM actions\n\t\t    \t  \tLEFT JOIN roles_actions\n\t\t          \tON roles_actions.action_name = actions.name\n\t\t          \tWHERE roles_actions.role_id = {$id}\n\t\t          ) ORDER BY actions.name DESC";
     $db = DatabaseFactory::create("AAADatabase")->connect();
     return $db->SQLFetchAllArray($query);
 }
コード例 #5
0
 public function setInData($data)
 {
     $id = $data;
     $query = "DELETE FROM Users WHERE id={$id}";
     $db = DatabaseFactory::create("AAADatabase")->connect();
     $db->SQLQuery($query);
 }
コード例 #6
0
 public function getOutData()
 {
     $name = $this->data;
     $query = "SELECT * FROM Users WHERE name LIKE '%{$name}%'";
     $db = DatabaseFactory::create("AAADatabase")->connect();
     return $db->SQLFetchAllArray($query);
 }
コード例 #7
0
 public function getOutData()
 {
     $id = $this->data;
     $query = "SELECT * FROM Users WHERE id = {$id}";
     $db = DatabaseFactory::create("AAADatabase")->connect();
     return $db->SQLFetchArray($query);
 }
 public function getOutData()
 {
     $date = $this->data['date'];
     $db = DatabaseFactory::create("SquidDatabase")->connect();
     $rowsTotalNumberInArray = $db->SQLFetchArray("SELECT COUNT(*)\n                                                         FROM SquidData\n                                                         WHERE date = '{$date}' ");
     return (int) $rowsTotalNumberInArray['COUNT(*)'];
 }
 public function getOutData()
 {
     $date = $this->data['date'];
     $query = "SELECT client_ip, COUNT(client_ip) as frequency \n                    FROM SquidData \n        \t\t\tWHERE date = '{$date}'\n                    GROUP BY client_ip \n        \t\t\tORDER BY frequency DESC";
     $db = DatabaseFactory::create("SquidDatabase")->connect();
     return $db->SQLFetchAllArray($query);
 }
 public function getOutData()
 {
     $clientIp = $this->data['client-ip'];
     $date = $this->data['date'];
     $query = "SELECT client_data, time, url\n                    FROM SquidData \n                    WHERE client_ip = '{$clientIp}' AND date = '{$date}'\n                    ORDER BY time";
     $db = DatabaseFactory::create("SquidDatabase")->connect();
     return $db->SQLFetchAllArray($query);
 }
コード例 #11
0
 public function setInData($data)
 {
     $name = $data['name'];
     $description = $data['description'];
     $query = "INSERT INTO Roles (name, description) VALUES ('{$name}', '{$description}')";
     $db = DatabaseFactory::create("AAADatabase")->connect();
     $db->SQLQuery($query);
 }
 public function getOutData()
 {
     $clientIp = $this->data['client-ip'];
     $date = $this->data['date'];
     $query = "SELECT url, date, time, COUNT(url) as frequency \n                    FROM SquidData \n                    WHERE client_ip = '{$clientIp}' AND date = '{$date}'\n                    GROUP BY url\n                    ORDER BY frequency DESC";
     $db = DatabaseFactory::create("SquidDatabase")->connect();
     return $db->SQLFetchAllArray($query);
 }
コード例 #13
0
 public function setInData($data)
 {
     $name = $data['name'];
     $password = $data['password'];
     $query = "INSERT INTO Users (name, password) VALUES ('{$name}', '{$password}')";
     $db = DatabaseFactory::create("AAADatabase")->connect();
     $db->SQLQuery($query);
 }
 public function getOutData()
 {
     $clientIp = $this->data['client-ip'];
     $date = $this->data['date'];
     $db = DatabaseFactory::create("SquidDatabase")->connect();
     $rowsTotalNumberInArray = $db->SQLFetchArray("SELECT COUNT(client_data)\n                                                         FROM SquidData\n                                                         WHERE client_ip = '{$clientIp}' \n                                                         AND date = '{$date}'\n                                                         ORDER BY time");
     return (int) $rowsTotalNumberInArray['COUNT(client_data)'];
 }
コード例 #15
0
 public function setInData($data)
 {
     $name = $data['name'];
     $password = $data['password'];
     $id = $data['id'];
     $query = "UPDATE Users SET\n                     name = '{$name}', \n                     password = '******' \n                     WHERE id = {$id}";
     $db = DatabaseFactory::create("AAADatabase")->connect();
     $db->SQLQuery($query);
 }
 public function getOutData()
 {
     $paginator = PaginatorFactory::create();
     $beginning = $paginator->beginning;
     $rowsPerPage = $paginator->rowsPerPage;
     $query = "SELECT client_ip, url, COUNT(client_ip) as frequency FROM SquidData \n        \t\t\tGROUP BY client_ip \n        \t\t\t\tORDER BY frequency DESC \n        \t\t\t\t\tLIMIT {$beginning}, {$rowsPerPage}";
     $db = DatabaseFactory::create("SquidDatabase")->connect();
     return $db->SQLFetchAllArray($query);
 }
コード例 #17
0
 public function getOutData()
 {
     $paginator = PaginatorFactory::create();
     $beginning = $paginator->beginning;
     $rowsPerPage = $paginator->rowsPerPage;
     $query = "SELECT * FROM Roles ORDER BY name LIMIT {$beginning}, {$rowsPerPage}";
     $db = DatabaseFactory::create("AAADatabase")->connect();
     return $db->SQLFetchAllArray($query);
 }
コード例 #18
0
 public function setInData($data)
 {
     $id = $data['id'];
     $name = $data['name'];
     $description = $data['description'];
     $query = "UPDATE Roles SET\n                     name = '{$name}', \n                     description = '{$description}' \n                     WHERE id = {$id}";
     $db = DatabaseFactory::create("AAADatabase")->connect();
     $db->SQLQuery($query);
 }
コード例 #19
0
 public function getOutData()
 {
     $actionName = $this->data['action-name'];
     $userId = $this->data['user-id'];
     $adminRoleId = $this->data['admin-role-id'];
     $query = "SELECT roles.*\n                  FROM roles\n                  LEFT JOIN roles_actions\n                  ON roles_actions.role_id = roles.id\n                  WHERE roles_actions.action_name = '{$actionName}'\n\n        \t\t\t\t  INTERSECT\n\n        \t\t\t\t  SELECT roles.*\n                          FROM roles \n                          LEFT JOIN users_roles\n                          ON users_roles.role_id = roles.id\n                          WHERE users_roles.user_id = {$userId}\n\n                  UNION\n\n                  SELECT roles.*\n                          FROM roles \n                          LEFT JOIN users_roles\n                          ON users_roles.role_id = {$adminRoleId}\n                          WHERE users_roles.user_id = {$userId}";
     $db = DatabaseFactory::create("AAADatabase")->connect();
     return $db->SQLFetchAllArray($query);
 }
コード例 #20
0
 public function getOutData()
 {
     $id = $this->data;
     $paginator = PaginatorFactory::create();
     $beginning = $paginator->beginning;
     $rowsPerPage = $paginator->rowsPerPage;
     $query = "SELECT actions.*, 1 as status\n                  FROM actions \n                  LEFT JOIN roles_actions\n                  ON roles_actions.action_name = actions.name\n                  WHERE roles_actions.role_id = {$id}\n\n\t\t\t\t  UNION\n\n\t\t\t\t  SELECT actions.*, 0 as status\n                  FROM actions \n                  WHERE actions.name NOT IN \n                  (\n                  \tSELECT actions.name\n\t\t\t      \tFROM actions\n\t\t    \t  \tLEFT JOIN roles_actions\n\t\t          \tON roles_actions.action_name = actions.name\n\t\t          \tWHERE roles_actions.role_id = {$id}\n\t\t          ) ORDER BY actions.name \n\t\t\t\t\tLIMIT {$beginning}, {$rowsPerPage}";
     $db = DatabaseFactory::create("AAADatabase")->connect();
     return $db->SQLFetchAllArray($query);
 }
コード例 #21
0
ファイル: Main.php プロジェクト: ewo1991/sisacreditacion
 public function __construct()
 {
     $site_path = realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR . '../lib/config.ini';
     try {
         $this->db = DatabaseFactory::create($site_path);
         $this->exec = DatabaseFactory::getExecute($site_path);
         $_SESSION['namebd'] = strtoupper($this->db->getAttribute(PDO::ATTR_DRIVER_NAME));
     } catch (PDOException $e) {
         $error = 'Conexion Fallada: ' . $e->getMessage();
         header("Location:index.php?controller=BaseDatos&action=orror&str=" . $error);
     }
 }
コード例 #22
0
 public function setInData($data)
 {
     $actions = $data;
     $queries = array();
     $query1 = "DELETE FROM actions";
     array_push($queries, $query1);
     foreach ($actions as $actionKey => $actionValue) {
         $query2 = "INSERT OR REPLACE INTO actions (name) VALUES \n\t\t\t        ('{$actionKey}')";
         array_push($queries, $query2);
     }
     $db = DatabaseFactory::create("AAADatabase")->connect();
     $db->SQLTransaction($queries);
 }
コード例 #23
0
 public function setInData($data)
 {
     $this->data = $data;
     $actionsNames = $this->data['selected-actions-names'];
     $roleId = $this->data['selected-role-id'];
     $queries = array();
     $query1 = "DELETE FROM roles_actions WHERE role_id='{$roleId}'";
     array_push($queries, $query1);
     foreach ($actionsNames as $actionName) {
         $query2 = "INSERT OR REPLACE INTO roles_actions (role_id, action_name) VALUES \n\t\t\t        ('{$roleId}', '{$actionName}')";
         array_push($queries, $query2);
     }
     $db = DatabaseFactory::create("AAADatabase")->connect();
     $db->SQLTransaction($queries);
 }
コード例 #24
0
 public function setInData($data)
 {
     $this->data = $data;
     $rolesIds = $this->data['selected-roles-ids'];
     $userId = $this->data['selected-user-id'];
     $queries = array();
     $query1 = "DELETE FROM users_roles WHERE user_id='{$userId}'";
     array_push($queries, $query1);
     foreach ($rolesIds as $roleId) {
         $query2 = "INSERT OR REPLACE INTO users_roles (user_id, role_id) VALUES \n\t\t\t        ('{$userId}', '{$roleId}')";
         array_push($queries, $query2);
     }
     $db = DatabaseFactory::create("AAADatabase")->connect();
     $db->SQLTransaction($queries);
 }
コード例 #25
0
 public function setInData($datafile)
 {
     //FOR ERROR Allowed memory size of 134217728
     //bytes exhausted (tried to allocate 20 bytes):
     ini_set('memory_limit', '-1');
     ini_set('upload_max_filesize', '500M');
     set_time_limit(100);
     // ini_set('memory_limit', '100M');
     $tmpdata = array();
     $logfile = file($datafile);
     foreach ($logfile as $linenumber => $line) {
         array_push($tmpdata, explode(" ", $line));
     }
     foreach ($tmpdata as $key => $line) {
         $newline = array();
         foreach ($line as $key => $datum) {
             if ($datum != null) {
                 array_push($newline, $datum);
             }
         }
         array_push($this->data, $newline);
     }
     $db = DatabaseFactory::create("SquidDatabase")->connect();
     $queries = array();
     $query1 = "DELETE FROM SquidData";
     array_push($queries, $query1);
     $filter = FilterFactory::create();
     foreach ($this->data as $key => $datum) {
         $date = date('d-m-Y', $filter->filters($datum[0]));
         $time = date('H:i:s', $filter->filters($datum[0]));
         $transaction_time = $datum[1];
         $client_ip = $filter->filters($datum[2]);
         $squid_result_code = $filter->filters($datum[3]);
         $client_data = $datum[4];
         $request_method = $filter->filters($datum[5]);
         $url = $filter->filters($datum[6]);
         $mime_type = $filter->filters($datum[9]);
         $query2 = "INSERT INTO SquidData\n        \t\t\t\t\t   (\n        \t\t\t\t\t\t\tdate, time, transaction_time, \n        \t\t\t\t\t\t\tclient_ip, squid_result_code,\n        \t\t\t\t\t\t\tclient_data, request_method,\n        \t\t\t\t\t\t\turl, mime_type\n        \t\t\t\t\t   ) \n\t\t\t\t\t\tVALUES (\n\t\t\t\t\t\t\t\t\t'{$date}', '{$time}', {$transaction_time},\n\t\t\t\t\t\t\t\t\t'{$client_ip}', '{$squid_result_code}',\n\t\t\t\t\t\t\t\t\t{$client_data}, '{$request_method}',\n\t\t\t\t\t\t\t\t\t'{$url}', '{$mime_type}'\n\t\t\t\t\t\t\t   )";
         array_push($queries, $query2);
     }
     $db->SQLTransaction($queries);
 }
コード例 #26
0
 public function getOutData()
 {
     $query = "SELECT client_ip FROM SquidData \n        \t\t\tGROUP BY client_ip \n        \t\t\t\tORDER BY client_ip";
     $db = DatabaseFactory::create("SquidDatabase")->connect();
     return $db->SQLFetchAllArray($query);
 }
コード例 #27
0
 public function getOutData()
 {
     $db = DatabaseFactory::create("AAADatabase")->connect();
     return $db->SQLFetchAllArray("SELECT * FROM Users ORDER BY name");
 }
コード例 #28
0
 public function getOutData()
 {
     $db = DatabaseFactory::create("AAADatabase")->connect();
     $rowsTotalNumberInArray = $db->SQLFetchArray("SELECT COUNT(*) FROM Users");
     return (int) $rowsTotalNumberInArray['COUNT(*)'];
 }