コード例 #1
0
 /**
  * Force SSL on live site.
  */
 public function init()
 {
     if (Director::isLive()) {
         Director::forceSSL();
     }
     parent::init();
 }
コード例 #2
0
 /**
  * Initialisierung
  *
  * @return void
  *
  * @author Sascha Koehler <*****@*****.**>
  * @since 02.12.2010
  */
 public function init()
 {
     if (SilvercartConfig::EnableSSL()) {
         Director::forceSSL();
     }
     parent::init();
 }
コード例 #3
0
 public function testForceSSLAlternateDomain()
 {
     Config::inst()->update('Director', 'alternate_base_url', '/');
     $_SERVER['REQUEST_URI'] = Director::baseURL() . 'admin';
     $output = Director::forceSSL(array('/^admin/'), 'secure.mysite.com');
     $this->assertEquals($output, 'https://secure.mysite.com/admin');
 }
コード例 #4
0
ファイル: DirectorTest.php プロジェクト: normann/sapphire
 public function testForceSSLWithPatternDoesNotMatchOtherPages()
 {
     $_SERVER['REQUEST_URI'] = Director::baseURL() . 'normal-page';
     $output = Director::forceSSL(array('/^admin/'));
     $this->assertFalse($output);
     $_SERVER['REQUEST_URI'] = Director::baseURL() . 'just-another-page/sub-url';
     $output = Director::forceSSL(array('/^admin/', '/^Security/'));
     $this->assertFalse($output);
 }
コード例 #5
0
 /**
  * statements to be called on object initialisation
  *
  * @author Roland Lehmann <*****@*****.**>
  * @since 18.11.2010
  * @return void
  */
 public function init()
 {
     if (SilvercartConfig::EnableSSL()) {
         Director::forceSSL();
     }
     Session::clear("redirect");
     //if customer has been to the checkout yet this is set to direct him back to the checkout after address editing
     parent::init();
     $this->registerCustomHtmlForm('SilvercartLoginForm', new SilvercartLoginForm($this));
 }
コード例 #6
0
global $project;
$project = 'mysite';
global $database;
//!!! YOU HAVE TO DEFINE YOUR DATABASE FIRST, MAN. !!!
$database = 'iowa-parents';
// Use _ss_environment.php file for configuration
require_once "conf/ConfigureFromEnv.php";
// Set the site locale
i18n::set_locale('en_US');
FulltextSearchable::enable();
// Enable nested URLs for this site (e.g. page/sub-page/)
if (class_exists('SiteTree')) {
    SiteTree::enable_nested_urls();
}
if (Director::isLive()) {
    Director::forceSSL();
}
Requirements::set_force_js_to_bottom(true);
// add a button to remove formatting
HtmlEditorConfig::get('cms')->insertButtonsBefore('styleselect', 'removeformat');
// tell the button which tags it may remove
HtmlEditorConfig::get('cms')->setOption('removeformat_selector', 'b,strong,em,i,span,ins');
//remove font->span conversion
HtmlEditorConfig::get('cms')->setOption('convert_fonts_to_spans', 'false,');
HtmlEditorConfig::get('cms')->setOptions(array('valid_elements' => "@[id|class|style|title],#a[id|rel|rev|dir|tabindex|accesskey|type|name|href|target|title|class],-strong/-b[class],-em/-i[class],-strike[class],-u[class],#p[id|dir|class|align|style],-ol[class],-ul[class],-li[class],br,img[id|dir|longdesc|usemap|class|src|border|alt=|title|width|height|align],-sub[class],-sup[class],-blockquote[dir|class],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|dir|id|style],-tr[id|dir|class|rowspan|width|height|align|valign|bgcolor|background|bordercolor|style],tbody[id|class|style],thead[id|class|style],tfoot[id|class|style],#td[id|dir|class|colspan|rowspan|width|height|align|valign|scope|style],-th[id|dir|class|colspan|rowspan|width|height|align|valign|scope|style],caption[id|dir|class],-h1[id|dir|class|align|style],-h2[id|dir|class|align|style],-h3[id|dir|class|align|style],-h4[id|dir|class|align|style],-h5[id|dir|class|align|style],-h6[id|dir|class|align|style],hr[class],dd[id|class|title|dir],dl[id|class|title|dir],dt[id|class|title|dir],@[id,style,class],small", 'extended_valid_elements' => "img[class|src|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|usemap],#iframe[src|name|width|height|align|frameborder|marginwidth|marginheight|scrolling],object[width|height|data|type],param[name|value],map[class|name|id],area[shape|coords|href|target|alt]"));
// TinyMCE cleanup on paste
HtmlEditorConfig::get('cms')->setOption('paste_auto_cleanup_on_paste', 'true');
HtmlEditorConfig::get('cms')->setOption('paste_remove_styles', 'true');
HtmlEditorConfig::get('cms')->setOption('paste_remove_styles_if_webkit', 'true');
HtmlEditorConfig::get('cms')->setOption('paste_strip_class_attributes', 'true');
GD::set_default_quality(80);
コード例 #7
0
 /**
  * Forces HTTPS mode if set in the configuration
  */
 private static function force_ssl()
 {
     $mode = self::config()->force_ssl;
     if (!is_bool($mode)) {
         user_error("Expected boolean in SSPSecurity::force_ssl", E_USER_ERROR);
     }
     if ($mode) {
         Director::forceSSL(null, $_SERVER['HTTP_HOST']);
     }
 }
コード例 #8
0
 /**
  * Initializes the step form. Includes forms and requirements.
  *
  * @return void
  *
  * @author Sebastian Diel <*****@*****.**>,
  *         Sascha Koehler <*****@*****.**>
  * @since 15.11.2014
  */
 public function init()
 {
     $this->preferences['templateDir'] = PIXELTRICKS_CHECKOUT_BASE_PATH_REL . 'templates/Layout/';
     if (SilvercartConfig::EnableSSL()) {
         Director::forceSSL();
     }
     parent::init();
     // Inject payment and shippingmethods to shoppingcart, if available
     $member = SilvercartCustomer::currentUser();
     if ($member) {
         $stepData = $this->getCombinedStepData();
         $shoppingCart = $member->getCart();
         // If minimum order value is set and shoppingcart value is below we
         // have to redirect the customer to the shoppingcart page and set
         // an appropriate error message.
         if ($this->getCurrentStep() < 5 && SilvercartConfig::UseMinimumOrderValue() && SilvercartConfig::MinimumOrderValue() && SilvercartConfig::MinimumOrderValue()->getAmount() > $shoppingCart->getAmountTotalWithoutFees()->getAmount()) {
             $silvercartSessionErrors = Session::get('Silvercart.errors');
             $silvercartSessionErrors[] = sprintf(_t('SilvercartShoppingCart.ERROR_MINIMUMORDERVALUE_NOT_REACHED'), SilvercartConfig::MinimumOrderValue()->Nice());
             Session::set('Silvercart.errors', $silvercartSessionErrors);
             Session::save();
             $this->redirect(SilvercartPage_Controller::PageByIdentifierCode('SilvercartCartPage')->Link());
         }
         if (isset($stepData['ShippingMethod'])) {
             $shoppingCart->setShippingMethodID($stepData['ShippingMethod']);
         }
         if (isset($stepData['PaymentMethod'])) {
             $shoppingCart->setPaymentMethodID($stepData['PaymentMethod']);
         }
         $requestParams = $this->getRequest()->allParams();
         if ($requestParams['Action'] == 'editAddress') {
             $addressID = (int) $requestParams['ID'];
             $membersAddresses = SilvercartCustomer::currentUser()->SilvercartAddresses();
             $membersAddress = $membersAddresses->find('ID', $addressID);
             if ($membersAddress instanceof SilvercartAddress && $membersAddress->exists()) {
                 Session::set("redirect", $this->Link());
                 $preferences = array();
                 $preferences['submitAction'] = 'editAddress/' . $addressID . '/customHtmlFormSubmit';
                 $this->registerCustomHtmlForm('SilvercartEditAddressForm', new SilvercartEditAddressForm($this, array('addressID' => $addressID), $preferences));
             }
         } elseif ($requestParams['Action'] == 'addNewAddress') {
             Session::set("redirect", $this->Link());
             $preferences = array();
             $preferences['submitAction'] = 'addNewAddress/customHtmlFormSubmit';
             $this->registerCustomHtmlForm('SilvercartAddAddressForm', new SilvercartAddAddressForm($this, array(), $preferences));
         }
     }
 }
コード例 #9
0
ファイル: _config.php プロジェクト: Thingee/openstack-org
// Use _ss_environment.php file for configuration
require_once "conf/ConfigureFromEnv.php";
// Register custom site configuration extension
DataObject::add_extension('SiteConfig', 'CustomSiteConfig');
// Set the site locale
i18n::set_locale('en_US');
//Turn on Silverstripe Translation
Object::add_extension('SiteTree', 'Translatable');
Object::add_extension('SiteConfig', 'Translatable');
Translatable::set_allowed_locales(array('en_US', 'de_DE', 'es_ES', 'ja_JP'));
//Turn on Silverstripe Translation
// Search index for Orgs
Object::add_extension('Org', 'AutocompleteOrgDecorator');
// Enable SSL for specific subdomains
if (Director::isLive()) {
    Director::forceSSL(array('/^Security/', '/^profile/', '/^join/', '/^user-survey/', '/^summit/', '/^news-manage/', '/^vote-vancouver/'));
}
// Email errors and warnings
global $email_log;
SS_Log::add_writer(new SS_LogFileWriter(Director::baseFolder() . '/logs/site.log'), SS_Log::ERR);
$email_log_writer = new Custom_SS_LogEmailWriter($email_log);
$email_log_writer->setFormatter(new SS_CustomLogErrorEmailFormatter());
SS_Log::add_writer($email_log_writer, SS_Log::ERR, '<=');
// Default From address for email
global $email_from;
Config::inst()->update('Email', 'admin_email', $email_from);
//Register Shortcodes
ShortcodeParser::get()->register('Sched', array('Page', 'SchedShortCodeHandler'));
ShortcodeParser::get()->register('outlink', array('Page', 'ExternalLinkShortCodeHandler'));
ShortcodeParser::get()->register('icon', array('Page', 'IconShortCodeHandler'));
//cache configuration
コード例 #10
0
 /**
  * initialisation of the form object
  * logged in members get logged out
  *
  * @author Sascha Koehler <*****@*****.**> Roland Lehmann <*****@*****.**>
  * @since 20.10.2010
  * @return void
  */
 public function init()
 {
     if (SilvercartConfig::EnableSSL()) {
         Director::forceSSL();
     }
     $this->registerCustomHtmlForm('SilvercartRegisterRegularCustomerForm', new SilvercartRegisterRegularCustomerForm($this));
     parent::init();
 }