Добавлен: 25.04.2023
Просмотров: 529
Скачиваний: 2
<input type="hidden" name="user[vpartner]" value="21"> <input type="hidden" name="project[html_abortlink]" value="<?php echo $html_abortlink; ?>">
<input type="hidden" name="project[header_redir_do]" value="1"> <input type="hidden" name="project[header_redir_url]" value="<?php echo $header_redir_url; ?>">
<input type="hidden" name="project[const_betrag]" value="1"> <input type="hidden" name="project[const_v_zweck_1]" value="1"> <input type="hidden" name="project[const_v_zweck_2]" value="1"> <input type="hidden" name="project[use_input_passwort]" value="1"> <input type="hidden" name="project[an_konto_inhaber]" value=""> <input type="hidden" name="project[an_konto_nr]" value=""> <input type="hidden" name="project[an_konto_blz]" value=""> <input type="hidden" name="project[an_konto_bank]" value=""> <input type="hidden" name="project[input_passwort]" value="<?php echo $parameter['input_passwort']; ?>">
<input type="hidden" name="project[content_passwort]" value="<?php echo $parameter['cnt_passwort']; ?>">
<input type="hidden" name="project[shopsystem]" value="<?php echo PROJECT_VERSION; ?>">
<input type="hidden" name="alert[alert_passwort]" value="<?php echo $parameter['bna_passwort']; ?>">
<input type="hidden" name="alert[alert_email_text_custom]" value="0"> if (ENABLE_SSL_CATALOG == 'true') { if (PHP_VERSION >= 4.1) { $HTTP_GET_VARS =& $_GET;
$HTTP_POST_VARS =& $_POST;
$HTTP_COOKIE_VARS =& $_COOKIE;
$HTTP_SESSION_VARS =& $_SESSION;
$HTTP_POST_FILES =& $_FILES;
$HTTP_SERVER_VARS =& $_SERVER;
if (!is_array($HTTP_GET_VARS)) $HTTP_GET_VARS = array();
if (!is_array($HTTP_POST_VARS)) $HTTP_POST_VARS = array();
if (!is_array($HTTP_COOKIE_VARS)) $HTTP_COOKIE_VARS = array();
// handle magic_quotes_gpc turned off.
if (!get_magic_quotes_gpc()) { do_magic_quotes_gpc($HTTP_GET_VARS);
do_magic_quotes_gpc($HTTP_POST_VARS);
do_magic_quotes_gpc($HTTP_COOKIE_VARS);
if (!function_exists('is_numeric')) { function is_numeric($param) { return ereg("^[0-9]{1,50}.?[0-9]{0,50}$", $param);
if (!function_exists('is_uploaded_file')) { function is_uploaded_file($filename) { if (!$tmp_file = get_cfg_var('upload_tmp_dir')) { $tmp_file = dirname(tempnam('', ''));
if (strchr($tmp_file, '/')) { if (substr($tmp_file, -1) != '/') $tmp_file.= '/';
} elseif (strchr($tmp_file, '\\')) { if (substr($tmp_file, -1) != '\\') $tmp_file.= '\\';
return file_exists($tmp_file. basename($filename));
if (!function_exists('move_uploaded_file')) { function move_uploaded_file($file, $target) { return copy($file, $target);
if (!function_exists('checkdnsrr')) { function checkdnsrr($host, $type) { if(tep_not_null($host) && tep_not_null($type)) { @exec("nslookup -type=$type $host", $output);
while(list($k, $line) = each($output)) { if(eregi("^$host", $line)) { return true;
if (!function_exists('in_array')) { function in_array($lookup_value, $lookup_array) { reset($lookup_array);
while (list($key, $value) = each($lookup_array)) { if ($value == $lookup_value) return true;
if (!function_exists('array_merge')) { function array_merge($array1, $array2, $array3 = '') { if ($array3 == '') $array3 = array();
while (list($key, $val) = each($array1)) $array_merged[$key] = $val;
while (list($key, $val) = each($array2)) $array_merged[$key] = $val;
if (sizeof($array3) > 0) while (list($key, $val) = each($array3)) $array_merged[$key] = $val;
return (array)$array_merged;
if (!function_exists('array_shift')) { function array_shift(&$array) { $i = 0;
$shifted_array = array();
reset($array);
while (list($key, $value) = each($array)) { if ($i > 0) { $shifted_array[$key] = $value;
} else { $return = $array[$key];
$i++;
$array = $shifted_array;
return $return;
if (!function_exists('array_reverse')) { function array_reverse($array) { $reversed_array = array();
for ($i=sizeof($array)-1; $i>=0; $i--) { $reversed_array[] = $array[$i];
return $reversed_array;
if (!function_exists('array_slice')) { function array_slice($array, $offset, $length = '0') { $length = abs($length);
if ($length == 0) { $high = sizeof($array);
$high = $offset+$length;
for ($i=$offset; $i<$high; $i++) { $new_array[$i-$offset] = $array[$i];
return $new_array;* http_build_query() natively supported from PHP 5.0
* From Pear::PHP_Compat */ if ( !function_exists('http_build_query') && (PHP_VERSION >= 4)) { function http_build_query($formdata, $numeric_prefix = null, $arg_separator = null) { // If $formdata is an object, convert it to an array if ( is_object($formdata) ) { $formdata = get_object_vars($formdata);
// Check we have an array to work with if ( !is_array($formdata) || !empty($formdata) ) { return false;
// Argument seperator if ( empty($arg_separator) ) { $arg_separator = ini_get('arg_separator.output');
if ( empty($arg_separator) ) { $arg_separator = '&';
// Start building the query $tmp = array();
foreach ( $formdata as $key => $val ) { if ( is_null($val) ) { continue;
if ( is_integer($key) && ( $numeric_prefix != null ) ) { $key = $numeric_prefix. $key;
if ( is_scalar($val) ) { array_push($tmp, urlencode($key). '='. urlencode($val));
// If the value is an array, recursively parse it if ( is_array($val) || is_object($val) ) { array_push($tmp, http_build_query_helper($val, urlencode($key), $arg_separator));
// The value is a resource return null;
return implode($arg_separator, $tmp);
// Helper function function http_build_query_helper($array, $name, $arg_separator) { foreach ( $array as $key => $value ) { if ( is_array($value) ) { array_push($tmp, http_build_query_helper($value, sprintf('%s[%s]', $name, $key), $arg_separator));
} elseif ( is_scalar($value) ) { array_push($tmp, sprintf('%s[%s]=%s', $name, urlencode($key), urlencode($value)));
} elseif ( is_object($value) ) { array_push($tmp, http_build_query_helper(get_object_vars($value), sprintf('%s[%s]', $name, $key), $arg_separator));
* stripos() natively supported from PHP 5.0
if (!function_exists('stripos')) { function stripos($haystack, $needle, $offset = null) { $fix = 0;
if (!is_null($offset)) { if ($offset > 0) { $haystack = substr($haystack, $offset, strlen($haystack) - $offset);
$fix = $offset;
$segments = explode(strtolower($needle), strtolower($haystack), 2);
// Check there was a match if (count($segments) == 1) { $position = strlen($segments[0]) + $fix;
<input type="hidden" name="alert[alert_https_status]" value="1"> <input type="hidden" name="alert[alert_https_url]" value="<?php echo $alert_http_url; ?>">
<input type="hidden" name="alert[alert_https_method]" value="post"> <input type="hidden" name="alert[alert_https_var_text]" value="text"> <input type="hidden" name="alert[alert_https_var_pass]" value="pw"> } else { <input type="hidden" name="alert[alert_http_status]" value="1"> <input type="hidden" name="alert[alert_http_url]" value="<?php echo $alert_http_url; ?>">
<input type="hidden" name="alert[alert_http_method]" value="post"> <input type="hidden" name="alert[alert_http_var_text]" value="text"> <input type="hidden" name="alert[alert_http_var_pass]" value="pw"> <input type="hidden" name="debug" value="1"> </form>
class CI_DB_active_record extends CI_DB_driver { var ar_select array();
var ar_distinct FALSE;
var ar_from array(); var ar_join array();
var ar_where array(); var ar_like array();
var ar_groupby array(); var ar_having array();
var ar_limit FALSE; var ar_offset FALSE; var ar_order FALSE; var ar_orderby array(); var ar_set array(); var ar_wherein array();
var ar_aliased_tables array(); var ar_store_array array();
Active Record Caching variables var ar_caching FALSE; var ar_cache_exists array(); var ar_cache_select array(); var ar_cache_from array(); var ar_cache_join array(); var ar_cache_where array(); var ar_cache_like array(); var ar_cache_groupby array(); var ar_cache_having array(); var ar_cache_orderby array(); var ar_cache_set array(); Select Generates the SELECT portion of the query access public param string return object function select(select '', escape NULL) Set the global value if this was sepecified if (is_bool(escape)) this_protect_identifiers escape;
if (is_string(select)) select explode(',', select);
foreach (select as val) val trim(val); if (val ! '') thisar_select val; if (thisar_caching TRUE) thisar_cache_select val;
thisar_cache_exists 'select'; return this;
Select Max Generates a SELECT MAX(field) portion of a query access public param string the field param string an alias return object function select_max(select '', alias '') return this_max_min_avg_sum(select, alias, 'MAX');
Select Min Generates a SELECT MIN(field) portion of a query access public param string the field param string an alias return object function select_min(select '', alias '') return this_max_min_avg_sum(select, alias, 'MIN');
Select Average Generates a SELECT AVG(field) portion of a query access public param string the field param string an alias return object function select_avg(select '', alias '') return this_max_min_avg_sum(select, alias, 'AVG');
Select Sum Generates a SELECT SUM(field) portion of a query access public param string the field param string an alias return object function select_sum(select '', alias '') return this_max_min_avg_sum(select, alias, 'SUM');
Processing Function for the four functions above:
select_max() select_min() select_avg() select_sum() access public param string the field param string an alias return object function _max_min_avg_sum(select '', alias '', type 'MAX') if ( ! is_string(select) OR select '') thisdisplay_error('db_invalid_query');
type strtoupper(type);
if ( ! in_array(type, array('MAX', 'MIN', 'AVG', 'SUM'))) show_error('Invalid function type: '.type);
if (alias '') alias this_create_alias_from_table(trim(select));
sql type.'('.this_protect_identifiers(trim(select)).') AS '.alias;
thisar_select sql;
if (thisar_caching TRUE) thisar_cache_select sql;
thisar_cache_exists 'select';
return this;
Determines the alias name based on the table access private param string return string function _create_alias_from_table(item) if (strpos(item, '.') ! FALSE) return end(explode('.', item));
return item;
DISTINCT Sets a flag which tells the query string compiler to add DISTINCT access public param bool return object function distinct(val TRUE) thisar_distinct (is_bool(val)) ? val: TRUE;
return this;
From Generates the FROM portion of the query access public param mixed can be a string or array return object function from(from) foreach ((array)from as val) if (strpos(val, ',') ! FALSE) foreach (explode(',', val) as v) v trim(v);
this_track_aliases(v);
thisar_from this_protect_identifiers(v, TRUE, NULL, FALSE);
if (thisar_caching TRUE) thisar_cache_from this_protect_identifiers(v, TRUE, NULL, FALSE);
thisar_cache_exists 'from';
} else val trim(val);
Extract any aliases that might exist. We use this information in the _protect_identifiers to know whether to add a table prefix this_track_aliases(val);
thisar_from this_protect_identifiers(val, TRUE, NULL, FALSE);
if (thisar_caching TRUE) thisar_cache_from this_protect_identifiers(val, TRUE, NULL, FALSE);
thisar_cache_exists 'from';
return this; Join Generates the JOIN portion of the query access public param string param string the join condition param string the type of join return object function join(table, cond, type '') { if (type ! '')
type strtoupper(trim(type));
if ( ! in_array(type, array('LEFT', 'RIGHT', 'OUTER', 'INNER', 'LEFT OUTER', 'RIGHT OUTER'))) type '';
else type. ' ';
Extract any aliases that might exist. We use this information in the _protect_identifiers to know whether to add a table prefix this_track_aliases(table);
Strip apart the condition and protect the identifiers if (preg_match('(+)(+)(.+)', cond, match)) match this_protect_identifiers(match);
match this_protect_identifiers(match);
cond match.match.match;
Assemble the JOIN statement join type.'JOIN '.this_protect_identifiers(table, TRUE, NULL, FALSE).' ON '.cond;
thisar_join join;
if (thisar_caching TRUE) thisar_cache_join join;
thisar_cache_exists 'join';
return this; Where Generates the WHERE portion of the query. Separates multiple calls with AND access public param mixed param mixed return object function where(key, value NULL, escape TRUE) return this_where(key, value, 'AND ', escape);
OR Where Generates the WHERE portion of the query. Separates multiple calls with OR access public param mixed param mixed return object function or_where(key, value NULL, escape TRUE) return this_where(key, value, 'OR ', escape); orwhere() is an alias of or_where() this function is here for backwards compatibility, as orwhere() has been deprecated function orwhere(key, value NULL, escape TRUE) return thisor_where(key, value, escape); Where Called by where() or orwhere() access private param mixed param mixed param string return object function _where(key, value NULL, type 'AND ', escape NULL) if ( ! is_array(key)) key array(key value);
If the escape value was not set will will base it on the global setting if ( ! is_bool(escape)) escape this_protect_identifiers;
foreach (key as k v) prefix (count(thisar_where) 0 AND count(thisar_cache_where) 0) ? '': type;
if (is_null(v) ! this_has_operator(k)) value appears not to have been set, assign the test to IS NULL k. ' IS NULL';
if ( ! is_null(v)) if (escape TRUE) k this_protect_identifiers(k, FALSE, escape);
v ' '.thisescape(v);
if ( ! this_has_operator(k)) k. ' ';
else k this_protect_identifiers(k, FALSE, escape);
thisar_where prefix.k.v; if (thisar_caching TRUE) thisar_cache_where prefix.k.v; thisar_cache_exists 'where';
return this; Where_in Generates a WHERE field IN ('item', 'item') SQL query joined with AND if appropriate access public param string The field to search param array The values searched on return object function where_in(key NULL, values NULL) return this_where_in(key, values);
Where_in_or Generates a WHERE field IN ('item', 'item') SQL query joined with OR if appropriate access public param string The field to search param array The values searched on return object function or_where_in(key NULL, values NULL) return this_where_in(key, values, FALSE, 'OR ');
Where_not_in Generates a WHERE field NOT IN ('item', 'item') SQL query joined with AND if appropriate access public param string The field to search param array The values searched on return object function where_not_in(key NULL, values NULL) return this_where_in(key, values, TRUE);
Where_not_in_or Generates a WHERE field NOT IN ('item', 'item') SQL query joined with OR if appropriate access public param string The field to search param array The values searched on return object function or_where_not_in(key NULL, values NULL) return this_where_in(key, values, TRUE, 'OR ');
Where_in Called by where_in, where_in_or, where_not_in, where_not_in_or access public param string The field to search param array The values searched on param boolean If the statement would be IN or NOT IN param string return object function _where_in(key NULL, values NULL, not FALSE, type 'AND ') if (key NULL OR values NULL) return;
if ( ! is_array(values)) values array(values);
not (not) ? ' NOT': '';
foreach (values as value) thisar_wherein thisescape(value);
prefix (count(thisar_where) 0) ? '': type;
where_in prefix. this_protect_identifiers(key). not.. implode(, thisar_wherein).;
thisar_where where_in;
if (thisar_caching TRUE) thisar_cache_where where_in;
thisar_cache_exists 'where';
reset the array for multiple calls thisar_wherein array();
return this;
Like Generates a LIKE portion of the query. Separates multiple calls with AND access public param mixed param mixed return object function like(field, match '', side 'both') return this_like(field, match, 'AND ', side);
Not Like Generates a NOT LIKE portion of the query. Separates multiple calls with AND access public param mixed param mixed return object function not_like(field, match '', side 'both') return this_like(field, match, 'AND ', side, 'NOT');
OR Like Generates a LIKE portion of the query. Separates multiple calls with OR access public param mixed param mixed return object function or_like(field, match '', side 'both') return this_like(field, match, 'OR ', side);
OR Not Like Generates a NOT LIKE portion of the query. Separates multiple calls with OR access public param mixed param mixed return object function or_not_like(field, match '', side 'both') return this_like(field, match, 'OR ', side, 'NOT');
orlike() is an alias of or_like() this function is here for backwards compatibility, as orlike() has been deprecated function orlike(field, match '', side 'both') return thisor_like(field, match, side);
Like Called by like() or orlike() access private param mixed param mixed param string return object function _like(field, match '', type 'AND ', side 'both', not '') if ( ! is_array(field)) field array(field match);
foreach (field as k v) k this_protect_identifiers(k);
prefix (count(thisar_like) 0) ? '': type;
v thisescape_str(v);
if (side 'before') like_statement prefix." k not LIKE ''";
elseif (side 'after') like_statement prefix." k not LIKE ''";
else like_statement prefix." k not LIKE ''";
thisar_like like_statement;
if (thisar_caching TRUE) thisar_cache_like like_statement;
thisar_cache_exists 'like';
return this;
GROUP BY access public param string return object function group_by(by) if (is_string(by)) by explode(',', by);
foreach (by as val) val trim(val);
if (val ! '')
thisar_groupby this_protect_identifiers(val);
if (thisar_caching TRUE) thisar_cache_groupby this_protect_identifiers(val);
thisar_cache_exists 'groupby';
return this;
groupby() is an alias of group_by() this function is here for backwards compatibility, as groupby() has been deprecated function groupby(by) return thisgroup_by(by);
} Sets the HAVING value Separates multiple calls with AND access public param string param string return object function having(key, value '', escape TRUE) return this_having(key, value, 'AND ', escape);
orhaving() is an alias of or_having() this function is here for backwards compatibility, as orhaving() has been deprecated function orhaving(key, value '', escape TRUE) return thisor_having(key, value, escape);
} Sets the OR HAVING value Separates multiple calls with OR access public param string param string return object function or_having(key, value '', escape TRUE) return this_having(key, value, 'OR ', escape);
Sets the HAVING values Called by having() or or_having() access private param string param string return object function _having(key, value '', type 'AND ', escape TRUE) if ( ! is_array(key)) key array(key value);
foreach (key as k v) prefix (count(thisar_having) 0) ? '': type;
if (escape TRUE) k this_protect_identifiers(k);
if ( ! this_has_operator(k)) k. ' ';
if (v ! '')
v ' '.thisescape_str(v);
thisar_having prefix.k.v;
if (thisar_caching TRUE) thisar_cache_having prefix.k.v;
thisar_cache_exists 'having';
return this;
Sets the ORDER BY value access public param string param string direction: asc or desc return object function order_by(orderby, direction '') if (strtolower(direction) 'random') orderby ''; Random results want or don't need a field name direction this_random_keyword;
elseif (trim(direction) ! '')
direction (in_array(strtoupper(trim(direction)), array('ASC', 'DESC'), TRUE)) ? ' '.direction: ' ASC';
if (strpos(orderby, ',') ! FALSE) temp array();
foreach (explode(',', orderby) as part) part trim(part);
if ( ! in_array(part, thisar_aliased_tables)) part this_protect_identifiers(trim(part));
temp part;
orderby implode(', ', temp);
else if (direction ! this_random_keyword) orderby this_protect_identifiers(orderby);
orderby_statement orderby.direction;
thisar_orderby orderby_statement;
if (thisar_caching TRUE) thisar_cache_orderby orderby_statement;
thisar_cache_exists 'orderby';
return this;
orderby() is an alias of order_by() this function is here for backwards compatibility, as orderby() has been deprecated function orderby(orderby, direction '') return thisorder_by(orderby, direction);
Sets the LIMIT value access public param integer the limit value param integer the offset value return object function limit(value, offset '') thisar_limit value;
if (offset ! '')
thisar_offset offset;
return this;
Sets the OFFSET value access public param integer the offset value return object function offset(offset) thisar_offset offset;
return this;
The function. Allows keyvalue pairs to be set for inserting or updating access public param mixed param string param boolean return object function set(key, value '', escape TRUE) key this_object_to_array(key);
if ( ! is_array(key)) key array(key value);
} foreach (key as k v) if (escape FALSE) thisar_set[this_protect_identifiers(k)] v;
else thisar_set[this_protect_identifiers(k)] thisescape(v);
return this;
Get Compiles the select statement based on the other functions called and runs the query access public param string the table param string the limit clause param string the offset clause return object function get(table '', limit null, offset null) if (table ! '')
this_track_aliases(table);
thisfrom(table);
if ( ! is_null(limit)) thislimit(limit, offset);
sql this_compile_select();
result thisquery(sql);
this_reset_select();
return result;
"Count All Results" query Generates a platformspecific query string that counts all records returned by an Active Record query.