Exemplo n.º 1
0
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $timeZoneCities = array(0 => 'London, Lisbon, Casablanca', 1 => 'Brussels, Copenhagen, Madrid, Paris', 2 => 'Athens, Istanbul, Jerusalem', 3 => 'Baghdad, Riyadh, Moscow, St. Petersburg', 4 => 'Abu Dhabi, Muscat, Baku, Tbilisi', 5 => 'Ekaterinburg, Islamabad, Karachi, Tashkent', 6 => 'Almaty, Dhaka, Colombo', 7 => 'Bangkok, Hanoi, Jakarta', 8 => 'Beijing, Perth, Singapore, Hong Kong', 9 => 'Tokyo, Seoul, Osaka, Sapporo, Yakutsk', 10 => 'Eastern Australia, Guam, Vladivostok', 11 => 'Magadan, Solomon Islands, New Caledonia', 12 => 'Auckland, Wellington, Fiji, Kamchatka', -1 => 'Azores, Cape Verde Islands', -2 => 'Mid-Atlantic', -3 => 'Brazil, Buenos Aires, Georgetown', -4 => 'Atlantic Time (Canada), Caracas, La Paz', -5 => 'Eastern Time (US & Canada), Bogota, Lima', -6 => 'Central Time (US & Canada), Mexico City', -7 => 'Mountain Time (US & Canada)', -8 => 'Pacific Time (US & Canada)', -9 => 'Alaska', -10 => 'Hawaii', -11 => 'Midway Island, Samoa', -12 => 'Eniwetok, Kwajalein');
     $timezones = array();
     for ($k = -12; $k < 13; $k++) {
         $v = $k < 0 ? $k : '+' . $k;
         if ($timeZoneCities[$k] != '') {
             $timezones[$v] = "GMT {$v}:00 ({$timeZoneCities[$k]})";
         } else {
             $timezones[$v] = "GMT {$v}:00";
         }
     }
     $availableCacheEngines = $options['cacheService']->getAvailableCacheEngines();
     $availableTemplateCacheHandlers = \CampTemplateCache::availableHandlers();
     $cacheEngines = array();
     $cacheTemplate = array();
     foreach ($availableCacheEngines as $cacheEngineName => $engineValue) {
         $cacheEngines[$engineValue] = $cacheEngineName;
     }
     foreach ($availableTemplateCacheHandlers as $handler => $value) {
         $cacheTemplate[$handler] = $handler;
     }
     $cacheLifetime = array();
     foreach (array(0 => 'newscoop.preferences.label.disabled', 30 => '30 Seconds', 60 => '1 Minute', 300 => '5 Minutes', 900 => '15 Minutes', 1800 => '30 Minutes', 3600 => '1 Hour', 3600 * 24 => '1 Day', 3600 * 24 * 2 => '2 Days', 3600 * 24 * 3 => '3 Days', 3600 * 24 * 4 => '4 Days', 3600 * 24 * 5 => '5 Days', 3600 * 24 * 6 => '6 Days', 3600 * 24 * 7 => '1 Week', 3600 * 24 * 14 => '2 Weeks', 3600 * 24 * 21 => '3 Weeks', 3600 * 24 * 31 => '1 Month', 3600 * 24 * 61 => '2 Months', 3600 * 24 * 91 => '3 Months', 3600 * 24 * 183 => '6 Months', 3600 * 24 * 365 => '1 Year', -1 => 'Infinite') as $k => $v) {
         $cacheLifetime[$k] = $v;
     }
     $language_codes_639_1 = \Language::Get6391List();
     asort($language_codes_639_1);
     $languages = array();
     foreach ($language_codes_639_1 as $geo_lang_code => $geo_lang_name) {
         $languages[$geo_lang_code] = $geo_lang_name;
     }
     $builder->add('siteonline', 'choice', array('choices' => array('Y' => 'newscoop.preferences.label.yesoption', 'N' => 'newscoop.preferences.label.nooption'), 'error_bubbling' => true, 'multiple' => false, 'expanded' => true, 'required' => true))->add('title', null, array('attr' => array('maxlength' => '100', 'size' => '64'), 'error_bubbling' => true, 'required' => true))->add('meta_keywords', null, array('attr' => array('maxlength' => '100', 'size' => '64'), 'error_bubbling' => true, 'required' => true))->add('meta_description', null, array('attr' => array('maxlength' => '100', 'size' => '64'), 'error_bubbling' => true, 'required' => true))->add('timezone', 'choice', array('choices' => $timezones, 'empty_value' => 'newscoop.preferences.label.disabled', 'required' => false))->add('cache_engine', 'choice', array('choices' => $cacheEngines, 'empty_value' => 'Array', 'required' => false))->add('cache_engine_host', 'text', array('error_bubbling' => true, 'required' => false))->add('cache_engine_port', 'text', array('error_bubbling' => true, 'required' => false))->add('cache_template', 'choice', array('choices' => $cacheTemplate, 'empty_value' => 'newscoop.preferences.label.disabled', 'required' => false))->add('cache_image', 'choice', array('choices' => $cacheLifetime, 'required' => true))->add('allow_recovery', 'choice', array('choices' => array('Y' => 'newscoop.preferences.label.yesoption', 'N' => 'newscoop.preferences.label.nooption'), 'error_bubbling' => true, 'multiple' => false, 'expanded' => true, 'required' => true))->add('secret_key', null, array('attr' => array('maxlength' => '32', 'size' => '64'), 'error_bubbling' => true, 'required' => false))->add('session_lifetime', 'integer', array('attr' => array('maxlength' => '5', 'max' => '86400', 'min' => 0), 'error_bubbling' => true, 'required' => true))->add('separator', null, array('attr' => array('maxlength' => '2', 'size' => '5'), 'error_bubbling' => true, 'required' => true))->add('captcha', 'integer', array('attr' => array('max' => 99, 'min' => 0), 'error_bubbling' => true, 'required' => true))->add('max_upload_size', null, array('attr' => array('maxlength' => '12', 'size' => '5'), 'error_bubbling' => true, 'required' => true))->add('automatic_collection', 'choice', array('choices' => array('Y' => 'newscoop.preferences.label.yesoption', 'N' => 'newscoop.preferences.label.nooption'), 'error_bubbling' => true, 'multiple' => false, 'expanded' => true, 'required' => true))->add('smtp_host', null, array('attr' => array('maxlength' => 100, 'size' => 64), 'error_bubbling' => true, 'required' => true))->add('smtp_port', 'integer', array('attr' => array('max' => 999999, 'min' => 1), 'error_bubbling' => true, 'required' => true))->add('email_from', 'email', array('attr' => array('maxlength' => 100, 'size' => 64), 'error_bubbling' => true, 'required' => true))->add('image_ratio', 'integer', array('attr' => array('max' => 100, 'min' => 1), 'error_bubbling' => true, 'required' => true))->add('image_width', 'integer', array('attr' => array('max' => 999999, 'min' => 0), 'error_bubbling' => true, 'required' => false))->add('image_height', 'integer', array('attr' => array('max' => 999999, 'min' => 0), 'error_bubbling' => true, 'required' => false))->add('zoom', 'choice', array('choices' => array('Y' => 'newscoop.preferences.label.yesoption', 'N' => 'newscoop.preferences.label.nooption'), 'error_bubbling' => true, 'multiple' => false, 'expanded' => true, 'required' => true))->add('mediaRichTextCaptions', 'choice', array('choices' => array('Y' => 'newscoop.preferences.label.yesoption', 'N' => 'newscoop.preferences.label.nooption'), 'error_bubbling' => true, 'multiple' => false, 'expanded' => true, 'required' => true))->add('mediaCaptionLength', 'integer', array('attr' => array('max' <= 999999, 'min' => 0), 'error_bubbling' => true, 'required' => true))->add('use_replication', 'choice', array('choices' => array('Y' => 'newscoop.preferences.label.yesoption', 'N' => 'newscoop.preferences.label.nooption'), 'error_bubbling' => true, 'multiple' => false, 'expanded' => true, 'required' => true))->add('use_replication_host', null, array('attr' => array('maxlength' => 60, 'size' => 30), 'error_bubbling' => true, 'required' => false))->add('use_replication_user', null, array('attr' => array('maxlength' => 20, 'size' => 30), 'error_bubbling' => true, 'required' => false))->add('use_replication_password', null, array('attr' => array('maxlength' => 20, 'size' => 30), 'error_bubbling' => true, 'required' => false))->add('use_replication_port', 'integer', array('attr' => array('max' => 999999, 'min' => 0), 'required' => false))->add('template_filter', 'text', array('attr' => array('maxlength' => 50, 'size' => 30), 'error_bubbling' => true, 'required' => true))->add('mysql_client_command_path', 'text', array('attr' => array('maxlength' => 200, 'size' => 40), 'error_bubbling' => true, 'required' => false))->add('center_latitude_default', 'number', array('attr' => array('size' => 10), 'error_bubbling' => true, 'invalid_message' => 'newscoop.preferences.error.latitude', 'precision' => 6, 'required' => true))->add('center_longitude_default', 'number', array('attr' => array('size' => 10), 'error_bubbling' => true, 'invalid_message' => 'newscoop.preferences.error.longitude', 'precision' => 6, 'required' => true))->add('map_display_resolution_default', 'integer', array('attr' => array('max' => 99, 'min' => 0), 'required' => true))->add('map_view_width_default', 'integer', array('attr' => array('max' => 999, 'min' => 0), 'required' => true))->add('map_view_height_default', 'integer', array('attr' => array('max' => 999, 'min' => 0), 'required' => true))->add('map_auto_cSS_file', null, array('attr' => array('maxlength' => 80, 'size' => 50), 'error_bubbling' => true, 'required' => true))->add('map_auto_focus_default', 'checkbox', array('required' => false))->add('map_auto_focus_max_zoom', 'integer', array('attr' => array('max' => 18, 'min' => 0), 'required' => true))->add('map_auto_focus_border', 'integer', array('attr' => array('max' => 999, 'min' => -99), 'required' => true))->add('map_provider_available_google_v3', 'checkbox', array('required' => false))->add('map_provider_available_map_quest', 'checkbox', array('required' => false))->add('map_provider_available_oSM', 'checkbox', array('required' => false))->add('map_provider_default', 'choice', array('choices' => array('GoogleV3' => 'Google Maps', 'MapQuest' => 'MapQuest Open', 'OSM' => 'OpenStreetMap'), 'required' => true))->add('geo_search_local_geonames', 'checkbox', array('required' => false))->add('geo_search_mapquest_nominatim', 'checkbox', array('required' => false))->add('geo_search_preferred_language', 'choice', array('choices' => $languages, 'required' => true))->add('map_marker_directory', null, array('attr' => array('maxlength' => 80, 'size' => 50), 'error_bubbling' => true, 'required' => true))->add('map_marker_source_default', null, array('required' => false))->add('map_popup_width_min', 'integer', array('attr' => array('max' => 999, 'min' => 0), 'required' => true))->add('map_popup_height_min', 'integer', array('attr' => array('max' => 999, 'min' => 0), 'required' => true))->add('map_video_width_you_tube', 'integer', array('attr' => array('max' => 999, 'min' => 0), 'required' => true))->add('map_video_height_you_tube', 'integer', array('attr' => array('max' => 999, 'min' => 0), 'required' => true))->add('map_video_width_vimeo', 'integer', array('attr' => array('max' => 999, 'min' => 0), 'required' => true))->add('map_video_height_vimeo', 'integer', array('attr' => array('max' => 999, 'min' => 0), 'required' => true))->add('map_video_width_flash', 'integer', array('attr' => array('max' => 999, 'min' => 0), 'required' => true))->add('map_video_height_flash', 'integer', array('attr' => array('max' => 999, 'min' => 0), 'required' => true))->add('geo_flash_server', null, array('attr' => array('maxlength' => 80, 'size' => 40), 'error_bubbling' => true, 'required' => false))->add('geo_flash_directory', null, array('attr' => array('maxlength' => 80, 'size' => 40), 'error_bubbling' => true, 'required' => false))->add('facebook_appid', null, array('attr' => array('maxlength' => 200, 'size' => 40), 'error_bubbling' => true, 'required' => false))->add('facebook_appsecret', null, array('attr' => array('maxlength' => 200, 'size' => 40), 'error_bubbling' => true, 'required' => false))->add('recaptchaPublicKey', null, array('attr' => array('maxlength' => 200, 'size' => 40), 'error_bubbling' => true, 'required' => false))->add('recaptchaPrivateKey', null, array('attr' => array('maxlength' => 200, 'size' => 40), 'error_bubbling' => true, 'required' => false))->add('recaptchaSecure', 'choice', array('choices' => array('Y' => 'newscoop.preferences.label.yesoption', 'N' => 'newscoop.preferences.label.nooption'), 'data' => 'N', 'error_bubbling' => true, 'multiple' => false, 'expanded' => true, 'required' => true))->add('userGarbageActive', 'choice', array('choices' => array('Y' => 'newscoop.preferences.label.yesoption', 'N' => 'newscoop.preferences.label.nooption'), 'error_bubbling' => true, 'multiple' => false, 'expanded' => true, 'required' => true))->add('userGarbageDays', 'integer', array('attr' => array('max' => 999, 'min' => 1), 'required' => true))->add('smartyUseProtocol', 'choice', array('choices' => array('Y' => 'newscoop.preferences.label.yesoption', 'N' => 'newscoop.preferences.label.nooption'), 'error_bubbling' => true, 'multiple' => false, 'expanded' => true, 'required' => true))->add('cronJobNotificationEmail', 'email', array('attr' => array('maxlength' => 255, 'size' => 64), 'error_bubbling' => true, 'required' => true))->add('cronJobSmtpSender', 'email', array('attr' => array('maxlength' => 100, 'size' => 64), 'error_bubbling' => true, 'required' => false))->add('cronJobSmtpSenderName', null, array('attr' => array('maxlength' => '100', 'size' => '64'), 'error_bubbling' => true, 'required' => false));
 }
Exemplo n.º 2
0
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $timeZones = array();
     array_walk(timezone_identifiers_list(), function ($timeZone) use(&$timeZones) {
         $timeZoneGroup = strpos($timeZone, '/') !== false ? substr($timeZone, 0, strpos($timeZone, '/')) : $timeZone;
         $value = strpos($timeZone, '/') !== false ? substr($timeZone, strpos($timeZone, '/') + 1) : $timeZone;
         $value = str_replace('_', ' ', $value);
         $value = str_replace('/', ' - ', $value);
         $timeZones[$timeZoneGroup][$timeZone] = $value;
     });
     $availableCacheEngines = $options['cacheService']->getAvailableCacheEngines();
     $availableTemplateCacheHandlers = \CampTemplateCache::availableHandlers();
     $cacheEngines = array();
     $cacheTemplate = array();
     foreach ($availableCacheEngines as $cacheEngineName => $engineValue) {
         $cacheEngines[$engineValue] = $cacheEngineName;
     }
     foreach ($availableTemplateCacheHandlers as $handler => $value) {
         $cacheTemplate[$handler] = $handler;
     }
     $cacheLifetime = array();
     foreach (array(0 => 'newscoop.preferences.label.disabled', 30 => '30 Seconds', 60 => '1 Minute', 300 => '5 Minutes', 900 => '15 Minutes', 1800 => '30 Minutes', 3600 => '1 Hour', 3600 * 24 => '1 Day', 3600 * 24 * 2 => '2 Days', 3600 * 24 * 3 => '3 Days', 3600 * 24 * 4 => '4 Days', 3600 * 24 * 5 => '5 Days', 3600 * 24 * 6 => '6 Days', 3600 * 24 * 7 => '1 Week', 3600 * 24 * 14 => '2 Weeks', 3600 * 24 * 21 => '3 Weeks', 3600 * 24 * 31 => '1 Month', 3600 * 24 * 61 => '2 Months', 3600 * 24 * 91 => '3 Months', 3600 * 24 * 183 => '6 Months', 3600 * 24 * 365 => '1 Year', -1 => 'Infinite') as $k => $v) {
         $cacheLifetime[$k] = $v;
     }
     $language_codes_639_1 = \Language::Get6391List();
     asort($language_codes_639_1);
     $languages = array();
     foreach ($language_codes_639_1 as $geo_lang_code => $geo_lang_name) {
         $languages[$geo_lang_code] = $geo_lang_name;
     }
     $builder->add('siteonline', 'choice', array('choices' => array('Y' => 'newscoop.preferences.label.yesoption', 'N' => 'newscoop.preferences.label.nooption'), 'multiple' => false, 'expanded' => true, 'constraints' => array(new Assert\NotBlank())))->add('title', null, array('attr' => array('size' => '64'), 'constraints' => array(new Assert\NotBlank(), new Assert\Type(array('type' => 'string')), new Assert\Length(array('max' => 100)))))->add('meta_keywords', null, array('attr' => array('size' => '64'), 'constraints' => array(new Assert\NotBlank(), new Assert\Type(array('type' => 'string')), new Assert\Length(array('max' => 100)))))->add('meta_description', null, array('attr' => array('size' => '64'), 'constraints' => array(new Assert\NotBlank(), new Assert\Type(array('type' => 'string')), new Assert\Length(array('max' => 100)))))->add('timezone', 'choice', array('choices' => $timeZones, 'placeholder' => 'newscoop.preferences.label.disabled', 'required' => false))->add('cache_engine', 'choice', array('choices' => $cacheEngines, 'placeholder' => 'Array', 'required' => false))->add('cache_engine_host', 'text', array('error_bubbling' => true, 'required' => false))->add('cache_engine_port', 'text', array('error_bubbling' => true, 'required' => false))->add('cache_template', 'choice', array('choices' => $cacheTemplate, 'placeholder' => 'newscoop.preferences.label.disabled', 'required' => false))->add('cache_image', 'choice', array('choices' => $cacheLifetime, 'constraints' => array(new Assert\NotBlank())))->add('allow_recovery', 'choice', array('choices' => array('Y' => 'newscoop.preferences.label.yesoption', 'N' => 'newscoop.preferences.label.nooption'), 'multiple' => false, 'expanded' => true, 'constraints' => array(new Assert\NotBlank())))->add('secret_key', null, array('attr' => array('size' => '64'), 'constraints' => array(new Assert\Length(array('max' => 32)))))->add('session_lifetime', 'integer', array('constraints' => array(new Assert\NotBlank(), new Assert\Type(array('type' => 'integer')), new Assert\Range(array('min' => 0, 'max' => 86400)))))->add('separator', null, array('attr' => array('size' => '5'), 'constraints' => array(new Assert\NotBlank(), new Assert\Type(array('type' => 'string')), new Assert\Length(array('max' => 2)))))->add('captcha', 'integer', array('constraints' => array(new Assert\NotBlank(), new Assert\Type(array('type' => 'integer')), new Assert\Range(array('min' => 0, 'max' => 99)))))->add('max_upload_size', null, array('attr' => array('size' => '5'), 'constraints' => array(new Assert\NotBlank(), new Assert\Type(array('type' => 'string')), new Assert\Length(array('max' => 12)))))->add('automatic_collection', 'choice', array('choices' => array('Y' => 'newscoop.preferences.label.yesoption', 'N' => 'newscoop.preferences.label.nooption'), 'multiple' => false, 'expanded' => true, 'constraints' => array(new Assert\NotBlank())))->add('smtp_host', null, array('attr' => array('size' => 64), 'constraints' => array(new Assert\NotBlank(), new Assert\Type(array('type' => 'string')), new Assert\Length(array('max' => 100)))))->add('smtp_port', 'integer', array('constraints' => array(new Assert\NotBlank(), new Assert\Type(array('type' => 'integer')), new Assert\Range(array('min' => 1, 'max' => 999999)))))->add('email_from', 'email', array('attr' => array('size' => 64), 'constraints' => array(new Assert\NotBlank(), new Assert\Email(), new Assert\Type(array('type' => 'string')), new Assert\Length(array('max' => 100)))))->add('image_ratio', 'integer', array('attr' => array('max' => 100, 'min' => 1), 'constraints' => array(new Assert\NotBlank(), new Assert\Type(array('type' => 'integer')), new Assert\Range(array('min' => 1, 'max' => 100)))))->add('image_width', 'integer', array('constraints' => array(new Assert\Range(array('min' => 0, 'max' => 999999)))))->add('image_height', 'integer', array('constraints' => array(new Assert\Range(array('min' => 0, 'max' => 999999)))))->add('zoom', 'choice', array('choices' => array('Y' => 'newscoop.preferences.label.yesoption', 'N' => 'newscoop.preferences.label.nooption'), 'multiple' => false, 'expanded' => true, 'constraints' => array(new Assert\NotBlank())))->add('mediaRichTextCaptions', 'choice', array('choices' => array('Y' => 'newscoop.preferences.label.yesoption', 'N' => 'newscoop.preferences.label.nooption'), 'multiple' => false, 'expanded' => true, 'constraints' => array(new Assert\NotBlank())))->add('mediaCaptionLength', 'integer', array('constraints' => array(new Assert\NotBlank(), new Assert\Type(array('type' => 'integer')), new Assert\Range(array('min' => 0, 'max' => 999999)))))->add('use_replication', 'choice', array('choices' => array('Y' => 'newscoop.preferences.label.yesoption', 'N' => 'newscoop.preferences.label.nooption'), 'multiple' => false, 'expanded' => true, 'constraints' => array(new Assert\NotBlank())))->add('use_replication_host', null, array('attr' => array('size' => 30), 'constraints' => array(new Assert\Length(array('max' => 60)))))->add('use_replication_user', null, array('attr' => array('size' => 30), 'constraints' => array(new Assert\Length(array('max' => 20)))))->add('use_replication_password', null, array('attr' => array('size' => 30), 'constraints' => array(new Assert\Length(array('max' => 20)))))->add('use_replication_port', 'integer', array('constraints' => array(new Assert\NotBlank(), new Assert\Type(array('type' => 'integer')), new Assert\Range(array('min' => 0, 'max' => 999999)))))->add('template_filter', 'text', array('attr' => array('size' => 30), 'constraints' => array(new Assert\NotBlank(), new Assert\Type(array('type' => 'string')), new Assert\Length(array('max' => 50)))))->add('mysql_client_command_path', 'text', array('attr' => array('size' => 40), 'constraints' => array(new Assert\Length(array('max' => 200)))))->add('center_latitude_default', 'number', array('attr' => array('size' => 10), 'precision' => 6, 'constraints' => array(new Assert\NotBlank(), new Assert\Type(array('type' => 'float')))))->add('center_longitude_default', 'number', array('attr' => array('size' => 10), 'precision' => 6, 'constraints' => array(new Assert\NotBlank(), new Assert\Type(array('type' => 'float')))))->add('map_display_resolution_default', 'integer', array('constraints' => array(new Assert\NotBlank(), new Assert\Type(array('type' => 'integer')), new Assert\Range(array('min' => 0, 'max' => 99)))))->add('map_view_width_default', 'integer', array('constraints' => array(new Assert\NotBlank(), new Assert\Type(array('type' => 'integer')), new Assert\Range(array('min' => 0, 'max' => 999)))))->add('map_view_height_default', 'integer', array('constraints' => array(new Assert\NotBlank(), new Assert\Type(array('type' => 'integer')), new Assert\Range(array('min' => 0, 'max' => 999)))))->add('map_auto_cSS_file', null, array('attr' => array('size' => 50), 'constraints' => array(new Assert\NotBlank(), new Assert\Type(array('type' => 'string')), new Assert\Length(array('max' => 80)))))->add('map_auto_focus_default', 'checkbox')->add('map_auto_focus_max_zoom', 'integer', array('constraints' => array(new Assert\NotBlank(), new Assert\Type(array('type' => 'integer')), new Assert\Range(array('min' => 0, 'max' => 18)))))->add('map_auto_focus_border', 'integer', array('constraints' => array(new Assert\NotBlank(), new Assert\Type(array('type' => 'integer')), new Assert\Range(array('min' => -99, 'max' => 999)))))->add('map_provider_available_google_v3', 'checkbox')->add('map_provider_available_map_quest', 'checkbox')->add('map_provider_available_oSM', 'checkbox')->add('map_provider_default', 'choice', array('choices' => array('GoogleV3' => 'Google Maps', 'MapQuest' => 'MapQuest Open', 'OSM' => 'OpenStreetMap'), 'constraints' => array(new Assert\NotBlank())))->add('geo_search_local_geonames', 'checkbox', array('required' => false))->add('geo_search_mapquest_nominatim', 'checkbox', array('required' => false))->add('geo_search_preferred_language', 'choice', array('choices' => $languages, 'constraints' => array(new Assert\NotBlank())))->add('map_marker_directory', null, array('attr' => array('size' => 50), 'constraints' => array(new Assert\NotBlank(), new Assert\Type(array('type' => 'string')), new Assert\Length(array('max' => 80)))))->add('map_marker_source_default', null, array())->add('map_popup_width_min', 'integer', array('constraints' => array(new Assert\NotBlank(), new Assert\Type(array('type' => 'integer')), new Assert\Range(array('min' => 0, 'max' => 999)))))->add('map_popup_height_min', 'integer', array('constraints' => array(new Assert\NotBlank(), new Assert\Type(array('type' => 'integer')), new Assert\Range(array('min' => 0, 'max' => 999)))))->add('map_video_width_you_tube', 'integer', array('constraints' => array(new Assert\NotBlank(), new Assert\Type(array('type' => 'integer')), new Assert\Range(array('min' => 0, 'max' => 999)))))->add('map_video_height_you_tube', 'integer', array('constraints' => array(new Assert\NotBlank(), new Assert\Type(array('type' => 'integer')), new Assert\Range(array('min' => 0, 'max' => 999)))))->add('map_video_width_vimeo', 'integer', array('constraints' => array(new Assert\NotBlank(), new Assert\Type(array('type' => 'integer')), new Assert\Range(array('min' => 0, 'max' => 999)))))->add('map_video_height_vimeo', 'integer', array('constraints' => array(new Assert\NotBlank(), new Assert\Type(array('type' => 'integer')), new Assert\Range(array('min' => 0, 'max' => 999)))))->add('map_video_width_flash', 'integer', array('constraints' => array(new Assert\NotBlank(), new Assert\Type(array('type' => 'integer')), new Assert\Range(array('min' => 0, 'max' => 999)))))->add('map_video_height_flash', 'integer', array('constraints' => array(new Assert\NotBlank(), new Assert\Type(array('type' => 'integer')), new Assert\Range(array('min' => 0, 'max' => 999)))))->add('geo_flash_server', null, array('attr' => array('size' => 40), 'constraints' => array(new Assert\Length(array('max' => 80)))))->add('geo_flash_directory', null, array('attr' => array('size' => 40), 'constraints' => array(new Assert\Length(array('max' => 200)))))->add('facebook_appid', null, array('attr' => array('size' => 40), 'constraints' => array(new Assert\Length(array('max' => 200)))))->add('facebook_appsecret', null, array('attr' => array('size' => 40), 'constraints' => array(new Assert\Length(array('max' => 200)))))->add('recaptchaPublicKey', null, array('attr' => array('size' => 40), 'constraints' => array(new Assert\Length(array('max' => 200)))))->add('recaptchaPrivateKey', null, array('attr' => array('size' => 40), 'constraints' => array(new Assert\Length(array('max' => 200)))))->add('recaptchaSecure', 'choice', array('choices' => array('Y' => 'newscoop.preferences.label.yesoption', 'N' => 'newscoop.preferences.label.nooption'), 'data' => 'N', 'multiple' => false, 'expanded' => true, 'constraints' => array(new Assert\NotBlank())))->add('userGarbageActive', 'choice', array('choices' => array('Y' => 'newscoop.preferences.label.yesoption', 'N' => 'newscoop.preferences.label.nooption'), 'multiple' => false, 'expanded' => true, 'constraints' => array(new Assert\NotBlank())))->add('userGarbageDays', 'integer', array('constraints' => array(new Assert\NotBlank(), new Assert\Type(array('type' => 'integer')), new Assert\Range(array('min' => 1, 'max' => 999)))))->add('smartyUseProtocol', 'choice', array('choices' => array('Y' => 'newscoop.preferences.label.yesoption', 'N' => 'newscoop.preferences.label.nooption'), 'multiple' => false, 'expanded' => true, 'constraints' => array(new Assert\NotBlank())))->add('cronJobNotificationEmail', 'email', array('attr' => array('size' => 64), 'constraints' => array(new Assert\NotBlank(), new Assert\Email(), new Assert\Length(array('max' => 255)))))->add('cronJobSmtpSender', 'email', array('attr' => array('size' => 64), 'constraints' => array(new Assert\Email(), new Assert\Length(array('max' => 255)))))->add('cronJobSmtpSenderName', null, array('attr' => array('size' => '64'), 'constraints' => array(new Assert\Length(array('max' => 100)))));
 }
Exemplo n.º 3
0
 /**
  */
 public function __construct()
 {
     parent::__construct();
     $config = CampSite::GetConfigInstance();
     $this->debugging = $config->getSetting('smarty.debugging');
     $this->force_compile = $config->getSetting('smarty.force_compile');
     $this->compile_check = $config->getSetting('smarty.compile_check');
     $this->use_sub_dirs = $config->getSetting('smarty.use_subdirs');
     // cache settings
     $preferencesService = \Zend_Registry::get('container')->getService('system_preferences_service');
     $this->useprotocol = $preferencesService->get('SmartyUseProtocol') === 'Y' ? 'true' : 'false';
     $this->templateCacheHandler = $preferencesService->TemplateCacheHandler;
     if ($this->templateCacheHandler) {
         $this->caching = 1;
         $this->caching_type = 'newscoop';
         CampTemplateCache::factory();
     } else {
         $this->caching = 0;
     }
     if (defined('APPLICATION_ENV') && APPLICATION_ENV == 'development') {
         $this->force_compile = true;
     }
     // define dynamic uncached block
     require_once APPLICATION_PATH . self::PLUGINS . '/block.dynamic.php';
     $this->registerPlugin('block', 'dynamic', 'smarty_block_dynamic', false);
     // define render function
     require_once APPLICATION_PATH . self::PLUGINS . '/function.render.php';
     $this->registerPlugin('function', 'render', 'smarty_function_render', false);
     // define translate modifier
     require_once APPLICATION_PATH . self::PLUGINS . '/modifier.translate.php';
     $this->registerPlugin('modifier', 'translate', 'smarty_modifier_translate', false);
     $this->left_delimiter = '{{';
     $this->right_delimiter = '}}';
     $this->auto_literal = false;
     $this->cache_dir = APPLICATION_PATH . '/../cache';
     $this->compile_dir = APPLICATION_PATH . '/../cache';
     $this->plugins_dir = array_merge((array) $this->plugins_dir, array(APPLICATION_PATH . self::PLUGINS), self::getPluginsPluginsDir());
     $this->setTemplateDir(array(APPLICATION_PATH . '/../themes/', APPLICATION_PATH . '/../themes/system_templates/', APPLICATION_PATH . self::SCRIPTS));
     $this->assign('view', \Zend_Registry::get('container')->get('view'));
     $this->assign('userindex', false);
     $this->assign('user', new MetaUser());
     $this->assign('siteinfo', array('title' => $preferencesService->SiteTitle, 'keywords' => $preferencesService->SiteMetaKeywords, 'description' => $preferencesService->SiteMetaDescription));
     $this->getTemplateTranslationsFiles();
 }
Exemplo n.º 4
0
 /**
  */
 public function __construct()
 {
     parent::__construct();
     $config = CampSite::GetConfigInstance();
     $this->debugging = $config->getSetting('smarty.debugging');
     $this->force_compile = $config->getSetting('smarty.force_compile');
     $this->compile_check = $config->getSetting('smarty.compile_check');
     $this->use_sub_dirs = $config->getSetting('smarty.use_subdirs');
     $this->allow_php_tag = true;
     // cache settings
     $cacheHandler = SystemPref::Get('TemplateCacheHandler');
     $auth = Zend_Auth::getInstance();
     if ($cacheHandler) {
         $this->caching = 1;
         $this->caching_type = 'newscoop';
         CampTemplateCache::factory();
     } else {
         $this->caching = 0;
     }
     if (self::isDevelopment()) {
         $this->force_compile = true;
     }
     // define dynamic uncached block
     require_once APPLICATION_PATH . self::PLUGINS . '/block.dynamic.php';
     $this->registerPlugin('block', 'dynamic', 'smarty_block_dynamic', false);
     // define render function
     require_once APPLICATION_PATH . self::PLUGINS . '/function.render.php';
     $this->registerPlugin('function', 'render', 'smarty_function_render', false);
     $this->left_delimiter = '{{';
     $this->right_delimiter = '}}';
     $this->auto_literal = false;
     $this->cache_dir = APPLICATION_PATH . '/../cache';
     $this->config_dir = APPLICATION_PATH . '/../configs';
     $this->compile_dir = APPLICATION_PATH . '/../cache';
     $this->plugins_dir = array_merge((array) $this->plugins_dir, array(APPLICATION_PATH . self::PLUGINS), self::getPluginsPluginsDir());
     $this->template_dir = array(APPLICATION_PATH . '/../themes/', APPLICATION_PATH . '/../themes/unassigned/system_templates/', APPLICATION_PATH . self::SCRIPTS);
     if (isset($GLOBALS['controller'])) {
         $this->assign('view', $GLOBALS['controller']->view);
     }
 }
Exemplo n.º 5
0
    /**
     * Set the article workflow on issue status change. Articles to be
     * published with the issue will be published on article publish.
     * Published articles are set to "publish with issue" on issue
     * unpublish.
     *
     * @param int $p_publicationId
     * @param int $p_languageId
     * @param int $p_issueNo
     * @param int $p_publish
     */
    public static function OnIssuePublish($p_publicationId, $p_languageId,
    $p_issueNo, $p_publish = true)
    {
        global $g_ado_db;

        settype($p_publicationId, 'integer');
        settype($p_languageId, 'integer');
        settype($p_issueNo, 'integer');

        $issueObj = new Issue($p_publicationId, $p_languageId, $p_issueNo);
        if (!$issueObj->exists()) {
            return false;
        }

        if (($issueObj->isPublished() && $p_publish)
        || (!$issueObj->isPublished() && !$p_publish)) {
            return false;
        }

        $fromState = $p_publish ? 'M' : 'Y';
        $toState = $p_publish ? 'Y' : 'M';

        $sql = "UPDATE Articles SET Published = '$toState' WHERE "
        . "IdPublication = $p_publicationId AND IdLanguage = $p_languageId"
        . " AND NrIssue = $p_issueNo AND Published = '$fromState'";
        $res = $g_ado_db->Execute($sql);

        CampCache::singleton()->clear('user');
        if (CampTemplateCache::factory()) {
            CampTemplateCache::factory()->update(array(
                'language' => $p_languageId,
                'publication' => $p_publicationId,
                'issue' => $p_issueNo,
                'section' => null,
                'article' => null,
            ));
        }
        return $res;
    }
Exemplo n.º 6
0
    ?>
"></a><?php 
}
// clear cache
$clearCache = Input::Get('clear_cache', 'string', 'no', true);
if ((CampCache::IsEnabled() || CampTemplateCache::factory()) && $clearCache == 'yes' && $g_user->hasPermission('ClearCache')) {
    // Clear cache engine's cache
    CampCache::singleton()->clear('user');
    CampCache::singleton()->clear();
    SystemPref::DeleteSystemPrefsFromCache();
    // Clear compiled templates
    require_once dirname(dirname(__FILE__)) . '/template_engine/classes/CampTemplate.php';
    CampTemplate::singleton()->clearCompiledTemplate();
    // Clear template cache storage
    if (CampTemplateCache::factory()) {
        CampTemplateCache::factory()->clean();
    }
    $actionMsg = getGS('Newscoop cache was cleaned up');
    $res = 'OK';
}
?>

<?php 
if (!empty($actionMsg)) {
    ?>
<script type="text/javascript">
$(function() {
    <?php 
    if ($res == 'OK') {
        ?>
    flashMessage('<?php 
Exemplo n.º 7
0
        $repository->flush();
    }
    $articleObj->setCommentsLocked($f_comment_status == "locked");
}
// Make sure that the time stamp is updated.
$articleObj->setProperty('time_updated', 'NOW()', true, true);
// Verify creation date is in the correct format.
// If not, dont change it.
if (preg_match("/\\d{4}-\\d{2}-\\d{2}/", $f_creation_date)) {
    $articleObj->setCreationDate($f_creation_date);
}
// Verify publish date is in the correct format.
// If not, dont change it.
if (preg_match("/\\d{4}-\\d{2}-\\d{2}/", $f_publish_date)) {
    $articleObj->setPublishDate($f_publish_date);
}
foreach ($articleFields as $dbColumnName => $text) {
    $articleTypeObj->setProperty($dbColumnName, $text);
}
Log::ArticleMessage($articleObj, $translator->trans('Content edited', array(), 'articles'), $g_user->getUserId(), 37);
ArticleIndex::RunIndexer(3, 10, true);
if (CampTemplateCache::factory()) {
    CampTemplateCache::factory()->update(array('language' => $articleObj->getLanguageId(), 'publication' => $articleObj->getPublicationId(), 'issue' => $articleObj->getIssueNumber(), 'section' => $articleObj->getSectionNumber(), 'article' => $articleObj->getArticleNumber()), !($articleObj->isPublished() || $articleObj->m_published));
}
$cacheService = \Zend_Registry::get('container')->getService('newscoop.cache');
$cacheService->clearNamespace('authors');
$cacheService->clearNamespace('article');
$cacheService->clearNamespace('article_type');
$cacheService->clearNamespace('boxarticles');
echo json_encode($data);
exit;
Exemplo n.º 8
0
    if (!$f_cache_engine || CampCache::IsSupported($f_cache_engine)) {
        SystemPref::Set('DBCacheEngine', $f_cache_engine);
        CampCache::singleton()->clear('user');
        CampCache::singleton()->clear();
    } else {
        $msg_ok = 0;
        camp_html_add_msg(getGS('Invalid: You need PHP $1 enabled in order to use the caching system.', $f_cache_engine));
    }
}

// Template Caching
if (SystemPref::Get('TemplateCacheHandler') != $f_template_cache_handler && $f_template_cache_handler) {
    $handler = CampTemplateCache::factory($f_template_cache_handler);
    if ($handler && CampTemplateCache::factory($f_template_cache_handler)->isSupported()) {
        SystemPref::Set('TemplateCacheHandler', $f_template_cache_handler);
        CampTemplateCache::factory($f_template_cache_handler)->clean();
    } else {
        $msg_ok = 0;
        camp_html_add_msg(getGS('Invalid: You need PHP $1 enabled in order to use the template caching system.'
            , $f_template_cache_handler));
    }
} else {
    SystemPref::Set('TemplateCacheHandler', $f_template_cache_handler);
}

// Image cache lifetime
SystemPref::Set('ImagecacheLifetime', $f_imagecache_lifetime);

// Secret key
SystemPref::Set('SiteSecretKey', $f_secret_key);
 /**
  * Sets templates caching.
  *
  * @param string                                   $cache_template Values 1 or 0
  * @param Symfony\Component\Translation\TranslatorInterface $translator     Translator
  *
  * @return void|RedirectResponse
  */
 private function templateCache($cache_template, $translator)
 {
     $preferencesService = $this->container->get('system_preferences_service');
     if ($preferencesService->TemplateCacheHandler != $cache_template && $cache_template) {
         $handler = \CampTemplateCache::factory($cache_template);
         if ($handler && \CampTemplateCache::factory($cache_template)->isSupported()) {
             $preferencesService->TemplateCacheHandler = $cache_template;
             \CampTemplateCache::factory($cache_template)->clean();
         } else {
             $this->get('session')->getFlashBag()->add('error', $translator->trans('newscoop.preferences.error.cache', array('%cache%' => $cache_template), 'system_pref'));
             return $this->redirect($this->generateUrl('newscoop_newscoop_systempref_index'));
         }
     } else {
         $preferencesService->TemplateCacheHandler = $cache_template;
     }
 }
Exemplo n.º 10
0
}
$crumbs = array();
$crumbs[] = array(getGS("Configure"), "");
$crumbs[] = array(getGS("System Preferences"), "");
echo camp_html_breadcrumbs($crumbs);
include_once $GLOBALS['g_campsiteDir'] . "/{$ADMIN_DIR}/javascript_common.php";
$htmlFormData['SiteTitle'] = htmlspecialchars(SystemPref::Get("SiteTitle"));
$htmlFormData['SiteMetaKeywords'] = htmlspecialchars(SystemPref::Get("SiteMetaKeywords"));
$htmlFormData['SiteMetaDescription'] = htmlspecialchars(SystemPref::Get("SiteMetaDescription"));
$htmlFormData['SiteSecretKey'] = htmlspecialchars(SystemPref::Get("SiteSecretKey"));
$max_upload_filesize = SystemPref::Get("MaxUploadFileSize");
if (empty($max_upload_filesize) || $max_upload_filesize == 0) {
    SystemPref::Set("MaxUploadFileSize", ini_get('upload_max_filesize'));
}
$availableCacheEngines = CacheEngine::AvailableEngines();
$availableTemplateCacheHandlers = CampTemplateCache::availableHandlers();
?>
<p></p>

<?php 
camp_html_display_msgs();
?>

<form action="/<?php 
echo $ADMIN;
?>
/system_pref/do_edit.php" onsubmit="return <?php 
camp_html_fvalidate();
?>
;" method="POST">
<?php 
Exemplo n.º 11
0
}

$menu_item =& DynMenuItem::Create(getGS('Change your password'),
    "/$ADMIN/users/edit.php?uType=Staff&User="******"/$ADMIN/articles/la_import.php",
            array("icon" => ''));
        $menu_actions->addItem($menu_item);
    }

    if ((CampCache::IsEnabled() || CampTemplateCache::factory()) && $g_user->hasPermission('ClearCache')) {
        $menu_item =& DynMenuItem::Create(getGS('Clear system cache'),
            "/$ADMIN/home.php?clear_cache=yes",
            array('icon' => ''));
        $menu_actions->addItem($menu_item);
    }

    if ($g_user->hasPermission('ManageBackup')) {
        $menu_item =& DynMenuItem::Create(getGS('Backup/Restore'),
            "/$ADMIN/backup.php",
            array('icon' => ''));
        $menu_actions->addItem($menu_item);
    }
}

// Creates the Configure menu