コード例 #1
0
ファイル: listslanguages.php プロジェクト: utopszkij/lmp
 function listslanguagesType()
 {
     jimport('joomla.filesystem.folder');
     $path = JLanguage::getLanguagePath(JPATH_ROOT);
     $dirs = JFolder::folders($path);
     $this->languages = array();
     foreach ($dirs as $dir) {
         if (strlen($dir) != 5 || $dir == "xx-XX") {
             continue;
         }
         $xmlFiles = JFolder::files($path . DS . $dir, '^([-_A-Za-z]*)\\.xml$');
         $xmlFile = reset($xmlFiles);
         if (empty($xmlFile)) {
             continue;
         }
         $data = JApplicationHelper::parseXMLLangMetaFile($path . DS . $dir . DS . $xmlFile);
         $oneLanguage = new stdClass();
         $oneLanguage->language = strtolower($dir);
         $oneLanguage->name = empty($data['name']) ? $dir : $data['name'];
         $this->languages[] = $oneLanguage;
     }
     if (count($this->languages) < 2) {
         return;
     }
     $this->multipleLang = true;
     $this->choice = array();
     $this->choice[] = JHTML::_('select.option', 'all', JText::_('ACY_ALL'));
     $this->choice[] = JHTML::_('select.option', 'special', JText::_('ACY_CUSTOM'));
     $js = "function updateLanguages(){\n\t\t\tchoice = eval('document.adminForm.choice_languages');\n\t\t\tchoiceValue = 'special';\n\t\t\tfor (var i=0; i < choice.length; i++){\n\t\t\t\t if (choice[i].checked){\n\t\t\t\t\t choiceValue = choice[i].value;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\thiddenVar = document.getElementById('hidden_languages');\n\t\t\tif(choiceValue != 'special'){\n\t\t\t\thiddenVar.value = choiceValue;\n\t\t\t\tdocument.getElementById('div_languages').style.display = 'none';\n\t\t\t}else{\n\t\t\t\tdocument.getElementById('div_languages').style.display = 'block';\n\t\t\t\tspecialVar = eval('document.adminForm.special_languages');\n\t\t\t\tfinalValue = '';\n\t\t\t\tfor (var i=0; i < specialVar.length; i++){\n\t\t\t\t\tif (specialVar[i].checked){\n\t\t\t\t\t\t\t finalValue += specialVar[i].value+',';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\thiddenVar.value = finalValue;\n\t\t\t}\n\n\t\t}";
     $doc = JFactory::getDocument();
     $doc->addScriptDeclaration($js);
 }
コード例 #2
0
ファイル: view.html.php プロジェクト: q0821/esportshop
 public function config($tpl = null)
 {
     hikaserial::setTitle(JText::_(self::name), self::icon, self::ctrl);
     $config = hikaserial::config();
     $this->assignRef('config', $config);
     $popup = hikaserial::get('shop.helper.popup');
     $this->assignRef('popup', $popup);
     $serialstatusType = hikaserial::get('type.serial_status');
     $this->assignRef('serial_status', $serialstatusType);
     $orderstatusType = hikaserial::get('type.order_status');
     $this->assignRef('orderstatusType', $orderstatusType);
     $manage = hikaserial::isAllowed($config->get('acl_config_manage', 'all'));
     $this->assignRef('manage', $manage);
     $toggleClass = hikaserial::get('helper.toggle');
     $languages = array();
     $lg = JFactory::getLanguage();
     $language = $lg->getTag();
     $styleRemind = 'float:right;margin-right:30px;position:relative;';
     $loadLink = $popup->display(JText::_('LOAD_LATEST_LANGUAGE'), 'EDIT_LANGUAGE_FILE', hikaserial::completeLink('config&task=latest&code=' . $language, true), 'loadlatest_language_' . $language, 800, 500, 'onclick="window.document.getElementById(\'hikashop_messages_warning\').style.display = \'none\';"', '', 'link');
     if (!file_exists(HIKASHOP_ROOT . 'language' . DS . $language . DS . $language . '.' . HIKASERIAL_COMPONENT . '.ini')) {
         if ($config->get('errorlanguagemissing', 1)) {
             $noteremind = '<small style="' . $styleRemind . '">' . $toggleClass->delete('hikashop_messages_warning', 'errorlanguagemissing-0', 'config', false, JText::_('DONT_REMIND')) . '</small>';
             hikaserial::display(JText::_('MISSING_LANGUAGE') . ' ' . $loadLink . ' ' . $noteremind, 'warning');
         }
     }
     $edit_image = HIKASHOP_IMAGES . 'icons/icon-16-edit.png';
     $new_image = HIKASHOP_IMAGES . 'icons/icon-16-new.png';
     jimport('joomla.filesystem.folder');
     $path = JLanguage::getLanguagePath(JPATH_ROOT);
     $dirs = JFolder::folders($path);
     foreach ($dirs as $dir) {
         $xmlFiles = JFolder::files($path . DS . $dir, '^([-_A-Za-z]*)\\.xml$');
         $xmlFile = array_pop($xmlFiles);
         if ($xmlFile == 'install.xml') {
             $xmlFile = array_pop($xmlFiles);
         }
         if (empty($xmlFile)) {
             continue;
         }
         $data = JApplicationHelper::parseXMLLangMetaFile($path . DS . $dir . DS . $xmlFile);
         $oneLanguage = new stdClass();
         $oneLanguage->language = $dir;
         $oneLanguage->name = $data['name'];
         $languageFiles = JFolder::files($path . DS . $dir, '^(.*)\\.' . HIKASERIAL_COMPONENT . '\\.ini$');
         $languageFile = reset($languageFiles);
         $linkEdit = hikaserial::completeLink('config&task=language&code=' . $oneLanguage->language, true, false, false);
         if (!empty($languageFile)) {
             $oneLanguage->edit = $popup->display('<img id="image' . $oneLanguage->language . '" src="' . $edit_image . '" alt="' . JText::_('EDIT_LANGUAGE_FILE', true) . '"/>', 'EDIT_LANGUAGE_FILE', $linkEdit, 'edit_language_' . $oneLanguage->language, 800, 500, '', '', 'link');
         } else {
             $oneLanguage->edit = $popup->display('<img id="image' . $oneLanguage->language . '" src="' . $new_image . '" alt="' . JText::_('ADD_LANGUAGE_FILE', true) . '"/>', 'ADD_LANGUAGE_FILE', $linkEdit, 'edit_language_' . $oneLanguage->language, 800, 500, '', '', 'link');
         }
         $languages[] = $oneLanguage;
     }
     $this->assignRef('languages', $languages);
     $this->toolbar = array('|', 'save', 'apply', 'hikacancel', '|', array('name' => 'pophelp', 'target' => 'config'), 'dashboard');
 }
コード例 #3
0
/**
* Compiles a list of installed languages
*/
function viewLanguages()
{
    global $mainframe, $option;
    // Initialize some variables
    $db =& JFactory::getDBO();
    $client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int'));
    $rows = array();
    $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
    $limitstart = $mainframe->getUserStateFromRequest($option . '.limitstart', 'limitstart', 0, 'int');
    $rowid = 0;
    // Set FTP credentials, if given
    jimport('joomla.client.helper');
    $ftp =& JClientHelper::setCredentialsFromRequest('ftp');
    //load folder filesystem class
    jimport('joomla.filesystem.folder');
    $path = JLanguage::getLanguagePath($client->path);
    $dirs = JFolder::folders($path);
    foreach ($dirs as $dir) {
        $files = JFolder::files($path . DS . $dir, '^([-_A-Za-z]*)\\.xml$');
        foreach ($files as $file) {
            $data = JApplicationHelper::parseXMLLangMetaFile($path . DS . $dir . DS . $file);
            $row = new StdClass();
            $row->id = $rowid;
            $row->language = substr($file, 0, -4);
            if (!is_array($data)) {
                continue;
            }
            foreach ($data as $key => $value) {
                $row->{$key} = $value;
            }
            // if current than set published
            $params = JComponentHelper::getParams('com_languages');
            if ($params->get($client->name, 'en-GB') == $row->language) {
                $row->published = 1;
            } else {
                $row->published = 0;
            }
            $row->checked_out = 0;
            $row->mosname = JString::strtolower(str_replace(" ", "_", $row->name));
            $rows[] = $row;
            $rowid++;
        }
    }
    jimport('joomla.html.pagination');
    $pageNav = new JPagination($rowid, $limitstart, $limit);
    $rows = array_slice($rows, $pageNav->limitstart, $pageNav->limit);
    HTML_languages::showLanguages($rows, $pageNav, $option, $client, $ftp);
}
コード例 #4
0
ファイル: extfilter.php プロジェクト: albertobraschi/Hab
 /**
  * Returns an annotated list of all front-end or back-end languages
  *
  * @param bool $frontend If true returns front-end languages, if false returns back-end languages
  * @return array The annotated languages array
  */
 function &_getAllLanguages($frontend = true)
 {
     static $_feLanguages;
     static $_beLanguages;
     if ($frontend) {
         if (!$_feLanguages) {
             $_feLanguages = array();
             jimport('joomla.filesystem.folder');
             // Get the site languages
             $langBDir = JLanguage::getLanguagePath(JPATH_SITE);
             $langDirs = JFolder::folders($langBDir);
             for ($i = 0; $i < count($langDirs); $i++) {
                 // Try to find VALID languages, by scanning and parsing their XML files
                 $row = array();
                 $row['language'] = $langDirs[$i];
                 $row['basedir'] = $langBDir;
                 $files = JFolder::files($langBDir . DS . $langDirs[$i], '^([-_A-Za-z]*)\\.xml$');
                 foreach ($files as $file) {
                     $data = JApplicationHelper::parseXMLLangMetaFile($langBDir . DS . $langDirs[$i] . DS . $file);
                     // If we didn't get valid data from the xml file, move on...
                     if (!is_array($data)) {
                         continue;
                     }
                     // Populate the row from the xml meta file
                     foreach ($data as $key => $value) {
                         $row[$key] = $value;
                     }
                     $clientVals =& JApplicationHelper::getClientInfo(0);
                     $lang = JComponentHelper::getParams('com_languages');
                     $row['default'] = $lang->get($clientVals->name, 'en-GB') == basename($row['language']);
                 }
                 if (isset($row['default'])) {
                     $_feLanguages[] = $row;
                 }
             }
         }
         return $_feLanguages;
     } else {
         if (!$_beLanguages) {
             $_beLanguages = array();
             jimport('joomla.filesystem.folder');
             // Get the site languages
             $langBDir = JLanguage::getLanguagePath(JPATH_ADMINISTRATOR);
             $langDirs = JFolder::folders($langBDir);
             for ($i = 0; $i < count($langDirs); $i++) {
                 // Try to find VALID languages, by scanning and parsing their XML files
                 $row = array();
                 $row['language'] = $langDirs[$i];
                 $row['basedir'] = $langBDir;
                 $files = JFolder::files($langBDir . DS . $langDirs[$i], '^([-_A-Za-z]*)\\.xml$');
                 foreach ($files as $file) {
                     $data = JApplicationHelper::parseXMLLangMetaFile($langBDir . DS . $langDirs[$i] . DS . $file);
                     // If we didn't get valid data from the xml file, move on...
                     if (!is_array($data)) {
                         continue;
                     }
                     // Populate the row from the xml meta file
                     foreach ($data as $key => $value) {
                         $row[$key] = $value;
                     }
                     $clientVals =& JApplicationHelper::getClientInfo(1);
                     $lang = JComponentHelper::getParams('com_languages');
                     $row['default'] = $lang->get($clientVals->name, 'en-GB') == basename($row['language']);
                 }
                 if (isset($row['default'])) {
                     $_beLanguages[] = $row;
                 }
             }
         }
         return $_beLanguages;
     }
 }
コード例 #5
0
    function display($tpl = null)
    {
        JHTML::_('behavior.modal', 'a.modal');
        $toggleClass = acymailing_get('helper.toggle');
        $config = acymailing_config();
        $db = JFactory::getDBO();
        $doc = JFactory::getDocument();
        $app = JFactory::getApplication();
        jimport('joomla.filesystem.folder');
        jimport('joomla.filesystem.file');
        $lg = JFactory::getLanguage();
        $language = $lg->getTag();
        $styleRemind = 'float:right;margin-right:30px;position:relative;';
        $loadLink = '<a onclick="window.document.getElementById(\'acymailing_messages_warning\').style.display = \'none\';return true;" class="modal" rel="{handler: \'iframe\', size:{x:800, y:500}}" href="index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=file&amp;task=latest&amp;code=' . $language . '">' . JText::_('LOAD_LATEST_LANGUAGE') . '</a>';
        if (!file_exists(ACYMAILING_ROOT . 'language' . DS . $language . DS . $language . '.com_acymailing.ini')) {
            if ($config->get('errorlanguagemissing', 1)) {
                $notremind = '<small style="' . $styleRemind . '">' . $toggleClass->delete('acymailing_messages_warning', 'errorlanguagemissing_0', 'config', false, JText::_('DONT_REMIND')) . '</small>';
                acymailing_enqueueMessage(JText::_('MISSING_LANGUAGE') . ' ' . $loadLink . ' ' . $notremind, 'warning');
            }
        } elseif (version_compare(JText::_('ACY_LANG_VERSION'), $config->get('version'), '<')) {
            if ($config->get('errorlanguageupdate', 1)) {
                $notremind = '<small style="' . $styleRemind . '">' . $toggleClass->delete('acymailing_messages_warning', 'errorlanguageupdate_0', 'config', false, JText::_('DONT_REMIND')) . '</small>';
                acymailing_enqueueMessage(JText::_('UPDATE_LANGUAGE') . ' ' . $loadLink . ' ' . $notremind, 'warning');
            }
        }
        if (ACYMAILING_J30 && $app->getTemplate() == 'hathor') {
            if ($config->get('errortemplatenotisis', 1)) {
                $message = ' You can change the default Back-end template <a href="index.php?option=com_templates&view=styles">Here</a> or change your personnal default Back-end template by editing your user profile <a href="index.php?option=com_users&view=users">Here</a>, tab "Basic Settings".';
                $personalTemplate = JFactory::getUser()->getParam('admin_style');
                if (!empty($personalTemplate)) {
                    $message = ' You can change your personnal default Back-end template by editing your user profile <a href="index.php?option=com_users&view=users">Here</a>, tab "Basic Settings".';
                }
                $notremind = '<small style="' . $styleRemind . '">' . $toggleClass->delete('acymailing_messages_warning', 'errortemplatenotisis_0', 'config', false, JText::_('DONT_REMIND')) . '</small>';
                acymailing_enqueueMessage('You should rather use the isis template in the Back-End which suits more AcyMailing.' . $message . $notremind, 'warning');
            }
        }
        $indexes = array('listsub', 'stats', 'list', 'mail', 'userstats', 'urlclick', 'history', 'template', 'queue', 'subscriber');
        $addIndexes = array('We recenty optimized our database...');
        foreach ($indexes as $oneTable) {
            if ($config->get('optimize_' . $oneTable, 1)) {
                continue;
            }
            $addIndexes[] = 'Please ' . $toggleClass->toggleText('addindex', $oneTable, 'config', 'click here') . ' to add indexes on the ' . $oneTable . ' table';
        }
        if (count($addIndexes) > 1) {
            acymailing_enqueueMessage($addIndexes, 'warning');
        }
        $acyToolbar = acymailing::get('helper.toolbar');
        $acyToolbar->custom('test', JText::_('SEND_TEST'), 'send', false);
        $acyToolbar->divider();
        $acyToolbar->addButtonOption('apply', JText::_('ACY_APPLY'), 'apply', false);
        $acyToolbar->save();
        $acyToolbar->cancel();
        $acyToolbar->divider();
        $acyToolbar->help('config');
        $acyToolbar->setTitle(JText::_('ACY_CONFIGURATION'), 'cpanel');
        $acyToolbar->display();
        $elements = new stdClass();
        $elements->add_names = JHTML::_('acyselect.booleanlist', "config[add_names]", '', $config->get('add_names', true));
        $elements->embed_images = JHTML::_('acyselect.booleanlist', "config[embed_images]", '', $config->get('embed_images', 0));
        $elements->embed_files = JHTML::_('acyselect.booleanlist', "config[embed_files]", '', $config->get('embed_files', 1));
        $elements->multiple_part = JHTML::_('acyselect.booleanlist', "config[multiple_part]", '', $config->get('multiple_part', 0));
        $mailerMethods = array('elasticemail', 'smtp', 'sendmail');
        $js = "function updateMailer(mailermethod){" . "\n";
        foreach ($mailerMethods as $oneMethod) {
            $js .= " window.document.getElementById('" . $oneMethod . "_config').style.display = 'none'; " . "\n";
        }
        $js .= "if(window.document.getElementById(mailermethod+'_config')) {window.document.getElementById(mailermethod+'_config').style.display = 'block';} }";
        $js .= 'window.addEvent(\'domready\', function(){ updateMailer(\'' . $config->get('mailer_method', 'phpmail') . '\'); });';
        $doc->addScriptDeclaration($js);
        $encodingval = array();
        $encodingval[] = JHTML::_('select.option', 'binary', 'Binary');
        $encodingval[] = JHTML::_('select.option', 'quoted-printable', 'Quoted-printable');
        $encodingval[] = JHTML::_('select.option', '7bit', '7 Bit');
        $encodingval[] = JHTML::_('select.option', '8bit', '8 Bit');
        $encodingval[] = JHTML::_('select.option', 'base64', 'Base 64');
        $elements->encoding_format = JHTML::_('select.genericlist', $encodingval, "config[encoding_format]", 'size="1" style="width:150px;"', 'value', 'text', $config->get('encoding_format', 'base64'));
        $charset = acymailing_get('type.charset');
        $elements->charset = $charset->display("config[charset]", $config->get('charset', 'UTF-8'));
        $securedVals = array();
        $securedVals[] = JHTML::_('select.option', '', '- - -');
        $securedVals[] = JHTML::_('select.option', 'ssl', 'SSL');
        $securedVals[] = JHTML::_('select.option', 'tls', 'TLS');
        $elements->smtp_secured = JHTML::_('select.genericlist', $securedVals, "config[smtp_secured]", 'size="1" style="width:100px;"', 'value', 'text', $config->get('smtp_secured'));
        $elements->smtp_auth = JHTML::_('acyselect.booleanlist', "config[smtp_auth]", '', $config->get('smtp_auth', 0));
        $elements->smtp_keepalive = JHTML::_('acyselect.booleanlist', "config[smtp_keepalive]", '', $config->get('smtp_keepalive', 1));
        $elements->allow_visitor = JHTML::_('acyselect.booleanlist', "config[allow_visitor]", '', $config->get('allow_visitor', 1));
        $editorType = acymailing_get('type.editor');
        $elements->editor = $editorType->display('config[editor]', $config->get('editor'));
        $elements->subscription_message = JHTML::_('acyselect.booleanlist', "config[subscription_message]", '', $config->get('subscription_message', 1));
        $elements->confirmation_message = JHTML::_('acyselect.booleanlist', "config[confirmation_message]", '', $config->get('confirmation_message', 1));
        $elements->unsubscription_message = JHTML::_('acyselect.booleanlist', "config[unsubscription_message]", '', $config->get('unsubscription_message', 1));
        $elements->welcome_message = JHTML::_('acyselect.booleanlist', "config[welcome_message]", '', $config->get('welcome_message', 1));
        $elements->unsub_message = JHTML::_('acyselect.booleanlist', "config[unsub_message]", '', $config->get('unsub_message', 1));
        $elements->confirm_message = JHTML::_('acyselect.booleanlist', "config[confirm_message]", '', $config->get('confirm_message', 0));
        if (acymailing_level(1)) {
            $forwardValues = array();
            $forwardValues[] = JHTML::_('select.option', 0, JTEXT::_('JOOMEXT_NO'));
            $forwardValues[] = JHTML::_('select.option', 1, JTEXT::_('JOOMEXT_YES'));
            $forwardValues[] = JHTML::_('select.option', 2, JTEXT::_('JOOMEXT_YES_FORWARD'));
            $elements->forward = JHTML::_('acyselect.radiolist', $forwardValues, "config[forward]", '', 'value', 'text', $config->get('forward', 0));
        } else {
            $elements->forward = acymailing_getUpgradeLink('essential');
        }
        if (acymailing_level(1)) {
            $js = "function updateDKIM(dkimval){\n\t\t\t\t\t\tif(dkimval == 1){document.getElementById('dkim_config').style.display = 'block';}\n\t\t\t\t\t\telse{document.getElementById('dkim_config').style.display = 'none';}\n\t\t\t\t\t\t};";
            $doc->addScriptDeclaration($js);
            if (function_exists('openssl_sign')) {
                $elements->dkim = JHTML::_('acyselect.booleanlist', "config[dkim]", 'onclick="updateDKIM(this.value)"', $config->get('dkim', 0));
            } else {
                $elements->dkim = '<input type="hidden" name="config[dkim]" value="0" />PHP Extension openssl not enabled';
            }
            $js = "function updateQueueProcess(newvalue){";
            $js .= "if(newvalue == 'onlyauto') {window.document.getElementById('method_auto').style.display = ''; window.document.getElementById('method_manual').style.display = 'none';}";
            $js .= "if(newvalue == 'auto') {window.document.getElementById('method_auto').style.display = ''; window.document.getElementById('method_manual').style.display = '';}";
            $js .= "if(newvalue == 'manual') {window.document.getElementById('method_auto').style.display = 'none'; window.document.getElementById('method_manual').style.display = '';}";
            $js .= '};';
            $doc->addScriptDeclaration($js);
            $queueType = array();
            $queueType[] = JHTML::_('select.option', 'onlyauto', JText::_('AUTO_ONLY'));
            $queueType[] = JHTML::_('select.option', 'auto', JText::_('AUTO_MAN'));
            $queueType[] = JHTML::_('select.option', 'manual', JText::_('MANUAL_ONLY'));
            $elements->queue_type = JHTML::_('acyselect.radiolist', $queueType, "config[queue_type]", 'onclick="updateQueueProcess(this.value);"', 'value', 'text', $config->get('queue_type', 'auto'));
        } else {
            $elements->dkim = acymailing_getUpgradeLink('essential');
        }
        $js = 'var selectedHTTPS = ' . ($config->get('ssl_links', 0) == 0 ? 'false;' : 'true;') . '
		function confirmHTTPS(element){
			var clickedHTTPS = (element == 1);
			if(clickedHTTPS == selectedHTTPS) return true;
			if(clickedHTTPS){
				var cnfrm = confirm(\'' . str_replace("'", "\\'", JText::_('ACY_SSLCHOICE_CONFIRMATION')) . '\');
				if(!cnfrm){';
        if (ACYMAILING_J30) {
            $js .= 'var labels = document.getElementById(\'config_ssl_linksfieldset\').getElementsByTagName(\'label\');
					if(labels[0].hasClass(\'btn-success\')){
						labels[1].click();
						return true;
					}else{
						labels[0].click();
						return true;
					}';
        } else {
            $js .= 'return false;';
        }
        $js .= '}
			}
			selectedHTTPS = clickedHTTPS;
			return true;
		}';
        $doc->addScriptDeclaration($js);
        $elements->ssl_links = JHTML::_('acyselect.booleanlist', "config[ssl_links]", 'onclick="return confirmHTTPS(this.value);"', $config->get('ssl_links', 0));
        $delayTypeManual = acymailing_get('type.delay');
        $elements->queue_pause = $delayTypeManual->display('config[queue_pause]', $config->get('queue_pause'), 0);
        $delayTypeAuto = acymailing_get('type.delay');
        $delayTypeAuto->onChange = "window.document.getElementById('autoFrequencyWarning').style.display='inline';";
        $onChangeMsg = '<span style="display:none;color:red;" id="autoFrequencyWarning">' . JText::_('ACY_CRON_CHANGE_FREQUENCY_WARNING') . '</span>';
        $elements->cron_frequency = $delayTypeAuto->display('config[cron_frequency]', $config->get('cron_frequency'), 2) . $onChangeMsg;
        $js = "function detectTimeout(id){\n\t\t\t\ttry{\n\t\t\t\t\twindow.document.getElementById(id).className = 'onload';\n\t\t\t\t\twindow.document.getElementById(id).innerHTML = '" . str_replace("'", "\\'", JText::_('ACY_CLOSE_TIMEOUT')) . "';\n\n\t\t\t\t\ttry{\n\t\t\t\t\t\tnew Ajax('" . rtrim(JURI::root(), '/') . "/index.php?option=com_acymailing&tmpl=component&ctrl=stats&task=detecttimeout&seckey=" . $config->get('security_key') . "',{ method: 'get', onComplete: function() { document.id(id).innerHTML = 'Done!'; window.document.getElementById(id).className = 'loading'; }}).request();\n\t\t\t\t\t}catch(err){\n\t\t\t\t\t\tnew Request({url:'" . rtrim(JURI::root(), '/') . "/index.php?option=com_acymailing&tmpl=component&ctrl=stats&task=detecttimeout&seckey=" . $config->get('security_key') . "',method: 'get', onComplete: function(response) { document.id(id).innerHTML = 'Done!'; window.document.getElementById(id).className = 'loading'; }}).send();\n\t\t\t\t\t}\n\t\t\t\t}catch(err){alert('Could not load the max execution time value : '+err);}\n\t\t\t\treturn;\n\t\t}";
        $maxexecutiontime = $config->get('max_execution_time');
        if (empty($maxexecutiontime) && intval($config->get('last_maxexec_check')) < time() - 60) {
            $js .= 'window.addEvent(\'domready\', function(){ detectTimeout(\'timeoutcheck\');return; });';
        }
        $doc = JFactory::getDocument();
        $doc->addScriptDeclaration($js);
        $cssval = array('css_frontend' => 'component', 'css_module' => 'module', 'css_backend' => 'backend');
        foreach ($cssval as $configval => $type) {
            $myvals = array();
            $myvals[] = JHTML::_('select.option', '', JText::_('ACY_NONE'));
            if ($configval == 'css_backend') {
                $myvals[] = JHTML::_('select.option', 'backend_custom', JText::_('ACY_CUSTOM'));
                $editFileName = $config->get('css_backend', 'default');
            } else {
                $regex = '^' . $type . '_([-_a-z0-9]*)\\.css$';
                $allCSSFiles = JFolder::files(ACYMAILING_MEDIA . 'css', $regex);
                $family = '';
                foreach ($allCSSFiles as $oneFile) {
                    preg_match('#' . $regex . '#i', $oneFile, $results);
                    $fileName = str_replace('default_', '', $results[1]);
                    $fileNameArray = explode('_', $fileName);
                    if (count($fileNameArray) == 2) {
                        if ($fileNameArray[0] != $family) {
                            if (!empty($family)) {
                                $myvals[] = JHTML::_('select.option', '</OPTGROUP>');
                            }
                            $family = $fileNameArray[0];
                            $myvals[] = JHTML::_('select.option', '<OPTGROUP>', ucfirst($family));
                        }
                        unset($fileNameArray[0]);
                        $fileName = implode('_', $fileNameArray);
                    }
                    $fileName = ucwords(str_replace('_', ' ', $fileName));
                    $myvals[] = JHTML::_('select.option', $results[1], $fileName);
                }
                if (!empty($family)) {
                    $myvals[] = JHTML::_('select.option', '</OPTGROUP>');
                }
                $editFileName = $type . '_' . $config->get($configval, 'default');
            }
            $currentVal = $config->get($configval, 'default');
            $aStyle = empty($currentVal) ? 'style="display:none"' : '';
            $js = 'onchange="updateCSSLink(\'' . $configval . '\',\'' . $type . '\',this.value);"';
            $elements->{$configval} = JHTML::_('select.genericlist', $myvals, 'config[' . $configval . ']', 'class="inputbox" size="1" ' . $js, 'value', 'text', $config->get($configval, 'default'), $configval . '_choice');
            $linkEdit = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=file&amp;task=css&amp;var=' . $configval . '&amp;file=' . $editFileName;
            $elements->{$configval} .= ' <a id="' . $configval . '_link" ' . $aStyle . ' class="modal" title="' . JText::_('ACY_EDIT', true) . '"  href="' . $linkEdit . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><i class="acyicon-edit" style="margin: 5px 5px 0px 5px; display: inline-block;"></i></a>';
        }
        $js = "function updateCSSLink(myid,type,newval){\n\t\t\tif(newval){document.getElementById(myid+'_link').style.display = '';}else{document.getElementById(myid+'_link').style.display = 'none'}\n\t\t\tif(myid == 'css_backend') filename = newval;\n\t\t\telse filename = type+'_'+newval;\n\t\t\tdocument.getElementById(myid+'_link').href = 'index.php?option=com_acymailing&tmpl=component&ctrl=file&task=css&var='+myid+'&file='+filename;\n\t\t}";
        $doc->addScriptDeclaration($js);
        $bootstrapFrontValues = array();
        $bootstrapFrontValues[] = JHTML::_('select.option', 0, JTEXT::_('JOOMEXT_NO'));
        $bootstrapFrontValues[] = JHTML::_('select.option', 1, 'Bootstrap 2');
        $bootstrapFrontValues[] = JHTML::_('select.option', 2, 'Bootstrap 3');
        $elements->bootstrap_frontend = JHTML::_('acyselect.radiolist', $bootstrapFrontValues, "config[bootstrap_frontend]", '', 'value', 'text', $config->get('bootstrap_frontend', 0));
        $elements->colortype = acymailing_get('type.color');
        $elements->use_sef = JHTML::_('acyselect.booleanlist', "config[use_sef]", '', $config->get('use_sef', 0));
        if (acymailing_level(1)) {
            $trackingMode = $config->get('trackingsystem', 'acymailing');
            $tracking_system = '<input type="checkbox" name="config[trackingsystem][]" id="trackingsystem[0]" value="acymailing" style="margin-left:10px" ' . (stripos($trackingMode, 'acymailing') !== false ? 'checked="checked"' : '') . '/> <label for="trackingsystem[0]">Acymailing</label>';
            $tracking_system .= '<input type="checkbox" name="config[trackingsystem][]" id="trackingsystem[1]" value="google" style="margin-left:10px;" ' . (stripos($trackingMode, 'google') !== false ? 'checked="checked"' : '') . '/> <label for="trackingsystem[1]">Google Analytics</label>';
            $tracking_system .= '<input type="hidden" name="config[trackingsystem][]" value="1"/>';
            $tracking_system_external_website = JHTML::_('acyselect.booleanlist', "config[trackingsystemexternalwebsite]", ' id="trackingsystemexternalwebsite"', $config->get('trackingsystemexternalwebsite', 1));
        } else {
            $tracking_system = acymailing_getUpgradeLink('essential');
            $tracking_system_external_website = acymailing_getUpgradeLink('essential');
        }
        $elements->tracking_system = $tracking_system;
        $elements->tracking_system_external_website = $tracking_system_external_website;
        $indexType = $config->get('indexFollow', '');
        $indexFollow = '<div style="float: left;"><input type="checkbox" name="config[indexFollow][]" id="indexFollow[0]" value="noindex" style="margin-left:10px" ' . (stripos($indexType, 'noindex') !== false ? 'checked="checked"' : '') . '/> <label for="indexFollow[0]">noindex</label></div>';
        $indexFollow .= '<div style="float: left;"><input type="checkbox" name="config[indexFollow][]" id="indexFollow[1]" value="nofollow" style="margin-left:10px" ' . (stripos($indexType, 'nofollow') !== false ? 'checked="checked"' : '') . '/> <label for="indexFollow[1]">nofollow</label></div>';
        $indexFollow .= '<input type="hidden" name="config[indexFollow][]" value="1"/>';
        $elements->indexFollow = $indexFollow;
        if (acymailing_level(3)) {
            $geolocAvailable = true;
            $geolocation = '<input type="hidden" name="config[geolocation]" value="0"/>';
            $geoloc_api_key = '';
            if (!function_exists('curl_init')) {
                $geolocAvailable = false;
                $geolocation .= 'The AcyMailing geolocation plugin needs the CURL library installed but it seems that it is not available on your server. Please contact your web hosting to set it up.';
            }
            if (!function_exists('json_decode')) {
                if (!$geolocAvailable) {
                    $geolocation .= '<br />';
                }
                $geolocAvailable = false;
                $geolocation .= 'The AcyMailing geolocation plugin can only work with PHP 5.2 at least. Please ask your web hosting to update your PHP version.';
            }
            if ($geolocAvailable) {
                $geoloc = $config->get('geolocation', '');
                $geolocation = '<span style="white-space:nowrap"><input type="checkbox" name="config[geolocation][]" id="geolocation_0" value="creation" style="margin-left:10px" ' . (stripos($geoloc, 'creation') !== false ? 'checked="checked"' : '') . '/> <label for="geolocation_0">' . JText::_('ON_USER_CREATE') . '</label></span>';
                $geolocation .= ' <span style="white-space:nowrap"><input type="checkbox" name="config[geolocation][]" id="geolocation_1" value="modify" style="margin-left:10px;" ' . (stripos($geoloc, 'modify') !== false ? 'checked="checked"' : '') . '/> <label for="geolocation_1">' . JText::_('ON_USER_CHANGE') . '</label></span>';
                $geolocation .= ' <span style="white-space:nowrap"><input type="checkbox" name="config[geolocation][]" id="geolocation_2" value="confirm" style="margin-left:10px;" ' . (stripos($geoloc, 'confirm') !== false ? 'checked="checked"' : '') . '/> <label for="geolocation_2">' . JText::_('GEOLOC_CONFIRM_SUB') . '</label></span>';
                $geolocation .= ' <span style="white-space:nowrap"><input type="checkbox" name="config[geolocation][]" id="geolocation_3" value="clic" style="margin-left:10px;" ' . (stripos($geoloc, 'clic') !== false ? 'checked="checked"' : '') . '/> <label for="geolocation_3">' . JText::_('ON_USER_CLICK') . '</label></span>';
                $geolocation .= ' <span style="white-space:nowrap"><input type="checkbox" name="config[geolocation][]" id="geolocation_4" value="open" style="margin-left:10px;" ' . (stripos($geoloc, 'open') !== false ? 'checked="checked"' : '') . '/> <label for="geolocation_4">' . JText::_('ON_OPEN_NEWS') . '</label></span>';
                $geolocation .= ' <span style="white-space:nowrap"><input type="checkbox" name="config[geolocation][]" id="geolocation_5" value="unsubscription" style="margin-left:10px;" ' . (stripos($geoloc, 'unsubscription') !== false ? 'checked="checked"' : '') . '/> <label for="geolocation_5">' . JText::_('GEOLOC_UNSUB') . '</label></span>';
                $geolocation .= '<input type="hidden" name="config[geolocation][]" value="1"/>';
                $geoloc_api_key = '<input class="inputbox" type="text" id="geoloc_api_key" name="config[geoloc_api_key]" style="width:450px" value="' . $this->escape($config->get('geoloc_api_key', '')) . '">';
            }
        } else {
            $geolocation = acymailing_getUpgradeLink('enterprise');
            $geoloc_api_key = false;
        }
        $elements->geolocation = $geolocation;
        $elements->geoloc_api_key = $geoloc_api_key;
        if (!ACYMAILING_J16) {
            $query = 'SELECT a.name, a.id as itemid, b.title  FROM `#__menu` as a JOIN `#__menu_types` as b on a.menutype = b.menutype WHERE a.access = 0 ORDER BY b.title ASC,a.ordering ASC';
        } else {
            $orderby = ACYMAILING_J30 ? 'a.lft' : 'a.ordering';
            $query = 'SELECT a.alias as name, a.id as itemid, b.title  FROM `#__menu` as a JOIN `#__menu_types` as b on a.menutype = b.menutype WHERE a.access NOT IN (2, 3) AND a.client_id=0 AND a.parent_id != 0 ORDER BY b.title ASC,' . $orderby . ' ASC';
        }
        $db->setQuery($query);
        $joomMenus = $db->loadObjectList();
        $menuvalues = array();
        $menuvalues[] = JHTML::_('select.option', '0', JText::_('ACY_NONE'));
        $lastGroup = '';
        foreach ($joomMenus as $oneMenu) {
            if ($oneMenu->title != $lastGroup) {
                if (!empty($lastGroup)) {
                    $menuvalues[] = JHTML::_('select.option', '</OPTGROUP>');
                }
                $menuvalues[] = JHTML::_('select.option', '<OPTGROUP>', $oneMenu->title);
                $lastGroup = $oneMenu->title;
            }
            $menuvalues[] = JHTML::_('select.option', $oneMenu->itemid, $oneMenu->name);
        }
        $elements->acymailing_menu = JHTML::_('select.genericlist', $menuvalues, 'config[itemid]', 'size="1"', 'value', 'text', $config->get('itemid'));
        $acyrss_format = array();
        $acyrss_format[] = JHTML::_('select.option', '', JText::_('ACY_NONE'));
        $acyrss_format[] = JHTML::_('select.option', 'rss', 'RSS feed');
        $acyrss_format[] = JHTML::_('select.option', 'atom', 'Atom feed');
        $acyrss_format[] = JHTML::_('select.option', 'both', JText::_('ACY_ALL'));
        $elements->acyrss_format = JHTML::_('select.genericlist', $acyrss_format, "config[acyrss_format]", 'size="1"', 'value', 'text', $config->get('acyrss_format', ''));
        $acyrss_order = array();
        $acyrss_order[] = JHTML::_('select.option', 'senddate', JText::_('SEND_DATE'));
        $acyrss_order[] = JHTML::_('select.option', 'mailid', JText::_('ACY_ID'));
        $acyrss_order[] = JHTML::_('select.option', 'subject', JText::_('ACY_TITLE'));
        $elements->acyrss_order = JHTML::_('select.genericlist', $acyrss_order, "config[acyrss_order]", 'size="1"', 'value', 'text', $config->get('acyrss_order', 'senddate'));
        $link = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=email&amp;task=edit&amp;mailid=confirmation';
        $elements->editConfEmail = '<a class="modal" id="confirmemail"  href="' . $link . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><button class="acymailing_button_grey" onclick="return false">' . JText::_('EDIT_CONF_MAIL') . '</button></a>';
        $link = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=email&amp;task=edit&amp;mailid=notification_created';
        $elements->edit_notification_created = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><button class="acymailing_button_grey" onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>';
        $link = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=email&amp;task=edit&amp;mailid=notification_refuse';
        $elements->edit_notification_refuse = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><button class="acymailing_button_grey" onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>';
        $link = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=email&amp;task=edit&amp;mailid=notification_unsuball';
        $elements->edit_notification_unsuball = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><button class="acymailing_button_grey" onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>';
        $link = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=email&amp;task=edit&amp;mailid=notification_unsub';
        $elements->edit_notification_unsub = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><button class="acymailing_button_grey" onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>';
        $link = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=email&amp;task=edit&amp;mailid=notification_contact';
        $elements->edit_notification_contact = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><button class="acymailing_button_grey" onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>';
        $link = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=email&amp;task=edit&amp;mailid=notification_contact_menu';
        $elements->edit_notification_contact_menu = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><button class="acymailing_button_grey" onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>';
        $link = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=email&amp;task=edit&amp;mailid=notification_confirm';
        $elements->edit_notification_confirm = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><button class="acymailing_button_grey" onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>';
        $link = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=email&amp;task=edit&amp;mailid=modif';
        $elements->editModifEmail = '<a class="modal" id="modifemail"  href="' . $link . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><button class="acymailing_button_grey" onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>';
        $link = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=cpanel&amp;task=checkDB';
        $elements->checkDB = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><button class="acymailing_button_grey" onclick="return false">' . JText::_('DATABASE_INTEGRITY') . '</button></a>';
        $js = "function addUnsubReason(){\n\t\t\tvar input = document.createElement('input');\n\t\t\tinput.name = 'unsub_reasons[]';\n\t\t\tinput.style.width = '300px';\n\t\t\tinput.style.margin = '3px 0px';\n\t\t\tinput.type = 'text';\n\t\t\tdocument.getElementById('unsub_reasons').appendChild(input);\n\t\t\tvar br = document.createElement('br');\n\t\t\tdocument.getElementById('unsub_reasons').appendChild(br);\n\t\t}\n\t\tfunction displaySurvey(surveyval){\n\t\t\tif(surveyval == 1){\n\t\t\t\tdocument.getElementById('unsub_reasons_area').style.display = 'block';\n\t\t\t}else{\n\t\t\t\tdocument.getElementById('unsub_reasons_area').style.display = 'none';\n\t\t\t}\n\t\t}\n\t\t";
        $doc->addScriptDeclaration($js);
        $path = JLanguage::getLanguagePath(JPATH_ROOT);
        $dirs = JFolder::folders($path);
        $languages = array();
        foreach ($dirs as $dir) {
            if (strlen($dir) != 5 || $dir == "xx-XX") {
                continue;
            }
            $xmlFiles = JFolder::files($path . DS . $dir, '^([-_A-Za-z]*)\\.xml$');
            $xmlFile = reset($xmlFiles);
            if (empty($xmlFile)) {
                $data = array();
            } else {
                $data = JApplicationHelper::parseXMLLangMetaFile($path . DS . $dir . DS . $xmlFile);
            }
            $oneLanguage = new stdClass();
            $oneLanguage->language = $dir;
            $oneLanguage->name = empty($data['name']) ? $dir : $data['name'];
            $languageFiles = JFolder::files($path . DS . $dir, '^(.*)\\.com_acymailing\\.ini$');
            $languageFile = reset($languageFiles);
            if (!empty($languageFile)) {
                $linkEdit = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=file&amp;task=language&amp;code=' . $oneLanguage->language;
                $oneLanguage->edit = ' <a class="modal" title="' . JText::_('EDIT_LANGUAGE_FILE', true) . '"  href="' . $linkEdit . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><i class="acyicon-edit" id="image' . $oneLanguage->language . '"></i></a>';
            } else {
                $linkEdit = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=file&amp;task=language&amp;code=' . $oneLanguage->language;
                $oneLanguage->edit = ' <a class="modal" title="' . JText::_('ADD_LANGUAGE_FILE', true) . '"  href="' . $linkEdit . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><i class="acyicon-new" id="image' . $oneLanguage->language . '"></i></a>';
            }
            $languages[] = $oneLanguage;
        }
        $js = "function updateConfirmation(newvalue){";
        $js .= "if(newvalue == 0) {window.document.getElementById('confirmemail').style.display = 'none'; window.document.getElementById('confirm_redirect').disabled = true;}else{window.document.getElementById('confirmemail').style.display = 'inline'; window.document.getElementById('confirm_redirect').disabled = false;}";
        $js .= '}';
        $js .= "function updateModification(newvalue){ if(newvalue != 'none') {window.document.getElementById('modifemail').style.display = 'none';}else{window.document.getElementById('modifemail').style.display = 'inline';}} ";
        $js .= 'window.addEvent(\'load\', function(){ updateModification(\'' . $config->get('allow_modif', 'data') . '\'); updateConfirmation(' . $config->get('require_confirmation', 0) . '); });';
        $doc->addScriptDeclaration($js);
        $elements->require_confirmation = JHTML::_('acyselect.booleanlist', "config[require_confirmation]", 'onclick="updateConfirmation(this.value)"', $config->get('require_confirmation', 0));
        $allowmodif = array();
        $allowmodif[] = JHTML::_('select.option', "none", JText::_('JOOMEXT_NO'));
        $allowmodif[] = JHTML::_('select.option', "data", JText::_('ONLY_SUBSCRIPTION'));
        $allowmodif[] = JHTML::_('select.option', "all", JText::_('JOOMEXT_YES'));
        $elements->allow_modif = JHTML::_('acyselect.radiolist', $allowmodif, "config[allow_modif]", 'size="1" onclick="updateModification(this.value)"', 'value', 'text', $config->get('allow_modif', 'data'));
        if (!ACYMAILING_J16) {
            $db->setQuery("SELECT name,published,id FROM `#__plugins` WHERE `folder` = 'acymailing' AND `element` NOT LIKE 'plg%' ORDER BY published DESC, ordering ASC");
        } else {
            $db->setQuery("SELECT name,enabled as published,extension_id as id FROM `#__extensions` WHERE `state` <> -1 AND `folder` = 'acymailing' AND `type`= 'plugin' AND `element` NOT LIKE 'plg%' ORDER BY enabled DESC, ordering ASC");
        }
        $plugins = $db->loadObjectList();
        if (!ACYMAILING_J16) {
            $db->setQuery("SELECT name,published,id FROM `#__plugins` WHERE (`folder` != 'acymailing' OR `element` LIKE 'plg%') AND (`name` LIKE '%acymailing%' OR `element` LIKE '%acymailing%') ORDER BY published DESC, ordering ASC");
        } else {
            $db->setQuery("SELECT name,enabled as published ,extension_id as id FROM `#__extensions` WHERE `state` <> -1 AND (`folder` != 'acymailing' OR `element` LIKE 'plg%') AND `type` = 'plugin' AND (`name` LIKE '%acymailing%' OR `element` LIKE '%acymailing%') ORDER BY enabled DESC, ordering ASC");
        }
        $integrationplugins = $db->loadObjectList();
        if (ACYMAILING_J16) {
            $db->setQuery("SELECT COUNT(*) FROM #__extensions WHERE `enabled` = 1 AND `state` = -1 AND `type` = 'plugin' AND (`folder` = 'acymailing' OR `name` LIKE '%acymailing%' OR `element` LIKE '%acymailing%')");
            $discoveredPlugins = $db->loadResult();
            if (!empty($discoveredPlugins)) {
                acymailing_display('Some AcyMailing plugins are placed in the Joomla "Discover" feature and will not work, you should install them through the "Discover" menu in the Extension manager.', 'warning');
            }
        }
        $bounceaction = acymailing_get('type.bounceaction');
        $this->assignRef('bounceaction', $bounceaction);
        $this->assignRef('config', $config);
        $this->assignRef('languages', $languages);
        $this->assignRef('elements', $elements);
        $this->assignRef('plugins', $plugins);
        $this->assignRef('integrationplugins', $integrationplugins);
        $tabs = acymailing_get('helper.acytabs');
        $tabs->setOptions(array('useCookie' => true));
        $this->assignRef('tabs', $tabs);
        $this->assignRef('toggleClass', $toggleClass);
        if (!ACYMAILING_J16 and !file_exists(rtrim(JPATH_SITE, DS) . DS . 'plugins' . DS . 'acymailing' . DS . 'tagsubscriber.php') or ACYMAILING_J16 and !file_exists(rtrim(JPATH_SITE, DS) . DS . 'plugins' . DS . 'acymailing' . DS . 'tagsubscriber' . DS . 'tagsubscriber.php')) {
            acymailing_checkPluginsFolders();
        }
        return parent::display($tpl);
    }
コード例 #6
0
ファイル: translation.php プロジェクト: q0821/esportshop
 function getAllLanguages()
 {
     jimport('joomla.filesystem.folder');
     $path = JLanguage::getLanguagePath(JPATH_ROOT);
     $dirs = JFolder::folders($path);
     $edit_image = HIKASHOP_IMAGES . 'icons/icon-16-edit.png';
     $new_image = HIKASHOP_IMAGES . 'icons/icon-16-new.png';
     $popup = hikashop_get('helper.popup');
     foreach ($dirs as $dir) {
         $xmlFiles = JFolder::files($path . DS . $dir, '^([-_A-Za-z]*)\\.xml$');
         $xmlFile = array_pop($xmlFiles);
         if ($xmlFile == 'install.xml') {
             $xmlFile = array_pop($xmlFiles);
         }
         if (empty($xmlFile)) {
             continue;
         }
         $data = JApplicationHelper::parseXMLLangMetaFile($path . DS . $dir . DS . $xmlFile);
         $oneLanguage = new stdClass();
         $oneLanguage->language = $dir;
         $oneLanguage->name = $data['name'];
         $languageFiles = JFolder::files($path . DS . $dir, '^(.*)\\.com_hikashop\\.ini$');
         $languageFile = reset($languageFiles);
         if (!empty($languageFile)) {
             $oneLanguage->edit = $popup->display('<img id="image' . $oneLanguage->language . '" src="' . $edit_image . '" alt="' . JText::_('EDIT_LANGUAGE_FILE') . '"/>', 'EDIT_LANGUAGE_FILE', 'index.php?option=com_hikashop&amp;tmpl=component&amp;ctrl=config&amp;task=language&amp;code=' . $oneLanguage->language, 'edit_language_' . $oneLanguage->language, 760, 480, '', '', 'link');
         } else {
             $oneLanguage->edit = $popup->display('<img id="image' . $oneLanguage->language . '" src="' . $new_image . '" alt="' . JText::_('ADD_LANGUAGE_FILE') . '"/>', 'ADD_LANGUAGE_FILE', 'index.php?option=com_hikashop&amp;tmpl=component&amp;ctrl=config&amp;task=language&amp;code=' . $oneLanguage->language, 'edit_language_' . $oneLanguage->language, 760, 480, '', '', 'link');
         }
         $languages[] = $oneLanguage;
     }
     return $languages;
 }
コード例 #7
0
ファイル: installed.php プロジェクト: jwest00724/joomla-cms
 /**
  * Method to get Languages item data.
  *
  * @return  array
  *
  * @since   1.6
  */
 public function getData()
 {
     // Fetch language data if not fetched yet.
     if (is_null($this->data)) {
         $this->data = array();
         // Get information.
         $db = $this->getDbo();
         $query = $db->getQuery(true);
         // Select languages installed from the extensions table.
         $query->select($db->quoteName(array('a.element', 'a.client_id', 'a.extension_id')))->from($db->quoteName('#__extensions', 'a'))->where($db->quoteName('a.type') . ' = ' . $db->quote('language'))->where($db->quoteName('state') . ' = 0')->where($db->quoteName('enabled') . ' = 1');
         // For client_id = 1 do we need to check language table also?
         $db->setQuery($query);
         $langlist = $db->loadObjectList();
         // Compute all the languages.
         foreach ($langlist as $lang) {
             $client = JApplicationHelper::getClientInfo($lang->client_id);
             $clientPath = $lang->client_id === 0 ? JPATH_SITE : JPATH_ADMINISTRATOR;
             $info = JApplicationHelper::parseXMLLangMetaFile($clientPath . '/language/' . $lang->element . '/' . $lang->element . '.xml');
             $row = new StdClass();
             $row->language = $lang->element;
             $row->client_id = (int) $lang->client_id;
             $row->extension_id = (int) $lang->extension_id;
             if (!is_array($info)) {
                 continue;
             }
             foreach ($info as $key => $value) {
                 $row->{$key} = $value;
             }
             // Fix wrongly set parentheses in RTL languages
             if (JFactory::getLanguage()->isRtl()) {
                 $row->name = html_entity_decode($row->name . '&#x200E;', ENT_QUOTES, 'UTF-8');
             }
             // If current than set published.
             $params = JComponentHelper::getParams('com_languages');
             if ($params->get($client->name, 'en-GB') == $row->language) {
                 $row->published = 1;
             } else {
                 $row->published = 0;
             }
             $row->checked_out = 0;
             $this->data[] = $row;
         }
     }
     $installedLanguages = array_merge($this->data);
     // Process filters.
     $clientId = (int) $this->getState('client_id');
     $search = $this->getState('filter.search');
     foreach ($installedLanguages as $key => $installedLanguage) {
         // Filter by client id.
         if (in_array($clientId, array(0, 1))) {
             if ($installedLanguage->client_id !== $clientId) {
                 unset($installedLanguages[$key]);
                 continue;
             }
         }
         // Filter by search term.
         if (!empty($search)) {
             if (stripos($installedLanguage->name, $search) === false && stripos($installedLanguage->language, $search) === false) {
                 unset($installedLanguages[$key]);
                 continue;
             }
         }
     }
     // Process ordering.
     $listOrder = $this->getState('list.ordering', 'name');
     $listDirn = $this->getState('list.direction', 'ASC');
     $installedLanguages = ArrayHelper::sortObjects($installedLanguages, $listOrder, strtolower($listDirn) === 'desc' ? -1 : 1, true, true);
     // Process pagination.
     $limit = (int) $this->getState('list.limit', 25);
     // Sets the total for pagination.
     $this->total = count($installedLanguages);
     if ($limit !== 0) {
         $start = (int) $this->getState('list.start', 0);
         return array_slice($installedLanguages, $start, $limit);
     }
     return $installedLanguages;
 }
コード例 #8
0
 function display($tpl = null)
 {
     JHTML::_('behavior.modal', 'a.modal');
     $toggleClass = acymailing_get('helper.toggle');
     $config = acymailing_config();
     $db =& JFactory::getDBO();
     $doc =& JFactory::getDocument();
     $app =& JFactory::getApplication();
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     $lg =& JFactory::getLanguage();
     $language = $lg->getTag();
     $styleRemind = 'float:right;margin-right:30px;position:relative;';
     $loadLink = '<a onclick="window.document.getElementById(\'acymailing_messages_warning\').style.display = \'none\';return true;" class="modal" rel="{handler: \'iframe\', size:{x:800, y:500}}" href="index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=file&amp;task=latest&amp;code=' . $language . '">' . JText::_('LOAD_LATEST_LANGUAGE') . '</a>';
     if (!file_exists(ACYMAILING_ROOT . 'language' . DS . $language . DS . $language . '.com_acymailing.ini')) {
         if ($config->get('errorlanguagemissing', 1)) {
             $notremind = '<small style="' . $styleRemind . '">' . $toggleClass->delete('acymailing_messages_warning', 'errorlanguagemissing_0', 'config', false, JText::_('DONT_REMIND')) . '</small>';
             acymailing_display(JText::_('MISSING_LANGUAGE') . ' ' . $loadLink . ' ' . $notremind, 'warning');
         }
     } elseif (version_compare(JText::_('ACY_LANG_VERSION'), $config->get('version'), '<')) {
         if ($config->get('errorlanguageupdate', 1)) {
             $notremind = '<small style="' . $styleRemind . '">' . $toggleClass->delete('acymailing_messages_warning', 'errorlanguageupdate_0', 'config', false, JText::_('DONT_REMIND')) . '</small>';
             acymailing_display(JText::_('UPDATE_LANGUAGE') . ' ' . $loadLink . ' ' . $notremind, 'warning');
         }
     }
     acymailing_setTitle(JText::_('CONFIGURATION'), 'acyconfig', 'cpanel');
     $bar =& JToolBar::getInstance('toolbar');
     JToolBarHelper::custom('test', 'send', '', JText::_('SEND_TEST'), false);
     JToolBarHelper::divider();
     JToolBarHelper::save();
     JToolBarHelper::apply();
     JToolBarHelper::cancel('cancel', JText::_('ACY_CLOSE'));
     JToolBarHelper::divider();
     $bar->appendButton('Pophelp', 'config');
     if (acymailing_isAllowed($config->get('acl_cpanel_manage', 'all'))) {
         $bar->appendButton('Link', 'acymailing', JText::_('ACY_CPANEL'), acymailing_completeLink('dashboard'));
     }
     $elements = null;
     $elements->add_names = JHTML::_('select.booleanlist', "config[add_names]", '', $config->get('add_names', true));
     $elements->embed_images = JHTML::_('select.booleanlist', "config[embed_images]", '', $config->get('embed_images', 0));
     $elements->embed_files = JHTML::_('select.booleanlist', "config[embed_files]", '', $config->get('embed_files', 1));
     $elements->multiple_part = JHTML::_('select.booleanlist', "config[multiple_part]", '', $config->get('multiple_part', 0));
     $mailerMethods = array('smtp_com', 'elasticemail', 'smtp', 'sendmail');
     $js = "function updateMailer(mailermethod){" . "\n";
     foreach ($mailerMethods as $oneMethod) {
         $js .= " window.document.getElementById('" . $oneMethod . "_config').style.display = 'none'; " . "\n";
     }
     $js .= "if(window.document.getElementById(mailermethod+'_config')) {window.document.getElementById(mailermethod+'_config').style.display = 'block';} }";
     $js .= 'window.addEvent(\'domready\', function(){ updateMailer(\'' . $config->get('mailer_method', 'phpmail') . '\'); });';
     $doc->addScriptDeclaration($js);
     $encodingval = array();
     $encodingval[] = JHTML::_('select.option', 'binary', 'Binary');
     $encodingval[] = JHTML::_('select.option', 'quoted-printable', 'Quoted-printable');
     $encodingval[] = JHTML::_('select.option', '7bit', '7 Bit');
     $encodingval[] = JHTML::_('select.option', '8bit', '8 Bit');
     $encodingval[] = JHTML::_('select.option', 'base64', 'Base 64');
     $elements->encoding_format = JHTML::_('select.genericlist', $encodingval, "config[encoding_format]", 'size="1"', 'value', 'text', $config->get('encoding_format', 'base64'));
     $charset = acymailing_get('type.charset');
     $elements->charset = $charset->display("config[charset]", $config->get('charset', 'UTF-8'));
     $securedVals = array();
     $securedVals[] = JHTML::_('select.option', '', '- - -');
     $securedVals[] = JHTML::_('select.option', 'ssl', 'SSL');
     $securedVals[] = JHTML::_('select.option', 'tls', 'TLS');
     $elements->smtp_secured = JHTML::_('select.genericlist', $securedVals, "config[smtp_secured]", 'size="1"', 'value', 'text', $config->get('smtp_secured'));
     $elements->smtp_auth = JHTML::_('select.booleanlist', "config[smtp_auth]", '', $config->get('smtp_auth', 0));
     $elements->smtp_keepalive = JHTML::_('select.booleanlist', "config[smtp_keepalive]", '', $config->get('smtp_keepalive', 1));
     $elements->allow_visitor = JHTML::_('select.booleanlist', "config[allow_visitor]", '', $config->get('allow_visitor', 1));
     $editorType = acymailing_get('type.editor');
     $elements->editor = $editorType->display('config[editor]', $config->get('editor'));
     $elements->subscription_message = JHTML::_('select.booleanlist', "config[subscription_message]", '', $config->get('subscription_message', 1));
     $elements->confirmation_message = JHTML::_('select.booleanlist', "config[confirmation_message]", '', $config->get('confirmation_message', 1));
     $elements->unsubscription_message = JHTML::_('select.booleanlist', "config[unsubscription_message]", '', $config->get('unsubscription_message', 1));
     $elements->welcome_message = JHTML::_('select.booleanlist', "config[welcome_message]", '', $config->get('welcome_message', 1));
     $elements->unsub_message = JHTML::_('select.booleanlist', "config[unsub_message]", '', $config->get('unsub_message', 1));
     $elements->confirm_message = JHTML::_('select.booleanlist', "config[confirm_message]", '', $config->get('confirm_message', 0));
     $elements->show_footer = JHTML::_('select.booleanlist', "config[show_footer]", '', $config->get('show_footer', 1));
     if (acymailing_level(1)) {
         $elements->forward = JHTML::_('select.booleanlist', "config[forward]", '', $config->get('forward', false));
     } else {
         $elements->forward = acymailing_getUpgradeLink('essential');
     }
     if (acymailing_level(1)) {
         $js = "function updateDKIM(dkimval){if(dkimval == 1){document.getElementById('dkim_config').style.display = 'block';}else{document.getElementById('dkim_config').style.display = 'none';}}\r\r\n\t\t\t\t\twindow.addEvent('load', function(){ updateDKIM(" . $config->get('dkim', 0) . ");});";
         $doc->addScriptDeclaration($js);
         if (function_exists('openssl_sign')) {
             $elements->dkim = JHTML::_('select.booleanlist', "config[dkim]", 'onclick="updateDKIM(this.value)"', $config->get('dkim', 0));
         } else {
             $elements->dkim = '<input type="hidden" name="config[dkim]" value="0" />PHP Extension openssl not enabled';
         }
         $js = "function updateQueueProcess(newvalue){";
         $js .= "if(newvalue == 'onlyauto') {window.document.getElementById('method_auto').style.display = ''; window.document.getElementById('method_manual').style.display = 'none';}";
         $js .= "if(newvalue == 'auto') {window.document.getElementById('method_auto').style.display = ''; window.document.getElementById('method_manual').style.display = '';}";
         $js .= "if(newvalue == 'manual') {window.document.getElementById('method_auto').style.display = 'none'; window.document.getElementById('method_manual').style.display = '';}";
         $js .= '}';
         $js .= 'window.addEvent(\'domready\', function(){ updateQueueProcess(\'' . $config->get('queue_type', 'auto') . '\'); });';
         $doc->addScriptDeclaration($js);
         $queueType = array();
         $queueType[] = JHTML::_('select.option', 'onlyauto', JText::_('AUTO_ONLY'));
         $queueType[] = JHTML::_('select.option', 'auto', JText::_('AUTO_MAN'));
         $queueType[] = JHTML::_('select.option', 'manual', JText::_('MANUAL_ONLY'));
         $elements->queue_type = JHTML::_('select.radiolist', $queueType, "config[queue_type]", 'onclick="updateQueueProcess(this.value);"', 'value', 'text', $config->get('queue_type', 'auto'));
     } else {
         $elements->dkim = acymailing_getUpgradeLink('essential');
     }
     $delayTypeManual = acymailing_get('type.delay');
     $elements->queue_pause = $delayTypeManual->display('config[queue_pause]', $config->get('queue_pause'), 0);
     $delayTypeAuto = acymailing_get('type.delay');
     $elements->cron_frequency = $delayTypeAuto->display('config[cron_frequency]', $config->get('cron_frequency'), 2);
     $cssval = array('css_frontend' => 'component', 'css_module' => 'module', 'css_backend' => 'component');
     foreach ($cssval as $configval => $type) {
         $myvals = array();
         $myvals[] = JHTML::_('select.option', '', JText::_('ACY_NONE'));
         $regex = '^' . $type . '_([-_a-z0-9]*)\\.css$';
         $allCSSFiles = JFolder::files(ACYMAILING_MEDIA . 'css', $regex);
         $family = '';
         foreach ($allCSSFiles as $oneFile) {
             preg_match('#' . $regex . '#i', $oneFile, $results);
             $fileName = str_replace('default_', '', $results[1]);
             $fileNameArray = explode('_', $fileName);
             if (count($fileNameArray) == 2) {
                 if ($fileNameArray[0] != $family) {
                     if (!empty($family)) {
                         $myvals[] = JHTML::_('select.option', '</OPTGROUP>');
                     }
                     $family = $fileNameArray[0];
                     $myvals[] = JHTML::_('select.option', '<OPTGROUP>', ucfirst($family));
                 }
                 unset($fileNameArray[0]);
                 $fileName = implode('_', $fileNameArray);
             }
             $fileName = ucwords(str_replace('_', ' ', $fileName));
             $myvals[] = JHTML::_('select.option', $results[1], $fileName);
         }
         if (!empty($family)) {
             $myvals[] = JHTML::_('select.option', '</OPTGROUP>');
         }
         $js = 'onchange="updateCSSLink(\'' . $configval . '\',\'' . $type . '\',this.value);"';
         $currentVal = $config->get($configval, 'default');
         $aStyle = empty($currentVal) ? 'style="display:none"' : '';
         $elements->{$configval} = JHTML::_('select.genericlist', $myvals, 'config[' . $configval . ']', 'class="inputbox" size="1" ' . $js, 'value', 'text', $config->get($configval, 'default'), $configval . '_choice');
         $linkEdit = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=file&amp;task=css&amp;file=' . $type . '_' . $config->get($configval, 'default') . '&amp;var=' . $configval;
         $elements->{$configval} .= ' <a id="' . $configval . '_link" ' . $aStyle . ' class="modal" title="' . JText::_('ACY_EDIT', true) . '"  href="' . $linkEdit . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><img class="icon16" src="' . ACYMAILING_IMAGES . 'icons/icon-16-edit.png" alt="' . JText::_('ACY_EDIT', true) . '"/></a>';
     }
     $js = "function updateCSSLink(myid,type,newval){\r\r\n\t\t\tif(newval){document.getElementById(myid+'_link').style.display = '';}else{document.getElementById(myid+'_link').style.display = 'none'}\r\r\n\t\t\tdocument.getElementById(myid+'_link').href = 'index.php?option=com_acymailing&tmpl=component&ctrl=file&task=css&file='+type+'_'+newval+'&var='+myid;\r\r\n\t\t}";
     $doc->addScriptDeclaration($js);
     $elements->colortype = acymailing_get('type.color');
     $elements->use_sef = JHTML::_('select.booleanlist', "config[use_sef]", '', $config->get('use_sef', 0));
     if (version_compare(JVERSION, '1.6.0', '<')) {
         $query = 'SELECT a.name, a.id as itemid, b.title  FROM `#__menu` as a LEFT JOIN `#__menu_types` as b on a.menutype = b.menutype WHERE a.access = 0 ORDER BY b.title ASC,a.ordering ASC';
     } else {
         $query = 'SELECT a.alias as name, a.id as itemid, b.title  FROM `#__menu` as a LEFT JOIN `#__menu_types` as b on a.menutype = b.menutype WHERE a.client_id=0 AND a.parent_id != 0 ORDER BY b.title ASC,a.ordering ASC';
     }
     $db->setQuery($query);
     $joomMenus = $db->loadObjectList();
     $menuvalues = array();
     $menuvalues[] = JHTML::_('select.option', '0', JText::_('ACY_NONE'));
     $lastGroup = '';
     foreach ($joomMenus as $oneMenu) {
         if ($oneMenu->title != $lastGroup) {
             if (!empty($lastGroup)) {
                 $menuvalues[] = JHTML::_('select.option', '</OPTGROUP>');
             }
             $menuvalues[] = JHTML::_('select.option', '<OPTGROUP>', $oneMenu->title);
             $lastGroup = $oneMenu->title;
         }
         $menuvalues[] = JHTML::_('select.option', $oneMenu->itemid, $oneMenu->name);
     }
     $elements->acymailing_menu = JHTML::_('select.genericlist', $menuvalues, 'config[itemid]', 'size="1"', 'value', 'text', $config->get('itemid'));
     $menupositions = array();
     $menupositions[] = JHTML::_('select.option', 'under', JText::_('UNDER_TITLE'));
     $menupositions[] = JHTML::_('select.option', 'above', JText::_('ABOVE_MAIN_AREA'));
     $elements->menu_position = JHTML::_('select.radiolist', $menupositions, 'config[menu_position]', 'size="1"', 'value', 'text', $config->get('menu_position', 'under'));
     $acyrss_format = array();
     $acyrss_format[] = JHTML::_('select.option', '', JText::_('ACY_NONE'));
     $acyrss_format[] = JHTML::_('select.option', 'rss', 'RSS feed');
     $acyrss_format[] = JHTML::_('select.option', 'atom', 'Atom feed');
     $acyrss_format[] = JHTML::_('select.option', 'both', JText::_('ACY_ALL'));
     $elements->acyrss_format = JHTML::_('select.genericlist', $acyrss_format, "config[acyrss_format]", 'size="1"', 'value', 'text', $config->get('acyrss_format', ''));
     $acyrss_order = array();
     $acyrss_order[] = JHTML::_('select.option', 'senddate', JText::_('SEND_DATE'));
     $acyrss_order[] = JHTML::_('select.option', 'mailid', JText::_('ACY_ID'));
     $acyrss_order[] = JHTML::_('select.option', 'subject', JText::_('ACY_TITLE'));
     $elements->acyrss_order = JHTML::_('select.genericlist', $acyrss_order, "config[acyrss_order]", 'size="1"', 'value', 'text', $config->get('acyrss_order', 'senddate'));
     $link = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=email&amp;task=edit&amp;mailid=confirmation';
     $elements->editConfEmail = '<a class="modal" id="confirmemail"  href="' . $link . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><button onclick="return false">' . JText::_('EDIT_CONF_MAIL') . '</button></a>';
     $link = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=email&amp;task=edit&amp;mailid=notification_created';
     $elements->edit_notification_created = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><button onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>';
     $link = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=email&amp;task=edit&amp;mailid=notification_refuse';
     $elements->edit_notification_refuse = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><button onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>';
     $link = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=email&amp;task=edit&amp;mailid=notification_unsuball';
     $elements->edit_notification_unsuball = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><button onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>';
     $link = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=email&amp;task=edit&amp;mailid=notification_unsub';
     $elements->edit_notification_unsub = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><button onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>';
     $link = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=email&amp;task=edit&amp;mailid=modif';
     $elements->editModifEmail = '<a class="modal" id="modifemail"  href="' . $link . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><button onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>';
     $path = JLanguage::getLanguagePath(JPATH_ROOT);
     $dirs = JFolder::folders($path);
     $languages = array();
     foreach ($dirs as $dir) {
         if (strlen($dir) != 5 || $dir == "xx-XX") {
             continue;
         }
         $xmlFiles = JFolder::files($path . DS . $dir, '^([-_A-Za-z]*)\\.xml$');
         $xmlFile = reset($xmlFiles);
         if (empty($xmlFile)) {
             $data = array();
         } else {
             $data = JApplicationHelper::parseXMLLangMetaFile($path . DS . $dir . DS . $xmlFile);
         }
         $oneLanguage = null;
         $oneLanguage->language = $dir;
         $oneLanguage->name = empty($data['name']) ? $dir : $data['name'];
         $languageFiles = JFolder::files($path . DS . $dir, '^(.*)\\.com_acymailing\\.ini$');
         $languageFile = reset($languageFiles);
         if (!empty($languageFile)) {
             $linkEdit = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=file&amp;task=language&amp;code=' . $oneLanguage->language;
             $oneLanguage->edit = ' <a class="modal" title="' . JText::_('EDIT_LANGUAGE_FILE', true) . '"  href="' . $linkEdit . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><img id="image' . $oneLanguage->language . '" class="icon16" src="' . ACYMAILING_IMAGES . 'icons/icon-16-edit.png" alt="' . JText::_('EDIT_LANGUAGE_FILE', true) . '"/></a>';
         } else {
             $linkEdit = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=file&amp;task=language&amp;code=' . $oneLanguage->language;
             $oneLanguage->edit = ' <a class="modal" title="' . JText::_('ADD_LANGUAGE_FILE', true) . '"  href="' . $linkEdit . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><img id="image' . $oneLanguage->language . '" class="icon16"  src="' . ACYMAILING_IMAGES . 'icons/icon-16-add.png" alt="' . JText::_('ADD_LANGUAGE_FILE', true) . '"/></a>';
         }
         $languages[] = $oneLanguage;
     }
     $js = "function updateConfirmation(newvalue){";
     $js .= "if(newvalue == 0) {window.document.getElementById('confirmemail').style.display = 'none'; window.document.getElementById('confirm_redirect').disabled = true;}else{window.document.getElementById('confirmemail').style.display = 'inline'; window.document.getElementById('confirm_redirect').disabled = false;}";
     $js .= '}';
     $js .= "function updateModification(newvalue){ if(newvalue != 'none') {window.document.getElementById('modifemail').style.display = 'none';}else{window.document.getElementById('modifemail').style.display = 'inline';}} ";
     $js .= 'window.addEvent(\'load\', function(){ updateModification(\'' . $config->get('allow_modif', 'data') . '\'); updateConfirmation(' . $config->get('require_confirmation', 0) . '); });';
     $doc->addScriptDeclaration($js);
     $elements->require_confirmation = JHTML::_('select.booleanlist', "config[require_confirmation]", 'onclick="updateConfirmation(this.value)"', $config->get('require_confirmation', 0));
     $allowmodif = array();
     $allowmodif[] = JHTML::_('select.option', "none", JText::_('JOOMEXT_NO'));
     $allowmodif[] = JHTML::_('select.option', "data", JText::_('ONLY_SUBSCRIPTION'));
     $allowmodif[] = JHTML::_('select.option', "all", JText::_('JOOMEXT_YES'));
     $elements->allow_modif = JHTML::_('select.radiolist', $allowmodif, "config[allow_modif]", 'size="1" onclick="updateModification(this.value)"', 'value', 'text', $config->get('allow_modif', 'data'));
     if (version_compare(JVERSION, '1.6.0', '<')) {
         $db->setQuery("SELECT name,published,id FROM `#__plugins` WHERE `folder` = 'acymailing' AND `element` NOT LIKE 'plg%' ORDER BY published DESC, ordering ASC");
     } else {
         $db->setQuery("SELECT name,enabled as published,extension_id as id FROM `#__extensions` WHERE `folder` = 'acymailing' AND `type`= 'plugin' AND `element` NOT LIKE 'plg%' ORDER BY enabled DESC, ordering ASC");
     }
     $plugins = $db->loadObjectList();
     if (version_compare(JVERSION, '1.6.0', '<')) {
         $db->setQuery("SELECT name,published,id FROM `#__plugins` WHERE (`folder` != 'acymailing' OR `element` LIKE 'plg%') AND (`name` LIKE '%acymailing%' OR `element` LIKE '%acymailing%') ORDER BY published DESC, ordering ASC");
     } else {
         $db->setQuery("SELECT name,enabled as published ,extension_id as id FROM `#__extensions` WHERE (`folder` != 'acymailing' OR `element` LIKE 'plg%') AND `type` = 'plugin' AND (`name` LIKE '%acymailing%' OR `element` LIKE '%acymailing%') ORDER BY enabled DESC, ordering ASC");
     }
     $integrationplugins = $db->loadObjectList();
     $bounceaction = acymailing_get('type.bounceaction');
     $this->assignRef('bounceaction', $bounceaction);
     $this->assignRef('config', $config);
     $this->assignRef('languages', $languages);
     $this->assignRef('elements', $elements);
     $this->assignRef('plugins', $plugins);
     $this->assignRef('integrationplugins', $integrationplugins);
     jimport('joomla.html.pane');
     $tabs =& JPane::getInstance('tabs');
     $this->assignRef('tabs', $tabs);
     $this->assignRef('toggleClass', $toggleClass);
     $images = array('icon-32-apply.png', 'icon-32-save.png', 'icon-32-cancel.png', 'icon-32-send.png', 'icon-32-preview.png', 'icon-32-edit.png', 'icon-32-help.png', 'icon-32-new.png', 'icon-32-delete.png');
     foreach ($images as $oneImage) {
         $to = ACYMAILING_MEDIA . 'images' . DS . 'icons' . DS . $oneImage;
         if (version_compare(JVERSION, '1.6.0', '<')) {
             $from = rtrim(JPATH_ADMINISTRATOR, DS) . DS . 'templates' . DS . 'khepri' . DS . 'images' . DS . 'toolbar' . DS . $oneImage;
         } else {
             $from = rtrim(JPATH_ADMINISTRATOR, DS) . DS . 'templates' . DS . 'bluestork' . DS . 'images' . DS . 'toolbar' . DS . $oneImage;
         }
         if (!file_exists($to) and file_exists($from)) {
             if (!JFile::copy($from, $to)) {
                 acymailing_display('Could not copy the file from ' . $from . ' to ' . $to, 'warning');
             }
         }
     }
     if (version_compare(JVERSION, '1.6.0', '<') and !file_exists(rtrim(JPATH_SITE, DS) . DS . 'plugins' . DS . 'acymailing' . DS . 'tagsubscriber.php') or !version_compare(JVERSION, '1.6.0', '<') and !file_exists(rtrim(JPATH_SITE, DS) . DS . 'plugins' . DS . 'acymailing' . DS . 'tagsubscriber' . DS . 'tagsubscriber.php')) {
         acymailing_display(JText::sprintf('ERROR_PLUGINS', 'href="index.php?option=com_acymailing&amp;ctrl=update&amp;task=install"'), 'warning');
     }
     return parent::display($tpl);
 }
コード例 #9
0
 /**
  * Method to get Languages item data
  *
  * @return	array
  * @since	1.6
  */
 public function &getData()
 {
     if (is_null($this->data)) {
         // Get information
         $path = $this->getPath();
         $client = $this->getClient();
         $langlist = $this->getLanguageList();
         // Compute all the languages
         $data = array();
         foreach ($langlist as $lang) {
             $file = $path . '/' . $lang . '/' . $lang . '.xml';
             $file = file_exists(PATH_APP . $file) ? PATH_APP . $file : PATH_CORE . $file;
             $info = JApplicationHelper::parseXMLLangMetaFile($file);
             $row = new \Hubzero\Base\Object();
             $row->language = $lang;
             if (!is_array($info)) {
                 continue;
             }
             foreach ($info as $key => $value) {
                 $row->{$key} = $value;
             }
             // if current than set published
             $params = Component::params('com_languages');
             if ($params->get($client->name, 'en-GB') == $row->language) {
                 $row->published = 1;
             } else {
                 $row->published = 0;
             }
             $row->checked_out = 0;
             $data[] = $row;
         }
         usort($data, array($this, 'compareLanguages'));
         // Prepare data
         $limit = $this->getState('list.limit');
         $start = $this->getState('list.start');
         $total = $this->getTotal();
         if ($limit == 0) {
             $start = 0;
             $end = $total;
         } else {
             if ($start > $total) {
                 $start = $total - $total % $limit;
             }
             $end = $start + $limit;
             if ($end > $total) {
                 $end = $total;
             }
         }
         // Compute the displayed languages
         $this->data = array();
         for ($i = $start; $i < $end; $i++) {
             $this->data[] =& $data[$i];
         }
     }
     return $this->data;
 }
コード例 #10
0
ファイル: emailtemplates.php プロジェクト: jomsocial/JSVoice
 function getLanguages($client = 0)
 {
     $client = JApplicationHelper::getClientInfo($client);
     $path = JLanguage::getLanguagePath($client->path);
     $dirs = JFolder::folders($path);
     $i = 0;
     $data['name'] = '';
     foreach ($dirs as $dir) {
         $files = JFolder::files($path . DS . $dir, '^([-_A-Za-z]*)\\.xml$');
         foreach ($files as $file) {
             $data = JApplicationHelper::parseXMLLangMetaFile($path . DS . $dir . DS . $file);
             $row = new StdClass();
             $row->id = $i;
             $row->language = substr($file, 0, -4);
             if (!is_array($data)) {
                 continue;
             }
             foreach ($data as $key => $value) {
                 $row->{$key} = $value;
             }
             $rows[] = $row;
         }
         $i++;
     }
     return $rows;
 }
コード例 #11
0
 public static function getLanguageCodes()
 {
     static $langs;
     if (is_array($langs)) {
         return $langs;
     }
     $db = JFactory::getDBO();
     jimport('joomla.version');
     $version = new JVersion();
     if (version_compare($version->getShortVersion(), '1.6', '<')) {
         $langs = array();
         $client =& JApplicationHelper::getClientInfo(0);
         jimport('joomla.filesystem.folder');
         $path = JLanguage::getLanguagePath($client->path);
         $dirs = JFolder::folders($path);
         jimport('joomla.filesystem.folder');
         $path = JLanguage::getLanguagePath($client->path);
         $dirs = JFolder::folders($path);
         foreach ($dirs as $dir) {
             $files = JFolder::files($path . DS . $dir, '^([-_A-Za-z]*)\\.xml$');
             foreach ($files as $file) {
                 $data = JApplicationHelper::parseXMLLangMetaFile($path . DS . $dir . DS . $file);
                 $language = substr($file, 0, -4);
                 if (!is_array($data)) {
                     continue;
                 }
                 // if current than set published
                 $params = JComponentHelper::getParams('com_languages');
                 //if ( $params->get($client->name, 'en-GB') == $language) {
                 $langs[] = $language;
                 //}
             }
         }
         return $langs;
     } else {
         $db->setQuery("Select lang_code From #__languages Where published = 1 Order By ordering");
         $langs = CBCompat::loadColumn();
         return $langs;
     }
 }
コード例 #12
0
ファイル: installed.php プロジェクト: joebushi/joomla
 /**
  * Method to get Languages item data
  *
  * @return array
  */
 public function &getData()
 {
     if (is_null($this->data)) {
         // Get information
         $folders =& $this->_getFolders();
         $path =& $this->_getPath();
         $client =& $this->getClient();
         // Compute all the languages
         $data = array();
         foreach ($folders as $folder) {
             $file = $path . DS . $folder . DS . $folder . '.xml';
             $info =& JApplicationHelper::parseXMLLangMetaFile($file);
             $row = new JObject();
             $row->language = $folder;
             if (!is_array($info)) {
                 continue;
             }
             foreach ($info as $key => $value) {
                 $row->{$key} = $value;
             }
             // if current than set published
             $params =& JComponentHelper::getParams('com_languages');
             if ($params->get($client->name, 'en-GB') == $row->language) {
                 $row->published = 1;
             } else {
                 $row->published = 0;
             }
             $row->checked_out = 0;
             $data[] = $row;
         }
         usort($data, array('LanguagesModelInstalled', '_compareLanguages'));
         // Prepare data
         $limit = $this->getState('list.limit');
         $start = $this->getState('list.start');
         $total = $this->getTotal();
         if ($limit == 0) {
             $start = 0;
             $end = $total;
         } else {
             if ($start > $total) {
                 $start = $total - $total % $limit;
             }
             $end = $start + $limit;
             if ($end > $total) {
                 $end = $total;
             }
         }
         // Compute the displayed languages
         $this->data = array();
         for ($i = $start; $i < $end; $i++) {
             $this->data[] =& $data[$i];
         }
     }
     return $this->data;
 }
コード例 #13
0
ファイル: view.html.php プロジェクト: jomsocial/JSVoice
 /**
  * Compiles a list of installed languages
  */
 function show_list()
 {
     $option = JRequest::getCmd('option');
     $mainframe = JFactory::getApplication();
     // Initialize some variables
     $db = JFactory::getDBO();
     $client = JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int'));
     $rows = array();
     $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
     $limitstart = $mainframe->getUserStateFromRequest($option . '.limitstart', 'limitstart', 0, 'int');
     //load folder filesystem class
     $path = JLanguage::getLanguagePath($client->path);
     $dirs = JFolder::folders($path);
     $i = 0;
     $data['name'] = '';
     foreach ($dirs as $dir) {
         $files = JFolder::files($path . DS . $dir, '^([-_A-Za-z]*)\\.xml$');
         foreach ($files as $file) {
             $data = JApplicationHelper::parseXMLLangMetaFile($path . DS . $dir . DS . $file);
             $row = new StdClass();
             $row->id = $i;
             $row->language = substr($file, 0, -4);
             if (!is_array($data)) {
                 continue;
             }
             foreach ($data as $key => $value) {
                 $row->{$key} = $value;
             }
             // if current than set published
             $params = JComponentHelper::getParams('com_languages');
             if ($params->get($client->name, 'en-GB') == $row->language) {
                 $row->published = 1;
             } else {
                 $row->published = 0;
             }
             $row->checked_out = 0;
             $row->mosname = JString::strtolower(str_replace(" ", "_", $row->name));
             $rows[] = $row;
         }
         $i++;
     }
     jimport('joomla.html.pagination');
     $pageNav = new JPagination($i, $limitstart, $limit);
     $rows = array_slice($rows, $pageNav->limitstart, $pageNav->limit);
     $this->assignRef('rows', $rows);
     $this->assignRef('page', $pageNav);
     $this->assignRef('client', $client);
 }
コード例 #14
0
ファイル: view.html.php プロジェクト: rlee1962/diylegalcenter
 function display($tpl = null)
 {
     JHTML::_('behavior.modal', 'a.modal');
     $config = acymailing::config();
     $db =& JFactory::getDBO();
     acymailing::setTitle(JText::_('CONFIGURATION'), 'config', 'config');
     $bar =& JToolBar::getInstance('toolbar');
     if (acymailing::level(3)) {
         $bar->appendButton('Link', 'fields', JText::_('EXTRA_FIELDS'), acymailing::completeLink('fields'));
         JToolBarHelper::custom('bounce', 'process', '', JText::_('BOUNCE_PROCESS'), false);
     }
     JToolBarHelper::custom('test', 'send', '', JText::_('SEND_TEST'), false);
     JToolBarHelper::divider();
     JToolBarHelper::save();
     JToolBarHelper::apply();
     JToolBarHelper::cancel('cancel', JText::_('CLOSE'));
     JToolBarHelper::divider();
     $bar->appendButton('Pophelp', 'config');
     $bar->appendButton('Link', 'acymailing', JText::_('JOOMEXT_CPANEL'), acymailing::completeLink('dashboard'));
     $elements = null;
     $elements->add_names = JHTML::_('select.booleanlist', "config[add_names]", '', $config->get('add_names', true));
     $elements->embed_images = JHTML::_('select.booleanlist', "config[embed_images]", '', $config->get('embed_images', 0));
     $elements->embed_files = JHTML::_('select.booleanlist', "config[embed_files]", '', $config->get('embed_files', 1));
     $elements->multiple_part = JHTML::_('select.booleanlist', "config[multiple_part]", '', $config->get('multiple_part', 0));
     $mailerMethod = acymailing::get('type.mailermethod');
     $elements->mailer_method = $mailerMethod->display("config[mailer_method]", $config->get('mailer_method', 'phpmail'));
     $encoding = acymailing::get('type.encoding');
     $elements->encoding_format = $encoding->display("config[encoding_format]", $config->get('encoding_format', 'base64'));
     $charset = acymailing::get('type.charset');
     $elements->charset = $charset->display("config[charset]", $config->get('charset', 'UTF-8'));
     $secured = acymailing::get('type.secured');
     $elements->smtp_secured = $secured->display("config[smtp_secured]", $config->get('smtp_secured'));
     $elements->smtp_auth = JHTML::_('select.booleanlist', "config[smtp_auth]", '', $config->get('smtp_auth', 0));
     $elements->smtp_keepalive = JHTML::_('select.booleanlist', "config[smtp_keepalive]", '', $config->get('smtp_keepalive', 1));
     $queueType = acymailing::get('type.queuetype');
     $elements->queue_type = $queueType->display("config[queue_type]", $config->get('queue_type', 'auto'));
     $elements->allow_visitor = JHTML::_('select.booleanlist', "config[allow_visitor]", '', $config->get('allow_visitor', 1));
     $editorType = acymailing::get('type.editor');
     $elements->editor = $editorType->display('config[editor]', $config->get('editor'));
     $elements->subscription_message = JHTML::_('select.booleanlist', "config[subscription_message]", '', $config->get('subscription_message', 1));
     $elements->confirmation_message = JHTML::_('select.booleanlist', "config[confirmation_message]", '', $config->get('confirmation_message', 1));
     $elements->unsubscription_message = JHTML::_('select.booleanlist', "config[unsubscription_message]", '', $config->get('unsubscription_message', 1));
     $elements->welcome_message = JHTML::_('select.booleanlist', "config[welcome_message]", '', $config->get('welcome_message', 1));
     $elements->unsub_message = JHTML::_('select.booleanlist', "config[unsub_message]", '', $config->get('unsub_message', 1));
     $elements->confirm_message = JHTML::_('select.booleanlist', "config[confirm_message]", '', $config->get('confirm_message', 0));
     if (acymailing::level(1)) {
         $elements->show_footer = JHTML::_('select.booleanlist', "config[show_footer]", '', $config->get('show_footer', 1));
         $elements->forward = JHTML::_('select.booleanlist', "config[forward]", '', $config->get('forward', false));
     } else {
         $elements->show_footer = '<small style="color:red">' . JText::_('ONLY_FROM_ESSENTIAL') . '</small>';
         $elements->forward = '<small style="color:red">' . JText::_('ONLY_FROM_ESSENTIAL') . '</small>';
     }
     $cssFiles = acymailing::get('type.css');
     $cssFiles->type = 'component';
     $elements->css_frontend = $cssFiles->display('config[css_frontend]', $config->get('css_frontend', 'default'));
     $cssFiles->type = 'module';
     $elements->css_module = $cssFiles->display('config[css_module]', $config->get('css_module', 'default'));
     $cssFiles->type = 'component';
     $elements->css_backend = $cssFiles->display('config[css_backend]', $config->get('css_backend', 'default'));
     $elements->colortype = acymailing::get('type.color');
     $elements->use_sef = JHTML::_('select.booleanlist', "config[use_sef]", '', $config->get('use_sef', 0));
     $query = 'SELECT a.name, a.id as itemid, b.title  FROM `#__menu` as a LEFT JOIN `#__menu_types` as b on a.menutype = b.menutype WHERE a.access = 0 ORDER BY b.title ASC,a.ordering ASC';
     $db->setQuery($query);
     $joomMenus = $db->loadObjectList();
     $menuvalues = array();
     $menuvalues[] = JHTML::_('select.option', '0', JText::_('NONE'));
     $lastGroup = '';
     foreach ($joomMenus as $oneMenu) {
         if ($oneMenu->title != $lastGroup) {
             if (!empty($lastGroup)) {
                 $menuvalues[] = JHTML::_('select.option', '</OPTGROUP>');
             }
             $menuvalues[] = JHTML::_('select.option', '<OPTGROUP>', $oneMenu->title);
             $lastGroup = $oneMenu->title;
         }
         $menuvalues[] = JHTML::_('select.option', $oneMenu->itemid, $oneMenu->name);
     }
     $elements->acymailing_menu = JHTML::_('select.genericlist', $menuvalues, 'config[itemid]', 'size="1"', 'value', 'text', $config->get('itemid'));
     if (acymailing::level(1)) {
         $cronTypeReport = acymailing::get('type.cronreport');
         $elements->cron_sendreport = $cronTypeReport->display('config[cron_sendreport]', $config->get('cron_sendreport', 2));
         $cronTypeReportSave = acymailing::get('type.cronreportsave');
         $elements->cron_savereport = $cronTypeReportSave->display('config[cron_savereport]', $config->get('cron_savereport', 0));
         $link = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=config&amp;task=cleanreport';
         $elements->deleteReport = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size: {x: 400, y: 100}}"><button onclick="return false">' . JText::_('REPORT_DELETE') . '</button></a>';
         $link = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=config&amp;task=seereport';
         $elements->seeReport = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size: {x: 800, y: 500}}"><button onclick="return false">' . JText::_('REPORT_SEE') . '</button></a>';
         $link = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=email&amp;task=edit&amp;mailid=report';
         $elements->editReportEmail = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size: {x: 800, y: 500}}"><button onclick="return false">' . JText::_('REPORT_EDIT') . '</button></a>';
         $delayType = acymailing::get('type.delay');
         $elements->cron_frequency = $delayType->display('config[cron_frequency]', $config->get('cron_frequency', 0), 0);
         $elements->cron_url = ACYMAILING_LIVE . 'index.php?option=com_acymailing&ctrl=cron';
         $item = $config->get('itemid');
         if (!empty($item)) {
             $elements->cron_url .= '&Itemid=' . $item;
         }
         $informations = null;
         $informations->version = $config->get('version');
         $informations->level = $config->get('level');
         $informations->website = str_replace('~', 'tildsymb', ACYMAILING_LIVE);
         $informations->component = 'acymailing';
         $informations->cronurl = str_replace('~', 'tildsymb', $elements->cron_url);
         $infos = urlencode(base64_encode(serialize($informations)));
         $urlCron = 'http://www.acyba.com/index.php?option=com_doc&gtask=launcher&task=edit&infos=' . $infos;
         $elements->cron_edit = '<a class="modal" href="' . $urlCron . '" rel="{handler: \'iframe\', size: {x: 800, y: 500}}"><button onclick="return false">' . JText::_('CREATE_CRON') . '</button></a>';
     }
     $link = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=email&amp;task=edit&amp;mailid=confirmation';
     $elements->editConfEmail = '<a class="modal" id="confirmemail"  href="' . $link . '" rel="{handler: \'iframe\', size: {x: 800, y: 500}}"><button onclick="return false">' . JText::_('EDIT_CONF_MAIL') . '</button></a>';
     $link = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=email&amp;task=edit&amp;mailid=notification_created';
     $elements->edit_notification_created = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size: {x: 800, y: 500}}"><button onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>';
     $link = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=email&amp;task=edit&amp;mailid=notification_refuse';
     $elements->edit_notification_refuse = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size: {x: 800, y: 500}}"><button onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>';
     $link = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=email&amp;task=edit&amp;mailid=notification_unsuball';
     $elements->edit_notification_unsuball = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size: {x: 800, y: 500}}"><button onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>';
     $link = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=email&amp;task=edit&amp;mailid=notification_unsub';
     $elements->edit_notification_unsub = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size: {x: 800, y: 500}}"><button onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>';
     $link = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=email&amp;task=edit&amp;mailid=modif';
     $elements->editModifEmail = '<a class="modal" id="modifemail"  href="' . $link . '" rel="{handler: \'iframe\', size: {x: 800, y: 500}}"><button onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>';
     if (acymailing::level(3)) {
         $elements->bounce = JHTML::_('select.booleanlist', "config[bounce]", '', $config->get('bounce', 0));
         $connectionType = acymailing::get('type.connection');
         $elements->bounce_connection = $connectionType->display('config[bounce_connection]', $config->get('bounce_connection', 'imap'));
         $elements->bounce_secured = $secured->display("config[bounce_secured]", $config->get('bounce_secured'));
         $elements->bounce_certif = JHTML::_('select.booleanlist', "config[bounce_certif]", '', $config->get('bounce_certif', 0));
         $this->assignRef('emailaction', acymailing::get('type.emailaction'));
         $js = "function updateConfirmation(newvalue){";
         $js .= "if(newvalue == 0) {window.document.getElementById('confirmemail').style.display = 'none'; window.document.getElementById('confirm_redirect').disabled = true;}else{window.document.getElementById('confirmemail').style.display = 'inline'; window.document.getElementById('confirm_redirect').disabled = false;}";
         $js .= '}';
         $js .= "function displayBounceFrequency(newvalue){ if(newvalue == '1') {window.document.getElementById('bouncefrequency').style.display = 'block';}else{window.document.getElementById('bouncefrequency').style.display = 'none';}} ";
         $js .= 'window.addEvent(\'load\', function(){ displayBounceFrequency(\'' . $config->get('auto_bounce', 0) . '\');});';
         $doc =& JFactory::getDocument();
         $doc->addScriptDeclaration($js);
     }
     jimport('joomla.filesystem.folder');
     $path = JLanguage::getLanguagePath(JPATH_ROOT);
     $dirs = JFolder::folders($path);
     foreach ($dirs as $dir) {
         $xmlFiles = JFolder::files($path . DS . $dir, '^([-_A-Za-z]*)\\.xml$');
         $xmlFile = reset($xmlFiles);
         if (empty($xmlFile)) {
             continue;
         }
         $data = JApplicationHelper::parseXMLLangMetaFile($path . DS . $dir . DS . $xmlFile);
         $oneLanguage = null;
         $oneLanguage->language = $dir;
         $oneLanguage->name = $data['name'];
         $languageFiles = JFolder::files($path . DS . $dir, '^(.*)\\.com_acymailing\\.ini$');
         $languageFile = reset($languageFiles);
         if (!empty($languageFile)) {
             $linkEdit = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=file&amp;task=language&amp;code=' . $oneLanguage->language;
             $oneLanguage->edit = '<a class="modal" title="' . JText::_('EDIT_LANGUAGE_FILE', true) . '"  href="' . $linkEdit . '" rel="{handler: \'iframe\', size: {x: 800, y: 500}}"><img id="image' . $oneLanguage->language . '" src="../images/M_images/edit.png" alt="' . JText::_('EDIT_LANGUAGE_FILE', true) . '"/></a>';
         } else {
             $linkEdit = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=file&amp;task=language&amp;code=' . $oneLanguage->language;
             $oneLanguage->edit = '<a class="modal" title="' . JText::_('ADD_LANGUAGE_FILE', true) . '"  href="' . $linkEdit . '" rel="{handler: \'iframe\', size: {x: 800, y: 500}}"><img id="image' . $oneLanguage->language . '" src="../images/M_images/new.png" alt="' . JText::_('ADD_LANGUAGE_FILE', true) . '"/></a>';
         }
         $languages[] = $oneLanguage;
     }
     $js = "function updateConfirmation(newvalue){";
     $js .= "if(newvalue == 0) {window.document.getElementById('confirmemail').style.display = 'none'; window.document.getElementById('confirm_redirect').disabled = true;}else{window.document.getElementById('confirmemail').style.display = 'inline'; window.document.getElementById('confirm_redirect').disabled = false;}";
     $js .= '}';
     $js .= "function updateModification(newvalue){ if(newvalue != 'none') {window.document.getElementById('modifemail').style.display = 'none';}else{window.document.getElementById('modifemail').style.display = 'inline';}} ";
     $js .= 'window.addEvent(\'load\', function(){ updateModification(\'' . $config->get('allow_modif', 'data') . '\'); updateConfirmation(' . $config->get('require_confirmation', 0) . '); });';
     $doc =& JFactory::getDocument();
     $doc->addScriptDeclaration($js);
     $elements->require_confirmation = JHTML::_('select.booleanlist', "config[require_confirmation]", 'onclick="updateConfirmation(this.value)"', $config->get('require_confirmation', 0));
     $allowmodif = array();
     $allowmodif[] = JHTML::_('select.option', "none", JText::_('JOOMEXT_NO'));
     $allowmodif[] = JHTML::_('select.option', "data", JText::_('ONLY_SUBSCRIPTION'));
     $allowmodif[] = JHTML::_('select.option', "all", JText::_('JOOMEXT_YES'));
     $elements->allow_modif = JHTML::_('select.radiolist', $allowmodif, "config[allow_modif]", 'size="1" onclick="updateModification(this.value)"', 'value', 'text', $config->get('allow_modif', 'data'));
     $delayType2 = acymailing::get('type.delay');
     $elements->queue_delay = $delayType2->display('config[queue_delay]', $config->get('queue_delay', 0), 2);
     $db->setQuery("SELECT name,published,id FROM `#__plugins` WHERE `folder` = 'acymailing' AND `element` NOT LIKE 'plg%' ORDER BY published DESC, ordering ASC");
     $plugins = $db->loadObjectList();
     $db->setQuery("SELECT name,published,id FROM `#__plugins` WHERE (`folder` != 'acymailing' OR `element` LIKE 'plg%') AND (`name` LIKE '%acymailing%' OR `element` LIKE '%acymailing%') ORDER BY published DESC, ordering ASC");
     $integrationplugins = $db->loadObjectList();
     $this->assignRef('bounceaction', acymailing::get('type.bounceaction'));
     $this->assignRef('config', $config);
     $this->assignRef('languages', $languages);
     $this->assignRef('elements', $elements);
     $this->assignRef('plugins', $plugins);
     $this->assignRef('integrationplugins', $integrationplugins);
     $toggleClass = acymailing::get('helper.toggle');
     jimport('joomla.html.pane');
     $tabs =& JPane::getInstance('tabs');
     $this->assignRef('tabs', $tabs);
     $this->assignRef('toggleClass', $toggleClass);
     if (!file_exists(ACYMAILING_FRONT . 'images' . DS . 'icons' . DS . 'icon-32-apply.png') || !file_exists(ACYMAILING_FRONT . 'images' . DS . 'icons' . DS . 'icon-32-edit.png') and file_exists(rtrim(JPATH_ADMINISTRATOR, DS) . DS . 'templates' . DS . 'khepri' . DS . 'images' . DS . 'toolbar' . DS . 'icon-32-apply.png')) {
         $images = array('icon-32-apply.png', 'icon-32-save.png', 'icon-32-cancel.png', 'icon-32-send.png', 'icon-32-preview.png', 'icon-32-edit.png');
         jimport('joomla.filesystem.file');
         foreach ($images as $oneImage) {
             JFile::copy(rtrim(JPATH_ADMINISTRATOR, DS) . DS . 'templates' . DS . 'khepri' . DS . 'images' . DS . 'toolbar' . DS . $oneImage, ACYMAILING_FRONT . 'images' . DS . 'icons' . DS . $oneImage);
         }
     }
     if (!file_exists(rtrim(JPATH_SITE, DS) . DS . 'plugins' . DS . 'acymailing' . DS . 'tagsubscriber.php')) {
         acymailing::display(JText::sprintf('ERROR_PLUGINS', 'index.php?option=com_acymailing&amp;ctrl=update&amp;task=install'), 'warning');
     }
     return parent::display($tpl);
 }
コード例 #15
0
ファイル: functions.php プロジェクト: JexyRu/jshop-updates
/**
* get system language
* 
* @param int $client (0 - site, 1 - admin)
*/
function getAllLanguages($client = 0)
{
    $pattern = '#(.*?)\\(#is';
    $client = JApplicationHelper::getClientInfo($client);
    $rows = array();
    jimport('joomla.filesystem.folder');
    $path = JLanguage::getLanguagePath($client->path);
    $dirs = JFolder::folders($path);
    foreach ($dirs as $dir) {
        $files = JFolder::files($path . '/' . $dir, '^([-_A-Za-z]*)\\.xml$');
        foreach ($files as $file) {
            $data = JApplicationHelper::parseXMLLangMetaFile($path . '/' . $dir . '/' . $file);
            $row = new StdClass();
            $row->descr = $data['name'];
            $row->language = substr($file, 0, -4);
            $row->lang = substr($row->language, 0, 2);
            $row->name = $data['name'];
            preg_match($pattern, $row->name, $matches);
            if (isset($matches[1])) {
                $row->name = trim($matches[1]);
            }
            if (!is_array($data)) {
                continue;
            }
            $rows[] = $row;
        }
    }
    return $rows;
}
コード例 #16
0
ファイル: installed.php プロジェクト: educakanchay/educared
 /**
  * Method to get Languages item data.
  *
  * @return  array
  *
  * @since   1.6
  */
 public function getData()
 {
     if (is_null($this->data)) {
         // Get information.
         $path = $this->getPath();
         $client = $this->getClient();
         $langlist = $this->getLanguageList();
         // Compute all the languages.
         $data = array();
         foreach ($langlist as $lang) {
             $file = $path . '/' . $lang . '/' . $lang . '.xml';
             $info = JApplicationHelper::parseXMLLangMetaFile($file);
             $row = new JObject();
             $row->language = $lang;
             if (!is_array($info)) {
                 continue;
             }
             foreach ($info as $key => $value) {
                 $row->{$key} = $value;
             }
             // Fix wrongly set parentheses in RTL languages
             if (JFactory::getLanguage()->isRTL()) {
                 $row->name = html_entity_decode($row->name . '&#x200E;', ENT_QUOTES, 'UTF-8');
             }
             // If current than set published.
             $params = JComponentHelper::getParams('com_languages');
             if ($params->get($client->name, 'en-GB') == $row->language) {
                 $row->published = 1;
             } else {
                 $row->published = 0;
             }
             $row->checked_out = 0;
             $data[] = $row;
         }
         usort($data, array($this, 'compareLanguages'));
         // Prepare data.
         $limit = $this->getState('list.limit');
         $start = $this->getState('list.start');
         $total = $this->getTotal();
         if ($limit == 0) {
             $start = 0;
             $end = $total;
         } else {
             if ($start > $total) {
                 $start = $total - $total % $limit;
             }
             $end = $start + $limit;
             if ($end > $total) {
                 $end = $total;
             }
         }
         // Compute the displayed languages.
         $this->data = array();
         for ($i = $start; $i < $end; $i++) {
             $this->data[] =& $data[$i];
         }
     }
     return $this->data;
 }
コード例 #17
0
ファイル: languages.php プロジェクト: kaantunc/MYK-BOR
 function _loadItems()
 {
     global $mainframe, $option;
     $db =& JFactory::getDBO();
     if ($this->_state->get('filter.client') < 0) {
         $client = 'all';
         // Get the site languages
         $langBDir = JLanguage::getLanguagePath(JPATH_SITE);
         $langDirs = JFolder::folders($langBDir);
         for ($i = 0; $i < count($langDirs); $i++) {
             $lang = new stdClass();
             $lang->folder = $langDirs[$i];
             $lang->client = 0;
             $lang->baseDir = $langBDir;
             $languages[] = $lang;
         }
         // Get the admin languages
         $langBDir = JLanguage::getLanguagePath(JPATH_ADMINISTRATOR);
         $langDirs = JFolder::folders($langBDir);
         for ($i = 0; $i < count($langDirs); $i++) {
             $lang = new stdClass();
             $lang->folder = $langDirs[$i];
             $lang->client = 1;
             $lang->baseDir = $langBDir;
             $languages[] = $lang;
         }
     } else {
         $clientInfo =& JApplicationHelper::getClientInfo($this->_state->get('filter.client'));
         $client = $clientInfo->name;
         $langBDir = JLanguage::getLanguagePath($clientInfo->path);
         $langDirs = JFolder::folders($langBDir);
         for ($i = 0, $n = count($langDirs); $i < $n; $i++) {
             $lang = new stdClass();
             $lang->folder = $langDirs[$i];
             $lang->client = $clientInfo->id;
             $lang->baseDir = $langBDir;
             if ($this->_state->get('filter.string')) {
                 if (strpos($lang->folder, $this->_state->get('filter.string')) !== false) {
                     $languages[] = $lang;
                 }
             } else {
                 $languages[] = $lang;
             }
         }
     }
     $rows = array();
     $rowid = 0;
     foreach ($languages as $language) {
         $files = JFolder::files($language->baseDir . DS . $language->folder, '^([-_A-Za-z]*)\\.xml$');
         foreach ($files as $file) {
             $data = JApplicationHelper::parseXMLLangMetaFile($language->baseDir . DS . $language->folder . DS . $file);
             $row = new StdClass();
             $row->id = $rowid;
             $row->client_id = $language->client;
             $row->language = $language->baseDir . DS . $language->folder;
             // If we didn't get valid data from the xml file, move on...
             if (!is_array($data)) {
                 continue;
             }
             // Populate the row from the xml meta file
             foreach ($data as $key => $value) {
                 $row->{$key} = $value;
             }
             // if current than set published
             $clientVals =& JApplicationHelper::getClientInfo($row->client_id);
             $lang = JComponentHelper::getParams('com_languages');
             if ($lang->get($clientVals->name, 'en-GB') == basename($row->language)) {
                 $row->published = 1;
             } else {
                 $row->published = 0;
             }
             $row->checked_out = 0;
             $row->jname = JString::strtolower(str_replace(" ", "_", $row->name));
             $rows[] = $row;
             $rowid++;
         }
     }
     $this->setState('pagination.total', count($rows));
     // if the offset is greater than the total, then can the offset
     if ($this->_state->get('pagination.offset') > $this->_state->get('pagination.total')) {
         $this->setState('pagination.offset', 0);
     }
     if ($this->_state->get('pagination.limit') > 0) {
         $this->_items = array_slice($rows, $this->_state->get('pagination.offset'), $this->_state->get('pagination.limit'));
     } else {
         $this->_items = $rows;
     }
 }
コード例 #18
0
ファイル: view.html.php プロジェクト: freaqzilla/joomla-site
 function display($tpl = null)
 {
     JHTML::_('behavior.modal', 'a.modal');
     $toggleClass = acymailing_get('helper.toggle');
     $config = acymailing_config();
     $db = JFactory::getDBO();
     $doc = JFactory::getDocument();
     $app = JFactory::getApplication();
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     $lg = JFactory::getLanguage();
     $language = $lg->getTag();
     $styleRemind = 'float:right;margin-right:30px;position:relative;';
     $loadLink = '<a onclick="window.document.getElementById(\'acymailing_messages_warning\').style.display = \'none\';return true;" class="modal" rel="{handler: \'iframe\', size:{x:800, y:500}}" href="index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=file&amp;task=latest&amp;code=' . $language . '">' . JText::_('LOAD_LATEST_LANGUAGE') . '</a>';
     if (!file_exists(ACYMAILING_ROOT . 'language' . DS . $language . DS . $language . '.com_acymailing.ini')) {
         if ($config->get('errorlanguagemissing', 1)) {
             $notremind = '<small style="' . $styleRemind . '">' . $toggleClass->delete('acymailing_messages_warning', 'errorlanguagemissing_0', 'config', false, JText::_('DONT_REMIND')) . '</small>';
             acymailing_display(JText::_('MISSING_LANGUAGE') . ' ' . $loadLink . ' ' . $notremind, 'warning');
         }
     } elseif (version_compare(JText::_('ACY_LANG_VERSION'), $config->get('version'), '<')) {
         if ($config->get('errorlanguageupdate', 1)) {
             $notremind = '<small style="' . $styleRemind . '">' . $toggleClass->delete('acymailing_messages_warning', 'errorlanguageupdate_0', 'config', false, JText::_('DONT_REMIND')) . '</small>';
             acymailing_display(JText::_('UPDATE_LANGUAGE') . ' ' . $loadLink . ' ' . $notremind, 'warning');
         }
     }
     $indexes = array('listsub', 'stats', 'list', 'mail', 'userstats', 'urlclick', 'history', 'template', 'queue', 'subscriber');
     $addIndexes = array('We recenty optimized our database...');
     foreach ($indexes as $oneTable) {
         if ($config->get('optimize_' . $oneTable, 1)) {
             continue;
         }
         $addIndexes[] = 'Please ' . $toggleClass->toggleText('addindex', $oneTable, 'config', 'click here') . ' to add indexes on the ' . $oneTable . ' table';
     }
     if (count($addIndexes) > 1) {
         acymailing_display($addIndexes, 'warning');
     }
     acymailing_setTitle(JText::_('CONFIGURATION'), 'acyconfig', 'cpanel');
     $bar = JToolBar::getInstance('toolbar');
     JToolBarHelper::custom('test', 'acysend', '', JText::_('SEND_TEST'), false);
     JToolBarHelper::divider();
     JToolBarHelper::save();
     JToolBarHelper::apply();
     JToolBarHelper::cancel('cancel', JText::_('ACY_CLOSE'));
     JToolBarHelper::divider();
     $bar->appendButton('Pophelp', 'config');
     if (acymailing_isAllowed($config->get('acl_cpanel_manage', 'all'))) {
         $bar->appendButton('Link', 'acymailing', JText::_('ACY_CPANEL'), acymailing_completeLink('dashboard'));
     }
     $elements = new stdClass();
     $elements->add_names = JHTML::_('acyselect.booleanlist', "config[add_names]", '', $config->get('add_names', true));
     $elements->embed_images = JHTML::_('acyselect.booleanlist', "config[embed_images]", '', $config->get('embed_images', 0));
     $elements->embed_files = JHTML::_('acyselect.booleanlist', "config[embed_files]", '', $config->get('embed_files', 1));
     $elements->multiple_part = JHTML::_('acyselect.booleanlist', "config[multiple_part]", '', $config->get('multiple_part', 0));
     $mailerMethods = array('smtp_com', 'elasticemail', 'smtp', 'sendmail');
     $js = "function updateMailer(mailermethod){" . "\n";
     foreach ($mailerMethods as $oneMethod) {
         $js .= " window.document.getElementById('" . $oneMethod . "_config').style.display = 'none'; " . "\n";
     }
     $js .= "if(window.document.getElementById(mailermethod+'_config')) {window.document.getElementById(mailermethod+'_config').style.display = 'block';} }";
     $js .= 'window.addEvent(\'domready\', function(){ updateMailer(\'' . $config->get('mailer_method', 'phpmail') . '\'); });';
     $doc->addScriptDeclaration($js);
     $encodingval = array();
     $encodingval[] = JHTML::_('select.option', 'binary', 'Binary');
     $encodingval[] = JHTML::_('select.option', 'quoted-printable', 'Quoted-printable');
     $encodingval[] = JHTML::_('select.option', '7bit', '7 Bit');
     $encodingval[] = JHTML::_('select.option', '8bit', '8 Bit');
     $encodingval[] = JHTML::_('select.option', 'base64', 'Base 64');
     $elements->encoding_format = JHTML::_('select.genericlist', $encodingval, "config[encoding_format]", 'size="1" style="width:150px;"', 'value', 'text', $config->get('encoding_format', 'base64'));
     $charset = acymailing_get('type.charset');
     $elements->charset = $charset->display("config[charset]", $config->get('charset', 'UTF-8'));
     $securedVals = array();
     $securedVals[] = JHTML::_('select.option', '', '- - -');
     $securedVals[] = JHTML::_('select.option', 'ssl', 'SSL');
     $securedVals[] = JHTML::_('select.option', 'tls', 'TLS');
     $elements->smtp_secured = JHTML::_('select.genericlist', $securedVals, "config[smtp_secured]", 'size="1" style="width:100px;"', 'value', 'text', $config->get('smtp_secured'));
     $elements->smtp_auth = JHTML::_('acyselect.booleanlist', "config[smtp_auth]", '', $config->get('smtp_auth', 0));
     $elements->smtp_keepalive = JHTML::_('acyselect.booleanlist', "config[smtp_keepalive]", '', $config->get('smtp_keepalive', 1));
     $elements->allow_visitor = JHTML::_('acyselect.booleanlist', "config[allow_visitor]", '', $config->get('allow_visitor', 1));
     $editorType = acymailing_get('type.editor');
     $elements->editor = $editorType->display('config[editor]', $config->get('editor'));
     $elements->subscription_message = JHTML::_('acyselect.booleanlist', "config[subscription_message]", '', $config->get('subscription_message', 1));
     $elements->confirmation_message = JHTML::_('acyselect.booleanlist', "config[confirmation_message]", '', $config->get('confirmation_message', 1));
     $elements->unsubscription_message = JHTML::_('acyselect.booleanlist', "config[unsubscription_message]", '', $config->get('unsubscription_message', 1));
     $elements->welcome_message = JHTML::_('acyselect.booleanlist', "config[welcome_message]", '', $config->get('welcome_message', 1));
     $elements->unsub_message = JHTML::_('acyselect.booleanlist', "config[unsub_message]", '', $config->get('unsub_message', 1));
     $elements->confirm_message = JHTML::_('acyselect.booleanlist', "config[confirm_message]", '', $config->get('confirm_message', 0));
     $elements->show_footer = JHTML::_('acyselect.booleanlist', "config[show_footer]", '', $config->get('show_footer', 1));
     if (acymailing_level(1)) {
         $forwardValues = array();
         $forwardValues[] = JHTML::_('select.option', 0, JTEXT::_('JOOMEXT_NO'));
         $forwardValues[] = JHTML::_('select.option', 1, JTEXT::_('JOOMEXT_YES'));
         $forwardValues[] = JHTML::_('select.option', 2, JTEXT::_('JOOMEXT_YES_FORWARD'));
         $elements->forward = JHTML::_('acyselect.radiolist', $forwardValues, "config[forward]", '', 'value', 'text', $config->get('forward', 0));
     } else {
         $elements->forward = acymailing_getUpgradeLink('essential');
     }
     if (acymailing_level(1)) {
         $js = "function updateDKIM(dkimval){if(dkimval == 1){document.getElementById('dkim_config').style.display = 'block';}else{document.getElementById('dkim_config').style.display = 'none';}}\r\n\t\t\t\t\twindow.addEvent('load', function(){ updateDKIM(" . $config->get('dkim', 0) . ");});";
         $doc->addScriptDeclaration($js);
         if (function_exists('openssl_sign')) {
             $elements->dkim = JHTML::_('acyselect.booleanlist', "config[dkim]", 'onclick="updateDKIM(this.value)"', $config->get('dkim', 0));
         } else {
             $elements->dkim = '<input type="hidden" name="config[dkim]" value="0" />PHP Extension openssl not enabled';
         }
         $js = "function updateQueueProcess(newvalue){";
         $js .= "if(newvalue == 'onlyauto') {window.document.getElementById('method_auto').style.display = ''; window.document.getElementById('method_manual').style.display = 'none';}";
         $js .= "if(newvalue == 'auto') {window.document.getElementById('method_auto').style.display = ''; window.document.getElementById('method_manual').style.display = '';}";
         $js .= "if(newvalue == 'manual') {window.document.getElementById('method_auto').style.display = 'none'; window.document.getElementById('method_manual').style.display = '';}";
         $js .= '}';
         $js .= 'window.addEvent(\'domready\', function(){ updateQueueProcess(\'' . $config->get('queue_type', 'auto') . '\'); });';
         $doc->addScriptDeclaration($js);
         $queueType = array();
         $queueType[] = JHTML::_('select.option', 'onlyauto', JText::_('AUTO_ONLY'));
         $queueType[] = JHTML::_('select.option', 'auto', JText::_('AUTO_MAN'));
         $queueType[] = JHTML::_('select.option', 'manual', JText::_('MANUAL_ONLY'));
         $elements->queue_type = JHTML::_('acyselect.radiolist', $queueType, "config[queue_type]", 'onclick="updateQueueProcess(this.value);"', 'value', 'text', $config->get('queue_type', 'auto'));
     } else {
         $elements->dkim = acymailing_getUpgradeLink('essential');
     }
     $elements->ssl_links = JHTML::_('acyselect.booleanlist', "config[ssl_links]", '', $config->get('ssl_links', 0));
     $delayTypeManual = acymailing_get('type.delay');
     $elements->queue_pause = $delayTypeManual->display('config[queue_pause]', $config->get('queue_pause'), 0);
     $delayTypeAuto = acymailing_get('type.delay');
     $elements->cron_frequency = $delayTypeAuto->display('config[cron_frequency]', $config->get('cron_frequency'), 2);
     $cssval = array('css_frontend' => 'component', 'css_module' => 'module', 'css_backend' => 'component');
     foreach ($cssval as $configval => $type) {
         $myvals = array();
         $myvals[] = JHTML::_('select.option', '', JText::_('ACY_NONE'));
         $regex = '^' . $type . '_([-_a-z0-9]*)\\.css$';
         $allCSSFiles = JFolder::files(ACYMAILING_MEDIA . 'css', $regex);
         $family = '';
         foreach ($allCSSFiles as $oneFile) {
             preg_match('#' . $regex . '#i', $oneFile, $results);
             $fileName = str_replace('default_', '', $results[1]);
             $fileNameArray = explode('_', $fileName);
             if (count($fileNameArray) == 2) {
                 if ($fileNameArray[0] != $family) {
                     if (!empty($family)) {
                         $myvals[] = JHTML::_('select.option', '</OPTGROUP>');
                     }
                     $family = $fileNameArray[0];
                     $myvals[] = JHTML::_('select.option', '<OPTGROUP>', ucfirst($family));
                 }
                 unset($fileNameArray[0]);
                 $fileName = implode('_', $fileNameArray);
             }
             $fileName = ucwords(str_replace('_', ' ', $fileName));
             $myvals[] = JHTML::_('select.option', $results[1], $fileName);
         }
         if (!empty($family)) {
             $myvals[] = JHTML::_('select.option', '</OPTGROUP>');
         }
         $js = 'onchange="updateCSSLink(\'' . $configval . '\',\'' . $type . '\',this.value);"';
         $currentVal = $config->get($configval, 'default');
         $aStyle = empty($currentVal) ? 'style="display:none"' : '';
         $elements->{$configval} = JHTML::_('select.genericlist', $myvals, 'config[' . $configval . ']', 'class="inputbox" size="1" ' . $js, 'value', 'text', $config->get($configval, 'default'), $configval . '_choice');
         $linkEdit = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=file&amp;task=css&amp;file=' . $type . '_' . $config->get($configval, 'default') . '&amp;var=' . $configval;
         $elements->{$configval} .= ' <a id="' . $configval . '_link" ' . $aStyle . ' class="modal" title="' . JText::_('ACY_EDIT', true) . '"  href="' . $linkEdit . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><img class="icon16" src="' . ACYMAILING_IMAGES . 'icons/icon-16-edit.png" alt="' . JText::_('ACY_EDIT', true) . '"/></a>';
     }
     $js = "function updateCSSLink(myid,type,newval){\r\n\t\t\tif(newval){document.getElementById(myid+'_link').style.display = '';}else{document.getElementById(myid+'_link').style.display = 'none'}\r\n\t\t\tdocument.getElementById(myid+'_link').href = 'index.php?option=com_acymailing&tmpl=component&ctrl=file&task=css&file='+type+'_'+newval+'&var='+myid;\r\n\t\t}";
     $doc->addScriptDeclaration($js);
     $elements->colortype = acymailing_get('type.color');
     $elements->use_sef = JHTML::_('acyselect.booleanlist', "config[use_sef]", '', $config->get('use_sef', 0));
     if (acymailing_level(1)) {
         $trackingMode = $config->get('trackingsystem', 'acymailing');
         $tracking_system = '<input type="checkbox" name="config[trackingsystem][]" id="trackingsystem[0]" value="acymailing" style="margin-left:10px" ' . (stripos($trackingMode, 'acymailing') !== false ? 'checked="checked"' : '') . '/> <label for="trackingsystem[0]">Acymailing</label>';
         $tracking_system .= '<input type="checkbox" name="config[trackingsystem][]" id="trackingsystem[1]" value="google" style="margin-left:10px;" ' . (stripos($trackingMode, 'google') !== false ? 'checked="checked"' : '') . '/> <label for="trackingsystem[1]">Google Analytics</label>';
         $tracking_system .= '<input type="hidden" name="config[trackingsystem][]" value="1"/>';
     } else {
         $tracking_system = acymailing_getUpgradeLink('essential');
     }
     $elements->tracking_system = $tracking_system;
     $indexType = $config->get('indexFollow', '');
     $indexFollow = '<input type="checkbox" name="config[indexFollow][]" id="indexFollow[0]" value="noindex" style="margin-left:10px" ' . (stripos($indexType, 'noindex') !== false ? 'checked="checked"' : '') . '/> <label for="indexFollow[0]">noindex</label>';
     $indexFollow .= '<input type="checkbox" name="config[indexFollow][]" id="indexFollow[1]" value="nofollow" style="margin-left:10px" ' . (stripos($indexType, 'nofollow') !== false ? 'checked="checked"' : '') . '/> <label for="indexFollow[1]">nofollow</label>';
     $indexFollow .= '<input type="hidden" name="config[indexFollow][]" value="1"/>';
     $elements->indexFollow = $indexFollow;
     if (acymailing_level(3)) {
         $geolocAvailable = true;
         $geolocation = '<input type="hidden" name="config[geolocation]" value="0"/>';
         $geoloc_api_key = '';
         if (!function_exists('curl_init')) {
             $geolocAvailable = false;
             $geolocation .= 'The AcyMailing geolocation plugin needs the CURL library installed but it seems that it is not available on your server. Please contact your web hosting to set it up.';
         }
         if (!function_exists('json_decode')) {
             if (!$geolocAvailable) {
                 $geolocation .= '<br/>';
             }
             $geolocAvailable = false;
             $geolocation .= 'The AcyMailing geolocation plugin can only work with PHP 5.2 at least. Please ask your web hosting to update your PHP version.';
         }
         if ($geolocAvailable) {
             $geoloc = $config->get('geolocation', '');
             $geolocation = '<span style="white-space:nowrap"><input type="checkbox" name="config[geolocation][]" id="geolocation_0" value="creation" style="margin-left:10px" ' . (stripos($geoloc, 'creation') !== false ? 'checked="checked"' : '') . '/> <label for="geolocation_0">' . JText::_('ON_USER_CREATE') . '</label></span>';
             $geolocation .= ' <span style="white-space:nowrap"><input type="checkbox" name="config[geolocation][]" id="geolocation_1" value="modify" style="margin-left:10px;" ' . (stripos($geoloc, 'modify') !== false ? 'checked="checked"' : '') . '/> <label for="geolocation_1">' . JText::_('ON_USER_CHANGE') . '</label></span>';
             $geolocation .= ' <span style="white-space:nowrap"><input type="checkbox" name="config[geolocation][]" id="geolocation_2" value="confirm" style="margin-left:10px;" ' . (stripos($geoloc, 'confirm') !== false ? 'checked="checked"' : '') . '/> <label for="geolocation_2">' . JText::_('GEOLOC_CONFIRM_SUB') . '</label></span>';
             $geolocation .= ' <span style="white-space:nowrap"><input type="checkbox" name="config[geolocation][]" id="geolocation_3" value="clic" style="margin-left:10px;" ' . (stripos($geoloc, 'clic') !== false ? 'checked="checked"' : '') . '/> <label for="geolocation_3">' . JText::_('ON_USER_CLICK') . '</label></span>';
             $geolocation .= ' <span style="white-space:nowrap"><input type="checkbox" name="config[geolocation][]" id="geolocation_4" value="open" style="margin-left:10px;" ' . (stripos($geoloc, 'open') !== false ? 'checked="checked"' : '') . '/> <label for="geolocation_4">' . JText::_('ON_OPEN_NEWS') . '</label></span>';
             $geolocation .= ' <span style="white-space:nowrap"><input type="checkbox" name="config[geolocation][]" id="geolocation_5" value="unsubscription" style="margin-left:10px;" ' . (stripos($geoloc, 'unsubscription') !== false ? 'checked="checked"' : '') . '/> <label for="geolocation_5">' . JText::_('GEOLOC_UNSUB') . '</label></span>';
             $geolocation .= '<input type="hidden" name="config[geolocation][]" value="1"/>';
             $geoloc_api_key = '<input class="inputbox" type="text" id="geoloc_api_key" name="config[geoloc_api_key]" style="width:450px" value="' . $this->escape($config->get('geoloc_api_key', '')) . '">';
         }
     } else {
         $geolocation = acymailing_getUpgradeLink('enterprise');
         $geoloc_api_key = false;
     }
     $elements->geolocation = $geolocation;
     $elements->geoloc_api_key = $geoloc_api_key;
     if (!ACYMAILING_J16) {
         $query = 'SELECT a.name, a.id as itemid, b.title  FROM `#__menu` as a JOIN `#__menu_types` as b on a.menutype = b.menutype WHERE a.access = 0 ORDER BY b.title ASC,a.ordering ASC';
     } else {
         $orderby = ACYMAILING_J30 ? 'a.lft' : 'a.ordering';
         $query = 'SELECT a.alias as name, a.id as itemid, b.title  FROM `#__menu` as a JOIN `#__menu_types` as b on a.menutype = b.menutype WHERE a.access NOT IN (2, 3) AND a.client_id=0 AND a.parent_id != 0 ORDER BY b.title ASC,' . $orderby . ' ASC';
     }
     $db->setQuery($query);
     $joomMenus = $db->loadObjectList();
     $menuvalues = array();
     $menuvalues[] = JHTML::_('select.option', '0', JText::_('ACY_NONE'));
     $lastGroup = '';
     foreach ($joomMenus as $oneMenu) {
         if ($oneMenu->title != $lastGroup) {
             if (!empty($lastGroup)) {
                 $menuvalues[] = JHTML::_('select.option', '</OPTGROUP>');
             }
             $menuvalues[] = JHTML::_('select.option', '<OPTGROUP>', $oneMenu->title);
             $lastGroup = $oneMenu->title;
         }
         $menuvalues[] = JHTML::_('select.option', $oneMenu->itemid, $oneMenu->name);
     }
     $elements->acymailing_menu = JHTML::_('select.genericlist', $menuvalues, 'config[itemid]', 'size="1"', 'value', 'text', $config->get('itemid'));
     $menupositions = array();
     $menupositions[] = JHTML::_('select.option', 'under', JText::_('UNDER_TITLE'));
     $menupositions[] = JHTML::_('select.option', 'above', JText::_('ABOVE_MAIN_AREA'));
     $elements->menu_position = JHTML::_('acyselect.radiolist', $menupositions, 'config[menu_position]', 'size="1"', 'value', 'text', $config->get('menu_position', 'under'));
     if (ACYMAILING_J30) {
         $elements->menu_position = '<input type="hidden" name="config[menu_position]" value="above" />' . JText::_('ABOVE_MAIN_AREA');
     }
     $acyrss_format = array();
     $acyrss_format[] = JHTML::_('select.option', '', JText::_('ACY_NONE'));
     $acyrss_format[] = JHTML::_('select.option', 'rss', 'RSS feed');
     $acyrss_format[] = JHTML::_('select.option', 'atom', 'Atom feed');
     $acyrss_format[] = JHTML::_('select.option', 'both', JText::_('ACY_ALL'));
     $elements->acyrss_format = JHTML::_('select.genericlist', $acyrss_format, "config[acyrss_format]", 'size="1"', 'value', 'text', $config->get('acyrss_format', ''));
     $acyrss_order = array();
     $acyrss_order[] = JHTML::_('select.option', 'senddate', JText::_('SEND_DATE'));
     $acyrss_order[] = JHTML::_('select.option', 'mailid', JText::_('ACY_ID'));
     $acyrss_order[] = JHTML::_('select.option', 'subject', JText::_('ACY_TITLE'));
     $elements->acyrss_order = JHTML::_('select.genericlist', $acyrss_order, "config[acyrss_order]", 'size="1"', 'value', 'text', $config->get('acyrss_order', 'senddate'));
     $link = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=email&amp;task=edit&amp;mailid=confirmation';
     $elements->editConfEmail = '<a class="modal" id="confirmemail"  href="' . $link . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><button class="btn" onclick="return false">' . JText::_('EDIT_CONF_MAIL') . '</button></a>';
     $link = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=email&amp;task=edit&amp;mailid=notification_created';
     $elements->edit_notification_created = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><button class="btn" onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>';
     $link = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=email&amp;task=edit&amp;mailid=notification_refuse';
     $elements->edit_notification_refuse = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><button class="btn" onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>';
     $link = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=email&amp;task=edit&amp;mailid=notification_unsuball';
     $elements->edit_notification_unsuball = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><button class="btn" onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>';
     $link = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=email&amp;task=edit&amp;mailid=notification_unsub';
     $elements->edit_notification_unsub = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><button class="btn" onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>';
     $link = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=email&amp;task=edit&amp;mailid=notification_contact';
     $elements->edit_notification_contact = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><button class="btn" onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>';
     $link = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=email&amp;task=edit&amp;mailid=notification_confirm';
     $elements->edit_notification_confirm = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><button class="btn" onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>';
     $link = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=email&amp;task=edit&amp;mailid=modif';
     $elements->editModifEmail = '<a class="modal" id="modifemail"  href="' . $link . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><button class="btn" onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>';
     $js = "function addUnsubReason(){\r\n\t\t\tvar input = document.createElement('input');\r\n\t\t\tinput.name = 'unsub_reasons[]';\r\n\t\t\tinput.style.width = '300px';\r\n\t\t\tinput.type = 'text';\r\n\t\t\tdocument.getElementById('unsub_reasons').appendChild(input);\r\n\t\t\tvar br = document.createElement('br');\r\n\t\t\tdocument.getElementById('unsub_reasons').appendChild(br);\r\n\t\t}\r\n\t\tfunction displaySurvey(surveyval){\r\n\t\t\tif(surveyval == 1){\r\n\t\t\t\tdocument.getElementById('unsub_reasons_area').style.display = 'block';\r\n\t\t\t}else{\r\n\t\t\t\tdocument.getElementById('unsub_reasons_area').style.display = 'none';\r\n\t\t\t}\r\n\t\t}\r\n\t\t";
     $doc->addScriptDeclaration($js);
     $path = JLanguage::getLanguagePath(JPATH_ROOT);
     $dirs = JFolder::folders($path);
     $languages = array();
     foreach ($dirs as $dir) {
         if (strlen($dir) != 5 || $dir == "xx-XX") {
             continue;
         }
         $xmlFiles = JFolder::files($path . DS . $dir, '^([-_A-Za-z]*)\\.xml$');
         $xmlFile = reset($xmlFiles);
         if (empty($xmlFile)) {
             $data = array();
         } else {
             $data = JApplicationHelper::parseXMLLangMetaFile($path . DS . $dir . DS . $xmlFile);
         }
         $oneLanguage = new stdClass();
         $oneLanguage->language = $dir;
         $oneLanguage->name = empty($data['name']) ? $dir : $data['name'];
         $languageFiles = JFolder::files($path . DS . $dir, '^(.*)\\.com_acymailing\\.ini$');
         $languageFile = reset($languageFiles);
         if (!empty($languageFile)) {
             $linkEdit = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=file&amp;task=language&amp;code=' . $oneLanguage->language;
             $oneLanguage->edit = ' <a class="modal" title="' . JText::_('EDIT_LANGUAGE_FILE', true) . '"  href="' . $linkEdit . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><img id="image' . $oneLanguage->language . '" class="icon16" src="' . ACYMAILING_IMAGES . 'icons/icon-16-edit.png" alt="' . JText::_('EDIT_LANGUAGE_FILE', true) . '"/></a>';
         } else {
             $linkEdit = 'index.php?option=com_acymailing&amp;tmpl=component&amp;ctrl=file&amp;task=language&amp;code=' . $oneLanguage->language;
             $oneLanguage->edit = ' <a class="modal" title="' . JText::_('ADD_LANGUAGE_FILE', true) . '"  href="' . $linkEdit . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><img id="image' . $oneLanguage->language . '" class="icon16"  src="' . ACYMAILING_IMAGES . 'icons/icon-16-add.png" alt="' . JText::_('ADD_LANGUAGE_FILE', true) . '"/></a>';
         }
         $languages[] = $oneLanguage;
     }
     $js = "function updateConfirmation(newvalue){";
     $js .= "if(newvalue == 0) {window.document.getElementById('confirmemail').style.display = 'none'; window.document.getElementById('confirm_redirect').disabled = true;}else{window.document.getElementById('confirmemail').style.display = 'inline'; window.document.getElementById('confirm_redirect').disabled = false;}";
     $js .= '}';
     $js .= "function updateModification(newvalue){ if(newvalue != 'none') {window.document.getElementById('modifemail').style.display = 'none';}else{window.document.getElementById('modifemail').style.display = 'inline';}} ";
     $js .= 'window.addEvent(\'load\', function(){ updateModification(\'' . $config->get('allow_modif', 'data') . '\'); updateConfirmation(' . $config->get('require_confirmation', 0) . '); });';
     $doc->addScriptDeclaration($js);
     $elements->require_confirmation = JHTML::_('acyselect.booleanlist', "config[require_confirmation]", 'onclick="updateConfirmation(this.value)"', $config->get('require_confirmation', 0));
     $allowmodif = array();
     $allowmodif[] = JHTML::_('select.option', "none", JText::_('JOOMEXT_NO'));
     $allowmodif[] = JHTML::_('select.option', "data", JText::_('ONLY_SUBSCRIPTION'));
     $allowmodif[] = JHTML::_('select.option', "all", JText::_('JOOMEXT_YES'));
     $elements->allow_modif = JHTML::_('acyselect.radiolist', $allowmodif, "config[allow_modif]", 'size="1" onclick="updateModification(this.value)"', 'value', 'text', $config->get('allow_modif', 'data'));
     if (!ACYMAILING_J16) {
         $db->setQuery("SELECT name,published,id FROM `#__plugins` WHERE `folder` = 'acymailing' AND `element` NOT LIKE 'plg%' ORDER BY published DESC, ordering ASC");
     } else {
         $db->setQuery("SELECT name,enabled as published,extension_id as id FROM `#__extensions` WHERE `folder` = 'acymailing' AND `type`= 'plugin' AND `element` NOT LIKE 'plg%' ORDER BY enabled DESC, ordering ASC");
     }
     $plugins = $db->loadObjectList();
     if (!ACYMAILING_J16) {
         $db->setQuery("SELECT name,published,id FROM `#__plugins` WHERE (`folder` != 'acymailing' OR `element` LIKE 'plg%') AND (`name` LIKE '%acymailing%' OR `element` LIKE '%acymailing%') ORDER BY published DESC, ordering ASC");
     } else {
         $db->setQuery("SELECT name,enabled as published ,extension_id as id FROM `#__extensions` WHERE (`folder` != 'acymailing' OR `element` LIKE 'plg%') AND `type` = 'plugin' AND (`name` LIKE '%acymailing%' OR `element` LIKE '%acymailing%') ORDER BY enabled DESC, ordering ASC");
     }
     $integrationplugins = $db->loadObjectList();
     $bounceaction = acymailing_get('type.bounceaction');
     $this->assignRef('bounceaction', $bounceaction);
     $this->assignRef('config', $config);
     $this->assignRef('languages', $languages);
     $this->assignRef('elements', $elements);
     $this->assignRef('plugins', $plugins);
     $this->assignRef('integrationplugins', $integrationplugins);
     $tabs = acymailing_get('helper.acytabs');
     $tabs->setOptions(array('useCookie' => true));
     $this->assignRef('tabs', $tabs);
     $this->assignRef('toggleClass', $toggleClass);
     if (!ACYMAILING_J16 and !file_exists(rtrim(JPATH_SITE, DS) . DS . 'plugins' . DS . 'acymailing' . DS . 'tagsubscriber.php') or ACYMAILING_J16 and !file_exists(rtrim(JPATH_SITE, DS) . DS . 'plugins' . DS . 'acymailing' . DS . 'tagsubscriber' . DS . 'tagsubscriber.php')) {
         acymailing_display(JText::sprintf('ERROR_PLUGINS', 'href="index.php?option=com_acymailing&amp;ctrl=update&amp;task=install"'), 'warning');
     }
     return parent::display($tpl);
 }
コード例 #19
0
 function getLanguages()
 {
     $path = JLanguage::getLanguagePath(JPATH_ROOT);
     $dirs = JFolder::folders($path);
     foreach ($dirs as $dir) {
         if (strlen($dir) != 5) {
             continue;
         }
         $xmlFiles = JFolder::files($path . DS . $dir, '^([-_A-Za-z]*)\\.xml$');
         $xmlFile = reset($xmlFiles);
         if (empty($xmlFile)) {
             continue;
         }
         $data = JApplicationHelper::parseXMLLangMetaFile($path . DS . $dir . DS . $xmlFile);
         $oneLanguage = new stdClass();
         $oneLanguage->language = $dir;
         $oneLanguage->name = $data['name'];
         $languageFiles = JFolder::files(JPATH_COMPONENT . DS . 'language' . DS . $dir, '^(.*)\\.' . getBookingExtName() . '\\.ini$');
         $imageName = JFolder::files(JPATH_COMPONENT . DS . 'language' . DS . $dir, '^(.*)\\.' . getBookingExtName() . '\\.png$');
         $languageFile = reset($languageFiles);
         if (!empty($languageFile)) {
             $linkEdit = 'index.php?option=' . getBookingExtName() . '&amp;task=language.editLanguage&amp;lngCode=' . $oneLanguage->language;
             $oneLanguage->edit = ' <a class="modal" title="' . JText::_('LNG_EDIT_LANGUAGE_FILE', true) . '"  href="' . $linkEdit . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><img id="image' . $oneLanguage->language . '" class="icon16" src="' . PATH_ASSETS_IMG . 'edit.png" alt="' . JText::_('LNG_EDIT_LANGUAGE_FILE', true) . '"/></a>';
         } else {
             $linkEdit = 'index.php?option=' . getBookingExtName() . '&amp;task=language.editLanguage&amp;lngCode=' . $oneLanguage->language;
             $oneLanguage->edit = ' <a class="modal" title="' . JText::_('LNG_ADD_LANGUAGE_FILE', true) . '"  href="' . $linkEdit . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><img id="image' . $oneLanguage->language . '" class="icon16" src="' . PATH_ASSETS_IMG . 'edit.png" alt="' . JText::_('LNG_EDIT_LANGUAGE_FILE', true) . '"/></a>';
         }
         $languages[] = $oneLanguage;
     }
     return $languages;
 }
コード例 #20
0
        // Install failed, roll back changes
        $this->parent->abort(JText::_('Plugin') . ' ' . JText::_('Install') . ': ' . $db->stderr(true));
        return false;
    }
}
$status->set('nooku_xmlrpc_plugin', true);
/***********************************************************************************************
 * ---------------------------------------------------------------------------------------------
 * SETUP DEFAULTS
 * ---------------------------------------------------------------------------------------------
 ***********************************************************************************************/
// Get the default site language's iso code, the name and the alias
$iso_code = JComponentHelper::getParams('com_languages')->get('site', 'en-GB');
$site = JApplicationHelper::getClientInfo(0);
$path = JLanguage::getLanguagePath($site->path);
$xml = JApplicationHelper::parseXMLLangMetaFile($path . DS . $iso_code . DS . $iso_code . '.xml');
$lang_name = preg_replace('/\\(.*\\)/', '', $xml['name']);
$alias = strtolower(substr($iso_code, 0, strpos($iso_code, '-')));
// Insert the default language into the nooku table
$iso = $db->Quote($iso_code);
$db->setQuery('INSERT INTO `#__nooku_languages` (`name`, `native_name`, `iso_code`, `alias`, `created_date`, `enabled`, `ordering`, `image`)' . 'VALUES (' . $db->Quote($lang_name) . ', ' . $db->Quote($lang_name) . ', ' . $db->Quote($iso_code) . ', ' . $db->Quote($alias) . ', NOW(), 1, 1,' . $db->Quote('gb.png') . ' )');
if (!$db->query()) {
    JError::raiseWarning(500, $db->getErrorMsg());
    return false;
}
//Save the primary language to the config
$table = JTable::getInstance('component');
$data = array();
$data['params'] = array('primary_language' => $iso_code);
$data['option'] = 'com_nooku';
$table->loadByOption('com_nooku');