Beispiel #1
0
 function acymailing_replaceusertags(&$email, &$user, $send = true)
 {
     if (!empty($email->altbody)) {
         $email->altbody = str_replace(array('{statpicture}', '{nostatpicture}'), '', $email->altbody);
     }
     if (!$email->sendHTML or empty($email->type) or !in_array($email->type, array('news', 'autonews', 'followup', 'welcome', 'unsub', 'joomlanotification')) or strpos($email->body, '{nostatpicture}')) {
         $email->body = str_replace(array('{statpicture}', '{nostatpicture}'), '', $email->body);
         return;
     }
     if (empty($user->subid) || !$send) {
         $pictureLink = ACYMAILING_LIVE . $this->params->get('picture', 'media/com_acymailing/images/statpicture.png');
     } else {
         $config = acymailing_config();
         $itemId = $config->get('itemid', 0);
         $item = empty($itemId) ? '' : '&Itemid=' . $itemId;
         $pictureLink = acymailing_frontendLink('index.php?option=com_acymailing&ctrl=stats&mailid=' . $email->mailid . '&subid=' . $user->subid . $item);
     }
     $widthsize = $this->params->get('width', 50);
     $heightsize = $this->params->get('height', 1);
     $width = empty($widthsize) ? '' : ' width="' . $widthsize . '" ';
     $height = empty($heightsize) ? '' : ' height="' . $heightsize . '" ';
     $statPicture = '<img class="spict" alt="' . $this->params->get('alttext', '') . '" src="' . $pictureLink . '"  border="0" ' . $height . $width . '/>';
     if (strpos($email->body, '{statpicture}')) {
         $email->body = str_replace('{statpicture}', $statPicture, $email->body);
     } elseif (strpos($email->body, '</body>')) {
         $email->body = str_replace('</body>', $statPicture . '</body>', $email->body);
     } else {
         $email->body .= $statPicture;
     }
 }
Beispiel #2
0
 function acymailing_replacetags(&$email, $send = true)
 {
     $match = '#{share:(.*)}#Ui';
     $variables = array('body', 'altbody');
     $found = false;
     $results = array();
     foreach ($variables as $var) {
         if (empty($email->{$var})) {
             continue;
         }
         $found = preg_match_all($match, $email->{$var}, $results[$var]) || $found;
         if (empty($results[$var][0])) {
             unset($results[$var]);
         }
     }
     if (!$found) {
         return;
     }
     $archiveLink = acymailing_frontendLink('index.php?option=com_acymailing&ctrl=archive&task=view&mailid=' . $email->mailid, $this->params->get('template') == 'component' ? true : false);
     $tags = array();
     foreach ($results as $var => $allresults) {
         foreach ($allresults[0] as $i => $tagname) {
             if (isset($tags[$tagname])) {
                 continue;
             }
             $arguments = explode('|', $allresults[1][$i]);
             $tag = new stdClass();
             $tag->network = $arguments[0];
             for ($i = 1, $a = count($arguments); $i < $a; $i++) {
                 $args = explode(':', $arguments[$i]);
                 if (isset($args[1])) {
                     $tag->{$args}[0] = $args[1];
                 } else {
                     $tag->{$args}[0] = true;
                 }
             }
             if ($tag->network == 'facebook') {
                 $tags[$tagname] = '<a target="_blank" href="http://www.facebook.com/sharer.php?u=' . urlencode($archiveLink) . '&t=' . urlencode($email->subject) . '" title="' . JText::sprintf('SOCIAL_SHARE', 'Facebook') . '"><img alt="Facebook" src="' . ACYMAILING_LIVE . $this->params->get('picturefb', 'media/com_acymailing/images/fbshare.gif') . '" /></a>';
             } elseif ($tag->network == 'twitter') {
                 $text = JText::sprintf('SHARE_TEXT', $archiveLink);
                 $tags[$tagname] = '<a target="_blank" href="http://twitter.com/home?status=' . urlencode($text) . '" title="' . JText::sprintf('SOCIAL_SHARE', 'Twitter') . '"><img alt="Twitter" src="' . ACYMAILING_LIVE . $this->params->get('picturetwitter', 'media/com_acymailing/images/twittershare.png') . '" /></a>';
             } elseif ($tag->network == 'linkedin') {
                 $tags[$tagname] = '<a target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&url=' . urlencode($archiveLink) . '&title=' . urlencode($email->subject) . '" title="' . JText::sprintf('SOCIAL_SHARE', 'LinkedIn') . '"><img alt="LinkedIn" src="' . ACYMAILING_LIVE . $this->params->get('picturelinkedin', 'media/com_acymailing/images/linkedin.png') . '" /></a>';
             } elseif ($tag->network == 'hyves') {
                 $tags[$tagname] = '<a target="_blank" href="http://www.hyves-share.nl/button/respect/?hc_hint=1&url=' . urlencode($archiveLink) . '&title=' . urlencode($email->subject) . '" title="' . JText::sprintf('SOCIAL_SHARE', 'Hyves') . '"><img alt="Hyves" src="' . ACYMAILING_LIVE . $this->params->get('picturehyves', 'media/com_acymailing/images/hyvesshare.png') . '" /></a>';
             } elseif ($tag->network == 'google') {
                 $tags[$tagname] = '<a target="_blank" href="https://plus.google.com/share?url=' . urlencode($archiveLink) . '" title="' . JText::sprintf('SOCIAL_SHARE', 'Google+') . '"><img alt="Google+" src="' . ACYMAILING_LIVE . $this->params->get('picturegoogleplus', 'media/com_acymailing/images/google_plusshare.png') . '" /></a>';
             }
             if (file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'share.php')) {
                 ob_start();
                 require ACYMAILING_MEDIA . 'plugins' . DS . 'share.php';
                 $tags[$tagname] = ob_get_clean();
             }
         }
     }
     $email->body = str_replace(array_keys($tags), $tags, $email->body);
     $email->altbody = str_replace(array_keys($tags), '', $email->altbody);
 }
Beispiel #3
0
 function acymailing_replaceusertags(&$email, &$user, $send = true)
 {
     $variables = array('subject', 'body', 'altbody');
     $acypluginsHelper = acymailing_get('helper.acyplugins');
     $tags = $acypluginsHelper->extractTags($email, 'print');
     $archiveLink = acymailing_frontendLink('index.php?option=com_acymailing&ctrl=archive&task=view&mailid=' . $email->mailid, $this->params->get('template', 'component') == 'component' ? true : false);
     $addkey = !empty($email->key) ? '&key=' . $email->key : '';
     $adduserkey = !empty($user->key) ? '&subid=' . $user->subid . '-' . $user->key : '';
     $link = $archiveLink . '&print=1' . $addkey . $adduserkey;
     foreach ($variables as $var) {
         if (empty($email->{$var})) {
             continue;
         }
         $email->{$var} = str_replace(array_keys($tags), $link, $email->{$var});
     }
 }
Beispiel #4
0
	function view(){

		global $Itemid;

		$app = JFactory::getApplication();

		$document = JFactory::getDocument();

		$this->addFeed();



		$pathway = $app->getPathway();
		$my = JFactory::getUser();

		$frontEndManagement = false;
		$listid = acymailing_getCID('listid');

		$values = new stdClass();
		$values->suffix = '';
		$jsite = JFactory::getApplication('site');
		$menus = $jsite->getMenu();
		$menu	= $menus->getActive();

		if(empty($menu) AND !empty($Itemid)){
			$menus->setActive($Itemid);
			$menu	= $menus->getItem($Itemid);
		}

		if (is_object( $menu )) {
			jimport('joomla.html.parameter');
			$menuparams = new acyParameter( $menu->params );
		}

		if(!empty($menuparams)){
			$values->suffix = $menuparams->get('pageclass_sfx','');
		}

		if(empty($listid) && !empty($menuparams)){
			$listid = $menuparams->get('listid');
			if ($menuparams->get('menu-meta_description')) $document->setDescription($menuparams->get('menu-meta_description'));
			if ($menuparams->get('menu-meta_keywords')) $document->setMetadata('keywords',$menuparams->get('menu-meta_keywords'));
			if ($menuparams->get('robots')) $document->setMetadata('robots',$menuparams->get('robots'));
			if ($menuparams->get('page_title')) acymailing_setPageTitle($menuparams->get('page_title'));
		}

		$config = acymailing_config();
		$indexFollow = $config->get('indexFollow', '');
		$tagIndFol = array();
		if(strpos($indexFollow, 'noindex') !== false) $tagIndFol[] = 'noindex';
		if(strpos($indexFollow, 'nofollow') !== false) $tagIndFol[] = 'nofollow';
		if(!empty($tagIndFol)) $document->setMetadata('robots',implode(',',$tagIndFol));

		if(!empty($listid)){
			 $listClass = acymailing_get('class.list');
			 $oneList = $listClass->get($listid);
			 if(!empty($oneList->visible) AND $oneList->published AND (empty($menuparams) || !$menuparams->get('listid'))){
				 $pathway->addItem($oneList->name,acymailing_completeLink('archive&listid='.$oneList->listid.':'.$oneList->alias));
			 }

			 if(!empty($oneList->listid) AND acymailing_level(3)){
				if(!empty($my->id) AND (int)$my->id == (int)$oneList->userid){
					$frontEndManagement = true;
				}
				if(!empty($my->id)){
					if($oneList->access_manage == 'all' OR acymailing_isAllowed($oneList->access_manage)){
						 $frontEndManagement = true;
					}
				}
			}
		}

		$mailid = JRequest::getString('mailid','nomailid');
		if(empty($mailid)){
			die('This is a Newsletter-template... and you can not access the online version of a Newsletter-template!<br />Please <a href="administrator/index.php?option=com_acymailing&ctrl=newsletter&task=edit" >create a Newsletter</a> using your template and then try again your "view it online" link!');
			exit;
		}

		if($mailid == 'nomailid'){
			$db = JFactory::getDBO();
			$query = 'SELECT m.`mailid` FROM `#__acymailing_list` as l JOIN `#__acymailing_listmail` as lm ON l.listid=lm.listid JOIN `#__acymailing_mail` as m on lm.mailid = m.mailid';
			$query .= ' WHERE l.`visible` = 1 AND l.`published` = 1 AND m.`visible`= 1 AND m.`published` = 1 AND m.`type` = "news" AND l.`type` = "list"';
			if(!empty($listid)) $query .= ' AND l.`listid` = '.(int) $listid;
			$query .= ' ORDER BY m.`senddate` DESC, m.`mailid` DESC LIMIT 1';
			$db->setQuery($query);
			$mailid = $db->loadResult();
		}
		$mailid = intval($mailid);
		if(empty($mailid)) return JError::raiseError( 404, 'Newsletter not found');

		$access_sub = true;
		 if(acymailing_level(3)){
			$listmail = acymailing_get('class.listmail');
			$allLists = $listmail->getLists($mailid);
			$access_sub = false;
			if(!empty($allLists)){
				foreach($allLists as $alist){
					if(empty($alist->mailid)) continue;
					if(!$alist->published OR !$alist->visible OR $alist->access_sub == 'none') continue;
					if(acymailing_isAllowed($alist->access_sub)){
						$access_sub = true;
						break;
					}

				}
			}
		}

		$mailClass = acymailing_get('helper.mailer');
		$mailClass->loadedToSend = false;
		$oneMail = $mailClass->load($mailid);

		if(empty($oneMail->mailid)){
			return JError::raiseError( 404, 'Newsletter not found : '.$mailid );
		}

		if(!$frontEndManagement AND (!$access_sub OR !$oneMail->published OR !$oneMail->visible)){
			$key = JRequest::getCmd('key');
			if(empty($key) OR $key !== $oneMail->key){
				$reason = (!$oneMail->published) ? 'Newsletter not published' : (!$oneMail->visible ? 'Newsletter not visible' : (!$access_sub ? 'Access not allowed' : ''));
				$app->enqueueMessage('You can not have access to this e-mail : '.$reason,'error');
				$app->redirect(acymailing_completeLink('lists',false,true));
				return false;
			}
		}

		$fshare = '';
		if(preg_match('#<img[^>]*id="pictshare"[^>]*>#i',$oneMail->body,$pregres) && preg_match('#src="([^"]*)"#i',$pregres[0],$pict)){
			$fshare = $pict[1];
		}elseif(preg_match('#<img[^>]*class="[^"]*pictshare[^"]*"[^>]*>#i',$oneMail->body,$pregres) && preg_match('#src="([^"]*)"#i',$pregres[0],$pict)){
			$fshare = $pict[1];
		}elseif(preg_match('#class="acymailing_content".*(<img[^>]*>)#is',$oneMail->body,$pregres) && preg_match('#src="([^"]*)"#i',$pregres[1],$pict)){
			if(strpos($pregres[1],JText::_('JOOMEXT_READ_MORE')) === false) $fshare = $pict[1];
		}

		if(!empty($fshare)){
			$document->setMetadata('og:image', $fshare);
		}

		$document->setMetadata('og:url',acymailing_frontendLink('index.php?option=com_acymailing&ctrl=archive&task=view&mailid='.$oneMail->mailid,JRequest::getCmd('tmpl') == 'component' ? true : false));
		$document->setMetadata('og:title',$oneMail->subject);
		if(!empty($oneMail->metadesc))$document->setMetadata('og:description',$oneMail->metadesc);

		$subkeys = JRequest::getString('subid',JRequest::getString('sub'));
		if(!empty($subkeys)){
			$db = JFactory::getDBO();
			$subid = intval(substr($subkeys,0,strpos($subkeys,'-')));
			$subkey = substr($subkeys,strpos($subkeys,'-')+1);
			$db->setQuery('SELECT * FROM '.acymailing_table('subscriber').' WHERE `subid` = '.$db->Quote($subid).' AND `key` = '.$db->Quote($subkey).' LIMIT 1');
			$receiver = $db->loadObject();
		}

		if(empty($receiver) AND !empty($my->email)){
			$userClass = acymailing_get('class.subscriber');
			$receiver = $userClass->get($my->email);
		}

		if(empty($receiver)){
			$receiver = new stdClass();
			$receiver->name = JText::_('VISITOR');
		}

		$oneMail->sendHTML = true;
		$mailClass->dispatcher->trigger('acymailing_replaceusertags',array(&$oneMail,&$receiver,false));

		$pathway->addItem($oneMail->subject);

		$document	= JFactory::getDocument();
		acymailing_setPageTitle($oneMail->subject);

		if (!empty($oneMail->metadesc)) {
			$document->setDescription( $oneMail->metadesc );
		}
		if (!empty($oneMail->metakey)) {
			$document->setMetadata('keywords', $oneMail->metakey);
		}

		$this->assignRef('mail',$oneMail);
		$this->assignRef('frontEndManagement',$frontEndManagement);
		$this->assignRef('list',$oneList);
		$config =& acymailing_config();
		$this->assignRef('config',$config);
		$this->assignRef('my',$my);
		$this->assignRef('receiver',$receiver);
		$this->assignRef('values',$values);

		if($oneMail->html){
			$templateClass = acymailing_get('class.template');
			$templateClass->archiveSection = true;
			$templateClass->displayPreview('newsletter_preview_area',$oneMail->tempid,$oneMail->subject);
		}
	}
Beispiel #5
0
 function replaceSubscriptionTag(&$allresults, $i, &$user, &$email)
 {
     if (empty($user->subid)) {
         return '';
     }
     if (empty($user->key)) {
         $user->key = acymailing_generateKey(14);
         $db = JFactory::getDBO();
         $db->setQuery('UPDATE ' . acymailing_table('subscriber') . ' SET `key`= ' . $db->Quote($user->key) . ' WHERE subid = ' . (int) $user->subid . ' LIMIT 1');
         $db->query();
     }
     $config = acymailing_config();
     $itemId = $config->get('itemid', 0);
     $item = empty($itemId) ? '' : '&Itemid=' . $itemId;
     $lang = empty($email->language) ? '' : '&lang=' . $email->language;
     if ($allresults[1][$i] == 'confirm') {
         //confirm your subscription link
         $itemId = $this->params->get('confirmitemid', 0);
         if (!empty($itemId)) {
             $item = '&Itemid=' . $itemId;
         }
         $myLink = acymailing_frontendLink('index.php?subid=' . $user->subid . '&option=com_acymailing&ctrl=user&task=confirm&key=' . urlencode($user->key) . $item . $lang, (bool) $this->params->get('confirmtemplate', false));
         if (empty($allresults[2][$i])) {
             return $myLink;
         }
         return '<a target="_blank" href="' . $myLink . '">' . $allresults[2][$i] . '</a>';
     } elseif ($allresults[1][$i] == 'modify') {
         //modify your subscription link
         $itemId = $this->params->get('modifyitemid', 0);
         if (!empty($itemId)) {
             $item = '&Itemid=' . $itemId;
         }
         $myLink = acymailing_frontendLink('index.php?subid=' . $user->subid . '&option=com_acymailing&ctrl=user&task=modify&key=' . urlencode($user->key) . $item . $lang, (bool) $this->params->get('modifytemplate', false));
         if (empty($allresults[2][$i])) {
             return $myLink;
         }
         return '<a style="text-decoration:none;" target="_blank" href="' . $myLink . '"><span class="acymailing_unsub">' . $allresults[2][$i] . '</span></a>';
     }
     //unsubscribe link
     $itemId = $this->params->get('unsubscribeitemid', 0);
     if (!empty($itemId)) {
         $item = '&Itemid=' . $itemId;
     }
     $myLink = acymailing_frontendLink('index.php?subid=' . $user->subid . '&option=com_acymailing&ctrl=user&task=out&mailid=' . $email->mailid . '&key=' . urlencode($user->key) . $item . $lang, (bool) $this->params->get('unsubscribetemplate', false));
     if (!$this->listunsubscribe && $this->params->get('listunsubscribe', 0) && method_exists($email, 'addCustomHeader')) {
         $this->listunsubscribe = true;
         $mailto = $this->params->get('listunsubscribeemail');
         if (empty($mailto)) {
             $mailto = @$email->replyemail;
         }
         if (empty($mailto)) {
             $mailto = $config->get('reply_email');
         }
         $email->addCustomHeader('List-Unsubscribe: <' . $myLink . '>, <mailto:' . $mailto . '?subject=unsubscribe_user_' . $user->subid . '&body=Please%20unsubscribe%20user%20ID%20' . $user->subid . '>');
     }
     if (empty($allresults[2][$i])) {
         return $myLink;
     }
     return '<a style="text-decoration:none;" target="_blank" href="' . $myLink . '"><span class="acymailing_unsub">' . $allresults[2][$i] . '</span></a>';
 }
Beispiel #6
0
 static function frontendLink($link, $popup = false)
 {
     return acymailing_frontendLink($link, $popup);
 }
Beispiel #7
0
 private function _replaceContent(&$tag)
 {
     $oldFormat = empty($tag->format);
     if (!ACYMAILING_J16) {
         $query = 'SELECT a.*,b.name as authorname, c.alias as catalias, c.title as cattitle, c.image AS catpict, s.alias as secalias, s.title as sectitle FROM ' . acymailing_table('content', false) . ' as a ';
         $query .= 'LEFT JOIN ' . acymailing_table('users', false) . ' as b ON a.created_by = b.id ';
         $query .= ' LEFT JOIN ' . acymailing_table('categories', false) . ' AS c ON c.id = a.catid ';
         $query .= ' LEFT JOIN ' . acymailing_table('sections', false) . ' AS s ON s.id = a.sectionid ';
         $query .= 'WHERE a.id = ' . $tag->id . ' LIMIT 1';
     } else {
         $query = 'SELECT a.*,b.name as authorname, c.alias as catalias, c.title as cattitle, c.params AS catparams FROM ' . acymailing_table('content', false) . ' as a ';
         $query .= 'LEFT JOIN ' . acymailing_table('users', false) . ' as b ON a.created_by = b.id ';
         $query .= ' LEFT JOIN ' . acymailing_table('categories', false) . ' AS c ON c.id = a.catid ';
         $query .= 'WHERE a.id = ' . $tag->id . ' LIMIT 1';
     }
     $this->db->setQuery($query);
     $article = $this->db->loadObject();
     if (empty($article)) {
         $app = JFactory::getApplication();
         if ($app->isAdmin()) {
             $app->enqueueMessage('The article "' . $tag->id . '" could not be loaded', 'notice');
         }
         return '';
     }
     if (empty($tag->lang) && !empty($this->newslanguage) && !empty($this->newslanguage->lang_code)) {
         $tag->lang = $this->newslanguage->lang_code . ',' . $this->newslanguage->lang_id;
     }
     $this->acypluginsHelper->translateItem($article, $tag, 'content');
     $varFields = array();
     foreach ($article as $fieldName => $oneField) {
         $varFields['{' . $fieldName . '}'] = $oneField;
     }
     $this->acypluginsHelper->cleanHtml($article->introtext);
     $this->acypluginsHelper->cleanHtml($article->fulltext);
     if ($this->params->get('integration') == 'jreviews' && !empty($article->images)) {
         $firstpict = explode('|', trim(reset(explode("\n", $article->images))) . '|||||||');
         if (!empty($firstpict[0])) {
             $picturePath = file_exists(ACYMAILING_ROOT . 'images' . DS . 'stories' . DS . str_replace('/', DS, $firstpict[0])) ? ACYMAILING_LIVE . 'images/stories/' . $firstpict[0] : ACYMAILING_LIVE . 'images/' . $firstpict[0];
             $myPict = '<img src="' . $picturePath . '" alt="" hspace="5" style="margin:5px" align="left" border="' . intval($firstpict[5]) . '" />';
             $article->introtext = $myPict . $article->introtext;
         }
     }
     $completeId = $article->id;
     $completeCat = $article->catid;
     if (!empty($article->alias)) {
         $completeId .= ':' . $article->alias;
     }
     if (!empty($article->catalias)) {
         $completeCat .= ':' . $article->catalias;
     }
     if (empty($tag->itemid)) {
         if (!ACYMAILING_J16) {
             $completeSec = $article->sectionid;
             if (!empty($article->secalias)) {
                 $completeSec .= ':' . $article->secalias;
             }
             if ($this->params->get('integration') == 'flexicontent' && class_exists('FlexicontentHelperRoute')) {
                 $link = FlexicontentHelperRoute::getItemRoute($completeId, $completeCat, $completeSec);
             } else {
                 $link = ContentHelperRoute::getArticleRoute($completeId, $completeCat, $completeSec);
             }
         } else {
             if ($this->params->get('integration') == 'flexicontent' && class_exists('FlexicontentHelperRoute')) {
                 $link = FlexicontentHelperRoute::getItemRoute($completeId, $completeCat);
             } else {
                 $link = ContentHelperRoute::getArticleRoute($completeId, $completeCat);
             }
         }
     } else {
         $link = 'index.php?option=com_content&view=article&id=' . $completeId . '&catid=' . $completeCat;
     }
     if ($this->params->get('integration') == 'flexicontent' && !class_exists('FlexicontentHelperRoute')) {
         $link = 'index.php?option=com_flexicontent&view=items&id=' . $completeId;
     } elseif ($this->params->get('integration') == 'jaggyblog') {
         $link = 'index.php?option=com_jaggyblog&task=viewpost&id=' . $completeId;
     }
     if (!empty($tag->itemid)) {
         $link .= '&Itemid=' . $tag->itemid;
     }
     if (!empty($tag->lang)) {
         $link .= (strpos($link, '?') ? '&' : '?') . 'lang=' . substr($tag->lang, 0, strpos($tag->lang, ','));
     }
     if (!empty($tag->autologin)) {
         $link .= (strpos($link, '?') ? '&' : '?') . 'user={usertag:username|urlencode}&passw={usertag:password|urlencode}';
     }
     if (empty($tag->lang) && !empty($article->language) && $article->language != '*') {
         if (!isset($this->langcodes[$article->language])) {
             $this->db->setQuery('SELECT sef FROM #__languages WHERE lang_code = ' . $this->db->Quote($article->language) . ' ORDER BY `published` DESC LIMIT 1');
             $this->langcodes[$article->language] = $this->db->loadResult();
             if (empty($this->langcodes[$article->language])) {
                 $this->langcodes[$article->language] = $article->language;
             }
         }
         $link .= (strpos($link, '?') ? '&' : '?') . 'lang=' . $this->langcodes[$article->language];
     }
     $link = acymailing_frontendLink($link);
     $varFields['{link}'] = $link;
     $afterTitle = '';
     $afterArticle = '';
     $contentText = '';
     $pictPath = '';
     if (!empty($tag->author)) {
         $authorName = empty($article->created_by_alias) ? $article->authorname : $article->created_by_alias;
         if ($tag->type == 'title') {
             $afterTitle .= '<br />';
         }
         $afterTitle .= '<span class="authorname">' . $authorName . '</span><br />';
     }
     $dateFormat = empty($tag->dateformat) ? JText::_('DATE_FORMAT_LC2') : $tag->dateformat;
     if (!empty($tag->created)) {
         if ($tag->type == 'title') {
             $afterTitle .= '<br />';
         }
         $varFields['{createddate}'] = JHTML::_('date', $article->created, $dateFormat);
         $afterTitle .= '<span class="createddate">' . $varFields['{createddate}'] . '</span><br />';
     }
     if (!empty($tag->modified)) {
         if ($tag->type == 'title') {
             $afterTitle .= '<br />';
         }
         $varFields['{modifieddate}'] = JHTML::_('date', $article->modified, $dateFormat);
         $afterTitle .= '<span class="modifieddate">' . $varFields['{modifieddate}'] . '</span><br />';
     }
     if (!isset($tag->pict) && $tag->type != 'title') {
         if ($this->params->get('removepictures', 'never') == 'always' || $this->params->get('removepictures', 'never') == 'intro' && $tag->type == "intro") {
             $tag->pict = 0;
         } else {
             $tag->pict = 1;
         }
     }
     if (strpos($article->introtext, 'jseblod') !== false && file_exists(ACYMAILING_ROOT . 'plugins' . DS . 'content' . DS . 'cckjseblod.php')) {
         global $mainframe;
         include_once ACYMAILING_ROOT . 'plugins' . DS . 'content' . DS . 'cckjseblod.php';
         if (function_exists('plgContentCCKjSeblod')) {
             $paramsContent = JComponentHelper::getParams('com_content');
             $article->text = $article->introtext . $article->fulltext;
             plgContentCCKjSeblod($article, $paramsContent);
             $article->introtext = $article->text;
             $article->fulltext = '';
         }
     }
     if ($tag->type != "title") {
         if ($tag->type == "intro") {
             $forceReadMore = false;
             $mytag = new stdClass();
             $mytag->wrap = $this->params->get('wordwrap', 0);
             if (empty($article->fulltext)) {
                 $article->introtext = $this->acypluginsHelper->wrapText($article->introtext, $mytag);
                 if (!empty($this->acypluginsHelper->wraped)) {
                     $forceReadMore = true;
                 }
             }
         }
         if (empty($article->fulltext) || $tag->type != "text") {
             $contentText .= $article->introtext;
         }
         if ($tag->type != "intro" && !empty($article->fulltext)) {
             if ($tag->type != "text" && !empty($article->introtext) && !preg_match('#^<[div|p]#i', trim($article->fulltext))) {
                 $contentText .= '<br />';
             }
             $contentText .= $article->fulltext;
         }
         $contentText = $this->acypluginsHelper->wrapText($contentText, $tag);
         if (!empty($this->acypluginsHelper->wraped)) {
             $forceReadMore = true;
         }
         if (!empty($tag->clean)) {
             $contentText = strip_tags($contentText, '<p><br><span><ul><li><h1><h2><h3><h4><a>');
         }
         if (ACYMAILING_J16 && !empty($article->images) && !empty($tag->pict)) {
             $picthtml = '';
             $images = json_decode($article->images);
             $pictVar = $tag->type == 'intro' ? 'image_intro' : 'image_fulltext';
             $floatVar = $tag->type == 'intro' ? 'float_intro' : 'float_fulltext';
             if (!empty($images->{$pictVar})) {
                 if ($images->{$floatVar} != 'right') {
                     if (empty($tag->format)) {
                         $tag->format = 'TOP_LEFT';
                     }
                     $images->{$floatVar} = 'left';
                 } elseif (empty($tag->format)) {
                     $tag->format = 'TOP_RIGHT';
                 }
                 $style = 'float:' . $images->{$floatVar} . ';padding-' . ($images->{$floatVar} == 'right' ? 'left' : 'right') . ':10px;padding-bottom:10px;';
                 if (!empty($tag->link) && empty($tag->nopictlink)) {
                     $picthtml .= '<a href="' . $link . '" style="text-decoration:none" >';
                 }
                 $alt = '';
                 $altVar = $pictVar . '_alt';
                 if (!empty($images->{$altVar})) {
                     $alt = $images->{$altVar};
                 }
                 $picthtml .= '<img' . (empty($tag->nopictstyle) ? ' style="' . $style . '"' : '') . ' alt="' . $alt . '" border="0" src="' . JURI::root() . $images->{$pictVar} . '" />';
                 $pictPath = JURI::root() . $images->{$pictVar};
                 if (!empty($tag->link) && empty($tag->nopictlink)) {
                     $picthtml .= '</a>';
                 }
                 $varFields['{picthtml}'] = $picthtml;
             }
         }
         $contentText = preg_replace('/^\\s*(<img[^>]*>)\\s*(?:<br[^>]*>\\s*)*/i', '$1', $contentText);
         if (file_exists(JPATH_SITE . DS . 'plugins' . DS . 'attachments') && empty($tag->noattach)) {
             try {
                 $query = 'SELECT display_name, url, filename ' . 'FROM #__attachments ' . 'WHERE (parent_entity = "article" ' . 'AND parent_id = ' . intval($tag->id) . ')';
                 if (ACYMAILING_J16) {
                     $query .= ' OR (parent_entity = "category" ' . 'AND parent_id = ' . intval($article->catid) . ')';
                 }
                 $this->db->setQuery($query);
                 $attachments = $this->db->loadObjectList();
             } catch (Exception $e) {
                 $attachments = array();
             }
             if (!empty($attachments)) {
                 $afterArticle .= '<br />' . JText::_('ATTACHED_FILES') . ' :';
                 foreach ($attachments as $oneAttachment) {
                     $afterArticle .= '<br /><a href="' . $oneAttachment->url . '">' . (empty($oneAttachment->display_name) ? $oneAttachment->filename : $oneAttachment->display_name) . '</a>';
                 }
             }
         }
         $readMoreText = empty($tag->readmore) ? $this->readmore : $tag->readmore;
         $varFields['{readmore}'] = '<a style="text-decoration:none;" target="_blank" href="' . $link . '"><span class="acymailing_readmore">' . $readMoreText . '</span></a>';
         if ($tag->type == "intro" && empty($tag->noreadmore) && (!empty($article->fulltext) || $forceReadMore)) {
             $contentText .= ' ' . $varFields['{readmore}'];
         }
         if (!empty($tag->share)) {
             $links = array();
             $shareOpt = explode(',', $tag->share);
             foreach ($shareOpt as $socialNetwork) {
                 $knownNetwork = true;
                 $socialNetwork = strtolower(trim($socialNetwork));
                 if ($socialNetwork == 'facebook') {
                     $linkShare = 'http://www.facebook.com/sharer.php?u=' . urlencode($link) . '&t=' . urlencode($article->title);
                     $picSrc = file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'facebook.png') ? 'media/com_acymailing/plugins/facebook.png' : 'media/com_acymailing/images/facebookshare.png';
                     $altText = 'Facebook';
                 } elseif ($socialNetwork == 'twitter') {
                     $text = JText::sprintf('SHARE_TEXT', $link);
                     $linkShare = 'http://twitter.com/home?status=' . urlencode($text);
                     $picSrc = file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'twitter.png') ? 'media/com_acymailing/plugins/twitter.png' : 'media/com_acymailing/images/twittershare.png';
                     $altText = 'Twitter';
                 } elseif ($socialNetwork == 'linkedin') {
                     $linkShare = 'http://www.linkedin.com/shareArticle?mini=true&url=' . urlencode($link) . '&title=' . urlencode($article->title);
                     $picSrc = file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'linkedin.png') ? 'media/com_acymailing/plugins/linkedin.png' : 'media/com_acymailing/images/linkedin.png';
                     $altText = 'LinkedIn';
                 } elseif ($socialNetwork == 'hyves') {
                     $linkShare = 'http://www.hyves-share.nl/button/respect/?hc_hint=1&url=' . urlencode($link) . '&title=' . urlencode($article->title);
                     $picSrc = file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'hyves.png') ? 'media/com_acymailing/plugins/hyves.png' : 'media/com_acymailing/images/hyvesshare.png';
                     $altText = 'Hyves';
                 } elseif ($socialNetwork == 'google') {
                     $linkShare = 'https://plus.google.com/share?url=' . urlencode($link);
                     $picSrc = file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'google.png') ? 'media/com_acymailing/plugins/google.png' : 'media/com_acymailing/images/google_plusshare.png';
                     $altText = 'Google+';
                 } elseif ($socialNetwork == 'mailto') {
                     $linkShare = 'mailto:?subject=' . urlencode($article->title) . '&body=' . urlencode($article->title . ' (' . $link . ')');
                     $picSrc = file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'mailto.png') ? 'media/com_acymailing/plugins/mailto.png' : 'media/com_acymailing/images/mailto.png';
                     $altText = 'MailTo';
                 } else {
                     $knownNetwork = false;
                     acymailing_display('Network not found: ' . $socialNetwork . '. Availables networks are facebook, twitter, linkedin, hyves, google and mailto.', 'warning');
                 }
                 if ($knownNetwork) {
                     array_push($links, '<a target="_blank" href="' . $linkShare . '" title="' . JText::sprintf('SOCIAL_SHARE', $altText) . '"><img alt="' . $altText . '" src="' . $picSrc . '" /></a>');
                 }
             }
             $afterArticle .= '<br />' . (!empty($tag->sharetxt) ? $tag->sharetxt . ' ' : '') . implode(' ', $links);
         }
     }
     if (!empty($tag->jtags) && version_compare(JVERSION, '3.1.0', '>=')) {
         $this->db->setQuery('SELECT t.id, t.alias, t.title FROM #__tags AS t JOIN #__contentitem_tag_map AS m ON t.id = m.tag_id WHERE t.published = 1 AND m.type_alias = "com_content.article" AND m.content_item_id = ' . intval($tag->id));
         $tags = $this->db->loadObjectList();
         if (!empty($tags)) {
             $afterArticle .= '<br />';
             foreach ($tags as $oneTag) {
                 $afterArticle .= ' <a href="index.php?option=com_tags&view=tag&id=' . $oneTag->id . '-' . $oneTag->alias . '">' . $oneTag->title . '</a> ';
             }
         }
     }
     $format = new stdClass();
     $format->tag = $tag;
     $format->title = empty($tag->notitle) ? $article->title : '';
     $format->afterTitle = $afterTitle;
     $format->afterArticle = $afterArticle;
     $format->imagePath = $pictPath;
     $format->description = $contentText;
     $format->link = empty($tag->link) ? '' : $link;
     $format->cols = 2;
     $result = $this->acypluginsHelper->getStandardDisplay($format);
     if (!empty($tag->theme)) {
         if (preg_match('#<img[^>]*>#Uis', $article->introtext . $article->fulltext, $pregresult)) {
             $cleanContent = strip_tags($result, '<p><br><span><ul><li><h1><h2><h3><h4><a>');
             $tdwidth = (empty($tag->maxwidth) ? $this->params->get('maxwidth', 150) : $tag->maxwidth) + 20;
             $result = '<table cellspacing="0" width="500" cellpadding="0" border="0" ><tr><td class="contentpicture" width="' . $tdwidth . '" valign="top" align="center"><a href="' . $link . '" target="_blank" style="border:0px;text-decoration:none">' . $pregresult[0] . '</a></td><td class="contenttext">' . $cleanContent . '</td></tr></table>';
         }
     }
     if ($tag->type != 'title') {
         $result = '<div class="acymailing_content">' . $result . '</div>';
     }
     if (!(empty($tag->cattitle) && empty($tag->catpict)) && (!strpos($article->catid, ',') && $this->currentcatid != $article->catid || strpos($article->catid, ',') && !in_array($this->currentcatid, explode(',', $article->catid)))) {
         if (strpos($article->catid, ',')) {
             $catids = explode(',', $article->catid);
             $this->currentcatid = $catids[0];
         } else {
             $this->currentcatid = $article->catid;
         }
         if (ACYMAILING_J16) {
             $params = json_decode($article->catparams);
             $article->catpict = $params->image;
         }
         $resultTitle = $article->cattitle;
         if (!empty($tag->catpict) && !empty($article->catpict)) {
             $style = '';
             if (!empty($tag->catmaxwidth)) {
                 $style .= 'max-width:' . intval($tag->catmaxwidth) . 'px;';
             }
             if (!empty($tag->catmaxheight)) {
                 $style .= 'max-height:' . intval($tag->catmaxheight) . 'px;';
             }
             $resultTitle = '<img' . (empty($style) ? '' : ' style="' . $style . '"') . ' alt="" src="' . $article->catpict . '" />';
             if (!empty($tag->cattitlelink)) {
                 $resultTitle = '<a href="index.php?option=com_content&view=category&id=' . $this->currentcatid . '">' . $resultTitle . '</a>';
             }
         } else {
             if (!empty($tag->cattitlelink)) {
                 $resultTitle = '<a href="index.php?option=com_content&view=category&id=' . $this->currentcatid . '">' . $resultTitle . '</a>';
             }
             $resultTitle = '<h3 class="cattitle">' . $resultTitle . '</h3>';
         }
         $result = $resultTitle . $result;
     }
     if ($oldFormat) {
         if (file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'tagcontent_html.php')) {
             ob_start();
             require ACYMAILING_MEDIA . 'plugins' . DS . 'tagcontent_html.php';
             $result = ob_get_clean();
         } elseif (file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'tagcontent.php')) {
             ob_start();
             require ACYMAILING_MEDIA . 'plugins' . DS . 'tagcontent.php';
             $result = ob_get_clean();
         }
     } elseif (!empty($tag->template) && file_exists(ACYMAILING_MEDIA . 'plugins' . DS . $tag->template)) {
         ob_start();
         require ACYMAILING_MEDIA . 'plugins' . DS . $tag->template;
         $result = ob_get_clean();
     }
     $result = str_replace(array_keys($varFields), $varFields, $result);
     $result = $this->acypluginsHelper->removeJS($result);
     $result = $this->acypluginsHelper->replaceVideos($result);
     $tag->maxheight = empty($tag->maxheight) ? $this->params->get('maxheight', 150) : $tag->maxheight;
     $tag->maxwidth = empty($tag->maxwidth) ? $this->params->get('maxwidth', 150) : $tag->maxwidth;
     $result = $this->acypluginsHelper->managePicts($tag, $result);
     if (!empty($tag->maxchar) && strlen(strip_tags($result)) > $tag->maxchar) {
         $result = strip_tags($result);
         for ($i = $tag->maxchar; $i > 0; $i--) {
             if ($result[$i] == ' ') {
                 break;
             }
         }
         if (!empty($i)) {
             $result = substr($result, 0, $i) . @$tag->textafter;
         }
     }
     return $result;
 }
Beispiel #8
0
 function acymailing_replaceusertags(&$email, &$user, $send = true)
 {
     $match = '#(?:{|%7B)(readonline|forward)([^}]*)(?:}|%7D)(.*)(?:{|%7B)/(readonline|forward)(?:}|%7D)#Uis';
     $variables = array('body', 'altbody');
     $found = false;
     foreach ($variables as $var) {
         if (empty($email->{$var})) {
             continue;
         }
         $found = preg_match_all($match, $email->{$var}, $results[$var]) || $found;
         if (empty($results[$var][0])) {
             unset($results[$var]);
         }
     }
     if (!$found) {
         return;
     }
     $config = acymailing_config();
     $tags = array();
     foreach ($results as $var => $allresults) {
         foreach ($allresults[0] as $i => $oneTag) {
             if (isset($tags[$oneTag])) {
                 continue;
             }
             $arguments = explode('|', strip_tags(str_replace('%7C', '|', $allresults[2][$i])));
             $tag = new stdClass();
             $tag->type = $allresults[1][$i];
             $tag->template = $tag->type == 'readonline' ? $this->params->get('viewtemplate', 'notemplate') : $this->params->get('forwardtemplate', 'notemplate');
             $tag->itemid = $config->get('itemid', 0);
             for ($j = 0, $a = count($arguments); $j < $a; $j++) {
                 $args = explode(':', $arguments[$j]);
                 $arg0 = trim($args[0]);
                 if (empty($arg0)) {
                     continue;
                 }
                 if (isset($args[1])) {
                     $tag->{$arg0} = $args[1];
                 } else {
                     $tag->{$arg0} = true;
                 }
             }
             $addkey = !empty($email->key) && $this->params->get('addkey', 'yes') == 'yes' ? '&key=' . $email->key : '';
             $adduserkey = !empty($user->key) && $this->params->get('adduserkey', 'yes') == 'yes' ? '&subid=' . $user->subid . '-' . $user->key : '';
             $tmpl = $tag->template == 'notemplate' ? '&tmpl=component' : '';
             $item = empty($tag->itemid) ? '' : '&Itemid=' . $tag->itemid;
             $lang = empty($email->language) ? '' : '&lang=' . $email->language;
             if ($tag->type == 'readonline') {
                 $link = acymailing_frontendLink('index.php?option=com_acymailing&ctrl=archive&task=view&mailid=' . $email->mailid . $addkey . $adduserkey . $tmpl . $item . $lang);
             } elseif ($tag->type == 'forward') {
                 $link = acymailing_frontendLink('index.php?option=com_acymailing&ctrl=archive&task=forward&mailid=' . $email->mailid . $addkey . $adduserkey . $tmpl . $item . $lang);
             }
             if (empty($allresults[3][$i])) {
                 $tags[$oneTag] = $link;
             } else {
                 $tags[$oneTag] = '<a style="text-decoration:none;" href="' . $link . '"><span class="acymailing_online">' . $allresults[3][$i] . '</span></a>';
             }
         }
     }
     $email->body = str_replace(array_keys($tags), $tags, $email->body);
     if (!empty($email->altbody)) {
         $email->altbody = str_replace(array_keys($tags), $tags, $email->altbody);
     }
 }
Beispiel #9
0
 private function _replaceContent(&$results, $i)
 {
     $acypluginsHelper = acymailing_get('helper.acyplugins');
     $tag = $acypluginsHelper->extractTag($results[1][$i]);
     $tag->id = intval($tag->id);
     if (!ACYMAILING_J16) {
         $query = 'SELECT a.*,b.name as authorname, c.alias as catalias, c.title as cattitle, s.alias as secalias, s.title as sectitle FROM ' . acymailing_table('content', false) . ' as a ';
         $query .= 'LEFT JOIN ' . acymailing_table('users', false) . ' as b ON a.created_by = b.id ';
         $query .= ' LEFT JOIN ' . acymailing_table('categories', false) . ' AS c ON c.id = a.catid ';
         $query .= ' LEFT JOIN ' . acymailing_table('sections', false) . ' AS s ON s.id = a.sectionid ';
         $query .= 'WHERE a.id = ' . $tag->id . ' LIMIT 1';
     } else {
         $query = 'SELECT a.*,b.name as authorname, c.alias as catalias, c.title as cattitle FROM ' . acymailing_table('content', false) . ' as a ';
         $query .= 'LEFT JOIN ' . acymailing_table('users', false) . ' as b ON a.created_by = b.id ';
         $query .= ' LEFT JOIN ' . acymailing_table('categories', false) . ' AS c ON c.id = a.catid ';
         $query .= 'WHERE a.id = ' . $tag->id . ' LIMIT 1';
     }
     $db = JFactory::getDBO();
     $db->setQuery($query);
     $article = $db->loadObject();
     $result = '';
     if (empty($article)) {
         $app = JFactory::getApplication();
         if ($app->isAdmin()) {
             $app->enqueueMessage('The article "' . $tag->id . '" could not be loaded', 'notice');
         }
         return $result;
     }
     if (!empty($tag->lang)) {
         $langid = (int) substr($tag->lang, strpos($tag->lang, ',') + 1);
         if (!empty($langid)) {
             $query = "SELECT reference_field, value FROM " . (ACYMAILING_J16 && file_exists(JPATH_SITE . DS . 'components' . DS . 'com_falang') ? '`#__falang_content`' : '`#__jf_content`') . " WHERE `published` = 1 AND `reference_table` = 'content' AND `language_id` = {$langid} AND `reference_id` = " . $tag->id;
             $db->setQuery($query);
             $translations = $db->loadObjectList();
             if (!empty($translations)) {
                 foreach ($translations as $oneTranslation) {
                     if (!empty($oneTranslation->value)) {
                         $translatedfield = $oneTranslation->reference_field;
                         $article->{$translatedfield} = $oneTranslation->value;
                     }
                 }
             }
         }
     }
     $acypluginsHelper = acymailing_get('helper.acyplugins');
     $acypluginsHelper->cleanHtml($article->introtext);
     $acypluginsHelper->cleanHtml($article->fulltext);
     if ($this->params->get('integration') == 'jreviews' and !empty($article->images)) {
         $firstpict = explode('|', trim(reset(explode("\n", $article->images))) . '|||||||');
         if (!empty($firstpict[0])) {
             $picturePath = file_exists(ACYMAILING_ROOT . 'images' . DS . 'stories' . DS . str_replace('/', DS, $firstpict[0])) ? ACYMAILING_LIVE . 'images/stories/' . $firstpict[0] : ACYMAILING_LIVE . 'images/' . $firstpict[0];
             $myPict = '<img src="' . $picturePath . '" alt="" hspace="5" style="margin:5px" align="left" border="' . intval($firstpict[5]) . '" />';
             $article->introtext = $myPict . $article->introtext;
         }
     }
     $completeId = $article->id;
     $completeCat = $article->catid;
     if (!empty($article->alias)) {
         $completeId .= ':' . $article->alias;
     }
     if (!empty($article->catalias)) {
         $completeCat .= ':' . $article->catalias;
     }
     if (empty($tag->itemid)) {
         if (!ACYMAILING_J16) {
             $completeSec = $article->sectionid;
             if (!empty($article->secalias)) {
                 $completeSec .= ':' . $article->secalias;
             }
             if ($this->params->get('integration') == 'flexicontent' && class_exists('FlexicontentHelperRoute')) {
                 $link = FlexicontentHelperRoute::getItemRoute($completeId, $completeCat, $completeSec);
             } else {
                 $link = ContentHelperRoute::getArticleRoute($completeId, $completeCat, $completeSec);
             }
         } else {
             if ($this->params->get('integration') == 'flexicontent' && class_exists('FlexicontentHelperRoute')) {
                 $link = FlexicontentHelperRoute::getItemRoute($completeId, $completeCat);
             } else {
                 $link = ContentHelperRoute::getArticleRoute($completeId, $completeCat);
             }
         }
     } else {
         $link = 'index.php?option=com_content&view=article&id=' . $completeId . '&catid=' . $completeCat;
     }
     if ($this->params->get('integration') == 'flexicontent' && !class_exists('FlexicontentHelperRoute')) {
         $link = 'index.php?option=com_flexicontent&view=items&id=' . $completeId;
     } elseif ($this->params->get('integration') == 'jaggyblog') {
         $link = 'index.php?option=com_jaggyblog&task=viewpost&id=' . $completeId;
     }
     if (!empty($tag->itemid)) {
         $link .= '&Itemid=' . $tag->itemid;
     }
     if (!empty($tag->lang)) {
         $link .= (strpos($link, '?') ? '&' : '?') . 'lang=' . substr($tag->lang, 0, strpos($tag->lang, ','));
     }
     if (!empty($tag->autologin)) {
         $link .= (strpos($link, '?') ? '&' : '?') . 'user={usertag:username|urlencode}&passw={usertag:password|urlencode}';
     }
     if (empty($tag->lang) && !empty($article->language) && $article->language != '*') {
         if (!isset($this->langcodes[$article->language])) {
             $db->setQuery('SELECT sef FROM #__languages WHERE lang_code = ' . $db->Quote($article->language) . ' ORDER BY `published` DESC LIMIT 1');
             $this->langcodes[$article->language] = $db->loadResult();
             if (empty($this->langcodes[$article->language])) {
                 $this->langcodes[$article->language] = $article->language;
             }
         }
         $link .= (strpos($link, '?') ? '&' : '?') . 'lang=' . $this->langcodes[$article->language];
     }
     $link = acymailing_frontendLink($link);
     $styleTitle = '';
     $styleTitleEnd = '';
     if ($tag->type != "title") {
         $styleTitle = '<h2 class="acymailing_title">';
         $styleTitleEnd = '</h2>';
     }
     if (empty($tag->notitle)) {
         if (!empty($tag->link)) {
             $result .= '<a href="' . $link . '" ';
             if ($tag->type != "title") {
                 $result .= 'style="text-decoration:none" name="content-' . $article->id . '" ';
             }
             $result .= 'target="_blank" >' . $styleTitle . $article->title . $styleTitleEnd . '</a>';
         } else {
             $result .= $styleTitle . $article->title . $styleTitleEnd;
         }
     }
     if (!empty($tag->author)) {
         $authorName = empty($article->created_by_alias) ? $article->authorname : $article->created_by_alias;
         if ($tag->type == 'title') {
             $result .= '<br/>';
         }
         $result .= '<span class="authorname">' . $authorName . '</span><br/>';
     }
     if (!empty($tag->created)) {
         if ($tag->type == 'title') {
             $result .= '<br/>';
         }
         $dateFormat = empty($tag->dateformat) ? JText::_('DATE_FORMAT_LC2') : $tag->dateformat;
         $result .= '<span class="createddate">' . JHTML::_('date', $article->created, $dateFormat) . '</span><br/>';
     }
     if (!isset($tag->pict) and $tag->type != 'title') {
         if ($this->params->get('removepictures', 'never') == 'always' || ($this->params->get('removepictures', 'never') == 'intro' and $tag->type == "intro")) {
             $tag->pict = 0;
         } else {
             $tag->pict = 1;
         }
     }
     if (strpos($article->introtext, 'jseblod') !== false and file_exists(ACYMAILING_ROOT . 'plugins' . DS . 'content' . DS . 'cckjseblod.php')) {
         global $mainframe;
         include_once ACYMAILING_ROOT . 'plugins' . DS . 'content' . DS . 'cckjseblod.php';
         if (function_exists('plgContentCCKjSeblod')) {
             $paramsContent = JComponentHelper::getParams('com_content');
             $article->text = $article->introtext . $article->fulltext;
             plgContentCCKjSeblod($article, $paramsContent);
             $article->introtext = $article->text;
             $article->fulltext = '';
         }
     }
     if ($tag->type != "title") {
         $contentText = '';
         if ($tag->type == "intro") {
             $forceReadMore = false;
             $wordwrap = $this->params->get('wordwrap', 0);
             if (!empty($wordwrap) and empty($article->fulltext)) {
                 $tagToKeep = '<br>';
                 if (!isset($tag->pict) || $tag->pict != '0') {
                     $tagToKeep .= '<img>';
                 }
                 $newintrotext = strip_tags($article->introtext, $tagToKeep);
                 $numChar = strlen($newintrotext);
                 if ($numChar > $wordwrap) {
                     $stop = strlen($newintrotext);
                     for ($i = $wordwrap; $i < $numChar; $i++) {
                         if ($newintrotext[$i] == " ") {
                             $stop = $i;
                             $forceReadMore = true;
                             break;
                         }
                     }
                     $article->introtext = substr($newintrotext, 0, $stop) . '...';
                 }
             }
         }
         if (empty($article->fulltext) or $tag->type != "text") {
             $contentText .= $article->introtext;
         }
         if ($tag->type != "intro" and !empty($article->fulltext)) {
             if ($tag->type != "text" && !empty($article->introtext) && !preg_match('#^<[div|p]#i', trim($article->fulltext))) {
                 $contentText .= '<br />';
             }
             $contentText .= $article->fulltext;
         }
         $contentText = $acypluginsHelper->wrapText($contentText, $tag);
         if (!empty($tag->clean)) {
             $contentText = strip_tags($contentText, '<p><br><span><ul><li><h1><h2><h3><h4><a>');
         }
         if (ACYMAILING_J16 && !empty($article->images) && !empty($tag->pict)) {
             $picthtml = '';
             $images = json_decode($article->images);
             $pictVar = $tag->type == 'intro' ? 'image_intro' : 'image_fulltext';
             $floatVar = $tag->type == 'intro' ? 'float_intro' : 'float_fulltext';
             if (!empty($images->{$pictVar})) {
                 if ($images->{$floatVar} != 'right') {
                     $images->{$floatVar} = 'left';
                 }
                 $style = 'float:' . $images->{$floatVar} . ';padding-' . ($images->{$floatVar} == 'right' ? 'left' : 'right') . ':10px;padding-bottom:10px;';
                 if (!empty($tag->link)) {
                     $picthtml .= '<a href="' . $link . '" style="text-decoration:none" >';
                 }
                 $alt = '';
                 $altVar = $pictVar . '_alt';
                 if (!empty($images->{$altVar})) {
                     $alt = $images->{$altVar};
                 }
                 $picthtml .= '<img style="' . $style . '" alt="' . $alt . '" border="0" src="' . JURI::root() . $images->{$pictVar} . '" />';
                 if (!empty($tag->link)) {
                     $picthtml .= '</a>';
                 }
                 $contentText = $picthtml . $contentText;
             }
         }
         $result .= $contentText;
         if (file_exists(JPATH_SITE . DS . 'plugins' . DS . 'attachments') && empty($tag->noattach)) {
             $db->setQuery('SELECT display_name, url, filename FROM #__attachments WHERE parent_id = ' . intval($tag->id));
             $attachments = $db->loadObjectList();
             if (!empty($attachments)) {
                 $result .= '<br/>' . JText::_('ATTACHED_FILES') . ' :';
                 foreach ($attachments as $oneAttachment) {
                     $result .= '<br/><a href="' . $oneAttachment->url . '">' . (empty($oneAttachment->display_name) ? $oneAttachment->filename : $oneAttachment->display_name) . '</a>';
                 }
             }
         }
         if ($tag->type == "intro") {
             if (empty($tag->noreadmore) and (!empty($article->fulltext) or $forceReadMore)) {
                 $readMoreText = empty($tag->readmore) ? $this->readmore : $tag->readmore;
                 $result .= '<a style="text-decoration:none;" target="_blank" href="' . $link . '"><span class="acymailing_readmore">' . $readMoreText . '</span></a>';
             }
         }
         if (!empty($tag->share)) {
             $links = array();
             $shareOpt = explode(',', $tag->share);
             foreach ($shareOpt as $socialNetwork) {
                 $knownNetwork = true;
                 $socialNetwork = strtolower(trim($socialNetwork));
                 if ($socialNetwork == 'facebook') {
                     $linkShare = 'http://www.facebook.com/sharer.php?u=' . urlencode($link) . '&t=' . urlencode($article->title);
                     $picSrc = file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'facebook.png') ? 'media/com_acymailing/plugins/facebook.png' : 'media/com_acymailing/images/facebookshare.png';
                     $altText = 'Facebook';
                 } elseif ($socialNetwork == 'twitter') {
                     $text = JText::sprintf('SHARE_TEXT', $link);
                     $linkShare = 'http://twitter.com/home?status=' . urlencode($text);
                     $picSrc = file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'twitter.png') ? 'media/com_acymailing/plugins/twitter.png' : 'media/com_acymailing/images/twittershare.png';
                     $altText = 'Twitter';
                 } elseif ($socialNetwork == 'linkedin') {
                     $linkShare = 'http://www.linkedin.com/shareArticle?mini=true&url=' . urlencode($link) . '&title=' . urlencode($article->title);
                     $picSrc = file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'linkedin.png') ? 'media/com_acymailing/plugins/linkedin.png' : 'media/com_acymailing/images/linkedin.png';
                     $altText = 'LinkedIn';
                 } elseif ($socialNetwork == 'hyves') {
                     $linkShare = 'http://www.hyves-share.nl/button/respect/?hc_hint=1&url=' . urlencode($link) . '&title=' . urlencode($article->title);
                     $picSrc = file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'hyves.png') ? 'media/com_acymailing/plugins/hyves.png' : 'media/com_acymailing/images/hyvesshare.png';
                     $altText = 'Hyves';
                 } elseif ($socialNetwork == 'google') {
                     $linkShare = 'https://plus.google.com/share?url=' . urlencode($link);
                     $picSrc = file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'google.png') ? 'media/com_acymailing/plugins/google.png' : 'media/com_acymailing/images/google_plusshare.png';
                     $altText = 'Google+';
                 } elseif ($socialNetwork == 'mailto') {
                     $linkShare = 'mailto:?subject=' . urlencode($article->title) . '&body=' . urlencode($article->title . ' (' . $link . ')');
                     $picSrc = file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'mailto.png') ? 'media/com_acymailing/plugins/mailto.png' : 'media/com_acymailing/images/mailto.png';
                     $altText = 'MailTo';
                 } else {
                     $knownNetwork = false;
                     acymailing_display('Network not found: ' . $socialNetwork . '. Availables networks are facebook, twitter, linkedin, hyves, google and mailto.', 'warning');
                 }
                 if ($knownNetwork) {
                     array_push($links, '<a target="_blank" href="' . $linkShare . '" title="' . JText::sprintf('SOCIAL_SHARE', $altText) . '"><img alt="' . $altText . '" src="' . $picSrc . '" /></a>');
                 }
             }
             $result .= '<br/>' . (!empty($tag->sharetxt) ? $tag->sharetxt . ' ' : '') . implode(' ', $links);
         }
         $result = '<table cellspacing="0" cellpadding="0" border="0" width="100%"><tr><td class="cat_' . @$article->catid . '" ><div class="acymailing_content" style="clear:both" >' . $result . '</div></td></tr></table>';
     }
     if (!empty($tag->theme)) {
         if (preg_match('#<img[^>]*>#Uis', $article->introtext . $article->fulltext, $pregresult)) {
             $cleanContent = strip_tags($result, '<p><br><span><ul><li><h1><h2><h3><h4><a>');
             $tdwidth = (empty($tag->maxwidth) ? $this->params->get('maxwidth', 150) : $tag->maxwidth) + 20;
             $result = '<div class="acymailing_content" style="clear:both"><table cellspacing="0" width="500" cellpadding="0" border="0" ><tr><td class="contentpicture" width="' . $tdwidth . '" valign="top" align="center"><a href="' . $link . '" target="_blank" style="border:0px;text-decoration:none">' . $pregresult[0] . '</a></td><td class="contenttext">' . $cleanContent . '</td></tr></table></div>';
         }
     }
     if (!empty($tag->cattitle) && $this->currentcatid != $article->catid) {
         $this->currentcatid = $article->catid;
         $result = '<h3 class="cattitle">' . $article->cattitle . '</h3>' . $result;
     }
     if (file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'tagcontent_html.php')) {
         ob_start();
         require ACYMAILING_MEDIA . 'plugins' . DS . 'tagcontent_html.php';
         $result = ob_get_clean();
     } elseif (file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'tagcontent.php')) {
         ob_start();
         require ACYMAILING_MEDIA . 'plugins' . DS . 'tagcontent.php';
         $result = ob_get_clean();
     }
     $result = $acypluginsHelper->removeJS($result);
     if (isset($tag->pict)) {
         $pictureHelper = acymailing_get('helper.acypict');
         $pictureHelper->maxHeight = empty($tag->maxheight) ? $this->params->get('maxheight', 150) : $tag->maxheight;
         $pictureHelper->maxWidth = empty($tag->maxwidth) ? $this->params->get('maxwidth', 150) : $tag->maxwidth;
         if ($tag->pict == '0') {
             $result = $pictureHelper->removePictures($result);
         } elseif ($tag->pict == 'resized') {
             if ($pictureHelper->available()) {
                 $result = $pictureHelper->resizePictures($result);
             } elseif ($app->isAdmin()) {
                 $app->enqueueMessage($pictureHelper->error, 'notice');
             }
         }
     }
     if (!empty($tag->maxchar) && strlen(strip_tags($result)) > $tag->maxchar) {
         $result = strip_tags($result);
         for ($i = $tag->maxchar; $i > 0; $i--) {
             if ($result[$i] == ' ') {
                 break;
             }
         }
         if (!empty($i)) {
             $result = substr($result, 0, $i) . @$tag->textafter;
         }
     }
     return $result;
 }
Beispiel #10
0
        echo "row{$k}";
        ?>
">
									<td align="center" style="text-align:center">
										<?php 
        echo $i + 1;
        ?>
									</td>
									<td>
										<?php 
        echo acymailing_getDate($row->senddate);
        ?>
									</td>
									<td>
										<?php 
        $link = acymailing_frontendLink('index.php?option=com_acymailing&ctrl=archive&task=view&subid=' . $this->subscriber->subid . '-' . $this->subscriber->key . '&mailid=' . $row->mailid . '-' . strip_tags($row->alias), (bool) $this->config->get('open_popup', 1));
        echo '<a ' . ($this->config->get('open_popup', 1) ? 'class="modal" rel="{handler: \'iframe\', size: {x: ' . $width . ', y: ' . $height . '}}"' : '') . ' href="' . $link . '">' . $row->subject . '</a>';
        ?>
									</td>
									<td align="center" style="text-align:center">
										<?php 
        echo $row->html ? JText::_('HTML') : JText::_('JOOMEXT_TEXT');
        ?>
									</td>
									<td align="center" style="text-align:center">
										<?php 
        echo $row->open;
        ?>
									</td>
									<td align="center" style="text-align:center">
										<?php 
Beispiel #11
0
    function _replaceProduct($tag, &$email)
    {
        if (empty($tag->lang) && !empty($email->language)) {
            $tag->lang = $email->language;
        }
        $this->db->setQuery('SELECT b.*,a.*
						FROM ' . acymailing_table('hikashop_product', false) . ' as a
						LEFT JOIN ' . acymailing_table('hikashop_file', false) . ' as b ON a.product_id=b.file_ref_id AND file_type=\'product\'
						WHERE a.product_id = ' . $tag->id . '
						ORDER BY b.file_ordering ASC, b.file_id ASC
						LIMIT 1');
        $product = $this->db->loadObject();
        if (empty($product)) {
            $app = JFactory::getApplication();
            if ($app->isAdmin()) {
                $app->enqueueMessage('The product "' . $tag->id . '" could not be loaded', 'notice');
            }
            return '';
        }
        if ($product->product_type == 'variant') {
            $this->db->setQuery('SELECT * FROM ' . hikashop_table('variant') . ' AS a LEFT JOIN ' . hikashop_table('characteristic') . ' AS b ON a.variant_characteristic_id=b.characteristic_id WHERE a.variant_product_id=' . (int) $tag->id . ' ORDER BY a.ordering');
            $product->characteristics = $this->db->loadObjectList();
            $productClass = hikashop_get('class.product');
            $this->db->setQuery('SELECT b.*,a.*
							FROM ' . acymailing_table('hikashop_product', false) . ' as a
							LEFT JOIN ' . acymailing_table('hikashop_file', false) . ' as b ON a.product_id=b.file_ref_id AND file_type=\'product\'
							WHERE a.product_id = ' . (int) $product->product_parent_id . '
							ORDER BY b.file_ordering ASC, b.file_id ASC
							LIMIT 1');
            $parentProduct = $this->db->loadObject();
            $productClass->checkVariant($product, $parentProduct);
        }
        $varFields = array();
        foreach ($product as $fieldName => $oneField) {
            $varFields['{' . $fieldName . '}'] = $oneField;
        }
        $translationHelper = hikashop_get('helper.translation');
        if ($translationHelper->isMulti(true, false)) {
            $this->acypluginsHelper->translateItem($product, $tag, 'hikashop_product');
        }
        $tag->itemid = intval($this->params->get('itemid'));
        $config =& hikashop_config();
        $currencyClass = hikashop_get('class.currency');
        $main_currency = $currency_id = (int) $config->get('main_currency', 1);
        $zone_id = explode(',', $config->get('main_tax_zone', 0));
        $zone_id = count($zone_id) ? array_shift($zone_id) : 0;
        $ids = array($product->product_id);
        $discount_before_tax = (int) $config->get('discount_before_tax', 0);
        $currencyClass->getPrices($product, $ids, $currency_id, $main_currency, $zone_id, $discount_before_tax);
        $finalPrice = '';
        if (empty($tag->price) || $tag->price == 'full') {
            if ($this->params->get('vat', 1)) {
                $finalPrice = @$currencyClass->format($product->prices[0]->price_value_with_tax, $product->prices[0]->price_currency_id);
            } else {
                $finalPrice = $currencyClass->format($product->prices[0]->price_value, $product->prices[0]->price_currency_id);
            }
            if (!empty($product->discount)) {
                if ($this->params->get('vat', 1)) {
                    $finalPrice = '<strike>' . $currencyClass->format($product->prices[0]->price_value_without_discount_with_tax, $product->prices[0]->price_currency_id) . '</strike> ' . $finalPrice;
                } else {
                    $finalPrice = '<strike>' . $currencyClass->format($product->prices[0]->price_value_without_discount, $product->prices[0]->price_currency_id) . '</strike> ' . $finalPrice;
                }
            }
        } elseif ($tag->price == 'no_discount') {
            if ($this->params->get('vat', 1)) {
                $finalPrice = $currencyClass->format($product->prices[0]->price_value_without_discount_with_tax, $product->prices[0]->price_currency_id);
            } else {
                $finalPrice = $currencyClass->format($product->prices[0]->price_value_without_discount, $product->prices[0]->price_currency_id);
            }
        }
        $varFields['{finalPrice}'] = $finalPrice;
        if (empty($tag->type) || $tag->type == 'full') {
            $description = $product->product_description;
        } else {
            $pos = strpos($product->product_description, '<hr id="system-readmore"');
            if ($pos !== false) {
                $description = substr($product->product_description, 0, $pos);
            } else {
                $description = substr($product->product_description, 0, 100) . '...';
            }
        }
        $link = 'index.php?option=com_hikashop&ctrl=product&task=show&cid=' . $product->product_id;
        if (!empty($tag->lang)) {
            $link .= '&lang=' . substr($tag->lang, 0, strpos($tag->lang, ','));
        }
        if (!empty($tag->itemid)) {
            $link .= '&Itemid=' . $tag->itemid;
        }
        $link = acymailing_frontendLink($link);
        $varFields['{link}'] = $link;
        $image = hikashop_get('helper.image');
        if (!empty($product->file_path)) {
            $varFields['{pictHTML}'] = $image->display($product->file_path, false, $product->product_name);
        }
        if (file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'hikashop_product.php')) {
            ob_start();
            require ACYMAILING_MEDIA . 'plugins' . DS . 'hikashop_product.php';
            $result = ob_get_clean();
            $result = str_replace(array_keys($varFields), $varFields, $result);
            return $result;
        }
        $result = '';
        $astyle = '';
        if (empty($tag->type) || $tag->type != 'title') {
            $result .= '<div class="acymailing_product">';
            $astyle = 'style="text-decoration:none;" name="product-' . $product->product_id . '"';
        }
        $result .= '<a ' . $astyle . ' target="_blank" href="' . $link . '">';
        if (empty($tag->type) || $tag->type != 'title') {
            $result .= '<h2 class="acymailing_title">';
        }
        $result .= $product->product_name;
        if (!empty($finalPrice)) {
            $result .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $finalPrice;
        }
        if (empty($tag->type) || $tag->type != 'title') {
            $result .= '</h2>';
        }
        $result .= '</a>';
        if (empty($tag->type) || $tag->type != 'title') {
            if (!empty($product->file_path)) {
                $config =& hikashop_config();
                $uploadFolder = ltrim(JPath::clean(html_entity_decode($config->get('uploadfolder'))), DS);
                $uploadFolder = rtrim($uploadFolder, DS) . DS;
                $image->uploadFolder_url = str_replace(DS, '/', $uploadFolder);
                $image->uploadFolder_url = ACYMAILING_LIVE . $image->uploadFolder_url;
                $pictureHTML = $image->display($product->file_path, false, $product->product_name, '', '', $config->get('thumbnail_x', 100), $config->get('thumbnail_y', 100));
                $pictureHTML = '<a target="_blank" style="text-decoration:none;border:0" href="' . $link . '" >' . $pictureHTML . '</a>';
                $result .= '<table class="acymailing_content"><tr><td valign="top" style="padding-right:5px">' . $pictureHTML . '</td><td>' . $description . '</td></tr></table>';
            } else {
                $result .= $description;
            }
        }
        if (empty($tag->type) || $tag->type != 'title') {
            $result .= '</div>';
        }
        $result = $this->acypluginsHelper->removeJS($result);
        return $result;
    }
Beispiel #12
0
	function getUrl($url,$mailid,$subid){
		static $allurls;

		$url = str_replace('&amp;','&',$url);
		if(empty($allurls[$url])){
			$currentURL = $this->getAdd($url);
			$allurls[$url] = $currentURL;
		}else{
			$currentURL = $allurls[$url];
		}

		$config = acymailing_config();
		$itemId = $config->get('itemid',0);
		$item = empty($itemId) ? '' : '&Itemid='.$itemId;

		if(empty($currentURL->urlid)) return;
		return str_replace('&amp;','&',acymailing_frontendLink('index.php?subid='.$subid.'&option=com_acymailing&ctrl=url&urlid='.$currentURL->urlid.'&mailid='.$mailid.$item));

	}
 function _replaceContent(&$results, $i)
 {
     $arguments = explode('|', strip_tags($results[1][$i]));
     $tag = new stdClass();
     $tag->id = (int) $arguments[0];
     for ($i = 1, $a = count($arguments); $i < $a; $i++) {
         $args = explode(':', $arguments[$i]);
         $arg0 = trim($args[0]);
         if (isset($args[1])) {
             $tag->{$arg0} = $args[1];
         } else {
             $tag->{$arg0} = true;
         }
     }
     if (version_compare(JVERSION, '1.6.0', '<')) {
         $query = 'SELECT a.*,b.name as authorname, c.alias as catalias, c.title as cattitle, s.alias as secalias, s.title as sectitle FROM ' . acymailing_table('content', false) . ' as a ';
         $query .= 'LEFT JOIN ' . acymailing_table('users', false) . ' as b ON a.created_by = b.id ';
         $query .= ' LEFT JOIN ' . acymailing_table('categories', false) . ' AS c ON c.id = a.catid ';
         $query .= ' LEFT JOIN ' . acymailing_table('sections', false) . ' AS s ON s.id = a.sectionid ';
         $query .= 'WHERE a.id = ' . $tag->id . ' LIMIT 1';
     } else {
         $query = 'SELECT a.*,b.name as authorname, c.alias as catalias, c.title as cattitle FROM ' . acymailing_table('content', false) . ' as a ';
         $query .= 'LEFT JOIN ' . acymailing_table('users', false) . ' as b ON a.created_by = b.id ';
         $query .= ' LEFT JOIN ' . acymailing_table('categories', false) . ' AS c ON c.id = a.catid ';
         $query .= 'WHERE a.id = ' . $tag->id . ' LIMIT 1';
     }
     $db =& JFactory::getDBO();
     $db->setQuery($query);
     $article = $db->loadObject();
     $result = '';
     if (empty($article)) {
         $app =& JFactory::getApplication();
         if ($app->isAdmin()) {
             $app->enqueueMessage('The article "' . $tag->id . '" could not be loaded', 'notice');
         }
         return $result;
     }
     if (!empty($tag->lang)) {
         $langid = (int) substr($tag->lang, strpos($tag->lang, ',') + 1);
         if (!empty($langid)) {
             $query = "SELECT reference_field, value FROM `#__jf_content` WHERE `published` = 1 AND `reference_table` = 'content' AND `language_id` = {$langid} AND `reference_id` = " . $tag->id;
             $db->setQuery($query);
             $translations = $db->loadObjectList();
             if (!empty($translations)) {
                 foreach ($translations as $oneTranslation) {
                     if (!empty($oneTranslation->value)) {
                         $translatedfield = $oneTranslation->reference_field;
                         $article->{$translatedfield} = $oneTranslation->value;
                     }
                 }
             }
         }
     }
     if ($this->params->get('integration') == 'jreviews' and !empty($article->images)) {
         $firstpict = explode('|', trim(reset(explode("\n", $article->images))) . '|||||||');
         if (!empty($firstpict[0])) {
             $myPict = '<img src="' . ACYMAILING_LIVE . 'images/stories/' . $firstpict[0] . '" hspace="5" style="margin:5px" align="left" border="' . intval($firstpict[5]) . '" />';
             $article->introtext = $myPict . $article->introtext;
         }
     }
     $completeId = $article->id;
     $completeCat = $article->catid;
     if (!empty($article->alias)) {
         $completeId .= ':' . $article->alias;
     }
     if (!empty($article->catalias)) {
         $completeCat .= ':' . $article->catalias;
     }
     if (empty($tag->itemid)) {
         if (version_compare(JVERSION, '1.6.0', '<')) {
             $completeSec = $article->sectionid;
             if (!empty($article->secalias)) {
                 $completeSec .= ':' . $article->secalias;
             }
             if ($this->params->get('integration') == 'flexicontent' && class_exists('FlexicontentHelperRoute')) {
                 $link = FlexicontentHelperRoute::getItemRoute($completeId, $completeCat, $completeSec);
             } else {
                 $link = ContentHelperRoute::getArticleRoute($completeId, $completeCat, $completeSec);
             }
         } else {
             if ($this->params->get('integration') == 'flexicontent' && class_exists('FlexicontentHelperRoute')) {
                 $link = FlexicontentHelperRoute::getItemRoute($completeId, $completeCat);
             } else {
                 $link = ContentHelperRoute::getArticleRoute($completeId, $completeCat);
             }
         }
     } else {
         $link = 'index.php?option=com_content&view=article&id=' . $completeId . '&catid=' . $completeCat;
     }
     if ($this->params->get('integration') == 'flexicontent' && !class_exists('FlexicontentHelperRoute')) {
         $link = 'index.php?option=com_flexicontent&view=items&id=' . $completeId;
     } elseif ($this->params->get('integration') == 'jaggyblog') {
         $link = 'index.php?option=com_jaggyblog&task=viewpost&id=' . $completeId;
     }
     if (!empty($tag->itemid)) {
         $link .= '&Itemid=' . $tag->itemid;
     }
     if (!empty($tag->lang)) {
         $link .= (strpos($link, '?') ? '&' : '?') . 'lang=' . substr($tag->lang, 0, strpos($tag->lang, ','));
     }
     if (!empty($tag->autologin)) {
         $link .= (strpos($link, '?') ? '&' : '?') . 'user={usertag:username|urlencode}&passw={usertag:password|urlencode}';
     }
     $link = acymailing_frontendLink($link);
     $styleTitle = '';
     $styleTitleEnd = '';
     if ($tag->type != "title") {
         $styleTitle = '<h2 class="acymailing_title">';
         $styleTitleEnd = '</h2>';
     }
     if (empty($tag->notitle)) {
         if (!empty($tag->link)) {
             $result .= '<a href="' . $link . '" ';
             if ($tag->type != "title") {
                 $result .= 'style="text-decoration:none" name="content-' . $article->id . '" ';
             }
             $result .= 'target="_blank" >' . $styleTitle . $article->title . $styleTitleEnd . '</a>';
         } else {
             $result .= $styleTitle . $article->title . $styleTitleEnd;
         }
     }
     if (!empty($tag->author)) {
         $authorName = empty($article->created_by_alias) ? $article->authorname : $article->created_by_alias;
         if ($tag->type == 'title') {
             $result .= '<br/>';
         }
         $result .= '<span class="authorname">' . $authorName . '</span><br/>';
     }
     if (!empty($tag->created)) {
         if ($tag->type == 'title') {
             $result .= '<br/>';
         }
         $dateFormat = empty($tag->dateformat) ? JText::_('DATE_FORMAT_LC2') : $tag->dateformat;
         $result .= '<span class="createddate">' . JHTML::_('date', $article->created, $dateFormat) . '</span><br/>';
     }
     if (!isset($tag->pict) and $tag->type != 'title') {
         if ($this->params->get('removepictures', 'never') == 'always' || ($this->params->get('removepictures', 'never') == 'intro' and $tag->type == "intro")) {
             $tag->pict = 0;
         } else {
             $tag->pict = 1;
         }
     }
     if (strpos($article->introtext, 'jseblod') !== false and file_exists(ACYMAILING_ROOT . 'plugins' . DS . 'content' . DS . 'cckjseblod.php')) {
         global $mainframe;
         include_once ACYMAILING_ROOT . 'plugins' . DS . 'content' . DS . 'cckjseblod.php';
         if (function_exists('plgContentCCKjSeblod')) {
             $paramsContent =& JComponentHelper::getParams('com_content');
             $article->text = $article->introtext . $article->fulltext;
             plgContentCCKjSeblod($article, $paramsContent);
             $article->introtext = $article->text;
             $article->fulltext = '';
         }
     }
     if ($tag->type != "title") {
         $contentText = '';
         if ($tag->type == "intro") {
             $forceReadMore = false;
             $wordwrap = $this->params->get('wordwrap', 0);
             if (!empty($wordwrap) and empty($article->fulltext)) {
                 $newintrotext = strip_tags($article->introtext, '<br><img>');
                 $numChar = strlen($newintrotext);
                 if ($numChar > $wordwrap) {
                     $stop = strlen($newintrotext);
                     for ($i = $wordwrap; $i < $numChar; $i++) {
                         if ($newintrotext[$i] == " ") {
                             $stop = $i;
                             $forceReadMore = true;
                             break;
                         }
                     }
                     $article->introtext = substr($newintrotext, 0, $stop) . '...';
                 }
             }
         }
         if (empty($article->fulltext) or $tag->type != "text") {
             $contentText .= $article->introtext;
         }
         if ($tag->type != "intro" and !empty($article->fulltext)) {
             if ($tag->type != "text" && !empty($article->introtext)) {
                 $contentText .= '<br />';
             }
             $contentText .= $article->fulltext;
         }
         if (!empty($tag->wrap)) {
             $newtext = strip_tags($contentText, '<br><img>');
             $numChar = strlen($newtext);
             if ($numChar > $tag->wrap) {
                 $stop = strlen($newtext);
                 for ($i = $tag->wrap; $i < $numChar; $i++) {
                     if ($newtext[$i] == " ") {
                         $stop = $i;
                         $forceReadMore = true;
                         break;
                     }
                 }
                 $contentText = substr($newtext, 0, $stop) . '...';
             }
         }
         $result .= $contentText;
         if ($tag->type == "intro") {
             if (empty($tag->noreadmore) and (!empty($article->fulltext) or $forceReadMore)) {
                 $readMoreText = empty($tag->readmore) ? JText::_('JOOMEXT_READ_MORE') : $tag->readmore;
                 $result .= '<a style="text-decoration:none;" target="_blank" href="' . $link . '"><span class="acymailing_readmore">' . $readMoreText . '</span></a>';
             }
         }
         $result = '<div class="acymailing_content">' . $result . '</div>';
     }
     if (!empty($tag->theme)) {
         if (preg_match('#<img[^>]*>#Uis', $article->introtext . $article->fulltext, $pregresult)) {
             $cleanContent = strip_tags($result, '<p><br><span><ul><li><h1><h2><h3><h4><a>');
             $tdwidth = (empty($tag->maxwidth) ? $this->params->get('maxwidth', 150) : $tag->maxwidth) + 20;
             $result = '<div class="acymailing_content"><table cellspacing="0" width="500" cellpadding="0" border="0" ><tr><td class="contentpicture" width="' . $tdwidth . '" valign="top" align="center"><a href="' . $link . '" target="_blank" style="border:0px;text-decoration:none">' . $pregresult[0] . '</a></td><td class="contenttext">' . $cleanContent . '</td></tr></table></div>';
         }
     }
     if (file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'tagcontent_html.php')) {
         ob_start();
         require ACYMAILING_MEDIA . 'plugins' . DS . 'tagcontent_html.php';
         $result = ob_get_clean();
     } elseif (file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'tagcontent.php')) {
         ob_start();
         require ACYMAILING_MEDIA . 'plugins' . DS . 'tagcontent.php';
         $result = ob_get_clean();
     }
     if ($tag->type != 'title' and $this->params->get('removejs', 'yes') == 'yes') {
         $result = $this->_removeJS($result);
     }
     if (isset($tag->pict)) {
         $pictureHelper = acymailing_get('helper.acypict');
         $pictureHelper->maxHeight = empty($tag->maxheight) ? $this->params->get('maxheight', 150) : $tag->maxheight;
         $pictureHelper->maxWidth = empty($tag->maxwidth) ? $this->params->get('maxwidth', 150) : $tag->maxwidth;
         if ($tag->pict == '0') {
             $result = $pictureHelper->removePictures($result);
         } elseif ($tag->pict == 'resized') {
             if ($pictureHelper->available()) {
                 $result = $pictureHelper->resizePictures($result);
             } elseif ($app->isAdmin()) {
                 $app->enqueueMessage($pictureHelper->error, 'notice');
             }
         }
     }
     return $result;
 }
Beispiel #14
0
 function replaceSubscriptionTag(&$allresults, $i, &$user, &$email)
 {
     if (empty($user->subid)) {
         return '';
     }
     if (empty($user->key)) {
         $user->key = md5(substr($user->email, 0, strpos($user->email, '@')) . time());
         $db = JFactory::getDBO();
         $db->setQuery('UPDATE ' . acymailing_table('subscriber') . ' SET `key`= ' . $db->Quote($user->key) . ' WHERE subid = ' . (int) $user->subid . ' LIMIT 1');
         $db->query();
     }
     $config = acymailing_config();
     $itemId = $config->get('itemid', 0);
     $item = empty($itemId) ? '' : '&Itemid=' . $itemId;
     if ($allresults[1][$i] == 'confirm') {
         //confirm your subscription link
         $itemId = $this->params->get('confirmitemid', 0);
         if (!empty($itemId)) {
             $item = '&Itemid=' . $itemId;
         }
         $myLink = acymailing_frontendLink('index.php?subid=' . $user->subid . '&option=com_acymailing&ctrl=user&task=confirm&key=' . $user->key . $item, (bool) $this->params->get('confirmtemplate', false));
         if (empty($allresults[2][$i])) {
             return $myLink;
         }
         return '<a target="_blank" href="' . $myLink . '">' . $allresults[2][$i] . '</a>';
     } elseif ($allresults[1][$i] == 'modify') {
         //modify your subscription link
         $itemId = $this->params->get('modifyitemid', 0);
         if (!empty($itemId)) {
             $item = '&Itemid=' . $itemId;
         }
         $myLink = acymailing_frontendLink('index.php?subid=' . $user->subid . '&option=com_acymailing&ctrl=user&task=modify&key=' . $user->key . $item, (bool) $this->params->get('modifytemplate', false));
         if (empty($allresults[2][$i])) {
             return $myLink;
         }
         return '<a style="text-decoration:none;" target="_blank" href="' . $myLink . '"><span class="acymailing_unsub">' . $allresults[2][$i] . '</span></a>';
     }
     //unsubscribe link
     $itemId = $this->params->get('unsubscribeitemid', 0);
     if (!empty($itemId)) {
         $item = '&Itemid=' . $itemId;
     }
     $myLink = acymailing_frontendLink('index.php?subid=' . $user->subid . '&option=com_acymailing&ctrl=user&task=out&mailid=' . $email->mailid . '&key=' . $user->key . $item, (bool) $this->params->get('unsubscribetemplate', false));
     if (empty($allresults[2][$i])) {
         return $myLink;
     }
     return '<a style="text-decoration:none;" target="_blank" href="' . $myLink . '"><span class="acymailing_unsub">' . $allresults[2][$i] . '</span></a>';
 }