aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/acm
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2006-06-13 21:06:29 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2006-06-13 21:06:29 +0000
commit1aac08acc0df55fb5c323d91ae9c1f3d8c29535d (patch)
treefd54bd12b4deb05526fe49559cc0e6c07b497ac5 /phpBB/includes/acm
parentb0b796381741cef142d5f76c2571e081c90a1ed3 (diff)
downloadforums-1aac08acc0df55fb5c323d91ae9c1f3d8c29535d.tar
forums-1aac08acc0df55fb5c323d91ae9c1f3d8c29535d.tar.gz
forums-1aac08acc0df55fb5c323d91ae9c1f3d8c29535d.tar.bz2
forums-1aac08acc0df55fb5c323d91ae9c1f3d8c29535d.tar.xz
forums-1aac08acc0df55fb5c323d91ae9c1f3d8c29535d.zip
make sure custom profile fields are created correctly on registration (#2225)
git-svn-id: file:///svn/phpbb/trunk@6058 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/acm')
-rw-r--r--phpBB/includes/acm/acm_file.php53
-rw-r--r--phpBB/includes/acm/acm_main.php12
2 files changed, 54 insertions, 11 deletions
diff --git a/phpBB/includes/acm/acm_file.php b/phpBB/includes/acm/acm_file.php
index c5c5420c70..fadef07ac3 100644
--- a/phpBB/includes/acm/acm_file.php
+++ b/phpBB/includes/acm/acm_file.php
@@ -9,8 +9,8 @@
*/
/**
-* @package acm
* ACM File Based Caching
+* @package acm
*/
class acm
{
@@ -20,12 +20,18 @@ class acm
var $sql_rowset = array();
+ /**
+ * Set cache path
+ */
function acm()
{
global $phpbb_root_path;
$this->cache_dir = $phpbb_root_path . 'cache/';
}
+ /**
+ * Load global cache
+ */
function load()
{
global $phpEx;
@@ -41,6 +47,9 @@ class acm
return true;
}
+ /**
+ * Unload cache object
+ */
function unload()
{
$this->save();
@@ -49,6 +58,9 @@ class acm
unset($this->sql_rowset);
}
+ /**
+ * Save modified objects
+ */
function save()
{
if (!$this->is_modified)
@@ -70,6 +82,9 @@ class acm
$this->is_modified = false;
}
+ /**
+ * Tidy cache
+ */
function tidy()
{
global $phpEx;
@@ -110,6 +125,9 @@ class acm
set_config('cache_last_gc', time(), true);
}
+ /**
+ * Get saved cache object
+ */
function get($var_name)
{
if ($var_name{0} == '_')
@@ -130,6 +148,9 @@ class acm
}
}
+ /**
+ * Put data into cache
+ */
function put($var_name, $var, $ttl = 31536000)
{
if ($var_name{0} == '_')
@@ -152,6 +173,9 @@ class acm
}
}
+ /**
+ * Destroy cache data
+ */
function destroy($var_name, $table = '')
{
global $phpEx;
@@ -202,6 +226,9 @@ class acm
}
}
+ /**
+ * Check if a given cache entry exist
+ */
function _exists($var_name)
{
if ($var_name{0} == '_')
@@ -225,6 +252,9 @@ class acm
}
}
+ /**
+ * Format an array to be stored on filesystem
+ */
function format_array($array)
{
$lines = array();
@@ -232,24 +262,28 @@ class acm
{
if (is_array($v))
{
- $lines[] = "'$k'=>" . $this->format_array($v);
+ $lines[] = "\n'$k' => " . $this->format_array($v);
}
else if (is_int($v))
{
- $lines[] = "'$k'=>$v";
+ $lines[] = "\n'$k' => $v";
}
else if (is_bool($v))
{
- $lines[] = "'$k'=>" . (($v) ? 'true' : 'false');
+ $lines[] = "\n'$k' => " . (($v) ? 'true' : 'false');
}
else
{
- $lines[] = "'$k'=>'" . str_replace("'", "\\'", str_replace('\\', '\\\\', $v)) . "'";
+ $lines[] = "\n'$k' => '" . str_replace("'", "\\'", str_replace('\\', '\\\\', $v)) . "'";
}
}
+
return 'array(' . implode(',', $lines) . ')';
}
+ /**
+ * Load cached sql query
+ */
function sql_load($query)
{
global $phpEx;
@@ -278,6 +312,9 @@ class acm
return $query_id;
}
+ /**
+ * Save sql query
+ */
function sql_save($query, &$query_result, $ttl)
{
global $db, $phpEx;
@@ -309,11 +346,17 @@ class acm
}
}
+ /**
+ * Ceck if a given sql query exist in cache
+ */
function sql_exists($query_id)
{
return isset($this->sql_rowset[$query_id]);
}
+ /**
+ * Fetch row from cache (database)
+ */
function sql_fetchrow($query_id)
{
return array_shift($this->sql_rowset[$query_id]);
diff --git a/phpBB/includes/acm/acm_main.php b/phpBB/includes/acm/acm_main.php
index b4a2669a22..a3a251d194 100644
--- a/phpBB/includes/acm/acm_main.php
+++ b/phpBB/includes/acm/acm_main.php
@@ -16,8 +16,8 @@ if (!defined('IN_PHPBB'))
}
/**
-* @package acm
* Class for grabbing/handling cached entries, extends acm_file or acm_db depending on the setup
+* @package acm
*/
class cache extends acm
{
@@ -238,7 +238,7 @@ class cache extends acm
{
$allowed = ($forum_id === 0) ? false : true;
}
-
+
if ($allowed)
{
$return['_allowed_'][$extension] = 0;
@@ -282,7 +282,7 @@ class cache extends acm
WHERE bot_active = 1
ORDER BY STRLEN(bot_agent) DESC';
break;
-
+
// LENGTH supported by MySQL, IBM DB2 and Oracle for sure...
default:
$sql = 'SELECT user_id, bot_agent, bot_ip
@@ -292,7 +292,7 @@ class cache extends acm
break;
}
$result = $db->sql_query($sql);
-
+
$bots = array();
while ($row = $db->sql_fetchrow($result))
{
@@ -330,7 +330,7 @@ class cache extends acm
$reparse = false;
$filename = $phpbb_root_path . 'styles/' . $theme[$key . '_path'] . '/' . $key . '/' . $key . '.cfg';
-
+
if (!file_exists($filename))
{
continue;
@@ -340,7 +340,7 @@ class cache extends acm
{
$reparse = true;
}
-
+
// Re-parse cfg file
if ($reparse)
{