mirror of
https://github.com/slawkens/myaac.git
synced 2025-10-14 01:34:55 +02:00
* new hooks: LOGIN, LOGIN_ATTEMPT, LOGOUT
* fixed bug with uninstalling some plugin dirs * updated TODO
This commit is contained in:
@@ -195,8 +195,11 @@ class Plugins {
|
||||
|
||||
if($continue) {
|
||||
if (isset($plugin['install'])) {
|
||||
if (file_exists(BASE . $plugin['install']))
|
||||
if (file_exists(BASE . $plugin['install'])) {
|
||||
$db->revalidateCache();
|
||||
require(BASE . $plugin['install']);
|
||||
$db->revalidateCache();
|
||||
}
|
||||
else
|
||||
self::$warnings[] = 'Cannot load install script. Your plugin might be not working correctly.';
|
||||
}
|
||||
@@ -270,7 +273,7 @@ class Plugins {
|
||||
break;
|
||||
}
|
||||
|
||||
$file = BASE . $file;
|
||||
$file = str_replace('/', '\\', BASE . $file);
|
||||
if(!is_sub_dir($file, BASE) || realpath(dirname($file)) != dirname($file)) {
|
||||
$success = false;
|
||||
self::$error = "You don't have rights to delete: " . $file;
|
||||
|
@@ -879,14 +879,7 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
|
||||
|
||||
public function logAction($action)
|
||||
{
|
||||
$ip = '0';
|
||||
if(isset($_SERVER['REMOTE_ADDR']) && !empty($_SERVER['REMOTE_ADDR']))
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
else if(isset($_SERVER['HTTP_CLIENT_IP']) && !empty($_SERVER['HTTP_CLIENT_IP']))
|
||||
$ip = $_SERVER['HTTP_CLIENT_IP'];
|
||||
else if(isset($_SERVER['HTTP_X_FORWARDED_FOR']) && !empty($_SERVER['HTTP_X_FORWARDED_FOR']))
|
||||
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
|
||||
$ip = get_browser_real_ip();
|
||||
if(strpos($ip, ":") === false) {
|
||||
$ipv6 = '0';
|
||||
}
|
||||
|
@@ -180,6 +180,10 @@ class OTS_DB_MySQL extends OTS_Base_DB
|
||||
return $this->has_table_cache[$name];
|
||||
}
|
||||
|
||||
return $this->hasTableInternal($name);
|
||||
}
|
||||
|
||||
private function hasTableInternal($name) {
|
||||
global $config;
|
||||
return ($this->has_table_cache[$name] = $this->query("SELECT `TABLE_NAME` FROM `information_schema`.`tables` WHERE `TABLE_SCHEMA` = " . $this->quote($config['database_name']) . " AND `TABLE_NAME` = " . $this->quote($name) . " LIMIT 1;")->rowCount() > 0);
|
||||
}
|
||||
@@ -189,8 +193,25 @@ class OTS_DB_MySQL extends OTS_Base_DB
|
||||
return $this->has_column_cache[$table . '.' . $column];
|
||||
}
|
||||
|
||||
return $this->hasColumnInternal($table, $column);
|
||||
}
|
||||
|
||||
private function hasColumnInternal($table, $column) {
|
||||
return ($this->has_column_cache[$table . '.' . $column] = count($this->query("SHOW COLUMNS FROM `" . $table . "` LIKE '" . $column . "'")->fetchAll()) > 0);
|
||||
}
|
||||
|
||||
public function revalidateCache() {
|
||||
foreach($this->has_table_cache as $key => $value) {
|
||||
$this->hasTableInternal($key);
|
||||
}
|
||||
|
||||
foreach($this->has_column_cache as $key => $value) {
|
||||
$explode = explode('.', $key);
|
||||
if(isset($this->has_table_cache[$explode[0]]) && $this->has_table_cache[$explode[0]]) {// first check if table exist
|
||||
$this->hasColumnInternal($explode[0], $explode[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**#@-*/
|
||||
|
Reference in New Issue
Block a user