Ejemplo n.º 1
0
Archivo: sql.php Proyecto: RickdeM/wms
 /**
  * Replace the Database Table
  *
  * @version 1
  * @author Rick de Man <*****@*****.**>
  *        
  * @param bool $Query
  *        	The query to be processed
  * @return string
  */
 private function Query_Table_Preg($Query)
 {
     // The 'USE' query does not contain a TAG
     if (preg_match('/^use /i', $Query) === 1) {
         return $Query;
     }
     // Replace Table Regex
     preg_match('/`(.+?)`/', $Query, $Match);
     // Validate the Position has been found
     if (!isset($Match[1])) {
         $e = 'SQL Table Select Error - ' . $Query;
         PDO_Error($e->getMessage(), $this->STH->queryString, $_SESSION['WMS-Debug']);
     }
     if ($this->PdoType == 'mysql') {
         // Load table prefix
         $a = $this->TablePrefix;
         // Replace "`%" -> "`{prefix}"
         $Query = preg_replace('/`%(.+?)`/', "`{$a}\$1`", $Query);
     }
     if ($this->PdoType == 'odbc') {
         // Load Database name
         $a = $this->Setup['DB'];
         // Load Database user
         $b = $this->Setup['User'];
         // Load table prefix
         $c = $this->TablePrefix;
         $Query = preg_replace('/`%(.+?)`/', "[{$a}].[{$b}].[{$c}\$1]", $Query);
     }
     return $Query;
 }
Ejemplo n.º 2
0
 protected function Validate_Type($Value1, $Value2)
 {
     die(__FUNCTION__);
     // Empty Value
     if ($Value1 == '') {
         return $this->CMS_Error('Global,NoTypeGiven');
     }
     // My rights cant be lower
     if ($Value1 > $Value1) {
         return $this->CMS_Error('Global,TypeGivenNoAuth');
     }
     // Database Lookup
     try {
         $Array = array();
         $Array[] = $Value1;
         // PDO Query Statement
         $STH = $this->DBH->prepare('SELECT * FROM `' . $this->SQL_Table['users_type'] . '` WHERE Type = ? AND Display = 1');
         // PDO Execute Statement
         $STH->execute($Array);
         if ($STH->Rowcount() != 1) {
             return $this->CMS_Error('Global,TypeGivenNoMatch');
         }
     } catch (PDOException $e) {
         // Oops, Something went wrong...
         PDO_Error($e->getMessage(), $this->Debug);
     }
     return True;
 }
Ejemplo n.º 3
0
Archivo: be.php Proyecto: RickdeM/wms
 protected function BE_Users_GenerateAuthList($User)
 {
     die(__FUNCTION__);
     return;
     // Loading User Authentication Settings
     $Auth = Check_Auth($User['Auth']);
     echo '<table>' . EOL;
     echo '  <tr>' . EOL;
     echo '    <td>Inloggen</td>' . EOL;
     echo '    <td><input type="CheckBox" id="login" name="cp_login" ' . (isset($Auth['cp']['login']) ? 'Checked="True"' : '') . '></td>' . EOL;
     echo '  </tr>' . EOL;
     echo '</table>' . EOL;
     // Retrieving all Menus
     try {
         // PDO Query Statement
         $STH = $this->DBH->query('SELECT * FROM `' . $this->SQL_Table['be_menu'] . '` WHERE Display > 0 AND Auth <> 0');
         // PDO Fetch all Results
         $STHMain = $STH->FetchAll();
     } catch (PDOException $e) {
         // Oops, Something went wrong...
         PDO_Error($e->getMessage(), $this->Debug);
     }
     foreach ($STHMain as $RowMain) {
         // print_r($Auth);
         // var_dump(isset($Auth[strtolower($RowMain['Href'])]).'1');
         // Authorisation Check each Menu
         if ($this->ThisUser['Type'] == 900 or isset($this->ThisUser['Auth']['cp'][strtolower($RowMain['Href'])]) or $RowMain['Auth'] == 0) {
             $RowMain['Href'] = strtolower($RowMain['Href']);
             echo '<div class="Users_Auth_List">' . EOL;
             echo '  <table>' . EOL;
             echo '    <tr>' . EOL;
             echo '      <td>' . $RowMain['Title'] . '</td>' . EOL;
             echo '      <td><input type="CheckBox" id="' . $RowMain['Href'] . '" name="cp_' . $RowMain['Href'] . '" ' . (isset($Auth['cp'][$RowMain['Href']]) ? 'Checked="True"' : '') . '></td>' . EOL;
             echo '    </tr>' . EOL;
             /*
              * echo '<!--'.EOL; print_r($Auth['cp']); var_dump( isset($Auth['cp'][$RowMain['Href']] ) ); echo '->>'.EOL;
              */
             // Retrieving all Sub Menus
             try {
                 $Array = array();
                 $Array[] = $RowMain['Place'];
                 $Array[] = 1;
                 // PDO Prepare Statement
                 $STH = $this->DBH->prepare('SELECT * FROM `' . $this->SQL_Table['be_menu_sub'] . '` WHERE ParentID = ? AND Display = ? ORDER BY ParentID,OrderList');
                 // PDO Execute Statement
                 $STH->execute($Array);
             } catch (PDOException $e) {
                 // Oops, Something went wrong...
                 PDO_Error($e->getMessage(), $this->Debug);
             }
             $GroupSort = array();
             $GroepDisplay = array();
             while ($Row = $STH->Fetch()) {
                 if ($this->ThisUser['Type'] == 900 or isset($this->ThisUser['Auth']['cp'][strtolower($RowMain['Href'])][strtolower($Row['Href'])])) {
                     $GroupSort[$Row['ParentID']][$Row['OrderList']] = $Row;
                     $AuthSub = isset($Auth['cp'][$RowMain['Href']][strtolower($Row['Href'])]) ? 'Checked="True" ' : '';
                     echo '    <tr>' . EOL;
                     echo '      <td>' . $Row['Title'] . '</td>' . EOL;
                     echo '      <td><input type="CheckBox" id="child" name="cp_' . $RowMain['Href'] . '_' . $Row['Href'] . '" ' . $AuthSub . '></td>' . EOL;
                     echo '    </tr>' . EOL;
                 }
             }
             echo '  </table>' . EOL;
             echo '</div>' . EOL;
         }
         echo '' . EOL;
     }
     echo '<div style="clear: left; "></div>' . EOL;
 }