本文整理汇总了PHP中FD::info方法的典型用法代码示例。如果您正苦于以下问题:PHP FD::info方法的具体用法?PHP FD::info怎么用?PHP FD::info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FD
的用法示例。
在下文中一共展示了FD::info方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: item
/**
* Default method to display the registration page.
*
* @since 1.0
* @access public
* @author Mark Lee <mark@stackideas.com>
*/
function item($tpl = null)
{
// Check for user profile completeness
FD::checkCompleteProfile();
$config = FD::config();
if (!$config->get('badges.enabled')) {
return $this->redirect(FRoute::dashboard(array(), false));
}
// Get id of badge
$id = JRequest::getInt('id');
$badge = FD::table('Badge');
$badge->load($id);
if (!$id || !$badge->id) {
FD::info()->set(JText::_('COM_EASYSOCIAL_BADGES_INVALID_BADGE_ID_PROVIDED'), SOCIAL_MSG_ERROR);
$this->redirect(FRoute::badges());
$this->close();
}
// Load the badge language
$badge->loadLanguage();
// Set the page title
FD::page()->title($badge->get('title'));
// Set the page breadcrumb
FD::page()->breadcrumb(JText::_('COM_EASYSOCIAL_PAGE_TITLE_BADGES'), FRoute::badges());
FD::page()->breadcrumb($badge->get('title'));
// Get the badges model
$options = array('start' => 0, 'limit' => FD::themes()->getConfig()->get('achieverslimit', 50));
$achievers = $badge->getAchievers($options);
$totalAchievers = $badge->getTotalAchievers();
$this->set('totalAchievers', $totalAchievers);
$this->set('achievers', $achievers);
$this->set('badge', $badge);
parent::display('site/badges/default.item');
}
示例2: display
/**
* Displays the application output in the canvas.
*
* @since 1.0
* @access public
* @param int The user id that is currently being viewed.
*/
public function display($userId = null, $docType = null)
{
// Require user to be logged in
FD::requireLogin();
$id = JRequest::getVar('schedule_id');
// Get the user that's being accessed.
$user = FD::user($userId);
$calendar = FD::table('Calendar');
$calendar->load($id);
if (!$calendar->id || !$id) {
FD::info()->set(false, JText::_('APP_CALENDAR_CANVAS_INVALID_SCHEDULE_ID'), SOCIAL_MSG_ERROR);
return $this->redirect(FD::profile(array('id' => $user->getAlias()), false));
}
$my = FD::user();
$privacy = FD::privacy($my->id);
$result = $privacy->validate('apps.calendar', $calendar->id, 'view', $user->id);
if (!$result) {
FD::info()->set(false, JText::_('APP_CALENDAR_NO_ACCESS'), SOCIAL_MSG_ERROR);
JFactory::getApplication()->redirect(FRoute::dashboard());
}
FD::page()->title($calendar->title);
// Render the comments and likes
$likes = FD::likes();
$likes->get($id, 'calendar', 'create', SOCIAL_APPS_GROUP_USER);
// Apply comments on the stream
$comments = FD::comments($id, 'calendar', 'create', SOCIAL_APPS_GROUP_USER, array('url' => FRoute::albums(array('layout' => 'item', 'id' => $id))));
$params = $this->app->getParams();
$this->set('params', $params);
$this->set('likes', $likes);
$this->set('comments', $comments);
$this->set('calendar', $calendar);
$this->set('user', $user);
echo parent::display('canvas/item/default');
}
示例3: route
/**
* Redirects a notification item to the intended location
*
* @since 1.0
* @access public
* @param string
* @return
*/
public function route()
{
// The user needs to be logged in to access notifications
FD::requireLogin();
// Check for user profile completeness
FD::checkCompleteProfile();
$id = JRequest::getInt('id');
$table = FD::table('Notification');
$table->load($id);
if (!$id || !$table->id) {
FD::info()->set(JText::_('COM_EASYSOCIAL_NOTIFICATIONS_INVALID_ID_PROVIDED'), SOCIAL_MSG_ERROR);
return $this->redirect(FRoute::dashboard(array(), false));
}
// Check if the user is allowed to view this notification item.
$my = FD::user();
if ($table->target_id != $my->id) {
FD::info()->set(JText::_('COM_EASYSOCIAL_NOTIFICATIONS_NOT_ALLOWED'), SOCIAL_MSG_ERROR);
return $this->redirect(FRoute::dashboard(array(), false));
}
// Mark the notification item as read
$table->markAsRead();
// Ensure that all & are replaced with &
$url = str_ireplace('&', '&', $table->url);
$this->redirect(FRoute::_($url, false));
$this->close();
}
示例4: display
/**
* Displays the application output in the canvas.
*
* @since 1.0
* @access public
* @param int The user id that is currently being viewed.
*/
public function display($uid = null, $docType = null)
{
$group = FD::group($uid);
$editor = JFactory::getEditor();
// Only allow group admin to create or edit news
if (!$group->isAdmin() && !$this->my->isSiteAdmin()) {
FD::info()->set(false, JText::_('COM_EASYSOCIAL_GROUPS_ONLY_MEMBER_ARE_ALLOWED'), SOCIAL_MSG_ERROR);
return $this->redirect($group->getPermalink(false));
}
$id = JRequest::getInt('newsId');
$news = FD::table('GroupNews');
$news->load($id);
FD::page()->title(JText::_('APP_GROUP_NEWS_FORM_UPDATE_PAGE_TITLE'));
// Determine if this is a new record or not
if (!$id) {
$news->comments = true;
FD::page()->title(JText::_('APP_GROUP_NEWS_FORM_CREATE_PAGE_TITLE'));
}
// Get app params
$params = $this->app->getParams();
$this->set('params', $params);
$this->set('news', $news);
$this->set('editor', $editor);
$this->set('group', $group);
echo parent::display('canvas/form');
}
示例5: saveSettings
/**
* Allows user to save settings
*
* @since 1.0
* @access public
* @param string
* @return
*/
public function saveSettings()
{
// Check for request forgeries
FD::checkToken();
// Ensure that the user is logged in.
FD::requireLogin();
// Get current view.
$view = $this->getCurrentView();
// Get current logged in user
$my = FD::user();
// Get the app id from request.
$id = JRequest::getInt('id');
// Try to load the app
$app = FD::table('App');
$app->load($id);
if (!$id || !$app->id) {
$view->setMessage(JText::_('COM_EASYSOCIAL_APPS_INVALID_ID_PROVIDED'), SOCIAL_MSG_ERROR);
return $view->call(__FUNCTION__);
}
// Ensure that the user can really access this app settings.
if (!$app->isInstalled()) {
return $ajax->reject(FD::info()->set(JText::_('COM_EASYSOCIAL_APPS_SETTINGS_NOT_INSTALLED'), SOCIAL_MSG_ERROR));
}
$data = JRequest::getVar('data', '');
// Convert the object to proper json string
$raw = FD::makeJSON($data);
$map = FD::table('AppsMap');
$map->load(array('uid' => $my->id, 'app_id' => $app->id));
$map->params = $raw;
// Store user params
$map->store();
return $view->call(__FUNCTION__);
}
示例6: preview
public function preview()
{
$fileid = JRequest::getInt('uid');
if (empty($fileid)) {
FD::info()->set((object) array('message' => JText::_('PLG_FIELDS_FILE_ERROR_INVALID_FILE_ID'), 'type' => SOCIAL_MSG_ERROR));
$this->redirect(FRoute::dashboard(array(), false));
}
$file = FD::table('file');
$state = $file->load($fileid);
if (!$state || !$file->hasPreview() || !$this->params->get('allow_preview')) {
FD::info()->set((object) array('message' => JText::_('PLG_FIELDS_FILE_ERROR_PREVIEW_NOT_ALLOWED'), 'type' => SOCIAL_MSG_ERROR));
$this->redirect(FRoute::dashboard(array(), false));
}
$file->preview();
}
示例7: saveFilter
public function saveFilter($filter)
{
// Unauthorized users should not be allowed to access this page.
FD::requireLogin();
FD::info()->set($this->getMessage());
if ($filter->id) {
//$this->redirect( FRoute::stream( array( 'layout' => 'form', 'id' => $filter->id ) , false ) );
$this->redirect(FRoute::dashboard(array(), false));
} else {
$model = FD::model('Stream');
$items = $model->getFilters(FD::user()->id);
$this->set('items', $items);
$this->set('filter', $filter);
echo parent::display('site/stream/filter.form');
}
}
示例8: form
public function form($keys = null)
{
// Check access
if (!$this->authorise('easysocial.access.maintenance')) {
$this->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error');
}
if ($this->hasErrors() || empty($keys)) {
FD::info()->set($this->getMessage());
return $this->redirect('index.php?option=com_easysocial&view=maintenance');
}
$this->setHeading('COM_EASYSOCIAL_HEADING_MAINTENANCE_EXECUTING');
$this->setDescription('COM_EASYSOCIAL_DESCRIPTION_MAINTENANCE_EXECUTING');
$model = FD::model('maintenance');
$scripts = $model->getItemByKeys($keys);
$this->set('scripts', $scripts);
echo parent::display('admin/maintenance/form');
}
示例9: display
/**
* Displays the application output in the canvas.
*
* @since 1.0
* @access public
* @param int The user id that is currently being viewed.
*/
public function display($uid = null, $docType = null)
{
$group = FD::group($uid);
if (!$group->isMember() && !$this->my->isSiteAdmin()) {
FD::info()->set(false, JText::_('COM_EASYSOCIAL_GROUPS_ONLY_MEMBER_ARE_ALLOWED'), SOCIAL_MSG_ERROR);
return $this->redirect($group->getPermalink(false));
}
// Set the page title
FD::page()->title(JText::_('APP_GROUP_DISCUSSIONS_PAGE_TITLE_CREATE'));
// Get the discussion item
$discussion = FD::table('Discussion');
// Determines if we should allow file sharing
$access = $group->getAccess();
$files = $access->get('files.enabled', true);
$this->set('files', $files);
$this->set('discussion', $discussion);
$this->set('group', $group);
echo parent::display('canvas/form');
}
示例10: display
/**
* Displays the application output in the canvas.
*
* @since 1.0
* @access public
* @param int The user id that is currently being viewed.
*/
public function display($uid = null, $docType = null)
{
$event = FD::event($uid);
// Check if the user is a member of the group
if (!$event->getGuest()->isGuest() && !$this->my->isSiteAdmin()) {
FD::info()->set(false, JText::_('COM_EASYSOCIAL_EVENTS_ONLY_GUEST_ARE_ALLOWED'), SOCIAL_MSG_ERROR);
return $this->redirect($event->getPermalink(false));
}
// Set the page title
FD::page()->title(JText::_('APP_EVENT_DISCUSSIONS_PAGE_TITLE_CREATE'));
// Get the discussion item
$discussion = FD::table('Discussion');
// Determines if we should allow file sharing
$access = $event->getAccess();
$files = $access->get('files.enabled', true);
$this->set('files', $files);
$this->set('discussion', $discussion);
$this->set('event', $event);
echo parent::display('canvas/form');
}
示例11: display
public function display($tpl = null)
{
$fieldid = JRequest::getInt('id');
$task = JRequest::getWord('task');
$field = FD::table('field');
$state = $field->load($fieldid);
if (!$state) {
FD::info()->set(JText::_('COM_EASYSOCIAL_FIELDS_INVALID_ID'), SOCIAL_MSG_ERROR);
$this->redirect(FRoute::dashboard(array(), false));
$this->close();
}
$app = $field->getApp();
if (!$app) {
FD::info()->set(JText::sprintf('COM_EASYSOCIAL_FIELDS_APP_DOES_NOT_EXIST', $app->element), SOCIAL_MSG_ERROR);
$this->redirect(FRoute::dashboard(array(), false));
$this->close();
}
$base = SOCIAL_FIELDS . '/' . $app->group . '/' . $app->element . '/views';
$classname = 'SocialFieldView' . ucfirst($app->group) . ucfirst($app->element);
if (!class_exists($classname)) {
if (!JFile::exists($base . '/' . $app->element . '.php')) {
FD::info()->set(JText::sprintf('COM_EASYSOCIAL_FIELDS_VIEW_DOES_NOT_EXIST', $app->element), SOCIAL_MSG_ERROR);
$this->redirect(FRoute::dashboard(array(), false));
$this->close();
}
require_once $base . '/' . $app->element . '.php';
}
if (!class_exists($classname)) {
FD::info()->set(JText::sprintf('COM_EASYSOCIAL_FIELDS_CLASS_DOES_NOT_EXIST', $classname), SOCIAL_MSG_ERROR);
$this->redirect(FRoute::dashboard(array(), false));
$this->close();
}
$view = new $classname($app->group, $app->element);
if (!is_callable(array($view, $task))) {
FD::info()->set(JText::sprintf('COM_EASYSOCIAL_FIELDS_METHOD_DOES_NOT_EXIST', $task), SOCIAL_MSG_ERROR);
$this->redirect(FRoute::dashboard(array(), false));
$this->close();
}
$view->init($field);
return $view->{$task}();
}
示例12: display
/**
* Displays the single note item
*
* @since 1.0
* @access public
* @param string
* @return
*/
public function display($userId = null, $docType = null)
{
$id = JRequest::getInt('cid');
$appid = JRequest::getInt('id');
// Get the current owner of this app canvas
$user = FD::user($userId);
$note = $this->getTable('Note');
$note->load($id);
if (!$id || !$note) {
FD::info()->set(false, JText::_('APP_USER_NOTES_INVALID_NOTE_ID_PROVIDED'), SOCIAL_MSG_ERROR);
return $this->redirect(FD::profile(array('id' => $user->getAlias()), false));
}
// Load up likes library for this note.
$likes = FD::likes($note->id, 'notes', 'create', SOCIAL_APPS_GROUP_USER);
// Load up comments library for this note.
$comments = FD::comments($note->id, 'notes', 'create', SOCIAL_APPS_GROUP_USER, array('url' => ''));
$this->set('likes', $likes);
$this->set('comments', $comments);
$this->set('note', $note);
$this->set('user', $user);
$this->set('appId', $appid);
echo parent::display('canvas/default');
}
示例13: requestPermissions
/**
* This is the first entry point when the social site redirects back to this callback.
* It is responsible to close the popup and redirect to the appropriate url.
*
* @since 1.0
* @access public
*/
public function requestPermissions()
{
$config = FD::config();
// Get allowed clients
$allowedClients = array_keys((array) $config->get('oauth'));
// Get the current client.
$oauthClient = JRequest::getWord('client');
if (!in_array($oauthClient, $allowedClients)) {
FD::info()->set(false, JText::sprintf('COM_EASYSOCIAL_OAUTH_INVALID_OAUTH_CLIENT_PROVIDED', $oauthClient), SOCIAL_MSG_ERROR);
$this->redirect('index.php?option=com_easysocial&view=login');
$this->close();
return;
}
$consumer = FD::OAuth(SOCIAL_TYPE_FACEBOOK);
$permissions = JRequest::getVar('permissions');
// Add permissions for this client
$consumer->addPermission($permissions);
// Get the return url
$return = JRequest::getVar('return_to');
$return = base64_decode($return);
$this->set('redirect', $return);
parent::display('site/registration/oauth.popup');
}
示例14: getDiscussions
/**
* Retrieves the list of discussions
*
* @since 1.2
* @access public
*/
public function getDiscussions()
{
// Check for request forgeriess
FD::checkToken();
// Ensure that the user is logged in.
FD::requireLogin();
// Load up ajax lib
$ajax = FD::ajax();
// Load the discussion
$id = JRequest::getInt('id');
$group = FD::group($id);
// Get the current logged in user.
$user = FD::user();
// Check if the viewer can really browse discussions from this group.
if (!$group->isMember() && ($group->isClosed() || $group->isInviteOnly())) {
FD::info()->set(JText::_('APP_GROUP_DISCUSSIONS_NOT_ALLOWED_VIEWING'), SOCIAL_MSG_ERROR);
// Perform a redirection
return $this->redirect(FRoute::dashboard());
}
// Get the current filter type
$filter = JRequest::getWord('filter', 'all');
$options = array();
if ($filter == 'unanswered') {
$options['unanswered'] = true;
}
if ($filter == 'locked') {
$options['locked'] = true;
}
if ($filter == 'resolved') {
$options['resolved'] = true;
}
// Get the current group app
$app = $this->getApp();
$params = $app->getParams();
// Get total number of discussions to display
$options['limit'] = $params->get('total', 10);
$model = FD::model('Discussions');
$discussions = $model->getDiscussions($group->id, SOCIAL_TYPE_GROUP, $options);
$pagination = $model->getPagination();
$pagination->setVar('view', 'groups');
$pagination->setVar('layout', 'item');
$pagination->setVar('id', $group->getAlias());
$pagination->setVar('appId', $this->getApp()->id);
$pagination->setVar('filter', $filter);
$theme = FD::themes();
$theme->set('params', $params);
$theme->set('pagination', $pagination);
$theme->set('app', $app);
$theme->set('group', $group);
$theme->set('discussions', $discussions);
$contents = $theme->output('apps/group/discussions/groups/default.list');
$empty = empty($discussions);
return $ajax->resolve($contents, $empty);
}
示例15: login
/**
* Replicate's Joomla login behavior
*
* @since 1.0
* @access public
* @param string
* @return
*/
public function login()
{
JSession::checkToken('post') or jexit(JText::_('JInvalid_Token'));
$app = JFactory::getApplication();
// Populate the data array:
$data = array();
$data['return'] = base64_decode($app->input->post->get('return', '', 'BASE64'));
$data['username'] = JRequest::getVar('username', '', 'method', 'username');
$data['password'] = JRequest::getString('password', '', 'post', JREQUEST_ALLOWRAW);
$data['secretkey'] = JRequest::getString('secretkey', '');
// Get the user's state because there could be instances where Joomla is redirecting users
$tmp = $app->getUserState('users.login.form.data');
if (isset($tmp['return']) && !empty($tmp['return'])) {
$data['return'] = $tmp['return'];
}
// Set the return URL if empty.
if (empty($data['return'])) {
$data['return'] = 'index.php?option=com_easysocial&view=login';
}
// Set the return URL in the user state to allow modification by plugins
$app->setUserState('users.login.form.return', $data['return']);
// Get the log in options.
$options = array();
$options['remember'] = JRequest::getBool('remember', false);
$options['return'] = $data['return'];
// Silent! Kill you!
$options['silent'] = true;
// Get the log in credentials.
$credentials = array();
$credentials['username'] = $data['username'];
$credentials['password'] = $data['password'];
$credentials['secretkey'] = $data['secretkey'];
// Perform the log in.
if (true === $app->login($credentials, $options)) {
// Set the remember state
if ($options['remember'] == true) {
$app->setUserState('rememberLogin', true);
}
// Success
$app->setUserState('users.login.form.data', array());
// Redirect link should use the return data instead of relying it on getUserState('users.login.form.return')
// Because EasySocial has its own settings of login redirection, hence this should respect the return link passed
// We cannot fallback because the return link needs to be set in the options before calling login, and as such, the fallback has been set before calling $app->login, and no fallback is needed here.
$app->redirect(JRoute::_($data['return'], false));
} else {
// Login failed !
$data['remember'] = (int) $options['remember'];
$app->setUserState('users.login.form.data', $data);
$returnFailed = base64_decode($app->input->post->get('returnFailed', '', 'BASE64'));
if (empty($returnFailed)) {
$returnFailed = FRoute::login(array(), false);
}
FD::info()->set(null, JText::_('JGLOBAL_AUTH_INVALID_PASS'), SOCIAL_MSG_ERROR);
$app->redirect($returnFailed);
}
}