protected function handleAction($filterChain, $actionInstance)
 {
     $moduleName = $actionInstance->getModuleName();
     $actionName = $actionInstance->getActionName();
     $request = $actionInstance->getRequest();
     if ($request->needToRedirectToSoftBankGateway()) {
         $request->redirectToSoftBankGateway();
     }
     $this->handleSsl($actionInstance);
     $dispatcher = sfContext::getInstance()->getEventDispatcher();
     // sfDoctrinePlugin needs to notify this event for enabling i18n
     $dispatcher->notify(new sfEvent($this, 'user.change_culture', array('culture' => sfContext::getInstance()->getUser()->getCulture())));
     self::notifyPreExecuteActionEvent($this, $dispatcher, $actionInstance);
     Doctrine::getTable('SnsTerm')->configure(sfContext::getInstance()->getUser()->getCulture(), sfConfig::get('sf_app'));
     if (sfConfig::has('op_is_use_captcha')) {
         sfConfig::set('op_is_use_captcha', opConfig::get('is_use_captcha'));
     }
     try {
         $result = parent::handleAction($filterChain, $actionInstance);
     } catch (opRuntimeException $e) {
         $this->forwardToErrorAction();
     } catch (sfValidatorErrorSchema $e) {
         if (isset($e['_csrf_token'])) {
             $this->forwardToCSRFErrorAction();
         }
         throw $e;
     }
     self::notifyPostExecuteActionEvent($this, $dispatcher, $actionInstance, $result);
     return $result;
 }
 /**
  * @see sfPluginConfiguration
  */
 public function initialize()
 {
     sfConfig::set('sf_orm', 'doctrine');
     if (!sfConfig::get('sf_admin_module_web_dir')) {
         sfConfig::set('sf_admin_module_web_dir', '/sfDoctrinePlugin');
     }
     if (sfConfig::get('sf_web_debug')) {
         require_once dirname(__FILE__) . '/../lib/debug/sfWebDebugPanelDoctrine.class.php';
         $this->dispatcher->connect('debug.web.load_panels', array('sfWebDebugPanelDoctrine', 'listenToAddPanelEvent'));
     }
     if (!sfConfig::has('sf_doctrine_dir')) {
         // for BC
         if (sfConfig::has('sfDoctrinePlugin_doctrine_lib_path')) {
             sfConfig::set('sf_doctrine_dir', realpath(dirname(sfConfig::get('sfDoctrinePlugin_doctrine_lib_path'))));
         } else {
             sfConfig::set('sf_doctrine_dir', realpath(dirname(__FILE__) . '/../lib/vendor/doctrine'));
         }
     }
     require_once sfConfig::get('sf_doctrine_dir') . '/Doctrine.php';
     spl_autoload_register(array('Doctrine', 'autoload'));
     $manager = Doctrine_Manager::getInstance();
     $manager->setAttribute(Doctrine::ATTR_EXPORT, Doctrine::EXPORT_ALL);
     $manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_NONE);
     $manager->setAttribute(Doctrine::ATTR_RECURSIVE_MERGE_FIXTURES, true);
     $manager->setAttribute(Doctrine::ATTR_AUTO_ACCESSOR_OVERRIDE, true);
     $manager->setAttribute(Doctrine::ATTR_AUTOLOAD_TABLE_CLASSES, true);
     // apply default attributes
     $manager->setDefaultAttributes();
     if (method_exists($this->configuration, 'configureDoctrine')) {
         $this->configuration->configureDoctrine($manager);
     }
     $this->dispatcher->notify(new sfEvent($manager, 'doctrine.configure'));
 }
예제 #3
0
 /**
  * Contructeur
  * @param array $conf Paramètres de connection à l'annuaire. Les paramètres
  *                    possibles sont : "host", "port", "options", "dn"
  *                    "password", "basedn"
  */
 public function __construct($conf = null)
 {
     if (!is_array($conf)) {
         $conf = array();
         if (sfConfig::has('app_ldap_server_host')) {
             $conf['host'] = sfConfig::get('app_ldap_server_host');
         }
         if (sfConfig::has('app_ldap_server_port')) {
             $conf['port'] = sfConfig::get('app_ldap_server_port');
         }
         if (sfConfig::has('app_ldap_server_dn')) {
             $conf['dn'] = sfConfig::get('app_ldap_server_dn');
         }
         if (sfConfig::has('app_ldap_server_password')) {
             $conf['password'] = sfConfig::get('app_ldap_server_password');
         }
         if (sfConfig::has('app_ldap_server_basedn')) {
             $conf['basedn'] = sfConfig::get('app_ldap_server_basedn');
         }
         if (sfConfig::has('app_ldap_server_options')) {
             $conf['options'] = sfConfig::get('app_ldap_server_options');
         }
     }
     $this->config = $conf;
 }
 /**
  * A url where to send amf requests.
  * 
  * @abstract
  * 
  * @return string
  */
 protected function _getAmfEndPoint($key = 'app_amf_endpoint')
 {
     if (!sfConfig::has($key)) {
         throw new Exception('The gateway url for testing amf services must be set in app.yml config file. The app.yml option should have a name `' . $key . '`');
     }
     return sfConfig::get($key);
 }
/**
 * Returns the Analytics integration code snippet.
 *
 * See: http://code.google.com/apis/analytics/docs/tracking/asyncTracking.html
 * 
 * @package    Reditype
 * @subpackage helper
 * @author     Piers Warmers <*****@*****.**>
 * @param      string $web_property_id
 * @return     string
 */
function analytics($web_property_id = null)
{
    if (is_null($web_property_id) && !sfConfig::has('app_rt_analytics_web_property_id')) {
        return '';
    }
    $web_property_id = is_null($web_property_id) ? sfConfig::get('app_rt_analytics_web_property_id') : $web_property_id;
    $domain = '';
    if (sfConfig::has('app_rt_analytics_web_property_domain')) {
        $domain = "_gaq.push(['_setDomainName', '" . sfConfig::get('app_rt_analytics_web_property_domain') . "']);";
    }
    $string = <<<EOS
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', '{$web_property_id}']);
  {$domain}
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
</script>

EOS;
    return $string;
}
 /**
  * Authenticate API access
  *
  * @param  String  $key
  * @return Boolean True for access granted
  */
 public static function grantApiAccess($key)
 {
     if (!sfConfig::has('app_rt_api_key') || $key !== sfConfig::get('app_rt_api_key')) {
         return false;
     }
     return true;
 }
 /**
  * Returns the appropiate slug to save
  *
  * @param   BaseObject  $node
  * @param   string      $from     Column from which slug is generated
  */
 public function createSlug(BaseObject $node)
 {
     $peer_name = get_class($node->getPeer());
     $node_class = get_class($node);
     $getter = self::forgeMethodName($node, 'get', 'from');
     $column = self::getColumnConstant($node_class, 'to');
     $conf_separator = sprintf('propel_behavior_sfPropelActAsSluggableBehavior_%s_separator', $node_class);
     $separator = sfConfig::has($conf_separator) ? sfConfig::get($conf_separator) : $this->default_separator;
     $slug = sfPropelActAsSluggableBehaviorUtils::stripText($node->{$getter}(), $separator);
     $ret = $slug;
     $i = 0;
     $conf_scope = sprintf('propel_behavior_sfPropelActAsSluggableBehavior_%s_scope', $node_class);
     $scope = sfConfig::has($conf_scope) ? sfConfig::get($conf_scope) : array();
     $scope_criteria = new Criteria();
     foreach ($scope as $my_col) {
         $getter = 'get' . call_user_func(array($peer_name, 'translateFieldName'), $column, BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME);
         $scope_criteria->add($column, $node->{$getter}());
     }
     while (1) {
         $c = clone $scope_criteria;
         $c->add($column, $ret);
         $entry = call_user_func(array($peer_name, 'doSelectOne'), $c);
         if ($entry && !$entry->equals($node)) {
             $i++;
             $ret = $slug . $separator . $i;
         } else {
             return $ret;
         }
     }
 }
 /**
  * @see sfPluginConfiguration
  */
 public function initialize()
 {
     if (!sfConfig::has('app_tmcTwitterBootstrapPlugin_header')) {
         //          throw new sfException('Make sure you copy app.yml to your application and set plugin configuration values.');
     }
     if (!in_array('tmcTwitterBootstrap', sfConfig::get('sf_enabled_modules', array()))) {
         //          throw new sfException('Make sure you enable the tmcTwitterBootstrap module in your application settings.');
     }
 }
 public function configure()
 {
     // TODO: They must be managed by an original config handler
     $colors = array('core_color_1' => '#FFFFFF', 'core_color_2' => '#0D6DDF', 'core_color_3' => '#DDDDDD', 'core_color_4' => '#EEEEFF', 'core_color_5' => '#7DDADF', 'core_color_6' => '#E0EAEF', 'core_color_7' => '#FFFFFF', 'core_color_8' => '#C49FFF', 'core_color_9' => '#DCD1EF', 'core_color_10' => '#FFFFFF', 'core_color_11' => '#0D6DDF', 'core_color_12' => '#B3CEEF', 'core_color_13' => '#BFA4EF', 'core_color_14' => '#000000', 'core_color_15' => '#0000FF', 'core_color_23' => '#FFFFFF', 'core_color_17' => '#800080', 'core_color_18' => '#EEEEEE', 'core_color_19' => '#999966', 'core_color_20' => '#0C5F0F', 'core_color_21' => '#C49FFF', 'core_color_22' => '#FF0000', 'core_color_24' => '#000000', 'core_color_25' => '#000000', 'core_color_26' => '#000000', 'core_color_27' => '#DDDDDD', 'core_color_28' => '#000000');
     $prefix = 'op_' . sfConfig::get('sf_app') . '_color_config_';
     foreach ($colors as $key => $value) {
         if (!sfConfig::has($prefix . $key)) {
             sfConfig::set($prefix . $key, $value);
         }
     }
 }
예제 #10
0
 protected function creaateTransform()
 {
     if (!defined('IMAGE_TRANSFORM_IM_PATH') && sfConfig::has('op_imagemagick_path')) {
         // follow 2.x format (for BC reason)
         $path = dirname(sfConfig::get('op_imagemagick_path')) . DIRECTORY_SEPARATOR;
         define('IMAGE_TRANSFORM_IM_PATH', $path);
     }
     $result = Image_Transform::factory('IM');
     if (PEAR::isError($result)) {
         throw new RuntimeException($result->getMessage());
     }
     return $result;
 }
/**
 * Return a badge
 *
 * @package    Reditype
 * @subpackage helper
 * @author     Piers Warmers <*****@*****.**>
 * @param      array $options
 * @return     string
 */
function get_social_networking_badge($options = null)
{
    if (sfConfig::get('app_rt_social_networking_service') === 'tweetmeme') {
        return get_tweetmeme_badge($options);
    }
    if (!sfConfig::has('app_rt_social_networking_service') || !sfConfig::has('app_rt_social_networking_service_username')) {
        return '';
    }
    if (sfConfig::get('app_rt_social_networking_service') === 'addthis') {
        return get_addthis_badge($options);
    }
    if (sfConfig::get('app_rt_social_networking_service') === 'sharethis') {
        return get_sharethis_badge($options);
    }
}
예제 #12
0
 /**
 * Contructeur
 *
 * @param array $conf Paramètres de connection à la bas. Les paramètres
 *                    obligatoires sont : "host", "pdo", "dbname", 
                      "username", "password"
 */
 public function __construct($conf = null)
 {
     if (!is_array($conf)) {
         $conf = array();
         $conf['host'] = sfConfig::has('app_bdd_server_host') ? sfConfig::get('app_bdd_server_host') : 'localhost';
         $conf['pdo'] = sfConfig::has('app_bdd_server_pdo') ? sfConfig::get('app_bdd_server_pdo') : 'mysql';
         $conf['db'] = sfConfig::has('app_bdd_server_dbname') ? sfConfig::get('app_bdd_server_dbname') : 'rdvz';
         $conf['user'] = sfConfig::get('app_bdd_server_username');
         $conf['pass'] = sfConfig::get('app_bdd_server_password');
         $conf['user_tab'] = sfConfig::has('app_bdd_infos_user_table_name') ? sfConfig::get('app_bdd_infos_user_table_name') : 'user';
         $conf['user_login'] = sfConfig::has('app_bdd_infos_user_login_field') ? sfConfig::get('app_bdd_infos_user_login_field') : 'login';
         $conf['user_pass'] = sfConfig::has('app_bdd_infos_user_pass_field') ? sfConfig::get('app_bdd_infos_user_pass_field') : 'pass';
         $conf['pass_crypt'] = sfConfig::has('app_bdd_infos_user_pass_encrypt') ? sfConfig::get('app_bdd_infos_user_pass_encrypt') : 'sha1';
     }
     $this->config = $conf;
 }
예제 #13
0
function get_nested_set_manager($model, $field, $root = 0)
{
    if (!sfConfig::has('app_sfJqueryTree_withContextMenu')) {
        sfConfig::set('app_sfJqueryTree_withContextMenu', true);
    }
    sfContext::getInstance()->getResponse()->addStylesheet('/sfJqueryTreeDoctrineManagerPlugin/jsTree/themes/default/style.css');
    sfContext::getInstance()->getResponse()->addStylesheet('/sfJqueryTreeDoctrineManagerPlugin/css/screen.css');
    //      by vit
    //        sfContext::getInstance()->getResponse()->addJavascript('/sfJqueryTreeDoctrineManagerPlugin/jsTree/jquery.js');
    sfContext::getInstance()->getResponse()->addJavascript('/sfJqueryTreeDoctrineManagerPlugin/jsTree/jquery.cookie.js');
    sfContext::getInstance()->getResponse()->addJavascript('/sfJqueryTreeDoctrineManagerPlugin/jsTree/jquery.tree.min.js');
    sfContext::getInstance()->getResponse()->addJavascript('/sfJqueryTreeDoctrineManagerPlugin/jsTree/plugins/jquery.tree.cookie.js');
    if (sfConfig::get('app_sfJqueryTree_withContextMenu')) {
        sfContext::getInstance()->getResponse()->addJavascript('/sfJqueryTreeDoctrineManagerPlugin/jsTree/plugins/jquery.tree.contextmenu.js');
    }
    return get_component('sfJqueryTreeDoctrineManager', 'manager', array('model' => $model, 'field' => $field, 'root' => $root));
}
function light_image_activate()
{
    if (!sfContext::hasInstance()) {
        return;
    }
    //add resources
    $response = sfContext::getInstance()->getResponse();
    //check if jqueryreloaded plugin is activated
    if (sfConfig::has('sf_jquery_web_dir') && sfConfig::has('sf_jquery_core')) {
        $response->addJavascript(sfConfig::get('sf_jquery_web_dir') . '/js/' . sfConfig::get('sf_jquery_core'));
    } else {
        throw new Exception("Theres is no JqueryReloaded plugin !");
    }
    //JQuery Lightbox specific
    $response->addJavascript(sfConfig::get("app_sf_jquery_lightbox_js_dir") . 'jquery.lightbox-0.5.js');
    $response->addStylesheet(sfConfig::get("app_sf_jquery_lightbox_css_dir") . 'jquery.lightbox-0.5.css');
    $code = "\$(function() {\r\n    \$('a.lightbox').lightBox({\r\n      imageLoading: '" . sfConfig::get('app_sf_jquery_lightbox_imageLoading') . "',\r\n      imageBtnClose: '" . sfConfig::get('app_sf_jquery_lightbox_imageBtnClose') . "',\r\n      imageBtnPrev: '" . sfConfig::get('app_sf_jquery_lightbox_imageBtnPrev') . "',\r\n      imageBtnNext: '" . sfConfig::get('app_sf_jquery_lightbox_imageBtnNext') . "',\r\n      imageBlank: '" . sfConfig::get('app_sf_jquery_lightbox_imageBlank') . "',\r\n      txtImage: '" . sfConfig::get('app_sf_jquery_lightbox_txtImage') . "',\r\n      txtOf: '" . sfConfig::get('app_sf_jquery_lightbox_txtOf') . "' });\r\n  });";
    echo javascript_tag($code);
}
예제 #15
0
 public function initialize($options)
 {
     if (isset($options['filename'])) {
         $class = self::getStorageClassName();
         $this->storage = call_user_func(array($class, 'find'), $options['filename'], $class);
     }
     if (!sfConfig::has('op_image_generator_name')) {
         $isMagick = sfConfig::get('op_use_imagemagick', 0);
         if (2 == $isMagick || 1 == $isMagick && 'gif' === $options['format']) {
             sfConfig::set('op_image_generator_name', 'IM');
         } else {
             sfConfig::set('op_image_generator_name', 'GD');
         }
     }
     $className = 'sfImageGenerator' . sfConfig::get('op_image_generator_name');
     if (!class_exists($className)) {
         throw new RuntimeException(sprintf('The specified image handler, %s is not found', $className));
     }
     $this->generator = new $className($options);
     $this->options = $options;
 }
예제 #16
0
 public function getAuthConfigSettings($name = '')
 {
     if (!sfConfig::has('op_auth_' . $this->getAuthModeName())) {
         // default
         $configPath = sfConfig::get('sf_lib_dir') . '/config/config/auth.yml';
         sfContext::getInstance()->getConfigCache()->registerConfigHandler($configPath, 'sfSimpleYamlConfigHandler', array());
         $default = (include sfContext::getInstance()->getConfigCache()->checkConfig($configPath));
         // plugins
         $configPath = sfConfig::get('sf_plugins_dir') . '/opAuth' . $this->getAuthModeName() . 'Plugin/config/auth.yml';
         sfContext::getInstance()->getConfigCache()->registerConfigHandler($configPath, 'sfSimpleYamlConfigHandler', array());
         $plugins = (include sfContext::getInstance()->getConfigCache()->checkConfig($configPath));
         sfConfig::set('op_auth_' . $this->getAuthModeName(), sfToolkit::arrayDeepMerge($default, $plugins));
     }
     $configs = sfConfig::get('op_auth_' . $this->getAuthModeName());
     if (!$name) {
         return $configs;
     } elseif (!empty($configs[$name])) {
         return $configs[$name];
     }
     return null;
 }
예제 #17
0
파일: sfConfigTest.php 프로젝트: hunde/bsc
 * file that was distributed with this source code.
 */
require_once dirname(__FILE__) . '/../../bootstrap/unit.php';
$t = new lime_test(9);
// ::get() ::set()
$t->diag('::get() ::set()');
sfConfig::clear();
sfConfig::set('foo', 'bar');
$t->is(sfConfig::get('foo'), 'bar', '::get() returns the value of key config');
$t->is(sfConfig::get('foo1', 'default_value'), 'default_value', '::get() takes a default value as its second argument');
// ::has()
$t->diag('::has()');
sfConfig::clear();
$t->is(sfConfig::has('foo'), false, '::has() returns false if the key config does not exist');
sfConfig::set('foo', 'bar');
$t->is(sfConfig::has('foo'), true, '::has() returns true if the key config exists');
// ::add()
$t->diag('::add()');
sfConfig::clear();
sfConfig::set('foo', 'bar');
sfConfig::set('foo1', 'foo1');
sfConfig::add(array('foo' => 'foo', 'bar' => 'bar'));
$t->is(sfConfig::get('foo'), 'foo', '::add() adds an array of config parameters');
$t->is(sfConfig::get('bar'), 'bar', '::add() adds an array of config parameters');
$t->is(sfConfig::get('foo1'), 'foo1', '::add() adds an array of config parameters');
// ::getAll()
$t->diag('::getAll()');
sfConfig::clear();
sfConfig::set('foo', 'bar');
sfConfig::set('foo1', 'foo1');
$t->is(sfConfig::getAll(), array('foo' => 'bar', 'foo1' => 'foo1'), '::getAll() returns all config parameters');
예제 #18
0
 /**
  * Gets a service container parameter.
  *
  * @param  string $name The parameter name
  *
  * @return mixed  The parameter value
  *
  * @throw  InvalidArgumentException if the parameter is not defined
  */
 public function getParameter($name)
 {
     if ($this->hasParameter($name)) {
         return $this->parameters[strtolower($name)];
     }
     if (sfConfig::has($name)) {
         return sfConfig::get($name);
     }
     throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name));
 }
예제 #19
0
<?php

use_helper('I18N');
$rt_site = rtSiteToolkit::getCurrentSite();
if (sfConfig::has('app_rt_email_signature_html')) {
    ?>
<p><?php 
    echo sfConfig::get('app_rt_email_signature_html', '');
    ?>
</p>
<?php 
} elseif ($rt_site) {
    ?>
<p>Many thanks, <?php 
    echo $rt_site->getTitle();
    ?>
</p>
<?php 
}
예제 #20
0
 /**
  * Checks to see if a configuration file has been modified and if so
  * recompile the cache file associated with it.
  *
  * The recompilation only occurs in a non debug environment.
  *
  * If the configuration file path is relative, symfony will look in directories 
  * defined in the sfLoader::getConfigPaths() method.
  *
  * @param string A filesystem path to a configuration file
  *
  * @return string An absolute filesystem path to the cache filename associated with this specified configuration file
  *
  * @throws <b>sfConfigurationException</b> If a requested configuration file does not exist
  *
  * @see sfLoader::getConfigPaths()
  */
 public function checkConfig($configPath, $optional = false)
 {
     static $process_cache_cleared = false;
     if (sfConfig::get('sf_debug') && sfConfig::get('sf_logging_enabled')) {
         $timer = sfTimerManager::getTimer('Configuration');
     }
     // the cache filename we'll be using
     $cache = $this->getCacheName($configPath);
     if (sfConfig::get('sf_in_bootstrap') && is_readable($cache)) {
         if (sfConfig::get('sf_debug') && sfConfig::get('sf_logging_enabled')) {
             $timer->addTime();
         }
         return $cache;
     }
     if (!sfToolkit::isPathAbsolute($configPath)) {
         $files = sfLoader::getConfigPaths($configPath);
     } else {
         $files = is_readable($configPath) ? array($configPath) : array();
     }
     if (!isset($files[0])) {
         if ($optional) {
             return null;
         }
         // configuration does not exist
         $error = sprintf('Configuration "%s" does not exist or is unreadable', $configPath);
         throw new sfConfigurationException($error);
     }
     // find the more recent configuration file last modification time
     $mtime = 0;
     foreach ($files as $file) {
         if (filemtime($file) > $mtime) {
             $mtime = filemtime($file);
         }
     }
     if (!is_readable($cache) || $mtime > filemtime($cache)) {
         // configuration has changed so we need to reparse it
         $this->callHandler($configPath, $files, $cache);
         // clear process cache
         if ('config/config_handlers.yml' != $configPath && sfConfig::has('sf_use_process_cache') && !$process_cache_cleared) {
             sfProcessCache::clear();
             $process_cache_cleared = true;
         }
     }
     if (sfConfig::get('sf_debug') && sfConfig::get('sf_logging_enabled')) {
         $timer->addTime();
     }
     return $cache;
 }
예제 #21
0
 public function has($param_name)
 {
     return sfConfig::has($this->m_path_prefix . $param_name);
 }
예제 #22
0
 /**
  *
  * @return boolean
  * @author jp_morvan
  */
 static function hasProfileInformations()
 {
   return sfConfig::has('app_vjCommentPlugin_profile');
 }
예제 #23
0
 * @author     Piers Warmers <*****@*****.**>
 * @author     Konny Zurcher <*****@*****.**>
 */
include dirname(__FILE__) . '/../bootstrap/unit.php';
$t = new lime_test(134, new lime_output_color());
$configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'test', true);
sfContext::createInstance($configuration);
new sfDatabaseManager($configuration);
$t->diag('/////////////////////////////////////////////////////////////////////////////');
$t->diag('/// Shopping cart testing                                                 ///');
$t->diag('/////////////////////////////////////////////////////////////////////////////');
// Disable tax and shipping costs
if (sfConfig::has('app_rt_shop_tax_rate')) {
    sfConfig::set('app_rt_shop_tax_rate', 0);
}
if (sfConfig::has('app_rt_shop_shipping_charges')) {
    sfConfig::set('app_rt_shop_shipping_charges', array());
}
$t->diag('-----------------------------------------------------------------------------');
$t->diag('0. Check classes');
$t->diag('-----------------------------------------------------------------------------');
// Cart Manager
$o1 = new rtShopCartManager();
$t->isa_ok($o1, 'rtShopCartManager', '->class() rtShopCartManager object is available');
// Promotion Toolkit
$o2 = new rtShopPromotionToolkit();
$t->isa_ok($o2, 'rtShopPromotionToolkit', '->class() rtShopPromotionToolkit class is available');
// Voucher Toolkit
$o3 = new rtShopVoucherToolkit();
$t->isa_ok($o3, 'rtShopVoucherToolkit', '->class() rtShopVoucherToolkit class is available');
unset($o1, $o3, $o3);
 /**
  * Gets the JavaScript paths associated with the widget.
  *
  * @return array An array of JavaScript paths
  */
 public function getJavaScripts()
 {
     //check if jquery is loaded
     $js = array();
     if (sfConfig::has('sf_jquery_web_dir') && sfConfig::has('sf_jquery_core')) {
         $js[] = sfConfig::get('sf_jquery_web_dir') . '/js/' . sfConfig::get('sf_jquery_core');
     } else {
         $js[] = '/sfJQueryUIPlugin/js/jquery-1.3.1.min.js';
     }
     $js[] = '/sfJQueryUIPlugin/js/jquery-ui.js';
     $culture = $this->getOption('culture');
     if ($culture != 'en') {
         $js[] = '/sfJQueryUIPlugin/js/i18n/ui.datepicker-' . $culture . ".js";
     }
     return $js;
 }
예제 #25
0
?>
</p>
<p><strong><?php 
echo __('Did you follow a link from somewhere?');
?>
</strong> </p>
<p><?php 
echo __('If you reached this page from another part of this site, please let us so we can correct our mistake.');
?>
 </p>
<p><?php 
echo __('Links from other sites can sometimes be outdated or misspelled. Let us know and we can try to contact the other site in order to fix the problem.');
?>
</p>
<?php 
if (sfConfig::has('app_rt_admin_email')) {
    ?>
<p><?php 
    echo __('In order to improve our service, please inform us of this missing page. We\'ll do our best correct the situation.');
    ?>
</p>
<p>
  <button id="rtNotify404Button" class="button positive"><?php 
    echo __('Let us know about this missing page!');
    ?>
</button>
  <span id="rtNotify404Message"></span>
</p>

<script type="text/javascript">
  $(document).ready(function() {
예제 #26
0
 /**
  * Clear conf for a given key
  * @param String $key
  */
 public static function clear($key)
 {
     if (sfConfig::has($key)) {
         sfConfig::set($key, null);
     }
 }
예제 #27
0
/**
 * Displays a tree administration panel.
 *
 * @package    Reditype
 * @subpackage helper
 * @author     Piers Warmers <*****@*****.**>
 * @param      string $model
 * @param      string $field
 * @param      string $root
 * @return     string
 */
function get_tree_manager($model, $field, $root = 0)
{
    if (!sfConfig::has('app_sfJqueryTree_withContextMenu')) {
        sfConfig::set('app_sfJqueryTree_withContextMenu', true);
    }
    sfContext::getInstance()->getResponse()->addStylesheet('/rtCorePlugin/vendor/jsTree/themes/default/style.css');
    sfContext::getInstance()->getResponse()->addJavascript('/rtCorePlugin/vendor/jquery/js/jquery.min.js');
    sfContext::getInstance()->getResponse()->addJavascript('/rtCorePlugin/vendor/jsTree/lib/jquery.cookie.js');
    sfContext::getInstance()->getResponse()->addJavascript('/rtCorePlugin/vendor/jsTree/jquery.tree.js');
    sfContext::getInstance()->getResponse()->addJavascript('/rtCorePlugin/vendor/jsTree/plugins/jquery.tree.cookie.js');
    sfContext::getInstance()->getResponse()->addJavascript('/rtCorePlugin/vendor/jsTree/plugins/jquery.tree.contextmenu.js');
    return get_component('rtTreeAdmin', 'manager', array('model' => $model, 'field' => $field, 'root' => $root));
}
예제 #28
0
 /**
  * Replaces constant identifiers in a scalar value.
  *
  * @param  string $value  the value to perform the replacement on
  *
  * @return string the value with substitutions made
  */
 public static function replaceConstants($value)
 {
     return is_string($value) ? preg_replace_callback('/%(.+?)%/', function ($v) {
         return sfConfig::has(strtolower($v[1])) ? sfConfig::get(strtolower($v[1])) : '%' . $v[1] . '%';
     }, $value) : $value;
 }
예제 #29
0
 /**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     $app = $arguments['app'];
     // Validate the application name
     if (!preg_match('/^[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*$/', $app)) {
         throw new sfCommandException(sprintf('The application name "%s" is invalid.', $app));
     }
     $appDir = sfConfig::get('sf_apps_dir') . '/' . $app;
     if (is_dir($appDir)) {
         throw new sfCommandException(sprintf('The application "%s" already exists.', $appDir));
     }
     if (is_readable(sfConfig::get('sf_data_dir') . '/skeleton/app')) {
         $skeletonDir = sfConfig::get('sf_data_dir') . '/skeleton/app';
     } else {
         $skeletonDir = __DIR__ . '/skeleton/app';
     }
     // Create basic application structure
     $finder = sfFinder::type('any')->discard('.sf');
     $this->getFilesystem()->mirror($skeletonDir . '/app', $appDir, $finder);
     // Create $app.php or index.php if it is our first app
     $indexName = 'index';
     $firstApp = !file_exists(sfConfig::get('sf_web_dir') . '/index.php');
     if (!$firstApp) {
         $indexName = $app;
     }
     if (true === $options['csrf-secret']) {
         $options['csrf-secret'] = sha1(mt_rand(11111111, 99999999) . getmypid());
     }
     // Set no_script_name value in settings.yml for production environment
     $finder = sfFinder::type('file')->name('settings.yml');
     $this->getFilesystem()->replaceTokens($finder->in($appDir . '/config'), '##', '##', array('NO_SCRIPT_NAME' => $firstApp ? 'true' : 'false', 'CSRF_SECRET' => sfYamlInline::dump(sfYamlInline::parseScalar($options['csrf-secret'])), 'ESCAPING_STRATEGY' => sfYamlInline::dump((bool) sfYamlInline::parseScalar($options['escaping-strategy'])), 'USE_DATABASE' => sfConfig::has('sf_orm') ? 'true' : 'false'));
     $this->getFilesystem()->copy($skeletonDir . '/web/index.php', sfConfig::get('sf_web_dir') . '/' . $indexName . '.php');
     $this->getFilesystem()->copy($skeletonDir . '/web/index.php', sfConfig::get('sf_web_dir') . '/' . $app . '_dev.php');
     $this->getFilesystem()->replaceTokens(sfConfig::get('sf_web_dir') . '/' . $indexName . '.php', '##', '##', array('APP_NAME' => $app, 'ENVIRONMENT' => 'prod', 'IS_DEBUG' => 'false', 'IP_CHECK' => ''));
     $this->getFilesystem()->replaceTokens(sfConfig::get('sf_web_dir') . '/' . $app . '_dev.php', '##', '##', array('APP_NAME' => $app, 'ENVIRONMENT' => 'dev', 'IS_DEBUG' => 'true', 'IP_CHECK' => '// this check prevents access to debug front controllers that are deployed by accident to production servers.' . PHP_EOL . '// feel free to remove this, extend it or make something more sophisticated.' . PHP_EOL . 'if (!in_array(@$_SERVER[\'REMOTE_ADDR\'], array(\'127.0.0.1\', \'::1\')))' . PHP_EOL . '{' . PHP_EOL . '  die(\'You are not allowed to access this file. Check \'.basename(__FILE__).\' for more information.\');' . PHP_EOL . '}' . PHP_EOL));
     $this->getFilesystem()->rename($appDir . '/config/ApplicationConfiguration.class.php', $appDir . '/config/' . $app . 'Configuration.class.php');
     $this->getFilesystem()->replaceTokens($appDir . '/config/' . $app . 'Configuration.class.php', '##', '##', array('APP_NAME' => $app));
     $fixPerms = new sfProjectPermissionsTask($this->dispatcher, $this->formatter);
     $fixPerms->setCommandApplication($this->commandApplication);
     $fixPerms->setConfiguration($this->configuration);
     $fixPerms->run();
     // Create test dir
     $this->getFilesystem()->mkdirs(sfConfig::get('sf_test_dir') . '/functional/' . $app);
 }
 /**
  * Returns the CDN host after comparing temestamps between a given file and
  * the CDN syncronisation tag file.
  *
  * @param string $file Absolute path of file to compare timestamp
  * @return string
  */
 private function getCdnHost($file)
 {
     $tag = self::getCdnTagFilename();
     if (!file_exists($tag) || !sfConfig::has('app_rt_cdn_host')) {
         return '';
     }
     return filectime($tag) > filectime($file) ? sfConfig::get('app_rt_cdn_host') : '';
 }