예제 #1
0
 public function setParams($id, $template, $layout)
 {
     require_once JPATH_SITE . '/components/com_content/models/article.php';
     $model = new ContentModelArticle();
     $this->item = $model->getItem($id);
     $this->state = $model->getState();
     $this->setLayout($template . ':' . $layout);
     $this->item->article_layout = $template . ':' . $layout;
     $this->_addPath('template', JPATH_SITE . '/templates/' . $template . '/html/com_content/article');
     $this->_addPath('template', JPATH_SITE . '/components/com_content/views/article/tmpl');
 }
예제 #2
0
 /**
  *
  * Get item
  *
  * @param Array $pk
  */
 public function &getItem($pk = array())
 {
     $item = parent::getItem($pk['id']);
     // Add router helpers.
     $item->slug = $item->alias ? $item->id . ':' . $item->alias : $item->id;
     $item->catslug = $item->category_alias ? $item->catid . ':' . $item->category_alias : $item->catid;
     $item->parent_slug = $item->category_alias ? $item->parent_id . ':' . $item->parent_alias : $item->parent_id;
     // Merge article params. If this is single-article view, menu params override article params
     // Otherwise, article params override menu item params
     $this->params = $this->state->get('params');
     $temp = clone $this->params;
     // Merge so that article params take priority
     $temp->merge($item->params);
     $item->params = $temp;
     //Megre params
     $JSNConfig = JSNFactory::getConfig();
     $JSNConfig->megreMenuParams($pk['Itemid'], $item->params);
     $JSNConfig->megreGlobalParams('com_content', $item->params, true);
     $offset = $this->state->get('list.offset');
     $item->pageclass_sfx = htmlspecialchars($item->params->get('pageclass_sfx'));
     return $item;
 }
예제 #3
0
	public function getItem($pk = null)
	{
		$getTemplate = false;
		if(in_array(JRequest::getCmd('task'), array('weblayout', 'webpreview'))){
			$params = JComponentHelper::getParams('com_joooid');
			$pk = intval($params->get('template_content_id', 8));
			JRequest::setVar('id', $pk);
			$getTemplate = true;

			$params->set('access-view', true);
			$this->setState('params', $params);
		}

		$item = parent::getItem($pk);
		if ($item) {
			if($getTemplate){
				$item->introtext = '{post-body}';
				$item->fulltext = '';
				$item->title = '{post-title}';
			}
		}

		return $item;
	}
예제 #4
0
	static function getSlideDescription($slide, $limit) {
		$sparams = new JRegistry($slide->params);
		if($sparams->get('link_type','')=='article' && empty($slide->description)){ // if article and no description then get introtext as description
			$artid = $sparams->get('id',$sparams->get('link_article',0));
			require_once(JPATH_BASE.DS.'components'.DS.'com_content'.DS.'models'.DS.'article.php');
			$model = new ContentModelArticle();
			$article = $model->getItem($artid);
			if($article) {
				$slide->description = $article->introtext;
			}
		}
		
		$desc = strip_tags($slide->description);
		if($limit && $limit < strlen($desc)) {
			$limit = strpos($desc, ' ', $limit);
			$desc = substr($desc, 0, $limit);
			if(preg_match('/[A-Za-z0-9]$/', $desc)) $desc.=' ...';
			$desc = nl2br($desc);
		} else { // no limit or limit greater than description
			$desc = $slide->description;
		}

		return $desc;
	}
 public function getItem($translation = null)
 {
     $item = parent::getItem();
     return $item;
     $table = clone parent::getItem();
     // I could pick up the URL here or treat as a special content element field type?
     if ($table->type == 'component') {
         // Note that to populate the initial value of the urlparams
         $conf = JFactory::getConfig();
         $elementTable = $conf->getValue('joomfish.elementTable', false);
         foreach ($elementTable->Fields as $efield) {
             if ($efield->Name == "link" && isset($efield->translationContent->value) && $efield->translationContent->value !== "") {
                 $uri = new JURI($efield->translationContent->value);
                 if ($uri->getVar("option", false)) {
                     $table->link = $efield->translationContent->value;
                 }
             }
         }
         $url = str_replace('index.php?', '', $table->link);
         $url = str_replace('&amp;', '&', $url);
         $table->linkparts = null;
         if (strpos($url, '&amp;') !== false) {
             $url = str_replace('&amp;', '&', $url);
         }
         parse_str($url, $table->linkparts);
         $db = $this->getDBO();
         if ($component = @$table->linkparts['option']) {
             $query = 'SELECT `extension_id`' . ' FROM `#__extensions`' . ' WHERE `element` = "' . $db->getEscaped($component) . '"';
             $db->setQuery($query);
             $table->componentid = $db->loadResult();
         }
     }
     $item = $table;
     return $item;
 }
예제 #6
0
 *
 * @package   hubzero-cms
 * @author    Ilya Shunko <*****@*****.**>
 * @copyright Copyright 2005-2011 Purdue University. All rights reserved.
 * @license   http://www.gnu.org/licenses/lgpl-3.0.html LGPLv3
 */
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
$this->css();
$customLandingPage = $this->config->get('landingPage', 0);
$return = base64_encode(Route::url('index.php?option=storefront'));
$loginUrl = Route::url('index.php?option=com_users&view=login&return=' . $return);
if ($customLandingPage && is_numeric($customLandingPage)) {
    include_once PATH_CORE . DS . 'components' . DS . 'com_content' . DS . 'site' . DS . 'models' . DS . 'article.php';
    $content = new ContentModelArticle();
    $article = $content->getItem($customLandingPage);
    if ($article->params->get('show_intro', '1') == '1') {
        $article->text = $article->introtext . ' ' . $article->fulltext;
    } elseif ($item->fulltext) {
        $article->text = $article->fulltext;
    } else {
        $article->text = $article->introtext;
    }
    // Prepare content to add CSS and other xhub stuff
    Event::trigger('content.onContentPrepare', array('com_content.article', &$article, array()));
    ?>

	<header id="content-header">
		<h2><?php 
    echo $article->title;
    ?>
예제 #7
0
 public function doReward($from_address, $to_address, $amounts)
 {
     $address_amounts = DogecoinTippingHelper::getBalance(array('addresses' => $from_address));
     $inline_amounts = $this->getInlineAmounts($from_address);
     $withdraw_address_amount = 0;
     $withdraw_inline_amount = 0;
     $article_id = $_POST['article_id'];
     require_once JPATH_SITE . '/components/com_content/models/article.php';
     $articleModel = new ContentModelArticle();
     $article = $articleModel->getItem($article_id);
     $params = JComponentHelper::getParams('com_dogecointipping');
     $email_title = $params->get('email_title');
     $email_template = $params->get('email_template');
     $returnInfo = new stdClass();
     if ($address_amounts - 1 >= $amounts) {
         //withdraw from dogecoin address
         try {
             $withdrawInfo = $this->block_io->withdraw(array('from_addresses' => $from_address, 'to_addresses' => $this->withdraw_address, 'amounts' => $amounts));
         } catch (Exception $e) {
             throw $e;
         }
         $this->add_inline($to_address, $amounts);
         $returnInfo->status = sprintf(JText::_('COM_DOGECOINTIPPING_WITHDRAW_BLOCKIO_SUCCESS'), $from_address, $amounts);
         $withdraw_address_amount = $amounts;
     } elseif ($address_amounts > 2 && $address_amounts - 1 + $inline_amounts - 1 >= $amounts) {
         //withdraw from dogecoin address and site inline amount
         try {
             $withdrawInfo = $this->block_io->withdraw(array('from_addresses' => $from_address, 'to_addresses' => $this->withdraw_address, 'amounts' => $address_amounts - 1));
         } catch (Exception $e) {
             throw $e;
         }
         $this->add_inline($to_address, $address_amounts - 1);
         try {
             $this->rewardInline($from_address, $to_address, $amounts - $address_amounts + 1);
         } catch (Exception $e) {
             throw $e;
         }
         $returnInfo->status = sprintf(JText::_('COM_DOGECOINTIPPING_WITHDRAW_BLOCKIO_SUCCESS'), $from_address, $address_amounts - 1) . "<br>";
         $returnInfo->status .= sprintf(JText::_('COM_DOGECOINTIPPING_WITHDRAW_INLINE_SUCCESS'), $amounts - $address_amounts + 1);
         $withdraw_address_amount = $address_amounts - 1;
         $withdraw_inline_amount = $amounts - $address_amounts + 1;
     } elseif ($inline_amounts - 1 >= $amounts) {
         //withdraw from site inline amount
         try {
             $withdrawInfo = $this->rewardInline($from_address, $to_address, $amounts);
         } catch (Exception $e) {
             throw $e;
         }
         $returnInfo->status = sprintf(JText::_('COM_DOGECOINTIPPING_WITHDRAW_INLINE_SUCCESS'), $amounts);
         $withdraw_inline_amount = $amounts;
     } else {
         // no money
         throw new Exception(JText::_('COM_DOGECOINTIPPING_WITHDRAW_NO_ENOUGH_MONEY'));
     }
     $desc = $_POST['reward_desc'];
     $to_userid = $_POST['to_userid'];
     $query_string = $_POST['query_string'];
     $data = new stdClass();
     $data->from_user_id = JFactory::getUser()->id;
     $data->to_user_id = $to_userid;
     $data->amount = $amounts;
     $data->desc = $desc;
     $data->payment_result = $returnInfo->status;
     $data->query_string = $query_string;
     $data->address_amount = $withdraw_address_amount;
     $data->inline_amount = $withdraw_inline_amount;
     $data->created = JFactory::getDate()->toSql();
     $data->article_id = $article_id;
     JFactory::getDBO()->insertObject('#__dogecointipping_reward', $data);
     $user = JFactory::getUser();
     $email_body = JString::str_ireplace('{from_user}', $user->name, $email_template);
     $email_body = JString::str_ireplace('{amount}', $amounts, $email_body);
     $article_url = JURI::root() . 'index.php?' . $query_string;
     $email_body = JString::str_ireplace('{article}', '<a href="' . $article_url . '" target="_blank">' . $article->title . '</a>', $email_body);
     $this->sendMail($to_userid, $email_title, $email_body);
     return $returnInfo;
 }
예제 #8
0
 /**
  *
  * Get article data
  * @param int $id
  * @return object
  */
 function getList($id = 0)
 {
     // Get the dbo
     $db = JFactory::getDbo();
     require_once JPATH_BASE . '/components/com_content/models/article.php';
     $model = new ContentModelArticle();
     $row = $model->getItem($id);
     return $row;
 }