Example #1
0
 public function index()
 {
     $language = OW::getLanguage();
     $billingService = BOL_BillingService::getInstance();
     $adminForm = new Form('adminForm');
     $element = new TextField('creditValue');
     $element->setRequired(true);
     $element->setLabel($language->text('billingcredits', 'admin_usd_credit_value'));
     $element->setDescription($language->text('billingcredits', 'admin_usd_credit_value_desc'));
     $element->setValue($billingService->getGatewayConfigValue('billingcredits', 'creditValue'));
     $validator = new FloatValidator(0.1);
     $validator->setErrorMessage($language->text('billingcredits', 'invalid_numeric_format'));
     $element->addValidator($validator);
     $adminForm->addElement($element);
     $element = new Submit('saveSettings');
     $element->setValue($language->text('billingcredits', 'admin_save_settings'));
     $adminForm->addElement($element);
     if (OW::getRequest()->isPost()) {
         if ($adminForm->isValid($_POST)) {
             $values = $adminForm->getValues();
             $billingService->setGatewayConfigValue('billingcredits', 'creditValue', $values['creditValue']);
             OW::getFeedback()->info($language->text('billingcredits', 'user_save_success'));
         }
     }
     $this->addForm($adminForm);
     $this->setPageHeading(OW::getLanguage()->text('billingcredits', 'config_page_heading'));
     $this->setPageTitle(OW::getLanguage()->text('billingcredits', 'config_page_heading'));
     $this->setPageHeadingIconClass('ow_ic_app');
 }
Example #2
0
 public function edit($params)
 {
     if (!isset($params['id']) || !($id = (int) $params['id'])) {
         throw new Redirect404Exception();
         return;
     }
     $language = OW::getLanguage();
     $config = OW::getConfig();
     $sponsor = SPONSORS_BOL_Service::getInstance()->findSponsorById($id);
     if (!$sponsor->id) {
         throw new Redirect404Exception();
         return;
     }
     $sponsorForm = new Form('sponsorForm');
     $sponsorForm->setEnctype('multipart/form-data');
     $element = new TextField('sponsorName');
     $element->setRequired(true);
     $element->setLabel($language->text('sponsors', 'sponsor_name'));
     $element->setInvitation($language->text('sponsors', 'sponsor_name_desc'));
     $element->setValue($sponsor->name);
     $element->setHasInvitation(true);
     $sponsorForm->addElement($element);
     $element = new TextField('sponsorEmail');
     $element->setRequired(true);
     $validator = new EmailValidator();
     $validator->setErrorMessage($language->text('sponsors', 'invalid_email_format'));
     $element->addValidator($validator);
     $element->setLabel($language->text('sponsors', 'sponsor_email'));
     $element->setInvitation($language->text('sponsors', 'sponsor_email_desc'));
     $element->setValue($sponsor->email);
     $element->setHasInvitation(true);
     $sponsorForm->addElement($element);
     $element = new TextField('sponsorWebsite');
     $element->setRequired(true);
     $validator = new UrlValidator();
     $validator->setErrorMessage($language->text('sponsors', 'invalid_url_format'));
     $element->addValidator($validator);
     $element->setLabel($language->text('sponsors', 'sponsor_website'));
     $element->setInvitation($language->text('sponsors', 'sponsor_website_desc'));
     $element->setHasInvitation(true);
     $element->setValue($sponsor->website);
     $sponsorForm->addElement($element);
     $element = new TextField('sponsorAmount');
     $element->setRequired(true);
     $minAmount = $config->getValue('sponsors', 'minimumPayment');
     $validator = new FloatValidator(0);
     $validator->setErrorMessage($language->text('sponsors', 'invalid_amount_value'));
     $element->addValidator($validator);
     $element->setLabel($language->text('sponsors', 'sponsor_payment_amount'));
     $element->setInvitation($language->text('sponsors', 'admin_payment_amount_desc'));
     $element->setHasInvitation(true);
     $element->setValue($sponsor->price);
     $sponsorForm->addElement($element);
     $element = new TextField('sponsorValidity');
     $element->setRequired(true);
     $element->setValue($sponsor->validity);
     $validator = new IntValidator(0);
     $validator->setErrorMessage($language->text('sponsors', 'invalid_numeric_format'));
     $element->addValidator($validator);
     $element->setLabel($language->text('sponsors', 'sponsorship_validatity'));
     $element->setInvitation($language->text('sponsors', 'sponsorship_validatity_desc'));
     $element->setHasInvitation(true);
     $sponsorForm->addElement($element);
     $element = new FileField('sponsorImage');
     $element->setLabel($language->text('sponsors', 'sponsorsh_image_file'));
     $sponsorForm->addElement($element);
     $element = new Submit('editSponsor');
     $element->setValue(OW::getLanguage()->text('sponsors', 'edit_sponsor_btn'));
     $sponsorForm->addElement($element);
     if (OW::getRequest()->isPost()) {
         if ($sponsorForm->isValid($_POST)) {
             $values = $sponsorForm->getValues();
             $allowedImageExtensions = array('jpg', 'jpeg', 'gif', 'png', 'tiff');
             $sponsorImageFile = "";
             if (isset($_FILES['sponsorImage']) && in_array(UTIL_File::getExtension($_FILES['sponsorImage']['name']), $allowedImageExtensions)) {
                 $backupPath = OW::getPluginManager()->getPlugin('sponsors')->getUserFilesDir() . $_FILES['sponsorImage']['name'];
                 move_uploaded_file($_FILES['sponsorImage']['tmp_name'], $backupPath);
                 $sponsorImageFile = $_FILES['sponsorImage']['name'];
             }
             $sponsor->name = $values['sponsorName'];
             $sponsor->email = $values['sponsorEmail'];
             $sponsor->website = $values['sponsorWebsite'];
             $sponsor->price = $values['sponsorAmount'];
             if (!empty($sponsorImageFile)) {
                 $sponsor->image = $sponsorImageFile;
             }
             $sponsor->userId = $sponsor->userId;
             $sponsor->status = $sponsor->status;
             $sponsor->validity = $values['sponsorValidity'];
             if (SPONSORS_BOL_Service::getInstance()->addSponsor($sponsor)) {
                 OW::getFeedback()->info(OW::getLanguage()->text('sponsors', 'sponsor_edit_ok'));
             } else {
                 OW::getFeedback()->error(OW::getLanguage()->text('sponsors', 'sponsor_edit_error'));
             }
         }
     }
     $this->addForm($sponsorForm);
     $fields = array();
     foreach ($sponsorForm->getElements() as $element) {
         if (!$element instanceof HiddenField) {
             $fields[$element->getName()] = $element->getName();
         }
     }
     $this->assign('formData', $fields);
     $this->assign('currentLogoImage', OW::getPluginManager()->getPlugin('sponsors')->getUserFilesUrl() . $sponsor->image);
     $this->setPageHeading(OW::getLanguage()->text('sponsors', 'edit_sponsor_heading'));
     $this->setPageTitle(OW::getLanguage()->text('sponsors', 'edit_sponsor_heading'));
     $this->setPageHeadingIconClass('ow_ic_edit');
 }
Example #3
0
 public function __construct()
 {
     parent::__construct('configSaveForm');
     $language = OW::getLanguage();
     $acceptedFilesizeField = new TextField('acceptedFilesize');
     $acceptedFilesizeField->setRequired(true);
     $sValidator = new FloatValidator(0.5, PHOTO_BOL_PhotoService::getInstance()->getMaxUploadFileSize());
     $sValidator->setErrorMessage($language->text('photo', 'file_size_validation_error'));
     $acceptedFilesizeField->addValidator($sValidator);
     $this->addElement($acceptedFilesizeField->setLabel($language->text('photo', 'accepted_filesize')));
     $albumQuotaField = new TextField('albumQuota');
     $albumQuotaField->setRequired(true);
     $aqValidator = new IntValidator(0, 1000);
     $albumQuotaField->addValidator($aqValidator);
     $this->addElement($albumQuotaField->setLabel($language->text('photo', 'album_quota')));
     $userQuotaField = new TextField('userQuota');
     $userQuotaField->setRequired(true);
     $uqValidator = new IntValidator(0, 10000);
     $userQuotaField->addValidator($uqValidator);
     $this->addElement($userQuotaField->setLabel($language->text('photo', 'user_quota')));
     $downloadAccept = new CheckboxField('downloadAccept');
     $downloadAccept->setLabel($language->text('photo', 'download_accept_label'));
     $downloadAccept->setValue(OW::getConfig()->getValue('photo', 'download_accept'));
     $this->addElement($downloadAccept);
     $storeFullsizeField = new CheckboxField('storeFullsize');
     $storeFullsizeField->setLabel($language->text('photo', 'store_full_size'));
     $storeFullsizeField->setValue((bool) OW::getConfig()->getValue('photo', 'store_fullsize'));
     $this->addElement($storeFullsizeField);
     $submit = new Submit('save');
     $submit->setValue($language->text('photo', 'btn_edit'));
     $this->addElement($submit);
 }
Example #4
0
 /**
  * Class constructor
  *
  */
 public function __construct()
 {
     parent::__construct('configSaveForm');
     $language = OW::getLanguage();
     // accepted file size Field
     $acceptedFilesizeField = new TextField('acceptedFilesize');
     $acceptedFilesizeField->setRequired(true);
     $sValidator = new FloatValidator();
     $max = intval(ini_get('upload_max_filesize')) ? intval(ini_get('upload_max_filesize')) : 2;
     $sValidator->setMaxValue($max);
     $sValidator->setErrorMessage($language->text('photo', 'file_size_validation_error'));
     $acceptedFilesizeField->addValidator($sValidator);
     $this->addElement($acceptedFilesizeField->setLabel($language->text('photo', 'accepted_filesize')));
     // main image width Field
     $mainWidthField = new TextField('mainWidth');
     $mainWidthField->setRequired(true);
     $mwValidator = new IntValidator(100, 1000);
     $mwValidator->setErrorMessage($language->text('photo', 'width_validation_error', array('min' => 100, 'max' => 1000)));
     $mainWidthField->addValidator($mwValidator);
     $this->addElement($mainWidthField);
     // main image height Field
     $mainHeightField = new TextField('mainHeight');
     $mainHeightField->setRequired(true);
     $mhValidator = new IntValidator(100, 1000);
     $mhValidator->setErrorMessage($language->text('photo', 'height_validation_error', array('min' => 100, 'max' => 1000)));
     $mainHeightField->addValidator($mhValidator);
     $this->addElement($mainHeightField);
     // preview image width Field
     $previewWidthField = new TextField('previewWidth');
     $previewWidthField->setRequired(true);
     $pwValidator = new IntValidator(50, 300);
     $pwValidator->setErrorMessage($language->text('photo', 'width_validation_error', array('min' => 50, 'max' => 300)));
     $previewWidthField->addValidator($pwValidator);
     $this->addElement($previewWidthField);
     // preview image height Field
     $previewHeightField = new TextField('previewHeight');
     $previewHeightField->setRequired(true);
     $phValidator = new IntValidator(50, 300);
     $phValidator->setErrorMessage($language->text('photo', 'height_validation_error', array('min' => 50, 'max' => 300)));
     $previewHeightField->addValidator($phValidator);
     $this->addElement($previewHeightField);
     // per page Field
     $perPageField = new TextField('perPage');
     $perPageField->setRequired(true);
     $pValidator = new IntValidator(1, 100);
     $perPageField->addValidator($pValidator);
     $this->addElement($perPageField->setLabel($language->text('photo', 'per_page')));
     // album quota Field
     $albumQuotaField = new TextField('albumQuota');
     $albumQuotaField->setRequired(true);
     $aqValidator = new IntValidator(0, 1000);
     $albumQuotaField->addValidator($aqValidator);
     $this->addElement($albumQuotaField->setLabel($language->text('photo', 'album_quota')));
     // user quota Field
     $userQuotaField = new TextField('userQuota');
     $userQuotaField->setRequired(true);
     $uqValidator = new IntValidator(0, 10000);
     $userQuotaField->addValidator($uqValidator);
     $this->addElement($userQuotaField->setLabel($language->text('photo', 'user_quota')));
     $storeFullsizeField = new CheckboxField('storeFullsize');
     $storeFullsizeField->setLabel($language->text('photo', 'store_full_size'));
     $this->addElement($storeFullsizeField);
     $fullsizeRes = new TextField('fullsizeResolution');
     $frValidator = new IntValidator();
     $frValidator->setMinValue(100);
     $fullsizeRes->addValidator($frValidator);
     $fullsizeRes->setLabel($language->text('photo', 'fullsize_resolution'));
     $this->addElement($fullsizeRes);
     $advancedUploadField = new CheckboxField('advancedUpload');
     $advancedUploadField->setLabel($language->text('photo', 'enable_advanced_upload'));
     $this->addElement($advancedUploadField);
     $js = UTIL_JsGenerator::composeJsString('$(window.owForms.configSaveForm.getElement("storeFullsize").input).click(function(){
             if ( !this.checked ) {
                 $("#delete-fullsize-btn-node").css("display", "inline");
                 $("#fullsize_res_config").css("display", "none");
             }
             else {
                 $("#delete-fullsize-btn-node").css("display", "none");
                 $("#fullsize_res_config").css("display", "table-row");
             }
         })', array('confMsg' => $language->text('photo', 'store_fullsize_confirm')));
     OW::getDocument()->addOnloadScript($js);
     // submit
     $submit = new Submit('save');
     $submit->setValue($language->text('photo', 'btn_edit'));
     $this->addElement($submit);
 }
Example #5
0
 /**
  * Class constructor
  *
  */
 public function __construct($maxUploadFileSize)
 {
     parent::__construct('configSaveForm');
     $language = OW::getLanguage();
     $configs = OW::getConfig()->getValues('mailbox');
     $element = new CheckboxField('enableAttachments');
     $element->setValue($configs['enable_attachments']);
     $this->addElement($element);
     $element = new TextField('uploadMaxFileSize');
     $element->addAttribute('style', 'width:30px');
     /* if ( !$configs['enable_attachments'] )
        {
            $element->addAttribute('disabled', 'disabled');
        } */
     $validator = new FloatValidator(0, $maxUploadFileSize);
     $validator->setErrorMessage($language->text('admin', 'settings_max_upload_size_error'));
     $element->addValidator($validator);
     $element->setValue((double) $configs['upload_max_file_size']);
     $this->addElement($element);
     // submit
     $submit = new Submit('save');
     $submit->setValue($language->text('base', 'edit_button'));
     $this->addElement($submit);
 }
Example #6
0
 /**
  * Class constructor
  *
  */
 public function __construct()
 {
     parent::__construct('configSaveForm');
     $language = OW::getLanguage();
     $attachEnableField = new CheckboxField('enableAttachments');
     $this->addElement($attachEnableField);
     // attachment file size Field
     $filesizeField = new TextField('attachmentFilesize');
     $filesizeField->setRequired(true);
     $sValidator = new FloatValidator();
     $max = intval(ini_get('upload_max_filesize')) ? intval(ini_get('upload_max_filesize')) : 2;
     $sValidator->setMaxValue($max);
     $sValidator->setErrorMessage($language->text('forum', 'file_size_validation_error'));
     $filesizeField->addValidator($sValidator);
     $filesizeField->setLabel($language->text('forum', 'attachment_filesize'));
     $this->addElement($filesizeField);
     // submit
     $submit = new Submit('save');
     $submit->setValue($language->text('base', 'edit_button'));
     $this->addElement($submit);
 }
Example #7
0
 /**
  * Class constructor
  *
  */
 public function __construct($maxUploadMaxFilesize)
 {
     parent::__construct('userSettingsForm');
     $this->setEnctype("multipart/form-data");
     $language = OW::getLanguage();
     // avatar size Field
     $avatarSize = new TextField('avatarSize');
     $avatarSize->setRequired(true);
     $validator = new IntValidator(40, 150);
     $validator->setErrorMessage($language->text('admin', 'user_settings_avatar_size_error', array('max' => 150)));
     $avatarSize->addValidator($validator);
     $this->addElement($avatarSize->setLabel($language->text('admin', 'user_settings_avatar_size_label')));
     // big avatar size Field
     $bigAvatarSize = new TextField('bigAvatarSize');
     $bigAvatarSize->setRequired(true);
     $validator = new IntValidator(150, 250);
     $validator->setErrorMessage($language->text('admin', 'user_settings_big_avatar_size_error', array('max' => 250)));
     $bigAvatarSize->addValidator($validator);
     $this->addElement($bigAvatarSize->setLabel($language->text('admin', 'user_settings_big_avatar_size_label')));
     // --- avatar max size
     $maxUploadMaxFilesizeValidator = new FloatValidator(0, $maxUploadMaxFilesize);
     $maxUploadMaxFilesizeValidator->setErrorMessage($language->text('admin', 'settings_max_upload_size_error'));
     $avatarMaxUploadSize = new TextField('avatar_max_upload_size');
     $avatarMaxUploadSize->setLabel($language->text('admin', 'input_settings_avatar_max_upload_size_label'));
     $avatarMaxUploadSize->addValidator($maxUploadMaxFilesizeValidator);
     $this->addElement($avatarMaxUploadSize);
     // --- avatar max size
     if (!defined('OW_PLUGIN_XP')) {
         // confirm Email
         $confirmEmail = new CheckboxField('confirmEmail');
         $confirmEmail->setValue(OW::getConfig()->getValue('base', 'confirm_email'));
         $this->addElement($confirmEmail->setLabel($language->text('admin', 'user_settings_confirm_email')));
     }
     // display name Field
     $displayNameField = new Selectbox('displayName');
     $displayNameField->setRequired(true);
     $questions = array('username' => $language->text('base', 'questions_question_username_label'), 'realname' => $language->text('base', 'questions_question_realname_label'));
     $displayNameField->setHasInvitation(false);
     $displayNameField->setOptions($questions);
     $this->addElement($displayNameField->setLabel($language->text('admin', 'user_settings_display_name')));
     $avatar = new FileField('avatar');
     $this->addElement($avatar);
     $bigAvatar = new FileField('bigAvatar');
     $this->addElement($bigAvatar);
     // --
     $joinConfigField = new Selectbox('join_display_photo_upload');
     $options = array(BOL_UserService::CONFIG_JOIN_DISPLAY_PHOTO_UPLOAD => $language->text('base', 'config_join_display_photo_upload_display_label'), BOL_UserService::CONFIG_JOIN_DISPLAY_AND_SET_REQUIRED_PHOTO_UPLOAD => $language->text('base', 'config_join_display_photo_upload_display_and_require_label'), BOL_UserService::CONFIG_JOIN_NOT_DISPLAY_PHOTO_UPLOAD => $language->text('base', 'config_join_display_photo_upload_not_display_label'));
     $joinConfigField->addOptions($options);
     $joinConfigField->setHasInvitation(false);
     $joinConfigField->setValue(OW::getConfig()->getValue('base', 'join_display_photo_upload'));
     $this->addElement($joinConfigField);
     // --
     $joinConfigField = new CheckboxField('join_display_terms_of_use');
     $joinConfigField->setValue(OW::getConfig()->getValue('base', 'join_display_terms_of_use'));
     $this->addElement($joinConfigField);
     // submit
     $submit = new Submit('save');
     $submit->setValue($language->text('admin', 'save_btn_label'));
     $this->addElement($submit);
 }
Example #8
0
 /**
  * Class constructor
  *
  */
 public function __construct($maxUploadMaxFilesize)
 {
     parent::__construct('userSettingsForm');
     $this->setEnctype("multipart/form-data");
     $language = OW::getLanguage();
     // avatar size Field
     $avatarSize = new TextField('avatarSize');
     $avatarSize->setRequired(true);
     $validator = new IntValidator(40, 150);
     $validator->setErrorMessage($language->text('admin', 'user_settings_avatar_size_error', array('max' => 150)));
     $avatarSize->addValidator($validator);
     $this->addElement($avatarSize->setLabel($language->text('admin', 'user_settings_avatar_size_label')));
     // big avatar size Field
     $bigAvatarSize = new TextField('bigAvatarSize');
     $bigAvatarSize->setRequired(true);
     $validator = new IntValidator(150, 250);
     $validator->setErrorMessage($language->text('admin', 'user_settings_big_avatar_size_error', array('max' => 250)));
     $bigAvatarSize->addValidator($validator);
     $this->addElement($bigAvatarSize->setLabel($language->text('admin', 'user_settings_big_avatar_size_label')));
     // --- avatar max size
     $maxUploadMaxFilesizeValidator = new FloatValidator(0, $maxUploadMaxFilesize);
     $maxUploadMaxFilesizeValidator->setErrorMessage($language->text('admin', 'settings_max_upload_size_error'));
     $avatarMaxUploadSize = new TextField('avatar_max_upload_size');
     $avatarMaxUploadSize->setLabel($language->text('admin', 'input_settings_avatar_max_upload_size_label'));
     $avatarMaxUploadSize->addValidator($maxUploadMaxFilesizeValidator);
     $this->addElement($avatarMaxUploadSize);
     // --- avatar max size
     if (!defined('OW_PLUGIN_XP')) {
         // confirm Email
         $confirmEmail = new CheckboxField('confirmEmail');
         $confirmEmail->setValue(OW::getConfig()->getValue('base', 'confirm_email'));
         $this->addElement($confirmEmail->setLabel($language->text('admin', 'user_settings_confirm_email')));
     }
     // display name Field
     $displayNameField = new Selectbox('displayName');
     $displayNameField->setRequired(true);
     $questions = array('username' => $language->text('base', 'questions_question_username_label'), 'realname' => $language->text('base', 'questions_question_realname_label'));
     $displayNameField->setHasInvitation(false);
     $displayNameField->setOptions($questions);
     $this->addElement($displayNameField->setLabel($language->text('admin', 'user_settings_display_name')));
     $avatar = new FileField('avatar');
     $this->addElement($avatar);
     $bigAvatar = new FileField('bigAvatar');
     $this->addElement($bigAvatar);
     // --
     $joinConfigField = new Selectbox('join_display_photo_upload');
     $options = array(BOL_UserService::CONFIG_JOIN_DISPLAY_PHOTO_UPLOAD => $language->text('base', 'config_join_display_photo_upload_display_label'), BOL_UserService::CONFIG_JOIN_DISPLAY_AND_SET_REQUIRED_PHOTO_UPLOAD => $language->text('base', 'config_join_display_photo_upload_display_and_require_label'), BOL_UserService::CONFIG_JOIN_NOT_DISPLAY_PHOTO_UPLOAD => $language->text('base', 'config_join_display_photo_upload_not_display_label'));
     $joinConfigField->addOptions($options);
     $joinConfigField->setHasInvitation(false);
     $joinConfigField->setValue(OW::getConfig()->getValue('base', 'join_display_photo_upload'));
     $this->addElement($joinConfigField);
     // --
     $joinConfigField = new CheckboxField('join_display_terms_of_use');
     $joinConfigField->setValue(OW::getConfig()->getValue('base', 'join_display_terms_of_use'));
     $this->addElement($joinConfigField);
     //--- privacy -----///
     $config = OW::getConfig();
     $baseConfigs = $config->getValues('base');
     $userApprove = new CheckboxField('user_approve');
     $userApprove->setLabel($language->text('admin', 'permissions_index_user_approve'));
     $this->addElement($userApprove);
     $whoCanJoin = new RadioField('who_can_join');
     $whoCanJoin->addOptions(array('1' => $language->text('admin', 'permissions_index_anyone_can_join'), '2' => $language->text('admin', 'permissions_index_by_invitation_only_can_join')));
     $whoCanJoin->setLabel($language->text('admin', 'permissions_index_who_can_join'));
     $this->addElement($whoCanJoin);
     $whoCanInvite = new RadioField('who_can_invite');
     $whoCanInvite->addOptions(array('1' => $language->text('admin', 'permissions_index_all_users_can_invate'), '2' => $language->text('admin', 'permissions_index_admin_only_can_invate')));
     $whoCanInvite->setLabel($language->text('admin', 'permissions_index_who_can_invite'));
     $this->addElement($whoCanInvite);
     $guestsCanView = new RadioField('guests_can_view');
     $guestsCanView->addOptions(array('1' => $language->text('admin', 'permissions_index_yes'), '2' => $language->text('admin', 'permissions_index_no'), '3' => $language->text('admin', 'permissions_index_with_password')));
     $guestsCanView->setLabel($language->text('admin', 'permissions_index_guests_can_view_site'));
     $guestsCanView->setDescription($language->text('admin', 'permissions_idex_if_not_yes_will_override_settings'));
     $this->addElement($guestsCanView);
     $password = new TextField('password');
     $password->setHasInvitation(true);
     if ($baseConfigs['guests_can_view'] == 3) {
         $password->setInvitation($language->text('admin', 'change_password'));
     } else {
         $password->setInvitation($language->text('admin', 'add_password'));
     }
     $this->addElement($password);
     // --- //
     //-- profile questions --//
     $userViewPresentationnew = new CheckboxField("user_view_presentation");
     $userViewPresentationnew->setLabel($language->text('base', 'questions_config_user_view_presentation_label'));
     $userViewPresentationnew->setDescription($language->text('base', 'questions_config_user_view_presentation_description'));
     $this->addElement($userViewPresentationnew);
     // --- //
     // submit
     $submit = new Submit('save');
     $submit->setValue($language->text('admin', 'save_btn_label'));
     $this->addElement($submit);
 }
Example #9
0
 public function userInput()
 {
     if (!OW::getRequest()->isAjax()) {
         OW::getNavigation()->activateMenuItem(OW_Navigation::ADMIN_SETTINGS, 'admin', 'sidebar_menu_item_user_settings');
     }
     $language = OW::getLanguage();
     $config = OW::getConfig();
     $menu = $this->getUsersMenu();
     $menu->getElement('content_input')->setActive(true);
     $this->addComponent('menu', $menu);
     $settingsForm = new Form('input_settings');
     $userCustomHtml = new CheckboxField('user_custom_html');
     $userCustomHtml->setLabel($language->text('admin', 'input_settings_user_custom_html_disable_label'));
     $userCustomHtml->setDescription($language->text('admin', 'input_settings_user_custom_html_disable_desc'));
     $settingsForm->addElement($userCustomHtml);
     $userRichMedia = new CheckboxField('user_rich_media');
     $userRichMedia->setLabel($language->text('admin', 'input_settings_user_rich_media_disable_label'));
     $userRichMedia->setDescription($language->text('admin', 'input_settings_user_rich_media_disable_desc'));
     $settingsForm->addElement($userRichMedia);
     $commentsRichMedia = new CheckboxField('comments_rich_media');
     $commentsRichMedia->setLabel($language->text('admin', 'input_settings_comments_rich_media_disable_label'));
     $commentsRichMedia->setDescription($language->text('admin', 'input_settings_comments_rich_media_disable_desc'));
     $settingsForm->addElement($commentsRichMedia);
     $allowPhotoUpload = new CheckboxField('allow_photo_upload');
     $allowPhotoUpload->setLabel($language->text('admin', 'input_settings_allow_photo_upload_label'));
     $settingsForm->addElement($allowPhotoUpload);
     $uploadMaxFilesize = (double) ini_get("upload_max_filesize");
     $postMaxSize = (double) ini_get("post_max_size");
     $maxUploadMaxFilesize = $uploadMaxFilesize >= $postMaxSize ? $postMaxSize : $uploadMaxFilesize;
     $this->assign('maxUploadMaxFilesize', $maxUploadMaxFilesize);
     $maxUploadMaxFilesizeValidator = new FloatValidator(0, $maxUploadMaxFilesize);
     $maxUploadMaxFilesizeValidator->setErrorMessage($language->text('admin', 'settings_max_upload_size_error'));
     $maxUploadSize = new TextField('max_upload_size');
     $maxUploadSize->setLabel($language->text('admin', 'input_settings_max_upload_size_label'));
     $maxUploadSize->addValidator($maxUploadMaxFilesizeValidator);
     $settingsForm->addElement($maxUploadSize);
     $resourceList = new Textarea('resource_list');
     $resourceList->setLabel($language->text('admin', 'input_settings_resource_list_label'));
     $resourceList->setDescription($language->text('admin', 'input_settings_resource_list_desc'));
     $settingsForm->addElement($resourceList);
     $submit = new Submit('save');
     $submit->setValue('Save');
     $settingsForm->addElement($submit);
     $this->addForm($settingsForm);
     if (OW::getRequest()->isPost()) {
         if ($settingsForm->isValid($_POST)) {
             $data = $settingsForm->getValues();
             $config->saveConfig('base', 'tf_comments_rich_media_disable', (int) $data['comments_rich_media']);
             $config->saveConfig('base', 'tf_user_custom_html_disable', (int) $data['user_custom_html']);
             $config->saveConfig('base', 'tf_user_rich_media_disable', (int) $data['user_rich_media']);
             $config->saveConfig('base', 'tf_allow_pic_upload', (int) $data['allow_photo_upload']);
             $config->saveConfig('base', 'tf_max_pic_size', round((double) $data['max_upload_size'], 2));
             if (!empty($data['resource_list'])) {
                 $res = array_unique(preg_split('/' . PHP_EOL . '/', $data['resource_list']));
                 $config->saveConfig('base', 'tf_resource_list', json_encode(array_map('trim', $res)));
             }
             OW::getFeedback()->info($language->text('admin', 'settings_submit_success_message'));
         } else {
             OW::getFeedback()->error('Error');
         }
         $this->redirect();
     }
     $userCustomHtml->setValue($config->getValue('base', 'tf_user_custom_html_disable'));
     $userRichMedia->setValue($config->getValue('base', 'tf_user_rich_media_disable'));
     $commentsRichMedia->setValue($config->getValue('base', 'tf_comments_rich_media_disable'));
     $maxUploadSize->setValue(round((double) $config->getValue('base', 'tf_max_pic_size'), 2));
     $resourceList->setValue(implode(PHP_EOL, json_decode($config->getValue('base', 'tf_resource_list'))));
     $allowPhotoUpload->setValue($config->getValue('base', 'tf_allow_pic_upload'));
     OW::getDocument()->setHeading(OW::getLanguage()->text('admin', 'heading_user_input_settings'));
     OW::getDocument()->setHeadingIconClass('ow_ic_gear_wheel');
 }
Example #10
0
 public function index()
 {
     $language = OW::getLanguage();
     $config = OW::getConfig();
     $adminForm = new Form('adminForm');
     $element = new TextField('allowedFileSize');
     $element->setRequired(true);
     $element->setValue($config->getValue('ivideo', 'allowedFileSize'));
     $element->setLabel($language->text('ivideo', 'admin_allowed_file_size'));
     $element->setDescription($language->text('ivideo', 'admin_allowed_file_size_desc'));
     $validator = new FloatValidator(1);
     $validator->setErrorMessage($language->text('ivideo', 'admin_invalid_number_error'));
     $element->addValidator($validator);
     $adminForm->addElement($element);
     $element = new Multiselect('allowedExtensions');
     $element->setRequired(true);
     $element->setValue(explode(",", $config->getValue('ivideo', 'allowedExtensions')));
     $element->setLabel($language->text('ivideo', 'admin_allowed_extension'));
     $element->setDescription($language->text('ivideo', 'admin_allowed_extension_desc'));
     $element->addOption('mp4', 'MP4');
     $element->addOption('flv', 'FLV');
     $element->addOption('avi', 'AVI');
     $element->addOption('wmv', 'WMV');
     $element->addOption('swf', 'SWF');
     $element->addOption('mov', 'MOV');
     $element->addOption('mpg', 'MPG');
     $element->addOption('3g2', '3G2');
     $element->addOption('ram', 'RAM');
     $element->setSize(6);
     $adminForm->addElement($element);
     $element = new TextField('videosPerRow');
     $element->setValue($config->getValue('ivideo', 'videosPerRow'));
     $element->setLabel($language->text('ivideo', 'admin_videos_per_row'));
     $element->setDescription($language->text('ivideo', 'admin_videos_per_row_desc'));
     $validator = new IntValidator();
     $validator->setErrorMessage($language->text('ivideo', 'admin_invalid_number_error'));
     $element->addValidator($validator);
     $adminForm->addElement($element);
     $element = new TextField('videoPreviewWidth');
     $element->setValue($config->getValue('ivideo', 'videoPreviewWidth'));
     $element->setLabel($language->text('ivideo', 'admin_video_preview_size'));
     $element->setDescription($language->text('ivideo', 'admin_video_preview_size_desc'));
     $validator = new IntValidator();
     $validator->setErrorMessage($language->text('ivideo', 'admin_invalid_number_error'));
     $element->addValidator($validator);
     $adminForm->addElement($element);
     $element = new TextField('videoPreviewHeight');
     $element->setValue($config->getValue('ivideo', 'videoPreviewHeight'));
     $element->setLabel($language->text('ivideo', 'admin_video_preview_height'));
     $validator = new IntValidator();
     $validator->setErrorMessage($language->text('ivideo', 'admin_invalid_number_error'));
     $element->addValidator($validator);
     $adminForm->addElement($element);
     $element = new TextField('videoWidth');
     $element->setValue($config->getValue('ivideo', 'videoWidth'));
     $element->setLabel($language->text('ivideo', 'admin_video_size'));
     $element->setDescription($language->text('ivideo', 'admin_video_size_desc'));
     $validator = new IntValidator();
     $validator->setErrorMessage($language->text('ivideo', 'admin_invalid_number_error'));
     $element->addValidator($validator);
     $adminForm->addElement($element);
     $element = new TextField('videoHeight');
     $element->setValue($config->getValue('ivideo', 'videoHeight'));
     $element->setLabel($language->text('ivideo', 'admin_video_height'));
     $validator = new IntValidator();
     $validator->setErrorMessage($language->text('ivideo', 'admin_invalid_number_error'));
     $element->addValidator($validator);
     $adminForm->addElement($element);
     $element = new Selectbox('videoApproval');
     $element->setRequired(true);
     $element->setValue($config->getValue('ivideo', 'videoApproval'));
     $element->setLabel($language->text('ivideo', 'admin_video_approval'));
     $element->addOption('auto', $language->text('ivideo', 'auto_approve'));
     $element->addOption('admin', $language->text('ivideo', 'admin_approve'));
     $element->setDescription($language->text('ivideo', 'admin_video_approval_desc'));
     $adminForm->addElement($element);
     $element = new Selectbox('theme');
     $element->setRequired(true);
     $element->setValue($config->getValue('ivideo', 'theme'));
     $element->setLabel($language->text('ivideo', 'admin_video_theme'));
     $element->addOption('baseTheme', $language->text('ivideo', 'baseTheme'));
     $element->addOption('classicTheme', $language->text('ivideo', 'classicTheme'));
     $element->addOption('fancyTheme', $language->text('ivideo', 'fancyTheme'));
     $element->addOption('listTheme', $language->text('ivideo', 'listTheme'));
     $element->setDescription($language->text('ivideo', 'admin_video_theme_desc'));
     $adminForm->addElement($element);
     $element = new TextField('resultsPerPage');
     $element->setRequired(true);
     $element->setLabel($language->text('ivideo', 'admin_results_per_page'));
     $element->setDescription($language->text('ivideo', 'admin_results_per_page_desc'));
     $element->setValue($config->getValue('ivideo', 'resultsPerPage'));
     $adminForm->addElement($element);
     $element = new TextField('ffmpegPath');
     $element->setLabel($language->text('ivideo', 'admin_ffmpeg_path'));
     $element->setDescription($language->text('ivideo', 'admin_ffmpeg_path_desc'));
     $element->setValue($config->getValue('ivideo', 'ffmpegPath'));
     $adminForm->addElement($element);
     $element = new CheckboxField('makeUploaderMain');
     $element->setLabel($language->text('ivideo', 'admin_make_uploader_main'));
     $element->setDescription($language->text('ivideo', 'admin_make_uploader_main_desc'));
     $element->setValue($config->getValue('ivideo', 'makeUploaderMain'));
     $adminForm->addElement($element);
     $element = new Submit('saveSettings');
     $element->setValue(OW::getLanguage()->text('ivideo', 'admin_save_settings'));
     $adminForm->addElement($element);
     if (OW::getRequest()->isPost()) {
         if ($adminForm->isValid($_POST)) {
             $values = $adminForm->getValues();
             $config->saveConfig('ivideo', 'allowedFileSize', $values['allowedFileSize']);
             $config->saveConfig('ivideo', 'allowedExtensions', implode(",", $values['allowedExtensions']));
             $config->saveConfig('ivideo', 'videoWidth', $values['videoWidth']);
             $config->saveConfig('ivideo', 'videoHeight', $values['videoHeight']);
             $config->saveConfig('ivideo', 'videoPreviewWidth', $values['videoPreviewWidth']);
             $config->saveConfig('ivideo', 'videoPreviewHeight', $values['videoPreviewHeight']);
             $config->saveConfig('ivideo', 'resultsPerPage', $values['resultsPerPage']);
             $config->saveConfig('ivideo', 'videoApproval', $values['videoApproval']);
             $config->saveConfig('ivideo', 'theme', $values['theme']);
             $config->saveConfig('ivideo', 'videosPerRow', $values['videosPerRow']);
             $config->saveConfig('ivideo', 'makeUploaderMain', $values['makeUploaderMain']);
             $config->saveConfig('ivideo', 'ffmpegPath', $values['ffmpegPath']);
             OW::getFeedback()->info($language->text('ivideo', 'user_save_success'));
         }
     }
     $this->addForm($adminForm);
 }
Example #11
0
 public function sponsor()
 {
     $language = OW::getLanguage();
     $config = OW::getConfig();
     $sponsorForm = new Form('sponsorForm');
     $sponsorForm->setEnctype('multipart/form-data');
     $element = new TextField('sponsorName');
     $element->setRequired(true);
     $element->setLabel($language->text('sponsors', 'sponsor_name'));
     $element->setInvitation($language->text('sponsors', 'sponsor_name_desc'));
     $element->setHasInvitation(true);
     $sponsorForm->addElement($element);
     $element = new TextField('sponsorEmail');
     $element->setRequired(true);
     $validator = new EmailValidator();
     $validator->setErrorMessage($language->text('sponsors', 'invalid_email_format'));
     $element->addValidator($validator);
     $element->setLabel($language->text('sponsors', 'sponsor_email'));
     $element->setInvitation($language->text('sponsors', 'sponsor_email_desc'));
     $element->setHasInvitation(true);
     $sponsorForm->addElement($element);
     $element = new TextField('sponsorWebsite');
     $element->setRequired(true);
     $validator = new UrlValidator();
     $validator->setErrorMessage($language->text('sponsors', 'invalid_url_format'));
     $element->addValidator($validator);
     $element->setLabel($language->text('sponsors', 'sponsor_website'));
     $element->setInvitation($language->text('sponsors', 'sponsor_website_desc'));
     $element->setHasInvitation(true);
     $sponsorForm->addElement($element);
     if ($config->getValue('sponsors', 'minimumPayment') > 0) {
         $element = new TextField('sponsorAmount');
         $element->setRequired(true);
         $element->setValue($config->getValue('sponsors', 'minimumPayment'));
         $minAmount = $config->getValue('sponsors', 'minimumPayment');
         $validator = new FloatValidator($minAmount);
         $validator->setErrorMessage($language->text('sponsors', 'invalid_sponsor_amount', array('minAmount' => $minAmount)));
         $element->addValidator($validator);
         $element->setLabel($language->text('sponsors', 'sponsor_payment_amount'));
         $element->setInvitation($language->text('sponsors', 'sponsor_payment_amount_desc', array('minAmount' => $minAmount)));
         $element->setHasInvitation(true);
         $sponsorForm->addElement($element);
     }
     $element = new FileField('sponsorImage');
     $element->setLabel($language->text('sponsors', 'sponsorsh_image_file'));
     $sponsorForm->addElement($element);
     if ($config->getValue('sponsors', 'minimumPayment') > 0) {
         $element = new BillingGatewaySelectionField('gateway');
         $element->setRequired(true);
         $element->setLabel($language->text('sponsors', 'payment_gatway_selection'));
         $sponsorForm->addElement($element);
     }
     $element = new Submit('becomeSponsor');
     $element->setValue(OW::getLanguage()->text('sponsors', 'become_sponsor_btn'));
     $sponsorForm->addElement($element);
     if (OW::getRequest()->isPost()) {
         if ($sponsorForm->isValid($_POST)) {
             $values = $sponsorForm->getValues();
             if (isset($_FILES['sponsorImage']) && in_array(UTIL_File::getExtension($_FILES['sponsorImage']['name']), $this->allowedImageExtensions)) {
                 $backupPath = OW::getPluginManager()->getPlugin('sponsors')->getUserFilesDir() . $_FILES['sponsorImage']['name'];
                 move_uploaded_file($_FILES['sponsorImage']['tmp_name'], $backupPath);
                 $sponsorImageFile = $_FILES['sponsorImage']['name'];
             } else {
                 $sponsorImageFile = "defaultSponsor.jpg";
             }
             if (isset($values['sponsorAmount']) && $values['gateway']) {
                 $billingService = BOL_BillingService::getInstance();
                 if (empty($values['gateway']['url']) || empty($values['gateway']['key']) || !($gateway = $billingService->findGatewayByKey($values['gateway']['key']) || !$gateway->active)) {
                     OW::getFeedback()->error($language->text('base', 'billing_gateway_not_found'));
                     $this->redirect();
                 }
                 $productAdapter = new SPONSORS_CLASS_SponsorProductAdapter();
                 $sale = new BOL_BillingSale();
                 $sale->pluginKey = 'sponsors';
                 $sale->entityDescription = $language->text('sponsors', 'sponsor_payment_gateway_text');
                 $sale->entityKey = $productAdapter->getProductKey();
                 $sale->entityId = time();
                 $sale->price = floatval($values['sponsorAmount']);
                 $sale->period = null;
                 $sale->userId = OW::getUser()->getId() ? OW::getUser()->getId() : 0;
                 $sale->recurring = 0;
                 $extraData = array();
                 $extraData['sponsorName'] = $values['sponsorName'];
                 $extraData['sponsorEmail'] = $values['sponsorEmail'];
                 $extraData['sponsorWebsite'] = $values['sponsorWebsite'];
                 $extraData['sponsorAmount'] = $values['sponsorAmount'];
                 $extraData['sponsorImage'] = $sponsorImageFile;
                 $extraData['status'] = $config->getValue('sponsors', 'autoApprove') == '1' ? 1 : 0;
                 $extraData['validity'] = $config->getValue('sponsors', 'sponsorValidity');
                 $sale->setExtraData($extraData);
                 $saleId = $billingService->initSale($sale, $values['gateway']['key']);
                 if ($saleId) {
                     $billingService->storeSaleInSession($saleId);
                     $billingService->setSessionBackUrl($productAdapter->getProductOrderUrl());
                     OW::getApplication()->redirect($values['gateway']['url']);
                 }
             } else {
                 $sponsor = new SPONSORS_BOL_Sponsor();
                 $sponsor->name = $values['sponsorName'];
                 $sponsor->email = $values['sponsorEmail'];
                 $sponsor->website = $values['sponsorWebsite'];
                 $sponsor->price = 0;
                 $sponsor->image = $sponsorImageFile;
                 $sponsor->userId = OW::getUser()->getId() ? OW::getUser()->getId() : 0;
                 $sponsor->status = $config->getValue('sponsors', 'autoApprove') == '1' ? 1 : 0;
                 $sponsor->validity = $config->getValue('sponsors', 'sponsorValidity');
                 $sponsor->timestamp = time();
                 if (SPONSORS_BOL_Service::getInstance()->addSponsor($sponsor)) {
                     if ($sponsor->status == 1) {
                         OW::getFeedback()->info(OW::getLanguage()->text('sponsors', 'sponsor_live_notification'));
                     } else {
                         OW::getFeedback()->info(OW::getLanguage()->text('sponsors', 'sponsor_live_notification_after_approval'));
                     }
                 } else {
                     OW::getFeedback()->error(OW::getLanguage()->text('sponsors', 'sponsor_add_error'));
                 }
             }
         }
     }
     $this->addForm($sponsorForm);
     $fields = array();
     foreach ($sponsorForm->getElements() as $element) {
         if (!$element instanceof HiddenField) {
             $fields[$element->getName()] = $element->getName();
         }
     }
     $this->assign('formData', $fields);
     $this->setPageHeading(OW::getLanguage()->text('sponsors', 'become_sponsor_heading'));
     $this->setPageTitle(OW::getLanguage()->text('sponsors', 'become_sponsor_title'));
     $this->setPageHeadingIconClass('ow_ic_gear_wheel');
 }