[Customisation Database Commits] r212 - in /trunk/titania: includes/core/ includes/objects/ install/ language/en/ modules/authors/ modules/mods/ theme/images/
Nathan Guse
exreaction at phpbb.com
Fri Jun 12 03:52:16 UTC 2009
Author: exreaction
Date: Fri Jun 12 03:52:15 2009
New Revision: 212
Log:
Some work on the author's page, ratings, and other stuff.
If anybody is keeping up-to-date make sure to uninstall/reinstall the database section again.
Added:
trunk/titania/theme/images/star_green.gif (with props)
trunk/titania/theme/images/star_grey.gif (with props)
trunk/titania/theme/images/star_orange.gif (with props)
trunk/titania/theme/images/star_red.gif (with props)
trunk/titania/theme/images/star_remove.gif (with props)
Modified:
trunk/titania/includes/core/titania.php
trunk/titania/includes/objects/author.php
trunk/titania/includes/objects/contribution.php
trunk/titania/includes/objects/faq.php
trunk/titania/includes/objects/rating.php
trunk/titania/install/index.php
trunk/titania/language/en/authors.php
trunk/titania/language/en/common.php
trunk/titania/modules/authors/authors_main.php
trunk/titania/modules/mods/mods_details.php
trunk/titania/modules/mods/mods_main.php
Modified: trunk/titania/includes/core/titania.php
==============================================================================
*** trunk/titania/includes/core/titania.php (original)
--- trunk/titania/includes/core/titania.php Fri Jun 12 03:52:15 2009
***************
*** 120,125 ****
--- 120,147 ----
}
/**
+ * Load a Titania Object
+ *
+ * @param mixed $object_name The name of the object
+ */
+ public static function load_object($object_name)
+ {
+ $object_name = preg_replace('#(^A-Za-z0-9)#', '', $object_name);
+
+ if (class_exists($object_name))
+ {
+ return;
+ }
+
+ if (!file_exists(TITANIA_ROOT . 'includes/objects/' . $object_name . '.' . PHP_EXT))
+ {
+ trigger_error('Missing Object: ' . $object_name);
+ }
+
+ include(TITANIA_ROOT . 'includes/objects/' . $object_name . '.' . PHP_EXT);
+ }
+
+ /**
* Add a phpBB language file
*
* @param mixed $lang_set
Modified: trunk/titania/includes/objects/author.php
==============================================================================
*** trunk/titania/includes/objects/author.php (original)
--- trunk/titania/includes/objects/author.php Fri Jun 12 03:52:15 2009
***************
*** 39,65 ****
*
* @var string
*/
! protected $sql_id_field = 'author_id';
/**
* Constructor class for titania authors
*
* @param int $author_id
*/
! public function __construct($author_id = false)
{
// Configure object properties
$this->object_config = array_merge($this->object_config, array(
- 'author_id' => array('default' => 0),
'user_id' => array('default' => 0),
'phpbb_user_id' => array('default' => 0),
- 'author_username' => array('default' => '', 'max' => 255),
- 'author_username_clean' => array('default' => '', 'max' => 255, 'readonly' => true),
'author_realname' => array('default' => '', 'max' => 255),
'author_website' => array('default' => '', 'max' => 200),
- 'author_email' => array('default' => '', 'multibyte' => false),
- 'author_email_hash' => array('default' => 0, 'readonly' => true),
'author_rating' => array('default' => 0.0),
'author_rating_count' => array('default' => 0),
--- 39,60 ----
*
* @var string
*/
! protected $sql_id_field = 'user_id';
/**
* Constructor class for titania authors
*
* @param int $author_id
*/
! public function __construct($user_id = false)
{
// Configure object properties
$this->object_config = array_merge($this->object_config, array(
'user_id' => array('default' => 0),
'phpbb_user_id' => array('default' => 0),
'author_realname' => array('default' => '', 'max' => 255),
'author_website' => array('default' => '', 'max' => 200),
'author_rating' => array('default' => 0.0),
'author_rating_count' => array('default' => 0),
***************
*** 70,103 ****
'author_visible' => array('default' => AUTHOR_VISIBLE),
));
! if ($author_id !== false)
{
! $this->author_id = $author_id;
}
}
/**
! * Special setter methods overwriting the default magic methods.
! *
! * @param string $value
! */
! public function set_author_username($value)
{
! $this->author_username = $value;
! $this->author_username_clean = utf8_clean_string($value);
}
/**
! * set author e-mail
! *
! * @param string $value
! */
! public function set_author_email($value)
{
! $lower = strtolower($value);
!
! $this->author_email = $lower;
! $this->author_email_hash = crc32($lower) . strlen($lower);
}
/**
--- 65,132 ----
'author_visible' => array('default' => AUTHOR_VISIBLE),
));
! if ($user_id !== false)
{
! $this->user_id = (int) $user_id;
}
}
/**
! * Load Author
! */
! public function load($user_id = false)
{
! if ($user_id !== false)
! {
! $this->user_id = (int) $user_id;
! }
!
! $sql_ary = array(
! 'SELECT' => 'a.*, u.*', // Don't change to *!
! 'FROM' => array(
! USERS_TABLE => 'u',
! ),
! 'LEFT_JOIN' => array(
! array(
! 'FROM' => array(TITANIA_AUTHORS_TABLE => 'a'),
! 'ON' => 'a.user_id = u.user_id'
! ),
! ),
! 'WHERE' => 'u.user_id = ' . $this->user_id
! );
!
! $sql = phpbb::$db->sql_build_query('SELECT', $sql_ary);
!
! $result = phpbb::$db->sql_query($sql);
!
! if(!($this->sql_data = phpbb::$db->sql_fetchrow($result)))
! {
! return false;
! }
!
! // The result could return with info only in the user's table (if no mods/styles have been submitted), so we need to fill these in if that is the case.
! foreach ($this->object_config as $name => $data)
! {
! if (!isset($this->sql_data[$name]))
! {
! $this->sql_data[$name] = $data['default'];
! }
! }
!
! foreach ($this->sql_data as $key => $value)
! {
! $this->$key = $value;
! }
!
! return true;
}
/**
! * Get profile data
! */
! public function get_profile_data()
{
! return $this->sql_data;
}
/**
***************
*** 107,115 ****
*/
public function get_profile_url()
{
! if ($this->author_id)
{
! return append_sid(TITANIA_ROOT . 'authors/index.' . PHP_EXT, 'a=' . $this->author_id);
}
return '';
--- 136,144 ----
*/
public function get_profile_url()
{
! if ($this->user_id)
{
! return append_sid(TITANIA_ROOT . 'authors/index.' . PHP_EXT, 'u=' . $this->user_id);
}
return '';
Modified: trunk/titania/includes/objects/contribution.php
==============================================================================
*** trunk/titania/includes/objects/contribution.php (original)
--- trunk/titania/includes/objects/contribution.php Fri Jun 12 03:52:15 2009
***************
*** 87,93 ****
'contrib_revision' => array('default' => 0),
'contrib_validated_revision' => array('default' => 0),
! 'contrib_author_id' => array('default' => 0),
'contrib_maintainer' => array('default' => 0),
'contrib_downloads' => array('default' => 0),
--- 87,93 ----
'contrib_revision' => array('default' => 0),
'contrib_validated_revision' => array('default' => 0),
! 'contrib_user_id' => array('default' => 0),
'contrib_maintainer' => array('default' => 0),
'contrib_downloads' => array('default' => 0),
***************
*** 146,151 ****
--- 146,160 ----
}
/**
+ * Get contrib data
+ */
+ public function get_data()
+ {
+ return $this->sql_data;
+ }
+
+
+ /**
* Generate text for storing description into the database
*
* @param bool $allow_bbcode
***************
*** 203,209 ****
require TITANIA_ROOT . 'includes/objects/author.' . PHP_EXT;
}
! $author = new titania_author($this->contrib_author_id);
$author->load();
return $author;
--- 212,218 ----
require TITANIA_ROOT . 'includes/objects/author.' . PHP_EXT;
}
! $author = new titania_author($this->contrib_user_id);
$author->load();
return $author;
Modified: trunk/titania/includes/objects/faq.php
==============================================================================
*** trunk/titania/includes/objects/faq.php (original)
--- trunk/titania/includes/objects/faq.php Fri Jun 12 03:52:15 2009
***************
*** 358,364 ****
global $template, $db, $user, $titania, $auth;
$sql_ary = array(
! 'SELECT' => 'f.*, r.revision_name, r.revision_time, c.contrib_author_id',
'FROM' => array(
TITANIA_CONTRIB_FAQ_TABLE => 'f',
TITANIA_CONTRIBS_TABLE => 'c'
--- 358,364 ----
global $template, $db, $user, $titania, $auth;
$sql_ary = array(
! 'SELECT' => 'f.*, r.revision_name, r.revision_time, c.contrib_user_id',
'FROM' => array(
TITANIA_CONTRIB_FAQ_TABLE => 'f',
TITANIA_CONTRIBS_TABLE => 'c'
***************
*** 390,396 ****
'REVISION_NAME' => $row['revision_name'],
'U_FAQ_LIST' => append_sid($titania->page, 'id=faq&mode=view&' . $this->contrib_identifier . '=' . $row['contrib_id']),
! 'U_EDIT_FAQ' => ($user->data['user_id'] == $row['contrib_author_id'] || $auth->acl_get('a_') || $auth->acl_get('m_')) ? append_sid($titania->page, 'id=faq&mode=view&action=edit&' . $this->contrib_identifier . '=' . $row['contrib_id'] . '&faq=' . $row['faq_id']) : false,
'L_REVISION' => $user->lang[strtoupper($this->contrib_identifier) . '_VERSION'],
));
--- 390,396 ----
'REVISION_NAME' => $row['revision_name'],
'U_FAQ_LIST' => append_sid($titania->page, 'id=faq&mode=view&' . $this->contrib_identifier . '=' . $row['contrib_id']),
! 'U_EDIT_FAQ' => ($user->data['user_id'] == $row['contrib_user_id'] || $auth->acl_get('a_') || $auth->acl_get('m_')) ? append_sid($titania->page, 'id=faq&mode=view&action=edit&' . $this->contrib_identifier . '=' . $row['contrib_id'] . '&faq=' . $row['faq_id']) : false,
'L_REVISION' => $user->lang[strtoupper($this->contrib_identifier) . '_VERSION'],
));
***************
*** 482,488 ****
$pagination->build_pagination(append_sid($titania->page, 'id=faq&mode=view&' . $this->contrib_identifier . '=' . $contrib_id));
// informations about contrib
! $sql = 'SELECT contrib_name, contrib_version, contrib_author_id
FROM ' . TITANIA_CONTRIBS_TABLE . '
WHERE contrib_id = ' . $contrib_id;
$result = $db->sql_query($sql);
--- 482,488 ----
$pagination->build_pagination(append_sid($titania->page, 'id=faq&mode=view&' . $this->contrib_identifier . '=' . $contrib_id));
// informations about contrib
! $sql = 'SELECT contrib_name, contrib_version, contrib_user_id
FROM ' . TITANIA_CONTRIBS_TABLE . '
WHERE contrib_id = ' . $contrib_id;
$result = $db->sql_query($sql);
***************
*** 496,502 ****
'CONTRIB_NAME' => $contrib['contrib_name'],
'CONTRIB_VERSION' => $contrib['contrib_version'],
! 'U_CREATE_FAQ' => ($user->data['user_id'] == $contrib['contrib_author_id'] || $auth->acl_get('a_') || $auth->acl_get('m_')) ? append_sid($titania->page, 'id=faq&mode=view&action=create&' . $this->contrib_identifier . '=' . $contrib_id) : false,
'L_CONTRIB_VERSION' => $user->lang[strtoupper($this->contrib_identifier) . '_VERSION'],
));
--- 496,502 ----
'CONTRIB_NAME' => $contrib['contrib_name'],
'CONTRIB_VERSION' => $contrib['contrib_version'],
! 'U_CREATE_FAQ' => ($user->data['user_id'] == $contrib['contrib_user_id'] || $auth->acl_get('a_') || $auth->acl_get('m_')) ? append_sid($titania->page, 'id=faq&mode=view&action=create&' . $this->contrib_identifier . '=' . $contrib_id) : false,
'L_CONTRIB_VERSION' => $user->lang[strtoupper($this->contrib_identifier) . '_VERSION'],
));
Modified: trunk/titania/includes/objects/rating.php
==============================================================================
*** trunk/titania/includes/objects/rating.php (original)
--- trunk/titania/includes/objects/rating.php Fri Jun 12 03:52:15 2009
***************
*** 75,81 ****
/**
* Object column
! * The rating item primary key field (ex: author_id for rating authors)
*
* @var string
*/
--- 75,81 ----
/**
* Object column
! * The rating item primary key field (ex: user_id for rating authors)
*
* @var string
*/
***************
*** 83,89 ****
/**
* Object ID
! * The rating item ID (ex: author_id for rating authors)
*
* @var int
*/
--- 83,89 ----
/**
* Object ID
! * The rating item ID (ex: user_id for rating authors)
*
* @var int
*/
***************
*** 129,135 ****
$this->cache_table = TITANIA_AUTHORS_TABLE;
$this->cache_rating = 'author_rating';
$this->cache_rating_count = 'author_rating_count';
! $this->object_column = 'author_id';
break;
case 'contrib' :
--- 129,135 ----
$this->cache_table = TITANIA_AUTHORS_TABLE;
$this->cache_rating = 'author_rating';
$this->cache_rating_count = 'author_rating_count';
! $this->object_column = 'user_id';
break;
case 'contrib' :
***************
*** 161,174 ****
}
$sql = 'SELECT * FROM ' . $this->sql_table . '
! WHERE rating_type_id = ' . (int) $this->rating_type . '
AND rating_user_id = ' . (int) phpbb::$user->data['user_id'] . '
AND rating_object_id = ' . (int) $this->object_id;
$result = phpbb::$db->sql_query($sql);
$this->sql_data = phpbb::$db->sql_fetchrow($result);
phpbb::$db->sql_freeresult($result);
! if ($row)
{
foreach ($this->sql_data as $key => $value)
{
--- 161,174 ----
}
$sql = 'SELECT * FROM ' . $this->sql_table . '
! WHERE rating_type_id = ' . (int) $this->rating_type_id . '
AND rating_user_id = ' . (int) phpbb::$user->data['user_id'] . '
AND rating_object_id = ' . (int) $this->object_id;
$result = phpbb::$db->sql_query($sql);
$this->sql_data = phpbb::$db->sql_fetchrow($result);
phpbb::$db->sql_freeresult($result);
! if ($this->sql_data)
{
foreach ($this->sql_data as $key => $value)
{
***************
*** 184,189 ****
--- 184,233 ----
*/
public function get_rating_string()
{
+ $can_rate = (phpbb::$user->data['is_registered'] && phpbb::$auth->acl_get('titania_rate') && !$this->rating_id) ? true : false;
+ $rate_url = append_sid(TITANIA_ROOT . 'rate.' . PHP_EXT, 'id=' . $this->object_id);
+
+ // If it has not had any ratings yet, give it 1/2 the max for the rating
+ if ($this->rating_count == 0)
+ {
+ $this->rating = round(titania::$config->max_rating / 2, 1);
+ }
+
+ // Go through and build the rating string
+ $final_code = '<span id="rating_' . $this->object_id . '">';
+ for ($i = 1; $i <= titania::$config->max_rating; $i++)
+ {
+ // Title will be $i/max if they've not rated it, rating/max if they have
+ $title = ((!$this->rating) ? $i : $this->rating) . '/' . titania::$config->max_rating;
+
+ $final_code .= ($can_rate) ? '<a href="' . $rate_url . '&value=' . $i . '">' : '';
+ $final_code .= '<img id="' . $this->object_id . '_' . $i . '" ';
+ if ($this->rating_id && $i <= $this->rating) // If they have rated, show their own rating in green stars
+ {
+ $final_code .= 'src="' . titania::$config->theme_path . '/images/star_green.gif" ';
+ }
+ else if (!$this->rating_id && $i <= round($this->rating)) // Round because we only have full stars ATM, orange stars for the average rating (if the user has not rated)
+ {
+ $final_code .= 'src="' . titania::$config->theme_path . '/images/star_orange.gif" ';
+ }
+ else // show the rest in grey stars
+ {
+ $final_code .= 'src="' . titania::$config->theme_path . '/images/star_grey.gif" ';
+ }
+ $final_code .= ($can_rate) ? "onmouseover=\"ratingHover('{$i}', '{$this->object_id}')\" onmouseout=\"ratingUnHover('{$this->rating}', '{$this->object_id}')\" onmousedown=\"ratingDown('{$i}', '{$this->object_id}')\"" : '';
+ $final_code .= ' alt="' . $title . '" title="' . $title . '" />';
+ $final_code .= ($can_rate) ? '</a>' : '';
+ }
+
+ // If they have rated already we will add the remove rating icon at the end
+ if ($this->rating_id)
+ {
+ $final_code .= ' <a href="' . $rate_url . '&value=remove"><img id="' . $this->object_id . '_remove" src="' . titania::$config->theme_path . '/images/star_remove.gif" alt="' . phpbb::$user->lang['REMOVE_RATING'] . '" title="' . phpbb::$user->lang['REMOVE_RATING'] . '" /></a>';
+ }
+
+ $final_code .= '</span>';
+
+ return $final_code;
}
/**
***************
*** 210,216 ****
// Resync the cache table
$cnt = $total = 0;
$sql = 'SELECT rating_value FROM ' . $this->sql_table . '
! WHERE rating_type_id = ' . (int) $this->rating_type . '
AND rating_object_id = ' . (int) $this->object_id;
$result = phpbb::$db->sql_query($sql);
while ($row = phpbb::$db->sql_fetchrow($result))
--- 254,260 ----
// Resync the cache table
$cnt = $total = 0;
$sql = 'SELECT rating_value FROM ' . $this->sql_table . '
! WHERE rating_type_id = ' . (int) $this->rating_type_id . '
AND rating_object_id = ' . (int) $this->object_id;
$result = phpbb::$db->sql_query($sql);
while ($row = phpbb::$db->sql_fetchrow($result))
***************
*** 242,248 ****
// Resync the cache table
$cnt = $total = 0;
$sql = 'SELECT rating_value FROM ' . $this->sql_table . '
! WHERE rating_type_id = ' . (int) $this->rating_type . '
AND rating_object_id = ' . (int) $this->object_id;
$result = phpbb::$db->sql_query($sql);
while ($row = phpbb::$db->sql_fetchrow($result))
--- 286,292 ----
// Resync the cache table
$cnt = $total = 0;
$sql = 'SELECT rating_value FROM ' . $this->sql_table . '
! WHERE rating_type_id = ' . (int) $this->rating_type_id . '
AND rating_object_id = ' . (int) $this->object_id;
$result = phpbb::$db->sql_query($sql);
while ($row = phpbb::$db->sql_fetchrow($result))
***************
*** 270,276 ****
}
$sql = 'DELETE FROM ' . $this->sql_table . '
! WHERE rating_type_id = ' . (int) $this->rating_type . '
AND rating_object_id = ' . (int) $this->object_id;
phpbb::$db->sql_query($sql);
--- 314,320 ----
}
$sql = 'DELETE FROM ' . $this->sql_table . '
! WHERE rating_type_id = ' . (int) $this->rating_type_id . '
AND rating_object_id = ' . (int) $this->object_id;
phpbb::$db->sql_query($sql);
Modified: trunk/titania/install/index.php
==============================================================================
*** trunk/titania/install/index.php (original)
--- trunk/titania/install/index.php Fri Jun 12 03:52:15 2009
***************
*** 56,83 ****
)),
array('customisation_authors', array(
'COLUMNS' => array(
- 'author_id' => array('UINT', NULL, 'auto_increment'),
'user_id' => array('UINT', 0),
'phpbb_user_id' => array('UINT', 0),
- 'author_username' => array('VCHAR_CI', ''),
- 'author_username_clean' => array('VCHAR_CI', ''),
'author_realname' => array('VCHAR_CI', ''),
'author_website' => array('VCHAR_UNI:200', ''),
- 'author_email' => array('VCHAR_UNI:100', ''),
- 'author_email_hash' => array('BINT', 0),
'author_rating' => array('DECIMAL', 0),
'author_rating_count' => array('UINT', 0),
! 'author_contribs' => array('UINT', 0), //
'author_snippets' => array('UINT', 0), // Number of snippets
'author_mods' => array('UINT', 0), // Number of mods
'author_styles' => array('UINT', 0), // Number of styles
'author_visible' => array('BOOL', 1),
),
! 'PRIMARY_KEY' => 'author_id',
'KEYS' => array(
- 'user_id' => array('INDEX', 'user_id'),
- 'phpbb_user_id' => array('INDEX', 'phpbb_user_id'),
- 'author_username_clean' => array('INDEX', 'author_username_clean'),
'author_rating' => array('INDEX', 'author_rating'),
'author_contribs' => array('INDEX', 'author_contribs'),
'author_snippets' => array('INDEX', 'author_snippets'),
--- 56,75 ----
)),
array('customisation_authors', array(
'COLUMNS' => array(
'user_id' => array('UINT', 0),
'phpbb_user_id' => array('UINT', 0),
'author_realname' => array('VCHAR_CI', ''),
'author_website' => array('VCHAR_UNI:200', ''),
'author_rating' => array('DECIMAL', 0),
'author_rating_count' => array('UINT', 0),
! 'author_contribs' => array('UINT', 0), // Total # of contribs
'author_snippets' => array('UINT', 0), // Number of snippets
'author_mods' => array('UINT', 0), // Number of mods
'author_styles' => array('UINT', 0), // Number of styles
'author_visible' => array('BOOL', 1),
),
! 'PRIMARY_KEY' => 'user_id',
'KEYS' => array(
'author_rating' => array('INDEX', 'author_rating'),
'author_contribs' => array('INDEX', 'author_contribs'),
'author_snippets' => array('INDEX', 'author_snippets'),
***************
*** 89,95 ****
array('customisation_contribs', array(
'COLUMNS' => array(
'contrib_id' => array('UINT', NULL, 'auto_increment'),
! 'contrib_author_id' => array('UINT', 0), // would like to replace with user_id...
'contrib_maintainer' => array('UINT', 0), // ???
'contrib_type' => array('TINT:1', 0),
'contrib_name' => array('STEXT_UNI', '', 'true_sort'),
--- 81,87 ----
array('customisation_contribs', array(
'COLUMNS' => array(
'contrib_id' => array('UINT', NULL, 'auto_increment'),
! 'contrib_user_id' => array('UINT', 0),
'contrib_maintainer' => array('UINT', 0), // ???
'contrib_type' => array('TINT:1', 0),
'contrib_name' => array('STEXT_UNI', '', 'true_sort'),
***************
*** 115,121 ****
),
'PRIMARY_KEY' => 'contrib_id',
'KEYS' => array(
! 'contrib_author_id' => array('INDEX', 'contrib_author_id'),
'contrib_type' => array('INDEX', 'contrib_type'),
'contrib_name_clean' => array('INDEX', 'contrib_name_clean'),
'contrib_status' => array('INDEX', 'contrib_status'),
--- 107,113 ----
),
'PRIMARY_KEY' => 'contrib_id',
'KEYS' => array(
! 'contrib_user_id' => array('INDEX', 'contrib_user_id'),
'contrib_type' => array('INDEX', 'contrib_type'),
'contrib_name_clean' => array('INDEX', 'contrib_name_clean'),
'contrib_status' => array('INDEX', 'contrib_status'),
***************
*** 127,135 ****
array('customisation_contrib_coauthors', array(
'COLUMNS' => array(
'contrib_id' => array('UINT', 0),
! 'author_id' => array('UINT', 0),
),
! 'PRIMARY_KEY' => array('contrib_id', 'author_id'),
)),
array('customisation_contrib_faq', array(
'COLUMNS' => array(
--- 119,127 ----
array('customisation_contrib_coauthors', array(
'COLUMNS' => array(
'contrib_id' => array('UINT', 0),
! 'user_id' => array('UINT', 0),
),
! 'PRIMARY_KEY' => array('contrib_id', 'user_id'),
)),
array('customisation_contrib_faq', array(
'COLUMNS' => array(
***************
*** 249,254 ****
--- 241,253 ----
'titania_rate_reset',
),
+ 'permission_set' => array(
+ array('ROLE_ADMIN_FULL', array('titania_rate_reset')),
+ array('ROLE_MOD_FULL', array('titania_rate_reset')),
+ array('ROLE_USER_FULL', array('titania_rate')),
+ array('ROLE_USER_STANDARD', array('titania_rate')),
+ ),
+
'module_add' => array(
array('mods', 0, 'MODS_CAT_MAIN'),
array('mods', 0, 'MODS_CAT_DETAILS'),
Modified: trunk/titania/language/en/authors.php
==============================================================================
*** trunk/titania/language/en/authors.php (original)
--- trunk/titania/language/en/authors.php Fri Jun 12 03:52:15 2009
***************
*** 41,47 ****
'AUTHOR_MODS' => 'MODs',
'AUTHOR_NOT_FOUND' => 'Author not found',
'AUTHOR_PROFILE' => 'Author Profile',
! 'AUTHOR_RATING' => 'Ranking',
'AUTHOR_SNIPPETS' => 'Snippets',
'AUTHOR_STYLES' => 'Styles',
--- 41,47 ----
'AUTHOR_MODS' => 'MODs',
'AUTHOR_NOT_FOUND' => 'Author not found',
'AUTHOR_PROFILE' => 'Author Profile',
! 'AUTHOR_RATING' => 'Rating',
'AUTHOR_SNIPPETS' => 'Snippets',
'AUTHOR_STYLES' => 'Styles',
Modified: trunk/titania/language/en/common.php
==============================================================================
*** trunk/titania/language/en/common.php (original)
--- trunk/titania/language/en/common.php Fri Jun 12 03:52:15 2009
***************
*** 61,66 ****
--- 61,67 ----
'PURGE_CACHE' => 'Purge Cache',
+ 'REMOVE_RATING' => 'Remove Rating',
'RATING' => 'Rating',
'RATINGS' => 'Ratings',
'RETURN_LAST_PAGE' => 'Return to the previous page',
***************
*** 121,127 ****
'RR_RANK' => 'MOD Rank',
'RR_E_RATING' => 'Enter Rating',
'RR_E_REVIEW' => 'Enter Review',
! 'RR_LIST' => 'Review List',
'COMPLEX_TITLE' => 'Complexity',
'COMPLEX_SCHEMA' => 'SQL Schema Changes',
--- 122,128 ----
'RR_RANK' => 'MOD Rank',
'RR_E_RATING' => 'Enter Rating',
'RR_E_REVIEW' => 'Enter Review',
! 'RR_LIST' => 'Review List',
'COMPLEX_TITLE' => 'Complexity',
'COMPLEX_SCHEMA' => 'SQL Schema Changes',
Modified: trunk/titania/modules/authors/authors_main.php
==============================================================================
*** trunk/titania/modules/authors/authors_main.php (original)
--- trunk/titania/modules/authors/authors_main.php Fri Jun 12 03:52:15 2009
***************
*** 45,50 ****
--- 45,64 ----
{
titania::add_lang(array('contrib', 'authors'));
+ $user_id = request_var('u', 0);
+
+ if ($user_id && !$mode)
+ {
+ $found = $this->author_profile();
+
+ if ($found)
+ {
+ $this->tpl_name = 'authors/author_profile';
+ $this->page_title = 'AUTHOR_PROFILE';
+ return;
+ }
+ }
+
switch ($mode)
{
case 'profile':
***************
*** 77,88 ****
{
if (!class_exists('sort'))
{
! include(TITANIA_ROOT . 'includes/class_sort.' . PHP_EXT);
}
if (!class_exists('pagination'))
{
! include(TITANIA_ROOT . 'includes/class_pagination.' . PHP_EXT);
}
$sort = new sort();
--- 91,102 ----
{
if (!class_exists('sort'))
{
! include(TITANIA_ROOT . 'includes/tools/sort.' . PHP_EXT);
}
if (!class_exists('pagination'))
{
! include(TITANIA_ROOT . 'includes/tools/pagination.' . PHP_EXT);
}
$sort = new sort();
***************
*** 121,149 ****
$sql = phpbb::$db->sql_build_query('SELECT', $sql_ary);
$result = phpbb::$db->sql_query_limit($sql, $limit, $start);
! $authors = $author_id_key = array();
while ($author = phpbb::$db->sql_fetchrow($result))
{
! $author_id_key[$author['user_id']] = $author;
! $author_id_key[$author['user_id']]['online'] = false;
! $authors[] = &$author_id_key[$author['user_id']];
}
phpbb::$db->sql_freeresult($result);
// Generate online information for user
! if ($config['load_onlinetrack'] && sizeof($authors))
{
$sql = 'SELECT session_user_id, MAX(session_time) as online_time, MIN(session_viewonline) AS viewonline
FROM ' . SESSIONS_TABLE . '
! WHERE ' . phpbb::$db->sql_in_set('session_user_id', array_keys($author_id_key)) . '
GROUP BY session_user_id';
$result = phpbb::$db->sql_query($sql);
$update_time = $config['load_online_time'] * 60;
while ($row = phpbb::$db->sql_fetchrow($result))
{
! $author_id_key[$row['session_user_id']]['online'] = (time() - $update_time < $row['online_time'] && (($row['viewonline']) || phpbb::$auth->acl_get('u_viewonline'))) ? true : false;
}
phpbb::$db->sql_freeresult($result);
}
--- 135,163 ----
$sql = phpbb::$db->sql_build_query('SELECT', $sql_ary);
$result = phpbb::$db->sql_query_limit($sql, $limit, $start);
! $authors = $user_id_key = array();
while ($author = phpbb::$db->sql_fetchrow($result))
{
! $user_id_key[$author['user_id']] = $author;
! $user_id_key[$author['user_id']]['online'] = false;
! $authors[] = &$user_id_key[$author['user_id']];
}
phpbb::$db->sql_freeresult($result);
// Generate online information for user
! if (phpbb::$config['load_onlinetrack'] && sizeof($authors))
{
$sql = 'SELECT session_user_id, MAX(session_time) as online_time, MIN(session_viewonline) AS viewonline
FROM ' . SESSIONS_TABLE . '
! WHERE ' . phpbb::$db->sql_in_set('session_user_id', array_keys($user_id_key)) . '
GROUP BY session_user_id';
$result = phpbb::$db->sql_query($sql);
$update_time = $config['load_online_time'] * 60;
while ($row = phpbb::$db->sql_fetchrow($result))
{
! $user_id_key[$row['session_user_id']]['online'] = (time() - $update_time < $row['online_time'] && (($row['viewonline']) || phpbb::$auth->acl_get('u_viewonline'))) ? true : false;
}
phpbb::$db->sql_freeresult($result);
}
***************
*** 157,163 ****
phpbb::$template->assign_block_vars('authors', array(
'USER_FULL' => ($author['user_id']) ? get_username_string('full', $author['user_id'], $author['username'], $author['user_colour']) : '',
! 'AUTHOR_FULL' => get_username_string('full', $author['author_id'], $author['author_username'], $author['user_colour'], false, $u_author_profile),
'CONTRIBS' => $author['author_contribs'],
'MODS' => $author['author_mods'],
'STYLES' => $author['author_styles'],
--- 171,177 ----
phpbb::$template->assign_block_vars('authors', array(
'USER_FULL' => ($author['user_id']) ? get_username_string('full', $author['user_id'], $author['username'], $author['user_colour']) : '',
! 'AUTHOR_FULL' => get_username_string('full', $author['user_id'], $author['author_username'], $author['user_colour'], false, $u_author_profile),
'CONTRIBS' => $author['author_contribs'],
'MODS' => $author['author_mods'],
'STYLES' => $author['author_styles'],
***************
*** 170,176 ****
));
}
! $pagination->sql_total_count($sql_ary, 'a.author_id');
$pagination->set_params(array(
'sk' => $sort->get_sort_key(false),
--- 184,190 ----
));
}
! $pagination->sql_total_count($sql_ary, 'a.user_id');
$pagination->set_params(array(
'sk' => $sort->get_sort_key(false),
***************
*** 187,236 ****
private function author_profile()
{
! $author_id = request_var('u', 0);
!
! $sql_ary = array(
! 'SELECT' => 'a.*, u.user_lastvisit, u.username, u.user_posts, u.user_colour',
! 'FROM' => array(
! TITANIA_AUTHORS_TABLE => 'a',
! ),
! 'LEFT_JOIN' => array(
! array(
! 'FROM' => array(USERS_TABLE => 'u'),
! 'ON' => 'a.user_id = u.user_id'
! ),
! ),
! 'WHERE' => 'a.author_id = ' . $author_id . '
! AND a.author_visible <> ' . AUTHOR_HIDDEN
! );
! $sql = phpbb::$db->sql_build_query('SELECT', $sql_ary);
! $result = phpbb::$db->sql_query($sql);
! if(!($author = phpbb::$db->sql_fetchrow($result)))
{
return false;
}
! if(!$author['author_visible'])
{
return false;
}
phpbb::$template->assign_vars(array(
! 'AUTHOR_NAME' => get_username_string('username', $author['user_id'], $author['username'], $author['user_colour']),
! 'USER_FULL' => ($author['user_id']) ? get_username_string('full', $author['user_id'], $author['username'], $author['user_colour']) : '',
! 'REAL_NAME' => htmlspecialchars($author['author_realname']),
! 'WEBSITE' => $author['author_website'],
! 'RATING' => $this->generate_rating($author['author_rating']),
! 'RATING_COUNT' => $author['author_rating_count'],
! 'CONTRIB_COUNT' => $this->generate_contrib_string('contrib', 'link', $author['author_contribs'], $author_id),
! 'SNIPPET_COUNT' => $this->generate_contrib_string('snippet', 'link', $author['author_snippets'], $author_id),
! 'MOD_COUNT' => $this->generate_contrib_string('mod', 'link', $author['author_mods'], $author_id),
! 'STYLE_COUNT' => $this->generate_contrib_string('style', 'link', $author['author_styles'], $author_id),
! 'U_PHPBB_PROFILE' => (!empty($author['phpbb_user_id']) && titania::$config->phpbbcom_profile) ? sprintf(titania::$config->phpbbcom_viewprofile_url, $author['phpbb_user_id']) : '',
));
return true;
--- 201,241 ----
private function author_profile()
{
! $user_id = request_var('u', 0);
! titania::load_object('author');
! $author = new titania_author($user_id);
! if ($author->load() === false)
{
return false;
}
! $author_data = $author->get_profile_data();
!
! titania::load_object('rating');
!
! $author_rating = new titania_rating('author', $author);
!
! if(isset($author_data['author_visible']) && !$author_data['author_visible'])
{
return false;
}
phpbb::$template->assign_vars(array(
! 'AUTHOR_NAME' => get_username_string('username', $author_data['user_id'], $author_data['username'], $author_data['user_colour']),
! 'USER_FULL' => ($author_data['user_id']) ? get_username_string('full', $author_data['user_id'], $author_data['username'], $author_data['user_colour']) : '',
! 'REAL_NAME' => htmlspecialchars($author_data['author_realname']),
! 'WEBSITE' => $author_data['author_website'],
! 'RATING' => $author_rating->get_rating_string(),
! 'RATING_COUNT' => $author_data['author_rating_count'],
! 'CONTRIB_COUNT' => $this->generate_contrib_string('contrib', 'link', $author_data['author_contribs'], $user_id),
! 'SNIPPET_COUNT' => $this->generate_contrib_string('snippet', 'link', $author_data['author_snippets'], $user_id),
! 'MOD_COUNT' => $this->generate_contrib_string('mod', 'link', $author_data['author_mods'], $user_id),
! 'STYLE_COUNT' => $this->generate_contrib_string('style', 'link', $author_data['author_styles'], $user_id),
! 'U_PHPBB_PROFILE' => $author->get_phpbb_com_profile_url(),
));
return true;
***************
*** 244,258 ****
}
// This can handle generating links to a contrib list, as well as just text
! private function generate_contrib_string($contrib_type, $string_type, $num, $author_id = 0)
{
$contrib_type = strtoupper($contrib_type);
$lang_key = 'NUM_' . $contrib_type . (($num == 1)?'':'S');
! $contrib_string = sprintf($user->lang[$lang_key], $num);
if($string_type == 'link')
{
! if($author_id == 0)
{
trigger_error('Author ID not set when using link', E_USER_WARNING);
}
--- 249,263 ----
}
// This can handle generating links to a contrib list, as well as just text
! private function generate_contrib_string($contrib_type, $string_type, $num, $user_id = 0)
{
$contrib_type = strtoupper($contrib_type);
$lang_key = 'NUM_' . $contrib_type . (($num == 1)?'':'S');
! $contrib_string = sprintf(phpbb::$user->lang[$lang_key], $num);
if($string_type == 'link')
{
! if($user_id == 0)
{
trigger_error('Author ID not set when using link', E_USER_WARNING);
}
***************
*** 260,266 ****
switch($contrib_type)
{
case 'MOD':
! $url = append_sid(TITANIA_ROOT . 'mods/index.php', 'mode=search&u=' . $author_id);
break;
default:
--- 265,271 ----
switch($contrib_type)
{
case 'MOD':
! $url = append_sid(TITANIA_ROOT . 'mods/index.php', 'mode=search&u=' . $user_id);
break;
default:
Modified: trunk/titania/modules/mods/mods_details.php
==============================================================================
*** trunk/titania/modules/mods/mods_details.php (original)
--- trunk/titania/modules/mods/mods_details.php Fri Jun 12 03:52:15 2009
***************
*** 90,101 ****
public function mod_details($mod_id)
{
$sql_ary = array(
! 'SELECT' => 'c.*, a.author_id, a.author_username, u.user_colour',
'FROM' => array(TITANIA_CONTRIBS_TABLE => 'c'),
'LEFT_JOIN' => array(
array(
'FROM' => array(TITANIA_AUTHORS_TABLE => 'a'),
! 'ON' => 'a.author_id = c.contrib_author_id',
),
array(
'FROM' => array(USERS_TABLE => 'u'),
--- 90,101 ----
public function mod_details($mod_id)
{
$sql_ary = array(
! 'SELECT' => 'c.*, a.user_id, a.author_username, u.user_colour',
'FROM' => array(TITANIA_CONTRIBS_TABLE => 'c'),
'LEFT_JOIN' => array(
array(
'FROM' => array(TITANIA_AUTHORS_TABLE => 'a'),
! 'ON' => 'a.user_id = c.contrib_user_id',
),
array(
'FROM' => array(USERS_TABLE => 'u'),
***************
*** 121,130 ****
'ADDED' => phpbb::$user->format_date($row['contrib_release_date']),
'UPDATED' => phpbb::$user->format_date($row['contrib_update_date']),
'VERSION' => $row['contrib_version'],
! 'AUTHOR_FULL' => sprintf(phpbb::$user->lang['AUTHOR_BY'], get_username_string('full', $row['author_id'], $row['author_username'], $row['user_colour'], false, $profile_url)),
'PROFILE_FULL' => (!empty($row['user_id']) ? get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']) : ''),
! 'U_SEARCH_MODS_AUTHOR' => sprintf(phpbb::$user->lang['U_SEARCH_MODS_AUTHOR'], '<a href="' . append_sid(TITANIA_ROOT . $this->page, 'mode=search&u=' . $row['author_id']) . '">', $row['author_username'], '</a>'),
));
}
--- 121,130 ----
'ADDED' => phpbb::$user->format_date($row['contrib_release_date']),
'UPDATED' => phpbb::$user->format_date($row['contrib_update_date']),
'VERSION' => $row['contrib_version'],
! 'AUTHOR_FULL' => sprintf(phpbb::$user->lang['AUTHOR_BY'], get_username_string('full', $row['user_id'], $row['author_username'], $row['user_colour'], false, $profile_url)),
'PROFILE_FULL' => (!empty($row['user_id']) ? get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']) : ''),
! 'U_SEARCH_MODS_AUTHOR' => sprintf(phpbb::$user->lang['U_SEARCH_MODS_AUTHOR'], '<a href="' . append_sid(TITANIA_ROOT . $this->page, 'mode=search&u=' . $row['user_id']) . '">', $row['author_username'], '</a>'),
));
}
Modified: trunk/titania/modules/mods/mods_main.php
==============================================================================
*** trunk/titania/modules/mods/mods_main.php (original)
--- trunk/titania/modules/mods/mods_main.php Fri Jun 12 03:52:15 2009
***************
*** 154,160 ****
$sort->sort_request(false);
$sql_ary = array(
! 'SELECT' => 'c.*, a.author_id, a.author_username, u.user_colour',
'FROM' => array(TITANIA_CONTRIBS_TABLE => 'c'),
'LEFT_JOIN' => array(
array(
--- 154,160 ----
$sort->sort_request(false);
$sql_ary = array(
! 'SELECT' => 'c.*, a.user_id, a.author_username, u.user_colour',
'FROM' => array(TITANIA_CONTRIBS_TABLE => 'c'),
'LEFT_JOIN' => array(
array(
***************
*** 163,169 ****
),
array(
'FROM' => array(TITANIA_AUTHORS_TABLE => 'a'),
! 'ON' => 'a.author_id = c.contrib_author_id',
),
array(
'FROM' => array(USERS_TABLE => 'u'),
--- 163,169 ----
),
array(
'FROM' => array(TITANIA_AUTHORS_TABLE => 'a'),
! 'ON' => 'a.user_id = c.contrib_user_id',
),
array(
'FROM' => array(USERS_TABLE => 'u'),
***************
*** 194,200 ****
'ADDED' => $user->format_date($row['contrib_release_date']),
'UPDATED' => $user->format_date($row['contrib_update_date']),
'VERSION' => $row['contrib_version'],
! 'AUTHOR' => sprintf($user->lang['AUTHOR_BY'], get_username_string('full', $row['author_id'], $row['author_username'], $row['user_colour'], false, $profile_url)),
));
}
$db->sql_freeresult($result);
--- 194,200 ----
'ADDED' => $user->format_date($row['contrib_release_date']),
'UPDATED' => $user->format_date($row['contrib_update_date']),
'VERSION' => $row['contrib_version'],
! 'AUTHOR' => sprintf($user->lang['AUTHOR_BY'], get_username_string('full', $row['user_id'], $row['author_username'], $row['user_colour'], false, $profile_url)),
));
}
$db->sql_freeresult($result);
Added: trunk/titania/theme/images/star_green.gif
==============================================================================
Binary file - no diff available.
Propchange: trunk/titania/theme/images/star_green.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: trunk/titania/theme/images/star_grey.gif
==============================================================================
Binary file - no diff available.
Propchange: trunk/titania/theme/images/star_grey.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: trunk/titania/theme/images/star_orange.gif
==============================================================================
Binary file - no diff available.
Propchange: trunk/titania/theme/images/star_orange.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: trunk/titania/theme/images/star_red.gif
==============================================================================
Binary file - no diff available.
Propchange: trunk/titania/theme/images/star_red.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: trunk/titania/theme/images/star_remove.gif
==============================================================================
Binary file - no diff available.
Propchange: trunk/titania/theme/images/star_remove.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
More information about the customisationdb-commits
mailing list