AnonSec Shell
Server IP : 54.36.91.62  /  Your IP : 216.73.217.112
Web Server : Apache
System : Linux webm013.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
User : coopiak ( 151928)
PHP Version : 8.3.23
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/coopiak/amisdesseniors-fr/administrator/components/com_jlexreview/libs/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/coopiak/amisdesseniors-fr/administrator/components/com_jlexreview/libs/alert.php
<?php
/**
 * @package		JLex Review
 * @version		4.2.3
 * @copyright	Copyright (c) 2013-2018 JLexArt. All rights reserved
 * @license		GNU General Public License version 2 or later;
 * @author		www.jlexart.com
 */

defined('_JEXEC') or die;

class JLexReviewAlert
{
	protected $row;

	protected $_db;

	public function __construct()
	{
		$this->_db = JFactory::getDbo();
	}

	protected function _getSectionFile($id)
	{
		static $section_files = array();

		if (array_key_exists($id, $section_files))
		{
			return $section_files[$id];
		}

		$query = $this->_db->getQuery(true);
		$query->select("params")
				->from("#__jlexreview_form")
				->where("id=" . $id);

		$form = $this->_db->setQuery($query)->loadResult();

		if (!$form)
		{
			return null;
		}

		$form = json_decode($form);

		$section_files[$id] = $form;

		return $form;
	}

	protected function _getReview($id, $sid)
	{
		$form = $this->_getSectionFile($sid);

		if (!$form)
		{
			return null;
		}

		$config = JLexReviewHelperAdmin::getConfig ();
		$query 	= $this->_db->getQuery(true);
		$query->select("*")
				->from("#__jlexreview_fields")
				->where("review_id=" . $id);

		$body = $this->_db->setQuery($query)->loadObjectList("field_id");

		if (!$body)
		{
			return null;
		}

		$results = array();

		foreach ($form->fs_data as $field)
		{
			$return = new stdClass();
			$return->value = "";

			if (!array_key_exists($field->id, $body) || empty($body[$field->id]->field_value))
			{
				continue;
			}

			$fieldval = $body[$field->id];

			$return->label = JText::_($field->label);

			if (isset($field->rating_data))
			{
				if ($config->get("criteria_display","percent")=="percent")
				{
					$percent = intval($body[$field->rating_data->id]->field_value*100/$field->rating_data->max);
					$return->rating = $percent . "%";
				} else {
					$return->rating = $body[$field->rating_data->id]->field_value . "/" . $field->rating_data->max;
				}
			}

			switch ($field->type)
			{
				case "select":
				case "checkbox":
				case "radio":
					$html = "";
					$options_data 	= preg_split("/(\r\n|\n|\r)/", $field->options);
					$options 		= array();
					foreach ($options_data as $line)
					{
						$line = explode("|", $line);
						$options[$line[0]] = $line[1];
					}

					if ($fieldval->field_multiple=="1")
					{
						$values = explode("|", $fieldval->field_value);
						if (count($values))
						{
							foreach ($values as $selected)
							{
								$html.= '<span class="_badge">'.$options[$selected].'</span>';
							}
						}
					} else {
						$html .= '<span class="_badge">'.$options[$fieldval->field_value].'</span>';
					}

					$return->value = $html;
					break;

				case "text":
				case "textarea":
					$return->value = strip_tags($fieldval->field_value);
					$return->value = nl2br($return->value);

					if (preg_match('/^\s*$/', $return->value))
					{
						$return->value = JLexReviewHelperSite::subwords($return->value , 20);
					}
					break;

				case "rating":
					if ($config->get("criteria_display","percent")=="percent")
					{
						$percent = intval($fieldval->field_value*100/$field->max);
						$return->rating = $percent . "%";
					} else {
						$return->rating = $fieldval->field_value . "/" . $field->max;
					}
					
					break;
			}

			$results[] = $return;
		}

		return $results;
	}

	public function set($row)
	{
		$this->row = $row;
		return $this;
	}

	public function freeSend($email, $tpl, $options=array())
	{
		$config = JLexReviewHelperAdmin::getConfig();
		$path 	= trim($config->get("email_tpl_path", ""));

	   	if(preg_match("/^\s*$/", $path))
        {
            $path = "administrator/components/com_jlexreview/libs/email_templates";
        }

        $path = JPATH_ROOT."/".$path."/".$tpl.".tpl.php";
        if(!is_file($path)) return false;

        ob_start();
		include $path;

		$body = ob_get_contents();
		ob_end_clean();

		// begin send
		$caption = "No Subject";
		if(array_key_exists("caption", $options))
			$caption = $options["caption"];

		$appConfig = JFactory::getConfig();
		JFactory::getMailer()->sendMail($appConfig->get("mailfrom"), $appConfig->get("fromname"), $email, $caption, $body, true);

		return true;
	}

	public function send($emails=array(), $quicktask=false)
	{
		$config = JLexReviewHelperAdmin::getConfig ();
		$path 	= trim($config->get('email_tpl_path',''),'');
	   	if (preg_match('/^\s*$/', $path))
        {
            $path = 'administrator/components/com_jlexreview/libs/email_templates';
        }
        $path 	= JPATH_ROOT.'/'.$path;

		$user_actions = array(
				"CM_REVIEW",
				"CM_REPLY"
			);

		$admin_actions = array(
				"CM_ADDED",
				"CM_MODIFIED",
				"REVIEW_ADDED",
				"REVIEW_MODIFIED"
			);

		
		// admin
		if (in_array($this->row->action_type, $admin_actions))
		{
			// find content
			$query = $this->_db->getQuery(true);

			if (in_array($this->row->action_type, array("CM_ADDED", "CM_MODIFIED")))
			{
				$cid = explode(",", $this->row->type_id);
				$query->clear()
					  ->select("0 AS type, item.comment")
					  ->from("#__jlexreview_cm item")
					  ->where("item.id=" . $this->_db->quote($cid[1]));
			} else {
				$query->clear()
					  ->select("1 AS type, item.title, item.rating")
					  ->from("#__jlexreview item")
					  ->where("item.id=" . $this->_db->quote($this->row->type_id));
			}

			$query->select("item.published,item.created_by,item.author_name, item.author_email")
				  ->select( "e.object_name, e.url, e.object, e.object_id, e.section_file" )
				  ->leftJoin( "#__jlexreview_entry e ON e.id=item.entry_id" );

			$item = $this->_db->setQuery($query)->loadObject();

			if (!$item) return;

			// entry
			if ($config->def("link_type",0)=="1")
            {
                $up =  JLexReviewHelperAdmin::getItemDetail($item->object, $item->object_id, $item->object_name, $item->url);
                $item->object_name = $up->title;
            }

            if ($item->type==1)
            {
            	if (!preg_match('/^\s*$/', $item->title))
		        {
		        	$item->title = JLexReviewHelperAdmin::subwords($item->title,20);
		        } else {
		        	$item->title = null;
		        }

		        $item->body = $this->_getReview($this->row->type_id*1, $item->section_file);
            }

			if (count($emails))
			{
				foreach ($emails as $email)
				{
					if (filter_var($email, FILTER_VALIDATE_EMAIL) !== false)
					{
						$hash = "hash=" . md5( 'jlexreview-' . implode(",", $emails) . $this->row->type_id);

						$links = array(
							"view" 		=> JRoute::_("index.php?option=com_jlexreview&view=mail&task=show&id=" . $this->row->type_id . "&" . $hash, false, 2),
							"publish" 	=> JRoute::_("index.php?option=com_jlexreview&view=mail&task=publish&id=" . $this->row->type_id . "&" . $hash, false, 2),
							"unpublish" => JRoute::_("index.php?option=com_jlexreview&view=mail&task=unpublish&id=" . $this->row->type_id . "&" . $hash, false, 2),
							"remove" 	=> JRoute::_("index.php?option=com_jlexreview&view=mail&task=remove&id=" . $this->row->type_id . "&" . $hash, false, 2)
						);

						ob_start();
						$caption = "";
						switch ($this->row->action_type) {
							case 'CM_ADDED':
								$caption = JText::_('JR_EMAIL_NEW_COMMENT_ADDED_TITLE');
								$content = '<p style="text-align:center">' . JText::_('JR_EMAIL_NEW_COMMENT_ADDED_IN');
								break;
							
							case 'CM_MODIFIED':
								$caption = JText::_('JR_EMAIL_NEW_COMMENT_EDITED_TITLE');
								$content = '<p style="text-align:center">' . JText::_('JR_EMAIL_NEW_COMMENT_EDITED_IN');
								break;

							case 'REVIEW_ADDED':
								$caption = JText::_('JR_EMAIL_NEW_REVIEW_ADDED_TITLE');
								$content = '<p style="text-align:center">' . JText::_('JR_EMAIL_NEW_REVIEW_ADDED_IN');
								break;

							case 'REVIEW_MODIFIED':
								$caption = JText::_('JR_EMAIL_NEW_REVIEW_EDITED_TITLE');
								$content = '<p style="text-align:center">' . JText::_('JR_EMAIL_NEW_REVIEW_EDITED_IN');
								break;
						}

						$content.= '<a href="'.$links['view'].'" target="_blank">'. $item->object_name .'</a></p>';

						$content.= '<div style="text-align:center"><a href="'.$links['view'].'" target="_blank" class="btn">'.JText::_('JR_EMAIL_VIEW_IT').'</a></div>';

						if ($quicktask)
						{
							$qhtml = '<div>' .JText::_('JR_EMAIL_QUICKTASK'). '</div>';
							$qhtml .= '<div class="_quicklinks">';
								$qhtml .= '<a href="'.$links['publish'].'">'.JText::_('JR_EMAIL_PUBLISH').'</a>';
								$qhtml .= '<a href="'.$links['unpublish'].'">'.JText::_('JR_EMAIL_UNPUBLISH').'</a>';
								$qhtml .= '<a href="'.$links['remove'].'">'.JText::_('JR_EMAIL_REMOVE').'</a>';
							$qhtml .= '</div>';
						}

						if (!is_file($path . '/admin.tpl.php')) continue;

						include $path . '/admin.tpl.php';

						$body = ob_get_contents();
						ob_end_clean();

						// begin send
						$appConfig = JFactory::getConfig();
						JFactory::getMailer()->sendMail($appConfig->get("mailfrom"), $appConfig->get("fromname"), $email, $caption, $body, true);

					}
				}
			}
		}

		// user
		if (in_array($this->row->action_type, $user_actions))
		{
			// find content
			$query = $this->_db->getQuery(true);

			$cid = explode(",", $this->row->type_id);
			$query->clear()
				  ->select("item.*")
				  ->from("#__jlexreview_cm item")
				  ->where(array(
				  		"item.id=" . $this->_db->quote($cid[1]),
				  		"item.published=1"
				  	));

			$query->select( "e.object_name,e.object,e.object_id,e.url" )
				  ->leftJoin( "#__jlexreview_entry e ON e.id=item.entry_id" );

			$item = $this->_db->setQuery($query)->loadObject();

			if ($item)
			{
				// entry
				if ($config->get("link_type",0)=="1")
	            {
	                $up =  JLexReviewHelperAdmin::getItemDetail($item->object, $item->object_id, $item->object_name, $item->url);
	                $item->url = str_replace(JUri::root(true), '', $up->url);
	                $item->object_name = $up->title;
	            } else {
	                $item->url  = urldecode($item->url);
	            }

	            $item->url  = trim($item->url, '/');
       			$item->url  = preg_match("/^https?:\/\//", $item->url) ? $item->url : JUri::root() . $item->url;
        		$item->url 	= $item->url .(stripos($item->url,'?')!==false?'&':'?'). 'review_id=' . $this->row->type_id;

        		if (!is_file($path . '/user.tpl.php')) return;

				ob_start();
				$caption = "";
				switch ($this->row->action_type) {
					case 'CM_REVIEW':
						$caption = JText::_('JR_EMAIL_NEW_COMMENT_ADDED_TITLE');
						$content = '<p style="text-align:center">' . JText::sprintf('JR_EMAIL_COMMENT_PEOPLE',$this->row->author->get('jname'));
						break;
					
					case 'CM_REPLY':
						$caption = JText::_('JR_EMAIL_REPLY_COMEMNT');
						$content = '<p style="text-align:center">' . JText::sprintf('JR_EMAIL_REPLY_COMMENT_PEOPLE', $this->row->author->get('jname'));
						break;
				}

				$content.= '<a href="'.$item->url.'" target="_blank">'. $item->object_name .'</a></p>';

				$content.= '<div style="text-align:center"><a href="'.$item->url.'" target="_blank" class="btn">'.JText::_('JR_EMAIL_VIEW_IT').'</a></div>';

				$hash  	= md5("jlexreview-notification-" . $this->row->user_remind);

				if($this->row->user_remind>0){
					$unsubscribe = JRoute::_("index.php?option=com_jlexreview&view=mail&task=stop&id=" . $this->row->user_remind . "&hash=" . $hash, false, 2);
				} else {
					$unsubscribe = '#';
				}

				include $path . '/user.tpl.php';

				$body = ob_get_contents();
				ob_end_clean();

				// begin send
				$appConfig = JFactory::getConfig();
				
				JFactory::getMailer()->sendMail($appConfig->get("mailfrom"), $appConfig->get("fromname"), $this->row->email_dest, $caption, $body, true);

			}
		}

		// update info rows
		$query = "UPDATE #__jlexreview_notification SET sent=1 WHERE id=" . $this->row->id;
		$this->_db->setQuery($query)->execute();
	}
}

Anon7 - 2022
AnonSec Team