/** * Safe String. Remove no letter's, no number's and other's no allowed Signs. * * @param string $string String to safe * @return string */ public static function safe($string) { static $items; if (is_null($items)) { $letters[] = 'abcdefghijklmnopqrstuvwxyz'; $letters[] = 'áćéǵíḱĺḿńóṕŕśúǘẃýź'; $letters[] = 'äëḧïöẗüẅẍÿ'; $letters[] = 'åůẘẙ'; $letters[] = 'ǎčďěǧȟǐǰǩľňǒřšťǔǚž'; $letters[] = '.-_ '; $items = array(); foreach ($letters as $item) { $items = array_merge($items, parent::str_split($item), parent::str_split(parent::strtoupper($item))); } $items = array_merge($items, parent::str_split('0123456789')); } $string = parent::str_split($string); $safe = ''; foreach ($string as $item) { if (in_array($item, $items)) { $safe .= $item; } } return parent::trim($safe); }
function display($tpl = null) { JToolBarHelper::title(JText::_('Счета'), 'Bill'); JToolBarHelper::deleteList(); JToolBarHelper::editListX(); JToolBarHelper::addNewX(); JToolBarHelper::publishList(); JToolBarHelper::unpublishList(); $act = array(); $items =& $this->get('Data'); $users =& $this->get('users'); foreach ($users as $u) { $act[$u->id] = $u->name; } $users = $act; $profiles =& $this->get('profiles'); foreach ($profiles as $p) { $act[$p->id] = $p->name; } $profiles = $act; $this->assignRef('items', $items); $this->assignRef('users', $users); $this->assignRef('profiles', $profiles); $pagination =& $this->get('Pagination'); $this->assignRef('pagination', $pagination); global $option; $apl = JFactory::getApplication(); $filter_order = $apl->getUserStateFromRequest($option . 'filter_order', 'filter_order', 'published'); $filter_order_Dir = JString::strtoupper($apl->getUserStateFromRequest($option . 'filter_order_Dir', 'filter_order_Dir', 'ASC')); $lists = array(); $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; $this->assignRef('lists', $lists); parent::display($tpl); }
function getItemDetail($id) { $realtorModel = $this->getModel('realtors'); $row =& $realtorModel->getRowById($id); if (!$row->id) { return; } // combine name and short instruction (slogan) // if ( !empty( $row->slogan ) ) // { // $row->name .= " - " . $row->slogan; // } // set image default if no avatar $avatar = JPATH_ROOT . DS . 'images' . DS . 'com_jea' . DS . 'images' . DS . 'realtors' . DS . $row->id . DS . 'avatar.jpg'; if (file_exists($avatar)) { $row->avatar = JURI::root() . "images/com_jea/images/realtors/{$row->id}/avatar.jpg"; } else { $row->avatar = JURI::root() . 'images/noimage.jpg'; } // get mod search $mod_search = JModuleHelper::getModule('jea_search', 'realtors_mod_search'); $attribs['style'] = 'search'; $mod_search->title = JText::_("REALTOR_MOD_SEARCH"); $row->mod_search = JModuleHelper::renderModule($mod_search, $attribs); // get realtor's properties & assign to template // $realtorListing = $realtorModel->getListingByRealtorId( $row->id ); // // $templatePath = "templates/webkp/html/mod_jea_emphasis"; // $helperPath = "modules/mod_jea_emphasis"; // // $listingTemplate = new JView(); // $listingTemplate->addTemplatePath($templatePath); // $listingTemplate->addHelperPath($helperPath); // $listingTemplate->loadHelper('helper'); // // //$listingTemplate->assignRef('rows', $realtorListing); // $listingTemplate->rows = &$realtorListing; // // $row->mod_realtors_properties = $listingTemplate->loadTemplate(); // $row->mod_realtors_properties = "chau test here"; $mod_properties = JModuleHelper::getModule('jea_emphasis', 'Realtor Properties'); $attribs['style'] = 'box8content'; $mod_properties->params .= "\n realtor_id={$row->id}"; $mod_properties->title = "DO " . JString::strtoupper($row->name); $row->mod_realtors_properties = JModuleHelper::renderModule($mod_properties, $attribs); // get concerned properties $mod_same_properties = JModuleHelper::getModule('jea_emphasis', 'Realtor Same Properties'); $attribs['style'] = 'box8content'; $mod_same_properties->params .= "\n realtor_id={$row->id}"; $mod_same_properties->title = JText::_("REALTOR SAME PROPERTIES"); $row->mod_same_properties = JModuleHelper::renderModule($mod_same_properties, $attribs); // get successful properties $mod_successful_properties = JModuleHelper::getModule('jea_emphasis', 'Realtor Successful Properties'); $attribs['style'] = 'box8content'; $mod_successful_properties->params .= "\n realtor_id={$row->id}"; $mod_successful_properties->title = JText::_("REALTOR SUCCESSFUL PROPERTIES"); $row->mod_successful_properties = JModuleHelper::renderModule($mod_successful_properties, $attribs); $this->assignRef('row', $row); }
public function __construct(EasyBlogTableBlock &$block) { $this->type = $block->element; $type = JString::strtoupper($this->type); $this->title = JText::_('COM_EASYBLOG_BLOCKS_HANDLER_' . $type . '_TITLE'); $this->keywords = JText::_('COM_EASYBLOG_BLOCKS_HANDLER_' . $type . '_KEYWORDS'); $this->table = $block; }
public function __construct(&$subject, $config = array()) { parent::__construct($subject, $config); $this->serviceProvider = 'PayPal Express'; $this->serviceAlias = 'paypalexpress'; $this->textPrefix .= '_' . \JString::strtoupper($this->serviceAlias); $this->debugType .= '_' . \JString::strtoupper($this->serviceAlias); }
/** * Save an existing or a new mood form POST */ public function apply() { CommunityLicenseHelper::_(); JRequest::checkToken() or jexit(JText::_('COM_COMMUNITY_INVALID_TOKEN')); $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; $scss = $jinput->post->get('scss', null, 'array'); $settings = $jinput->post->get('settings', null, 'array'); if (JString::strtoupper($jinput->getMethod()) != 'POST') { $mainframe->redirect('index.php?option=com_community&view=moods', JText::_('COM_COMMUNITY_PERMISSION_DENIED'), 'error'); } if (!is_null($scss)) { CommunityThemeHelper::parseScss($scss, 'general'); } // Handle image uploads $images['frontpage-image'] = $jinput->files->get('frontpage-image-new', '', 'NONE'); foreach ($images as $key => $image) { if (!empty($image['tmp_name']) && isset($image['name']) && !empty($image['name'])) { $imagePath = COMMUNITY_PATH_ASSETS; // same as the image path //check the file extension first and only allow jpg or png $ext = strtolower(pathinfo($image['name'], PATHINFO_EXTENSION)); if (!in_array($ext, array('jpg', 'png')) || $image['type'] != 'image/png' && $image['type'] != 'image/jpeg') { } $imageJpg = $imagePath . '/' . $key . '.jpg'; $imagePng = $imagePath . '/' . $key . '.png'; //check if existing image exist, if yes, delete it if (file_exists($imageJpg)) { unlink($imageJpg); } if (file_exists($imagePng)) { unlink($imagePng); } //let move the tmp image to the actual path $finalPath = $imagePath . $key . '.' . $ext; move_uploaded_file($image['tmp_name'], $finalPath); require JPATH_ROOT . "/components/com_community/helpers/image.php"; CImageHelper::resizeProportional($finalPath, $finalPath, "image/{$ext}", 1000, 1000); $settings[$key] = $ext; } } // Parse settings finish CommunityThemeHelper::parseSettings($settings, 'general'); $message = JText::_('COM_COMMUNITY_THEME_GENERAL_UPDATED'); $mainframe->redirect('index.php?option=com_community&view=themegeneral', $message, 'message'); // Get the view type $document = JFactory::getDocument(); $viewType = $document->getType(); // Get the view $viewName = JRequest::getCmd('view', 'community'); $view = $this->getView($viewName, $viewType); $view->setLayout('edit'); $model = $this->getModel($viewName, 'CommunityAdminModel'); if ($model) { $view->setModel($model, $viewName); } $view->display(); }
/** * @param $value * @param null $position * @return Item|void */ public function fromCSV($value, $position = null) { $options = $this->_getArray($value, JBCSVItem::SEP_CELL); foreach ($options as $key => $option) { $options[$key] = JString::strtoupper($option); } $this->_element->bindData(array('country' => $options)); return $this->_item; }
/** * Redirect to payment action * @return null|string */ public function getRedirectUrl() { $order = $this->getOrder(); $payCurrency = $this->getDefaultCurrency(); $merchantUrl = $this->isDebug() ? $this->_testUrl : $this->_realUrl; $orderAmount = $this->_order->val($this->getOrderSumm(), $order->getCurrency())->convert($payCurrency); $fields = array('cmd' => '_xclick', 'no_shipping' => 1, 'rm' => 2, 'business' => JString::trim($this->config->get('email')), 'item_number' => $order->id, 'amount' => $orderAmount->val(), 'currency_code' => JString::strtoupper($payCurrency), 'return' => $this->_jbrouter->payment('success'), 'cancel_return' => $this->_jbrouter->payment('fail'), 'notify_url' => $this->_jbrouter->payment('callback'), 'item_name' => $this->getOrderDescription()); return $merchantUrl . '?' . $this->_jbrouter->query($fields); }
/** * Checks validation * @return null|void * @throws AppException */ public function isValid($params = array()) { $crc = JString::trim(JString::strtoupper($_REQUEST["SignatureValue"])); $myCrc = JString::trim(JString::strtoupper(md5(implode(':', array($_REQUEST['OutSum'], $this->getOrderId(), $this->config->get('password2')))))); if ($crc === $myCrc) { return true; } return false; }
function parserXMLDetails() { $arrayResult = array(); $arraylang = array(); $temp = null; $fileDescription = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_imageshow' . DS . $this->_fileDescriptName; $parserDescription = JFactory::getXMLParser('Simple'); $resultLoadFileDescription = $parserDescription->loadFile($fileDescription); $documentDescription =& $parserDescription->document; $nodeRealName =& $documentDescription->getElementByPath('name'); $nodVersion =& $documentDescription->getElementByPath('version'); $nodAuthor =& $documentDescription->getElementByPath('author'); $nodDate =& $documentDescription->getElementByPath('creationdate'); $nodLicense =& $documentDescription->getElementByPath('license'); $nodCopyright =& $documentDescription->getElementByPath('copyright'); $nodWebsite =& $documentDescription->getElementByPath('authorurl'); $languages =& $documentDescription->getElementByPath('languages'); $administration =& $documentDescription->getElementByPath('administration'); $nodEdition =& $documentDescription->getElementByPath('edition'); if ($administration != false) { $submenu =& $administration->getElementByPath('submenu'); if ($submenu != false) { $child = $submenu->children(); if (count($child) > 0) { $arrayKey = array(); foreach ($child as $value) { $keyValue = JString::strtoupper($value->data()); $arrayKey[] = $keyValue; } $arrayResult['menu'] = $arrayKey; } } } if ($nodAuthor != false && $nodVersion != false && $nodDate != false && $nodLicense != false && $nodCopyright != false && $nodWebsite != false && $nodeRealName != false) { $arrayResult['realName'] = $nodeRealName->data(); $arrayResult['version'] = $nodVersion->data(); $arrayResult['author'] = $nodAuthor->data(); $arrayResult['date'] = $nodDate->data(); $arrayResult['license'] = $nodLicense->data(); $arrayResult['copyright'] = $nodCopyright->data(); $arrayResult['website'] = $nodWebsite->data(); $arrayResult['edition'] = $nodEdition != false ? $nodEdition->data() : ''; if ($languages != false && count($languages->children())) { foreach ($languages->children() as $value) { if ($temp != $value->attributes('tag')) { $tag = $value->attributes('tag'); $arraylang[$tag] = $tag; $temp = $tag; } } } $arrayResult['langs'] = $arraylang; } return $arrayResult; }
function check() { $this->name = JString::trim($this->name); $this->name = JString::str_ireplace('-', '', $this->name); $this->name = JString::str_ireplace('.', '', $this->name); $params = JComponentHelper::getParams('com_k2'); if ($params->get('k2TagNorm')) { $searches = array('À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'à', 'á', 'â', 'ã', 'ä', 'å', 'Ā', 'ā', 'Ă', 'ă', 'Ą', 'ą', 'Ç', 'ç', 'Ć', 'ć', 'Ĉ', 'ĉ', 'Ċ', 'ċ', 'Č', 'č', 'Ð', 'ð', 'Ď', 'ď', 'Đ', 'đ', 'È', 'É', 'Ê', 'Ë', 'è', 'é', 'ê', 'ë', 'Ē', 'ē', 'Ĕ', 'ĕ', 'Ė', 'ė', 'Ę', 'ę', 'Ě', 'ě', 'Ĝ', 'ĝ', 'Ğ', 'ğ', 'Ġ', 'ġ', 'Ģ', 'ģ', 'Ĥ', 'ĥ', 'Ħ', 'ħ', 'Ì', 'Í', 'Î', 'Ï', 'ì', 'í', 'î', 'ï', 'Ĩ', 'ĩ', 'Ī', 'ī', 'Ĭ', 'ĭ', 'Į', 'į', 'İ', 'ı', 'Ĵ', 'ĵ', 'Ķ', 'ķ', 'ĸ', 'Ĺ', 'ĺ', 'Ļ', 'ļ', 'Ľ', 'ľ', 'Ŀ', 'ŀ', 'Ł', 'ł', 'Ñ', 'ñ', 'Ń', 'ń', 'Ņ', 'ņ', 'Ň', 'ň', 'ʼn', 'Ŋ', 'ŋ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ø', 'ò', 'ó', 'ô', 'õ', 'ö', 'ø', 'Ō', 'ō', 'Ŏ', 'ŏ', 'Ő', 'ő', 'Ŕ', 'ŕ', 'Ŗ', 'ŗ', 'Ř', 'ř', 'Ś', 'ś', 'Ŝ', 'ŝ', 'Ş', 'ş', 'Š', 'š', 'ſ', 'Ţ', 'ţ', 'Ť', 'ť', 'Ŧ', 'ŧ', 'Ù', 'Ú', 'Û', 'Ü', 'ù', 'ú', 'û', 'ü', 'Ũ', 'ũ', 'Ū', 'ū', 'Ŭ', 'ŭ', 'Ů', 'ů', 'Ű', 'ű', 'Ų', 'ų', 'Ŵ', 'ŵ', 'Ý', 'ý', 'ÿ', 'Ŷ', 'ŷ', 'Ÿ', 'Ź', 'ź', 'Ż', 'ż', 'Ž', 'ž', 'Ά', 'ά', 'Έ', 'έ', 'Ή', 'ή', 'Ί', 'ί', 'Ό', 'ό', 'Ύ', 'ύ', 'Ώ', 'ώ', 'ϋ', 'ϊ', 'ΐ'); $replacements = array('A', 'A', 'A', 'A', 'A', 'A', 'a', 'a', 'a', 'a', 'a', 'a', 'A', 'a', 'A', 'a', 'A', 'a', 'C', 'c', 'C', 'c', 'C', 'c', 'C', 'c', 'C', 'c', 'D', 'd', 'D', 'd', 'D', 'd', 'E', 'E', 'E', 'E', 'e', 'e', 'e', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'G', 'g', 'G', 'g', 'G', 'g', 'G', 'g', 'H', 'h', 'H', 'h', 'I', 'I', 'I', 'I', 'i', 'i', 'i', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'J', 'j', 'K', 'k', 'k', 'L', 'l', 'L', 'l', 'L', 'l', 'L', 'l', 'L', 'l', 'N', 'n', 'N', 'n', 'N', 'n', 'N', 'n', 'n', 'N', 'n', 'O', 'O', 'O', 'O', 'O', 'O', 'o', 'o', 'o', 'o', 'o', 'o', 'O', 'o', 'O', 'o', 'O', 'o', 'R', 'r', 'R', 'r', 'R', 'r', 'S', 's', 'S', 's', 'S', 's', 'S', 's', 's', 'T', 't', 'T', 't', 'T', 't', 'U', 'U', 'U', 'U', 'u', 'u', 'u', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'W', 'w', 'Y', 'y', 'y', 'Y', 'y', 'Y', 'Z', 'z', 'Z', 'z', 'Z', 'z', 'Α', 'α', 'Ε', 'ε', 'Η', 'η', 'Ι', 'ι', 'Ο', 'ο', 'Υ', 'υ', 'Ω', 'ω', 'υ', 'ι', 'ι'); $additionalReplacements = $params->get('k2TagNormAdditionalReplacements'); $pairs = @explode(',', $additionalReplacements); if (is_array($pairs)) { foreach ($pairs as $pair) { @(list($search, $replace) = @explode('|', $pair)); if (isset($search) && $search && isset($replace) && $replace) { $searches[] = $search; $replacements[] = $replace; } } } //$this->name = JString::str_ireplace($searches, $replacements, $this->name); // This causes character stripping in J!1.5!! $this->name = str_ireplace($searches, $replacements, $this->name); // Switch case if ($params->get('k2TagNormCase') == 'upper') { $this->name = JString::strtoupper($this->name); } else { $this->name = JString::strtolower($this->name); // Special case for Greek letter s final $this->name = JString::str_ireplace('σ ', 'ς ', $this->name); if (JString::substr($this->name, -1) == 'σ') { $this->name = JString::substr($this->name, 0, -1); $this->name .= 'ς'; } } } $this->name = JString::trim($this->name); if ($this->name == '') { $this->setError(JText::_('K2_TAG_CANNOT_BE_EMPTY')); return false; } if (strlen(utf8_decode($this->name)) < 2) { $this->setError(JText::_('K2_TAG_CANNOT_BE_A_SINGLE_CHARACTER')); return false; } // Check if tag exists already for new tags if (!$this->id) { $this->_db->setQuery("SELECT id FROM #__k2_tags WHERE name = " . $this->_db->Quote($this->name)); if ($this->_db->loadResult()) { $this->setError(JText::_('K2_THIS_TAG_EXISTS_ALREADY')); return false; } } return true; }
/** * Get query to load full licenses list to browse table. * * @return string */ public function getListQuery() { $query = 'SELECT `lcs`.*, `edt`.`name` AS `editor`, `crt`.`name` AS `creator` '; $query .= 'FROM `#__joomdoc_license` AS `lcs` '; $query .= 'LEFT JOIN `#__users` AS `edt` ON `edt`.`id` = `lcs`.`checked_out` '; $query .= 'LEFT JOIN `#__users` AS `crt` ON `crt`.`id` = `lcs`.`created_by` '; if ($this->state->get(JOOMDOC_FILTER_KEYWORDS)) { $query .= 'WHERE LOWER(`lcs`.`title`) LIKE ' . $this->_db->quote('%' . JString::strtolower($this->state->get(JOOMDOC_FILTER_KEYWORDS)) . '%') . ' '; } $query .= 'ORDER BY `' . $this->state->get(JOOMDOC_FILTER_ORDERING) . '` ' . JString::strtoupper($this->state->get(JOOMDOC_FILTER_DIRECTION)); return $query; }
/** * Process a string in a JOOMLA_TRANSLATION_STRING standard. * This method processes a string and replaces all accented UTF-8 characters by unaccented * ASCII-7 "equivalents" and the string is uppercase. Spaces replaced by underscore. * * @param string $string String to process * * @return string Processed string * * @since 1.0.0 */ public static function stringToJText($string) { // Remove any '_' from the string since they will be used as concatenaters $str = str_replace('_', ' ', $string); $lang = JFactory::getLanguage(); $str = $lang->transliterate($str); // Trim white spaces at beginning and end of translation string and make uppercase $str = trim(JString::strtoupper($str)); // Remove any duplicate whitespace, and ensure all characters are alphanumeric $str = preg_replace('/(\\s|[^A-Za-z0-9\\-])+/', '_', $str); // Trim underscores at beginning and end of translation string $str = trim($str, '_'); return $str; }
/** * Add the page title and toolbar. * */ protected function addToolbar() { $canDo = JeaHelper::getActions(); $feature = $this->state->get('feature.name'); JToolBarHelper::title(JText::_(JString::strtoupper("com_jea_list_of_{$feature}_title")), 'jea.png'); if ($canDo->get('core.create')) { JToolBarHelper::addNew('feature.add'); } if ($canDo->get('core.edit')) { JToolBarHelper::editList('feature.edit'); } if ($canDo->get('core.delete')) { JToolBarHelper::divider(); JToolBarHelper::deleteList(JText::_('COM_JEA_MESSAGE_CONFIRM_DELETE'), 'featurelist.delete'); } }
/** * Redirect to payment form action * @return null|string */ public function getRedirectUrl() { $order = $this->getOrder(); $orderId = $this->getOrderId(); $publicKey = JString::trim($this->config->get('public_key')); $privateKey = JString::trim($this->config->get('private_key')); $payCurrency = $this->getDefaultCurrency(); $orderAmount = $this->_order->val($this->getOrderSumm(), $order->getCurrency())->convert($payCurrency); $data = array('version' => self::VERSION, 'amount' => $orderAmount->val(), 'currency' => JString::strtoupper($payCurrency), 'public_key' => $publicKey, 'description' => $this->getOrderDescription(), 'order_id' => $orderId, 'server_url' => $this->_jbrouter->payment('callback'), 'result_url' => $this->_jbrouter->payment('success') . '&orderId=' . $this->getOrderId()); if ($this->isDebug()) { $data = array_merge($data, array('sandbox' => 1)); } $dataEncode = base64_encode(json_encode($data)); $signature = base64_encode(sha1($privateKey . $dataEncode . $privateKey, 1)); return $this->_uri . '?' . $this->_jbrouter->query(array('data' => $dataEncode, 'signature' => $signature)); }
/** * Save an existing or a new mood form POST */ public function apply() { CommunityLicenseHelper::_(); JRequest::checkToken() or jexit(JText::_('COM_COMMUNITY_INVALID_TOKEN')); $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; $scss = $jinput->post->get('scss', null, 'array'); if (JString::strtoupper($jinput->getMethod()) != 'POST') { $mainframe->redirect('index.php?option=com_community&view=moods', JText::_('COM_COMMUNITY_PERMISSION_DENIED'), 'error'); } if (!is_null($scss)) { CommunityThemeHelper::parseScss($scss, 'colors'); } $message = JText::_('COM_COMMUNITY_THEME_COLORS_UPDATED'); $mainframe->redirect('index.php?option=com_community&view=themecolors', $message, 'message'); }
/** * Save file * @param array $params * @param $path * @return bool */ public function saveToFile(array $params, $path) { $fileTemplate = array('<?php', '/**', ' * JBZoo App is universal Joomla CCK, application for YooTheme Zoo component', ' *', ' * @package jbzoo', ' * @version 2.x Pro', ' * @author JBZoo App http://jbzoo.com', ' * @copyright Copyright (C) JBZoo.com, All rights reserved.', ' * @license http://jbzoo.com/license JBZoo Licence', ' */', '', '// no direct access', 'defined(\'_JEXEC\') or die(\'Restricted access\');', '', ''); foreach ($params as $key => $value) { $constName = JString::strtoupper($key); $value = str_replace('\'', "\\'", $value); $fileTemplate[] = 'define(\'' . $constName . '\', \'' . $value . '\');'; } $fileTemplate[] = ''; $fileContent = implode(PHP_EOL, $fileTemplate); if (JFile::exists($path)) { JFile::delete($path); } if (!JFile::write($path, $fileContent)) { $this->app->jbnotify->warning('The file is not created, check file permissions for JBZoo directory'); return false; } return true; }
/** * Save the profile information */ public function apply() { CommunityLicenseHelper::_(); JRequest::checkToken() or jexit(JText::_('COM_COMMUNITY_INVALID_TOKEN')); $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; if (JString::strtoupper($jinput->getMethod()) != 'POST') { $mainframe->redirect('index.php?option=com_community&view=themegroups', JText::_('COM_COMMUNITY_PERMISSION_DENIED'), 'error'); } // save the config first $configs = $jinput->post->get('config', null, 'array'); $model = $this->getModel('Configuration'); if (!empty($configs)) { $model->save($configs); } // There isn't much that can go wrong, no validation required $message = JText::_('COM_COMMUNITY_THEME_PROFILE_UPDATED'); $mainframe->redirect('index.php?option=com_community&view=themegroups', $message, 'message'); }
/** * Checks validation * @param array $params * @return null|void * @throws AppException */ public function isValid($params = array()) { $shopid = JString::trim(JString::strtoupper($this->config->get('shopid'))); $reqShopid = JString::trim(JString::strtoupper($this->app->jbrequest->get('ik_co_id'))); if ($reqShopid !== $shopid) { throw new JBCartElementPaymentException('Not correct shopid'); } $status = JString::trim(JString::strtoupper($this->app->jbrequest->get('ik_inv_st'))); if ($status !== 'SUCCESS') { throw new JBCartElementPaymentException('Not correct status'); } $isTest = $this->_checkIkHash($this->config->get('test_key')); if ($this->isDebug() && $isTest) { return true; } $isReal = $this->_checkIkHash($this->config->get('key')); if (!$this->isDebug() && $isReal) { return true; } return false; }
function display($tpl = null) { JToolBarHelper::title(JText::_('Профили'), 'profile'); JToolBarHelper::deleteList(); JToolBarHelper::editListX(); JToolBarHelper::addNewX(); JToolBarHelper::publishList(); JToolBarHelper::unpublishList(); $items =& $this->get('Data'); $this->assignRef('items', $items); $pagination =& $this->get('Pagination'); $this->assignRef('pagination', $pagination); global $option; $apl = JFactory::getApplication(); $filter_order = $apl->getUserStateFromRequest($option . 'filter_order', 'filter_order', 'published'); $filter_order_Dir = JString::strtoupper($apl->getUserStateFromRequest($option . 'filter_order_Dir', 'filter_order_Dir', 'ASC')); $lists = array(); $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; $this->assignRef('lists', $lists); parent::display($tpl); }
public static function getLikeHTML($row, $position = 'vertical') { $config = DiscussHelper::getConfig(); if (!$config->get('integration_facebook_like')) { return ''; } $document = JFactory::getDocument(); $language = $document->getLanguage(); $language = explode('-', $language); if (count($language) != 2) { $language = array('en', 'GB'); } $layout = $config->get('integration_facebook_like_layout'); $faces = $config->get('integration_facebook_like_faces') ? 'true' : 'false'; $width = $config->get('integration_facebook_like_width'); $verb = $config->get('integration_facebook_like_verb'); $theme = $config->get('integration_facebook_like_theme'); $send = $config->get('integration_facebook_like_send') ? 'true' : 'false'; $height = $faces == 'true' ? '70' : '30'; $locale = $language[0] . '_' . JString::strtoupper($language[1]); $fb = DiscussHelper::getHelper('Facebook'); $fb->addOpenGraph($row); $url = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=post&id=' . $row->id, true, true); $html = ''; if ($position == 'horizontal') { $layout = 'button_count'; } else { $layout = 'box_count'; } $html = '<div class="social-button facebook-like">'; if ($config->get('integration_facebook_scripts')) { $html .= '<div id="fb-root"></div><script src="https://connect.facebook.net/' . $locale . '/all.js#xfbml=1"></script>'; } $html .= '<fb:like href="' . $url . '" send="' . $send . '" layout="' . $layout . '" action="' . $verb . '" '; $html .= 'locale="' . $locale . '" colorscheme="' . $theme . '" show_faces="' . $faces . '" style="height: ' . $height . ';" height="' . $height . '"></fb:like>'; $html .= '</div>'; return $html; }
/** * Save data into the DB * * @param array $data The data about item * * @return int Item ID */ public function save($data) { $id = JArrayHelper::getValue($data, "id"); $title = JArrayHelper::getValue($data, "title"); $code = JArrayHelper::getValue($data, "code"); $symbol = JArrayHelper::getValue($data, "symbol"); $published = JArrayHelper::getValue($data, "published"); $params = JArrayHelper::getValue($data, "params", array(), "array"); if (!$params) { $params = null; } else { $params = json_encode($params); } // Load a record from the database $row = $this->getTable(); $row->load($id); $row->set("title", $title); $row->set("code", JString::strtoupper($code)); $row->set("symbol", $symbol); $row->set("params", $params); $row->set("published", $published); $row->store(true); return $row->get("id"); }
/** * Prepare some main filters. * * @param JDatabaseQuery $query */ protected function prepareFilters(&$query) { $db = JFactory::getDbo(); // Filter by featured state. $value = $this->getState($this->context . '.filter_featured'); if (null !== $value) { if (!$value) { $query->where('a.featured = 0'); } else { $query->where('a.featured = 1'); } } // Filter by category ID $value = (int) $this->getState($this->context . '.category_id', 0); if ($value > 0) { $query->where('a.catid = ' . $value); } // Filter by project type $value = (int) $this->getState($this->context . '.filter_projecttype', 0); if ($value > 0) { $query->where('a.type_id = ' . $value); } // Filter by user. $value = (int) $this->getState($this->context . '.filter_user', 0); if ($value > 0) { $query->where('a.user_id = ' . $value); } // Filter by country $value = $this->getState($this->context . '.filter_country'); if (JString::strlen($value) > 0) { $query->innerJoin($db->quoteName('#__crowdf_locations', 'l') . ' ON a.location_id = l.id'); $query->where('l.country_code = ' . $db->quote($value)); } // Filter by location $value = (int) $this->getState($this->context . '.filter_location'); if ($value > 0) { $query->where('a.location_id = ' . (int) $value); } // Filter by funding type $value = JString::strtoupper(JString::trim($this->getState($this->context . '.filter_fundingtype'))); if (JString::strlen($value) > 0) { $allowedFundingTypes = array('FIXED', 'FLEXIBLE'); if (in_array($value, $allowedFundingTypes, true)) { $query->where('a.funding_type = ' . $db->quote($value)); } } // Filter by phrase $value = $this->getState($this->context . '.filter_phrase'); if (JString::strlen($value) > 0) { $escaped = $db->escape($value, true); $quoted = $db->quote('%' . $escaped . '%', false); $query->where('a.title LIKE ' . $quoted); } }
if (!defined('COM_FABRIK_FRONTEND')) { JError::raiseError(400, JText::_('COM_FABRIK_SYSTEM_PLUGIN_NOT_ACTIVE')); } require_once JPATH_COMPONENT . '/controller.php'; /** * Test for YQL & XML document type * use the format request value to check for document type */ $docs = array("yql", "xml"); foreach ($docs as $d) { if (JRequest::getCmd("type") == $d) { // Get the class require_once JPATH_SITE . '/administrator/components/com_fabrik/classes/' . $d . 'document.php'; // Replace the document $document = JFactory::getDocument(); $docClass = 'JDocument' . JString::strtoupper($d); $document = new $docClass(); } } JModel::addIncludePath(JPATH_COMPONENT . '/models'); // $$$ rob if you want to you can override any fabrik model by copying it from // models/ to models/adaptors the copied file will overwrite (NOT extend) the original JModel::addIncludePath(JPATH_COMPONENT . '/models/adaptors'); $controllerName = JRequest::getCmd('view'); // Check for a plugin controller // Call a plugin controller via the url : // &c=visualization.calendar $isplugin = false; $cName = JRequest::getCmd('controller'); if (JString::strpos($cName, '.') != false) { list($type, $name) = explode('.', $cName);
public function getTitle() { return JText::_('COM_EASYSOCIAL_SHARING_' . JString::strtoupper($this->name)); }
/** * Responsible to save an existing or a new group. */ public function save() { JRequest::checkToken() or jexit(JText::_('COM_COMMUNITY_INVALID_TOKEN')); $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; if (JString::strtoupper($jinput->getMethod()) != 'POST') { $mainframe->redirect('index.php?option=com_community&view=groups', JText::_('COM_COMMUNITY_PERMISSION_DENIED'), 'error'); } // Load frontend language file. $lang = JFactory::getLanguage(); $lang->load('com_community', JPATH_ROOT); $group = JTable::getInstance('Group', 'CTable'); $id = JRequest::getInt('groupid'); $group->load($id); $tmpPublished = $group->published; $name = $jinput->post->get('name', '', 'STRING'); $published = $jinput->post->get('published', '', 'NONE'); $description = $_POST['description']; $categoryId = $jinput->post->get('categoryid', '', 'INT'); $creator = JRequest::getInt('creator', 0, 'POST'); $website = $jinput->post->get('website', '', 'STRING'); $validated = true; $model = $this->getModel('Groups', 'CommunityAdminModel'); $isNew = $group->id < 1; $ownerChanged = $group->ownerid != $creator && $group->id >= 1; // @rule: Test for emptyness if (empty($name)) { $validated = false; $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_GROUPS_EMPTY_NAME_ERROR'), 'error'); } // @rule: Test if group exists if ($model->groupExist($name, $group->id)) { $validated = false; $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_GROUPS_NAME_TAKEN_ERROR'), 'error'); } // @rule: Test for emptyness if (empty($description)) { $validated = false; $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_GROUPS_DESCRIPTION_EMPTY_ERROR'), 'error'); } if (empty($categoryId)) { $validated = false; $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_GROUPS_CATEGORY_ERROR'), 'error'); } if ($validated) { // Get the configuration object. $config = CFactory::getConfig(); $group->bindRequestParams(); // Bind the post with the table first $group->name = $name; $group->published = $published; $group->description = $description; $group->categoryid = $categoryId; $group->website = $website; $group->approvals = JRequest::getInt('approvals', '0', 'POST'); $oldOwner = $group->ownerid; $group->ownerid = $creator; if ($isNew) { $group->created = gmdate('Y-m-d H:i:s'); } $group->store(); if ($isNew) { // Since this is storing groups, we also need to store the creator / admin // into the groups members table $member = JTable::getInstance('GroupMembers', 'CTable'); $member->groupid = $group->id; $member->memberid = $group->ownerid; // Creator should always be 1 as approved as they are the creator. $member->approved = 1; // @todo: Setup required permissions in the future $member->permissions = '1'; $member->store(); } if (!$isNew && $ownerChanged) { $group->updateOwner($oldOwner, $creator); } // send notification if necessary if ($tmpPublished == 0 && $group->published == 1 && $config->get('moderategroupcreation')) { $this->notificationApproval($group); } $message = $isNew ? JText::_('COM_COMMUNITY_GROUPS_CREATED') : JText::_('COM_COMMUNITY_GROUPS_UPDATED'); $mainframe->redirect('index.php?option=com_community&view=groups', $message, 'message'); } $document = JFactory::getDocument(); $viewName = JRequest::getCmd('view', 'community'); // Get the view type $viewType = $document->getType(); // Get the view $view = $this->getView($viewName, $viewType); $view->setLayout('edit'); $model = $this->getModel($viewName, 'CommunityAdminModel'); if ($model) { $view->setModel($model, $viewName); } $view->display(); }
/** * Return a string of the where clause for filtering the the backend list of attachments * * @param string $parent_state the state ('ALL', 'PUBLISHED', 'UNPUBLISHED', 'ARCHIVED', 'NONE') * @param string $filter_entity the entity filter ('ALL', 'ARTICLE', 'CATEGORY') * * @return an array of where clauses */ public function getParentPublishedFilter($parent_state, $filter_entity) { // If we want all attachments, do no filtering if ($parent_state == 'ALL') { return array(); } $db = JFactory::getDBO(); $where = array(); $filter_entity = JString::strtoupper($filter_entity); // NOTE: These WHERE clauses will be combined by OR if ($parent_state == 'PUBLISHED') { if ($filter_entity == 'ALL' || $filter_entity == 'ARTICLE') { $now = JFactory::getDate()->toSql(); $nullDate = $db->getNullDate(); $where[] = "EXISTS (SELECT * FROM #__content AS c1 " . "WHERE (a.parent_entity = 'article' AND c1.id = a.parent_id AND c1.state=1 AND " . '(c1.publish_up = ' . $db->quote($nullDate) . ' OR c1.publish_up <= ' . $db->quote($now) . ') AND ' . '(c1.publish_down = ' . $db->quote($nullDate) . ' OR c1.publish_down >= ' . $db->quote($now) . ')))'; } if ($filter_entity == 'ALL' || $filter_entity == 'CATEGORY') { $where[] = "EXISTS (SELECT * FROM #__categories AS c2 " . "WHERE (a.parent_entity = 'category' AND c2.id = a.parent_id AND c2.published=1))"; } } elseif ($parent_state == 'UNPUBLISHED') { // These WHERE clauses will be combined by OR if ($filter_entity == 'ALL' || $filter_entity == 'ARTICLE') { $where[] = "EXISTS (SELECT * FROM #__content AS c1 " . "WHERE (a.parent_entity = 'article' AND c1.id = a.parent_id AND c1.state=0))"; $where[] = "(a.parent_entity = 'article' AND NOT EXISTS (select * from #__content as c1 where c1.id = a.parent_id))"; // ??? Add clauses here to get articles that are unpublished because of publish_up/publish_down } if ($filter_entity == 'ALL' || $filter_entity == 'CATEGORY') { $where[] = "EXISTS (SELECT * FROM #__categories AS c2 " . "WHERE (a.parent_entity = 'category' AND c2.id = a.parent_id AND c2.published=0))"; $where[] = "(a.parent_entity = 'category' AND NOT EXISTS (select * from #__categories as c1 where c1.id = a.parent_id))"; } } elseif ($parent_state == 'ARCHIVED') { // These WHERE clauses will be combined by OR if ($filter_entity == 'ALL' || $filter_entity == 'ARTICLE') { $where[] = "EXISTS (SELECT * FROM #__content AS c1 " . "WHERE (a.parent_entity = 'article' AND c1.id = a.parent_id AND c1.state=2))"; } if ($filter_entity == 'ALL' || $filter_entity == 'CATEGORY') { $where[] = "EXISTS (SELECT * FROM #__categories AS c2 " . "WHERE (a.parent_entity = 'category' AND c2.id = a.parent_id AND c2.published=2))"; } } elseif ($parent_state == 'TRASHED') { // These WHERE clauses will be combined by OR if ($filter_entity == 'ALL' || $filter_entity == 'ARTICLE') { $where[] = "EXISTS (SELECT * FROM #__content AS c1 " . "WHERE (a.parent_entity = 'article' AND c1.id = a.parent_id AND c1.state=-2))"; } if ($filter_entity == 'ALL' || $filter_entity == 'CATEGORY') { $where[] = "EXISTS (SELECT * FROM #__categories AS c2 " . "WHERE (a.parent_entity = 'category' AND c2.id = a.parent_id AND c2.published=-2))"; } } elseif ($parent_state == 'NONE') { // NOTE: The 'NONE' clauses will be combined with AND (with other tests for a.parent_id) $where[] = "(NOT EXISTS( SELECT * FROM #__content as c1 " . "WHERE a.parent_entity = 'article' AND c1.id = a.parent_id ))"; $where[] = "(NOT EXISTS( SELECT * FROM #__categories as c2 " . "WHERE a.parent_entity = 'category' AND c2.id = a.parent_id ))"; } else { $errmsg = JText::sprintf('ATTACH_ERROR_UNRECOGNIZED_PARENT_STATE_S', $parent_state) . ' (ERR 407)'; JError::raiseError(500, $errmsg); } return $where; }
/** * Parse subject and body, replacing indicators with other values. * * <code> * $subject = "Here you are my website."; * $body = "My website is {WEBSITE}..."; * * $data = array( * "website" => "http://itprism.com" * ); * * $email = new VirtualCurrencyEmail($subject, $body); * $email->bind($data); * * // Replace {WEBSITE} with http://itprism.com. * $email->parse($data); * * $body = $email->setBody(); * </code> * * @param array $data * * @return string */ public function parse($data) { foreach ($data as $key => $value) { // Prepare flag $search = "{" . JString::strtoupper($key) . "}"; // Parse subject $this->subject = str_replace($search, $value, $this->subject); // Parse body $this->body = str_replace($search, $value, $this->body); } return $this; }
/** * Build the filter query for the given element. * Can be overwritten in plugin - e.g. see checkbox element which checks for partial matches * * @param string $key Element name in format `tablename`.`elementname` * @param string $condition =/like etc. * @param string $value Search string - already quoted if specified in filter array options * @param string $originalValue Original filter value without quotes or %'s applied * @param string $type Filter type advanced/normal/prefilter/search/querystring/searchall * * @return string sql query part e,g, "key = value" */ public function getFilterQuery($key, $condition, $value, $originalValue, $type = 'normal') { $element = $this->getElement(); $db = JFactory::getDbo(); $condition = JString::strtoupper($condition); $this->encryptFieldName($key); $glue = 'OR'; if ($element->filter_type == 'checkbox' || $element->filter_type == 'multiselect') { $str = array(); if ($condition === 'NOT IN') { $partialComparison = ' NOT LIKE '; $comparison = ' <> '; $glue = ' AND '; } else { $partialComparison = ' LIKE '; $comparison = ' = '; $glue = ' OR '; } switch ($condition) { case 'IN': case 'NOT IN': /** * Split out 1,2,3 into an array to iterate over. * It's a string if pre-filter, array if element filter */ if (!is_array($originalValue)) { $originalValue = explode(',', $originalValue); } foreach ($originalValue as &$v) { $v = trim($v); $v = FabrikString::ltrimword($v, '"'); $v = FabrikString::ltrimword($v, "'"); $v = FabrikString::rtrimword($v, '"'); $v = FabrikString::rtrimword($v, "'"); } break; default: $originalValue = (array) $originalValue; break; } foreach ($originalValue as $v2) { $v2 = str_replace("/", "\\\\/", $v2); $str[] = '(' . $key . $partialComparison . $db->quote('%"' . $v2 . '"%') . $glue . $key . $comparison . $db->quote($v2) . ') '; } $str = '(' . implode($glue, $str) . ')'; } else { $originalValue = trim($value, "'"); /* * JSON stored values will back slash "/". So we need to add "\\\\" * before it to escape it for the query. */ $originalValue = str_replace("/", "\\\\/", $originalValue); if (strtoupper($condition) === 'IS NULL') { $value = ''; } switch ($condition) { case '=': case '<>': $condition2 = $condition == '=' ? 'LIKE' : 'NOT LIKE'; $glue = $condition == '=' ? 'OR' : 'AND'; $db = FabrikWorker::getDbo(); $str = "({$key} {$condition} {$value} " . " {$glue} {$key} {$condition2} " . $db->quote('["' . $originalValue . '"%') . " {$glue} {$key} {$condition2} " . $db->quote('%"' . $originalValue . '"%') . " {$glue} {$key} {$condition2} " . $db->quote('%"' . $originalValue . '"]') . ")"; break; default: $str = " {$key} {$condition} {$value} "; break; } } return $str; }
?> <thead> <tr> <th width="1%" style="display:none;"> </th> <th class="list-name" id="tableOrderingname"> <?php echo JHtml::_('grid.sort', 'COM_KNVBAPI_HEADING_NAME', 'a.name', $list_dirn, $list_order); ?> </th> <?php if ($date = $this->params->get('list_show_competitie_date')) { ?> <th class="list-date" id="tableOrderingdate"> <?php echo JHtml::_('grid.sort', 'COM_KNVBAPI_FIELD_' . JString::strtoupper($date) . '_LABEL', 'a.' . $date, $list_dirn, $list_order); ?> </th> <?php } ?> <?php if ($this->params->get('list_show_competitie_created_by', 0)) { ?> <th class="list-created_by" id="tableOrderingcreated_by"> <?php echo JHtml::_('grid.sort', 'COM_KNVBAPI_HEADING_CREATED_BY', 'created_by_name', $list_dirn, $list_order); ?> </th> <?php