Пример #1
0
 /**
  * @param array $options
  * @return Ambigous <WM_Translate, JO_Translate>
  */
 public static function getInstance($options = array())
 {
     if (self::$_instance == null) {
         self::$_instance = new self($options);
         self::initDB();
     }
     return self::$_instance;
 }
Пример #2
0
 public function _initTranslate()
 {
     $request = JO_Request::getInstance();
     if ($request->getModule() == 'install') {
         return '';
     }
     $translate = new WM_Gettranslate();
     JO_Registry::set('JO_Translate', WM_Translate::getInstance(array('data' => $translate->getTranslate())));
 }
Пример #3
0
 public function __construct()
 {
     $this->validate = new JO_Validate_Form();
     $translate = WM_Translate::getInstance();
     $this->validate->_set_errors('not_empty', $translate->translate('Field {field} must not be empty'));
     $this->validate->_set_errors('max_length', $translate->translate('Field {field} must contain no more than {symbols} characters'));
     $this->validate->_set_errors('min_length', $translate->translate('Field {field} must contain not less than {symbols} characters'));
     $this->validate->_set_errors('abc', $translate->translate('Field {field} must contain only letters'));
     $this->validate->_set_errors('number', $translate->translate('Field {field} must contain only numbers'));
     $this->validate->_set_errors('num_abc', $translate->translate('Field {field} must contain letters and numbers'));
     $this->validate->_set_errors('username', $translate->translate('Field {field} must contain only A-Z, a-z, 0-9, _ and .'));
     $this->validate->_set_errors('email', $translate->translate('Field {field} must contain a valid E-mail address'));
     $this->validate->_set_errors('date', $translate->translate('Field {field} must contain a valid date'));
     $this->validate->_set_errors('count', $translate->translate('Field {field} must be chosen more than {symbols}'));
     $this->validate->_set_errors('domain', $translate->translate('Field {field} is not valid'));
     return $this->validate;
 }
Пример #4
0
 public function __construct()
 {
     parent::__construct();
     $translate = WM_Translate::getInstance();
     $this->setErrorMessage(1, $translate->translate("The uploaded file is larger than the allowed maximum size for uploading to the server settings."));
     $this->setErrorMessage(2, $translate->translate("The uploaded file is larger than the allowed maximum size for upload in your site."));
     $this->setErrorMessage(3, $translate->translate("File was partially uploaded"));
     $this->setErrorMessage(4, $translate->translate("File was not successfully uploaded"));
     // end  http errors
     $this->setErrorMessage(10, $translate->translate("Please select file to upload"));
     $this->setErrorMessage(11, $translate->translate("Only files with the following extensions are allowed: {ext_string}"));
     $this->setErrorMessage(12, $translate->translate("Sorry, the file name contains illegal characters. Use only alphanumeric characters and underscore without spaces. Correct the file name ends with a point and then the extension."));
     $this->setErrorMessage(13, $translate->translate("The name of the file exceeds maximum length of {max_length_filename} characters."));
     $this->setErrorMessage(14, $translate->translate("Sorry, the directory file upload does not exist!"));
     $this->setErrorMessage(15, $translate->translate("Error uploading files: {the_file}. File already exists!"));
     $this->setErrorMessage(16, $translate->translate("The uploaded file is renamed to {file_copy}."));
 }
Пример #5
0
 public static function addContact($data)
 {
     $db = JO_Db::getDefaultAdapter();
     $domain = JO_Request::getInstance()->getDomain();
     $translate = WM_Translate::getInstance();
     $text = $translate->translate('Username') . ": " . $data['username'] . "\r\r\n\t\t" . $translate->translate('E-mail') . ": " . $data['email'] . "\r\r\n\t\t" . $translate->translate('Issue') . ": " . $data['issue'] . "\r\r\n\t\t" . $translate->translate('Description of issue') . ": " . $data['issue_details'] . "";
     $db->insert('contacts', array('name' => $data['username'], 'email' => $data['email'], 'issue' => $data['issue'], 'issue_id' => (int) $data['issue_id'], 'short_text' => $text, 'datetime' => new JO_Db_Expr('NOW()')));
     $contact_id = $db->lastInsertId();
     if ($contact_id) {
         $mail = new JO_Mail();
         if (JO_Registry::get('mail_smtp')) {
             $mail->setSMTPParams(JO_Registry::forceGet('mail_smtp_host'), JO_Registry::forceGet('mail_smtp_port'), JO_Registry::forceGet('mail_smtp_user'), JO_Registry::forceGet('mail_smtp_password'));
         }
         $mail->setFrom($data['email']);
         $mail->setSubject("[" . $domain . "] " . $translate->translate('Contact form') . ' [' . $contact_id . ']');
         $mail->setHTML(nl2br($text));
         $result = (int) $mail->send(array(JO_Registry::get('admin_mail')), JO_Registry::get('mail_smtp') ? 'smtp' : 'mail');
         return $result;
     }
 }
Пример #6
0
 public function error_text($err_num)
 {
     if (isset($this->error_message[$err_num])) {
         return $this->error_message[$err_num];
     }
     $translate = WM_Translate::getInstance();
     $error = array();
     $error[1] = $translate->translate('The uploaded file is larger than') . " " . $this->server_upload_max_filesize . ".";
     $error[2] = $translate->translate('The uploaded file is larger than') . " " . $this->format_bytes($this->max_size) . ".";
     $error[3] = $translate->translate('The file was partially uploaded');
     $error[4] = $translate->translate('The file has not been uploaded');
     $error[5] = $translate->translate('The file is empty');
     $error[6] = $translate->translate('Missing /tmp/ folder');
     $error[7] = $translate->translate('This file can not be saved');
     // end  http errors
     $error[11] = $translate->translate('Only files with the following extensions are allowed') . ": <b>%s</b>";
     $error[12] = $translate->translate('No file is specified for uploading');
     return isset($error[$err_num]) ? $error[$err_num] : $err_num;
 }