diff --git a/phpBB/common.php b/phpBB/common.php index bd0b843673..7d4323cb38 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -190,8 +190,8 @@ set_error_handler('msg_handler'); $user = new user(); $auth = new auth(); $template = new template(); +$cache = new acm(); $db = new sql_db(); -$cache = new acm($db); // Connect to DB $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false); diff --git a/phpBB/includes/acm/acm_db.php b/phpBB/includes/acm/acm_db.php index 054abdb478..a9e1866616 100644 --- a/phpBB/includes/acm/acm_db.php +++ b/phpBB/includes/acm/acm_db.php @@ -21,18 +21,12 @@ class acm { - var $db; var $is_modified = FALSE; var $vars = ''; - var $sql_enabled = FALSE; - - function acm(&$db) - { - $this->db =& $db; - } function load($var_names = '') { + global $db; $this->vars = array(); $sql = 'SELECT var_name, var_ts, var_data @@ -43,9 +37,9 @@ class acm $sql .= " WHERE var_name IN ('" . implode("', '", $var_names) . "')"; } - $result = $this->db->sql_query($sql); + $result = $db->sql_query($sql); - while ($row = $this->db->sql_fetchrow($result)) + while ($row = $db->sql_fetchrow($result)) { $this->vars[$row['var_name']] = array( 'data' => unserialize($row['var_data']), @@ -67,6 +61,8 @@ class acm return; } + global $db; + $delete = $insert = array(); foreach ($this->vars as $var_name => $var_ary) { @@ -79,10 +75,10 @@ class acm else { $delete[] = $var_name; - $insert[] = "'$var_name', " . time() . ", '" . $this->db->sql_escape(serialize($var_ary['data'])) . "'"; + $insert[] = "'$var_name', " . time() . ", '" . $db->sql_escape(serialize($var_ary['data'])) . "'"; } - $this->db->sql_query($sql); + $db->sql_query($sql); } } @@ -90,7 +86,7 @@ class acm { $sql = 'DELETE FROM ' . CACHE_TABLE . " WHERE var_name IN ('" . implode("', '", $delete) . "')"; - $this->db->sql_query($sql); + $db->sql_query($sql); } if (count($insert)) { @@ -99,7 +95,7 @@ class acm case 'mysql': $sql = 'INSERT INTO ' . CACHE_TABLE . ' (var_name, var_ts, var_data) VALUES (' . implode('), (', $insert) . ')'; - $this->db->sql_query($sql); + $db->sql_query($sql); break; default: @@ -107,7 +103,7 @@ class acm { $sql = 'INSERT INTO ' . CACHE_TABLE . " (var_name, var_ts, var_data) VALUES ($values)"; - $this->db->sql_query($sql); + $db->sql_query($sql); } } } @@ -117,9 +113,11 @@ class acm function tidy($max_age = 0) { + global $db; + $sql = 'DELETE FROM ' . CACHE_TABLE . ' WHERE var_ts < ' . (time() - $max_age); - $this->db->sql_query($sql); + $db->sql_query($sql); } function get($var_name, $max_age = 0) diff --git a/phpBB/includes/acm/acm_file.php b/phpBB/includes/acm/acm_file.php index 035885c787..30548f5a5a 100644 --- a/phpBB/includes/acm/acm_file.php +++ b/phpBB/includes/acm/acm_file.php @@ -27,7 +27,7 @@ class acm var $sql_rowset = array(); - function acm(&$db) + function acm() { global $phpbb_root_path; $this->cache_dir = $phpbb_root_path . 'cache/'; diff --git a/phpBB/install/install.php b/phpBB/install/install.php index 1376210c07..c10554eccf 100644 --- a/phpBB/install/install.php +++ b/phpBB/install/install.php @@ -67,7 +67,7 @@ if (@file_exists($phpbb_root_path . 'config.'.$phpEx)) $stage = (isset($_POST['stage'])) ? intval($_POST['stage']) : 0; // These are all strings so we'll just traverse an array -$var_ary = array('language', 'dbms', 'dbhost', 'dbport', 'dbuser', 'dbpasswd', 'dbname', 'table_prefix', 'admin_name', 'admin_pass1', 'admin_pass2', 'board_email1', 'board_email2', 'server_name', 'server_port', 'script_path', 'img_imagick', 'ftp_path', 'ftp_user', 'ftp_pass'); +$var_ary = array('language', 'dbms', 'dbhost', 'dbport', 'dbuser', 'dbpasswd', 'dbname', 'table_prefix', 'admin_name', 'admin_pass1', 'admin_pass2', 'board_email1', 'board_email2', 'server_name', 'server_port', 'script_path', 'acm_type', 'img_imagick', 'ftp_path', 'ftp_user', 'ftp_pass'); foreach ($var_ary as $var) { @@ -767,6 +767,8 @@ if ($stage == 1) : + :
+ /> /> @@ -814,7 +816,7 @@ if ($stage == 2) $config_data .= "\$dbuser = '$dbuser';\n"; $config_data .= "\$dbpasswd = '$dbpasswd';\n\n"; $config_data .= "\$table_prefix = '$table_prefix';\n"; - $config_data .= "\$acm_type = 'file';\n"; + $config_data .= "\$acm_type = '" . ((!$acm_typefile) ? 'db' : '') . "';\n"; $config_data .= "\$load_extensions = '$load_extensions';\n\n"; $config_data .= "define('PHPBB_INSTALLED', true);\n"; $config_data .= "define('DEBUG', true);\n"; // Comment out when final @@ -1375,7 +1377,7 @@ function inst_language_select($default = '') function can_load_dll($dll) { global $suffix; - +return false; return ((@ini_get('enable_dl') || strtolower(@ini_get('enable_dl')) == 'on') && (!@ini_get('safe_mode') || strtolower(@ini_get('safe_mode')) == 'off') && @dl($dll . ".$suffix")) ? true : false; } diff --git a/phpBB/style.php b/phpBB/style.php index 288b7fbb75..4d3db9b8b1 100644 --- a/phpBB/style.php +++ b/phpBB/style.php @@ -49,7 +49,7 @@ if (!empty($_GET['id']) && !empty($_GET['sid'])) require($phpbb_root_path . 'includes/db/' . $dbms . '.'.$phpEx); $db = new sql_db(); - $cache = new acm($db); + $cache = new acm(); // Connect to DB if (!@$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false))