예제 #1
0
 function getPageUpdate($serverScheme, $serverName, $base, $location, $fileName, $rawDataSource, $rawDataEdit, $rawDataFile)
 {
     $page = new YellowPage($this->yellow);
     $page->setRequestInformation($serverScheme, $serverName, $base, $location, $fileName);
     $page->parseData($this->merge->merge($rawDataSource, $rawDataEdit, $rawDataFile), false, 0);
     if (empty($page->rawData)) {
         $page->error(500, "Page has been modified by someone else!");
     }
     if ($this->yellow->lookup->isFileLocation($location) && !$page->isError()) {
         $pageSource = new YellowPage($this->yellow);
         $pageSource->setRequestInformation($serverScheme, $serverName, $base, $location, $fileName);
         $pageSource->parseData($rawDataSource, false, 0);
         $prefix = $this->yellow->config->get("webinterfaceMetaFilePrefix");
         if ($pageSource->get($prefix) != $page->get($prefix) || $pageSource->get("title") != $page->get("title")) {
             $page->fileName = $this->yellow->lookup->findFileFromTitle($page->get($prefix), $page->get("title"), $fileName, $this->yellow->config->get("contentDefaultFile"), $this->yellow->config->get("contentExtension"));
             $page->location = $this->yellow->lookup->findLocationFromFile($page->fileName);
             if ($pageSource->location != $page->location) {
                 if (!$this->yellow->lookup->isFileLocation($page->location)) {
                     $page->error(500, "Page '" . $page->get("title") . "' is not allowed!");
                 } else {
                     if ($this->yellow->pages->find($page->location)) {
                         $page->error(500, "Page '" . $page->get("title") . "' already exists!");
                     }
                 }
             }
         }
     }
     if (!$this->getUserPermission($page->location, $page->fileName)) {
         $page->error(500, "Page '" . $page->get("title") . "' is not allowed!");
     }
     return $page;
 }
예제 #2
0
파일: core.php 프로젝트: bell0956/bell0956
 function scanLocation($location)
 {
     if (is_null($this->files[$location])) {
         if (defined("DEBUG") && DEBUG >= 2) {
             echo "YellowFiles::scanLocation location:{$location}<br/>\n";
         }
         $this->files[$location] = array();
         $serverScheme = $this->yellow->page->serverScheme;
         $serverName = $this->yellow->page->serverName;
         $base = $this->yellow->page->base;
         if (empty($location)) {
             $fileNames = array($this->yellow->config->get("mediaDir"));
         } else {
             $fileNames = array();
             $path = substru($location, 1);
             foreach ($this->yellow->toolbox->getDirectoryEntries($path, "/.*/", true, true, true) as $entry) {
                 array_push($fileNames, $entry . "/");
             }
             foreach ($this->yellow->toolbox->getDirectoryEntries($path, "/.*/", true, false, true) as $entry) {
                 array_push($fileNames, $entry);
             }
         }
         foreach ($fileNames as $fileName) {
             $file = new YellowPage($this->yellow);
             $file->setRequestInformation($serverScheme, $serverName, $base, "/" . $fileName, $fileName);
             $file->parseData(NULL, false, 0);
             array_push($this->files[$location], $file);
         }
     }
     return $this->files[$location];
 }