Loading Please wait...

mediaRouter Class Reference

Media Router The Zigmoyd Shared Content Router. More...

Inheritance diagram for mediaRouter:

Inheritance graph
[legend]
Collaboration diagram for mediaRouter:

Collaboration graph
[legend]

Public Member Functions

 getMimeType ($extension)
 returns the Mime Type of the File By Extension returns mime type from system (e.g.
 defineSharedPaths ()
 define Constants to loacte the Path Correctly and flexibly
 determineSharedPath ()
 returns the shared Partial path of the requested file
 locateSharedPath ()
 returns the shared full system path of the requested file
 sendContentType ()
 send the Mime Content Tyoe of teh Requested file
 send404 ()
 sends 404 Header
 readFile ()
 Reads teh requested file and sends it to teh output Buffer (e.g.
 doRoute ()
 Do the Routing (e.g.

Detailed Description

Media Router The Zigmoyd Shared Content Router.

Private

Definition at line 43 of file rt.php.


Member Function Documentation

mediaRouter::getMimeType ( extension  ) 

returns the Mime Type of the File By Extension returns mime type from system (e.g.

Unix's /etc/mime.types or apache's mime.types File is not exists on zigmoyd's etc/mime.types)

Private

Parameters:
$extension string
Returns:
string

Definition at line 52 of file rt.php.

Referenced by readFile(), and sendContentType().

00052                                   {
00053     $mime = parse_ini_file(ZIGSETTINGS.DRS.'mime.types.ini.php');
00054     if(!isset($mime[$extension])){
00055       return mime_content_type($mime[$extension]);
00056     }else{
00057       return $mime[$extension];
00058     }
00059   }

mediaRouter::defineSharedPaths (  ) 

define Constants to loacte the Path Correctly and flexibly

Private

Definition at line 65 of file rt.php.

Referenced by doRoute().

00065                               {
00066     $dummyBin = parse_ini_file(ZIGSETTINGS.DRS.'mime.types.ini.php',  true);
00067     foreach($dummyBin['flag'] as $defKey => $defVal){
00068       if(!defined($defKey))define($defKey, $defVal);
00069     }
00070   }

mediaRouter::determineSharedPath (  ) 

returns the shared Partial path of the requested file

Private

Returns:
string

Definition at line 77 of file rt.php.

References $GLOBALS, and perror().

00077                                 {
00078     switch($GLOBALS['contentType']){
00079       case ZIG_ROUTE_FLAG_UPLOAD:
00080           return Z_DIR_TRANS_UP;
00081         break;
00082       case ZIG_ROUTE_FLAG_DOWNLOAD:
00083           return Z_DIR_TRANS_DN;
00084         break;
00085       case ZIG_ROUTE_FLAG_PIX:
00086           return Z_DIR_IMG;
00087         break;
00088       case ZIG_ROUTE_FLAG_JS:
00089           return Z_DIR_JS;
00090         break;
00091       case ZIG_ROUTE_FLAG_VBS:
00092           return Z_DIR_VBS;
00093         break;
00094       case ZIG_ROUTE_FLAG_CSS:
00095           return Z_DIR_CSS;
00096         break;
00097       case ZIG_ROUTE_FLAG_AJX_JS:
00098           return Z_DIR_AJX_C;
00099         break;
00100       default:
00101           perror('<code>zigmoyd.SharedContent.route</code>Invalid Type '.$GLOBALS['contentType']);
00102     }
00103   }

Here is the call graph for this function:

mediaRouter::locateSharedPath (  ) 

returns the shared full system path of the requested file

Private

Returns:
string

Definition at line 110 of file rt.php.

References $GLOBALS.

Referenced by readFile().

00110                              {
00111     $path = ZIGROOT.DRS.Z_DIR_PROJECTS.DRS.fstab_getProjectDirByName($GLOBALS['prjName']).DRS.mediaRouter::determineSharedPath().$GLOBALS['filePath'];
00112     return $path;
00113   }

mediaRouter::sendContentType (  ) 

send the Mime Content Tyoe of teh Requested file

Private

Definition at line 119 of file rt.php.

References $GLOBALS, zLogger::error(), getMimeType(), and perror().

Referenced by readFile().

00119                             {
00120     if(!headers_sent()){
00121       header('Content-Type: '.mediaRouter::getMimeType(pathinfo($GLOBALS['filePath'], PATHINFO_EXTENSION)));
00122     }else{
00123       perror("<code>zigmoyd.shared.Router</code><br />Failed to sent Content Type as HEADER ALREADY SENT");
00124       zLogger::error("failed To Send Mime Type as Header already sent", 'shared.Router');
00125     }
00126   }

Here is the call graph for this function:

mediaRouter::send404 (  ) 

sends 404 Header

Private

Definition at line 132 of file rt.php.

Referenced by readFile().

00132                     {
00133     header('HTTP/1.0 404 Not Found');
00134   }

mediaRouter::readFile (  ) 

Reads teh requested file and sends it to teh output Buffer (e.g.

Browser)

Private

Returns:
boolean

Definition at line 141 of file rt.php.

References $__Z__ContentPath, $GLOBALS, zLogger::error(), getMimeType(), locateSharedPath(), perror(), send404(), and sendContentType().

Referenced by doRoute().

00141                      {
00142     global $__Z__ContentPath;
00143     $sharedPath = mediaRouter::locateSharedPath();
00144     if(!file_exists($sharedPath)){
00145       mediaRouter::send404();
00146       zLogger::error('File '.$sharedPath.' doesn\'t exists', 'shared.router');
00147       perror('File '.$sharedPath.' doesn\'t exists');
00148     }else{
00149       if(!is_readable($sharedPath)){
00150         mediaRouter::send404();
00151         zLogger::error('File '.$sharedPath.' is not readable Plese Check the permission', 'shared.router');
00152         perror('File '.$GLOBALS['filePath'].' is not readable Plese Check the permission');
00153       }else{
00154         mediaRouter::sendContentType();
00155         $__Z__ContentPath = $sharedPath;
00156         if(strstr(mediaRouter::getMimeType(pathinfo($GLOBALS['filePath'], PATHINFO_EXTENSION)), "text")){
00157           return include($__Z__ContentPath);
00158         }else{
00159           return readfile($__Z__ContentPath);
00160         }
00161       }
00162     }
00163     return false;
00164   }

Here is the call graph for this function:

mediaRouter::doRoute (  ) 

Do the Routing (e.g.

semnd the Contents of the requested file to the Output Buffer / Browser)

Returns:
boolean

Definition at line 170 of file rt.php.

References defineSharedPaths(), and readFile().

00170                     {
00171     mediaRouter::defineSharedPaths();
00172     return mediaRouter::readFile();
00173   }

Here is the call graph for this function:


The documentation for this class was generated from the following file:

Generated on Mon Oct 27 23:53:08 2008 for zigmoyd.kdevelop by doxygen 1.5.6