Esempio n. 1
0
/**
 * 把当前 QUERY_STRING分解成数组
 *
 * @return array
 */
function query_string_to_array()
{
    $params = array();
    $query_string = explode('&', query_string());
    foreach ($query_string as $string) {
        if (strpos($string, '=')) {
            list($key, $value) = explode('=', $string);
            $params[$key] = $value;
        }
    }
    return $params;
}
Esempio n. 2
0
 function test_query_string_removes_paths()
 {
     assert_equal('a=1', query_string(array('a' => 1, 'b' => 2), null, 'b'));
 }
Esempio n. 3
0
                }
                break;
            case '=':
                $dur = '= ' . (int) trim(subStr($dur, 1));
                break;
            default:
                $dur = '> ' . (int) trim($dur);
                break;
        }
    } else {
        $dur = '';
    }
    return $dur;
}
$dur = _sanitize_dur($dur);
$query_string = query_string($period, $src, $dst, $dur, $stat);
/*
echo 'SELECT SQL_CALC_FOUND_ROWS
DATE_FORMAT(calldate,\'%d.%m.%Y %H:%i:%s\') as datum,clid,src,dst,duration,billsec,disposition
FROM `ast_cdr` '. $query_string;
*/
$rs = $CDR_DB->execute('DELETE FROM `ast_cdr` WHERE `dst`=\'h\'');
$rs = $CDR_DB->execute('SELECT SQL_CALC_FOUND_ROWS
	DATE_FORMAT(`calldate`, \'%d.%m.%Y %H:%i:%s\') `datum`, `clid`, `src`, `dst`, `duration`, `billsec`, `disposition`, `userfield`, `dcontext`
FROM `ast_cdr` ' . $query_string . '
ORDER BY `calldate` DESC
LIMIT ' . $page * (int) $per_page . ',' . (int) $per_page);
$num_total = @$CDR_DB->numFoundRows();
$num_pages = ceil($num_total / $per_page);
$sum_talktime = (int) @$CDR_DB->executeGetOne('SELECT SUM(`billsec`) FROM `ast_cdr` ' . $query_string);
$sum_calltime = (int) @$CDR_DB->executeGetOne('SELECT SUM(`duration`) FROM `ast_cdr` ' . $query_string);
/**
 * current_url_query_string function.
 *
 * returns uri_string with query_string on the end and current_url at the
 * beginning.
 *
 * @param mixed $add (default: '')
 * @param mixed $remove (default: '')
 * @param bool $include_current (default: TRUE) Whether to include the
 * current page's query string or start fresh.
 * @return string
 */
function current_url_query_string($add = '', $remove = '', $include_current = TRUE)
{
    $_ci =& get_instance();
    $_ci->load->helper('url');
    return current_url() . query_string($add, $remove, $include_current);
}