/** * * Themes & styles * */ public function init() { $cname = explode('_', get_class()); $this->preInit(end($cname)); // use template file $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/SettingsStyles.phtml')))); // load settings $AppOptions = new Application_Model_AppOptions(); $all_meta = $AppOptions->getAllOptions(); // fields $themes_array = array('/bootstrap/css/bootstrap.min.css' => 'Bootstrap'); $css_theme = new Zend_Form_Element_Select('css_theme'); $css_theme->setDecorators(array('ViewHelper', 'Errors'))->setMultiOptions($themes_array)->setErrorMessages(array($this->translator->translate('Please select')))->setLabel($this->translator->translate('Choose css theme'))->setRequired(true)->setValue(isset($all_meta['css_theme']) ? $all_meta['css_theme'] : 'bootstrap')->setAttrib('class', 'form-control'); $wide_layout = new Zend_Form_Element_Checkbox('wide_layout'); $wide_layout->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['wide_layout']) && $all_meta['wide_layout'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Extra-wide layout on large screens'))->setCheckedValue("1")->setUncheckedValue("0"); $cover_ysize = new Zend_Form_Element_Text('cover_ysize'); $cover_ysize->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Cover image height'))->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['cover_ysize']) ? $all_meta['cover_ysize'] : '220')->setAttrib('class', 'form-control'); $user_background = new Zend_Form_Element_Checkbox('user_background'); $user_background->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['user_background']) && $all_meta['user_background'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Users can have custom background image'))->setCheckedValue("1")->setUncheckedValue("0"); $subscriber_background = new Zend_Form_Element_Checkbox('subscriber_background'); $subscriber_background->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['subscriber_background']) && $all_meta['subscriber_background'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Subscribers can have custom background image'))->setCheckedValue("1")->setUncheckedValue("0"); $custom_css = new Zend_Form_Element_Textarea('css_custom'); $custom_css->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('COLS', '')->setAttrib('ROWS', '15')->setValue(isset($all_meta['css_custom']) ? $all_meta['css_custom'] : '')->setLabel($this->translator->translate('Custom css'))->setAttrib('class', 'form-control'); $submit = new Zend_Form_Element_Submit('submitbtn'); $submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Update'))->setAttrib('class', 'submit btn btn-default'); $this->addElements(array($css_theme, $wide_layout, $cover_ysize, $user_background, $subscriber_background, $custom_css, $submit)); $this->postInit(); }
/** * * Change network background * */ public function init() { $cname = explode('_', get_class()); $this->preInit(end($cname)); // use template file $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/SettingsBackground.phtml')))); // load settings $AppOptions = new Application_Model_AppOptions(); $all_meta = $AppOptions->getAllOptions(); // fields $background_image = new Zend_Form_Element_File('background'); $background_image->setDecorators(array('File', 'Errors'))->setLabel($this->translator->translate('Choose Picture (jpg, png or gif)'))->addValidator('Extension', false, 'jpg,jpeg,png,gif'); $background_color = new Zend_Form_Element_Text('background_color'); $background_color->setDecorators(array('ViewHelper', 'Errors'))->addFilter('StringTrim')->setValue(isset($all_meta['background_color']) ? $all_meta['background_color'] : 'ff0000')->setErrorMessages(array($this->translator->translate('Please pick a color')))->setLabel($this->translator->translate('Background Color'))->setRequired(true)->setAttrib('class', 'form-control colorpicker-input'); $background_repeat = new Zend_Form_Element_Checkbox('background_repeat'); $background_repeat->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['background_repeat']) && $all_meta['background_repeat'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Repeat background'))->setCheckedValue("1")->setUncheckedValue("0"); $background_scroll = new Zend_Form_Element_Checkbox('background_scroll'); $background_scroll->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['background_scroll']) && $all_meta['background_scroll'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Scroll background'))->setCheckedValue("1")->setUncheckedValue("0"); $background_stretch = new Zend_Form_Element_Checkbox('background_stretch'); $background_stretch->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['background_stretch']) && $all_meta['background_stretch'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Stretch background'))->setCheckedValue("1")->setUncheckedValue("0"); $disable_image = new Zend_Form_Element_Checkbox('background_noimage'); $disable_image->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['background_noimage']) && $all_meta['background_noimage'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Disable custom image'))->setCheckedValue("1")->setUncheckedValue("0"); $submit = new Zend_Form_Element_Submit('formsubmit'); $submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Save'))->setAttrib('class', 'submit btn btn-default'); $this->addElements(array($background_image, $background_repeat, $background_scroll, $background_stretch, $disable_image, $background_color, $submit)); $this->postInit(); }
/** * * Change network logo * */ public function init() { $cname = explode('_', get_class()); $this->preInit(end($cname), true, false); // use template file $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/SettingsLogo.phtml')))); // load settings $AppOptions = new Application_Model_AppOptions(); $all_meta = $AppOptions->getAllOptions(); // fields $logo_image = new Zend_Form_Element_File('logo_image'); $logo_image->setDecorators(array('File', 'Errors'))->setLabel($this->translator->translate('Choose Picture (jpg, png or gif)'))->addValidator('Extension', false, 'jpg,jpeg,png,gif'); $disable_image = new Zend_Form_Element_Checkbox('logo_noimage'); $disable_image->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['logo_noimage']) && $all_meta['logo_noimage'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Disable custom image'))->setCheckedValue("1")->setUncheckedValue("0"); $submit = new Zend_Form_Element_Submit('formsubmit'); $submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Save'))->setAttrib('class', 'submit btn btn-default'); $this->addElements(array($logo_image, $disable_image, $submit)); $this->postInit(); }
/** * Write combined config to registry */ protected function _initConfig() { $AppOptions = new Application_Model_AppOptions(); try { $app_options = $AppOptions->getAllOptions(); } catch (Zend_Exception $e) { echo 'ERROR: App options cannot be loaded. Make sure your database has been imported. If you wish to run installer again please remove config.php file.<br />'; echo $e->getMessage(); die; } foreach ($app_options as &$app_option) { $app_option = str_replace("PUBLIC_PATH", PUBLIC_PATH, $app_option); $app_option = str_replace("APPLICATION_PATH", APPLICATION_PATH, $app_option); } $zend_options = $this->getOptions(); $config = new Zend_Config(array_merge($app_options, $zend_options), true); Zend_Registry::set('config', $config); $this->_appConfig = $config; return; }
/** * * General settings * */ public function init() { $cname = explode('_', get_class()); $this->preInit(end($cname)); // use template file $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/Settings.phtml')))); // load settings $AppOptions = new Application_Model_AppOptions(); $all_meta = $AppOptions->getAllOptions(); // fields $global_head = new Zend_Form_Element_Textarea('global_head'); $global_head->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('COLS', '')->setAttrib('ROWS', '8')->setValue(isset($all_meta['global_head']) ? $all_meta['global_head'] : '')->setLabel($this->translator->translate('Additional html for head section - show on global pages'))->setAttrib('class', 'form-control'); $profiles_head = new Zend_Form_Element_Textarea('profiles_head'); $profiles_head->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('COLS', '')->setAttrib('ROWS', '8')->setValue(isset($all_meta['profiles_head']) ? $all_meta['profiles_head'] : '')->setLabel($this->translator->translate('Additional html for head section - show on profile pages (Tags: PROFILE_SCREEN_NAME, PROFILE_NAME, PROFILE_AVATAR, PROFILE_COVER, PROFILE_DESCRIPTION)'))->setAttrib('class', 'form-control'); $common_head = new Zend_Form_Element_Textarea('common_head'); $common_head->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('COLS', '')->setAttrib('ROWS', '8')->setValue(isset($all_meta['common_head']) ? $all_meta['common_head'] : '')->setLabel($this->translator->translate('Additional html for head section - always show on all pages (common analytics code etc)'))->setAttrib('class', 'form-control'); $submit = new Zend_Form_Element_Submit('submitbtn'); $submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Update'))->setAttrib('class', 'submit btn btn-default'); $this->addElements(array($global_head, $profiles_head, $common_head, $submit)); $this->postInit(); }
/** * * General settings * */ public function init() { $cname = explode('_', get_class()); $this->preInit(end($cname)); // use template file $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/Settings.phtml')))); // load settings $AppOptions = new Application_Model_AppOptions(); $all_meta = $AppOptions->getAllOptions(); // fields $network_name = new Zend_Form_Element_Text('network_name'); $network_name->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Network name'))->setValue(isset($all_meta['network_name']) ? $all_meta['network_name'] : 'MyNetwork')->setAttrib('class', 'form-control'); $description = new Zend_Form_Element_Textarea('network_description'); $description->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('COLS', '')->setAttrib('ROWS', '4')->addFilter('StripTags')->setValue(isset($all_meta['network_description']) ? $all_meta['network_description'] : '')->setLabel($this->translator->translate('Description'))->setAttrib('class', 'form-control'); $license_code = new Zend_Form_Element_Text('license_code'); $license_code->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Item Purchase Code'))->setValue(isset($all_meta['license_code']) ? $all_meta['license_code'] : '')->setAttrib('class', 'form-control'); $submit = new Zend_Form_Element_Submit('submitbtn'); $submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Save'))->setAttrib('class', 'submit btn btn-default'); $this->addElements(array($network_name, $description, $license_code, $submit)); $this->postInit(); }
/** * * General settings * */ public function init() { $cname = explode('_', get_class()); $this->preInit(end($cname)); // use template file $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/Settings.phtml')))); // load settings $AppOptions = new Application_Model_AppOptions(); $all_meta = $AppOptions->getAllOptions(); // fields $php_post_max_size = Application_Plugin_Common::returnBytes(ini_get('post_max_size')); $php_upload_max_filesize = Application_Plugin_Common::returnBytes(ini_get('upload_max_filesize')); $info_class = ''; if ($all_meta['max_file_upload_size'] > $php_post_max_size || $all_meta['max_file_upload_size'] > $php_upload_max_filesize) { $info_class = 'warning'; } $filesize_php_info = '<span class="' . $info_class . '">(' . $this->translator->translate('php ini settings:') . ' post_max_size = ' . $php_post_max_size . ', upload_max_filesize = ' . $php_upload_max_filesize . ')</span>'; $max_file_upload_size = new Zend_Form_Element_Text('max_file_upload_size'); $max_file_upload_size->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Max file upload size in bytes') . ' ' . $filesize_php_info)->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['max_file_upload_size']) ? $all_meta['max_file_upload_size'] : '1048576')->setAttrib('class', 'form-control'); $max_images_per_post = new Zend_Form_Element_Text('max_images_per_post'); $max_images_per_post->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Max images per post'))->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['max_images_per_post']) ? $all_meta['max_images_per_post'] : '5')->setAttrib('class', 'form-control'); $max_files_per_user = new Zend_Form_Element_Text('max_files_per_user'); $max_files_per_user->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Max files per user'))->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['max_files_per_user']) ? $all_meta['max_files_per_user'] : '******')->setAttrib('class', 'form-control'); $max_storage_per_user = new Zend_Form_Element_Text('max_storage_per_user'); $max_storage_per_user->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Max storage space per user (in bytes)'))->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['max_storage_per_user']) ? $all_meta['max_storage_per_user'] : '******')->setAttrib('class', 'form-control'); $resample_images = new Zend_Form_Element_Checkbox('resample_images'); $resample_images->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['resample_images']) && $all_meta['resample_images'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Resample uploaded images'))->setCheckedValue("1")->setUncheckedValue("0"); $keep_original = new Zend_Form_Element_Checkbox('keep_original'); $keep_original->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['keep_original']) && $all_meta['keep_original'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Keep original file'))->setCheckedValue("1")->setUncheckedValue("0"); $resample_maxwidth = new Zend_Form_Element_Text('resample_maxwidth'); $resample_maxwidth->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Resample image max width'))->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['resample_maxwidth']) ? $all_meta['resample_maxwidth'] : '400')->setAttrib('class', 'form-control'); $resample_maxheight = new Zend_Form_Element_Text('resample_maxheight'); $resample_maxheight->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Resample image max height'))->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['resample_maxwidth']) ? $all_meta['resample_maxheight'] : '400')->setAttrib('class', 'form-control'); $submit = new Zend_Form_Element_Submit('submitbtn'); $submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Update'))->setAttrib('class', 'submit btn btn-default'); $this->addElements(array($max_file_upload_size, $max_images_per_post, $max_files_per_user, $max_storage_per_user, $resample_images, $keep_original, $resample_maxwidth, $resample_maxheight, $submit)); $this->postInit(); }
/** * * Mail settings * */ public function init() { $cname = explode('_', get_class()); $this->preInit(end($cname)); // use template file $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/Settings.phtml')))); // load settings $AppOptions = new Application_Model_AppOptions(); $all_meta = $AppOptions->getAllOptions(); // fields $mail_adapters = array('smtp' => 'smtp', 'mail' => 'php mail()'); $mail_adapter = new Zend_Form_Element_Select('mail_adapter'); $mail_adapter->setDecorators(array('ViewHelper', 'Errors'))->setMultiOptions($mail_adapters)->setLabel($this->translator->translate('Email adapter'))->setRequired(true)->setValue(isset($all_meta['mail_adapter']) ? $all_meta['mail_adapter'] : 'Zend_Mail_Transport_Smtp')->setAttrib('class', 'form-control'); $mail_host = new Zend_Form_Element_Text('mail_host'); $mail_host->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('(smtp) host'))->setValue(isset($all_meta['mail_host']) ? $all_meta['mail_host'] : 'example.com')->setAttrib('class', 'form-control'); $mail_port = new Zend_Form_Element_Text('mail_port'); $mail_port->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('(smtp) port (25/465/587)'))->setValidators(array('digits'))->setValue(isset($all_meta['mail_port']) ? $all_meta['mail_port'] : '465')->setAttrib('class', 'form-control'); $mail_login = new Zend_Form_Element_Select('mail_login'); $mail_login->setDecorators(array('ViewHelper', 'Errors'))->setMultiOptions(array('login' => 'login', '' => 'open'))->setLabel($this->translator->translate('(smtp) auth method'))->setValue(isset($all_meta['mail_login']) ? $all_meta['mail_login'] : '******')->setAttrib('class', 'form-control'); $mail_security_methods = array('ssl' => 'ssl', 'tls' => 'tls', '' => 'none'); $mail_security = new Zend_Form_Element_Select('mail_security'); $mail_security->setDecorators(array('ViewHelper', 'Errors'))->setMultiOptions($mail_security_methods)->setLabel($this->translator->translate('(smtp) security'))->setValue(isset($all_meta['mail_security']) ? $all_meta['mail_security'] : 'ssl')->setAttrib('class', 'form-control'); $mail_username = new Zend_Form_Element_Text('mail_username'); $mail_username->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('name'))->setValue(isset($all_meta['mail_username']) ? $all_meta['mail_username'] : '')->setAttrib('class', 'form-control'); $mail_password = new Zend_Form_Element_Password('mail_password'); $mail_password->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('(smtp) auth password'))->setAttrib('autocomplete', 'off')->setRenderPassword(true)->setValue(isset($all_meta['mail_password']) ? $all_meta['mail_password'] : '')->setAttrib('class', 'form-control'); $mail_username = new Zend_Form_Element_Text('mail_username'); $mail_username->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('(smtp) auth username'))->setValue(isset($all_meta['mail_username']) ? $all_meta['mail_username'] : '')->setAttrib('class', 'form-control'); $mail_from = new Zend_Form_Element_Text('mail_from'); $mail_from->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('from'))->setValue(isset($all_meta['mail_from']) ? $all_meta['mail_from'] : '')->setAttrib('class', 'form-control'); $mail_from_name = new Zend_Form_Element_Text('mail_from_name'); $mail_from_name->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('from name'))->setValue(isset($all_meta['mail_from_name']) ? $all_meta['mail_from_name'] : '')->setAttrib('class', 'form-control'); $submit = new Zend_Form_Element_Submit('submitbtn'); $submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Update'))->setAttrib('class', 'submit btn btn-default'); $this->addElements(array($mail_adapter, $mail_from, $mail_from_name, $mail_host, $mail_port, $mail_security, $mail_login, $mail_username, $mail_password, $submit)); $this->postInit(); }
/** * * General settings * */ public function init() { $cname = explode('_', get_class()); $this->preInit(end($cname)); // use template file $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/Settings.phtml')))); // load settings $AppOptions = new Application_Model_AppOptions(); $all_meta = $AppOptions->getAllOptions(); // fields $motd = new Zend_Form_Element_Textarea('motd'); $motd->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('COLS', '')->setAttrib('ROWS', '8')->setValue(isset($all_meta['motd']) ? $all_meta['motd'] : '')->setLabel($this->translator->translate('Message of the day'))->setAttrib('class', 'form-control'); $top_banner = new Zend_Form_Element_Textarea('top_banner'); $top_banner->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('COLS', '')->setAttrib('ROWS', '8')->setValue(isset($all_meta['top_banner']) ? $all_meta['top_banner'] : '')->setLabel($this->translator->translate('Top Banner html'))->setAttrib('class', 'form-control'); $sidebar_banner = new Zend_Form_Element_Textarea('sidebar_banner'); $sidebar_banner->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('COLS', '')->setAttrib('ROWS', '8')->setValue(isset($all_meta['sidebar_banner']) ? $all_meta['sidebar_banner'] : '')->setLabel($this->translator->translate('Sidebar Banner html'))->setAttrib('class', 'form-control'); // fields $middle_banner = new Zend_Form_Element_Textarea('middle_banner'); $middle_banner->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('COLS', '')->setAttrib('ROWS', '8')->setValue(isset($all_meta['middle_banner']) ? $all_meta['middle_banner'] : '')->setLabel($this->translator->translate('Middle Banner html'))->setAttrib('class', 'form-control'); $submit = new Zend_Form_Element_Submit('submitbtn'); $submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Update'))->setAttrib('class', 'submit btn btn-default'); $this->addElements(array($motd, $top_banner, $sidebar_banner, $middle_banner, $submit)); $this->postInit(); }
/** * * General settings * */ public function init() { $cname = explode('_', get_class()); $this->preInit(end($cname)); // use template file $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/Settings.phtml')))); // load settings $AppOptions = new Application_Model_AppOptions(); $all_meta = $AppOptions->getAllOptions(); // fields $limit_posts = new Zend_Form_Element_Text('limit_posts'); $limit_posts->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Max posts per page'))->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['limit_posts']) ? $all_meta['limit_posts'] : '5')->setAttrib('class', 'form-control'); $max_post_length = new Zend_Form_Element_Text('max_post_length'); $max_post_length->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Max post length'))->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['max_post_length']) ? $all_meta['max_post_length'] : '2000')->setAttrib('class', 'form-control'); $limit_comments = new Zend_Form_Element_Text('limit_comments'); $limit_comments->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Number of visible comments per resource'))->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['limit_comments']) ? $all_meta['limit_comments'] : '3')->setAttrib('class', 'form-control'); $pagination_limit = new Zend_Form_Element_Text('pagination_limit'); $pagination_limit->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Pagination limit'))->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['pagination_limit']) ? $all_meta['pagination_limit'] : '10')->setAttrib('class', 'form-control'); $max_scroll_fetches = new Zend_Form_Element_Text('max_scroll_fetches'); $max_scroll_fetches->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Maximum fetches on infinite scroll (0 = no limit)'))->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['max_scroll_fetches']) ? $all_meta['max_scroll_fetches'] : '0')->setAttrib('class', 'form-control'); $languages_array = array_merge(array('' => ''), Zend_Registry::get('languages_array')); $default_language = new Zend_Form_Element_Select('default_language'); $default_language->setDecorators(array('ViewHelper', 'Errors'))->setMultiOptions($languages_array)->setLabel($this->translator->translate('Choose default language'))->setRequired(true)->setValue(isset($all_meta['default_language']) ? $all_meta['default_language'] : '')->setAttrib('class', 'form-control'); $username_minchars = new Zend_Form_Element_Text('username_minchars'); $username_minchars->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Min chars for username'))->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['username_minchars']) ? $all_meta['username_minchars'] : '5')->setAttrib('class', 'form-control'); $username_maxchars = new Zend_Form_Element_Text('username_maxchars'); $username_maxchars->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Max chars for username'))->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['username_maxchars']) ? $all_meta['username_maxchars'] : '20')->setAttrib('class', 'form-control'); $sidebar_max_users = new Zend_Form_Element_Text('sidebar_max_users'); $sidebar_max_users->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Max users to show on sidebar boxes'))->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['sidebar_max_users']) ? $all_meta['sidebar_max_users'] : '3')->setAttrib('class', 'form-control'); $user_manage_groups = new Zend_Form_Element_Checkbox('user_manage_groups'); $user_manage_groups->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['user_manage_groups']) && $all_meta['user_manage_groups'] == 1 ? 1 : 0)->setLabel($this->translator->translate('User can manage groups'))->setCheckedValue("1")->setUncheckedValue("0"); $user_manage_pages = new Zend_Form_Element_Checkbox('user_manage_pages'); $user_manage_pages->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['user_manage_pages']) && $all_meta['user_manage_pages'] == 1 ? 1 : 0)->setLabel($this->translator->translate('User can manage pages'))->setCheckedValue("1")->setUncheckedValue("0"); $disable_groups_pages = new Zend_Form_Element_Checkbox('disable_groups_pages'); $disable_groups_pages->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['disable_groups_pages']) && $all_meta['disable_groups_pages'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Disable groups and pages feature (only admin can manage them)'))->setCheckedValue("1")->setUncheckedValue("0"); $user_activation_disabled = new Zend_Form_Element_Checkbox('user_activation_disabled'); $user_activation_disabled->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['user_activation_disabled']) && $all_meta['user_activation_disabled'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Disable user activation after registration'))->setCheckedValue("1")->setUncheckedValue("0"); $allow_addons = new Zend_Form_Element_Checkbox('allow_addons'); $allow_addons->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['allow_addons']) && $all_meta['allow_addons'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Load addons'))->setCheckedValue("1")->setUncheckedValue("0"); $disable_ajax_validator = new Zend_Form_Element_Checkbox('disable_ajax_validator'); $disable_ajax_validator->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['disable_ajax_validator']) && $all_meta['disable_ajax_validator'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Disable Ajax form validation'))->setCheckedValue("1")->setUncheckedValue("0"); $newuser_notify_email = new Zend_Form_Element_Text('newuser_notify_email'); $newuser_notify_email->addValidator('EmailAddress', true)->addFilter('StringToLower')->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('When new user signs up send notification to this email'))->setValue(isset($all_meta['newuser_notify_email']) ? $all_meta['newuser_notify_email'] : '')->setAttrib('class', 'form-control'); $report_notify_email = new Zend_Form_Element_Text('report_notify_email'); $report_notify_email->addValidator('EmailAddress', true)->addFilter('StringToLower')->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('When resource is reported send notification to this email'))->setValue(isset($all_meta['report_notify_email']) ? $all_meta['report_notify_email'] : '')->setAttrib('class', 'form-control'); $auto_follow_users = new Zend_Form_Element_Text('auto_follow_users'); $auto_follow_users->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Upon registration follow these users (usernames separated by comma)'))->setValue(isset($all_meta['auto_follow_users']) ? $all_meta['auto_follow_users'] : '')->setAttrib('class', 'form-control'); $heartbeatfreq = new Zend_Form_Element_Text('heartbeatfreq'); $heartbeatfreq->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Notification freqency in seconds (heartbeat)'))->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['heartbeatfreq']) ? $all_meta['heartbeatfreq'] : '5')->setAttrib('class', 'form-control'); $session_lifetime = new Zend_Form_Element_Text('session_lifetime'); $session_lifetime->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Session lifetime (Remember me) time in seconds. Set to 0 to use php server settings.'))->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['session_lifetime']) ? $all_meta['session_lifetime'] : '0')->setAttrib('class', 'form-control'); $recaptcha_active = new Zend_Form_Element_Checkbox('recaptcha_active'); $recaptcha_active->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['recaptcha_active']) && $all_meta['recaptcha_active'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Use ReCaptcha'))->setCheckedValue("1")->setUncheckedValue("0"); $recaptcha_privatekey = new Zend_Form_Element_Text('recaptcha_privatekey'); $recaptcha_privatekey->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('ReCaptcha Private Key'))->setValue(isset($all_meta['recaptcha_privatekey']) ? $all_meta['recaptcha_privatekey'] : '123456789')->setAttrib('class', 'form-control'); $recaptcha_publickey = new Zend_Form_Element_Text('recaptcha_publickey'); $recaptcha_publickey->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('ReCaptcha Public Key'))->setValue(isset($all_meta['recaptcha_publickey']) ? $all_meta['recaptcha_publickey'] : '123456789')->setAttrib('class', 'form-control'); $facebook_appid = new Zend_Form_Element_Text('facebook_appid'); $facebook_appid->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Facebook app id'))->setValue(isset($all_meta['facebook_appid']) ? $all_meta['facebook_appid'] : '123456789')->setAttrib('class', 'form-control'); $facebook_secret = new Zend_Form_Element_Text('facebook_secret'); $facebook_secret->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Facebook secret'))->setValue(isset($all_meta['facebook_secret']) ? $all_meta['facebook_secret'] : '123456789')->setAttrib('class', 'form-control'); $allow_guests = new Zend_Form_Element_Checkbox('allow_guests'); $allow_guests->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['allow_guests']) && $all_meta['allow_guests'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Allow public posts so the guests can explore the site'))->setCheckedValue("1")->setUncheckedValue("0"); $submit = new Zend_Form_Element_Submit('submitbtn'); $submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Update'))->setAttrib('class', 'submit btn btn-default'); $this->addElements(array($default_language, $facebook_appid, $facebook_secret, $allow_addons, $user_manage_groups, $user_manage_pages, $disable_groups_pages, $user_activation_disabled, $allow_guests, $disable_ajax_validator, $limit_posts, $max_post_length, $limit_comments, $pagination_limit, $max_scroll_fetches, $newuser_notify_email, $report_notify_email, $auto_follow_users, $username_minchars, $username_maxchars, $sidebar_max_users, $heartbeatfreq, $session_lifetime, $recaptcha_active, $recaptcha_publickey, $recaptcha_privatekey, $submit)); $this->postInit(); }
/** * Site settings */ public function settingsAction() { $request = $this->getRequest(); $section = $request->getUserParam('section', 'general'); $get_callback = $request->getUserParam('checkforupdates'); $this->buildSettingsMenu(); switch ($section) { case 'general': $settings_form = new Application_Form_SettingsGeneral(); break; case 'mail': $settings_form = new Application_Form_SettingsMail(); break; case 'storage': $settings_form = new Application_Form_SettingsStorage(); break; case 'markup': $settings_form = new Application_Form_SettingsMarkup(); break; case 'logo': $settings_form = new Application_Form_SettingsLogo(); break; case 'banner': $settings_form = new Application_Form_SettingsBanners(); break; default: $settings_form = new Application_Form_Settings(); $this->view->callback_info = ''; if ($get_callback) { // check for updates $client = new Zend_Http_Client('http://www.socialstrap.net/callback/?license=' . Zend_Registry::get('config')->get('license_code') . '&schemaver=' . Zend_Registry::get('config')->get('schema_version') . '&appver=' . APP_VERSION, array('timeout' => 5)); $response = $client->request(); if ($response->isSuccessful()) { $this->view->callback_info = '<hr />' . $response->getBody(); } } break; } $this->view->settings_form = $settings_form; $AppOptions = new Application_Model_AppOptions(); $AppOptions->getAllOptions(); if ($request->isPost()) { // Form Submitted... if ($settings_form->isValid($_POST)) { $elements = $settings_form->getElements(); foreach ($elements as $element) { $element_id = $element->getId(); if ($element_id == 'submitbtn' || $element_id == 'identifier') { continue; } $AppOptions->updateOption($element_id, $element->getValue()); } Application_Plugin_Alerts::success($this->view->translate('Settings updated')); // flush url $this->redirect('admin/settings/section/' . $section); } } }