public function __construct($profile) { $config = Komento::getConfig(); $phpbbpath = $config->get('layout_phpbb_path'); $phpbburl = $config->get('layout_phpbb_url'); $phpbburl = Jstring::rtrim($phpbburl, '/', ''); $phpbbDB = $this->_getPhpbbDBO($phpbbpath); $phpbbConfig = $this->_getPhpbbConfig(); $phpbbuserid = 0; if (empty($phpbbConfig)) { return false; } $juser = JFactory::getUser($profile->id); $sql = 'SELECT `user_id`, `username`, `user_avatar`, `user_avatar_type` ' . 'FROM `#__users` WHERE LOWER(`username`) = ' . $phpbbDB->quote(strtolower($juser->username)) . ' ' . 'LIMIT 1'; $phpbbDB->setQuery($sql); $result = $phpbbDB->loadObject(); $phpbbuserid = empty($result->user_id) ? '0' : $result->user_id; if (!empty($result->user_avatar)) { switch ($result->user_avatar_type) { case '1': $subpath = $phpbbConfig->avatar_upload_path; $phpEx = JFile::getExt(__FILE__); $source = $phpbburl . '/download/file.' . $phpEx . '?avatar=' . $result->user_avatar; break; case '2': $source = $result->user_avatar; break; case '3': $subpath = $phpbbConfig->avatar_gallery_path; $source = $phpbburl . '/' . $subpath . '/' . $result->user_avatar; break; default: $subpath = ''; $source = ''; } } else { $sql = 'SELECT ' . $phpbbDB->nameQuote('theme_name') . ' ' . 'FROM ' . $phpbbDB->nameQuote('#__styles_theme') . ' ' . 'WHERE ' . $phpbbDB->nameQuote('theme_id') . ' = ' . $phpbbDB->quote($phpbbConfig->default_style); $phpbbDB->setQuery($sql); $theme = $phpbbDB->loadObject(); $defaultPath = 'styles/' . $theme->theme_name . '/theme/images/no_avatar.gif'; $source = $phpbburl . '/' . $defaultPath; } $this->avatar = $source; $this->link = $phpbburl . '/memberlist.php?mode=viewprofile&u=' . $phpbbuserid; return parent::__construct($profile); }