本文整理汇总了PHP中CError类的典型用法代码示例。如果您正苦于以下问题:PHP CError类的具体用法?PHP CError怎么用?PHP CError使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CError类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Update the user status
*
* @param int user id
* @param string the message. Should be < 140 char (controller check)
*/
function update($id, $status)
{
$db =& $this->getDBO();
$my = CFactory::getUser();
// @todo: posted_on should be constructed to make sure we take into account
// of Joomla server offset
// Current user and update id should always be the same
CError::assert($my->id, $id, 'eq', __FILE__, __LINE__);
// Trigger onStatusUpdate
require_once COMMUNITY_COM_PATH . DS . 'libraries' . DS . 'apps.php';
$appsLib =& CAppPlugins::getInstance();
$appsLib->loadApplications();
$args = array();
$args[] = $my->id;
// userid
$args[] = $my->getStatus();
// old status
$args[] = $status;
// new status
$appsLib->triggerEvent('onProfileStatusUpdate', $args);
$today =& JFactory::getDate();
$data = new stdClass();
$data->userid = $id;
$data->status = $status;
$data->posted_on = $today->toMySQL();
$db->updateObject('#__community_users', $data, 'userid');
if ($db->getErrorNum()) {
JError::raiseError(500, $db->stderr());
}
}
开发者ID:bizanto,项目名称:Hooked,代码行数:36,代码来源:status.php
示例2: setImage
public function setImage($path, $type = 'thumb')
{
CError::assert($path, '', '!empty', __FILE__, __LINE__);
$db = $this->getDBO();
// Fix the back quotes
$path = CString::str_ireplace('\\', '/', $path);
$type = JString::strtolower($type);
// Test if the record exists.
$oldFile = $this->{$type};
if ($db->getErrorNum()) {
JError::raiseError(500, $db->stderr());
}
if ($oldFile) {
// File exists, try to remove old files first.
$oldFile = CString::str_ireplace('/', '/', $oldFile);
// If old file is default_thumb or default, we should not remove it.
//
// Need proper way to test it
if (!JString::stristr($oldFile, 'group.jpg') && !JString::stristr($oldFile, 'group_thumb.jpg') && !JString::stristr($oldFile, 'default.jpg') && !JString::stristr($oldFile, 'default_thumb.jpg')) {
jimport('joomla.filesystem.file');
JFile::delete($oldFile);
}
}
$this->{$type} = $path;
$this->store();
}
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:26,代码来源:moods.php
示例3: onDiscussionDisplay
public function onDiscussionDisplay($row)
{
CError::assert($row->message, '', '!empty', __FILE__, __LINE__);
// @rule: Only nl2br text that doesn't contain html tags
if (!CStringHelper::isHTML($row->message)) {
$row->message = CStringHelper::nl2br($row->message);
}
}
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:8,代码来源:groups.trigger.php
示例4: onWallDisplay
public function onWallDisplay($row)
{
//CFactory::load( 'helpers' , 'string' );
CError::assert($row->comment, '', '!empty', __FILE__, __LINE__);
// @rule: Only nl2br text that doesn't contain html tags
if (!CStringHelper::isHTML($row->comment)) {
$row->comment = CStringHelper::nl2br($row->comment);
}
}
开发者ID:Jougito,项目名称:DynWeb,代码行数:9,代码来源:wall.trigger.php
示例5: onDiscussionDisplay
function onDiscussionDisplay(&$row)
{
CError::assert($row->message, '', '!empty', __FILE__, __LINE__);
$config = CFactory::getConfig();
// If editor is disabled, we only want to replace newlines with BR otherwise it doesn't make any sense to replace so many br
if ($config->get('editor') == '0') {
$row->message = $this->_filterText($row->message);
}
}
开发者ID:Jougito,项目名称:DynWeb,代码行数:9,代码来源:input.php
示例6: onMessageDisplay
public function onMessageDisplay($row)
{
CFactory::load('helpers', 'string');
CError::assert($row->body, '', '!empty', __FILE__, __LINE__);
// @rule: Only nl2br text that doesn't contain html tags
if (!CStringHelper::isHTML($row->body)) {
$row->body = CStringHelper::nl2br($row->body);
}
}
开发者ID:bizanto,项目名称:Hooked,代码行数:9,代码来源:inbox.trigger.php
示例7: onWallDisplay
public function onWallDisplay($row)
{
//CFactory::load( 'helpers' , 'string' );
CError::assert($row->comment, '', '!empty', __FILE__, __LINE__);
// @rule: Only nl2br text that doesn't contain html tags
//@since 4.1 new rule added, to ignore newline replace
if (!CStringHelper::isHTML($row->comment) && !isset($row->newlineReplace)) {
$row->comment = CStringHelper::nl2br($row->comment);
}
}
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:10,代码来源:wall.trigger.php
示例8: load
/**
* 加载文件
*
* @param string $name
*/
public static function load($class_name)
{
if (self::checkClass($class_name)) {
return true;
}
// add to class map
self::addClass(str_replace('/', '_', $class_name));
$file = dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $class_name) . '.php';
if (!is_file($file)) {
CError::show('COULD NOT FOUND THE FILE ' . $file);
}
require $file;
}
开发者ID:Rgss,项目名称:imp,代码行数:18,代码来源:Loader.php
示例9: add
/**
* Add new activity,
* @access static
*
*/
function add($activity, $params = '', $points = 1)
{
CError::assert($activity, '', '!empty', __FILE__, __LINE__);
// If params is an object, instead of a string, we convert it to string
$cmd = !empty($activity->cmd) ? $activity->cmd : '';
if (!empty($cmd)) {
$userPointModel = CFactory::getModel('Userpoints');
// Test command, with userpoint command. If is unpublished do not proceed into adding to activity stream.
$point = $userPointModel->getPointData($cmd);
if ($point && !$point->published) {
return;
}
}
$actor = !empty($activity->actor) ? $activity->actor : '';
$target = !empty($activity->target) ? $activity->target : 0;
$title = !empty($activity->title) ? $activity->title : '';
$content = !empty($activity->content) ? $activity->content : '';
$appname = !empty($activity->app) ? $activity->app : '';
$cid = !empty($activity->cid) ? $activity->cid : 0;
$points = !empty($activity->points) ? $activity->points : $points;
$access = !empty($activity->access) ? $activity->access : 0;
// If the params in embedded within the activity object, use it
// if it is not explicitly overriden
if (empty($params) && !empty($activity->params)) {
$params = $activity->params;
}
include_once JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'models' . DS . 'activities.php';
if (class_exists('CFactory')) {
$activities = CFactory::getModel('activities');
} else {
$activities = new CommunityModelActivities();
}
// Update access for activity based on the user's profile privacy
if (!empty($actor) && $actor != 0) {
$user = CFactory::getUser($actor);
$userParams = $user->getParams();
$profileAccess = $userParams->get('privacyProfileView');
// Only overwrite access if the user global profile privacy is higher
// BUT, if access is defined as PRIVACY_FORCE_PUBLIC, do not modify it
if ($access != PRIVACY_FORCE_PUBLIC && $profileAccess > $access) {
$access = $profileAccess;
}
}
$activities->add($actor, $target, $title, $content, $appname, $cid, $params, $points, $access);
}
开发者ID:bizanto,项目名称:Hooked,代码行数:50,代码来源:activities.php
示例10: build
public static function build($view, $task = '', $keys = null, $route = true)
{
// View cannot be empty. Assertion must be included here.
CError::assert($view, '', '!empty', __FILE__, __LINE__);
$url = 'index.php?option=com_community&view=' . $view;
// Task might be optional
$url .= !empty($task) ? '&task=' . $task : '';
if (!is_null($keys) && is_array($keys)) {
foreach ($keys as $key => $value) {
$url .= '&' . $key . '=' . $value;
}
}
// Test if it needs JRoute
if ($route) {
return CRoute::_($url);
}
return $url;
}
开发者ID:bizanto,项目名称:Hooked,代码行数:18,代码来源:url.php
示例11: setImage
/**
* Set the avatar for specific application. Caller must have a database table
* that is named after the appType. E.g, users should have jos_community_users
*
* @param appType Application type. ( users , groups )
* @param path The relative path to the avatars.
* @param type The type of Image, thumb or avatar.
*
**/
function setImage($id, $path, $type = 'thumb')
{
CError::assert($id, '', '!empty', __FILE__, __LINE__);
CError::assert($path, '', '!empty', __FILE__, __LINE__);
$db =& $this->getDBO();
// Fix the back quotes
$path = JString::str_ireplace('\\', '/', $path);
$type = JString::strtolower($type);
// Test if the record exists.
$query = 'SELECT ' . $db->nameQuote($type) . ' FROM ' . $db->nameQuote('#__community_users') . 'WHERE ' . $db->nameQuote('userid') . '=' . $db->Quote($id);
$db->setQuery($query);
$oldFile = $db->loadResult();
if ($db->getErrorNum()) {
JError::raiseError(500, $db->stderr());
}
if (!$oldFile) {
$query = 'UPDATE ' . $db->nameQuote('#__community_users') . ' ' . 'SET ' . $db->nameQuote($type) . '=' . $db->Quote($path) . ' ' . 'WHERE ' . $db->nameQuote('userid') . '=' . $db->Quote($id);
$db->setQuery($query);
$db->query($query);
if ($db->getErrorNum()) {
JError::raiseError(500, $db->stderr());
}
} else {
$query = 'UPDATE ' . $db->nameQuote('#__community_users') . ' ' . 'SET ' . $db->nameQuote($type) . '=' . $db->Quote($path) . ' ' . 'WHERE ' . $db->nameQuote('userid') . '=' . $db->Quote($id);
$db->setQuery($query);
$db->query($query);
if ($db->getErrorNum()) {
JError::raiseError(500, $db->stderr());
}
// If old file is default_thumb or default, we should not remove it.
// Need proper way to test it
if (!Jstring::stristr($oldFile, 'components/com_community/assets/default.jpg') && !Jstring::stristr($oldFile, 'components/com_community/assets/default_thumb.jpg')) {
// File exists, try to remove old files first.
$oldFile = JString::str_ireplace('/', DS, $oldFile);
JFile::delete($oldFile);
}
}
}
开发者ID:bizanto,项目名称:Hooked,代码行数:47,代码来源:users.php
示例12: getCategoryName
/**
* Returns the category name of the specific category
*
* @access public
* @param string Category Id
* @returns string Category name
* */
public function getCategoryName($categoryId)
{
CError::assert($categoryId, '', '!empty', __FILE__, __LINE__);
$db = $this->getDBO();
$query = 'SELECT ' . $db->quoteName('name') . ' ' . 'FROM ' . $db->quoteName('#__community_events_category') . ' ' . 'WHERE ' . $db->quoteName('id') . '=' . $db->Quote($categoryId);
$db->setQuery($query);
$result = $db->loadResult();
if ($db->getErrorNum()) {
JError::raiseError(500, $db->stderr());
}
CError::assert($result, '', '!empty', __FILE__, __LINE__);
return $result;
}
开发者ID:SMARTRESPONSOR,项目名称:SMARTRESPONSOR,代码行数:20,代码来源:events.php
示例13: setImage
/**
* Set the avatar for specific application. Caller must have a database table
* that is named after the appType. E.g, users should have jos_community_users
*
* @param appType Application type. ( users , groups )
* @param path The relative path to the avatars.
* @param type The type of Image, thumb or avatar.
*
**/
function setImage($id, $path, $type = 'thumb', $removeOldImage = true)
{
CError::assert($id, '', '!empty', __FILE__, __LINE__);
CError::assert($path, '', '!empty', __FILE__, __LINE__);
$db =& $this->getDBO();
// Fix the back quotes
$path = JString::str_ireplace('\\', '/', $path);
$type = JString::strtolower($type);
// Test if the record exists.
$query = 'SELECT ' . $db->nameQuote($type) . ' FROM ' . $db->nameQuote('#__community_users') . 'WHERE ' . $db->nameQuote('userid') . '=' . $db->Quote($id);
$db->setQuery($query);
$oldFile = $db->loadResult();
if ($db->getErrorNum()) {
JError::raiseError(500, $db->stderr());
}
$appsLib =& CAppPlugins::getInstance();
$appsLib->loadApplications();
$args = array();
$args[] =& $id;
// userid
$args[] =& $oldFile;
// old path
$args[] =& $path;
// new path
$appsLib->triggerEvent('onProfileAvatarUpdate', $args);
if (!$oldFile) {
$query = 'UPDATE ' . $db->nameQuote('#__community_users') . ' ' . 'SET ' . $db->nameQuote($type) . '=' . $db->Quote($path) . ' ' . 'WHERE ' . $db->nameQuote('userid') . '=' . $db->Quote($id);
$db->setQuery($query);
$db->query($query);
if ($db->getErrorNum()) {
JError::raiseError(500, $db->stderr());
}
} else {
$query = 'UPDATE ' . $db->nameQuote('#__community_users') . ' ' . 'SET ' . $db->nameQuote($type) . '=' . $db->Quote($path) . ' ' . 'WHERE ' . $db->nameQuote('userid') . '=' . $db->Quote($id);
$db->setQuery($query);
$db->Query();
if ($db->getErrorNum()) {
JError::raiseError(500, $db->stderr());
}
// If old file is default_thumb or default, we should not remove it.
// Need proper way to test it
if (!JString::stristr($oldFile, 'components/com_community/assets/default.jpg') && !JString::stristr($oldFile, 'components/com_community/assets/default_thumb.jpg') && $removeOldImage) {
// File exists, try to remove old files first.
$oldFile = JString::str_ireplace('/', DS, $oldFile);
if (JFile::exists($oldFile)) {
JFile::delete($oldFile);
}
}
}
}
开发者ID:bizanto,项目名称:Hooked,代码行数:59,代码来源:user.php
示例14: ajaxRemoveWall
/**
* Delete post message
*
* @param response An ajax Response object
* @param id A unique identifier for the wall row
*
* returns response
*/
function ajaxRemoveWall($response, $id, $cache_id = "")
{
$my = CFactory::getUser();
$wallModel = CFactory::getModel('wall');
$wall = $wallModel->get($id);
CError::assert($id, '', '!empty', __FILE__, __LINE__);
CFactory::load('helpers', 'owner');
// Make sure the current user actually has the correct permission
// Only the original writer and the person the wall is meant for (and admin of course)
// can delete the wall
if ($my->id == $wall->post_by || $my->id == $wall->contentid || COwnerHelper::isCommunityAdmin()) {
if ($wallModel->deletePost($id)) {
// @rule: Remove the wall activity from the database as well
CFactory::load('libraries', 'activities');
CActivityStream::remove('walls', $id);
//add user points
if ($wall->post_by != 0) {
CFactory::load('libraries', 'userpoints');
CUserPoints::assignPoint('wall.remove', $wall->post_by);
}
} else {
$html = JText::_('Error while removing wall. Line:' . __LINE__);
$response->addAlert($html);
}
$cache =& JFactory::getCache('plgCommunityWalls');
$cache->remove($cache_id);
$cache =& JFactory::getCache('plgCommunityWalls_fullview');
$cache->remove($cache_id);
} else {
$html = JText::_('COM_COMMUNITY_PERMISSION_DENIED_WARNING');
$response->addAlert($html);
}
return $response;
}
开发者ID:Simarpreet05,项目名称:joomla,代码行数:42,代码来源:walls.php
示例15: ajaxRemoveWall
public function ajaxRemoveWall($wallId)
{
$filter = JFilterInput::getInstance();
$wallId = $filter->clean($wallId, 'int');
CError::assert($wallId, '', '!empty', __FILE__, __LINE__);
$response = new JAXResponse();
CFactory::load('helpers', 'owner');
if (!COwnerHelper::isRegisteredUser()) {
return $this->ajaxBlockUnregister();
}
//@rule: Check if user is really allowed to remove the current wall
$my = CFactory::getUser();
$wallModel =& $this->getModel('wall');
$wall = $wallModel->get($wallId);
$eventModel =& $this->getModel('events');
$event =& JTable::getInstance('Event', 'CTable');
$event->load($wall->contentid);
if (!COwnerHelper::isCommunityAdmin() && !$event->isAdmin($my->id)) {
$response->addScriptCall('alert', JText::_('COM_COMMUNITY_NOT_ALLOWED_TO_REMOVE_WALL'));
} else {
if (!$wallModel->deletePost($wallId)) {
$response->addAlert(JText::_('COM_COMMUNITY_GROUPS_REMOVE_WALL_ERROR'));
} else {
if ($wall->post_by != 0) {
//add user points
CFactory::load('libraries', 'userpoints');
CUserPoints::assignPoint('wall.remove', $wall->post_by);
}
}
// Substract the count
$event->substractWallCount();
}
$this->cacheClean(array(COMMUNITY_CACHE_TAG_ACTIVITIES));
return $response->sendResponse();
}
开发者ID:Simarpreet05,项目名称:joomla,代码行数:35,代码来源:events.php
示例16: _groupAlbum
function _groupAlbum()
{
CFactory::load('models', 'photos');
CFactory::load('helpers', 'friends');
CFactory::load('models', 'groups');
$mainframe =& JFactory::getApplication();
$document =& JFactory::getDocument();
$config = CFactory::getConfig();
$my = CFactory::getUser();
$model = CFactory::getModel('photos');
$groupModel = CFactory::getModel('groups');
$albumId = JRequest::getInt('albumid', '', 'GET');
$defaultId = JRequest::getVar('photo', '', 'GET');
$groupId = JRequest::getInt('groupid', '', 'REQUEST');
$group =& JTable::getInstance('Group', 'CTable');
$group->load($groupId);
if (empty($albumId)) {
echo JText::_('CC NO PROPER ALBUM ID');
return;
}
CFactory::load('helpers', 'owner');
//@rule: Do not allow non members to view albums for private group
if ($group->approvals == COMMUNITY_PRIVATE_GROUP && !$group->isMember($my->id) && !$group->isAdmin($my->id) && !COwnerHelper::isCommunityAdmin()) {
// Set document title
$document->setTitle(JText::_('CC RESTRICTED ACCESS'));
$mainframe->enqueueMessage(JText::_('CC RESTRICTED ACCESS', 'notice'));
echo JText::_('CC ALBUM NEED GROUP MEMBER PERMISSION');
return;
}
$album =& JTable::getInstance('Album', 'CTable');
$album->load($albumId);
// Set document title
CFactory::load('helpers', 'string');
$document->setTitle(JText::sprintf('CC USER PHOTOS TITLE', $group->name) . ' - ' . $album->name);
$this->setTitle($album->name);
$pathway =& $mainframe->getPathway();
$pathway->addItem($album->name, '');
CError::assert($group, 'object', 'istype', __FILE__, __LINE__);
// Get list of photos and set some limit to be displayed.
// @todo: make limit configurable?
$photos = $model->getAllPhotos($albumId, PHOTOS_GROUP_TYPE, null, null, COMMUNITY_ORDER_BY_DESC, COMMUNITY_ORDERING_BY_CREATED);
// Need to append the absolute path for the captions
for ($i = 0; $i < count($photos); $i++) {
$item =& JTable::getInstance('Photo', 'CTable');
$item->bind($photos[$i]);
$photos[$i] = $item;
$photo =& $photos[$i];
$photo->link = CRoute::_('index.php?option=com_community&view=photos&task=photo&groupid=' . $groupId . '&albumid=' . $photo->albumid) . '#photoid=' . $photo->id;
}
CFactory::load('helpers', 'group');
$allowManagePhotos = CGroupHelper::allowManagePhoto($groupId);
if (($group->isAdmin($my->id) || $allowManagePhotos) && $my->id != 0) {
$this->addSubmenuItem('index.php?option=com_community&view=photos&task=uploader&albumid=' . $album->id . '&groupid=' . $group->id, JText::_('CC UPLOAD PHOTOS'), '', true);
$this->addSubmenuItem('index.php?option=com_community&view=photos&task=newalbum&groupid=' . $group->id, JText::_('CC ADD ALBUM'), '', true);
}
$tmpl = new CTemplate();
CFactory::load('libraries', 'bookmarks');
$bookmarks = new CBookmarks(CRoute::getExternalURL('index.php?option=com_community&view=photos&task=album&albumid=' . $album->id . '&groupid=' . $group->id));
$bookmarksHTML = $bookmarks->getHTML();
$tmpl->set('bookmarksHTML', $bookmarksHTML);
$tmpl->set('isOwner', $group->isAdmin($my->id));
$tmpl->set('photos', $photos);
$tmpl->set('album', $album);
echo $tmpl->fetch('photos.album');
}
开发者ID:bizanto,项目名称:Hooked,代码行数:65,代码来源:view.feed.php
示例17: triggerWallComments
/**
* Formats the comment in the rows
*
* @param Array An array of wall objects
**/
function triggerWallComments(&$rows)
{
CError::assert($rows, 'array', 'istype', __FILE__, __LINE__);
require_once COMMUNITY_COM_PATH . DS . 'libraries' . DS . 'apps.php';
$appsLib =& CAppPlugins::getInstance();
$appsLib->loadApplications();
for ($i = 0; $i < count($rows); $i++) {
$args = array();
$args[] =& $rows[$i];
$appsLib->triggerEvent('onWallDisplay', $args);
}
return true;
}
开发者ID:bizanto,项目名称:Hooked,代码行数:18,代码来源:wall.php
示例18: _getFieldIdFromFieldCode
public function _getFieldIdFromFieldCode($code)
{
CError::assert($code, '', '!empty', __FILE__, __LINE__);
$db = $this->getDBO();
$query = 'SELECT' . $db->quoteName('id') . ' ' . 'FROM ' . $db->quoteName('#__community_fields') . ' ' . 'WHERE ' . $db->quoteName('fieldcode') . '=' . $db->Quote($code);
$db->setQuery($query);
$id = $db->loadResult();
CError::assert($id, '', '!empty', __FILE__, __LINE__);
return $id;
}
开发者ID:SMARTRESPONSOR,项目名称:SMARTRESPONSOR,代码行数:10,代码来源:search.php
示例19: viewGroup
/**
* Displays specific groups
**/
public function viewGroup($group)
{
$mainframe =& JFactory::getApplication();
CFactory::load('libraries', 'tooltip');
CFactory::load('libraries', 'wall');
CFactory::load('libraries', 'window');
CFactory::load('libraries', 'videos');
CFactory::load('libraries', 'activities');
CFactory::load('helpers', 'group');
CWindow::load();
$config = CFactory::getConfig();
$document = JFactory::getDocument();
$groupLib = new CGroups();
// Load appropriate models
$groupModel = CFactory::getModel('groups');
$wallModel = CFactory::getModel('wall');
$userModel = CFactory::getModel('user');
$discussModel = CFactory::getModel('discussions');
$bulletinModel = CFactory::getModel('bulletins');
$photosModel = CFactory::getModel('photos');
$activityModel = CFactory::getModel('activities');
//$groupid = JRequest::getInt( 'groupid' , '' );
//CError::assert( $groupid , '' , '!empty' , __FILE__ , __LINE__ );
$editGroup = JRequest::getVar('edit', false, 'GET');
$editGroup = $editGroup == 1 ? true : false;
$params = $group->getParams();
CFactory::load('helpers', 'string');
$document->setMetaData('title', CStringHelper::escape($group->name));
$document->setMetaData('description', CStringHelper::escape(strip_tags($group->description)));
$document->addCustomTag('<link rel="image_src" href="' . JURI::root() . $group->thumb . '" />');
// @rule: Test if the group is unpublished, don't display it at all.
if (!$group->published) {
$this->_redirectUnpublishGroup();
return;
}
// Show submenu
$this->showSubmenu();
// Set the group info to contain proper <br>
$group->description = nl2br($group->description);
$this->addPathway(JText::_('COM_COMMUNITY_GROUPS'), CRoute::_('index.php?option=com_community&view=groups'));
$this->addPathway(JText::sprintf('COM_COMMUNITY_GROUPS_NAME_TITLE', $group->name), '');
// Load the current browsers data
$my = CFactory::getUser();
// If user are invited
$isInvited = $groupModel->isInvited($my->id, $group->id);
// Get members list for display
//$members = $groupModel->getAllMember($group->id);
//Set limit for member listing on view group page
$limit = 12;
$approvedMembers = $groupModel->getMembers($group->id, $limit, true, false, true);
CError::assert($approvedMembers, 'array', 'istype', __FILE__, __LINE__);
$membersCount = $groupModel->total;
// Is there any my friend is the member of this group?
$join = '';
$friendsCount = 0;
if ($isInvited) {
// Get the invitors
$invitors = $groupModel->getInvitors($my->id, $group->id);
if (count($invitors) == 1) {
$user = CFactory::getUser($invitors[0]->creator);
$join = '<a href="' . CUrlHelper::userLink($user->id) . '">' . $user->getDisplayName() . '</a>';
} else {
for ($i = 0; $i < count($invitors); $i++) {
$user = CFactory::getUser($invitors[$i]->creator);
if ($i + 1 == count($invitors)) {
$join .= ' ' . JText::_('COM_COMMUNITY_AND') . ' ' . '<a href="' . CUrlHelper::userLink($user->id) . '">' . $user->getDisplayName() . '</a>';
} else {
$join .= ', ' . '<a href="' . CUrlHelper::userLink($user->id) . '">' . $user->getDisplayName() . '</a>';
}
}
}
// Get users friends in this group
$friendsCount = $groupModel->getFriendsCount($my->id, $group->id);
}
$admins = $groupModel->getAdmins($group->id, $limit, CC_RANDOMIZE);
// Get list of unapproved members
$groupModel->getMembers($group->id, null, false);
$unapproved = $groupModel->total;
//Get list of approved members
// Test if the current user is admin
$isAdmin = $groupModel->isAdmin($my->id, $group->id);
// Test if the current browser is a member of the group
$isMember = $groupModel->isMember($my->id, $group->id);
$waitingApproval = false;
// Test if the current user is banned from this group
$isBanned = $group->isBanned($my->id);
// Attach avatar of the member
// Pre-load multiple users at once
$userids = array();
$limitloop = $limit;
foreach ($approvedMembers as $uid) {
$userids[] = $uid->id;
if (--$limitloop < 1) {
break;
}
}
CFactory::loadUsers($userids);
//.........这里部分代码省略.........
开发者ID:Simarpreet05,项目名称:joomla,代码行数:101,代码来源:view.html.php
示例20: setImage
/**
* Set user profile avatar
*/
public function setImage($path, $type = 'thumb')
{
CError::assert($path, '', '!empty', __FILE__, __LINE__);
$db = $this->getDBO();
// Fix the back quotes
$path = JString::str_ireplace('\\', '/', $path);
$type = JString::strtolower($type);
// Test if the record exists.
$oldFile = $this->{$type};
if ($db->getErrorNum()) {
JError::raiseError(500, $db->stderr());
}
if ($oldFile) {
// File exists, try to remove old files first.
$oldFile = JString::str_ireplace('/', '/', $oldFile);
// If old file is default_thumb or default, we should not remove it.
if (!JString::stristr($oldFile, 'user.png') && !JString::stristr($oldFile, 'user_thumb.png') && !JString::stristr($oldFile, 'avatar_')) {
jimport('joomla.filesystem.file');
JFile::delete($oldFile);
}
}
$this->{$type} = $path;
$this->store();
// Trigger profile avatar update event.
if ($type == 'avatar') {
$appsLib = CAppPlugins::getInstance();
$appsLib->loadApplications();
$args = array();
$args[] = $this->userid;
// userid
$args[] = $oldFile;
// old path
$args[] = $path;
// new path
$appsLib->triggerEvent('onProfileAvatarUpdate', $args);
}
}
开发者ID:SMARTRESPONSOR,项目名称:SMARTRESPONSOR,代码行数:40,代码来源:profile.php
注:本文中的CError类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论