예제 #1
0
파일: config.php 프로젝트: vazahat/dudex
 /**
  * Returns an instance of class (singleton pattern implementation).
  *
  * @return OW_Config
  */
 public static function getInstance()
 {
     if (self::$classInstance === null) {
         self::$classInstance = new self();
     }
     return self::$classInstance;
 }
예제 #2
0
파일: ow.php 프로젝트: hardikamutech/hammu
 /**
  * Returns global config object.
  *
  * @return OW_Config
  */
 public static function getConfig()
 {
     return OW_Config::getInstance();
 }
예제 #3
0
 /**
  * Updates config value.
  *
  * @param string $key
  * @param string $name
  * @param mixed $value
  */
 public function saveConfig($key, $name, $value)
 {
     $this->configManager->saveConfig($key, $name, $value);
 }
예제 #4
0
파일: settings.php 프로젝트: ZyXelP/oxwall
 public function user()
 {
     if (!OW::getRequest()->isAjax()) {
         OW::getNavigation()->activateMenuItem(OW_Navigation::ADMIN_SETTINGS, 'admin', 'sidebar_menu_item_user_settings');
     }
     $language = OW::getLanguage();
     $avatarService = BOL_AvatarService::getInstance();
     if (isset($_GET['del-avatar']) && in_array($_GET['del-avatar'], array(1, 2))) {
         $del = $avatarService->deleteCustomDefaultAvatar((int) $_GET['del-avatar']);
         if ($del) {
             OW::getFeedback()->info($language->text('admin', 'default_avatar_deleted'));
         }
         $this->redirect(OW::getRouter()->urlForRoute('admin_settings_user'));
     }
     $uploadMaxFilesize = (double) ini_get("upload_max_filesize");
     $postMaxSize = (double) ini_get("post_max_size");
     $maxUploadMaxFilesize = BOL_FileService::getInstance()->getUploadMaxFilesize();
     $this->assign('maxUploadMaxFilesize', $maxUploadMaxFilesize);
     $userSettingsForm = new UserSettingsForm($maxUploadMaxFilesize);
     $this->addForm($userSettingsForm);
     $conf = OW::getConfig();
     $avatarSize = $conf->getValue('base', 'avatar_size');
     $bigAvatarSize = $conf->getValue('base', 'avatar_big_size');
     $avatarUploadSize = $conf->getValue('base', 'avatar_max_upload_size');
     $userSettingsForm->getElement('avatar_max_upload_size')->setValue((double) $avatarUploadSize);
     $userSettingsForm->getElement('avatarSize')->setValue($avatarSize);
     $userSettingsForm->getElement('bigAvatarSize')->setValue($bigAvatarSize);
     $userSettingsForm->getElement('displayName')->setValue($conf->getValue('base', 'display_name_question'));
     // privacy
     $userSettingsForm->getElement('who_can_join')->setValue($conf->getValue('base', 'who_can_join'));
     $userSettingsForm->getElement('who_can_invite')->setValue($conf->getValue('base', 'who_can_invite'));
     $userSettingsForm->getElement('guests_can_view')->setValue($conf->getValue('base', 'guests_can_view'));
     $userSettingsForm->getElement('user_approve')->setValue($conf->getValue('base', 'mandatory_user_approve'));
     // profile questions
     $userSettingsForm->getElement('user_view_presentation')->setValue(OW::getConfig()->getValue('base', 'user_view_presentation') == 'tabs');
     $this->assign('displayConfirmEmail', !defined('OW_PLUGIN_XP'));
     if (OW::getRequest()->isPost() && $userSettingsForm->isValid($_POST)) {
         if (!empty($_FILES['avatar']['tmp_name']) && !UTIL_File::validateImage($_FILES['avatar']['name']) || !empty($_FILES['bigAvatar']['tmp_name']) && !UTIL_File::validateImage($_FILES['bigAvatar']['name'])) {
             OW::getFeedback()->error($language->text('base', 'not_valid_image'));
             $this->redirect();
         }
         $values = $userSettingsForm->getValues();
         $guestPassword = OW_Config::getInstance()->getValue('base', 'guests_can_view_password');
         if ((int) $values['guests_can_view'] === 3 && empty($values['password']) && is_null($guestPassword)) {
             OW::getFeedback()->error($language->text('admin', 'permission_global_privacy_empty_pass_error_message'));
             $this->redirect();
         } else {
             if ((int) $values['guests_can_view'] === 3 && strlen(trim($values['password'])) < 4 && strlen(trim($values['password'])) > 0) {
                 OW::getFeedback()->error($language->text('admin', 'permission_global_privacy_pass_length_error_message'));
                 $this->redirect();
             }
         }
         $res = $userSettingsForm->process();
         OW::getFeedback()->info($language->text('admin', 'user_settings_updated'));
         $this->redirect();
     }
     $avatar = $avatarService->getDefaultAvatarUrl(1);
     $avatarBig = $avatarService->getDefaultAvatarUrl(2);
     $this->assign('avatar', $avatar);
     $this->assign('avatarBig', $avatarBig);
     $custom = json_decode($conf->getValue('base', 'default_avatar'), true);
     $this->assign('customAvatar', $custom);
     $language->addKeyForJs('admin', 'confirm_avatar_delete');
     if (!OW::getRequest()->isAjax()) {
         OW::getDocument()->setHeading(OW::getLanguage()->text('admin', 'heading_user_settings'));
         OW::getDocument()->setHeadingIconClass('ow_ic_gear_wheel');
     }
     OW::getNavigation()->deactivateMenuItems(OW_Navigation::ADMIN_SETTINGS);
 }