phpDocumentor pond
[ class tree: pond ] [ index: pond ] [ all elements ]

Source for file index.php

Documentation is available at index.php

  1. <?php
  2. /**
  3.  * This is the main public interface file.
  4.  *
  5.  * IF YOU ARE READING THIS IN YOUR WEB BROWSER, IT MEANS THAT PHP IS NOT PROPERLY INSTALLED
  6.  * ON YOUR WEB SERVER. IF YOU DON'T KNOW WHAT THIS MEANS, CONTACT YOUR SERVER ADMINISTRATOR
  7.  * OR YOUR HOSTING COMPANY.
  8.  *
  9.  * This file is NOT mandatory. You can delete it if you want.
  10.  * You can also replace the contents of this file with contents similar to the contents
  11.  * of a_stub.php, a_notemplate.php, multiblogs.php, etc.
  12.  *
  13.  * Quam Plures - {@link http://quamplures.net/}
  14.  * Released under GNU GPL License - {@link http://quamplures.net/license.html}
  15.  * @copyright (c) 2009 - 2011 by the Quam Plures developers - {@link http://quamplures.net/}
  16.  * @copyright (c)2003-2009 by Francois PLANQUE - {@link http://fplanque.net/}
  17.  *
  18.  *  {@internal Note: we need at least one file in the main package}}
  19.  *
  20.  * @package pond
  21.  */
  22.  
  23. /**
  24.  * First thing: Do the minimal initializations required for QP:
  25.  */
  26. require_once dirname(__FILE__).'/qp_config/_config.php';
  27.  
  28. /**
  29.  * Check this: we are requiring _main.inc.php INSTEAD of _blog_main.inc.php
  30.  * because we are not trying to initialize any particular blog
  31.  */
  32. require_once $inc_path.'_main.inc.php';
  33.  
  34. // Check if a specific blog has been requested in the URL:
  35. param'blog''integer'''true );
  36.  
  37. ifempty($blog) )
  38. // No blog requested by URL param, let's try to match something in the URL
  39.     $Debuglog->add'No blog param received, checking extra path...''detectblog' );
  40.  
  41.     $BlogCache get_Cache'BlogCache' );
  42.  
  43.     ifpreg_match'#^(.+?)index.php/([^/]+)#'$ReqHost.$ReqPath$matches ) )
  44.     // We have an URL blog name:
  45.         $Debuglog->add'Found a potential URL blog name: '.$matches[2]'detectblog' );
  46.         if( (($Blog $BlogCache->get_by_urlname$matches[2]false )) !== false) )
  47.         // We found a matching blog:
  48.             $blog $Blog->ID;
  49.         }
  50.     }
  51.  
  52.     ifempty($blog) )
  53.     // No blog identified by URL name, let's try to match the absolute URL
  54.         ifpreg_match'#^(.+?)index.php#'$ReqHost.$ReqPath$matches ) )
  55.         // Remove what's not part of the absolute URL
  56.             $ReqAbsUrl $matches[1];
  57.         }
  58.         else
  59.         {
  60.             $ReqAbsUrl $ReqHost.$ReqPath;
  61.         }
  62.         $Debuglog->add'Looking up absolute url : '.$ReqAbsUrl'detectblog' );
  63.  
  64.         if( (($Blog $BlogCache->get_by_url$ReqAbsUrlfalse )) !== false) )
  65.         // We found a matching blog:
  66.             $blog $Blog->ID;
  67.             $Debuglog->add'Found matching blog: '.$blog'detectblog' );
  68.         }
  69.     }
  70.  
  71.     ifempty($blog) )
  72.     // Still no blog requested, use default
  73.         $blog $Settings->get('default_blog_ID');
  74.         if( (($Blog $BlogCache->get_by_ID$blogfalsefalse )) !== false) )
  75.         // We found a matching blog:
  76.             $Debuglog->add'Using default blog '.$blog'detectblog' );
  77.         }
  78.         else
  79.         {
  80.             $blog NULL;
  81.         }
  82.     }
  83.  
  84.     ifempty($blog) )
  85.     // No specific blog to be displayed, so make something nice then exit
  86.         header_content_type'text/html' )// sets charset
  87.         ?>
  88.         <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  89.         <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php locale_lang(?>" lang="<?php locale_lang(?>">
  90.         <head>
  91.         <title><?php echo $app_name?> - Default Page</title>
  92.         <meta name="viewport" content="width = 750" />
  93.         <link href="qp_rsc/css/support_install.css" rel="stylesheet" type="text/css" />
  94.         <base href="<?php echo $app_baseurl ?>" />
  95.         </head>
  96.         <body>
  97.         <?php
  98.         // --- --- --- --- --- --- --- --- --- --- ---
  99.         // --- TOOLBAR INCLUDED HERE ---
  100.         require $templates_path.'_toolbar.inc.php';
  101.         echo "\n";
  102.         ifis_logged_in() )
  103.         {
  104.             echo '<div id="template_wrapper" class="template_wrapper_loggedin">';
  105.         }
  106.         else
  107.         {
  108.             echo '<div id="template_wrapper" class="template_wrapper_anonymous">';
  109.         }
  110.         echo "\n";
  111.         ?>
  112.         <div class="wrapper1"><div class="wrapper2"><div class="block1"><div class="block2"><div class="block3">
  113.         <h1><?php printfT_('Welcome to %s')$app_name )?></h1>
  114.         <?php
  115.         // messages generated from actions
  116.         messagesarray() );
  117.         $BlogCache get_Cache('BlogCache');
  118.         $BlogCache->load_all();
  119.         ifcount$BlogCache->cache == )
  120.         {    // There is no blog on this system!
  121.             echo '<p><strong>';
  122.             printfT_('%s is installed and ready but you haven\'t created any blog on this system yet.')$app_name );
  123.             echo '</strong></p>';
  124.             echo '<p><a href="'.$admin_url.'?ctrl=collections&amp;action=new">'.T_'Create a first blog' ).' &raquo;</a></p>';
  125.         }
  126.         else
  127.         {
  128.             echo '<p><strong>';
  129.             printfT_('You have successfully installed %s.')$app_name );
  130.             echo '</strong></p>';
  131.             echo '<p>'.T_('You haven\'t set a default blog yet. Thus, you see this default page.').'</p>';
  132.             ?>
  133.             <p><a href="<?php echo $admin_url ?>?ctrl=settings&amp;tab=general"><?php echo T_'Set a default blog' ?> &raquo;</a></p>
  134.             <?php
  135.         }
  136.         ?>
  137.         </div></div></div></div>
  138.         <div class="body_fade_out"><div class="menu_bottom">
  139.         <?php
  140.         echo '<a href="contact.php" title="'.T_('Contact the admin').'">'.T_('Contact the admin').'</a>';
  141.         echo ' &bull; ';
  142.         echo T_('powered by').' <a href="'.$app_homepage.'" title="'.$app_homepage.'">'.$app_name.'</a>';
  143.         ?>
  144.         </div></div></div></div></body></html>
  145.         <?php
  146.         exit();
  147.     }
  148. }
  149.  
  150. // A blog has been requested... Let's set a few default params:
  151.  
  152. # You could *force* a specific template here with this setting:
  153. # $template = 'basic';
  154.  
  155. # This setting retricts posts to those published, thus hiding drafts.
  156. # You should not have to change this.
  157. $show_statuses array();
  158.  
  159. # Here you can set a limit before which posts will be ignored
  160. # You can use a unix timestamp value or 'now' which will hide all posts in the past
  161. $timestamp_min '';
  162.  
  163. # Here you can set a limit after which posts will be ignored
  164. # You can use a unix timestamp value or 'now' which will hide all posts in the future
  165. $timestamp_max 'now';
  166.  
  167. # Additionnaly, you can set other values (see URL params in the manual)...
  168. # $order = 'ASC'; // This for example would display the blog in chronological order...
  169.  
  170. // That's it, now let Quam Plures do the rest! :)
  171. require $inc_path.'_blog_main.inc.php';
  172.  
  173. ?>