public static function getTranslateConfig() { if (empty(self::$translateConfig) && is_file(self::getParam('translateConfigFile'))) { self::$translateConfig = (include self::getParam('translateConfigFile')); } return self::$translateConfig; }
/** * Displays the view. * * @param string $tpl the template name * * @return void * @since 1.0 */ public function display($tpl = null) { JHTML::_('behavior.modal'); //TODO: Need to move css/js to SetDocument JHTML::stylesheet('media/com_newsletter/css/admin.css'); JHTML::stylesheet('media/com_newsletter/css/subscribers.css'); JHTML::script('media/com_newsletter/js/migur/js/core.js'); JHTML::script('media/com_newsletter/js/migur/js/filterpanel.js'); JHTML::script('media/com_newsletter/js/migur/js/search.js'); JHTML::script(JURI::root() . "administrator/components/com_newsletter/views/subscribers/subscribers.js"); $this->setModel(JModel::getInstance('lists', 'NewsletterModel')); EnvironmentHelper::showWarnings(array('checkUserConflicts')); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } // We don't need toolbar in the modal window. if ($this->getLayout() !== 'modal') { $this->addToolbar(); } $modelSubs = $this->getModel('subscribers'); $modelLists = $this->getModel('lists'); $ss = (object) array('items' => $modelSubs->getItems(), 'pagination' => $modelSubs->getPagination(), 'state' => $modelSubs->getState(), 'listOrder' => $modelSubs->getState('list.ordering'), 'listDirn' => $modelSubs->getState('list.direction')); $this->assignRef('subscribers', $ss); $lists = (object) array('items' => $modelLists->getItems(), 'pagination' => $modelLists->getPagination(), 'state' => $modelLists->getState(), 'listOrder' => $modelLists->getState('list.ordering'), 'listDirn' => $modelLists->getState('list.direction')); $this->assignRef('lists', $lists); $this->assignRef('subscriberModel', JModel::getInstance('Subscriber', 'NewsletterModelEntity')); parent::display($tpl); }
/** * Gets last used schema from #_schema * * @return string json */ public function checkDb() { $res = array(); // 1. Check the schema version $man = NewsletterHelper::getManifest(); $version = $man->version; $schema = EnvironmentHelper::getLastSchema(); $sc = version_compare($schema, $version) <= 0; $res[] = array('text' => JText::_('COM_NEWSLETTER_MAINTAINANCE_CHECKSCHEMA') . ': ' . $schema, 'type' => $sc); // 2. Check if all tables are present $res[] = array('text' => JText::_('COM_NEWSLETTER_MAINTAINANCE_CHECKSCHEMA') . ': ' . $schema, 'type' => $sc); $installFile = file_get_contents(JPATH_COMPONENT_ADMINISTRATOR . DS . 'install' . DS . 'install.sql'); // explode whole script to table alter scripts $tableAlters = array(); preg_match_all("/create\\s*table\\s*[\\`\"\\']?([\\#\\_a-zA-Z0-9]+)[\\`\"\\']?[^;]*/is", $installFile, $tableAlters); $dbo = JFactory::getDbo(); for ($i = 0; $i < count($tableAlters[0]); $i++) { // Process each table... $tableName = $tableAlters[1][$i]; $alterScript = $tableAlters[0][$i]; // Get fields of table from alter script $matches = array(); preg_match_all("/^\\s*(?:\\`|\"|\\')([a-z0-9_]+)/m", $alterScript, $matches); $fields = $matches[1]; // Get destription of a table from DB $dbo->setQuery('DESCRIBE ' . $tableName); $data = $dbo->loadAssocList(); // Check if table absent at all if ($data === null) { $res[] = array('text' => JText::sprintf('COM_NEWSLETTER_MAINTAINANCE_TABLE_ABSENT', $tableName), 'type' => false); } else { // Check if some fields of a table absent $fieldsPresent = array(); foreach ($data as $item) { $fieldsPresent[] = $item['Field']; } foreach ($fields as $field) { if (!in_array($field, $fieldsPresent)) { $res[] = array('text' => JText::sprintf('COM_NEWSLETTER_MAINTAINANCE_TABLE_FIELD_ABSENT', $field, $tableName), 'type' => false); } } } } // 3. Check conflicts $count = EnvironmentHelper::getConflictsCount(); $res[] = array('text' => JText::_('COM_NEWSLETTER_MAINTAINANCE_CHECKUSERCONFLICTS') . ' ' . JText::sprintf('COM_NEWSLETTER_CONFLICTS_FOUND', $count), 'type' => $count == 0); // 4. Remove all died rows $dbo = JFactory::getDbo(); $dbo->setQuery('DELETE FROM #__newsletter_subscribers ' . 'USING #__newsletter_subscribers ' . 'LEFT JOIN #__users AS u ON u.id = #__newsletter_subscribers.user_id ' . 'WHERE #__newsletter_subscribers.email="" AND #__newsletter_subscribers.user_id > 0 AND u.id IS NULL'); if ($dbo->query()) { $diedCnt = $dbo->getAffectedRows(); $res[] = array('text' => JText::_('COM_NEWSLETTER_MAINTAINANCE_CHECKDIEDROWS') . ':' . $diedCnt, 'type' => true); } else { $res[] = array('text' => JText::_('COM_NEWSLETTER_MAINTAINANCE_CHECKDIEDROWS'), 'type' => false); } // Return data NewsletterHelper::jsonMessage('checkDb', $res); }
/** * Displays the view. * * @param string $tpl the template name * * @return void * @since 1.0 */ public function display($tpl = null) { JHTML::stylesheet('media/com_newsletter/css/admin.css'); JHTML::stylesheet('media/com_newsletter/css/dashboard.css'); JHTML::script('media/com_newsletter/js/migur/js/core.js'); JHTML::script('media/com_newsletter/js/migur/js/raphael-min.js'); JHTML::script('media/com_newsletter/js/migur/js/g.raphael-min.js'); JHTML::script('media/com_newsletter/js/migur/js/g.line-min.js'); JHTML::script('media/com_newsletter/js/migur/js/g.raphael.js'); JHTML::script('media/com_newsletter/js/migur/js/g.line.js'); JHTML::script('media/com_newsletter/js/migur/js/g.pie.js'); JHTML::script('media/com_newsletter/js/migur/js/g.bar.js'); JHTML::script('media/com_newsletter/js/migur/js/raphael-migur-line.js'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } EnvironmentHelper::showWarnings(array('checkJoomla', 'checkImap', 'checkLogs')); $this->addToolbar(); $stat = QueueHelper::getCount(); $sent = 0; $toSend = 0; $total = 0; foreach ($stat as $row) { $sent += $row['sent']; $toSend += $row['to_send']; $total += $row['total']; } JavascriptHelper::addStringVar('emailsSent', $sent); JavascriptHelper::addStringVar('emailsToSend', $toSend); JavascriptHelper::addStringVar('emailsTotal', $total); JavascriptHelper::addStringVar('newslettersSent', count($stat)); $cache = JFactory::getCache('com_newsletter'); $this->news = $cache->call(array('RssfeedHelper', 'loadFeed'), new JObject(array('rssurl' => JRoute::_('http://migur.com/blog?format=feed&type=rss')))); $this->info = NewsletterHelper::getCommonInfo(); $this->setStatisticsData(); $sess = JFactory::getSession(); JavascriptHelper::addStringVar('sessname', $sess->getName()); parent::display($tpl); // Set the document $this->setDocument(); }
/** * Perform checks. Returns verbal messages. * * @param array|string names of checks you want to perform * * @return array Verbal warnings * * @since 1.0.3 */ public static function getWarnings($checkList = array()) { $methods = self::getAvailableChecks(); // Get only requested and available if (!empty($checkList)) { $checkList = (array) $checkList; $methods = array_intersect($checkList, $methods); } // Do checks $res = array(); foreach ($methods as $m) { self::$data = array(); if (!self::$m()) { array_push($res, JText::sprintf('COM_NEWSLETTER_ENVIRONMENT_' . strtoupper($m), isset(self::$data[0]) ? self::$data[0] : '', isset(self::$data[1]) ? self::$data[1] : '')); } } self::$data = array(); return $res; }
/** * Displays the view. * * @param string $tpl the template name * * @return void * @since 1.0 */ public function display($tpl = null) { //TODO: Need to move css/js to SetDocument JHTML::stylesheet('media/com_newsletter/css/admin.css'); JHTML::stylesheet('media/com_newsletter/css/queues.css'); JHTML::script('media/com_newsletter/js/migur/js/core.js'); JHTML::script('media/com_newsletter/js/migur/js/filterpanel.js'); JHTML::script('media/com_newsletter/js/migur/js/search.js'); JHTML::script(JURI::root() . "/administrator/components/com_newsletter/views/queues/queues.js"); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } EnvironmentHelper::showWarnings(array('checkJoomla', 'checkImap', 'checkLogs')); // We don't need toolbar in the modal window. if ($this->getLayout() !== 'modal') { $this->addToolbar(); } // JHTML::_('behavior.modal'); // Let's work with model 'queues' ! $model = $this->getModel('queues'); $items = $model->getItems(); $pagination = $model->getPagination(); $state = $model->getState(); $listOrder = $model->getState('list.ordering'); $listDirn = $model->getState('list.direction'); $saveOrder = $listOrder == 'a.ordering'; $this->assignRef('items', $items); $this->assignRef('pagination', $pagination); $this->assignRef('state', $state); $this->assignRef('listOrder', $listOrder); $this->assignRef('listDirn', $listDirn); $this->assignRef('saveOrder', $saveOrder); $sess = JFactory::getSession(); JavascriptHelper::addStringVar('sessname', $sess->getName()); parent::display($tpl); }
/** * Displays the view. * * @param string $tpl the template name * * @return void * @since 1.0 */ public function display($tpl = null) { JHTML::_('behavior.modal'); JHTML::stylesheet('media/com_newsletter/css/admin.css'); JHTML::stylesheet('media/com_newsletter/css/configuration.css'); JHTML::script('media/com_newsletter/js/migur/js/core.js'); JHTML::script('administrator/components/com_newsletter/views/configuration/configuration.js'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } EnvironmentHelper::showWarnings(array('checkJoomla', 'checkImap', 'checkLogs', 'checkAcl')); $this->general = JComponentHelper::getParams('com_newsletter'); //$model = JModel::getInstance('extensions', 'NewsletterModel'); //$this->modules = $model->getModules(); //$this->plugins = $model->getPlugins(); $this->modules = MigurModuleHelper::getSupported(); $this->plugins = MigurPluginHelper::getSupported(); $this->form = $this->get('Form'); $this->addToolbar(); parent::display($tpl); }
'error' => 'Вы пытаетесь забронировать прошедшую игру. Выберите другое время' ); } else { if (IBlockHelper::existRequest($arFields['DATE'])) { $arResult = array( 'success' => 0, 'error' => 'Данное время уже забранировано' ); } else { $el = new CIBlockElement; $arFields['PRICE'] = IBlockHelper::getGamePrice($arFields['DATE']); $arFields['DAYWEEK'] = FormatDate('l', $stamp); $arAddFields = array( 'IBLOCK_ID' => EnvironmentHelper::getParam('requestIBlockId'), 'ACTIVE' => 'Y', 'DATE_ACTIVE_FROM' => $arFields['DATE'], 'NAME' => htmlspecialchars(trim($arFields['PHONE'])), 'PROPERTY_VALUES' => array( 'NAME' => htmlspecialchars(trim($arFields['NAME'])), 'EMAIL' => htmlspecialchars(trim($arFields['EMAIL'])), 'QUEST' => htmlspecialchars(trim($arFields['QUEST'])), 'PRICE' => $arFields['PRICE'], 'DAYWEEK' => $arFields['DAYWEEK'] ) ); if ($requestId = $el->add($arAddFields)) { $arResult = array( 'success' => 1,
<?php /** * Инициализатор конфигурации */ EnvironmentHelper::setConfiguration(array('requestIBlockId' => 2, 'emailPattern' => '^([a-z0-9_\\.-])+@[a-z0-9-]+\\.([a-z]{2,4}\\.)?[a-z]{2,4}$')); define('ASSETS_DIR', '/local/assets'); if (file_exists(sprintf('%s%sconfig_override.php', __DIR__, DIRECTORY_SEPARATOR))) { include_once 'config_override.php'; }
<?php /** * Инициализатор конфигурации */ EnvironmentHelper::setConfiguration(array('scheduleIBlockId' => 1, 'requestIBlockId' => 2, 'defaultPrice' => 2000, 'emailPattern' => '^([a-z0-9_\\.-])+@[a-z0-9-]+\\.([a-z]{2,4}\\.)?[a-z]{2,4}$')); if (file_exists(sprintf('%s%sam_override.php', __DIR__, DIRECTORY_SEPARATOR))) { include_once 'am_override.php'; }
<? function logArray() { $arArgs = func_get_args(); $strResult = ''; foreach ($arArgs as $arArg) { $strResult .= "\n\n" . print_r($arArg, true); } if (!defined('LOG_FILENAME')) { define('LOG_FILENAME', $_SERVER['DOCUMENT_ROOT'] . '/bitrix/log.txt'); } AddMessage2Log($strResult, 'logArray -> '); } require_once 'include/helper/EnvironmentHelper.php'; include_once sprintf('include/config/%s', EnvironmentHelper::getConfigInitializerFileNameForSite(SITE_ID)); include(dirname(__FILE__) . '/func.php'); include(dirname(__FILE__) . '/include/helper/StringHelper.php'); include(dirname(__FILE__) . '/include/helper/IBlockHelper.php'); include(dirname(__FILE__) . '/include/helper/FormHelper.php');