Ejemplo n.º 1
0
 /**
  * Add a LeftAndMain controller to the CMS menu.
  *
  * @param string $controllerClass The class name of the controller
  * @return The result of the operation
  * @todo A director rule is added when a controller link is added, but it won't be removed
  *			when the item is removed. Functionality needed in {@link Director}.
  */
 public static function add_controller($controllerClass)
 {
     // Get static bits
     $urlBase = eval("return {$controllerClass}::\$url_base;");
     $urlSegment = eval("return {$controllerClass}::\$url_segment;");
     $urlRule = eval("return {$controllerClass}::\$url_rule;");
     $urlPriority = eval("return {$controllerClass}::\$url_priority;");
     $menuPriority = eval("return {$controllerClass}::\$menu_priority;");
     // Don't add menu items defined the old way
     if ($urlSegment === null) {
         return;
     }
     $link = Controller::join_links($urlBase, $urlSegment) . '/';
     // Make director rule
     if ($urlRule[0] == '/') {
         $urlRule = substr($urlRule, 1);
     }
     $rule = $link . '/' . $urlRule;
     // the / will combine with the / on the end of $link to make a //
     Director::addRules($urlPriority, array($rule => $controllerClass));
     // doesn't work if called outside of a controller context (e.g. in _config.php)
     // as the locale won't be detected properly. Use {@link LeftAndMain->MainMenu()} to update
     // titles for existing menu entries
     $defaultTitle = LeftAndMain::menu_title_for_class($controllerClass);
     $menuTitle = _t("{$controllerClass}.MENUTITLE", $defaultTitle);
     // Add menu item
     return self::add_menu_item($controllerClass, $menuTitle, $link, $controllerClass, $menuPriority);
 }
 function setUp()
 {
     parent::setUp();
     // Hold the original request URI once so it doesn't get overwritten
     if (!self::$originalRequestURI) {
         self::$originalRequestURI = $_SERVER['REQUEST_URI'];
     }
     Director::addRules(99, array('DirectorTestRule/$Action/$ID/$OtherID' => 'DirectorTestRequest_Controller'));
 }
Ejemplo n.º 3
0
    {
        $data = array('action_allowedformaction' => 1);
        $response = $this->post('RequestHandlingTest_ControllerFormWithAllowedActions/Form', $data);
        $this->assertEquals(200, $response->getStatusCode());
        $this->assertEquals('allowedformaction', $response->getBody());
        $data = array('action_disallowedformaction' => 1);
        $response = $this->post('RequestHandlingTest_ControllerFormWithAllowedActions/Form', $data);
        $this->assertEquals(403, $response->getStatusCode());
        // Note: Looks for a specific 403 thrown by Form->httpSubmission(), not RequestHandler->handleRequest()
        $this->assertContains('not allowed on form', $response->getBody());
    }
}
/**
 * Director rules for the test
 */
Director::addRules(50, array('testGoodBase1' => "RequestHandlingTest_Controller", 'testGoodBase2//$Action/$ID/$OtherID' => "RequestHandlingTest_Controller", 'testBadBase/$Action/$ID/$OtherID' => "RequestHandlingTest_Controller", 'testBaseWithExtension/virtualfile.xml' => "RequestHandlingTest_Controller", 'testBaseWithExtension//$Action/$ID/$OtherID' => "RequestHandlingTest_Controller", 'testParentBase/testChildBase//$Action/$ID/$OtherID' => "RequestHandlingTest_Controller"));
/**
 * Controller for the test
 */
class RequestHandlingTest_Controller extends Controller implements TestOnly
{
    static $url_handlers = array('$Action//$ID/$OtherID' => "handleAction");
    static $extensions = array('RequestHandlingTest_ControllerExtension', 'RequestHandlingTest_AllowedControllerExtension');
    function __construct()
    {
        $this->failover = new RequestHandlingTest_ControllerFailover();
        parent::__construct();
    }
    function index($request)
    {
        return "This is the controller";
<?php

define('SIMPLEWIKI_DIR', dirname(__FILE__));
Director::addRules(100, array('ssimplewiki/$Action' => 'WikiPage_Controller'));
if (($SIMPLEWIKI_EDITING_MODULE = basename(dirname(__FILE__))) != 'simplewiki') {
    die("The SimpleWiki module MUST be in the /simplewiki directory, not {$SIMPLEWIKI_EDITING_MODULE}");
}
//HtmlEditorConfig::get('default')->enablePlugins(array('sslinks' => '../../../simplewiki/javascript/sslinks/editor_plugin_src.js'));
HtmlEditorConfig::get('default')->insertButtonsBefore('advcode', 'ss_simplelink', 'unlink', 'ss_simpleimage');
// PERMISSION CONSTANTS
// To use these permissions, you MUST grant your wiki editor group the ability
// to  View draft content as well as the edit wiki pages.
define('EDIT_WIKI', 'EDIT_WIKI');
define('MANAGE_WIKI_PAGES', 'MANAGE_WIKI_PAGES');
// Registration of wiki formatters
WikiPage::register_formatter(new MarkdownFormatter());
//WikiPage::register_formatter(new HTMLFormatter());
WikiPage::register_formatter(new WikiFormatter());
//WikiPage::register_formatter(new PlainFormatter());
// Example configuration options below
/*
WikiPage::$show_edit_button = true; // | false - whether public users get an edit link when viewing a wikipage
WikiPage::$auto_publish = true; // | false - whether pages are automatically published when saved/created
*/
Ejemplo n.º 5
0
<?php

Director::addRules(50, array(Payment_Controller::$URLSegment . '/$Action/$ID' => 'Payment_Controller'));
<?php

Director::addRules(50, array('createecommercevariations/$Action/$ProductID' => 'CreateEcommerceVariations', 'createecommercevariationsbatch/$Action' => 'CreateEcommerceVariations_Batch'));
Buyable::add_class("ProductVariation");
Object::add_extension("Product", "ProductWithVariationDecorator");
Object::add_extension("Product_Controller", "ProductWithVariationDecorator_Controller");
Object::add_extension("ProductBulkLoader", "ProductVariationBulkLoader");
Product_Controller::$allowed_actions[] = 'VariationForm';
Product_Controller::$allowed_actions[] = 'addvariation';
LeftAndMain::require_javascript(THIRDPARTY_DIR . "/jquery/jquery.js");
LeftAndMain::require_javascript(THIRDPARTY_DIR . "/jquery-livequery/jquery.livequery.js");
LeftAndMain::require_javascript("ecommerce_product_variation/javascript/CreateEcommerceVariationsField.js");
LeftAndMain::require_themed_css("CreateEcommerceVariationsField");
ProductsAndGroupsModelAdmin::$model_importers['ProductVariation'] = null;
//copy the lines between the START AND END line to your /mysite/_config.php file and choose the right settings
// __________________________________ START ECOMMERCE PRODUCT VARIATIONS MODULE CONFIG __________________________________
//____________HIGHLY RECOMMENDED
//ProductsAndGroupsModelAdmin::add_managed_model("ProductAttributeValue");
//ProductsAndGroupsModelAdmin::add_managed_model("ProductAttributeType");
//ProductsAndGroupsModelAdmin::add_managed_model("ProductVariation");
//____________ADD TO CART FORM INTERACTION
//ProductWithVariationDecorator_Controller::set_use_js_validation(false);
//ProductWithVariationDecorator_Controller::set_alternative_validator_class_name("MyValidatorClass");
//____________EASY SORTING - REQUIRES: http://sunny.svnrepository.com/svn/sunny-side-up-general/dataobjectsorter
//Object::add_extension('ProductAttributeValue', 'DataObjectSorterDOD');
//Object::add_extension('ProductAttributeType', 'DataObjectSorterDOD');
//DataObjectSorterDOD::set_also_update_sort_field(true);
//DataObjectSorterDOD::set_do_not_add_alternative_sort_field(true);
//____________CUSTOMISED CMS INTERACTION
//LeftAndMain::require_javascript("mysite/javascript/MyCreateEcommerceVariationsField.js");
//____________COLOUR OPTIONS
Ejemplo n.º 7
0
<?php

Director::addRules(50, array(WorldpayPayment_Handler::$URLSegment . '/$Action/$ID' => 'WorldpayPayment_Handler', PayPalPayment_Handler::$URLSegment . '/$Action/$ID' => 'PayPalPayment_Handler'));
Object::add_extension('Member', 'PayerHavingReceipt');
<?php

global $project;
$project = 'mysite';
global $database;
$database = 'SS_ssnewdocstest';
require_once 'conf/ConfigureFromEnv.php';
MySQLDatabase::set_connection_charset('utf8');
// This line set's the current theme. More themes can be
// downloaded from http://www.silverstripe.org/themes/
SSViewer::set_theme('docs');
// enable nested URLs for this site (e.g. page/sub-page/)
SiteTree::enable_nested_urls();
// render the user documentation first
Director::addRules(20, array('Security//$Action/$ID/$OtherID' => 'Security'));
DocumentationViewer::set_link_base('');
DocumentationViewer::$check_permission = false;
Director::addRules(10, array('$Action' => 'DocumentationViewer', '' => '->current/en/cms'));
DocumentationService::set_automatic_registration(false);
DocumentationService::register("cms", realpath("../../master/cms/docs/"), '2.4');
// We want this to be reviewed by the whole community
BasicAuth::protect_entire_site(false);
<?php

Object::add_extension('SiteConfig', 'SLSiteConfig');

Director::addRules(100,
	array(
		'leg//$Action/$Query' => 'SLCongressController'
	)
);
Ejemplo n.º 10
0
 * Here you can make different settings for the Sapphire module (the core
 * module).
 *
 * For example you can register the authentication methods you wish to use
 * on your site, e.g. to register the OpenID authentication method type
 *
 * <code>
 * Authenticator::register_authenticator('OpenIDAuthenticator');
 * </code>
 *
 * @package sapphire
 * @subpackage core
 */
// Default director
Director::addRules(10, array('Security//$Action/$ID/$OtherID' => 'Security', 'db//$Action' => 'DatabaseAdmin', '$Controller//$Action/$ID/$OtherID' => '*', '' => 'RootURLController', 'api/v1/live' => 'VersionedRestfulServer', 'api/v1' => 'RestfulServer', 'soap/v1' => 'SOAPModelAccess', 'dev' => 'DevelopmentAdmin', 'interactive' => 'SapphireREPL'));
Director::addRules(1, array('$URLSegment//$Action/$ID/$OtherID' => 'ModelAsController'));
/**
 * Register the default internal shortcodes.
 */
ShortcodeParser::get('default')->register('sitetree_link', array('SiteTree', 'link_shortcode_handler'));
/**
 * PHP 5.2 introduced a conflict with the Datetime field type, which was renamed to SSDatetime. This was later renamed
 * to SS_Datetime to be consistent with other namespaced classes.
 *
 * Overload both of these to support legacy code.
 */
Object::useCustomClass('SSDatetime', 'SS_Datetime', true);
Object::useCustomClass('Datetime', 'SS_Datetime', true);
/**
 * The root directory of TinyMCE
 */
Ejemplo n.º 11
0
<?php

// adds a rule to make www.site.com/sitemap.xml work
Director::addRules(10, array('sitemap.xml' => 'GoogleSitemap'));
// add the extension
Object::add_extension('SiteTree', 'GoogleSitemapDecorator');
Ejemplo n.º 12
0
	/**
	 * Add the appropriate Director rules for the given controller.
	 */
	protected static function add_director_rule_for_controller($controllerClass) {
		$urlBase      = Config::inst()->get($controllerClass, 'url_base', Config::FIRST_SET);
		$urlSegment   = Config::inst()->get($controllerClass, 'url_segment', Config::FIRST_SET);
		$urlRule      = Config::inst()->get($controllerClass, 'url_rule', Config::FIRST_SET);
		$urlPriority  = Config::inst()->get($controllerClass, 'url_priority', Config::FIRST_SET);

		if($urlSegment || $controllerClass == 'CMSMain') {
			$link = Controller::join_links($urlBase, $urlSegment) . '/';
		
			// Make director rule
			if($urlRule[0] == '/') $urlRule = substr($urlRule,1);
			$rule = $link . '/' . $urlRule; // the / will combine with the / on the end of $link to make a //
			Director::addRules($urlPriority, array(
				$rule => $controllerClass
			));
		}
	}
Ejemplo n.º 13
0
<?php

/*
 * This file is needed to identify this as a SilverStripe module 
 */
// Extend the Member with e-commerce related fields.
DataObject::add_extension('Member', 'EcommerceRole');
// Extend Payment with e-commerce relationship.
DataObject::add_extension('Payment', 'EcommercePayment');
Director::addRules(50, array(ShoppingCart_Controller::$URLSegment . '/$Action/$ID' => 'ShoppingCart_Controller'));
<?php

// Example configuration:
/*
if(Director::isLive()){
	Email::setAdminEmail(<my_live_email>);
	DPSHostedPayment::set_px_pay_userid(<my_live_id>);
	DPSHostedPayment::set_px_pay_key(<my_live_key>);
}else{
	Email::setAdminEmail(<my_test_email>);
	DPSHostedPayment::set_px_pay_userid(<my_test_id>);
	DPSHostedPayment::set_px_pay_key(<my_test_key>);
}
*/
Director::addRules(100, array('DPSHostedPayment/$Action/$ID' => 'DPSHostedPayment_Controller'));
Ejemplo n.º 15
0
<?php

Director::addRules(100, array('SlickMap/$Action/$ID/$OtherID' => 'SlickMap_Controller'));
SlickMap::$title = "Sitemap";
<?php

Member::add_extension('FrameworkTestRole');
Member::add_extension('FileUploadRole');
SiteTree::add_extension('FrameworkTestSiteTreeExtension');
File::add_extension('FrameworkTestFileExtension');
if (class_exists('SiteTreeCMSWorkflow')) {
    SiteConfig::add_extension('CMSWorkflowSiteConfigDecorator');
    CMSWorkflowSiteConfigDecorator::apply_active_config();
}
Director::addRules(100, array('dev/regress/$Action/$ID' => 'FrameworktestRegressSessionAdmin'));
if (@$_GET['db']) {
    $enabletranslatable = @$_GET['enabletranslatable'];
} elseif (@$_SESSION['db']) {
    $enabletranslatable = @$_SESSION['enabletranslatable'];
} else {
    $enabletranslatable = null;
}
if ($enabletranslatable) {
    SiteTree::add_extension('Translatable');
    SiteConfig::add_extension('Translatable');
}
Ejemplo n.º 17
0
 /**
  * Add the appropriate Director rules for the given controller.
  */
 protected static function add_director_rule_for_controller($controllerClass)
 {
     $urlBase = Object::get_static($controllerClass, 'url_base');
     $urlSegment = Object::get_static($controllerClass, 'url_segment');
     $urlRule = Object::get_static($controllerClass, 'url_rule');
     $urlPriority = Object::get_static($controllerClass, 'url_priority');
     if ($urlSegment || $controllerClass == "CMSMain") {
         $link = Controller::join_links($urlBase, $urlSegment) . '/';
         // Make director rule
         if ($urlRule[0] == '/') {
             $urlRule = substr($urlRule, 1);
         }
         $rule = $link . '/' . $urlRule;
         // the / will combine with the / on the end of $link to make a //
         Director::addRules($urlPriority, array($rule => $controllerClass));
     }
 }
Ejemplo n.º 18
0
 * module).
 *
 * For example you can register the authentication methods you wish to use
 * on your site, e.g. to register the OpenID authentication method type
 *
 * <code>
 * Authenticator::register_authenticator('OpenIDAuthenticator');
 * </code>
 *
 * @package sapphire
 * @subpackage core
 */
// Default director
Director::addRules(10, array('Security//$Action/$ID/$OtherID' => 'Security', 'db//$Action' => 'DatabaseAdmin', '$Controller//$Action/$ID/$OtherID' => '*', 'api/v1/live' => 'VersionedRestfulServer', 'api/v1' => 'RestfulServer', 'soap/v1' => 'SOAPModelAccess', 'dev' => 'DevelopmentAdmin', 'interactive' => 'SapphireREPL'));
// Add default routing unless 'cms' module is present (which overrules this with a CMSMain controller)
Director::addRules(20, array('admin//$action/$ID/$OtherID' => '->admin/security'));
/**
 * PHP 5.2 introduced a conflict with the Datetime field type, which was renamed to SSDatetime. This was later renamed
 * to SS_Datetime to be consistent with other namespaced classes.
 *
 * Overload both of these to support legacy code.
 */
Object::useCustomClass('SSDatetime', 'SS_Datetime', true);
Object::useCustomClass('Datetime', 'SS_Datetime', true);
/**
 * The root directory of TinyMCE
 */
define('MCE_ROOT', 'sapphire/thirdparty/tinymce/');
/**
 * The secret key that needs to be sent along with pings to /Email_BounceHandler
 *
<?php

require_once dirname(__FILE__) . '/_sync_types.php';
define('SYNC_MODULE_FOLDER', dirname(__FILE__));
// Set up a route manually. I don't know of a better way to
// do this while still allowing the url segment to change.
// Pull requests welcome if there is a way.
if (Config::inst()->get('SyncController', 'url_segment') != 'sync') {
    Director::addRules(100, array(Config::inst()->get('SyncController', 'url_segment') . '/$SyncContext' => 'SyncController'));
}
Ejemplo n.º 20
0
global $databaseConfig;
$databaseConfig = array(
	"type" => "MySQLDatabase",
	"server" => "localhost", 
	"username" => "root", 
	"password" => "", 
	"database" => "SS_mysite",
);

// Sites running on the following servers will be
// run in development mode. See
// http://doc.silverstripe.com/doku.php?id=devmode
// for a description of what dev mode does.
Director::set_dev_servers(array(
	'localhost',
	'127.0.0.1',
));

// This line set's the current theme. More themes can be
// downloaded from http://www.silverstripe.com/themes/
SSViewer::set_theme('mysite');

// Default administrator account for the CMS
Security::setDefaultAdmin('admin', 'password');

// Add rules for CommunityAdmin interface
Director::addRules(100, array(
	'admin/community' => 'CommunityAdmin',
));
?>
<?php

Director::addRules(100, array('dev/docs' => 'DocumentationViewer'));
Ejemplo n.º 22
0
    error_reporting(E_ALL);
    SSViewer::flush_template_cache();
    Debug::log_errors_to('err.log');
}
//(v2.4) Log errors to an email address
//SS_Log::add_writer(new SS_LogEmailWriter('*****@*****.**'), SS_Log::ERR);
//
//(v2.4) Log errors to a file
//SS_Log::add_writer(new SS_LogFileWriter('error_log.txt'), SS_Log::ERR);
//
/**
 * Extended URL rules for the CMS module
 * 
 * @package cms
 */
Director::addRules(50, array('processes//$Action/$ID/$Batch' => 'BatchProcess_Controller', 'admin/help//$Action/$ID' => 'CMSHelp', 'admin/bulkload//$Action/$ID/$OtherID' => 'BulkLoaderAdmin', 'admin/cms//$Action/$ID/$OtherID' => 'CMSMain', 'PageComment//$Action/$ID' => 'PageComment_Controller', 'dev/buildcache/$Action' => 'RebuildStaticCacheTask'));
CMSMenu::add_director_rules();
// Default CMS HTMLEditorConfig
HtmlEditorConfig::get('cms')->setOptions(array('friendly_name' => 'Default CMS', 'priority' => '50', 'mode' => 'none', 'language' => i18n::get_tinymce_lang(), 'body_class' => 'typography', 'document_base_url' => Director::absoluteBaseURL(), 'urlconverter_callback' => "nullConverter", 'setupcontent_callback' => "sapphiremce_setupcontent", 'cleanup_callback' => "sapphiremce_cleanup", 'use_native_selects' => true, '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],-div[id|dir|class|align|style],-span[class|align|style],-pre[class|align],address[class|align],-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]", '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]"));
HtmlEditorConfig::get('cms')->enablePlugins('media', 'fullscreen');
HtmlEditorConfig::get('cms')->enablePlugins(array('ssbuttons' => '../../../cms/javascript/tinymce_ssbuttons/editor_plugin_src.js'));
HtmlEditorConfig::get('cms')->insertButtonsBefore('formatselect', 'styleselect');
HtmlEditorConfig::get('cms')->insertButtonsBefore('advcode', 'ssimage', 'ssflash', 'sslink', 'unlink', 'anchor', 'separator');
HtmlEditorConfig::get('cms')->insertButtonsAfter('advcode', 'fullscreen', 'separator');
HtmlEditorConfig::get('cms')->removeButtons('tablecontrols');
HtmlEditorConfig::get('cms')->addButtonsToLine(3, 'tablecontrols');
// Register default side reports
SS_Report::register("SideReport", "SideReport_EmptyPages");
SS_Report::register("SideReport", "SideReport_RecentlyEdited");
SS_Report::register("SideReport", "SideReport_ToDo");
if (class_exists('SubsiteReportWrapper')) {
Ejemplo n.º 23
0
        }
        $testPath = dirname($testPath);
    }
}
if (ManifestBuilder::staleManifest()) {
    ManifestBuilder::compileManifest();
}
require_once MANIFEST_FILE;
if (isset($_GET['debugmanifest'])) {
    Debug::show(file_get_contents(MANIFEST_FILE));
}
if (!isset(Director::$environment_type)) {
    Director::set_environment_type($envType);
}
// Default director
Director::addRules(10, array('Security/$Action' => 'Security', 'db/$Action' => 'DatabaseAdmin', '$Controller/$Action/$ID/$OtherID' => '*', 'images/$Action/$Class/$ID/$Field' => 'Image_Uploader', '' => '->home/', '$URLSegment/$Action/$ID/$OtherID' => 'ModelAsController'));
// Load error handlers
Debug::loadErrorHandlers();
// Connect to database
require_once "core/model/DB.php";
DB::connect($databaseConfig);
// Get the request URL
// $baseURL = dirname(dirname($_SERVER[SCRIPT_NAME]));
$url = $_SERVER['argv'][1];
if (isset($_SERVER['argv'][2])) {
    parse_str($_SERVER['argv'][2], $_GET);
    $_REQUEST = $_GET;
    print_r($_GET);
}
// Direct away - this is the "main" function, that hands control to the apporopriate controllerx
Director::direct($url);
Ejemplo n.º 24
0
<?php

Director::addRules(20, array('adclick//$Action/$ID' => 'AdController'));
Ejemplo n.º 25
0
    public function getBirthdayYear()
    {
        return $this->Birthday ? date('Y', strtotime($this->Birthday)) : null;
    }
}
class FormTest_Team extends DataObject implements TestOnly
{
    static $db = array('Name' => 'Varchar', 'Region' => 'Varchar');
    static $many_many = array('Players' => 'FormTest_Player');
}
class FormTest_Controller extends Controller
{
    static $url_handlers = array('$Action//$ID/$OtherID' => "handleAction");
    protected $template = 'BlankPage';
    function Link($action = null)
    {
        return Controller::join_links('FormTest_Controller', $this->request->latestParam('Action'), $this->request->latestParam('ID'), $action);
    }
    function Form()
    {
        $form = new Form($this, 'Form', new FieldSet(new EmailField('Email'), new TextField('SomeRequiredField'), new CheckboxSetField('Boxes', null, array('1' => 'one', '2' => 'two'))), new FieldSet(new FormAction('doSubmit')), new RequiredFields('Email', 'SomeRequiredField'));
        return $form;
    }
    function doSubmit($data, $form, $request)
    {
        $form->sessionMessage('Test save was successful', 'good');
        return $this->redirectBack();
    }
}
Director::addRules(50, array('FormTest_Controller' => "FormTest_Controller"));
Ejemplo n.º 26
0
<?php

/**
 * Nested Urls SilverStripe Module
 * Config file
 * @author James Muir <*****@*****.**>
 * @copyright Copyright (c) 2009, James Muir
 */
/**
 * Add Extension to SiteTree class
 */
Object::add_extension('SiteTree', 'NestedUrlPageExtension');
Object::add_extension('ContentController', 'NestedUrlControllerExtension');
/**
 * Add Rules to director (once page is found, will fall back to ModelAsController)
 */
Director::addRules(2, array('$url1/$url2/$url3/$url4/$url5/$url6/$url7/$url8/$url9' => 'NestedUrlController'));
<?php

if (($RESTRICTED_OBJECTS_DIR = basename(dirname(__FILE__))) != 'restrictedobjects') {
    die("The restricted objects module must be installed in /restrictedobjects, not {$RESTRICTED_OBJECTS_DIR}");
}
if (!class_exists('MultiValueField')) {
    die('The restricted objects module requires the multivaluefield module from http://github.com/nyeholt/silverstripe-multivaluefield');
}
Director::addRules(100, array('Security/logout' => 'RestrictedSecurityController'));
Object::add_extension('Member', 'RestrictedMember');
// if we're in Dev, and have set "no initial checks", which is common during testing, disable perms
if ((Director::isDev() || Director::is_cli()) && isset($_GET['disable_perms'])) {
    Restrictable::set_enabled(false);
}
SS_Cache::set_cache_lifetime('restricted_perms', 3600);
<?php

DataObject::add_extension('SiteConfig', 'RiskAssessmentSiteConfig');
DataObject::add_extension('RiskWorksheet', 'WorkflowApplicable');
DataObject::add_extension('SiteTree', 'WorkflowApplicable');
Director::addRules(20, array('worksheets//$Action/$ID/$OtherID' => 'WorksheetController'));
<?php

/**
 * Secure Files Module Configuration
 *
 * @package securefiles
 * @author Hamish Campbell <*****@*****.**>
 * @copyright copyright (c) 2010, Hamish Campbell
 */
define('MODULE_SECUREFILES_PATH', basename(dirname(__FILE__)));
Director::addRules(50, array(ASSETS_DIR . '/$Action' => 'SecureFileController'));
AssetAdmin::require_css(MODULE_SECUREFILES_PATH . '/css/SecureFiles.css');
// -------------------------------
/**
 *  Apply optional permission methods here. Include them in the reverse
 *  order that you would like them to appear in the CMS.
 */
// Assign file security by individual member:
// DataObject::add_extension('File', 'SecureFileMemberPermissionDecorator');
// Assign file security by member group:
// DataObject::add_extension('File', 'SecureFileGroupPermissionDecorator');
// Create time-limited access tokens:
// DataObject::add_extension('File', 'SecureFileTokenPermissionDecorator');
// -------------------------------
DataObject::add_extension('File', 'SecureFileDecorator');
/**
 * For large files or heavily trafficed sites use x-sendfile headers to by-pass
 * file handling in PHP. Supported in lighttpd and in Apache with mod_xsendfile
 * available at http://tn123.ath.cx/mod_xsendfile/
 */
// SecureFileController::use_x_sendfile_method();
<?php

Director::addRules(50, array(OgonePayment_Handler::get_url_segment() . '//$Action/$ID/$OtherID' => 'OgonePayment_Handler'));
// copy to myste/_config and set as required...
// __________________________________ START OGONE PAYMENT MODULE CONFIG __________________________________
//DO NOT FORGET...
//Payment::set_site_currency('NZD');
//Payment::set_supported_methods(array('OgonePayment' => 'Ogone Payment'));
// MUST SET
//if(Director::isLive()) {
//OgonePayment::set_test_mode(false);
//OgonePayment::set_sha_passphrase("hello");
//}
//else {
//OgonePayment::set_test_mode(true);
//OgonePayment::set_sha_passphrase("hello");
//}
//OgonePayment::set_account_pspid("myaccountcode");
//HIGLY RECOMMENDED TO SET
//OgonePayment::set_logos_to_show_array(array("visa", "master-card", "maestro", "iDeal", "paypal"); // may also be an associative array with code and filename , e.g. "visa" => "mysite/images/MyVisaLogo.gif"
//OgonePayment::set_payment_options_array(array('CredtiCard' => 'Credit Card','iDeal' => 'iDeal','PayPal' => 'Paypal'));
//OgonePayment::add_payment_option($key, $title);
//OgonePayment::remove_payment_option($key) ;
//  FORMATTING
//OgonePayment::set_page_title("");
//OgonePayment::set_back_color();
//OgonePayment::set_text_color();
//OgonePayment::set_table_back_color();
//OgonePayment::set_table_text_color();
//OgonePayment::set_button_back_color();
//OgonePayment::set_button_text_color();