uawdijnntqw1x1x1
IP : 216.73.217.59
Hostname : webm003.cluster107.gra.hosting.ovh.net
Kernel : Linux webm003.cluster107.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
OS : Linux
PATH:
/
home
/
opticamezl
/
www
/
newok
/
libraries
/
..
/
tmp
/
..
/
includes
/
..
/
api
/
..
/
language
/
..
/
tmp
/
..
/
helper.php.tar
/
/
home/opticamezl/www/newok/modules/mod_responsive_slider/helper.php000060400000030262151653554360021664 0ustar00<?php /** * @title Responsive Slider for Articles * @version 3.x * @copyright Copyright (C) 2011-2014 Minitek, All rights reserved. * @license GNU General Public License version 3 or later. * @author url http://www.minitek.gr/ * @author email info@minitek.gr * @developers Minitek.gr */ defined('_JEXEC') or die; jimport('joomla.filesystem.folder'); if(!defined('DS')) define('DS', DIRECTORY_SEPARATOR); if( !defined('PhpThumbFactoryLoaded') ) { require_once dirname(__FILE__).DS.'admin'.DS.'phpthumb/ThumbLib.inc.php'; define('PhpThumbFactoryLoaded',1); } $com_path = JPATH_SITE.'/components/com_content/'; require_once $com_path.'router.php'; require_once $com_path.'helpers/route.php'; JModelLegacy::addIncludePath($com_path . '/models', 'ContentModel'); /** * Helper for mod_articles_category * * @package Joomla.Site * @subpackage mod_articles_category */ abstract class ResponsiveSliderHelper { public static function getList(&$params) { // Get an instance of the generic articles model $articles = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true)); // Set application parameters in model $app = JFactory::getApplication(); $appParams = $app->getParams(); $articles->setState('params', $appParams); // Set the filters based on the module params $articles->setState('list.start', 0); $articles->setState('list.limit', (int) $params->get('count', 0)); $articles->setState('filter.published', 1); // Access filter $access = !JComponentHelper::getParams('com_content')->get('show_noauth'); $authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id')); $articles->setState('filter.access', $access); // Prep for Normal or Dynamic Modes $mode = $params->get('mode', 'normal'); switch ($mode) { case 'dynamic': $option = $app->input->get('option'); $view = $app->input->get('view'); if ($option === 'com_content') { switch($view) { case 'category': $catids = array($app->input->getInt('id')); break; case 'categories': $catids = array($app->input->getInt('id')); break; case 'article': if ($params->get('show_on_article_page', 1)) { $article_id = $app->input->getInt('id'); $catid = $app->input->getInt('catid'); if (!$catid) { // Get an instance of the generic article model $article = JModelLegacy::getInstance('Article', 'ContentModel', array('ignore_request' => true)); $article->setState('params', $appParams); $article->setState('filter.published', 1); $article->setState('article.id', (int) $article_id); $item = $article->getItem(); $catids = array($item->catid); } else { $catids = array($catid); } } else { // Return right away if show_on_article_page option is off return; } break; case 'featured': default: // Return right away if not on the category or article views return; } } else { // Return right away if not on a com_content page return; } break; case 'normal': default: $catids = $params->get('catid'); $articles->setState('filter.category_id.include', (bool) $params->get('category_filtering_type', 1)); break; } // Category filter if ($catids) { if ($params->get('show_child_category_articles', 0) && (int) $params->get('levels', 0) > 0) { // Get an instance of the generic categories model $categories = JModelLegacy::getInstance('Categories', 'ContentModel', array('ignore_request' => true)); $categories->setState('params', $appParams); $levels = $params->get('levels', 1) ? $params->get('levels', 1) : 9999; $categories->setState('filter.get_children', $levels); $categories->setState('filter.published', 1); $categories->setState('filter.access', $access); $additional_catids = array(); foreach ($catids as $catid) { $categories->setState('filter.parentId', $catid); $recursive = true; $items = $categories->getItems($recursive); if ($items) { foreach ($items as $category) { $condition = (($category->level - $categories->getParent()->level) <= $levels); if ($condition) { $additional_catids[] = $category->id; } } } } $catids = array_unique(array_merge($catids, $additional_catids)); } $articles->setState('filter.category_id', $catids); } // Ordering $articles->setState('list.ordering', $params->get('article_ordering', 'a.ordering')); $articles->setState('list.direction', $params->get('article_ordering_direction', 'ASC')); // New Parameters $articles->setState('filter.featured', $params->get('show_front', 'show')); $articles->setState('filter.author_id', $params->get('created_by', "")); $articles->setState('filter.author_id.include', $params->get('author_filtering_type', 1)); $articles->setState('filter.author_alias', $params->get('created_by_alias', "")); $articles->setState('filter.author_alias.include', $params->get('author_alias_filtering_type', 1)); $excluded_articles = $params->get('excluded_articles', ''); if ($excluded_articles) { $excluded_articles = explode("\r\n", $excluded_articles); $articles->setState('filter.article_id', $excluded_articles); $articles->setState('filter.article_id.include', false); // Exclude } $date_filtering = $params->get('date_filtering', 'off'); if ($date_filtering !== 'off') { $articles->setState('filter.date_filtering', $date_filtering); $articles->setState('filter.date_field', $params->get('date_field', 'a.created')); $articles->setState('filter.start_date_range', $params->get('start_date_range', '1000-01-01 00:00:00')); $articles->setState('filter.end_date_range', $params->get('end_date_range', '9999-12-31 23:59:59')); $articles->setState('filter.relative_date', $params->get('relative_date', 30)); } // Filter by language $articles->setState('filter.language', $app->getLanguageFilter()); $items = $articles->getItems(); // Display options $show_date = $params->get('show_date', 0); $show_date_field = $params->get('show_date_field', 'created'); $show_date_format = $params->get('show_date_format', 'Y-m-d H:i:s'); $show_category = $params->get('show_category', 0); $show_hits = $params->get('show_hits', 0); $show_author = $params->get('show_author', 0); $show_introtext = $params->get('show_introtext', 0); $introtext_limit = $params->get('introtext_limit', 15); $title_limit = $params->get('title_limit', 15); $imageWidth = (int)$params->get( 'image_width', 864 ); $imageHeight = (int)$params->get( 'image_height', 354 ); $imageWidthth = (int)$params->get( 'thumb_width', 864 ); $imageHeightth = (int)$params->get( 'thumb_height', 354 ); // Find current Article ID if on an article page $option = $app->input->get('option'); $view = $app->input->get('view'); if ($option === 'com_content' && $view === 'article') { $active_article_id = $app->input->getInt('id'); } else { $active_article_id = 0; } // Prepare data for display using display options foreach ($items as &$item) { // General image $images = json_decode($item->images, true); if ($params->get('image_type')=='introtext') { $item->mainimage = $images['image_intro']; } else if ($params->get('image_type')=='fulltext') { $item->mainimage = $images['image_fulltext']; } else if ($params->get('image_type')=='inline') { preg_match('/<img.+src=[\'"](?P<src>.+)[\'"].*>/i', $item->introtext, $new_image); if (array_key_exists('src', $new_image)) { $item->mainimage = $new_image['src']; } else { $item->mainimage = $images['image_intro']; } } $item->slug = $item->id.':'.$item->alias; $item->catslug = $item->catid ? $item->catid .':'.$item->category_alias : $item->catid; if ($access || in_array($item->access, $authorised)) { // We know that user has the privilege to view the article $item->link = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catslug)); } else { $app = JFactory::getApplication(); $menu = $app->getMenu(); $menuitems = $menu->getItems('link', 'index.php?option=com_users&view=login'); if (isset($menuitems[0])) { $Itemid = $menuitems[0]->id; } elseif ($app->input->getInt('Itemid') > 0) { // Use Itemid from requesting page only if there is no existing menu $Itemid = $app->input->getInt('Itemid'); } $item->link = JRoute::_('index.php?option=com_users&view=login&Itemid='.$Itemid); } // Used for styling the active article $item->active = $item->id == $active_article_id ? 'active' : ''; $item->displayDate = ''; $item->displayDate = JHTML::_('date', $item->$show_date_field, $show_date_format); if ($item->catid) { $item->displayCategoryLink = JRoute::_(ContentHelperRoute::getCategoryRoute($item->catid)); $item->displayCategoryTitle = $show_category ? '<a href="'.$item->displayCategoryLink.'">'.$item->category_title.'</a>' : ''; } else { $item->displayCategoryTitle = $show_category ? $item->category_title : ''; } $item->displayHits = $show_hits ? $item->hits : ''; $item->displayAuthorName = $show_author ? $item->author : ''; $item->displayIntrotext = self::wordLimit($item->introtext, $introtext_limit); $item->title = self::wordLimit($item->title, $title_limit); // Crop images if ( $item->mainimage && $image = self::renderImages($item->mainimage, $imageWidth, $imageHeight, $item->title ) ) { $item->mainimage = $image; } if ( $item->mainimage && $image = self::renderImages($item->mainimage, $imageWidthth, $imageHeightth, $item->title ) ) { $item->mainimage_th = $image; } } return $items; } public static function _cleanIntrotext($introtext) { $introtext = str_replace('<p>', ' ', $introtext); $introtext = str_replace('</p>', ' ', $introtext); $introtext = strip_tags($introtext, '<a><em><strong>'); $introtext = trim($introtext); return $introtext; } public static function makeDir( $path ) { $folders = explode ( '/', ( $path ) ); $tmppath = JPATH_SITE.DS.'images'.DS.'reslidercon'.DS; if( !file_exists($tmppath) ) { JFolder::create( $tmppath, 0755 ); }; for( $i = 0; $i < count ( $folders ) - 1; $i ++) { if (! file_exists ( $tmppath . $folders [$i] ) && ! JFolder::create( $tmppath . $folders [$i], 0755) ) { return false; } $tmppath = $tmppath . $folders [$i] . DS; } return true; } public static function renderImages( $path, $width, $height, $title='' ) { $path = str_replace( JURI::base(), '', $path ); $imgSource = JPATH_SITE.DS. str_replace( '/', DS, $path ); if ( file_exists($imgSource) ) { $path = $width."x".$height.'/'.$path; $thumbPath = JPATH_SITE.DS.'images'.DS.'reslidercon'.DS. str_replace( '/', DS, $path ); if ( !file_exists($thumbPath) ) { $thumb = PhpThumbFactory::create( $imgSource ); if( !self::makeDir( $path ) ) { return ''; } $thumb->adaptiveResize( $width, $height); $thumb->save( $thumbPath ); } $path = JURI::base().'images/reslidercon/'.$path; } return $path; } public static function wordLimit($str, $limit = 100, $end_char = '…') { if (JString::trim($str) == '') return $str; // always strip tags for text $str = strip_tags($str); $find = array("/\r|\n/u", "/\t/u", "/\s\s+/u"); $replace = array(" ", " ", " "); $str = preg_replace($find, $replace, $str); preg_match('/\s*(?:\S*\s*){'.(int)$limit.'}/u', $str, $matches); if (JString::strlen($matches[0]) == JString::strlen($str)) $end_char = ''; return JString::rtrim($matches[0]).$end_char; } } home/opticamezl/www/newok/modules/mod_jdsimplecontactform/helper.php000060400000041456151653740630022200 0ustar00<?php /** * @package JD Simple Contact Form * @author JoomDev https://www.joomdev.com * @copyright Copyright (C) 2021 Joomdev, Inc. All rights reserved. * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or Later */ // no direct access defined('_JEXEC') or die; class ModJDSimpleContactFormHelper { public static function renderForm($params, $module) { $fields = $params->get('fields', []); foreach ($fields as $field) { $field->id = \JFilterOutput::stringURLSafe('jdscf-' . $module->id . '-' . $field->name); self::renderField($field, $module, $params); } } public static function renderField($field, $module, $params) { $label = new JLayoutFile('label', JPATH_SITE . '/modules/mod_jdsimplecontactform/layouts'); $field_layout = self::getFieldLayout($field->type); $input = new JLayoutFile('fields.' . $field_layout, JPATH_SITE . '/modules/mod_jdsimplecontactform/layouts'); $layout = new JLayoutFile('field', JPATH_SITE . '/modules/mod_jdsimplecontactform/layouts'); if ($field->type == 'checkbox' || $field->type == 'hidden') { $field->show_label = 0; } echo $layout->render(['field' => $field, 'label' => $label->render(['field' => $field]), 'input' => $input->render(['field' => $field, 'label' => self::getLabelText($field), 'module' => $module, 'params' => $params]), 'module' => $module]); } public static function getOptions($options) { $options = explode("\n", $options); $array = []; foreach ($options as $option) { if (!empty($option)) { $array[] = ['text' => $option, 'value' => trim( $option )]; } } return $array; } public static function getLabelText($field) { $label = $field->label; if (empty($label)) { $label = ucfirst($field->name); } else { $label = JText::_($label); } return $label; } public static function getFieldLayout($type) { $return = ''; if (file_exists(JPATH_SITE . '/modules/mod_jdsimplecontactform/layouts/fields/' . $type . '-custom.php')) { // For adding custom files $return = $type . '-custom'; } else if (file_exists(JPATH_SITE . '/modules/mod_jdsimplecontactform/layouts/fields/' . $type . '.php')) { $return = $type; } else { $return = 'text'; } return $return; } public static function submitForm($ajax = false) { if (!JSession::checkToken()) { throw new \Exception(JText::_("JINVALID_TOKEN")); } if ($_SERVER['REQUEST_METHOD'] !== 'POST') { throw new \Exception(JText::_('MOD_JDSCF_BAD_REQUEST'), 400); } $app = JFactory::getApplication(); $jinput = $app->input->post; $jdscf = $jinput->get('jdscf', [], 'ARRAY'); $id = $jinput->get('id', [], 'INT'); $params = self::getModuleParams(); if ($params->get('captcha', 0)) { $captchaType = $params->get('captchaPlugins') == "" ? JFactory::getConfig()->get('captcha') : $params->get('captchaPlugins'); JPluginHelper::importPlugin('captcha', $captchaType); $dispatcher = JEventDispatcher::getInstance(); if ( $captchaType == "recaptcha" ) { $check_captcha = $dispatcher->trigger('onCheckAnswer', $jinput->get('recaptcha_response_field')); if (!$check_captcha[0]) { throw new \Exception(JText::_('Invalid Captcha'), 0); } } elseif ( $captchaType == "recaptcha_invisible" ) { $check_captcha = $dispatcher->trigger('onCheckAnswer', $jinput->get('g-recaptcha-response')); } elseif (!empty($captchaType)) { $check_captcha = $dispatcher->trigger('onCheckAnswer'); } } $labels = []; foreach ($params->get('fields', []) as $field) { $labels[$field->name] = ['label' => self::getLabelText($field), 'type' => $field->type]; } $cc_emails = []; $values = []; foreach ($jdscf as $name => $value) { if(is_array($value)) { // Type email values if(isset($value['email'])) { $values[$name] = $value['email']; //single cc if(isset($value['single_cc']) && $value['single_cc'] == 1) { $cc_emails[] = $value['email']; } } // Type text values ( isset($value['text'] ) ? $values[$name] = $value['text'] : ''); // Type number values ( isset($value['number'] ) ? $values[$name] = $value['number'] : ''); // Type url values ( isset($value['url'] ) ? $values[$name] = $value['url'] : ''); // Type Hidden Value ( isset($value['hidden'] ) ? $values[$name] = $value['hidden'] : ''); } else { $values[$name] = $value; } } $contents = []; $attachments = []; $errors = []; // Get all error messages and add them to $errors variable $messages = $app->getMessageQueue(); if (!empty($messages)) { for ($i=0; $i < count($messages); $i++) { $errors[] = $messages[$i]["message"]; } } foreach ($labels as $name => $fld) { $value = isset($values[$name]) ? $values[$name] : ''; if ($fld['type'] == 'checkboxes') { if ( isset ($_POST['jdscf'][$name]['cbs'] ) ) { $value = $_POST['jdscf'][$name]['cbs']; } if (is_array($value)) { $value = implode(', ', $value); } else { $value = $value; } } if ($fld['type'] == 'checkbox') { if (isset($_POST['jdscf'][$name]['cb'])){ $value = $_POST['jdscf'][$name]['cb']; } if (is_array($value)) { $value = implode(',', $value); } else { $value = $value; } $value = empty($value) ? 'unchecked' : 'checked'; } if ($fld['type'] == 'file') { if(isset($_FILES['jdscf']['name'][$name])) { $value = $_FILES['jdscf']['name'][$name]; $uploaded = self::uploadFile($_FILES['jdscf']['name'][$name], $_FILES['jdscf']['tmp_name'][$name]); //filetype error if(!empty($value)) { if(!$uploaded) { $errors[] = JText::_('MOD_JDSCF_UNSUPPORTED_FILE_ERROR'); } } if(!empty($uploaded)) { $attachments[] = $uploaded; } } } if ($fld['type'] == 'textarea') { if ($value) { $value = nl2br($value); } } $contents[] = [ "value" => $value, "label" => $fld['label'], "name" => $name, ]; } // Fetches IP Address of Client if ( $params->get('ip_info' ) ) { if (!empty($_SERVER['HTTP_CLIENT_IP'])) { $ipAddress = $_SERVER['HTTP_CLIENT_IP']; } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { $ipAddress = $_SERVER['HTTP_X_FORWARDED_FOR']; } else { $ipAddress = $_SERVER['REMOTE_ADDR']; } $contents[] = array( "value" => "<a href='http://whois.domaintools.com/$ipAddress'>$ipAddress</a>", "label" => "IP Address", "name" => "ip" ); } if ($params->get('email_template', '') == 'custom') { $html = $params->get('email_custom', ''); if ( empty( $html ) ) { $layout = new JLayoutFile('emails.default', JPATH_SITE . '/modules/mod_jdsimplecontactform/layouts'); $html = $layout->render(['contents' => $contents]); } else { $html = self::renderVariables($contents, $html); } } else { $layout = new JLayoutFile('emails.default', JPATH_SITE . '/modules/mod_jdsimplecontactform/layouts'); $html = $layout->render(['contents' => $contents]); } // sending mail $mailer = JFactory::getMailer(); $config = JFactory::getConfig(); $title = $params->get('title', ''); if (!empty($title)) { $title = ' : ' . $title; } // Sender if (!empty($params->get('email_from', ''))) { $email_from = $params->get('email_from', ''); $email_from = self::renderVariables($contents, $email_from); if (!filter_var($email_from, FILTER_VALIDATE_EMAIL)) { $email_from = $config->get('mailfrom'); } } else { $email_from = $config->get('mailfrom'); } if (!empty($params->get('email_name', ''))) { $email_name = $params->get('email_name', ''); $email_name = self::renderVariables($contents, $email_name); if (empty($email_name)) { $email_name = $config->get('fromname'); } } else { $email_name = $config->get('fromname'); } $sender = array($email_from, $email_name); $mailer->setSender($sender); // Subject $email_subject = !empty($params->get('email_subject', '')) ? $params->get('email_subject') : JText::_('MOD_JDSCF_DEFAULT_SUBJECT', $title); $email_subject = self::renderVariables($contents, $email_subject); $mailer->setSubject($email_subject); // Recipient $recipients = !empty($params->get('email_to', '')) ? $params->get('email_to') : $config->get('mailfrom'); $recipients = explode(',', $recipients); if (!empty($recipients)) { $mailer->addRecipient($recipients); } // Reply-To if (!empty($params->get('reply_to', ''))) { $reply_to = $params->get('reply_to', ''); $reply_to = self::renderVariables($contents, $reply_to); if (!filter_var($reply_to, FILTER_VALIDATE_EMAIL)) { $reply_to = ''; } $mailer->addReplyTo($reply_to); } else { $reply_to = ''; } // CC $cc = !empty($params->get('email_cc', '')) ? $params->get('email_cc') : ''; $cc = empty($cc) ? [] : explode(",", $cc); if(!empty($cc_emails)){ $cc = array_merge($cc, $cc_emails); $cc = array_unique($cc); } if (!empty($cc)) { $mailer->addCc($cc); } // BCC $bcc = !empty($params->get('email_bcc', '')) ? $params->get('email_bcc') : ''; $bcc = empty($bcc) ? [] : explode(',', $bcc); if (!empty($bcc)) { $mailer->addBcc($bcc); } $mailer->isHtml(true); $mailer->Encoding = 'base64'; $mailer->setBody($html); foreach($attachments as $attachment){ $mailer->addAttachment($attachment); } if(!empty($errors)) { $app = JFactory::getApplication(); $send = false; // showing all the validation errors foreach ($errors as $error) { $app->enqueueMessage(\JText::_($error), 'error'); } } else { $send = $mailer->Send(); } if ($send !== true) { switch($params->get('ajaxsubmit')) { case 0: throw new \Exception(JText::_('MOD_JDSCFEMAIL_SEND_ERROR')); break; case 1: throw new \Exception(json_encode($errors)); break; } } $message = $params->get('thankyou_message', ''); if (empty($message)) { $message = JText::_('MOD_JDSCF_THANKYOU_DEFAULT'); } else { $template = $params->get('email_custom', ''); $message = self::renderVariables($contents, $message); } $redirect_url = $params->get('redirect_url', ''); $redirect_url = self::renderVariables($contents, $redirect_url); if (!$ajax) { $return = !empty($redirect_url) ? $redirect_url : urldecode($jinput->get('returnurl', '', 'RAW')); $session = JFactory::getSession(); if (empty($redirect_url)) { $session->set('jdscf-message-' . $id, $message); } else { $session->set('jdscf-message-' . $id, ''); } $app->redirect($return); } return ['message' => $message, 'redirect' => $redirect_url, 'errors' => json_encode($errors)]; } public static function renderVariables($variables, $source) { foreach ($variables as $content) { $value = is_array($content['value']) ? implode(', ', $content['value']) : $content['value']; $value = empty($value) ? '' : $value; $label = empty($content['label']) ? '' : $content['label']; $source = str_replace('{' . $content['name'] . ':label}', $label, $source); $source = str_replace('{' . $content['name'] . ':value}', $value, $source); } return $source; } public static function getModuleParams() { $app = JFactory::getApplication(); $jinput = $app->input->post; $id = $jinput->get('id', 0); $params = new JRegistry(); $db = JFactory::getDbo(); $query = "SELECT * FROM `#__modules` WHERE `id`='$id'"; $db->setQuery($query); $result = $db->loadObject(); if (!empty($result)) { $params->loadString($result->params, 'JSON'); } else { throw new \Exception(JText::_('MOD_JDSCF_MODULE_NOT_FOUND'), 404); } return $params; } public static function submitAjax() { try { self::submitForm(); } catch (\Exception $e) { $app = JFactory::getApplication(); $params = self::getModuleParams(); $jinput = $app->input->post; $app->enqueueMessage($e->getMessage(), 'error'); $redirect_url = $params->get('redirect_url', ''); $return = !empty($redirect_url) ? $redirect_url : urldecode($jinput->get('returnurl', '', 'RAW')); $app->redirect($return); } } public static function submitFormAjax() { header('Content-Type: application/json'); header('Access-Control-Allow-Origin: *'); $return = array(); try { $data = self::submitForm(true); $return['status'] = "success"; $return['code'] = 200; $return['data'] = $data; } catch (\Exception $e) { $return['status'] = "error"; $return['code'] = $e->getCode(); $return['message'] = $e->getMessage(); $return['line'] = $e->getLine(); $return['file'] = $e->getFile(); } echo \json_encode($return); exit; } public static function addJS($js, $moduleid) { if (!isset($GLOBALS['mod_jdscf_js_' . $moduleid])) { $GLOBALS['mod_jdscf_js_' . $moduleid] = []; } $GLOBALS['mod_jdscf_js_' . $moduleid][] = $js; } public static function getJS($moduleid) { if (!isset($GLOBALS['mod_jdscf_js_' . $moduleid])) { return []; } return $GLOBALS['mod_jdscf_js_' . $moduleid]; } //for single email field (at bottom) public static function isSingleCCMail($params) { $singlesendcopy_email = $params->get('single_sendcopy_email', 0); $singlesendcopyemail_field = $params->get('singleSendCopyEmail_field', ''); if($singlesendcopy_email && !empty($singlesendcopyemail_field)){ return true; } else { return false; } } public static function uploadFile($name, $src) { jimport('joomla.filesystem.file'); jimport('joomla.application.component.helper'); $fullFileName = JFile::stripExt($name); $filetype = JFile::getExt($name); $filename = JFile::makeSafe($fullFileName."_".mt_rand(10000000,99999999).".".$filetype); $params = JComponentHelper::getParams('com_media'); $allowable = array_map('trim', explode(',', $params->get('upload_extensions'))); if ($filetype == '' || $filetype == false || (!in_array($filetype, $allowable) )) { return false; } else { $tmppath = JPATH_SITE . '/tmp'; if (!file_exists($tmppath.'/jdscf')) { mkdir($tmppath.'/jdscf',0777); } $folder = md5(time().'-'.$filename.rand(0,99999)); if (!file_exists($tmppath.'/jdscf/'.$folder)) { mkdir($tmppath.'/jdscf/'.$folder,0777); } $dest = $tmppath.'/jdscf/'.$folder.'/'.$filename; $return = null; if (JFile::upload($src, $dest)) { $return = $dest; } return $return; } } } home/opticamezl/www/newok/modules/mod_globalnews/helper.php000060400000052324151721524030020250 0ustar00<?php /*------------------------------------------------------------------------ # mod_globalnews - Global News Module # ------------------------------------------------------------------------ # author Joomla!Vargas # copyright Copyright (C) 2010 joomla.vargas.co.cr. All Rights Reserved. # @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL # Websites: http://joomla.vargas.co.cr # Technical Support: Forum - http://joomla.vargas.co.cr/forum -------------------------------------------------------------------------*/ // no direct access defined('_JEXEC') or die; require_once (JPATH_SITE.'/components/com_content/helpers/route.php'); jimport('joomla.application.component.model'); JModelLegacy::addIncludePath(JPATH_SITE.'/components/com_content/models', 'ContentModel'); abstract class modGlobalNewsHelper { public static function getGN_Img( &$params, $link, $img, $pfx ) { $align = $params->get( $pfx.'_img_align', 'left' ); $margin = $params->get( $pfx.'_img_margin', '3px' ); $width = (int)$params->get( $pfx.'_img_width', '' ); $height = (int)$params->get( $pfx.'_img_height', '' ); $border = $params->get( $pfx.'_img_border', '0' ); if ( $align == 'left' ) : $style = 'float:left;'; if ( $pfx == 'cat' ) { $style .= 'margin-right:' . $margin . ';'; } else { $style .= 'margin:' . $margin . ';'; } endif; if ( $align == 'right' ) : $style = 'float:right;'; if ( $pfx == 'cat' ) { $style .= 'margin-left:' . $margin . ';'; } else { $style .= 'margin:' . $margin . ';'; } endif; $style .= 'border:' . $border . ';'; $attribs = array ('style' => $style); if (!$params->get('thumb_image', 1)) { if ( $height ) $attribs = array('height' => $height, $attribs); if ( $width ) $attribs = array('width' => $width, $attribs ); } $image = JHTML::_('image', $img, JText::_('IMAGE'), $attribs ); if ( $link ) $image = JHTML::_('link', $link, $image); if ( $align == 'center') $image = '<center>' . $image . '</center>'; return $image; } public static function getGN_Cats(&$params) { $db = JFactory::getDBO(); $user = JFactory::getUser(); $groups = implode(',', $user->getAuthorisedViewLevels()); $catid = $params->get('catid', ''); $curcat = $params->get('curcat', 0); $current = $params->get('current', 1); $show_cat = $params->get('show_cat', 1); $cat_title = $params->get('cat_title', 1); $cat_img = $params->get( 'cat_img_align', 0); $access = !JComponentHelper::getParams('com_content')->get('show_noauth'); $group_id = $condition = ''; switch ($params->get( 'cat_order', 1)) { case '0': $ordering = 'rand()'; break; case '1': $ordering = 'c.id ASC'; break; case '2': $ordering = 'c.title ASC'; break; case '3': default: $ordering = 'c.lft ASC'; break; } if ( $curcat == 0 || $current != 1 ) : if ( JRequest::getCmd('option') == 'com_content' ) { $view = JRequest::getCmd('view'); $temp = JRequest::getString('id'); $temp = explode(':', $temp); $id = $temp[0]; } endif; $catids = $params->get('catid'); JArrayHelper::toInteger($catids); $catids = implode(',', $catids); if (!empty($catids)) { $condition .= ' AND c.id IN ('.$catids.')'; } $query = 'SELECT c.*, ' . ' CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(":", c.id, c.alias) ELSE c.id END as slug' . ' FROM #__categories AS c' . ' WHERE c.published = 1 AND c.extension = "com_content"' . ($access ? ' AND c.access IN ('.$groups.')' : ''). ($condition!='' ? $condition : ''). ' ORDER BY '. $ordering; $db->setQuery($query); $cats = $db->loadObjectList(); foreach ( $cats as &$cat ) { $cat->link = JRoute::_(ContentHelperRoute::getCategoryRoute( $cat->slug )); $cat->cond = $cat->id; $cat->image = ''; if ( $cat_img ) { $catParams = new JRegistry; $catParams->loadString($cat->params); if ( $image = $catParams->get('image')) { $cat->image .= modGlobalNewsHelper::getGN_Img( $params, $cat->link, $image, 'cat' ); } } if ( $group_id == $cat->id && $curcat == 0 ) { $cat->link = ''; } if ( $cat_title != 0 ) { $tags = array(array('',''),array('',''),array('<strong>','</strong>'),array('<u>','</u>'),array('<strong><u>','</u></strong>'),array('<h1>','</h1>'),array('<h2>','</h2>'),array('<h3>','</h3>'),array('<h4>','</h4>'),array('<h5>','</h5>'),array('<h6>','</h6>')); if ( $show_cat == 2 ) { $cat->title = $tags[$cat_title][0] . $cat->title . $tags[$cat_title][1]; } else { $cat->title = ( $cat_title > 4 ? $tags[$cat_title][0] : '' ) . ( $cat->link ? '<a href="' . $cat->link. '">' : '' ) . ( $cat_title < 5 ? $tags[$cat_title][0] : '' ) . $cat->title . ( $cat_title < 5 ? $tags[$cat_title][1] : '' ) . ( $cat->link ? '</a>' : '' ) . ( $cat_title > 4 ? $tags[$cat_title][1] : '' ); } } else { $cat->title = ''; } } return $cats; } public static function getGN_List(&$params,$catid) { $db = JFactory::getDBO(); $user = JFactory::getUser(); $userId = (int) $user->get('id'); $groups = implode(',', $user->getAuthorisedViewLevels()); $count = trim( $params->get('count', 5) ); $current = trim( $params->get('current', 1) ); $layout = $params->get('layout', 'list'); $html = $params->get('html'); $show_front = $params->get('show_front', 1); $aid = $user->get('aid', 0); $limittitle = $params->get('limittitle', ''); $nullDate = $db->getNullDate(); jimport('joomla.utilities.date'); $date = new JDate(); $now = $date->toSql(); $article_id = 0; if ($current != 1 && JRequest::getCmd('option') === 'com_content' && JRequest::getCmd('view') === 'article') { $article_id = JRequest::getInt('id'); } $articles = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true)); $app = JFactory::getApplication(); $appParams = $app->getParams(); $articles->setState('params', $appParams); $articles->setState('list.start', 0); $articles->setState('list.limit', (int) $params->get('count', 5)); $articles->setState('filter.published', 1); $access = !JComponentHelper::getParams('com_content')->get('show_noauth'); $authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id')); $articles->setState('filter.access', $access); if ($params->get('show_child_category_articles', 0) && (int) $params->get('levels', 0) > 0) { $categories = JModelLegacy::getInstance('Categories', 'ContentModel', array('ignore_request' => true)); $categories->setState('params', $appParams); $levels = $params->get('levels', 1) ? $params->get('levels', 1) : 9999; $categories->setState('filter.get_children', $levels); $categories->setState('filter.published', 1); $categories->setState('filter.access', $access); $additional_catids = array(); $categories->setState('filter.parentId', $catid); $recursive = true; $items = $categories->getItems($recursive); if ($items) { foreach($items as $category) { $condition = (($category->level - $categories->getParent()->level) <= $levels); if ($condition) { $additional_catids[] = $category->id; } } } $catid = array_unique(array_merge(array($catid), $additional_catids)); } $articles->setState('filter.category_id', $catid); $articles->setState('list.ordering', $params->get('article_ordering', 'a.ordering')); if ($params->get('article_ordering') != 'rand()') { $articles->setState('list.direction', $params->get('article_ordering_direction', 'ASC')); } else { $articles->setState('list.direction', ''); } $articles->setState('filter.featured', $params->get('show_front', 'show')); $articles->setState('filter.author_id', $params->get('created_by', "")); $articles->setState('filter.author_id.include', 1); if ( $article_id && $current == 0 ) { $articles->setState('filter.article_id', $article_id); $articles->setState('filter.article_id.include', false); // Exclude } $articles->setState('filter.language',$app->getLanguageFilter()); $rows = $articles->getItems(); foreach ( $rows as &$row ) { if ( $article_id == $row->id && $current == 2 ) { $link = ''; } else { $row->slug = $row->id.':'.$row->alias; $row->catslug = $row->catid ? $row->catid .':'.$row->category_alias : $row->catid; $link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catslug)); } if ( $limittitle && strlen( $row->title ) > $limittitle ) { $row->title = substr( $row->title, 0, $limittitle ). '...'; } if ( $link ) { $row->title = '<a href="'.$link.'">'.htmlspecialchars( $row->title ).'</a>'; } else { $row->title = htmlspecialchars( $row->title ); } if ( $layout != 'list' ) : $gn_image = ''; $gn_title = ''; $gn_created = ''; $gn_author = ''; $gn_text = ''; $gn_readmore = ''; $gn_comments = ''; if ( preg_match("/GN_title/", $html) ) { $gn_title = $row->title; $gn_title = preg_replace('/\$/','$-',$gn_title); } if ( preg_match("/GN_date/", $html) ) { $gn_created = JHTML::_('date', ($params->get( 'date' ) == 'created' ? $row->created : $row->modified ), $params->get('date_format', '' ) ); } if ( preg_match("/GN_author/", $html) ) { $author = $params->get( 'author' ); if ( $author != 'alias' ) { $query = "SELECT " . $author . " FROM #__users WHERE id = " . $row->created_by; $db->setQuery($query); $gn_author = $db->loadResult(); } else { $gn_author = $row->created_by_alias; } } if ( preg_match("/GN_image/", $html) ) { $img = ''; $images = json_decode($row->images); if (isset($images->image_intro) and !empty($images->image_intro)) : $img = $images->image_intro; elseif (isset($images->image_fulltext) and !empty($images->image_fulltext)) : $img = $images->image_fulltext; else : $regex = "/<img[^>]+src\s*=\s*[\"']\/?([^\"']+)[\"'][^>]*\>/"; $search = $row->introtext; preg_match ($regex, $search, $matches); $images = (count($matches)) ? $matches : array(); if ( count($images) ) { $img = $images[1]; } endif; if ($img) { if ($params->get('thumb_image', 1)) { $img = str_replace(JURI::base(false),'',$img); $img = modGlobalNewsHelper::getThumbnail($img,$params,$row->id); } $gn_image = modGlobalNewsHelper::getGN_Img ( $params, $link, $img, 'item' ); } } if ( preg_match("/GN_text/", $html) ) { $limit = trim( $params->get('limittext', '150') ); $gn_text = $row->introtext; if ( $params->get('striptext', '1')) $gn_text = trim( strip_tags( $gn_text, $params->get('allowedtags', '') ) ); $pattern = array("/[\n\t\r]+/",'/{(\w+)[^}]*}.*{\/\1}|{(\w+)[^}]*}/Us', '/\$/'); $replace = array(' ', '', '$-'); $gn_text = preg_replace( $pattern, $replace, $gn_text ); if ( $limit && strlen( $gn_text ) > $limit ) { $gn_text = substr( $gn_text, 0, $limit ); $space = strrpos( $gn_text, ' ' ); $gn_text = substr( $gn_text, 0, $space ). '...'; } } if ( preg_match("/GN_readmore/", $html) && $link ) { $gn_readmore = JHTML::_('link', $link, JText::_('MOD_GLOBALNEWS_READ_MORE_TITLE')); } $code = array("/GN_image/", "/GN_title/", "/GN_date/", "/GN_author/", "/GN_text/", "/GN_readmore/", "/GN_comments/","/GN_break/","/GN_space/","/GN_hits_label/","/GN_hits_value/"); $rplc = array( $gn_image, $gn_title, $gn_created, $gn_author, $gn_text, $gn_readmore, $gn_comments, "<br />", " ", JText::_('MOD_GLOBALNEWS_HITS_LABEL'), $row->hits); $row->content = preg_replace($code, $rplc, $html); $row->content = preg_replace('/\$-/','$',$row->content); endif; } return $rows; } public static function addGN_CSS(&$params, $layout, $globalnews_id, $total) { $doc = JFactory::getDocument(); $layout = $params->get( 'layout', 'list' ); $padding = (int)$params->get('padding', '5px'); $border = $params->get('border', '1px solid #EFEFEF'); $color = $params->get('color', '#FFFFFF'); $show_cat = $params->get('show_cat', '1'); $css = ''; if ( $globalnews_id == 1 ) : $css .= ".gn_clear { clear:both; height:0; line-height:0; }\n"; endif; $header = '.gn_header_' . $globalnews_id . ' {' .' background-color:' . $params->get('header_color', '#EFEFEF') . ';' .' border:' . $border . ';' .' border-bottom:none;' .' padding:' . (int)$params->get('header_padding', '5px') . 'px;' .' }'; $marquee = ' border:' . $border . ';' . ( $show_cat != 0 ? ' border-top:none;' : '' ) .' padding:' . $padding . 'px;' .' height:' . $params->get('height', '100px') . ';' .' background-color:' . $color . ';' .' overflow:hidden;'; switch ( $layout ) { case 'list' : $css .= $header . "\n" .".gn_list_" . $globalnews_id . " {" . $marquee ." }"; break; case 'static' : $css .= $header . "\n" .".gn_static_" . $globalnews_id . " {" . $marquee ." }"; break; case 'slider' : $css .= $header . "\n" .".gn_slider_" . $globalnews_id . " {" . $marquee ." border-bottom:none;" ." }" . "\n" .".gn_slider_" . $globalnews_id . " .gn_opacitylayer {" ." height:100%;" ." filter:progid:DXImageTransform.Microsoft.alpha(opacity=100);" ." -moz-opacity:1;" ." opacity:1;" ." }" . "\n" .".gn_pagination_" . $globalnews_id . " {" ." border:" . $border . ";" ." border-top:none;" ." padding:2px " . $padding . "px;" ." text-align:right;" ." background-color:" . $color . ";" ." }" . "\n" .".gn_pagination_" . $globalnews_id . " a:link {" ." font-weight:bold;" ." padding:0 2px;" ." }" . "\n" .".gn_pagination_" . $globalnews_id . " a:hover, .gn_pagination_" . $globalnews_id . " a.selected {" ." color:#000;" ." }"; break; case 'browser' : $containerIds = array(); for ($m=0;$m<$total;$m++) { $containerIds[$m] = '#gn_container_' . $globalnews_id . '_' . ($m+1); } $css .= $header . "\n" . implode(',' , $containerIds) . " {" . $marquee ." position: relative;" ." }"; break; case 'scroller' : $scrollerIds = array(); for ($m=0;$m<$total;$m++) { $scrollerIds[$m] = '#gn_scroller_' . $globalnews_id . '_' . ($m+1); } $css .= $header . "\n" . implode(',' , $scrollerIds) . " {" . $marquee ." }"; break; } return $doc->addStyleDeclaration($css); } public static function getThumbnail($img,&$params,$item_id) { $width = $params->get('thumb_width',90); $height = $params->get('thumb_height',90); $proportion = $params->get('thumb_proportions','bestfit'); $img_type = $params->get('thumb_type',''); $bgcolor = hexdec($params->get('thumb_bg','#FFFFFF')); $img_name = pathinfo($img, PATHINFO_FILENAME); $img_ext = pathinfo($img, PATHINFO_EXTENSION); $img_path = JPATH_BASE . '/' . $img; $size = @getimagesize($img_path); $errors = array(); if(!$size) { $errors[] = 'There was a problem loading image ' . $img_name . '.' . $img_ext; } else { $sub_folder = '0' . substr($item_id, -1); if ( $img_type ) { $img_ext = $img_type; } $origw = $size[0]; $origh = $size[1]; if( ($origw<$width && $origh<$height)) { $width = $origw; $height = $origh; } $prefix = substr($proportion,0,1) . "_".$width."_".$height."_".$bgcolor."_".$item_id."_"; $thumb_file = $prefix . str_replace(array( JPATH_ROOT, ':', '/', '\\', '?', '&', '%20', ' '), '_' ,$img_name . '.' . $img_ext); //$thumb_path = __DIR__ . '/thumbs/' . $sub_folder . '/' . $thumb_file; $thumb_path = dirname(__FILE__) . '/thumbs/' . $sub_folder . '/' . $thumb_file; $attribs = array(); if(!file_exists($thumb_path)) { modGlobalNewsHelper::calculateSize($origw, $origh, $width, $height, $proportion, $newwidth, $newheight, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h); switch(strtolower($size['mime'])) { case 'image/png': $imagecreatefrom = "imagecreatefrompng"; break; case 'image/gif': $imagecreatefrom = "imagecreatefromgif"; break; case 'image/jpeg': $imagecreatefrom = "imagecreatefromjpeg"; break; default: $errors[] = "Unsupported image type $img_name.$img_ext ".$size['mime']; } if ( !function_exists ( $imagecreatefrom ) ) { $errors[] = "Failed to process $img_name.$img_ext. Function $imagecreatefrom doesn't exist."; } $src_img = $imagecreatefrom($img_path); if (!$src_img) { $errors[] = "There was a problem to process image $img_name.$img_ext ".$size['mime']; } $dst_img = ImageCreateTrueColor($width, $height); // $bgcolor = imagecolorallocatealpha($image, 200, 200, 200, 127); imagefill( $dst_img, 0,0, $bgcolor); if ( $proportion == 'transparent' ) { imagecolortransparent($dst_img, $bgcolor); } imagecopyresampled($dst_img,$src_img, $dst_x, $dst_y, $src_x, $src_y, $newwidth, $newheight, $src_w, $src_h); switch(strtolower($img_ext)) { case 'png': $imagefunction = "imagepng"; break; case 'gif': $imagefunction = "imagegif"; break; default: $imagefunction = "imagejpeg"; } if($imagefunction=='imagejpeg') { $result = @$imagefunction($dst_img, $thumb_path, 80 ); } else { $result = @$imagefunction($dst_img, $thumb_path); } imagedestroy($src_img); if(!$result) { if(!$disablepermissionwarning) { //$errors[] = 'Could not create image:<br />' . $thumb_path . '.<br /> Check if the folder exists and if you have write permissions:<br /> ' . __DIR__ . '/thumbs/' . $sub_folder; $errors[] = 'Could not create image:<br />' . $thumb_path . '.<br /> Check if the folder exists and if you have write permissions:<br /> ' . dirname(__FILE__) . '/thumbs/' . $sub_folder; } $disablepermissionwarning = true; } else { imagedestroy($dst_img); } } } if (count($errors)) { JError::raiseWarning(404, implode("\n", $errors)); return false; } $image = JURI::base(false)."modules/mod_globalnews/thumbs/$sub_folder/" . basename($thumb_path); return $image; } public static function calculateSize($origw, $origh, &$width, &$height, &$proportion, &$newwidth, &$newheight, &$dst_x, &$dst_y, &$src_x, &$src_y, &$src_w, &$src_h) { if(!$width ) { $width = $origw; } if(!$height ) { $height = $origh; } if ( $height > $origh ) { $newheight = $origh; $height = $origh; } else { $newheight = $height; } if ( $width > $origw ) { $newwidth = $origw; $width = $origw; } else { $newwidth = $width; } $dst_x = $dst_y = $src_x = $src_y = 0; switch($proportion) { case 'fill': case 'transparent': $xscale=$origw/$width; $yscale=$origh/$height; if ($yscale<$xscale){ $newheight = round($origh/$origw*$width); $dst_y = round(($height - $newheight)/2); } else { $newwidth = round($origw/$origh*$height); $dst_x = round(($width - $newwidth)/2); } $src_w = $origw; $src_h = $origh; break; case 'crop': $ratio_orig = $origw/$origh; $ratio = $width/$height; if ( $ratio > $ratio_orig) { $newheight = round($width/$ratio_orig); $newwidth = $width; } else { $newwidth = round($height*$ratio_orig); $newheight = $height; } $src_x = ($newwidth-$width)/2; $src_y = ($newheight-$height)/2; $src_w = $origw; $src_h = $origh; break; case 'only_cut': // } $src_x = round(($origw-$newwidth)/2); $src_y = round(($origh-$newheight)/2); $src_w = $newwidth; $src_h = $newheight; break; case 'bestfit': $xscale=$origw/$width; $yscale=$origh/$height; if ($yscale<$xscale){ $newheight = $height = round($width / ($origw / $origh)); } else { $newwidth = $width = round($height * ($origw / $origh)); } $src_w = $origw; $src_h = $origh; break; } } }home/opticamezl/www/newok/modules/mod_gtranslate/helper.php000060400000002621151721524240020255 0ustar00<?php /** * @version $Id$ * @package GTranslate * @copyright Copyright (C) 2008-2023 GTranslate Inc. All rights reserved. * @license GNU/GPL v3 http://www.gnu.org/licenses/gpl.html */ defined('_JEXEC') or die('Restricted access'); class modGTranslateHelper { public static function getParams(&$params) { $params->def('look', 'float'); $params->def('flag_size', 32); $params->def('flag_style', '2d'); $params->def('globe_size', 60); $params->def('language', 'en'); $params->def('url_structure', 'none'); $params->def('native_language_names', 1); $params->def('detect_browser_language', 0); $params->def('enable_cdn', 1); $params->def('add_new_line', 1); $params->def('select_language_label', 'Select Language'); $params->def('color_scheme', 'light'); $params->def('alt_flags', array()); $params->def('wrapper_selector', '.gtranslate_wrapper'); $params->def('float_position', 'bottom-left'); $params->def('float_switcher_open_direction', 'top'); $params->def('position', 'inline'); $params->def('switcher_open_direction', 'bottom'); $params->def('custom_domains', 0); $params->def('custom_domains_config', ''); $params->def('custom_css', ''); $params->def('languages', array('en', 'es', 'de', 'it', 'fr')); return $params; } }home/opticamezl/www/newok/modules/mod_jo_whatsapp_contact_button/helper.php000060400000001300151721525040023526 0ustar00<?php /*------------------------------------------------------------------------ # mod_jo_whatsapp_contact_button - JO WhatsApp Contact Button for Joomla 1.6, 1.7, 2.5 and 3.x module # ----------------------------------------------------------------------- # author: http://www.joomcore.com # copyright Copyright (C) 2011 Joomcore.com. All Rights Reserved. # @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL # Websites: http://www.joomcore.com # Technical Support: Forum - http://www.joomcore.com/Support -------------------------------------------------------------------------*/ // no direct access defined('_JEXEC') or die ('Restricted access'); class modJoWhatsAppContactButton { } ?> home/opticamezl/www/newok/modules/mod_search/helper.php000060400000001074151721737050017364 0ustar00<?php /** * @package Joomla.Site * @subpackage mod_search * * @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Helper for mod_search * * @since 1.5 */ class ModSearchHelper { /** * Display the search button as an image. * * @return string The HTML for the image. * * @since 1.5 */ public static function getSearchImage() { return JHtml::_('image', 'searchButton.gif', '', null, true, true); } }
/home/opticamezl/www/newok/libraries/../tmp/../includes/../api/../language/../tmp/../helper.php.tar