1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-04 13:47:31 +02:00

Applying missing commits

This commit is contained in:
SecretR
2013-10-16 18:13:21 +03:00
parent 932be9aacb
commit 6ae99f2bfd
9 changed files with 43 additions and 20 deletions

View File

@@ -3625,7 +3625,7 @@ class e_admin_controller_ui extends e_admin_controller
{ {
$tableSJoinArr[] = "{$tparams['__tablePath']}*"; $tableSJoinArr[] = "{$tparams['__tablePath']}*";
} }
else elseif($fields)
{ {
$tableSJoinArr[] = $fields; $tableSJoinArr[] = $fields;
/*$fields = explode(',', $fields); /*$fields = explode(',', $fields);

View File

@@ -251,7 +251,7 @@ class convert
$tdata['tm_hour'], $tdata['tm_hour'],
$tdata['tm_min'], $tdata['tm_min'],
$tdata['tm_sec'], $tdata['tm_sec'],
$tdata['tm_mon'], $tdata['tm_mon'] + 1,
$tdata['tm_mday'], $tdata['tm_mday'],
($tdata['tm_year'] + 1900) ($tdata['tm_year'] + 1900)
); );

View File

@@ -1207,10 +1207,10 @@ class e_parse extends e_parser
// it should work for any characters encoding // it should work for any characters encoding
// FIXME - INVESTIGATE this one, switch to utf8 aware methods // FIXME - INVESTIGATE this one, switch to utf8 aware methods
$leftAmp = strrpos(substr($ret, -8), '&'); $leftAmp = $this->ustrrpos($this->usubstr($ret, -8), '&');
if($leftAmp) if($leftAmp)
{ {
$ret = substr($ret, 0, strlen($ret) - 8 + $leftAmp); $ret = $this->usubstr($ret, 0, $this->ustrlen($ret) - 8 + $leftAmp);
} }
return $ret.$more; return $ret.$more;

View File

@@ -687,14 +687,30 @@ class e_form
{ {
if(!is_array($options)) parse_str($options, $options); if(!is_array($options)) parse_str($options, $options);
$default_name = vartrue($default_name,USERNAME); $default_name = vartrue($default_name, '');
$default_id = vartrue($default_id,USERID); $default_id = vartrue($default_id, 0);
//TODO Auto-calculate $name_fld from $id_fld ie. append "_usersearch" here ? //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'])) $fldid = $this->name2id($name_fld);
.$this->hidden($id_fld,$default_id, array('id' => $this->name2id($id_fld)))." id# ".$default_id; $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# <span id='{$fldid}-id'>".$default_id.'</span>';
$ret .= " <a href='#' id='{$fldid}-reset'>reset</a>";
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'; $label_fld = str_replace('_', '-', $name_fld).'-upicker-lable';

View File

@@ -1453,10 +1453,11 @@ class e_model extends e_object
/** /**
* Generic load data from DB * Generic load data from DB
* @param mixed $id
* @param boolean $force * @param boolean $force
* @return e_model * @return e_model
*/ */
public function load($id, $force = false) public function load($id = null, $force = false)
{ {
if(!$force && $this->getId()) if(!$force && $this->getId())
{ {
@@ -1468,8 +1469,8 @@ class e_model extends e_object
$this->setData(array()) $this->setData(array())
->_clearCacheData(); ->_clearCacheData();
} }
$id = e107::getParser()->toDB($id); if($id) $id = e107::getParser()->toDB($id);
if(!$id) if(!$id && !$this->getParam('db_query'))
{ {
return $this; return $this;
} }
@@ -2658,7 +2659,7 @@ class e_front_model extends e_model
return 0; return 0;
} }
$sql = e107::getDb(); $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) if(!$res)
{ {
$this->_db_errno = $sql->getLastErrorNumber(); $this->_db_errno = $sql->getLastErrorNumber();
@@ -2845,7 +2846,7 @@ class e_admin_model extends e_front_model
return false; return false;
} }
$sql = e107::getDb(); $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) if(!$res)
{ {
$this->_db_errno = $sql->getLastErrorNumber(); $this->_db_errno = $sql->getLastErrorNumber();
@@ -3421,7 +3422,7 @@ class e_front_tree_model extends e_tree_model
} }
$idstr = implode(', ', $ids); $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_errno = $sql->getLastErrorNumber();
$this->_db_errmsg = $sql->getLastErrorText(); $this->_db_errmsg = $sql->getLastErrorText();
if(!$res) if(!$res)

View File

@@ -393,7 +393,7 @@ class e_db_mysql
if ($debug == 'now') if ($debug == 'now')
{ {
echo "** $query<br />\n"; echo "<pre>** $query</pre><br />\n";
} }
if ($debug !== FALSE || strstr($_SERVER['QUERY_STRING'], 'showsql')) if ($debug !== FALSE || strstr($_SERVER['QUERY_STRING'], 'showsql'))
{ {

View File

@@ -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 string $url
* @param boolean $replace - default TRUE * @param boolean $replace - default TRUE
* @param integer|null $http_response_code - default NULL * @param integer|null $http_response_code - default NULL
* @param boolean $preventCache
* @return void * @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()) if(session_id())
{ {
e107::getSession()->end(); 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) if(null === $http_response_code)
{ {
header('Location: '.$url, $replace); header('Location: '.$url, $replace);

View File

@@ -338,7 +338,7 @@ class UserHandler
*/ */
public function generateRandomString($pattern, $seed = '') public function generateRandomString($pattern, $seed = '')
{ {
if (strlen($pattern) < 6) if (empty($pattern))
$pattern = '##....'; $pattern = '##....';
$newname = ''; $newname = '';

View File

@@ -119,7 +119,7 @@ class login_menu_class
if(($tmp = getcachedvars('loginbox_elist')) !== FALSE) return $tmp; if(($tmp = getcachedvars('loginbox_elist')) !== FALSE) return $tmp;
$ret = array(); $ret = array();
$lbox_admin = varsettrue($eplug_admin, false); //$lbox_admin = varsettrue($eplug_admin, false);
$coreplugs = $this->get_coreplugs(); $coreplugs = $this->get_coreplugs();
$lprefs = varsettrue($this->loginPrefs['external_links']) ? explode(',', $this->loginPrefs['external_links']) : array(); $lprefs = varsettrue($this->loginPrefs['external_links']) ? explode(',', $this->loginPrefs['external_links']) : array();