Пример #1
0
<?php

/**
 * @package      Projectfork
 * @subpackage   Users
 *
 * @author       Tobias Kuhn (eaxs)
 * @copyright    Copyright (C) 2006-2012 Tobias Kuhn. All rights reserved.
 * @license      http://www.gnu.org/licenses/gpl.html GNU/GPL, see LICENSE.txt
 */
defined('_JEXEC') or die;
$item =& $this->item;
$user = JFactory::getUser();
$access = PFusersHelper::getActions();
$params = JComponentHelper::getParams('com_projectfork');
$cfg_img = $params->get('user_profile_avatar');
?>
<div id="projectfork" class="category-list<?php 
echo $this->pageclass_sfx;
?>
 view-user">

    <?php 
if ($this->params->get('show_page_heading', 1)) {
    ?>
        <h1><?php 
    echo $this->escape($this->params->get('page_heading'));
    ?>
</h1>
    <?php 
}
Пример #2
0
 /**
  * Method to upload or delete a user avatar image
  *
  * @return boolean True on success, False on error
  */
 public function avatar()
 {
     // Check for request forgeries.
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     $user = JFactory::getUser();
     $access = PFusersHelper::getActions();
     $file = JRequest::getVar('avatar', '', 'files', 'array');
     $id = JRequest::getUInt('id');
     $model = $this->getModel();
     // Access check
     if ($user->id != $id || defined('PFDEMO')) {
         if (!$access->get('core.admin') || defined('PFDEMO')) {
             $this->setError(JText::_('JERROR_ALERTNOAUTHOR'));
             $this->setMessage($this->getError(), 'error');
             $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($id), false));
             return false;
         }
     }
     if (!empty($file['tmp_name'])) {
         if (!$model->saveAvatar($id, $file)) {
             $this->setError($model->getError());
             $this->setMessage($this->getError(), 'error');
             $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($id), false));
             return false;
         }
     }
     $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($id), false));
     return true;
 }