Example #1
0
 public static function getResource($resource)
 {
     if (class_exists('DBSR_GUI_Resources', FALSE)) {
         return DBSR_GUI_Resources::getResource($resource);
     }
     if (preg_match('/\\.\\.[\\/\\\\]/', $resource)) {
         return FALSE;
     }
     $resource = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'DBSR_GUI_Resources' . DIRECTORY_SEPARATOR . $resource;
     if (!is_readable($resource) || !is_file($resource)) {
         return FALSE;
     }
     return @file_get_contents($resource);
 }
Example #2
0
 /**
  * Get the resource file content.
  * @param 	string 	$resource 	The filename of the resource.
  * @return 	mixed 				The content of the file as string, or FALSE if unsuccessful.
  */
 public static function getResource($resource)
 {
     // Check if a compiled version is available
     if (class_exists('DBSR_GUI_Resources', FALSE)) {
         return DBSR_GUI_Resources::getResource($resource);
     }
     // No directory traversing
     if (preg_match('/\\.\\.[\\/\\\\]/', $resource)) {
         return FALSE;
     }
     // Add path to filename
     $resource = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'DBSR_GUI_Resources' . DIRECTORY_SEPARATOR . $resource;
     // Does the file exists
     if (!is_readable($resource) || !is_file($resource)) {
         return FALSE;
     }
     // Return the content
     return @file_get_contents($resource);
 }