symfony1

Symfony: email address as request parameter

天涯浪子 提交于 2019-11-30 23:45:06
问题 I'm having some issues with passing an email address in a url to a symfony app. The url looks like example.com/unsubscribe/email/me@example.com It will always result in a sfError404Exception , except when the period is removed. After doing some googling around, the only solution I've yet seen is that htaccess is bypassing the url because of the period present. However, when I add the suggested fix to htaccess, like so: # we skip all files with .something RewriteCond %{REQUEST_URI} \..+$

How to get Symfony session variable in model?

∥☆過路亽.° 提交于 2019-11-30 20:55:25
问题 How can I pass session variable in symfony model without using sfContext::getInstance() ? 回答1: The recommended way is called dependency injection, and works like this: you create a setUser() method in your model file, that saves the given parameter to a private property: class Foo { private $_user; public function setUser(myUser $user) { $this->_user = $user; } // ... later: public function save(Doctrine_Connection $conn = null) { // use $this->_user to whatever you need } } This looks clumsy

Disable CSS stylesheet for a specific action in Symfony

随声附和 提交于 2019-11-30 20:22:25
Is there any way of disabling a stylesheet in view.yml for a specific action in Symfony? For example I've got this in my view.yml: default: stylesheets: [default.css] I want to be able to do something like: displaySuccess: stylesheet: [!default.css] to disable default.css in displaySuccess only Is this possible or do I have to explicitly say which modules/actions should have default.css? You can remove or add stylesheets to a modules view.yml by doing the following: displaySuccess: stylesheet: [-default] would remove default.css from the display action. Simply putting displaySuccess:

PHP Post Data Over VPN

ⅰ亾dé卋堺 提交于 2019-11-30 19:49:57
I need to connect to a webservice which is behind of a VPN via PHP. My server is Debian Linux (Squeeze). Is it possible to accomplish this via PHP on Linux? Is it risky to do this if it is possible? (When VPN connection hangs etc., does the operating system or any other what-so-over handles the situation) I have only one network card, therefore I really wonder whether it is possible to keep server online for normal users while "posting data over an accomplished VPN connection in the background". Although my question seems to a conceptual question, any specific help is also welcome. Server OS :

integrating Wordpress with Symfony

喜你入骨 提交于 2019-11-30 18:41:21
问题 I have a site built with Symfony 1.2. I'm trying to integrate Wordpress 2.8.4 into it to power my blog. I followed the instructions at http://www.theodo.fr/blog/2009/03/integrate-wordpress-into-symfony/, including the 2 steps in the comments at http://www.theodo.fr/blog/2009/03/integrate-wordpress-into-symfony/comment-page-1/#comment-573. My actions.class.php file looks like this: <?php class sfWordpressActions extends sfActions { public function executeIndex(sfWebRequest $request) { // Don't

How can escaping be used to prevent XSS attacks?

半世苍凉 提交于 2019-11-30 18:11:41
问题 To prevent XSS attacks, output escaping has been enabled; The above is from symfony,but I don't understand. 回答1: XSS is an abbreviation for "Cross-site scripting". Cross-site scripting attacks occur when you manage to sneak a script (usually javascript) onto someone else's website, where it can run maliciously. XSS is possible when you have user input into a web site. For instance, if I was filling out a web form, and it asked me for my name, I could enter My name is <script src="http://bad

Symfony Ignore Directory in web/

喜你入骨 提交于 2019-11-30 16:34:24
In an symfony project, is there any way to exclude a directory from being processed. For example, I want to run a seperate php program in mysite.com/other_app How can I exclude web/other_app folder from being processed by the symfony controller. I've tried using RewriteCond %{REQUEST_URI} !^/other_app/(.*)$ and RewriteCond %{REQUEST_FILENAME} !-d Symfony still processes the other_app which obviously isn't going to work properly. Any suggestions.Do I need to modify htaccess in other_app/.htaccess as well? Also, let me add. When I access just the directory mysite.com/other_app I get the correct

Symfony Ignore Directory in web/

心已入冬 提交于 2019-11-30 16:14:19
问题 In an symfony project, is there any way to exclude a directory from being processed. For example, I want to run a seperate php program in mysite.com/other_app How can I exclude web/other_app folder from being processed by the symfony controller. I've tried using RewriteCond %{REQUEST_URI} !^/other_app/(.*)$ and RewriteCond %{REQUEST_FILENAME} !-d Symfony still processes the other_app which obviously isn't going to work properly. Any suggestions.Do I need to modify htaccess in other_app/

Can't change model builder options

跟風遠走 提交于 2019-11-30 16:08:12
问题 I'm trying to get symfony to use a custom class called jsDoctrineRecord instead of sfDoctrineRecord for its models. Here's the code for the overriding class: <?php abstract class jsDoctrineRecord extends sfDoctrineRecord { public function foo() { echo 'foo';exit; } } Here's what I have in config/ProjectConfiguration.class.php , per the instructions here: <?php require_once dirname(__FILE__).'/../lib/vendor/symfony/lib/autoload/sfCoreAutoload.class.php'; sfCoreAutoload::register(); class

Symfony on virtual host (document root problem)

99封情书 提交于 2019-11-30 15:54:44
I'm developing an application in Symfony and on localhost (XAMPP) I want to simulate the same conditions as on the webserver. The web server is configured as follows: /www => mydomain.com /foo => foo.mydomain.com /bar => bar.mydomain.com ... I'm going to put my Symfony application into /www direcotry so there'll be: /www /www/apps /www/apps/frontend /www/apps/frontend/... /www/apps/backend /www/apps/backend/... /www/cache /www/config ... and so on... /www/web The thing is that the document root is still set to the /www directory but Symfony expects it in the /www/web . Of course it will work