Пример #1
0
function OptionGet($varname, $default = '')
{
    return Option_Get($varname, $default);
}
Пример #2
0
 function pullAndro()
 {
     ob_start();
     x_EchoFlush("Obtaining information about Node Manager");
     $info = SQL_AllRows("Select n.node_url\n            from applications a\n            join nodes        n ON a.node = n.node\n           where a.application='andro'");
     if (count($info) == 0) {
         x_EchoFlush("ERROR!  There is no entry for the node manager!");
         return;
     }
     // Pull the two pieces we need to know
     $URL = $info[0]['node_url'];
     x_EchoFlush("We will pull latest code from:");
     x_EchoFlush("  {$URL}");
     $URL = "http://" . $URL . "/andro/pages/public_downloads/";
     x_EchoFlush("Complete URL will be:");
     x_EchoFlush("  {$URL}");
     x_EchoFlush("Requesting name of latest file from remote URL");
     $URL_req = $URL . "latest_filename.php";
     x_EchoFlush(" Complete request string is " . $URL_req);
     $filename = file_get_contents($URL_req);
     x_EchoFLush("Remote URL reports latest file is: {$filename}");
     x_EchoFlush("Beginning download of {$filename}");
     $file = file_get_contents($URL . $filename);
     x_EchoFlush("Download complete. Filesize is " . strlen($file) . ' bytes');
     $fileapps = $GLOBALS['AG']['dirs']['root'] . "pkg-apps";
     $filespec = $GLOBALS['AG']['dirs']['root'] . "pkg-apps/{$filename}";
     // KFD 7/25/07, this does not appear on windows systems
     if (!file_exists($fileapps)) {
         mkdir($fileapps);
     }
     x_EchoFlush("Saving as {$filespec}");
     x_EchoFlush("Bytes written: " . file_put_contents($filespec, $file));
     // Here is the extraction code
     x_EchoFlush("Extracting locally");
     require_once "Archive/Tar.php";
     $tar = new Archive_Tar($filespec, 'gz');
     $tar->extract($fileapps);
     // Protect flag
     $protect = strtolower(Option_Get("NM_PROTECT"));
     if (in_array($protect, array('yes', 'true', 'y'))) {
         x_EchoFlush("");
         x_EchoFlush("ERROR!");
         x_EchoFlush("The system variable NM_PROTECT has value -{$protect}-");
         x_EchoFlush("This prevents any overwriting of node manager code");
         x_EchoFlush("On this node.  This is an undocumented option and");
         x_EchoFlush("would not normally be set by accident.");
         return;
     }
     // If we didn't abort because we're Ken's laptop, expand
     // directly over the currently running node manager.
     //
     x_echoFlush("Unpacking with PEAR Archive_Tar library.");
     $filedest = $GLOBALS['AG']['dirs']['root'];
     $remove_path = basename($filespec, ".tgz");
     $tar->extractModify($filedest, $remove_path);
     x_EchoFlush("Done");
     echo ob_get_clean();
 }