Index: /plugins/ac2009WebDebugPlugin/config/app.yml =================================================================== --- /plugins/ac2009WebDebugPlugin/config/app.yml (revision 25164) +++ /plugins/ac2009WebDebugPlugin/config/app.yml (revision 25164) @@ -0,0 +1,6 @@ +# default values +all: + ac_web_debug_plugin: + panels: + checklist: acWebDebugPanelChecklist + documentation: acWebDebugPanelDocumentation Index: /plugins/ac2009WebDebugPlugin/config/acWebDebugPluginConfiguration.class.php =================================================================== --- /plugins/ac2009WebDebugPlugin/config/acWebDebugPluginConfiguration.class.php (revision 25164) +++ /plugins/ac2009WebDebugPlugin/config/acWebDebugPluginConfiguration.class.php (revision 25164) @@ -0,0 +1,42 @@ + + * @copyright Blue Door Project 2009 + * @since 2009-10-24 + * @version svn:$Id$ $Author$ + */ + +class acWebDebugPluginConfiguration extends sfPluginConfiguration +{ + /** + * @see sfPluginConfiguration + */ + public function initialize() + { + $this->dispatcher->connect('debug.web.load_panels', array('acWebDebugPluginConfiguration', 'listenToLoadDebugWebPanelEvent')); + } + + /** + * Global listener for all the web debug panels in this plugin. Each will be + * added based on the 'enabled_panels' configuration value + * + * Listens on the debug.web.load_panels event + */ + public static function listenToLoadDebugWebPanelEvent(sfEvent $event) + { + $panels = sfConfig::get('app_ac_web_debug_plugin_panels', array()); + + foreach($panels as $name => $panelClass) + { + if ($panelClass) + { + $event->getSubject()->setPanel($name, new $panelClass($event->getSubject())); + } + } + } +} Index: /plugins/ac2009WebDebugPlugin/lib/debug/acWebDebugPanelChecklist.class.php =================================================================== --- /plugins/ac2009WebDebugPlugin/lib/debug/acWebDebugPanelChecklist.class.php (revision 25164) +++ /plugins/ac2009WebDebugPlugin/lib/debug/acWebDebugPanelChecklist.class.php (revision 25164) @@ -0,0 +1,262 @@ + + * @link http://symfony-check.org/ + * @copyright Blue Door Project 2009 + * @since 2009-10-24 + * @version svn:$Id$ $Author$ + */ +class acWebDebugPanelChecklist extends sfWebDebugPanel +{ + protected $checkList = array( + 1 => 'Customize the "Oops! Page Not Found page', + 2 => 'Customize the "Oops! An Error Occurred" page', + 3 => 'Customize the "Login Required" page', + 4 => 'Customize the "Credentials Required" page', + 5 => 'Customize the "This Module is Unavailable" page', + 6 => 'Customize the "Website Temporarily Unavailable" page', + 7 => 'Add a favicon', + 8 => 'Change the cookie names', + 9 => 'Check the configuration of the production server', + 10 => 'Customize the language of your pages', + 11 => 'Delete "/backend.php/" from your uri', + 12 => 'Install a PHP Accelerator', + 19 => 'Optimize Apache: avoid .htaccess', + 13 => 'Log errors in the production environment', + 14 => 'Customize rsync_exclude.txt', + 15 => 'Escape your templates', + 16 => 'Protect your forms', + 17 => 'Redirect to the unavailable screen during the maintenance operations', + 18 => 'Optimize your routes', + + ); + + public function getTitle() + { + return 'Symfony Deployment Checklist checklist'; + } + + public function getPanelTitle() + { + return 'Symfony Deployment Checklist'; + } + + public function getPanelContent() + { + $content = ''; + foreach($this->checkList as $num => $item) + { + $url = 'http://symfony-check.org/#todo' . $num; + + $content .= sprintf('%s

%s

', + $this->getCheckIcon($num), + $url, + $url, + $item + ); + } + + $header = sprintf(' +

http://symfony-check.org

+ The symfony deployment checklist, provided by + UI Studio is a great way to make + sure you\'ve got everything prepared before going to production. This + panel attempts to determine which of the following items have been completed. +
', + $this->getColorSpan(true), + $this->getColorSpan(false), + $this->getColorSpan(null) + ); + + return sprintf('%s%s
', $header, $content); + } + + protected function getCheckIcon($num) + { + $method = 'isChecked'.$num; + + if (method_exists($this, $method)) + { + $ret = $this->$method(); + } + else + { + $ret = null; + } + + return $this->getColorSpan($ret); + } + + /** + * Returns the colored span that relates to either a "yes", "no" or "unknown" + * + * @param boolean $status true, false or null for "yes", "no" or "unknown" + */ + protected function getColorSpan($status) + { + if ($status === true) + { + $txt = 'Y'; + $color = 'darkgreen'; + } + elseif ($status === false) + { + $txt = 'X'; + $color = 'darkred'; + } + else + { + $txt = '?'; + $color = 'lightblue'; + } + + return sprintf('%s', $color, $txt); + } + + + /* + ************** Is-Checked functions + */ + + + /* + * Determines if the error404 page has been customized or not + */ + protected function isChecked1() + { + return ( + sfConfig::get('sf_error_404_module') != 'default' + || sfConfig::get('sf_error_404_action') != 'error404' + || file_exists(sfConfig::get('sf_app_module_dir') . '/default/templates/error404Success.php') + ); + } + + /* + * Determines if the error500 page has been customized or not + */ + protected function isChecked2() + { + return (file_exists(sfConfig::get('sf_app_config_dir').'/error/error.html.php') || file_exists(sfConfig::get('sf_config_dir').'/error/error.html.php')); + } + + /* + * Determines if the login page has been customized + */ + protected function isChecked3() + { + return ( + sfConfig::get('sf_login_module') != 'default' + || sfConfig::get('sf_login_action') != 'login' + || file_exists(sfConfig::get('sf_app_module_dir') . '/default/templates/loginSuccess.php') + ); + } + + /* + * Determines if the login page has been customized + */ + protected function isChecked4() + { + return ( + sfConfig::get('sf_secure_module') != 'default' + || sfConfig::get('sf_secure_action') != 'secure' + || file_exists(sfConfig::get('sf_app_module_dir') . '/default/templates/secureSuccess.php') + ); + } + + /* + * Determines if the module disabled page has been customized + */ + protected function isChecked5() + { + return ( + sfConfig::get('sf_module_disabled_module') != 'default' + || sfConfig::get('sf_module_disabled_action') != 'disabled' + || file_exists(sfConfig::get('sf_app_module_dir') . '/default/templates/disabledSuccess.php') + ); + } + + /* + * Determines if the "unavailable" / project-disabled page has been customized + */ + protected function isChecked6() + { + return (file_exists(sfConfig::get('sf_app_config_dir').'/error/unavailable.php') || file_exists(sfConfig::get('sf_config_dir').'/error/unavailable.php')); + } + + /* + * Determines if a favicon exists + */ + protected function isChecked7() + { + return (file_exists(sfConfig::get('sf_web_dir').'/favicon.ico')); + } + + /* + * Determines if the cookie name has been changed + */ + protected function isChecked8() + { + $options = sfContext::getInstance()->getStorage()->getOptions(); + + return ($options['session_name'] != 'symfony'); + } + + /* + * Determines if logging is enabled in production + * + * This one is definitely not an exact science. + */ + protected function isChecked13() + { + $settings = sfYaml::load(sfConfig::get('sf_app_config_dir') . '/settings.yml'); + + // check for logging_enabled in settings.yml + if (isset($settings['prod']) && isset($settings['prod']['.settings']) && isset($settings['prod']['.settings']['logging_enabled']) && !$settings['prod']['.settings']['logging_enabled']) + { + return false; + } + + $factories = sfYaml::load(sfConfig::get('sf_app_config_dir') . '/factories.yml'); + + if (!isset($factories['prod']) || !isset($factories['prod']['logger']) || empty($factories['prod']['logger']) || $factories['prod']['logger']['class'] == 'sfNoLogger') + { + return false; + } + + return true; + } + + /* + * Determines if output escaping is on or not + */ + protected function isChecked15() + { + return (sfConfig::get('sf_escaping_strategy')); + } + + /* + * Determines if csrf_protection is enabled + */ + protected function isChecked16() + { + $form = new sfForm(); + + return ($form->isCSRFProtected()); + } + + /* + * Determines if check_locks is on + */ + protected function isChecked17() + { + return (sfConfig::get('sf_check_lock')); + } + + +} Index: /plugins/ac2009WebDebugPlugin/lib/debug/acWebDebugPanelDocumentation.class.php =================================================================== --- /plugins/ac2009WebDebugPlugin/lib/debug/acWebDebugPanelDocumentation.class.php (revision 25164) +++ /plugins/ac2009WebDebugPlugin/lib/debug/acWebDebugPanelDocumentation.class.php (revision 25164) @@ -0,0 +1,59 @@ + + * @since 2009-10-25 + * @version svn:$Id$ $Author$ + */ +class acWebDebugPanelDocumentation extends sfWebDebugPanel +{ + protected $definitiveGuideChapters = array( + 'Chapter 1 - Introducing Symfony' => 'http://www.symfony-project.org/book/1_2/01-Introducing-Symfony', + 'Chapter 2 - Exploring Symfony\'s Code' => 'http://www.symfony-project.org/book/1_2/02-Exploring-Symfony-s-Code', + 'Chapter 3 - Running Symfony' => 'http://www.symfony-project.org/book/1_2/03-Running-Symfony', + 'Chapter 4 - The Basics Of Page Creation' => 'http://www.symfony-project.org/book/1_2/04-The-Basics-of-Page-Creation', + 'Chapter 5 - Configuring Symfony' => 'http://www.symfony-project.org/book/1_2/05-Configuring-Symfony', + 'Chapter 6 - Inside The Controller Layer' => 'http://www.symfony-project.org/book/1_2/06-Inside-the-Controller-Layer', + 'Chapter 7 - Inside The View Layer' => 'http://www.symfony-project.org/book/1_2/07-Inside-the-View-Layer', + 'Chapter 8 - Inside The Model Layer' => 'http://www.symfony-project.org/book/1_2/08-Inside-the-Model-Layer', + 'Chapter 9 - Links And The Routing System' => 'http://www.symfony-project.org/book/1_2/09-Links-and-the-Routing-System', + 'Chapter 10 - Forms' => 'http://www.symfony-project.org/book/1_2/10-Forms', + 'Chapter 11 - Ajax Integration' => 'http://www.symfony-project.org/book/1_2/11-Ajax-Integration', + 'Chapter 12 - Caching' => 'http://www.symfony-project.org/book/1_2/12-Caching', + 'Chapter 13 - I18n And L10n' => 'http://www.symfony-project.org/book/1_2/13-I18n-and-L10n', + 'Chapter 14 - Admin Generator' => 'http://www.symfony-project.org/book/1_2/14-Generators', + 'Chapter 15 - Unit And Functional Testing' => 'http://www.symfony-project.org/book/1_2/15-Unit-and-Functional-Testing', + 'Chapter 16 - Application Management Tools' => 'http://www.symfony-project.org/book/1_2/16-Application-Management-Tools', + 'Chapter 17 - Extending Symfony' => 'http://www.symfony-project.org/book/1_2/17-Extending-Symfony', + 'Chapter 18 - Performance' => 'http://www.symfony-project.org/book/1_2/18-Performance', + 'Chapter 19 - Mastering Symfony\'s Configuration Files' => 'http://www.symfony-project.org/book/1_2/19-Mastering-Symfony-s-Configuration-Files', + ); + + public function getTitle() + { + return 'Documentation Shortcuts docs'; + } + + public function getPanelTitle() + { + return 'Documentation'; + } + + public function getPanelContent() + { + $content = sprintf('

The Definitive Guide to symfony %s

', $this->getToggler('definitive_guide', 'The Definitive Guide to symfony')); + + $chptContent = ''; + foreach($this->definitiveGuideChapters as $title => $url) + { + $chptContent .= sprintf('
  • %s
  • ', $url, $title, $title); + } + $content .= sprintf('', $chptContent); + + return $content; + } +}