コード例 #1
0
ファイル: db-table.php プロジェクト: klan1/k1.lib
 public function set_query_filter_exclude($filter_array, $exact_filter = FALSE, $do_clean_array = TRUE)
 {
     if ($do_clean_array) {
         $clean_filter_array = \k1lib\common\clean_array_with_guide($filter_array, $this->db_table_config);
     } else {
         $clean_filter_array = $filter_array;
     }
     if (empty($clean_filter_array)) {
         return FALSE;
     } else {
         $query_where_pairs = "";
         if ($exact_filter) {
             $query_where_pairs = \k1lib\sql\array_to_sql_set_exclude($this->db, $clean_filter_array, TRUE, TRUE);
         } else {
             $doFilter = FALSE;
             foreach ($clean_filter_array as $search_value) {
                 if (!empty($search_value)) {
                     $doFilter = TRUE;
                 }
             }
             $i = 0;
             if ($doFilter) {
                 // and make the conditions, all with LIKE
                 foreach ($clean_filter_array as $field => $search_value) {
                     if (isset($this->db_table_config[$field]) && !empty($search_value)) {
                         $query_where_pairs .= $i >= 1 ? " AND " : "";
                         $query_where_pairs .= " {$field} NOT LIKE '%{$search_value}%'";
                         $i++;
                     }
                 }
             }
         }
         if (!empty($this->query_where_pairs)) {
             $this->query_where_pairs = "({$this->query_where_pairs}) AND ({$query_where_pairs})";
         } else {
             $this->query_where_pairs = $query_where_pairs;
         }
         return TRUE;
     }
 }
コード例 #2
0
ファイル: functions.php プロジェクト: klan1/k1.lib
function get_keys_array_from_row_data($row_data, $db_table_config)
{
    $key_fields_array = get_db_table_keys($db_table_config);
    $keys_array = \k1lib\common\clean_array_with_guide($row_data, $key_fields_array);
    if (!empty($keys_array)) {
        return $keys_array;
    } else {
        return [];
    }
}
コード例 #3
0
ファイル: creating.php プロジェクト: klan1/k1.lib
 /**
  * Get and check the $_POST data, then remove the non table values. If do_table_field_name_encrypt is TRUE then will decrypt them too.
  * @return boolean
  */
 function catch_post_data()
 {
     $this->do_file_uploads_validation();
     $this->do_password_fields_validation();
     $_POST = \k1lib\forms\check_all_incomming_vars($_POST);
     $this->post_incoming_array = array_merge($this->post_incoming_array, $_POST);
     if (isset($this->post_incoming_array['k1magic'])) {
         self::set_k1magic_value($this->post_incoming_array['k1magic']);
         unset($this->post_incoming_array['k1magic']);
         if (!empty($this->post_incoming_array)) {
             if ($this->do_table_field_name_encrypt) {
                 $new_post_data = [];
                 foreach ($this->post_incoming_array as $field => $value) {
                     $new_post_data[$this->decrypt_field_name($field)] = $value;
                 }
                 $this->post_incoming_array = $new_post_data;
                 unset($new_post_data);
             }
             $this->post_incoming_array = \k1lib\common\clean_array_with_guide($this->post_incoming_array, $this->db_table->get_db_table_config());
             // PUT BACK the password data
             //                $this->post_incoming_array = array_merge($this->post_incoming_array, $password_array);
             $this->post_data_catched = TRUE;
             return TRUE;
         } else {
             return FALSE;
         }
     } else {
         return FALSE;
     }
 }