Date: 11/27/00
- Next message: Peter Schiedner: "[phplib] trouble with ct_sql.inc/db_mysql.inc"
- Previous message: Jens Benecke: "Re: [phplib] Security"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hello,
I'm not sure if this is the right place, but here is a patch for
sqlquery.inc in phplib-7.2.
It removes the dependency on the global variable $sess.
It also doesn't allow changing the size of the query when variable is
not set to "on" or true.
It also adds a method "set_lang" that sets the language only if the
dictionary is available for that language. If it is called without
parameters it tries to use the browser's prefered language.
Finally it adds a language dictionary for Spanish. :)
Plese reply to me separately as I am not subscribed.
-- Ivan Jager
30a31,41 > "es" => array( > "searchfor" => "Buscar:", > "and" => "y", > "or" => "o", > "like" => "contiene", > "reset" => "Borrar", > "submit" => "Enviar", > "less" => "Menos", > "more" => "Mas" > ), > 69a81,86 > > function Sql_Query() > { > $this->set_lang(); > } > 120a138 > ## 20001127 - Ivan Jager <ivanjager <email protected>> removed $sess dependency 122d139 < global $sess; 124c141 < ##
---
> ##
144c161
< ($target)?$target:$sess->self_url());
---
> ($target)?$target:$GLOBALS[SCRIPT_NAME]);
310,311c327,333
< if (isset($GLOBALS[$base]["less_0"]))
< $this->conditions -= $incr;
---
>
> if ( $this->variable == "on" || $this->variable == true )
> {
> $this->conditions = $this->count_conditions($base);
>
> if (isset($GLOBALS[$base]["less_0"]))
> $this->conditions -= $incr;
313,314c335,337
< if (isset($GLOBALS[$base]["more_0"]))
< $this->conditions += $incr;
---
> if (isset($GLOBALS[$base]["more_0"]))
> $this->conditions += $incr;
> }
320a344,379
>
> ## count_conditions:
> ##
> ## Count the number or conditions that were submitted to completely
> ## eliminate the need for session management. :)
> ##
> ## The best would be to change the variable naming to $base."[sel][".$i."]",
> ## and just use count($GLOBALS[$base]['sel']), but that could break
> ## compatibility for others. :(
> ## Ivan Jager
> function count_conditions($base)
> {
> for ($i=1; isset($GLOBALS[$base]["sel_$i"]); $i++);
> return $i-1;
> }
>
> ## set_lang:
> ##
> ## Set the language to $lang only if the dictionary for that language is
> ## available. If $lang is not set we use the browsers prefered language
> ## Returns the language that was set.
> ## Ivan Jager
> function set_lang($lang='')
> {
> if ($lang == '')
> {
> $lang = $GLOBALS[HTTP_ACCEPT_LANGUAGE];
> $lang = substr($lang, 0, strstr($lang, ' ') );
> }
>
> if ( isset($this->dict[$lang]) )
> $this->lang = $lang;
>
> return $this->lang;
> }
>
--------------------------------------------------------------------- To unsubscribe, e-mail: phplib-unsubscribe <email protected> For additional commands, e-mail: phplib-help <email protected>
- Next message: Peter Schiedner: "[phplib] trouble with ct_sql.inc/db_mysql.inc"
- Previous message: Jens Benecke: "Re: [phplib] Security"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

