Пример #1
0
 function installLanguages()
 {
     $languages = JRequest::getString('languages');
     ob_start();
     $languagesContent = acymailing_fileGetContent(ACYMAILING_UPDATEURL . 'loadLanguages&json=1&codes=' . $languages);
     $warnings = ob_get_clean();
     if (!empty($warnings) && defined('JDEBUG') && JDEBUG) {
         echo $warnings;
     }
     if (empty($languagesContent)) {
         acymailing_display('Could not load the language files from our server, you can update them in the AcyMailing configuration page, tab "Languages" or start your own translation and share it', 'error');
         return;
     }
     $decodedLanguages = json_decode($languagesContent, true);
     jimport('joomla.filesystem.file');
     $updateHelper = acymailing_get('helper.update');
     $success = array();
     $error = array();
     foreach ($decodedLanguages as $code => $content) {
         if (empty($content)) {
             $error[] = 'The language ' . $code . ' was not found on our server, you can start your own translation in the AcyMailing configuration page, tab "Languages" then share it';
             continue;
         }
         if (JFile::write(JPATH_SITE . DS . 'language' . DS . $code . DS . $code . '.com_acymailing.ini', $content)) {
             $updateHelper->installMenu($code);
             $success[] = 'Successfully installed language: ' . $code;
         } else {
             $error[] = JText::sprintf('FAIL_SAVE', $code . '.com_acymailing.ini');
         }
     }
     if (!empty($success)) {
         acymailing_display(implode('<br />', $success), 'success');
     }
     if (!empty($error)) {
         acymailing_display(implode('<br />', $error), 'error');
     }
 }
Пример #2
0
 function checkForNewVersion()
 {
     $config = acymailing_config();
     ob_start();
     $url = ACYMAILING_UPDATEURL . 'loadUserInformation&component=acymailing&level=' . strtolower($config->get('level', 'starter'));
     $userInformation = acymailing_fileGetContent($url);
     $warnings = ob_get_clean();
     $result = !empty($warnings) && defined('JDEBUG') && JDEBUG ? $warnings : '';
     if (empty($userInformation)) {
         echo json_encode(array('content' => '<br/><span style="color:#C10000;">Could not load your information from our server</span><br/>' . $result));
         exit;
     }
     $decodedInformation = json_decode($userInformation, true);
     $newConfig = new stdClass();
     $newConfig->latestversion = $decodedInformation['latestversion'];
     $newConfig->expirationdate = $decodedInformation['expiration'];
     $newConfig->lastlicensecheck = time();
     $config->save($newConfig);
     $menuHelper = acymailing_get('helper.acymenu');
     $myAcyArea = $menuHelper->myacymailingarea();
     echo json_encode(array('content' => $myAcyArea));
     exit;
 }