/** * Timeout error handler */ function deadOnTimeOut() { if( connection_status() == 1 ) { AEUtilLogger::WriteLog(_AE_LOG_ERROR, 'The process was aborted on user\'s request'); } if( connection_status() >= 2 ) { AEUtilLogger::WriteLog(_AE_LOG_ERROR, AEPlatform::translate('KETTENRAD_TIMEOUT') ); } }
/** * Returns the JSON representation of the GUI definition and the associated values * @return string */ public static function getJsonGuiDefinition() { // Initialize the array which will be converted to JSON representation $json_array = array( 'engines' => array(), 'installers' => array(), 'gui' => array() ); // Get a reference to the configuration $configuration =& AEFactory::getConfiguration(); // Get data for all engines $engine_types = array('archiver','dump','scan','writer','proc'); foreach($engine_types as $type) { $engines = self::getEnginesList($type); foreach($engines as $engine_name => $engine_data) { // Translate information foreach($engine_data['information'] as $key => $value) { switch($key) { case 'title': case 'description': $value = AEPlatform::translate($value); break; } $json_array['engines'][$type][$engine_name]['information'][$key] = $value; } // Process parameters $parameters = array(); foreach($engine_data['parameters'] as $param_key => $param) { $param['default'] = $configuration->get( $param_key, $param['default'], false ); foreach($param as $option_key => $option_value ) { // Translate title, description, enumkeys switch($option_key) { case 'title': case 'description': case 'labelempty': case 'labelnotempty': $param[$option_key] = AEPlatform::translate($option_value); break; case 'enumkeys': $enumkeys = explode('|', $option_value); $new_keys = array(); foreach($enumkeys as $old_key) { $new_keys[] = AEPlatform::translate($old_key); } $param[$option_key] = implode('|', $new_keys); break; default: } } $parameters[$param_key] = $param; } // Add processed parameters $json_array['engines'][$type][$engine_name]['parameters'] = $parameters; } } // Get data for GUI elements $json_array['gui'] = array(); $groupdefs = self::getGUIGroups(); foreach($groupdefs as $group_ini => $definition) { $group_name = AEPlatform::translate($definition['information']['description']); if( empty($group_name) ) continue; // Skip no-name groups $parameters = array(); foreach($definition['parameters'] as $param_key => $param) { $param['default'] = $configuration->get( $param_key, $param['default'], FALSE ); foreach($param as $option_key => $option_value ) { // Translate title, description, enumkeys switch($option_key) { case 'title': case 'description': $param[$option_key] = AEPlatform::translate($option_value); break; case 'enumkeys': $enumkeys = explode('|', $option_value); $new_keys = array(); foreach($enumkeys as $old_key) { $new_keys[] = AEPlatform::translate($old_key); } $param[$option_key] = implode('|', $new_keys); break; default: } } $parameters[$param_key] = $param; } $json_array['gui'][$group_name] = $parameters; } // Get data for the installers $json_array['installers'] = self::getInstallerList(); $json = json_encode($json_array); return $json; }
/** * Gets a "quirk" status and adds it to the list if it is active * * @param array $quirks The quirks array * @param string $code The Quirks code, without the Q * @param string $severity Severity: 'low','medium','high' */ private static function getQuirk( &$quirks, $code, $severity ) { $methodName = 'q'.$code; if(self::$methodName()) { $description = AEPlatform::translate('Q'.$code); $quirks[] = array( 'code' => $code, 'severity' => $severity, 'description' => $description, 'help_url' => 'http://www.akeebabackup.com/help-support-documentation/warnings/q'.$code.'.html' ); } }
/** * Sends an email to the administrators * @return bool */ private function mail_administrators() { $this->setStep('Processing emails to administrators'); $this->setSubstep(''); // Skip email for back-end backups if(AEPlatform::get_backup_origin() == 'backend' ) return true; $must_email = AEPlatform::get_platform_configuration_option('frontend_email_on_finish', 0) != 0; if(!$must_email) return true; AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "Preparing to send e-mail to administrators"); $email = AEPlatform::get_platform_configuration_option('frontend_email_address', ''); $email = trim($email); if( !empty($email) ) { $emails = array($email); } else { $emails = AEPlatform::get_administrator_emails(); } if(!empty($emails)) { // Fetch user's preferences $subject = trim(AEPlatform::get_platform_configuration_option('frontend_email_subject','')); $body = trim(AEPlatform::get_platform_configuration_option('frontend_email_body','')); // Get the statistics $statistics =& AEFactory::getStatistics(); $stat = $statistics->getRecord(); $parts = AEUtilStatistics::get_all_filenames($stat, false); $profile_number = AEPlatform::get_active_profile(); $profile_name = AEPlatform::get_profile_name($profile_number); $parts = AEUtilStatistics::get_all_filenames($stat, false); $stat = (object)$stat; $num_parts = $stat->multipart; if($num_parts == 0) $num_parts = 1; // Non-split archives have a part count of 0 $parts_list = ''; if(!empty($parts)) foreach($parts as $file) { $parts_list .= "\t".basename($file)."\n"; } // Do we need a default subject? if(empty($subject)) { // Get the default subject $subject = AEPlatform::translate('EMAIL_SUBJECT_OK'); } else { // Post-process the subject $subject = AEUtilFilesystem::replace_archive_name_variables($subject); } // Do we need a default body? if(empty($body)) { $body = AEPlatform::translate('EMAIL_BODY_OK'); $info_source = AEPlatform::translate('EMAIL_BODY_INFO'); $body .= "\n\n" . sprintf($info_source, $profile_number, $num_parts) . "\n\n"; $body .= $parts_list; } else { // Post-process the body $body = AEUtilFilesystem::replace_archive_name_variables($body); $body = str_replace('[PROFILENUMBER]', $profile_number, $body); $body = str_replace('[PROFILENAME]', $profile_name, $body); $body = str_replace('[PARTCOUNT]', $num_parts, $body); $body = str_replace('[FILELIST]', $parts_list, $body); } // Sometimes $body contains literal \n instead of newlines $body = str_replace('\\n',"\n", $body); foreach($emails as $email) { AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "Sending email to $email"); AEPlatform::send_email($email, $subject, $body); } } return true; }