public function execute() { $errors = array(); $params = array(); $template_processor = SJB_System::getTemplateProcessor(); if (isset($_REQUEST['action'])) { $action_name = $_REQUEST['action']; $params = $_REQUEST; $action = SJB_PhraseActionFactory::get($action_name, $params, $template_processor); if ($action->canPerform()) { $action->perform(); SJB_WrappedFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/manage-phrases/?action=remember_previous_state&result=' . $action->result); } else { $errors = $action->getErrors(); } } $i18n = SJB_ObjectMother::createI18N(); $domains = $i18n->getDomainsData(); $langs = $i18n->getLanguagesData(); $template_processor->assign('domains', $domains); $template_processor->assign('langs', $langs); $template_processor->assign('request_data', $_REQUEST); $template_processor->assign('errors', $errors); $template_processor->display('add_phrase.tpl'); }
public function execute() { $errors = array(); $params = array(); $lang_id = SJB_Request::getVar('languageId', null); $i18n = SJB_ObjectMother::createI18N(); if ($i18n->languageExists($lang_id)) { $params = $i18n->getLanguageData($lang_id); $params['languageId'] = $lang_id; if (isset($_REQUEST['action'])) { $action_name = $_REQUEST['action']; $form_submitted = SJB_Request::getVar('submit'); $params = array_merge($params, $_REQUEST); $action = SJB_LanguageActionFactory::get($action_name, $params); if ($action->canPerform()) { $action->perform(); if ($form_submitted == 'save') { SJB_WrappedFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/manage-languages/'); } } else { $errors = $action->getErrors(); } } } else { $errors[] = 'LANGUAGE_DOES_NOT_EXIST'; } $template_editor = SJB_ObjectMother::createTemplateEditor(); $themes = $template_editor->getThemeList(); $template_processor = SJB_System::getTemplateProcessor(); $template_processor->assign('themes', $themes); $template_processor->assign('lang', $params); $template_processor->assign('errors', $errors); $template_processor->display('update_language.tpl'); }
public static function init($url) { // get setting from config.php $storageType = SJB_System::getSystemSettings('SESSION_STORAGE'); if ($storageType != 'files') { $sessionStorage = new SessionStorage(); session_set_save_handler(array($sessionStorage, 'open'), array($sessionStorage, 'close'), array($sessionStorage, 'read'), array($sessionStorage, 'write'), array($sessionStorage, 'destroy'), array($sessionStorage, 'gc')); } $path = SJB_Session::getSessionCookiePath(); SJB_WrappedFunctions::ini_set('session.cookie_path', $path); Zend_Session::start(); self::identificationUserSign(); }
public function execute() { $tp = SJB_System::getTemplateProcessor(); $errors = array(); $action = SJB_Request::getVar('action', false); if ($action && isset($_FILES['lang_file'])) { $params = $_REQUEST + $_FILES['lang_file']; $action = SJB_LanguageActionFactory::get($action, $params); if (@$action->canPerform()) { $action->perform(); SJB_WrappedFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/manage-languages/'); } else { $errors = $action->getErrors(); } } $tp->assign('errors', $errors); $tp->assign("uploadMaxFilesize", SJB_UploadFileManager::getIniUploadMaxFilesize()); $tp->display('import_language.tpl'); }
public function execute() { $errors = array(); $params = array(); if (isset($_REQUEST['action'])) { $action_name = $_REQUEST['action']; $params = $_REQUEST; $action = SJB_LanguageActionFactory::get($action_name, $params); if ($action->canPerform()) { $action->perform(); SJB_WrappedFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/manage-languages/'); } else { $errors = $action->getErrors(); } } $template_processor = SJB_System::getTemplateProcessor(); $template_processor->assign('request_data', $params); $template_processor->assign('errors', $errors); $template_processor->display('add_language.tpl'); }
function _validate() { $errors = array(); if (!empty($this->lang_file_data) && $this->lang_file_data['error'] == UPLOAD_ERR_NO_FILE) { $errors[] = 'Please choose language file'; return $errors; } if (!empty($this->lang_file_data) && $this->lang_file_data['error'] == UPLOAD_ERR_INI_SIZE) { $errors[] = 'File size exceeds system limit. Please check the file size limits on your hosting or upload another file'; return $errors; } if (!SJB_WrappedFunctions::is_uploaded_file($this->temp_file_path)) { $errors[] = 'LANG_FILE_UPLOAD_FAILED'; SJB_Logger::error('LANG_FILE_UPLOAD_FAILED'); } if (!SJB_WrappedFunctions::move_uploaded_file($this->temp_file_path, $this->file_path)) { $errors[] = 'UPLOADED_LANG_FILE_CANNOT_BE_MOVED'; SJB_Logger::error('UPLOADED_LANG_FILE_CANNOT_BE_MOVED'); } $fileHelper = $this->i18n->getFileHelper(); $languageID = $fileHelper->getLanguageIDForImportFile($this->file_name); if ($languageID === false) { $errors[] = 'The file format is invalid. Please try another file.'; SJB_Logger::error('The file format is invalid. Please try another file.'); } $lang_file_data = array('languageId' => $languageID, 'lang_file_path' => $this->file_path); $validator = $this->i18n->createImportLanguageValidator($lang_file_data); if (!$validator->isValid()) { $errors = array_merge($errors, $validator->getErrors()); } $fileSystem = new SJB_FileSystem(); if (!empty($errors)) { $fileSystem->deleteFile($this->file_path); } return $errors; }
public static function init($url) { $sessionStorage = new PHPBBSessionStorage(); session_set_save_handler(array($sessionStorage, 'open'), array($sessionStorage, 'close'), array($sessionStorage, 'read'), array($sessionStorage, 'write'), array($sessionStorage, 'destroy'), array($sessionStorage, 'gc')); $path = SJB_Session::getSessionCookiePath($url); SJB_WrappedFunctions::ini_set("session.cookie_path", $path); SJB_WrappedFunctions::session_start(); }
public static function deleteUploadedFile($file_info, $file_id) { $upload_file_directory = SJB_System::getSystemSettings('UPLOAD_FILES_DIRECTORY'); $file_name = SJB_Path::combine($upload_file_directory, $file_info['file_group'], $file_info['saved_file_name']); if (SJB_WrappedFunctions::file_exists($file_name)) { SJB_WrappedFunctions::unlink($file_name); } $ext = substr($file_name, 1 + strrpos($file_name, '.')); if ($ext == 'flv') { $base_name = substr($file_name, 0, strrpos($file_name, '.')); $file_name_img = $base_name . '.png'; if (SJB_WrappedFunctions::file_exists($file_name_img)) { SJB_WrappedFunctions::unlink($file_name_img); } } SJB_DB::query("DELETE FROM uploaded_files WHERE id = ?s", $file_id); }