Changeset 12149 for branches/dwhittle
- Timestamp:
- 10/12/08 07:08:50 (2 months ago)
- Files:
-
- branches/dwhittle/1.1/lib/storage/sfMySQLSessionStorage.class.php (modified) (1 diff)
- branches/dwhittle/1.2/UPGRADE_TO_1_2 (modified) (8 diffs)
- branches/dwhittle/1.2/lib/addon/sfData.class.php (modified) (2 diffs)
- branches/dwhittle/1.2/lib/autoload/sfCoreAutoload.class.php (modified) (3 diffs)
- branches/dwhittle/1.2/lib/config/sfGeneratorConfigHandler.class.php (modified) (2 diffs)
- branches/dwhittle/1.2/lib/config/sfProjectConfiguration.class.php (modified) (4 diffs)
- branches/dwhittle/1.2/lib/exception/data/error.atom.php (copied) (copied from branches/1.2/lib/exception/data/error.atom.php)
- branches/dwhittle/1.2/lib/exception/data/error.css.php (copied) (copied from branches/1.2/lib/exception/data/error.css.php)
- branches/dwhittle/1.2/lib/exception/data/error.html.php (copied) (copied from branches/1.2/lib/exception/data/error.html.php)
- branches/dwhittle/1.2/lib/exception/data/error.js.php (copied) (copied from branches/1.2/lib/exception/data/error.js.php)
- branches/dwhittle/1.2/lib/exception/data/error.json.php (copied) (copied from branches/1.2/lib/exception/data/error.json.php)
- branches/dwhittle/1.2/lib/exception/data/error.rdf.php (copied) (copied from branches/1.2/lib/exception/data/error.rdf.php)
- branches/dwhittle/1.2/lib/exception/data/error.txt.php (copied) (copied from branches/1.2/lib/exception/data/error.txt.php)
- branches/dwhittle/1.2/lib/exception/data/error.xml.php (copied) (copied from branches/1.2/lib/exception/data/error.xml.php)
- branches/dwhittle/1.2/lib/exception/data/error500.atom.php (deleted)
- branches/dwhittle/1.2/lib/exception/data/error500.css.php (deleted)
- branches/dwhittle/1.2/lib/exception/data/error500.html.php (deleted)
- branches/dwhittle/1.2/lib/exception/data/error500.js.php (deleted)
- branches/dwhittle/1.2/lib/exception/data/error500.json.php (deleted)
- branches/dwhittle/1.2/lib/exception/data/error500.rdf.php (deleted)
- branches/dwhittle/1.2/lib/exception/data/error500.txt.php (deleted)
- branches/dwhittle/1.2/lib/exception/data/error500.xml.php (deleted)
- branches/dwhittle/1.2/lib/exception/data/exception.atom.php (modified) (1 diff)
- branches/dwhittle/1.2/lib/exception/data/exception.css.php (modified) (1 diff)
- branches/dwhittle/1.2/lib/exception/data/exception.html.php (modified) (1 diff)
- branches/dwhittle/1.2/lib/exception/data/exception.js.php (modified) (1 diff)
- branches/dwhittle/1.2/lib/exception/data/exception.json.php (modified) (1 diff)
- branches/dwhittle/1.2/lib/exception/data/exception.rdf.php (modified) (1 diff)
- branches/dwhittle/1.2/lib/exception/data/exception.txt (modified) (2 diffs)
- branches/dwhittle/1.2/lib/exception/data/exception.xml.php (modified) (1 diff)
- branches/dwhittle/1.2/lib/exception/sfException.class.php (modified) (8 diffs)
- branches/dwhittle/1.2/lib/form/sfForm.class.php (modified) (2 diffs)
- branches/dwhittle/1.2/lib/helper/JavascriptBaseHelper.php (modified) (1 diff)
- branches/dwhittle/1.2/lib/response/sfWebResponse.class.php (modified) (1 diff)
- branches/dwhittle/1.2/lib/routing/sfPatternRouting.class.php (modified) (3 diffs)
- branches/dwhittle/1.2/lib/storage/sfCacheSessionStorage.class.php (copied) (copied from branches/1.2/lib/storage/sfCacheSessionStorage.class.php)
- branches/dwhittle/1.2/lib/storage/sfMySQLSessionStorage.class.php (modified) (1 diff)
- branches/dwhittle/1.2/lib/task/app/sfAppRoutesTask.class.php (modified) (1 diff)
- branches/dwhittle/1.2/lib/task/generator/sfGenerateAppTask.class.php (modified) (1 diff)
- branches/dwhittle/1.2/lib/task/generator/skeleton/app/web/index.php (modified) (1 diff)
- branches/dwhittle/1.2/lib/task/project/upgrade1.2/sfExceptionTemplatesUpgrade.class.php (deleted)
- branches/dwhittle/1.2/lib/task/test/sfTestCoverageTask.class.php (copied) (copied from branches/1.2/lib/task/test/sfTestCoverageTask.class.php)
- branches/dwhittle/1.2/lib/validator/sfValidatorRegex.class.php (modified) (2 diffs)
- branches/dwhittle/1.2/lib/view/sfView.class.php (modified) (1 diff)
- branches/dwhittle/1.2/package.xml.tmpl (modified) (2 diffs)
- branches/dwhittle/1.2/test/unit/form/sfFormTest.php (modified) (4 diffs)
- branches/dwhittle/1.2/test/unit/storage/sfCacheSessionStorageTest.php (copied) (copied from branches/1.2/test/unit/storage/sfCacheSessionStorageTest.php)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/dwhittle/1.1/lib/storage/sfMySQLSessionStorage.class.php
r10594 r12149 101 101 $id = $this->db_escape($id); 102 102 103 // deletethe record associated with this id103 // get the record associated with this id 104 104 $sql = "SELECT $db_data_col FROM $db_table WHERE $db_id_col = '$id'"; 105 105 branches/dwhittle/1.2/UPGRADE_TO_1_2
r11971 r12149 49 49 `sfCreoleSessionStorage` | `sfPDOSessionStorage` 50 50 51 The `propel:build-db` task has been removed as this functionality is provided by52 `propel:insert-sql`.51 The `propel:build-db` task has been removed as this functionality is not yet 52 provided by Propel 1.3. 53 53 54 54 The first step to upgrading is changing from Creole to PDO syntax in the … … 328 328 329 329 The `sfForm` class has a new `hasErrors()` method which returns true if the 330 form has noerrors and false otherwise. This methods returns `false` if the330 form has some errors and false otherwise. This methods returns `false` if the 331 331 form is not bound. This method is quite useful in a template: 332 332 … … 504 504 505 505 These new widgets are now used by default for the Propel generated forms. 506 507 All widgets have a new `label` option. This option sets the label for the widget 508 when used in a widget schema context: 509 510 [php] 511 $widget = new sfWidgetFormInput(array('label' => 'Enter your name here')); 512 $widget->setLabel('Enter your name here'); 513 echo $widget->getLabel(); 506 514 507 515 Response … … 574 582 --------------------------- 575 583 576 symfony continues to decouple its bundled software. In 1.2 the bundled Prototype 577 and Scriptaculous libraries and helper (`JavascriptHelper`) have been moved to a578 core-plugin. Core plugins behave like real plugins but are shipped by symfony platform.579 This will make the javscript and css files of the new `sfProtoculousPlugin`580 (the more or less inofficial name of the often featured duo) behave like real plugin581 assets. They will be now in `web/sfProtoculousPlugin` rather than in `web/sf` 582 (as it has been in 1.0 and 1.1). The `prototype_web_dir` setting will also now point 584 symfony continues to decouple its bundled software. In 1.2 the bundled Prototype 585 and Scriptaculous libraries and helpers (`JavascriptHelper`) have been moved to a 586 core-plugin. Core plugins behave like any plugin but are shipped with symfony. 587 This will make the JavaScript and CSS files of the new `sfProtoculousPlugin` 588 (the more or less unofficial name of the often featured duo) behave like real plugin 589 assets. They will be now in `web/sfProtoculousPlugin` rather than in `web/sf` 590 (as it has been in 1.0 and 1.1). The `prototype_web_dir` setting will also now point 583 591 to the new directory. 584 592 … … 593 601 <?php end_javascript_tag() ?> 594 602 595 596 603 >**CAUTION** 597 >**Work in progress:** As plugins are normally installed via a task and this invokes the 604 >**Work in progress:** As plugins are normally installed via a task and this invokes the 598 605 >creation of the symlink in the web directory this is required for core plugins as well. 599 606 >To do this manually you need to invoke: 600 607 > 601 > ` `symfony plugin:configure-core``608 > `symfony plugin:configure-core` 602 609 > 603 > The target is that the project creation and upgrade task do this for you 610 > The target is that the project creation and upgrade task do this for you. 604 611 605 612 Browser … … 875 882 It will output the submitted values and all the errors if any. 876 883 884 ## Coverage 885 886 There is a new `test:coverage` task that output the code coverage for some given 887 tests: 888 889 [php] 890 ./symfony test:coverage test/unit/model/ArticleTest.php lib/model/Article.php 891 892 The first argument is a test file or a test directory. The second one is the 893 file or directory you want to cover. 894 895 If you want to know which lines are not covered, simply add the `--detailed` option: 896 897 [php] 898 ./symfony test:coverage --detailed test/unit/model/ArticleTest.php lib/model/Article.php 899 877 900 YAML 878 901 ---- … … 1056 1079 pass the `no-confirmation` option: 1057 1080 1058 $ php symfony propel:insert-sql --no-confirmation 1081 $ php symfony propel:insert-sql --no-confirmation 1082 1083 Before symfony 1.2, the `propel:insert-sql` task was the only task to read its 1084 database configuration information from `propel.ini`. As of symfony 1.2, it 1085 reads its information from `databases.yml`. So, if you use several different 1086 connections in your model, the task will take those into account. 1087 Thanks to this new feature, you can now use the `--connection` option 1088 if you want to only load SQL statements for a given connection: 1089 1090 $ php symfony propel:insert-sql --connection=propel 1091 1092 You can also use the `--env` and the `--application` options to select a 1093 specific configuration to use: 1094 1095 $ php symfony propel:insert-sql --env=prod --application=frontend 1059 1096 1060 1097 The `sfTask` base class now provides three new methods to use in your tasks: … … 1597 1634 For example, an uncaught exception during an XML request could render 1598 1635 `config/error/exception.xml.php` when your application is in debug mode, or 1599 `config/error/error500.xml.php` when your application is not in debug mode. 1600 1601 Your symfony 1.1 project's `config/error500.php` file will also render, but 1602 your symfony 1.0 project's `web/errors/error500.php` file must be moved. This 1603 is done for you by the upgrade task. 1636 `config/error/error.xml.php` when your application is not in debug mode. 1637 1638 If you had customized the 500 error template in your project, you will 1639 need to manually move it to the new directory: 1640 1641 * For symfony 1.1: from `config/error500.php` to `config/error/error.html.php` 1642 * For symfony 1.0: from `web/errors/error500.php` to `config/error/error.html.php` branches/dwhittle/1.2/lib/addon/sfData.class.php
r9083 r12149 50 50 * Loads data for the database from a YAML file 51 51 * 52 * @param string $fi xture_file The path to the YAML file.52 * @param string $file The path to the YAML file. 53 53 */ 54 protected function doLoadDataFromFile($fi xture_file)54 protected function doLoadDataFromFile($file) 55 55 { 56 56 // import new datas 57 $data = sfYaml::load($fi xture_file);57 $data = sfYaml::load($file); 58 58 59 59 $this->loadDataFromArray($data); … … 71 71 * loading them into the data source 72 72 * 73 * @param array $fi xture_files The path names of the YAML data files73 * @param array $files The path names of the YAML data files 74 74 */ 75 protected function doLoadData($fi xture_files)75 protected function doLoadData($files) 76 76 { 77 77 $this->object_references = array(); 78 78 $this->maps = array(); 79 79 80 sort($fixture_files); 81 foreach ($fixture_files as $fixture_file) 80 foreach ($files as $file) 82 81 { 83 $this->doLoadDataFromFile($fi xture_file);82 $this->doLoadDataFromFile($file); 84 83 } 85 84 } 86 85 87 86 /** 88 * Gets a list of one or more *.yml files and returns the list in an array 87 * Gets a list of one or more *.yml files and returns the list in an array. 89 88 * 90 * @param string $directory_or_file A directory or file name; if null, then defaults to 'sf_data_dir'/fixtures89 * The returned array of files is sorted by alphabetical order. 91 90 * 92 * @returns array A list of *.yml files. 91 * @param string|array $element A directory or file name or an array of directories and/or file names 92 * If null, then defaults to 'sf_data_dir'/fixtures 93 * 94 * @return array A list of *.yml files 93 95 * 94 96 * @throws sfInitializationException If the directory or file does not exist. 95 97 */ 96 p rotected function getFiles($directory_or_file= null)98 public function getFiles($element = null) 97 99 { 98 // directory or file? 99 $fixture_files = array(); 100 if (!$directory_or_file) 100 if (is_null($element)) 101 101 { 102 102 $directory_or_file = sfConfig::get('sf_data_dir').'/fixtures'; 103 103 } 104 104 105 if (is_file($directory_or_file)) 105 $files = array(); 106 if (is_array($element)) 106 107 { 107 $fixture_files[] = $directory_or_file; 108 foreach ($element as $e) 109 { 110 $files = array_merge($files, $this->getFiles($e)); 111 } 108 112 } 109 else if (is_ dir($directory_or_file))113 else if (is_file($element)) 110 114 { 111 $fixture_files = sfFinder::type('file')->name('*.yml')->in($directory_or_file); 115 $files[] = $element; 116 } 117 else if (is_dir($element)) 118 { 119 $files = sfFinder::type('file')->name('*.yml')->in($element); 112 120 } 113 121 else 114 122 { 115 throw new sfInitializationException('You must give a directory or a file.');123 throw new sfInitializationException('You must give an array, a directory or a file to sfPropelData::getFiles().'); 116 124 } 117 125 118 return $fixture_files; 126 $files = array_unique($files); 127 sort($files); 128 129 return $files; 119 130 } 120 131 } branches/dwhittle/1.2/lib/autoload/sfCoreAutoload.class.php
r11940 r12149 305 305 'sfRouteCollection' => 'routing', 306 306 'sfRouting' => 'routing', 307 'sfCacheSessionStorage' => 'storage', 307 308 'sfDatabaseSessionStorage' => 'storage', 308 309 'sfMySQLSessionStorage' => 'storage', … … 360 361 'sfViewCacheManagerUpgrade' => 'task/project/upgrade1.1', 361 362 'sfWebDebugUpgrade' => 'task/project/upgrade1.1', 362 'sfExceptionTemplatesUpgrade' => 'task/project/upgrade1.2',363 363 'sfFactories12Upgrade' => 'task/project/upgrade1.2', 364 364 'sfPropel13Upgrade' => 'task/project/upgrade1.2', … … 369 369 'sfTask' => 'task', 370 370 'sfTestAllTask' => 'task/test', 371 'sfTestCoverageTask' => 'task/test', 371 372 'sfTestFunctionalTask' => 'task/test', 372 373 'sfTestUnitTask' => 'task/test', branches/dwhittle/1.2/lib/config/sfGeneratorConfigHandler.class.php
r11663 r12149 73 73 "// auto-generated by sfGeneratorConfigHandler\n". 74 74 "// date: %s\n%s\n"; 75 $retval = sprintf($retval, date('Y/m/d H:i:s'), $this->getContent($generatorManager, $config['class'], $generatorParam));75 $retval = sprintf($retval, date('Y/m/d H:i:s'), self::getContent($generatorManager, $config['class'], $generatorParam)); 76 76 77 77 return $retval; … … 84 84 // TODO: remove when the admin generator is moved to the new form framework 85 85 $r = new ReflectionClass($class); 86 if ('sfPropelAdminGenerator' == $class || $r->isSubclassOf(new ReflectionClass('sfPropelAdminGenerator'))) 86 if ( 87 (class_exists('sfPropelAdminGenerator') && ('sfPropelAdminGenerator' == $class || $r->isSubclassOf(new ReflectionClass('sfPropelAdminGenerator')))) 88 || 89 (class_exists('sfDoctrineAdminGenerator') && ('sfDoctrineAdminGenerator' == $class || $r->isSubclassOf(new ReflectionClass('sfDoctrineAdminGenerator')))) 90 ) 87 91 { 88 $data .= <<<EOF 89 require sfConfig::get('sf_symfony_lib_dir').'/plugins/sfCompat10Plugin/config/config.php'; 90 91 EOF; 92 $data .= "require sfConfig::get('sf_symfony_lib_dir').'/plugins/sfCompat10Plugin/config/config.php';\n"; 92 93 } 93 94 branches/dwhittle/1.2/lib/config/sfProjectConfiguration.class.php
r11824 r12149 219 219 { 220 220 $this->plugins = $plugins; 221 222 $this->pluginPaths = array(); 221 223 } 222 224 … … 228 230 public function enablePlugins($plugins) 229 231 { 232 $this->setPlugins(array_merge($this->plugins, is_array($plugins) ? $plugins : array($plugins))); 233 } 234 235 /** 236 * Disables a plugin. 237 * 238 * @param array|string A plugin name or a plugin list 239 */ 240 public function disablePlugins($plugins) 241 { 230 242 if (!is_array($plugins)) 231 243 { … … 233 245 } 234 246 235 $this->plugins = array_merge($this->plugins, $plugins);236 }237 238 /**239 * Disables a plugin.240 *241 * @param array|string A plugin name or a plugin list242 */243 public function disablePlugins($plugins)244 {245 if (!is_array($plugins))246 {247 $plugins = array($plugins);248 }249 250 247 foreach ($plugins as $plugin) 251 248 { … … 255 252 } 256 253 } 254 255 $this->pluginPaths = array(); 257 256 } 258 257 branches/dwhittle/1.2/lib/exception/data/exception.atom.php
r11824 r12149 1 <?php include dirname(__FILE__).'/exception.xml.php'?>1 <?php include sfException::getTemplatePathForError('xml', true) ?> branches/dwhittle/1.2/lib/exception/data/exception.css.php
r11824 r12149 1 1 /* 2 500 Internal Server Error2 <?php echo $code ?> <?php echo $text ?> 3 3 4 <?php echo $name."\n".$message."\n" ?> 4 <?php echo $name ?> 5 <?php echo $message ?> 6 7 <?php foreach ($traces as $trace): ?> 8 <?php echo $trace ?> 9 10 <?php endforeach; ?> 5 11 */ branches/dwhittle/1.2/lib/exception/data/exception.html.php
r11824 r12149 33 33 <center><div id="main"> 34 34 <div style="float: right"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAZCAYAAAAiwE4nAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAEfklEQVRIx7VUa0wUVxT+Znd2FxZk0YKACAtaGwEDUhUTBTEIItmKYk3UNqalD7StMSQ1JKatP5omTYyx0VRrjPERX7XWAG2t9GVi3drU2h+gi4BCWV67lOe6O/uYmXtPf0BRrMBK6UlObmbON9935p6HQEQI1o7uXeSy1dsjHn2Xlpr0oKzililoEiIKymvOr9q+pzyZZN894moHcbWDZN892lOeTN9fKHgrWB5NsInZ7joOrtv4JgR2F4r0AxTpRwisEes2bsNtW+eBYHmCEqw8kVsp6oy6jMUFYIoTxFUQqWBqNzIWr4aoC9NVnlxZNSWC1mqLsa6ubd36zbug+m3gXBlypoCYAuavx4Ytu1Fbay+2VluME/GJEwHsnT3WpLlzhbi4Z6D46gBosP/gVQDA669kIzJSRWxcApLnPie0dw3cALBw0k1z5dyKrIqyWHL1/Eye7n3kcX5MH75fRAAIAJUUZ5Cnez9JPYfI1XuDKsriqOZcbtakm6alte/yqsIi6LVt4KobxAIAqSPxwUEJxAPgqgcG0YH8NS+gxT5wZVI1/PrU0q1O54OoFfmvQZZsIBYA5zIy0maOYFZmJ4GYAuIyZG8jcvLfgMPhmnHlbG7pUws2NfUeWVvyMpj3d3DVB84C4MyPxNkP+8I0TQRn/qGY6gP316J4w6uob3AceirBzw9nnBD1RmN65nLIUhOIBUBcBjEZ5viQEZx5thFcdQ+50o+A5w7SM5dBFHWhFz5bdOpJ3MLjq63mdHrIr7f6PaXbPtBGht4DUwYAQXikyVTkb/gKtbYBNFpzYYoY3egarR6D7jCcPmtly5ZEh6/ZWucfdyycPep3ycmJ2phoAzx9ziERLoMzN4hJAICI8KEkp4VxcCaP+p4zGdHTw2FOiNB2OTzfAMgf80qrjmem1zf256zf9B6kvmvgqgeqrw2qvx1cGQRxBcQV5GRFIGepaeT5cfdJXbAUPY+79z15l47MWzDmH7a3P/g2Ly9X4O6LkKUWEPeOMbwMpnANiClPDkOBXteL3OXxQnNL72UA5n/V8NLR9Bdrb/ddLN+5VvD23wTA8d9MgNH0LD759DrS5oeUbN7RWjXqSu//OXi8sCBFkN11IFJAxMZ0e4cP12+6xsUQqZC9nShclYTWtsDJUTU8cyDlsE7URqTMC4Eiu8fN+/JVF7I3NuGlna2wlDaPi1VkN1LnR0GvF00n95kPAICm+tgcQ9N9V5ll9Tz4JSem2vySE5bCFDS3+t+uPjbHIA64dF/MioU2aoYGXndgQgJLngnWL0PR1iUje0n4hHimBhA1XYA5IVz8q1eu0oSGqCc6HV4ihAIQgso6MV4flNhDUR/iYqbBI1GqZtM7zVUzZ4p3rl5rQIgxesqvVCsa0O8y4Lc/nGp8rLhcBIA7Df7C7hlKe2ZGojYmZsGUCsqygvOnf6FZsbrtm3bY+wUigiAIC/funlXR0RXYgv/BzAmGn979qGvXyOALghAJQAtAB0A/fIrDY6MNurj/LBqADW8OFYACQB4+2d80or7Ra0ZtxAAAAABJRU5ErkJggg==" /></div> 35 <h1> [<?php echo $name ?>]</h1>35 <h1><?php echo $code ?> | <?php echo $text ?> | <?php echo $name ?></h1> 36 36 <h2 id="message"><?php echo str_replace("\n", '<br />', htmlspecialchars($message, ENT_QUOTES, sfConfig::get('sf_charset', 'UTF-8'))) ?></h2> 37 37 <h2>stack trace</h2> branches/dwhittle/1.2/lib/exception/data/exception.js.php
r11824 r12149 1 1 /* 2 500 Internal Server Error2 <?php echo $code ?> <?php echo $text ?> 3 3 4 4 <?php echo $name ?> 5 5 <?php echo $message ?> 6 7 <?php foreach ($traces as $trace): ?> 8 <?php echo $trace ?> 9 10 <?php endforeach; ?> 6 11 */ branches/dwhittle/1.2/lib/exception/data/exception.json.php
r11824 r12149 1 1 { 2 'error':2 "error": 3 3 { 4 'code': 500,5 'message': 'Internal Server Error',6 'debug':4 "code": <?php echo $code ?>, 5 "message": "<?php echo addcslashes($text, "\0..\37\\'\"\177..\377\/") ?>", 6 "debug": 7 7 { 8 'name': '<?php echo $name ?>', 9 'message':'<?php echo addcslashes($message, "\0..\37\\'\"\177..\377\/") ?>' 8 "name": "<?php echo $name ?>", 9 "message": "<?php echo addcslashes($message, "\0..\37\\'\"\177..\377\/") ?>" 10 "traces": 11 [ 12 <?php foreach ($traces as $trace): ?> 13 "<?php echo addcslashes($trace, "\0..\37\\'\"\177..\377\/") ?>" 14 15 <?php endoreach; ?> 16 ] 10 17 } 11 18 } branches/dwhittle/1.2/lib/exception/data/exception.rdf.php
r11824 r12149 1 <?php include dirname(__FILE__).'/exception.xml.php'?>1 <?php include sfException::getTemplatePathForError('xml', true) ?> branches/dwhittle/1.2/lib/exception/data/exception.txt
r10639 r12149 1 [exception] <?php echo $ name ?>2 [message] <?php echo $message ?> 1 [exception] <?php echo $code.' | '.$text.' | '.$name ?> 2 [message] <?php echo $message ?> 3 3 <?php if (count($traces) > 0): ?> 4 4 [stack trace] … … 9 9 <?php endif; ?> 10 10 [symfony] v. <?php echo SYMFONY_VERSION ?> (symfony-project.org) 11 [PHP] v. <?php echo PHP_VERSION ?> 11 [PHP] v. <?php echo PHP_VERSION ?> branches/dwhittle/1.2/lib/exception/data/exception.xml.php
r11824 r12149 1 1 <?xml version="1.0" encoding="<?php echo sfConfig::get('sf_charset', 'UTF-8') ?>"?> 2 <error code=" 500" message="Internal Server Error">2 <error code="<?php echo $code ?>" message="<?php echo $text ?>"> 3 3 <debug> 4 4 <name><?php echo $name ?></name> 5 5 <message><?php echo htmlspecialchars($message, ENT_QUOTES, sfConfig::get('sf_charset', 'UTF-8')) ?></message> 6 <traces> 7 <?php foreach ($traces as $trace): ?> 8 <trace><?php echo $trace ?></trace> 9 <?php endforeach; ?> 10 </traces> 6 11 </debug> 7 12 </error> branches/dwhittle/1.2/lib/exception/sfException.class.php
r11887 r12149 96 96 static protected function outputStackTrace(Exception $exception) 97 97 { 98 if (class_exists('sfContext', false) && sfContext::hasInstance()) 98 $format = 'html'; 99 $code = '500'; 100 $text = 'Internal Server Error'; 101 102 if (class_exists('sfContext', false) && sfContext::hasInstance() && is_object($request = sfContext::getInstance()->getRequest()) && is_object($response = sfContext::getInstance()->getResponse())) 99 103 { 100 104 $dispatcher = sfContext::getInstance()->getEventDispatcher(); … … 111 115 } 112 116 113 $request = sfContext::getInstance()->getRequest();114 $response = sfContext::getInstance()->getResponse();115 116 117 if ($response->getStatusCode() < 300) 117 118 { … … 120 121 } 121 122 122 if ($mimeType = $request->getMimeType($format = $request->getRequestFormat())) 123 { 124 $response->setContentType($mimeType); 125 } 126 else 127 { 128 $format = 'html'; 129 $response->setContentType('text/html'); 130 } 123 $response->setContentType('text/html'); 131 124 132 125 if (!sfConfig::get('sf_test')) … … 137 130 } 138 131 } 132 133 $code = $response->getStatusCode(); 134 $text = $response->getStatusText(); 135 136 $format = $request->getRequestFormat(); 137 if (!$format) 138 { 139 $format = 'html'; 140 } 141 142 if ($mimeType = $request->getMimeType($format)) 143 { 144 $response->setContentType($mimeType); 145 } 139 146 } 140 147 else 141 148 { 142 149 // a backward compatible default 143 $format = 'html';144 145 150 if (!sfConfig::get('sf_test')) 146 151 { … … 148 153 } 149 154 } 150 151 $templatePaths = array(152 sfConfig::get('sf_app_config_dir').'/error',153 sfConfig::get('sf_config_dir').'/error',154 dirname(__FILE__).'/data',155 );156 155 157 156 // send an error 500 if not in debug mode 158 157 if (!sfConfig::get('sf_debug')) 159 158 { 160 $template = sprintf('error500.%s.php', $format); 161 foreach ($templatePaths as $path) 162 { 163 if (is_null($path)) 164 { 165 continue; 166 } 167 168 if (is_readable($file = $path.'/'.$template)) 169 { 170 include $file; 171 return; 172 } 173 174 // for backward compatibility with symfony 1.1 175 if ('html' == $format && is_readable($file = $path.'/../error500.php')) 176 { 177 include $file; 178 return; 179 } 159 if ($template = self::getTemplatePathForError($format, false)) 160 { 161 include $template; 162 return; 180 163 } 181 164 } … … 183 166 $message = is_null($exception->getMessage()) ? 'n/a' : $exception->getMessage(); 184 167 $name = get_class($exception); 185 $traces = self::getTraces($exception, 0 == strncasecmp(PHP_SAPI, 'cli', 3) ? 'plain' : 'html');168 $traces = self::getTraces($exception, 'html' != $format || 0 == strncasecmp(PHP_SAPI, 'cli', 3) ? 'plain' : 'html'); 186 169 187 170 // dump main objects values … … 198 181 } 199 182 200 $template = sprintf('exception.%s.php', $format); 183 if ($template = self::getTemplatePathForError($format, true)) 184 { 185 include $template; 186 return; 187 } 188 } 189 190 /** 191 * Returns the path for the template error message. 192 * 193 * @param string $format The request format 194 * @param Boolean $debug Whether to return a template for the debug mode or not 195 * 196 * @return string|Boolean false if the template cannot be found for the given format, 197 * the absolute path to the template otherwise 198 */ 199 static public function getTemplatePathForError($format, $debug) 200 { 201 $templatePaths = array( 202 sfConfig::get('sf_app_config_dir').'/error', 203 sfConfig::get('sf_config_dir').'/error', 204 dirname(__FILE__).'/data', 205 ); 206 207 $template = sprintf('%s.%s.php', $debug ? 'exception' : 'error', $format); 201 208 foreach ($templatePaths as $path) 202 209 { 203 210 if (!is_null($path) && is_readable($file = $path.'/'.$template)) 204 211 { 205 include $file; 206 return; 207 } 208 } 212 return $file; 213 } 214 } 215 216 return false; 209 217 } 210 218 … … 322 330 else if ($value === null) 323 331 { 324 $result[] = '<em>null</em>';332 $result[] = $format == 'html' ? '<em>null</em>' : 'null'; 325 333 } 326 334 else if (!is_int($key)) 327 335 { 328 $result[] = "'$key' =>'$value'";336 $result[] = $format == 'html' ? "'$key' => '$value'" : "'$key' => '$value'"; 329 337 } 330 338 else branches/dwhittle/1.2/lib/form/sfForm.class.php
r11971 r12149 511 511 512 512 /** 513 * Set a validator for the given field name. 514 * 515 * @param string $name The field name 516 * @param sfValidator $validator The validator 517 */ 518 public function setValidator($name, sfValidatorBase $validator) 519 { 520 $this->validatorSchema[$name] = $validator; 521 522 $this->resetFormFields(); 523 } 524 525 /** 526 * Gets a validator for the given field name. 527 * 528 * @param string $name The field name 529 * 530 * @return sfValidator $validator The validator 531 */ 532 public function getValidator($name) 533 { 534 if (!isset($this->validatorSchema[$name])) 535 { 536 throw new InvalidArgumentException(sprintf('The validator "%s" does not exist.', $name)); 537 } 538 539 return $this->validatorSchema[$name]; 540 } 541 542 /** 513 543 * Sets the validator schema associated with this form. 514 544 * … … 540 570 { 541 571 $this->setWidgetSchema(new sfWidgetFormSchema($widgets)); 572 } 573 574 /** 575 * Set a widget for the given field name. 576 * 577 * @param string $name The field name 578 * @param sfWidgetForm $widget The widget 579 */ 580 public function setWidget($name, sfWidgetForm $widget) 581 { 582 $this->widgetSchema[$name] = $widget; 583 584 $this->resetFormFields(); 585 } 586 587 /** 588 * Gets a widget for the given field name. 589 * 590 * @param string $name The field name 591 * 592 * @return sfWidgetForm $widget The widget 593 */ 594 public function getWidget($name) 595 { 596 if (!isset($this->widgetSchema[$name])) 597 { 598 throw new InvalidArgumentException(sprintf('The widget "%s" does not exist.', $name)); 599 } 600 601 return $this->widgetSchema[$name]; 542 602 } 543 603 branches/dwhittle/1.2/lib/helper/JavascriptBaseHelper.php
r11887 r12149 53 53 54 54 return content_tag('a', $name, $html_options); 55 } 56 57 /** 58 * Returns a button that'll trigger a javascript function using the 59 * onclick handler and return false after the fact. 60 * 61 * Examples: 62 * <?php echo button_to_function('Greeting', "alert('Hello world!')") ?> 63 */ 64 function button_to_function($name, $function, $html_options = array()) 65 { 66 $html_options = _parse_attributes($html_options); 67 68 $html_options['onclick'] = $function.'; return false;'; 69 $html_options['type'] = 'button'; 70 $html_options['value'] = $name; 71 72 return tag('input', $html_options); 55 73 } 56 74 branches/dwhittle/1.2/lib/response/sfWebResponse.class.php
r11971 r12149 205 205 206 206 /** 207 * Retrieves status text for the current web response. 208 * 209 * @return string Status text 210 */ 211 public function getStatusText() 212 { 213 return $this->statusText; 214 } 215 216 /** 207 217 * Retrieves status code for the current web response. 208 218 * 209 * @return stringStatus code219 * @return integer Status code 210 220 */ 211 221 public function getStatusCode() branches/dwhittle/1.2/lib/routing/sfPatternRouting.class.php
r11824 r12149 170 170 * @see connect 171 171 */ 172 public function prependRoute($name, sfRoute$route)172 public function prependRoute($name, $route) 173 173 { 174 174 $routes = $this->routes; … … 187 187 * @see connect 188 188 */ 189 public function appendRoute($name, sfRoute$route)189 public function appendRoute($name, $route) 190 190 { 191 191 return $this->connect($name, $route); … … 197 197 * @see connect 198 198 */ 199 public function insertRouteBefore($pivot, $name, sfRoute$route)199 public function insertRouteBefore($pivot, $name, $route) 200 200 { 201 201 if (!isset($this->routes[$pivot])) branches/dwhittle/1.2/lib/storage/sfMySQLSessionStorage.class.php
r10594 r12149 101 101 $id = $this->db_escape($id); 102 102 103 // deletethe record associated with this id103 // get the record associated with this id 104 104 $sql = "SELECT $db_data_col FROM $db_table WHERE $db_id_col = '$id'"; 105 105 branches/dwhittle/1.2/lib/task/app/sfAppRoutesTask.class.php
r11479 r12149 48 48 $config = new sfRoutingConfigHandler(); 49 49 $routes = $config->evaluate($this->configuration->getConfigPaths('config/routing.yml')); 50 $this->routes = sfPatternRouting::flattenRoutes($routes); 50 51 $routing = new sfPatternRouting($this->dispatcher); 52 $routing->setRoutes($routes); 53 54 $this->dispatcher->notify(new sfEvent($routing, 'routing.load_configuration')); 55 56 $this->routes = $routing->getRoutes(); 51 57 52 58 // display branches/dwhittle/1.2/lib/task/generator/sfGenerateAppTask.class.php
r10879 r12149 137 137 'ENVIRONMENT' => 'dev', 138 138 'IS_DEBUG' => 'true', 139 'IP_CHECK' => '// this check prevents access to debug front con rollers that are deployed by accident to production servers.'.PHP_EOL.139 'IP_CHECK' => '// this check prevents access to debug front controllers that are deployed by accident to production servers.'.PHP_EOL. 140 140 '// feel free to remove this, extend it or make something more sophisticated.'.PHP_EOL. 141 141 'if (!in_array(@$_SERVER[\'REMOTE_ADDR\'], array(\'127.0.0.1\', \'::1\')))'.PHP_EOL. branches/dwhittle/1.2/lib/task/generator/skeleton/app/web/index.php
r9489 r12149 1 1 <?php 2 2 3 ##IP_CHECK## 3 4 require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php'); branches/dwhittle/1.2/lib/validator/sfValidatorRegex.class.php
r9048 r12149 17 17 * @version SVN: $Id$ 18 18 &nb