diff --git a/e107_handlers/admin_ui.php b/e107_handlers/admin_ui.php index 4414fdb4f..cbe2215f9 100644 --- a/e107_handlers/admin_ui.php +++ b/e107_handlers/admin_ui.php @@ -3625,7 +3625,7 @@ class e_admin_controller_ui extends e_admin_controller { $tableSJoinArr[] = "{$tparams['__tablePath']}*"; } - else + elseif($fields) { $tableSJoinArr[] = $fields; /*$fields = explode(',', $fields); diff --git a/e107_handlers/date_handler.php b/e107_handlers/date_handler.php index fc8646ce7..e298c598c 100644 --- a/e107_handlers/date_handler.php +++ b/e107_handlers/date_handler.php @@ -251,7 +251,7 @@ class convert $tdata['tm_hour'], $tdata['tm_min'], $tdata['tm_sec'], - $tdata['tm_mon'], + $tdata['tm_mon'] + 1, $tdata['tm_mday'], ($tdata['tm_year'] + 1900) ); diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php index 16f710703..a56eef964 100644 --- a/e107_handlers/e_parse_class.php +++ b/e107_handlers/e_parse_class.php @@ -1207,10 +1207,10 @@ class e_parse extends e_parser // it should work for any characters encoding // FIXME - INVESTIGATE this one, switch to utf8 aware methods - $leftAmp = strrpos(substr($ret, -8), '&'); + $leftAmp = $this->ustrrpos($this->usubstr($ret, -8), '&'); if($leftAmp) { - $ret = substr($ret, 0, strlen($ret) - 8 + $leftAmp); + $ret = $this->usubstr($ret, 0, $this->ustrlen($ret) - 8 + $leftAmp); } return $ret.$more; diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index 149c27e17..9809888a4 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -687,14 +687,30 @@ class e_form { if(!is_array($options)) parse_str($options, $options); - $default_name = vartrue($default_name,USERNAME); - $default_id = vartrue($default_id,USERID); + $default_name = vartrue($default_name, ''); + $default_id = vartrue($default_id, 0); //TODO Auto-calculate $name_fld from $id_fld ie. append "_usersearch" here ? - return $this->text($name_fld,$default_name,20, "class=e-tip&title=Type name of user&typeahead=users&readonly=".vartrue($options['readonly'])) - .$this->hidden($id_fld,$default_id, array('id' => $this->name2id($id_fld)))." id# ".$default_id; + $fldid = $this->name2id($name_fld); + $hidden_fldid = $this->name2id($id_fld); + + $ret = $this->text($name_fld,$default_name,20, "class=e-tip&title=Type name of user&typeahead=users&readonly=".vartrue($options['readonly'])) + .$this->hidden($id_fld,$default_id, array('id' => $this->name2id($id_fld)))." id# ".$default_id.''; + $ret .= " reset"; + e107::getJs()->footerInline(" + \$('#{$fldid}').blur(function () { + \$('#{$fldid}-id').html(\$('#{$hidden_fldid}').val()); + }); + \$('#{$fldid}-reset').click(function () { + \$('#{$fldid}-id').html('0'); + \$('#{$hidden_fldid}').val(0); + \$('#{$fldid}').val(''); + }); + "); + + return $ret; /* $label_fld = str_replace('_', '-', $name_fld).'-upicker-lable'; diff --git a/e107_handlers/model_class.php b/e107_handlers/model_class.php index e59ac2dd2..f22cb8bbc 100644 --- a/e107_handlers/model_class.php +++ b/e107_handlers/model_class.php @@ -1453,10 +1453,11 @@ class e_model extends e_object /** * Generic load data from DB + * @param mixed $id * @param boolean $force * @return e_model */ - public function load($id, $force = false) + public function load($id = null, $force = false) { if(!$force && $this->getId()) { @@ -1468,8 +1469,8 @@ class e_model extends e_object $this->setData(array()) ->_clearCacheData(); } - $id = e107::getParser()->toDB($id); - if(!$id) + if($id) $id = e107::getParser()->toDB($id); + if(!$id && !$this->getParam('db_query')) { return $this; } @@ -2658,7 +2659,7 @@ class e_front_model extends e_model return 0; } $sql = e107::getDb(); - $res = $sql->db_Update($this->getModelTable(), $this->toSqlQuery('update')); + $res = $sql->db_Update($this->getModelTable(), $this->toSqlQuery('update'), $this->getParam('db_debug', false)); if(!$res) { $this->_db_errno = $sql->getLastErrorNumber(); @@ -2845,7 +2846,7 @@ class e_admin_model extends e_front_model return false; } $sql = e107::getDb(); - $res = $sql->db_Insert($this->getModelTable(), $this->toSqlQuery('create')); + $res = $sql->db_Insert($this->getModelTable(), $this->toSqlQuery('create'), $this->getParam('db_debug', false)); if(!$res) { $this->_db_errno = $sql->getLastErrorNumber(); @@ -3421,7 +3422,7 @@ class e_front_tree_model extends e_tree_model } $idstr = implode(', ', $ids); - $res = $sql->db_Update($this->getModelTable(), "{$field}={$value} WHERE ".$this->getFieldIdName().' IN ('.$idstr.')'); + $res = $sql->db_Update($this->getModelTable(), "{$field}={$value} WHERE ".$this->getFieldIdName().' IN ('.$idstr.')', $this->getParam('db_debug', false)); $this->_db_errno = $sql->getLastErrorNumber(); $this->_db_errmsg = $sql->getLastErrorText(); if(!$res) diff --git a/e107_handlers/mysql_class.php b/e107_handlers/mysql_class.php index 346d9e9cf..75f525351 100644 --- a/e107_handlers/mysql_class.php +++ b/e107_handlers/mysql_class.php @@ -393,7 +393,7 @@ class e_db_mysql if ($debug == 'now') { - echo "** $query
\n"; + echo "
** $query

\n"; } if ($debug !== FALSE || strstr($_SERVER['QUERY_STRING'], 'showsql')) { diff --git a/e107_handlers/redirection_class.php b/e107_handlers/redirection_class.php index cf5c3b35e..aa479d5c8 100644 --- a/e107_handlers/redirection_class.php +++ b/e107_handlers/redirection_class.php @@ -306,9 +306,9 @@ class redirection } - public function redirect($url, $replace = TRUE, $http_response_code = NULL) + public function redirect($url, $replace = TRUE, $http_response_code = NULL, $preventCache) { - return $this->go($url, $replace, $http_response_code); + return $this->go($url, $replace, $http_response_code, $preventCache); } @@ -318,14 +318,20 @@ class redirection * @param string $url * @param boolean $replace - default TRUE * @param integer|null $http_response_code - default NULL + * @param boolean $preventCache * @return void */ - public function go($url, $replace = TRUE, $http_response_code = NULL) + public function go($url, $replace = TRUE, $http_response_code = NULL, $preventCache = true) { if(session_id()) { e107::getSession()->end(); } + if($preventCache) + { + header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0', true); + header('Expires: Sat, 26 Jul 1997 05:00:00 GMT', true); + } if(null === $http_response_code) { header('Location: '.$url, $replace); diff --git a/e107_handlers/user_handler.php b/e107_handlers/user_handler.php index 975536c7d..3729b3cc6 100644 --- a/e107_handlers/user_handler.php +++ b/e107_handlers/user_handler.php @@ -338,7 +338,7 @@ class UserHandler */ public function generateRandomString($pattern, $seed = '') { - if (strlen($pattern) < 6) + if (empty($pattern)) $pattern = '##....'; $newname = ''; diff --git a/e107_plugins/login_menu/login_menu_class.php b/e107_plugins/login_menu/login_menu_class.php index 24117ca59..58c32cd6e 100644 --- a/e107_plugins/login_menu/login_menu_class.php +++ b/e107_plugins/login_menu/login_menu_class.php @@ -119,7 +119,7 @@ class login_menu_class if(($tmp = getcachedvars('loginbox_elist')) !== FALSE) return $tmp; $ret = array(); - $lbox_admin = varsettrue($eplug_admin, false); + //$lbox_admin = varsettrue($eplug_admin, false); $coreplugs = $this->get_coreplugs(); $lprefs = varsettrue($this->loginPrefs['external_links']) ? explode(',', $this->loginPrefs['external_links']) : array();