コード例 #1
0
 private function writeBearerConfig($username, $password, $authBearer = null)
 {
     if (!$this->loadConfig()) {
         return false;
     }
     if (!$authBearer) {
         $authBearer = $this->guid();
     }
     $output = "<?php";
     $output .= "\n\$GLOBALS[\"LCMS\"][\"administrator\"][\"username\"]   = \"" . $username . "\";";
     $output .= "\n\$GLOBALS[\"LCMS\"][\"administrator\"][\"password\"]   = \"" . $password . "\";";
     $output .= "\n\$GLOBALS[\"LCMS\"][\"administrator\"][\"lastlogin\"]  = \"" . time() . "\";";
     $output .= "\n\$GLOBALS[\"LCMS\"][\"administrator\"][\"bearer\"]     = \"" . $authBearer . "\";";
     $output .= "\n\$GLOBALS[\"LCMS\"][\"administrator\"][\"bearer_exp\"] = \"" . (time() + 300) . "\";";
     $output .= "\n?>";
     $fileHandler = new LCMS_FileHandler();
     $fileHandler->save($GLOBALS["LCMS"]["authfile"], $output);
     return $authBearer;
 }
コード例 #2
0
 private function showDir($incomingData)
 {
     // Load Files
     $fileSystem = new LCMS_FileHandler();
     $dirContent = $fileSystem->scanDir($GLOBALS["LCMS"]["internalFolder"] . "/" . $GLOBALS["LCMS"]["originPath"]);
     // Result
     $result = array();
     foreach ($dirContent as $file) {
         $result[] = array("url" => $this->getFrontendUrl($GLOBALS["LCMS"]["originPath"] . "/" . $file), "name" => $file);
     }
     return json_encode($result);
 }