PageRenderTime 53ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

/application/controllers/IndexController.php

https://github.com/sashafr/open-context-code
PHP | 97 lines | 37 code | 11 blank | 49 comment | 6 complexity | 294ef3ad6e98397e51f5d82312cf6095 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. <?php
  2. /** Zend_Controller_Action */
  3. require_once 'Zend/Controller/Action.php';
  4. class indexController extends Zend_Controller_Action
  5. {
  6. public function altHomeAction(){
  7. }
  8. public function indexAction()
  9. {
  10. $host = OpenContext_OCConfig::get_host_config();
  11. if(substr_count($_SERVER['HTTP_HOST'], "www.")>0){
  12. $reDirectURI = $host;
  13. header('Location: '.$reDirectURI);
  14. exit;
  15. }
  16. @$agent = $_SERVER['HTTP_USER_AGENT'];
  17. //$this->view->simpleView = false;
  18. if($agent){
  19. if(stristr($agent, "safari") || stristr($agent, "iphone") || stristr($agent, "ipad")|| stristr($agent, "firefox")){
  20. //$this->view->simpleView = true;
  21. if(isset($_GET["test"])){
  22. return $this->render("alt-home");
  23. }
  24. }
  25. }
  26. }
  27. public function robotsAction() {
  28. $this->_helper->viewRenderer->setNoRender();
  29. $host = OpenContext_OCConfig::get_host_config();
  30. $robots = "
  31. User-agent:*\r\n
  32. Crawl-Delay:0.5\r\n
  33. Disallow:/cgi-bin/\r\n
  34. Disallow:/tmp/\r\n
  35. Disallow:/sets/\r\n
  36. Disallow:/lightbox/\r\n
  37. Disallow:/search/\r\n
  38. Disallow:/properties/\r\n
  39. Disallow:/narratives/\r\n
  40. Disallow: /*&\r\n
  41. Sitemap: http://opencontext.org/data/siteMap-1.xml \r\n
  42. Sitemap: http://opencontext.org/data/siteMap-2.xml \r\n
  43. Sitemap: http://opencontext.org/data/siteMap-3.xml \r\n
  44. Sitemap: http://opencontext.org/data/siteMap-4.xml \r\n
  45. Sitemap: http://opencontext.org/data/siteMap-5.xml \r\n
  46. Sitemap: http://opencontext.org/data/siteMap-6.xml \r\n
  47. Sitemap: http://opencontext.org/data/siteMap-7.xml \r\n
  48. Sitemap: http://opencontext.org/data/siteMap-8.xml \r\n
  49. Sitemap: http://opencontext.org/data/siteMap-9.xml \r\n
  50. Sitemap: http://opencontext.org/data/siteMap-10.xml \r\n
  51. Sitemap: http://opencontext.org/data/siteMap-11.xml \r\n
  52. Sitemap: http://opencontext.org/data/siteMap-12.xml \r\n
  53. Sitemap: http://opencontext.org/data/siteMap-13.xml \r\n
  54. Sitemap: http://opencontext.org/data/siteMap-14.xml \r\n
  55. Sitemap: http://opencontext.org/data/siteMap-15.xml \r\n
  56. Sitemap: http://opencontext.org/data/siteMap-16.xml \r\n
  57. Sitemap: http://opencontext.org/data/siteMap-17.xml \r\n
  58. Sitemap: http://opencontext.org/data/siteMap-18.xml \r\n
  59. Sitemap: http://opencontext.org/data/siteMap-19.xml \r\n
  60. ";
  61. header("Content-Type: text/plain");
  62. echo $robots;
  63. }
  64. //this is for the timemap js, for some reason it likes to request __history__.html
  65. public function historyAction() {
  66. $this->_helper->viewRenderer->setNoRender();
  67. header("Content-Type: text/plain");
  68. echo true;
  69. }
  70. public function rssProjectsRss2PhpAction() {
  71. $this->_helper->viewRenderer->setNoRender();
  72. $host = OpenContext_OCConfig::get_host_config();
  73. $reDirectURI = $host."/projects/.atom";
  74. header('Location: '.$reDirectURI);
  75. exit;
  76. }
  77. }