Ejemplo n.º 1
0
 /**
  * Builds a file path with the appropriate directory separator.
  * @param string $segments,... unlimited number of path segments
  * @return string Path
  */
 function __construct($passedArguments)
 {
     // Platform stuff
     if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'windows') !== false) {
         Core::$Platform = WINDOWS;
         system("cls");
     } else {
         Core::$Platform = UNIX;
         system("clear");
     }
     Core::Output(MESSAGE, " -=[ BLUEPRINT " . REVISION . " ]=-");
     // Assign our root directory
     $this->rootDirectory = getcwd();
     $this->SetupEnvironment();
     $this->arguments = $passedArguments;
     switch ($this->arguments[1]) {
         case "views":
         case "update":
             $this->mode = UPDATE;
             break;
         case "generate":
         case "build":
             $this->mode = BUILD;
             break;
         case "output":
         case "deploy":
             $this->mode = DEPLOY;
             break;
         case "all":
             $this->mode = ALL;
             break;
         default:
             Core::Output(ERROR, "You must provide an action to do with Blueprint.");
             // Output information on how to run Blueprint with project files/paths
             Core::Output(INFO, "Acceptable actions are \"update\" which pushes template updates to views, and \"build\" which will update the build folder, and \"deploy\" which does a comparison based copy to a target.");
             // Stop any further
             Core::$CanRun = false;
             return;
     }
     if (is_null($this->arguments[2])) {
         // Output error
         Core::Output(ERROR, "You must provide a project path to generate from.");
         // Output information on how to run Blueprint with project files/paths
         Core::Output(INFO, "By default we look in the local project folder, however you are able to provide full paths to a folder and it will use it instead. An example local project would be to use \"tests\" which will generate based on the test framework packaged with Blueprint in the project folder (" . BuildPath($this->rootDirectory, "projects", "tests") . ").");
         // Stop any further
         Core::$CanRun = false;
         return;
     } else {
         $this->LoadHelpers();
         // Load Classes
         $this->LoadClasses();
         $this->LoadParsers();
         // Load Projects
         Core::Output(MESSAGE, "Loading Projects ...");
         for ($i = 2; $i < count($this->arguments); $i++) {
             $this->LoadProject(realpath($this->arguments[$i]));
         }
     }
 }
Ejemplo n.º 2
0
        $FolderCollection = array_reverse($FolderCollection);
    }
    // Add actual folders
    for ($i = 0; $i < count($FolderCollection); $i++) {
        $Params->Set("did", FormatDelimitedString($Config->FolderIDs, $i, $Config->FolderDelimiter));
        $FileList .= "<li>\r\n         <a href=\"" . CurrentUrl() . $Params->GetQueryString() . "\">" . $FolderCollection[$i] . "</a>\r\n         </li>";
    }
    $FileList .= "</ul>\r\n";
}
// ------------------
// 5. WRITE PAGE HEAD
// ------------------
// Define the current folder path
$RootPath = substr(CurrentWebPath(), 0, strlen(CurrentWebPath()) - 1);
$CurrentPath = "<a href=\"{$RootPath}?fpp=" . $Config->FilesPerPage . "\">" . str_replace("http://", "", $RootPath) . "</a>";
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en-ca\">\r\n   <head>\r\n   <title>" . $Config->PageTitle . "</title>\r\n   <link rel=\"stylesheet\" type=\"text/css\" href=\"" . $Config->StyleUrl . "\" />\r\n   <script language=\"Javascript\" type=\"text/javascript\">\r\n      //<![CDATA[\r\n      var BodyLoaded = 0;\r\n      if (document.all && !document.getElementById) {\r\n          document.getElementById = function(id) {\r\n               return document.all[id];\r\n          }\r\n      }\r\n      function copy(inElement) {\r\n         if (inElement.createTextRange) {\r\n            var range = inElement.createTextRange();\r\n            if (range && BodyLoaded==1) range.execCommand('Copy');\r\n         } else {\r\n            var flashcopier = 'flashcopier';\r\n            if(!document.getElementById(flashcopier)) {\r\n               var divholder = document.createElement('div');\r\n               divholder.id = flashcopier;\r\n               document.body.appendChild(divholder);\r\n            }\r\n            document.getElementById(flashcopier).innerHTML = '';\r\n            var divinfo = '<embed src=\"_clipboard.swf\" FlashVars=\"clipboard='+escape(inElement.value)+'\" width=\"0\" height=\"0\" type=\"application/x-shockwave-flash\"></embed>';\r\n            document.getElementById(flashcopier).innerHTML = divinfo;\r\n         }\r\n      }\r\n      function writeImage(imageName, imageWidth, imageHeight, imageID) {\r\n         var windowWidth = getWindowWidth();\r\n         if (windowWidth < imageWidth) {\r\n            var newWidth = windowWidth - 40;\r\n            var newHeight = Math.round((newWidth*imageHeight)/(imageWidth+40));\r\n\r\n            document.write('<span id=\"sm'+imageID+'\">'\r\n               +'<div class=\"Notice\">Note: this image has been shrunk to fit on your screen. <a href=\"Javascript:resizeImage('+imageID+');\">Click here to view the image at actual size.</a></div>'\r\n               +'<img src=\"'+imageName+'\" height=\"'+newHeight+'\" width=\"'+newWidth+'\" />'\r\n            +'</span>'\r\n            +'<span id=\"lg'+imageID+'\" style=\"display: none;\">'\r\n               +'<div class=\"Notice\">Note: this image does not fit on your screen. <a href=\"Javascript:resizeImage('+imageID+');\">Click here to fit the image to your screen.</a></div>'\r\n               +'<img src=\"'+imageName+'\" height=\"'+imageHeight+'\" width=\"'+imageWidth+'\" />'\r\n            +'</span>');\r\n         } else {\r\n            document.write('<img src=\"'+imageName+'\" height=\"'+imageHeight+'\" width=\"'+imageWidth+'\" />');\r\n         }\r\n      }\r\n      function getWindowWidth() {\r\n         var myWidth = 0;\r\n         if( typeof( window.innerWidth ) == 'number' ) {\r\n            myWidth = window.innerWidth - 20;\r\n         } else if (document.documentElement && document.documentElement.clientWidth) {\r\n            myWidth = document.documentElement.clientWidth;\r\n         } else if (document.body && document.body.clientWidth) {\r\n            myWidth = document.body.clientWidth;\r\n         } else {\r\n            myWidth = screen.width;\r\n         }\r\n         return myWidth;\r\n      }\r\n      function resizeImage(imageID, link) {\r\n         var lg = document.getElementById('lg'+imageID);\r\n         var sm = document.getElementById('sm'+imageID);\r\n         if (lg && sm) {\r\n            switchVisibility(lg);\r\n            switchVisibility(sm);\r\n         }\r\n      }\r\n      function switchVisibility(object) {\r\n         if (object.style.display == 'none') {\r\n            object.style.display = 'block';\r\n         } else {\r\n            object.style.display = 'none';\r\n         }\r\n      }\r\n      //]]>\r\n   </script>\r\n   </head>\r\n   <body onload=\"BodyLoaded=1\">\r\n      <div class=\"SiteContainer\">\r\n<!--      <div class=\"Head\">\r\n         <h1>" . $Config->PageTitle . "</h1>\r\n         " . $CurrentPath . BuildPath($Config->FolderNavigator, $Config->FilesPerPage) . "\r\n      </div> --!>";
// ------------------------------------
// 6. CONFIGURE & WRITE NAVIGATION MENU
// ------------------------------------
$TotalItemCount = ForceInt(count($aItemHistory), 0);
if ($TotalItemCount > 0) {
    $TotalItemCount = $TotalItemCount - 1;
}
$FirstItem = $TotalItemCount == 0 ? false : $aItemHistory[0];
$LastItem = $TotalItemCount == 0 ? false : $aItemHistory[$TotalItemCount];
$NextItem = false;
$PreviousItemGroup = false;
$PreviousItem = false;
// If viewing a file, check to see if the file id exists in the item history
if ($TotalItemCount > 0) {
    $FileKey = false;
Ejemplo n.º 3
0
      }
      function switchVisibility(object) {
         if (object.style.display == 'none') {
            object.style.display = 'block';
         } else {
            object.style.display = 'none';
         }
      }
      //]]>
   </script>
   </head>
   <body onload=\"BodyLoaded=1\">
      <div class=\"SiteContainer\">
      <div class=\"Head\">
         <h1>".$Config->PageTitle."</h1>
         ".$CurrentPath.BuildPath($Config->FolderNavigator, $Config->FilesPerPage)."
      </div>");

// ------------------------------------
// 6. CONFIGURE & WRITE NAVIGATION MENU
// ------------------------------------
$TotalItemCount = ForceInt(count($aItemHistory), 0);
if ($TotalItemCount > 0) $TotalItemCount = $TotalItemCount-1;
$FirstItem = ($TotalItemCount == 0)?false:$aItemHistory[0];
$LastItem = ($TotalItemCount == 0)?false:$aItemHistory[$TotalItemCount];
$NextItem = false;
$PreviousItemGroup = false;
$PreviousItem = false;

// If viewing a file, check to see if the file id exists in the item history
if ($TotalItemCount > 0) {
Ejemplo n.º 4
0
 function DefineProperties()
 {
     $this->DefineBrowsingDirectory();
     // Create some holder variables
     $this->FolderCollection = array();
     $this->ImageCollection = new FileCollection();
     $ThumbnailCollection = array();
     // RETRIEVE FILES
     // Loop through files in the current browsing directory
     $FolderKey = 0;
     $FolderHandle = opendir($this->CurrentBrowsingDirectory);
     $CurrentExtension = "";
     $RecordItem = true;
     while (false !== ($Item = readdir($FolderHandle))) {
         $RecordItem = true;
         if ($Item == "." || $Item == ".." || $Item == $this->SelfUrl || in_array($this->CurrentBrowsingDirectory . "/" . $Item, $this->FullyQualifiedHideFiles)) {
             $RecordItem = false;
         }
         if ($RecordItem) {
             // If dealing with a folder, add it to the folder collection
             if (is_dir($this->CurrentBrowsingDirectory . "/" . $Item)) {
                 $this->FolderCollection[] = $Item;
                 // If not dealing with a folder, add it to the proper file collection
             } elseif (substr($Item, 0, 7) == $this->ThumbPrefix) {
                 $ThumbnailCollection[] = $Item;
             } elseif (substr($Item, 0, 1) == "_") {
                 // Ignore "hidden" files
             } elseif (in_array($this->GetFileType($this->CurrentBrowsingDirectory, $Item), $this->ThumbnailableFormats)) {
                 $this->ImageCollection->AddFile($Item, filesize($this->CurrentBrowsingDirectory . "/" . $Item), filemtime($this->CurrentBrowsingDirectory . "/" . $Item), "");
             }
         }
     }
     // BUILD THE PAGE ELEMENTS
     $ThumbedList = "";
     $NonThumbedList = "";
     // Create a parameters class to manage querystring values
     $Params = new Parameters();
     $Params->DefineCollection($_GET);
     $Params->Remove("smf");
     if ($this->FolderIDs == "") {
         $Params->Remove("did");
     }
     $FileCounter = 0;
     // Build the file listing
     // Get the sorted files
     $Files = $this->ImageCollection->GetFiles($this->SortBy, $this->SortDirection, $ThumbnailCollection);
     $ThumbBool = 0;
     $NonThumbBool = 0;
     if (count($Files) > 0) {
         for ($j = 0; $j < count($Files); $j++) {
             $FileCounter += 1;
             $CurrentFileName = $Files[$j]["Name"];
             $CurrentFileSize = $Files[$j]["Size"];
             $CurrentFileDate = $Files[$j]["Date"];
             $CurrentFileHandlerMethod = $Files[$j]["HandlerMethod"];
             if ($Files[$j]["ThumbnailPresent"]) {
                 $ThumbedList .= $this->FormatListItem($FileCounter, $CurrentFileName, $CurrentFileSize, $CurrentFileDate, $Params, $ThumbBool);
                 $ThumbBool = FlipBool($ThumbBool);
             } else {
                 $NonThumbedList .= $this->FormatListItem($FileCounter, $CurrentFileName, $CurrentFileSize, $CurrentFileDate, $Params, $NonThumbBool);
                 $NonThumbBool = FlipBool($NonThumbBool);
             }
         }
     }
     if ($NonThumbedList != "") {
         $NonThumbedList = $this->FormatImageList($NonThumbedList, "Images Without Thumbnails", "Images");
     }
     if ($ThumbedList != "") {
         $ThumbedList = $this->FormatImageList($ThumbedList, "Images With Thumbnails", "ThumbedImages");
     }
     $this->FileList = $NonThumbedList . $ThumbedList;
     // Define the current folder path
     $RootPath = substr($this->SelfWebPath, 0, strlen($this->SelfWebPath) - 1);
     $CurrentPath = "<a href=\"" . $RootPath . "/" . $this->SelfUrl . "\">" . str_replace("http://", "", $RootPath) . "</a>";
     $this->FolderList = "<div class=\"Container Folders\">\r\n\t\t\t<dl class=\"CurrentFolder\">\r\n\t\t\t\t<dt>Current Folder</dt>\r\n\t\t\t\t<dd>" . $CurrentPath . BuildPath($this->FolderNavigator, $this->SelfUrl, 0) . "</dd>\r\n\t\t\t</dl>";
     // Build the folder listing
     if (count($this->FolderCollection) > 0 || count($this->aFolderID) > 0) {
         // Sort the folders
         usort($this->FolderCollection, "strcasecmp");
         reset($this->FolderCollection);
         if ($this->SortDirection == "desc") {
             $this->FolderCollection = array_reverse($this->FolderCollection);
         }
         $Params->Remove("fid");
         $this->FolderList .= "<h2>Folders</h2>\r\n\t\t\t\t<ul class=\"FolderList\">\r\n";
         // Display the updirectory link if necessary
         if (count($this->aFolderID) > 0) {
             $ParentFolder = "";
             if (count($this->aFolderID) > 1) {
                 for ($i = 0; $i < count($this->aFolderID) - 1; $i++) {
                     $ParentFolder = FormatDelimitedString($ParentFolder, $this->aFolderID[$i], $this->FolderDelimiter);
                 }
                 $Params->Set("did", $ParentFolder);
             } else {
                 $Params->Remove("did");
             }
             $this->FolderList .= "<li><a href=\"" . $this->SelfUrl . $Params->GetQueryString() . "\">Parent Folder</a></li>\r\n";
         }
         // Add actual folders
         for ($i = 0; $i < count($this->FolderCollection); $i++) {
             $Params->Set("did", FormatDelimitedString($this->FolderIDs, $i, $this->FolderDelimiter));
             $this->FolderList .= "<li><a href=\"" . $this->SelfUrl . $Params->GetQueryString() . "\">" . $this->FolderCollection[$i] . "</a></li>\r\n";
         }
         $this->FolderList .= "</ul>";
     }
     $this->FolderList .= "</div>";
 }