mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
- custom profile field fixed
- fixing sql_fetchfield from cache - changing the quote parser. In my tests i have not seen changed behaviour - but i might have broken something with this change. git-svn-id: file:///svn/phpbb/trunk@6232 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
650007a5f1
commit
82f42bb5fa
16 changed files with 351 additions and 298 deletions
|
@ -81,7 +81,13 @@
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
<!-- IF S_BOOL or S_DROPDOWN -->
|
<!-- IF S_BOOL or S_DROPDOWN -->
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="lang_options">{L_ENTRIES}:</label><br /><span>{L_LANG_OPTIONS_EXPLAIN}</span></dt>
|
<dt><label for="lang_options">{L_ENTRIES}:</label>
|
||||||
|
<!-- IF S_EDIT_MODE and S_DROPDOWN -->
|
||||||
|
<br /><span>{L_EDIT_DROPDOWN_LANG_EXPLAIN}</span>
|
||||||
|
<!-- ELSE -->
|
||||||
|
<br /><span>{L_LANG_OPTIONS_EXPLAIN}</span>
|
||||||
|
<!-- ENDIF -->
|
||||||
|
</dt>
|
||||||
<!-- IF S_DROPDOWN -->
|
<!-- IF S_DROPDOWN -->
|
||||||
<dd><textarea id="lang_options" name="lang_options" rows="5" cols="80">{LANG_OPTIONS}</textarea></dd>
|
<dd><textarea id="lang_options" name="lang_options" rows="5" cols="80">{LANG_OPTIONS}</textarea></dd>
|
||||||
<!-- ELSE -->
|
<!-- ELSE -->
|
||||||
|
|
|
@ -389,7 +389,7 @@ class acm
|
||||||
{
|
{
|
||||||
if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id]))
|
if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id]))
|
||||||
{
|
{
|
||||||
return $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]];
|
return (isset($this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]][$field])) ? $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]][$field] : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1082,7 +1082,7 @@ class acp_forums
|
||||||
{
|
{
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
$table_ary = array(LOG_TABLE, POSTS_TABLE, TOPICS_TABLE, DRAFTS_TABLE, TOPICS_TRACK_TABLE);
|
$table_ary = array(ACL_GROUPS_TABLE, ACL_USERS_TABLE, LOG_TABLE, POSTS_TABLE, TOPICS_TABLE, DRAFTS_TABLE, TOPICS_TRACK_TABLE);
|
||||||
|
|
||||||
foreach ($table_ary as $table)
|
foreach ($table_ary as $table)
|
||||||
{
|
{
|
||||||
|
@ -1123,6 +1123,7 @@ class acp_forums
|
||||||
|
|
||||||
$errors = array();
|
$errors = array();
|
||||||
$log_action_posts = $log_action_forums = $posts_to_name = $subforums_to_name = '';
|
$log_action_posts = $log_action_forums = $posts_to_name = $subforums_to_name = '';
|
||||||
|
$forum_ids = array($forum_id);
|
||||||
|
|
||||||
if ($action_posts == 'delete')
|
if ($action_posts == 'delete')
|
||||||
{
|
{
|
||||||
|
@ -1166,8 +1167,6 @@ class acp_forums
|
||||||
if ($action_subforums == 'delete')
|
if ($action_subforums == 'delete')
|
||||||
{
|
{
|
||||||
$log_action_forums = 'FORUMS';
|
$log_action_forums = 'FORUMS';
|
||||||
|
|
||||||
$forum_ids = array($forum_id);
|
|
||||||
$rows = get_forum_branch($forum_id, 'children', 'descending', false);
|
$rows = get_forum_branch($forum_id, 'children', 'descending', false);
|
||||||
|
|
||||||
foreach ($rows as $row)
|
foreach ($rows as $row)
|
||||||
|
@ -1259,11 +1258,6 @@ class acp_forums
|
||||||
WHERE left_id > {$forum_data['right_id']}";
|
WHERE left_id > {$forum_data['right_id']}";
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
|
|
||||||
if (!isset($forum_ids) || !is_array($forum_ids))
|
|
||||||
{
|
|
||||||
$forum_ids = array($forum_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete forum ids from extension groups table
|
// Delete forum ids from extension groups table
|
||||||
$sql = 'SELECT group_id, allowed_forums
|
$sql = 'SELECT group_id, allowed_forums
|
||||||
FROM ' . EXTENSION_GROUPS_TABLE;
|
FROM ' . EXTENSION_GROUPS_TABLE;
|
||||||
|
|
|
@ -933,280 +933,23 @@ class acp_profile
|
||||||
'field_active' => 1
|
'field_active' => 1
|
||||||
);
|
);
|
||||||
|
|
||||||
$db->sql_query('INSERT INTO ' . PROFILE_FIELDS_TABLE . ' ' . $db->sql_build_array('INSERT', $profile_fields));
|
$sql = 'INSERT INTO ' . PROFILE_FIELDS_TABLE . ' ' . $db->sql_build_array('INSERT', $profile_fields);
|
||||||
|
$db->sql_query($sql);
|
||||||
|
|
||||||
$field_id = $db->sql_nextid();
|
$field_id = $db->sql_nextid();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$db->sql_query('UPDATE ' . PROFILE_FIELDS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $profile_fields) . "
|
$sql = 'UPDATE ' . PROFILE_FIELDS_TABLE . '
|
||||||
WHERE field_id = $field_id");
|
SET ' . $db->sql_build_array('UPDATE', $profile_fields) . "
|
||||||
|
WHERE field_id = $field_id";
|
||||||
|
$db->sql_query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'create')
|
if ($action == 'create')
|
||||||
{
|
{
|
||||||
|
|
||||||
$field_ident = '_' . $field_ident;
|
$field_ident = '_' . $field_ident;
|
||||||
|
$profile_sql[] = $this->add_field_ident($field_ident, $field_type);
|
||||||
switch (SQL_LAYER)
|
|
||||||
{
|
|
||||||
case 'mysql':
|
|
||||||
case 'mysql4':
|
|
||||||
case 'mysqli':
|
|
||||||
|
|
||||||
// We are defining the biggest common value, because of the possibility to edit the min/max values of each field.
|
|
||||||
$sql = 'ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . " ADD `$field_ident` ";
|
|
||||||
switch ($field_type)
|
|
||||||
{
|
|
||||||
case FIELD_STRING:
|
|
||||||
$sql .= ' VARCHAR(255) ';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FIELD_DATE:
|
|
||||||
$sql .= 'VARCHAR(10) ';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FIELD_TEXT:
|
|
||||||
$sql .= "TEXT";
|
|
||||||
// ADD {$field_ident}_bbcode_uid VARCHAR(5) NOT NULL,
|
|
||||||
// ADD {$field_ident}_bbcode_bitfield INT(11) UNSIGNED";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FIELD_BOOL:
|
|
||||||
$sql .= 'TINYINT(2) ';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FIELD_DROPDOWN:
|
|
||||||
$sql .= 'MEDIUMINT(8) ';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FIELD_INT:
|
|
||||||
$sql .= 'BIGINT(20) ';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'sqlite':
|
|
||||||
|
|
||||||
switch ($field_type)
|
|
||||||
{
|
|
||||||
case FIELD_STRING:
|
|
||||||
$type = ' VARCHAR(255) ';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FIELD_DATE:
|
|
||||||
$type = 'VARCHAR(10) ';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FIELD_TEXT:
|
|
||||||
$type = "TEXT(65535)";
|
|
||||||
// ADD {$field_ident}_bbcode_uid VARCHAR(5) NOT NULL,
|
|
||||||
// ADD {$field_ident}_bbcode_bitfield INT(11) UNSIGNED";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FIELD_BOOL:
|
|
||||||
$type = 'TINYINT(2) ';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FIELD_DROPDOWN:
|
|
||||||
$type = 'MEDIUMINT(8) ';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FIELD_INT:
|
|
||||||
$type = 'BIGINT(20) ';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// We are defining the biggest common value, because of the possibility to edit the min/max values of each field.
|
|
||||||
if (version_compare(sqlite_libversion(), '3.0') == -1)
|
|
||||||
{
|
|
||||||
$sql = "SELECT sql
|
|
||||||
FROM sqlite_master
|
|
||||||
WHERE type = 'table'
|
|
||||||
AND name = '" . PROFILE_FIELDS_DATA_TABLE . "'
|
|
||||||
ORDER BY type DESC, name;";
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
$row = $db->sql_fetchrow($result);
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
// Create a temp table and populate it, destroy the existing one
|
|
||||||
$db->sql_query(preg_replace('#CREATE\s+TABLE\s+"?' . PROFILE_FIELDS_DATA_TABLE . '"?#i', 'CREATE TEMPORARY TABLE ' . PROFILE_FIELDS_DATA_TABLE . '_temp', $row['sql']));
|
|
||||||
$db->sql_query('INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . '_temp SELECT * FROM ' . PROFILE_FIELDS_DATA_TABLE);
|
|
||||||
$db->sql_query('DROP TABLE ' . PROFILE_FIELDS_DATA_TABLE);
|
|
||||||
|
|
||||||
preg_match('#\((.*)\)#s', $row['sql'], $matches);
|
|
||||||
|
|
||||||
$new_table_cols = trim($matches[1]);
|
|
||||||
$old_table_cols = explode(',', $new_table_cols);
|
|
||||||
$column_list = array();
|
|
||||||
foreach($old_table_cols as $declaration)
|
|
||||||
{
|
|
||||||
$entities = preg_split('#\s+#', trim($declaration));
|
|
||||||
if ($entities == 'PRIMARY')
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$column_list[] = $entities[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
$columns = implode(',', $column_list);
|
|
||||||
|
|
||||||
$new_table_cols = $field_ident . ' ' . $type . ',' . $new_table_cols;
|
|
||||||
|
|
||||||
// create a new table and fill it up. destroy the temp one
|
|
||||||
$db->sql_query('CREATE TABLE ' . PROFILE_FIELDS_DATA_TABLE . ' (' . $new_table_cols . ');');
|
|
||||||
$db->sql_query('INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . PROFILE_FIELDS_DATA_TABLE . '_temp;');
|
|
||||||
$db->sql_query('DROP TABLE ' . PROFILE_FIELDS_DATA_TABLE . '_temp');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$sql = 'ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . " ADD $field_ident [$type]";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'mssql':
|
|
||||||
case 'mssql_odbc':
|
|
||||||
|
|
||||||
// We are defining the biggest common value, because of the possibility to edit the min/max values of each field.
|
|
||||||
$sql = 'ALTER TABLE [' . PROFILE_FIELDS_DATA_TABLE . "] ADD [$field_ident] ";
|
|
||||||
|
|
||||||
switch ($field_type)
|
|
||||||
{
|
|
||||||
case FIELD_STRING:
|
|
||||||
$sql .= ' [VARCHAR] (255) ';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FIELD_DATE:
|
|
||||||
$sql .= '[VARCHAR] (10) ';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FIELD_TEXT:
|
|
||||||
$sql .= "[TEXT]";
|
|
||||||
// ADD {$field_ident}_bbcode_uid [VARCHAR] (5) NOT NULL,
|
|
||||||
// ADD {$field_ident}_bbcode_bitfield [INT] UNSIGNED";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FIELD_BOOL:
|
|
||||||
case FIELD_DROPDOWN:
|
|
||||||
$sql .= '[INT] ';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FIELD_INT:
|
|
||||||
$sql .= '[FLOAT] ';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'postgres':
|
|
||||||
|
|
||||||
// We are defining the biggest common value, because of the possibility to edit the min/max values of each field.
|
|
||||||
$sql = 'ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . " ADD COLUMN \"$field_ident\" ";
|
|
||||||
|
|
||||||
switch ($field_type)
|
|
||||||
{
|
|
||||||
case FIELD_STRING:
|
|
||||||
$sql .= ' VARCHAR(255) ';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FIELD_DATE:
|
|
||||||
$sql .= 'VARCHAR(10) ';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FIELD_TEXT:
|
|
||||||
$sql .= "TEXT";
|
|
||||||
// ADD {$field_ident}_bbcode_uid VARCHAR(5) NOT NULL,
|
|
||||||
// ADD {$field_ident}_bbcode_bitfield INT4 UNSIGNED";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FIELD_BOOL:
|
|
||||||
$sql .= 'INT2 ';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FIELD_DROPDOWN:
|
|
||||||
$sql .= 'INT4 ';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FIELD_INT:
|
|
||||||
$sql .= 'INT8 ';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'firebird':
|
|
||||||
|
|
||||||
// We are defining the biggest common value, because of the possibility to edit the min/max values of each field.
|
|
||||||
$sql = 'ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . " ADD \"$field_ident\" ";
|
|
||||||
|
|
||||||
switch ($field_type)
|
|
||||||
{
|
|
||||||
case FIELD_STRING:
|
|
||||||
$sql .= ' VARCHAR(255) ';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FIELD_DATE:
|
|
||||||
$sql .= 'VARCHAR(10) ';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FIELD_TEXT:
|
|
||||||
$sql .= "BLOB SUB_TYPE TEXT";
|
|
||||||
// ADD {$field_ident}_bbcode_uid VARCHAR(5) NOT NULL,
|
|
||||||
// ADD {$field_ident}_bbcode_bitfield INTEGER UNSIGNED";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FIELD_BOOL:
|
|
||||||
case FIELD_DROPDOWN:
|
|
||||||
$sql .= 'INTEGER ';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FIELD_INT:
|
|
||||||
$sql .= 'DOUBLE PRECISION ';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'oracle':
|
|
||||||
|
|
||||||
// We are defining the biggest common value, because of the possibility to edit the min/max values of each field.
|
|
||||||
$sql = 'ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . " ADD \"$field_ident\" ";
|
|
||||||
switch ($field_type)
|
|
||||||
{
|
|
||||||
case FIELD_STRING:
|
|
||||||
$sql .= ' VARCHAR2(255) ';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FIELD_DATE:
|
|
||||||
$sql .= 'VARCHAR2(10) ';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FIELD_TEXT:
|
|
||||||
$sql .= "CLOB";
|
|
||||||
// ADD {$field_ident}_bbcode_uid VARCHAR2(5) NOT NULL,
|
|
||||||
// ADD {$field_ident}_bbcode_bitfield NUMBER(11) UNSIGNED";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FIELD_BOOL:
|
|
||||||
$sql .= 'NUMBER(2) ';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FIELD_DROPDOWN:
|
|
||||||
$sql .= 'NUMBER(8) ';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FIELD_INT:
|
|
||||||
$sql .= 'NUMBER(20) ';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$profile_sql[] = $sql;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql_ary = array(
|
$sql_ary = array(
|
||||||
|
@ -1298,9 +1041,9 @@ class acp_profile
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->update_insert(PROFILE_FIELDS_LANG_TABLE, $sql_ary, array(
|
$this->update_insert(PROFILE_FIELDS_LANG_TABLE, $sql_ary, array(
|
||||||
'field_id' => $field_id,
|
'field_id' => $field_id,
|
||||||
'lang_id' => (int) $default_lang_id,
|
'lang_id' => (int) $default_lang_id,
|
||||||
'option_id' => (int) $option_id)
|
'option_id' => (int) $option_id)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1464,6 +1207,276 @@ class acp_profile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return sql statement for adding a new field ident (profile field) to the profile fields data table
|
||||||
|
*/
|
||||||
|
function add_field_ident($field_ident, $field_type)
|
||||||
|
{
|
||||||
|
global $db;
|
||||||
|
|
||||||
|
switch (SQL_LAYER)
|
||||||
|
{
|
||||||
|
case 'mysql':
|
||||||
|
case 'mysql4':
|
||||||
|
case 'mysqli':
|
||||||
|
|
||||||
|
// We are defining the biggest common value, because of the possibility to edit the min/max values of each field.
|
||||||
|
$sql = 'ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . " ADD `$field_ident` ";
|
||||||
|
|
||||||
|
switch ($field_type)
|
||||||
|
{
|
||||||
|
case FIELD_STRING:
|
||||||
|
$sql .= ' VARCHAR(255) ';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FIELD_DATE:
|
||||||
|
$sql .= 'VARCHAR(10) ';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FIELD_TEXT:
|
||||||
|
$sql .= "TEXT";
|
||||||
|
// ADD {$field_ident}_bbcode_uid VARCHAR(5) NOT NULL,
|
||||||
|
// ADD {$field_ident}_bbcode_bitfield INT(11) UNSIGNED";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FIELD_BOOL:
|
||||||
|
$sql .= 'TINYINT(2) ';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FIELD_DROPDOWN:
|
||||||
|
$sql .= 'MEDIUMINT(8) ';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FIELD_INT:
|
||||||
|
$sql .= 'BIGINT(20) ';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'sqlite':
|
||||||
|
|
||||||
|
switch ($field_type)
|
||||||
|
{
|
||||||
|
case FIELD_STRING:
|
||||||
|
$type = ' VARCHAR(255) ';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FIELD_DATE:
|
||||||
|
$type = 'VARCHAR(10) ';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FIELD_TEXT:
|
||||||
|
$type = "TEXT(65535)";
|
||||||
|
// ADD {$field_ident}_bbcode_uid VARCHAR(5) NOT NULL,
|
||||||
|
// ADD {$field_ident}_bbcode_bitfield INT(11) UNSIGNED";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FIELD_BOOL:
|
||||||
|
$type = 'TINYINT(2) ';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FIELD_DROPDOWN:
|
||||||
|
$type = 'MEDIUMINT(8) ';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FIELD_INT:
|
||||||
|
$type = 'BIGINT(20) ';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We are defining the biggest common value, because of the possibility to edit the min/max values of each field.
|
||||||
|
if (version_compare(sqlite_libversion(), '3.0') == -1)
|
||||||
|
{
|
||||||
|
$sql = "SELECT sql
|
||||||
|
FROM sqlite_master
|
||||||
|
WHERE type = 'table'
|
||||||
|
AND name = '" . PROFILE_FIELDS_DATA_TABLE . "'
|
||||||
|
ORDER BY type DESC, name;";
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
$row = $db->sql_fetchrow($result);
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
// Create a temp table and populate it, destroy the existing one
|
||||||
|
$db->sql_query(preg_replace('#CREATE\s+TABLE\s+"?' . PROFILE_FIELDS_DATA_TABLE . '"?#i', 'CREATE TEMPORARY TABLE ' . PROFILE_FIELDS_DATA_TABLE . '_temp', $row['sql']));
|
||||||
|
$db->sql_query('INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . '_temp SELECT * FROM ' . PROFILE_FIELDS_DATA_TABLE);
|
||||||
|
$db->sql_query('DROP TABLE ' . PROFILE_FIELDS_DATA_TABLE);
|
||||||
|
|
||||||
|
preg_match('#\((.*)\)#s', $row['sql'], $matches);
|
||||||
|
|
||||||
|
$new_table_cols = trim($matches[1]);
|
||||||
|
$old_table_cols = explode(',', $new_table_cols);
|
||||||
|
$column_list = array();
|
||||||
|
|
||||||
|
foreach ($old_table_cols as $declaration)
|
||||||
|
{
|
||||||
|
$entities = preg_split('#\s+#', trim($declaration));
|
||||||
|
if ($entities == 'PRIMARY')
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$column_list[] = $entities[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
$columns = implode(',', $column_list);
|
||||||
|
|
||||||
|
$new_table_cols = $field_ident . ' ' . $type . ',' . $new_table_cols;
|
||||||
|
|
||||||
|
// create a new table and fill it up. destroy the temp one
|
||||||
|
$db->sql_query('CREATE TABLE ' . PROFILE_FIELDS_DATA_TABLE . ' (' . $new_table_cols . ');');
|
||||||
|
$db->sql_query('INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . PROFILE_FIELDS_DATA_TABLE . '_temp;');
|
||||||
|
$db->sql_query('DROP TABLE ' . PROFILE_FIELDS_DATA_TABLE . '_temp');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sql = 'ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . " ADD $field_ident [$type]";
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'mssql':
|
||||||
|
case 'mssql_odbc':
|
||||||
|
|
||||||
|
// We are defining the biggest common value, because of the possibility to edit the min/max values of each field.
|
||||||
|
$sql = 'ALTER TABLE [' . PROFILE_FIELDS_DATA_TABLE . "] ADD [$field_ident] ";
|
||||||
|
|
||||||
|
switch ($field_type)
|
||||||
|
{
|
||||||
|
case FIELD_STRING:
|
||||||
|
$sql .= ' [VARCHAR] (255) ';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FIELD_DATE:
|
||||||
|
$sql .= '[VARCHAR] (10) ';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FIELD_TEXT:
|
||||||
|
$sql .= "[TEXT]";
|
||||||
|
// ADD {$field_ident}_bbcode_uid [VARCHAR] (5) NOT NULL,
|
||||||
|
// ADD {$field_ident}_bbcode_bitfield [INT] UNSIGNED";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FIELD_BOOL:
|
||||||
|
case FIELD_DROPDOWN:
|
||||||
|
$sql .= '[INT] ';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FIELD_INT:
|
||||||
|
$sql .= '[FLOAT] ';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'postgres':
|
||||||
|
|
||||||
|
// We are defining the biggest common value, because of the possibility to edit the min/max values of each field.
|
||||||
|
$sql = 'ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . " ADD COLUMN \"$field_ident\" ";
|
||||||
|
|
||||||
|
switch ($field_type)
|
||||||
|
{
|
||||||
|
case FIELD_STRING:
|
||||||
|
$sql .= ' VARCHAR(255) ';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FIELD_DATE:
|
||||||
|
$sql .= 'VARCHAR(10) ';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FIELD_TEXT:
|
||||||
|
$sql .= "TEXT";
|
||||||
|
// ADD {$field_ident}_bbcode_uid VARCHAR(5) NOT NULL,
|
||||||
|
// ADD {$field_ident}_bbcode_bitfield INT4 UNSIGNED";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FIELD_BOOL:
|
||||||
|
$sql .= 'INT2 ';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FIELD_DROPDOWN:
|
||||||
|
$sql .= 'INT4 ';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FIELD_INT:
|
||||||
|
$sql .= 'INT8 ';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'firebird':
|
||||||
|
|
||||||
|
// We are defining the biggest common value, because of the possibility to edit the min/max values of each field.
|
||||||
|
$sql = 'ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . " ADD \"$field_ident\" ";
|
||||||
|
|
||||||
|
switch ($field_type)
|
||||||
|
{
|
||||||
|
case FIELD_STRING:
|
||||||
|
$sql .= ' VARCHAR(255) ';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FIELD_DATE:
|
||||||
|
$sql .= 'VARCHAR(10) ';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FIELD_TEXT:
|
||||||
|
$sql .= "BLOB SUB_TYPE TEXT";
|
||||||
|
// ADD {$field_ident}_bbcode_uid VARCHAR(5) NOT NULL,
|
||||||
|
// ADD {$field_ident}_bbcode_bitfield INTEGER UNSIGNED";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FIELD_BOOL:
|
||||||
|
case FIELD_DROPDOWN:
|
||||||
|
$sql .= 'INTEGER ';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FIELD_INT:
|
||||||
|
$sql .= 'DOUBLE PRECISION ';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'oracle':
|
||||||
|
|
||||||
|
// We are defining the biggest common value, because of the possibility to edit the min/max values of each field.
|
||||||
|
$sql = 'ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . " ADD \"$field_ident\" ";
|
||||||
|
|
||||||
|
switch ($field_type)
|
||||||
|
{
|
||||||
|
case FIELD_STRING:
|
||||||
|
$sql .= ' VARCHAR2(255) ';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FIELD_DATE:
|
||||||
|
$sql .= 'VARCHAR2(10) ';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FIELD_TEXT:
|
||||||
|
$sql .= "CLOB";
|
||||||
|
// ADD {$field_ident}_bbcode_uid VARCHAR2(5) NOT NULL,
|
||||||
|
// ADD {$field_ident}_bbcode_bitfield NUMBER(11) UNSIGNED";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FIELD_BOOL:
|
||||||
|
$sql .= 'NUMBER(2) ';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FIELD_DROPDOWN:
|
||||||
|
$sql .= 'NUMBER(8) ';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FIELD_INT:
|
||||||
|
$sql .= 'NUMBER(20) ';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $sql;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -618,8 +618,8 @@ class acp_users
|
||||||
|
|
||||||
// Validation data
|
// Validation data
|
||||||
$var_ary = array(
|
$var_ary = array(
|
||||||
'password_confirm' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']),
|
|
||||||
'user_password' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']),
|
'user_password' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']),
|
||||||
|
'password_confirm' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']),
|
||||||
'warnings' => array('num'),
|
'warnings' => array('num'),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -361,7 +361,7 @@ class dbal
|
||||||
// This could happen if the connection could not be established for example (then we are not able to grab the default language)
|
// This could happen if the connection could not be established for example (then we are not able to grab the default language)
|
||||||
if (!isset($user->lang['SQL_ERROR_OCCURRED']))
|
if (!isset($user->lang['SQL_ERROR_OCCURRED']))
|
||||||
{
|
{
|
||||||
$message .= '<br /><br />An sql error occurred while fetching this page. Please contact an administrator if this problem persist.';
|
$message .= '<br /><br />An sql error occurred while fetching this page. Please contact an administrator if this problem persists.';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -582,6 +582,12 @@ function create_thumbnail($source, $destination, $mimetype)
|
||||||
imagecopyresampled($new_image, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
|
imagecopyresampled($new_image, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we are in safe mode create the destination file prior to using the gd functions to circumvent a PHP bug
|
||||||
|
if (@ini_get('safe_mode') || @strtolower(ini_get('safe_mode')) == 'on')
|
||||||
|
{
|
||||||
|
@touch($destination);
|
||||||
|
}
|
||||||
|
|
||||||
switch ($type['format'])
|
switch ($type['format'])
|
||||||
{
|
{
|
||||||
case IMG_GIF:
|
case IMG_GIF:
|
||||||
|
|
|
@ -262,7 +262,7 @@ function check_rule(&$rules, &$rule_row, &$message_row, $user_id)
|
||||||
// Replace Rule Literals
|
// Replace Rule Literals
|
||||||
$evaluate = preg_replace('/{(STRING|USER_ID|GROUP_ID)}/', '$rule_row["rule_" . strtolower("\1")]', $evaluate);
|
$evaluate = preg_replace('/{(STRING|USER_ID|GROUP_ID)}/', '$rule_row["rule_" . strtolower("\1")]', $evaluate);
|
||||||
|
|
||||||
// Eval Statement
|
// Evil Statement
|
||||||
$result = false;
|
$result = false;
|
||||||
eval('$result = (' . $evaluate . ') ? true : false;');
|
eval('$result = (' . $evaluate . ') ? true : false;');
|
||||||
|
|
||||||
|
@ -447,8 +447,10 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false)
|
||||||
switch ($rule_ary['action'])
|
switch ($rule_ary['action'])
|
||||||
{
|
{
|
||||||
case ACTION_PLACE_INTO_FOLDER:
|
case ACTION_PLACE_INTO_FOLDER:
|
||||||
|
// Folder actions have precedence, so we will remove any other ones
|
||||||
$folder_action = true;
|
$folder_action = true;
|
||||||
$_folder_id = (int) $rule_ary['folder_id'];
|
$_folder_id = (int) $rule_ary['folder_id'];
|
||||||
|
$move_into_folder = array();
|
||||||
$move_into_folder[$_folder_id][] = $msg_id;
|
$move_into_folder[$_folder_id][] = $msg_id;
|
||||||
$num_new++;
|
$num_new++;
|
||||||
break;
|
break;
|
||||||
|
@ -458,7 +460,11 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false)
|
||||||
{
|
{
|
||||||
$unread_ids[] = $msg_id;
|
$unread_ids[] = $msg_id;
|
||||||
}
|
}
|
||||||
$move_into_folder[PRIVMSGS_INBOX][] = $msg_id;
|
|
||||||
|
if (!$folder_action)
|
||||||
|
{
|
||||||
|
$move_into_folder[PRIVMSGS_INBOX][] = $msg_id;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACTION_DELETE_MESSAGE:
|
case ACTION_DELETE_MESSAGE:
|
||||||
|
@ -470,7 +476,11 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false)
|
||||||
{
|
{
|
||||||
$important_ids[] = $msg_id;
|
$important_ids[] = $msg_id;
|
||||||
}
|
}
|
||||||
$move_into_folder[PRIVMSGS_INBOX][] = $msg_id;
|
|
||||||
|
if (!$folder_action)
|
||||||
|
{
|
||||||
|
$move_into_folder[PRIVMSGS_INBOX][] = $msg_id;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -494,7 +494,15 @@ class custom_profile
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->options_lang[$field_id][$lang_id][(int) $value];
|
$value = (int) $value;
|
||||||
|
|
||||||
|
// User not having a value assigned
|
||||||
|
if (!isset($this->options_lang[$field_id][$lang_id][$value]))
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->options_lang[$field_id][$lang_id][$value];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'bool':
|
case 'bool':
|
||||||
|
|
|
@ -692,7 +692,8 @@ class bbcode_firstpass extends bbcode
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$out .= $buffer . $tok;
|
$out .= $buffer . $tok;
|
||||||
$tok = ($tok == '[') ? ']' : '[]';
|
// $tok = ($tok == '[') ? ']' : '[]';
|
||||||
|
$tok = '[]';
|
||||||
$buffer = '';
|
$buffer = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,8 +51,8 @@ class ucp_profile
|
||||||
|
|
||||||
// Do not check cur_password, it is the old one.
|
// Do not check cur_password, it is the old one.
|
||||||
$var_ary = array(
|
$var_ary = array(
|
||||||
'password_confirm' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']),
|
|
||||||
'new_password' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']),
|
'new_password' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']),
|
||||||
|
'password_confirm' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']),
|
||||||
'email' => array(
|
'email' => array(
|
||||||
array('string', false, 6, 60),
|
array('string', false, 6, 60),
|
||||||
array('email', $data['email'])),
|
array('email', $data['email'])),
|
||||||
|
|
|
@ -117,8 +117,8 @@ class ucp_register
|
||||||
'username' => array(
|
'username' => array(
|
||||||
array('string', false, $config['min_name_chars'], $config['max_name_chars']),
|
array('string', false, $config['min_name_chars'], $config['max_name_chars']),
|
||||||
array('username')),
|
array('username')),
|
||||||
'password_confirm' => array('string', false, $config['min_pass_chars'], $config['max_pass_chars']),
|
|
||||||
'new_password' => array('string', false, $config['min_pass_chars'], $config['max_pass_chars']),
|
'new_password' => array('string', false, $config['min_pass_chars'], $config['max_pass_chars']),
|
||||||
|
'password_confirm' => array('string', false, $config['min_pass_chars'], $config['max_pass_chars']),
|
||||||
'email' => array(
|
'email' => array(
|
||||||
array('string', false, 6, 60),
|
array('string', false, 6, 60),
|
||||||
array('email')),
|
array('email')),
|
||||||
|
|
|
@ -61,10 +61,11 @@ $lang = array_merge($lang, array(
|
||||||
'DISPLAY_PROFILE_FIELD_EXPLAIN' => 'The profile field will be shown on viewtopic/viewprofile/memberlist/etc.',
|
'DISPLAY_PROFILE_FIELD_EXPLAIN' => 'The profile field will be shown on viewtopic/viewprofile/memberlist/etc.',
|
||||||
'DROPDOWN_ENTRIES_EXPLAIN' => 'Enter your options now, every option in one line',
|
'DROPDOWN_ENTRIES_EXPLAIN' => 'Enter your options now, every option in one line',
|
||||||
|
|
||||||
'EMPTY_FIELD_IDENT' => 'Empty field identification',
|
'EDIT_DROPDOWN_LANG_EXPLAIN' => 'Please note that you are able to change your options text and also able to add new options to the end. It is not advised to add new options between existing options - this could result in wrong options assigned to your users. This can also happen if you remove options in-between. Removing options from the end result in users having assigned this item now reverting back to the default one.',
|
||||||
'EMPTY_USER_FIELD_NAME' => 'Please enter a field name/title',
|
'EMPTY_FIELD_IDENT' => 'Empty field identification',
|
||||||
'ENTRIES' => 'Entries',
|
'EMPTY_USER_FIELD_NAME' => 'Please enter a field name/title',
|
||||||
'EVERYTHING_OK' => 'Everything OK',
|
'ENTRIES' => 'Entries',
|
||||||
|
'EVERYTHING_OK' => 'Everything OK',
|
||||||
|
|
||||||
'FIELD_BOOL' => 'Boolean (Yes/No)',
|
'FIELD_BOOL' => 'Boolean (Yes/No)',
|
||||||
'FIELD_DATE' => 'Date',
|
'FIELD_DATE' => 'Date',
|
||||||
|
|
|
@ -450,7 +450,7 @@ $lang = array_merge($lang, array(
|
||||||
'SORT_TOPIC_TITLE' => 'Topic title',
|
'SORT_TOPIC_TITLE' => 'Topic title',
|
||||||
'SORT_USERNAME' => 'Username',
|
'SORT_USERNAME' => 'Username',
|
||||||
'SPLIT_TOPIC' => 'Split topic',
|
'SPLIT_TOPIC' => 'Split topic',
|
||||||
'SQL_ERROR_OCCURRED' => 'An SQL error occurred while fetching this page. Please contact the %sBoard Administrator%s if this problem persist.',
|
'SQL_ERROR_OCCURRED' => 'An SQL error occurred while fetching this page. Please contact the %sBoard Administrator%s if this problem persists.',
|
||||||
'STATISTICS' => 'Statistics',
|
'STATISTICS' => 'Statistics',
|
||||||
'START_WATCHING_FORUM' => 'Subscribe forum',
|
'START_WATCHING_FORUM' => 'Subscribe forum',
|
||||||
'START_WATCHING_TOPIC' => 'Subscribe topic',
|
'START_WATCHING_TOPIC' => 'Subscribe topic',
|
||||||
|
|
|
@ -231,7 +231,7 @@ $lang = array_merge($lang, array(
|
||||||
'MESSAGE_DELETED' => 'Message successfully deleted',
|
'MESSAGE_DELETED' => 'Message successfully deleted',
|
||||||
'MESSAGE_HISTORY' => 'Message history',
|
'MESSAGE_HISTORY' => 'Message history',
|
||||||
'MESSAGE_REMOVED_FROM_OUTBOX' => 'This message has been removed by it\'s author before it was delivered',
|
'MESSAGE_REMOVED_FROM_OUTBOX' => 'This message has been removed by it\'s author before it was delivered',
|
||||||
'MESSAGE_STORED' => 'The message has been send successfully',
|
'MESSAGE_STORED' => 'Your message has been sent successfully',
|
||||||
'MESSAGES_DELETED' => 'Messages successfully deleted',
|
'MESSAGES_DELETED' => 'Messages successfully deleted',
|
||||||
'MOVE_DELETED_MESSAGES_TO' => 'Move messages from removed folder to',
|
'MOVE_DELETED_MESSAGES_TO' => 'Move messages from removed folder to',
|
||||||
'MOVE_DOWN' => 'Move down',
|
'MOVE_DOWN' => 'Move down',
|
||||||
|
|
|
@ -25,6 +25,7 @@ $user->setup(array('memberlist', 'groups'));
|
||||||
$mode = request_var('mode', '');
|
$mode = request_var('mode', '');
|
||||||
$action = request_var('action', '');
|
$action = request_var('action', '');
|
||||||
$user_id = request_var('u', ANONYMOUS);
|
$user_id = request_var('u', ANONYMOUS);
|
||||||
|
$username = request_var('un', '');
|
||||||
$group_id = request_var('g', 0);
|
$group_id = request_var('g', 0);
|
||||||
$topic_id = request_var('t', 0);
|
$topic_id = request_var('t', 0);
|
||||||
|
|
||||||
|
@ -321,16 +322,27 @@ switch ($mode)
|
||||||
|
|
||||||
case 'viewprofile':
|
case 'viewprofile':
|
||||||
// Display a profile
|
// Display a profile
|
||||||
if ($user_id == ANONYMOUS)
|
if ($user_id == ANONYMOUS && !$username)
|
||||||
{
|
{
|
||||||
trigger_error('NO_USER');
|
trigger_error('NO_USER');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get user...
|
// Get user...
|
||||||
$sql = 'SELECT *
|
if ($username)
|
||||||
FROM ' . USERS_TABLE . "
|
{
|
||||||
WHERE user_id = $user_id
|
$sql = 'SELECT *
|
||||||
AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
|
FROM ' . USERS_TABLE . "
|
||||||
|
WHERE LOWER(username) = '" . strtolower($db->sql_escape($username)) . "'
|
||||||
|
AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sql = 'SELECT *
|
||||||
|
FROM ' . USERS_TABLE . "
|
||||||
|
WHERE user_id = $user_id
|
||||||
|
AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
|
||||||
|
}
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
$member = $db->sql_fetchrow($result);
|
$member = $db->sql_fetchrow($result);
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
@ -340,6 +352,8 @@ switch ($mode)
|
||||||
trigger_error('NO_USER');
|
trigger_error('NO_USER');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$user_id = (int) $member['user_id'];
|
||||||
|
|
||||||
// Do the SQL thang
|
// Do the SQL thang
|
||||||
$sql = 'SELECT g.group_id, g.group_name, g.group_type
|
$sql = 'SELECT g.group_id, g.group_name, g.group_type
|
||||||
FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . " ug
|
FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . " ug
|
||||||
|
|
Loading…
Add table
Reference in a new issue