function __autoload($className)
{
    $file = findFile($className . '.php', 'class');
    if ($file != null) {
        $chunks = explode("/", $file);
        if (TEST_MODE_ACTIVATED && in_array("old", $chunks)) {
            echo Debug::createWarningTag("Old script used: {$file}");
        }
        include $file;
    } else {
        throw new Exception($className . " not found");
    }
}
Esempio n. 2
0
 function run($dbi, $argstr, &$request, $basepage)
 {
     /* ignore fatal on loading */
     /*
     global $ErrorManager;
     $ErrorManager->pushErrorHandler(new WikiMethodCb($this,'_error_handler'));
     */
     // Require the XML_FOAF_Parser class. This is a pear library not included with phpwiki.
     // see doc/README.foaf
     if (findFile('XML/FOAF/Parser.php', 'missing_ok')) {
         require_once 'XML/FOAF/Parser.php';
     }
     //$ErrorManager->popErrorHandler();
     if (!class_exists('XML_FOAF_Parser')) {
         return $this->error(_("required pear library XML/FOAF/Parser.php not found in include_path"));
     }
     extract($this->getArgs($argstr, $request));
     // Get our FOAF File from the foaf plugin argument or $_GET['foaf']
     if (empty($foaf)) {
         $foaf = $request->getArg('foaf');
     }
     $chooser = HTML::form(array('method' => 'get', 'action' => $request->getURLtoSelf()), HTML::h4(_("FOAF File URI")), HTML::input(array('id' => 'foaf', 'name' => 'foaf', 'type' => 'text', 'size' => '80', 'value' => $foaf)), HTML::br(), HTML::input(array('id' => 'pretty', 'name' => 'pretty', 'type' => 'radio', 'checked' => 'checked'), _("Pretty HTML")), HTML::input(array('id' => 'original', 'name' => 'original', 'type' => 'radio'), _("Original URL (Redirect)")), HTML::br(), HTML::input(array('type' => 'submit', 'value' => _("Parse FOAF"))));
     if (empty($foaf)) {
         return $chooser;
     } else {
         //Error Checking
         if (substr($foaf, 0, 7) != "http://") {
             return $this->error(_("foaf must be a URI starting with http://"));
         }
         // Start of output
         if (!empty($original)) {
             $request->redirect($foaf);
         } else {
             $foaffile = url_get_contents($foaf);
             if (!$foaffile) {
                 //TODO: get errormsg
                 return HTML(HTML::p("Resource isn't available: Something went wrong, probably a 404!"));
             }
             // Create new Parser object
             $parser = new XML_FOAF_Parser();
             // Parser FOAF into $foaffile
             $parser->parseFromMem($foaffile);
             $a = $parser->toArray();
             $html = HTML(HTML::h1(@$a[0]["name"]), HTML::table(HTML::thead(), HTML::tbody(@$a[0]["title"] ? HTML::tr(HTML::td(_("Title")), HTML::td($a[0]["title"])) : null, @$a[0]["homepage"][0] ? $this->iterateHTML($a[0], "homepage", $a["dc"]) : null, @$a[0]["weblog"][0] ? $this->iterateHTML($a[0], "weblog", $a["dc"]) : null, HTML::tr(HTML::td("Full Name"), @$a[0]["name"][0] ? HTML::td(@$a[0]["name"]) : null), @$a[0]["nick"][0] ? $this->iterateHTML($a[0], "nick", $a["dc"]) : null, @$a[0]["mboxsha1sum"][0] ? $this->iterateHTML($a[0], "mboxsha1sum", $a["dc"]) : null, @$a[0]["depiction"][0] ? $this->iterateHTML($a[0], "depiction", $a["dc"]) : null, @$a[0]["seealso"][0] ? $this->iterateHTML($a[0], "seealso", $a["dc"]) : null, HTML::tr(HTML::td("Source"), HTML::td(HTML::a(array('href' => @$foaf), "RDF"))))));
             if (DEBUG) {
                 $html->pushContent(HTML::hr(), $chooser);
             }
             return $html;
         }
     }
 }
Esempio n. 3
0
function findFile($dir, $class)
{
    $file = $dir . '/' . $class . '.php';
    if (file_exists($file)) {
        return $file;
    }
    if ($dh = opendir($dir)) {
        while (false !== ($dr = readdir($dh))) {
            if ('.' == $dr || '..' == $dr) {
                continue;
            }
            if (is_dir($dr)) {
                findFile($dr, $class);
            }
        }
    }
    return false;
}
/**
 * @param string $dir
 * @param array $list
 * @return array
 */
function findFile($dir, array $list = array())
{
    $resource = opendir($dir);
    while (($file = readdir($resource)) !== false) {
        if (preg_match('!^\\.+$!', $file)) {
            continue;
        }
        $fullpath = $dir . '/' . $file;
        if (file_exists($fullpath)) {
            if (is_dir($fullpath)) {
                $list2 = findFile($fullpath, $list);
                $list = array_merge($list, $list2);
            } else {
                $list[] = $fullpath;
            }
        } else {
            continue;
        }
    }
    closedir($resource);
    return $list;
}
Esempio n. 5
0
<?php

require_once "util.php";
$method = strtolower($_SERVER['REQUEST_METHOD']);
$app = $_REQUEST["app"];
if (empty($app)) {
    echo "error: empty app";
    return;
}
$i2iFolder = findDirectory("0B3fQzMzGKQsccFQzZUQza1RMZ1E");
$appFolder = findDirectory($app, $i2iFolder, true);
$sheet = findFile("{$app}.gsheet", $appFolder, true);
$sheet = $sheets->spreadsheets_values->get($sheet->getId(), "DB!");
$db = $sheet->getSheets()->getWorksheets()->getByTitle("DB");
if ($method === "get") {
    $entries = $db->getListFeed()->getEntries();
    echo "[";
    $isFirst = true;
    foreach ($entries as $entry) {
        if ($isFirst === true) {
            $isFirst = false;
        } else {
            echo ",";
        }
        echo json_encode($entry->getValues());
    }
    echo "]";
    return;
} else {
    if ($method === "post") {
        $values = json_decode($_REQUEST["values"]);
Esempio n. 6
0
function optimizeMySQL()
{
    // we need to locate tracker.mysql.php
    // first, try the most obvious location.. which should be in the
    // same directory as the ./help.php file being ran
    if (is_readable('./tracker.mysql.php')) {
        // require
        require './tracker.mysql.php';
    } elseif (findFile(realpath('.'), 'tracker.mysql.php')) {
        // require
        chdir(dirname($_GET['found_file_path']));
        require './tracker.mysql.php';
    } else {
        $_GET['notice'] = 'no';
        $_GET['message'] = '' . "Could not locate the <em>tracker.mysql.php</em> file. " . "Make sure all of the necessary tracker files have been uploaded. ";
        return;
    }
    // open db
    peertracker::open();
    // optimize
    if (peertracker::$api->query("CHECK TABLE `{$_SERVER['tracker']['db_prefix']}peers`") && peertracker::$api->query("ANALYZE TABLE `{$_SERVER['tracker']['db_prefix']}peers`") && peertracker::$api->query("REPAIR TABLE `{$_SERVER['tracker']['db_prefix']}peers`") && peertracker::$api->query("OPTIMIZE TABLE `{$_SERVER['tracker']['db_prefix']}peers`")) {
        // no errors, hopefully???
        $_GET['notice'] = 'yes';
        $_GET['message'] = 'Your MySQL Tracker Database has been optimized.';
    } else {
        $_GET['notice'] = 'no';
        $_GET['message'] = 'Could not optimize the MySQL Database.';
    }
    // close
    peertracker::close();
}
Esempio n. 7
0
    foreach ($sublist as $eachlist) {
        if (in_array($file, $eachlist[url])) {
            $foundlist = $eachlist;
        }
    }
    menuPrinter($file, $foundlist);
}
// now we put it all together and create the page
// get the filename of the current file from $_SERVER
$FileName = explode("/", $_SERVER['REQUEST_URI']);
$FileNameEnd = array_pop($FileName);
// strip any parameters that may have been passed in the URL
$FileNameBreak = explode("?", $FileNameEnd);
$FileNamePop = $FileNameBreak[0];
// start printing the page
print "<div id=\"banner\">";
print "<a href=\"http://www.scratchfactory.com\"><img src=\"/dponiwiki/media/banners/SFTransparentLogo.png\" style=\"padding-top:5px;float:right;\"></a>";
print "<a href=\"Home.php\">";
print "<img style=\"border: none; padding-left: 25px;\" src=\"/dponiwiki/media/banners/Banner.png\" alt=\"Banner\"></a>";
print "</div>";
print "<div id=\"nav\">";
print "<ul>";
// go looking for the file requested and print the appropriate menu
findFile($FileNamePop);
// print the rest of the page
print "</ul>";
print "</div>";
print "<div id=\"content\">";
if ($FileNamePop != "License.php") {
    print "<p id=\"legal\">This material is Open Game Content, and is licensed for public use under the terms of the <a href=\"License.php\">Open Game License v1.0a.</a><br />Hosted by <a href=\"http://www.scratchfactory.com\">Scratch Factory</a></p>";
}
Esempio n. 8
0
function moduleAddServer($url, $data)
{
    /** Attempt to determine default variables */
    $named_conf = findFile('named.conf');
    $data['server_run_as_predefined'] = 'named';
    if ($named_conf) {
        if (function_exists('posix_getgrgid')) {
            if ($run_as = posix_getgrgid(filegroup($named_conf))) {
                $data['server_run_as_predefined'] = $run_as['name'];
            }
        }
        $data['server_config_file'] = $named_conf;
        $server_root = getParameterValue('directory', $named_conf, '"');
        if ($server_root === false) {
            if (file_exists($named_conf . '.options')) {
                $server_root = getParameterValue('directory', $named_conf . '.options', '"');
            }
        }
        $data['server_root_dir'] = $server_root;
        $data['server_zones_dir'] = dirname($named_conf) == '/etc' ? null : dirname($named_conf) . '/zones';
    }
    $data['server_chroot_dir'] = detectChrootDir();
    /** Add the server to the account */
    $app = detectDaemonVersion(true);
    if ($app === null) {
        echo "failed\n\n";
        echo fM("Cannot find a supported DNS server - please check the README document for supported DNS servers.  Aborting.\n");
        exit(1);
    }
    $data['server_type'] = $app['server']['type'];
    $data['server_version'] = $app['app_version'];
    $raw_data = getPostData(str_replace('genserial', 'addserial', $url), $data);
    $raw_data = $data['compress'] ? @unserialize(gzuncompress($raw_data)) : @unserialize($raw_data);
    if (!is_array($raw_data)) {
        if (!$raw_data) {
            echo "An error occurred\n";
        } else {
            echo $raw_data;
        }
        exit(1);
    }
    return array('data' => $data, 'add_result' => "Success\n");
}
Esempio n. 9
0
/**
 * Added sudoers entries
 *
 * @since 2.0
 * @package facileManager
 *
 * @param string $module_name Module to add line for
 * @param string $sudoers_line Sudo lines
 * @param string $user User with permissions
 */
function addSudoersConfig($module_name, $sudoers_line, $user)
{
    $sudoers_file = findFile('sudoers');
    $sudoers_options[] = "Defaults:{$user}  !requiretty";
    $sudoers_options[] = "Defaults:{$user}  !env_reset";
    $sudoers_line = implode("\n", $sudoers_options) . "\n" . $sudoers_line;
    unset($sudoers_options);
    if (!$sudoers_file) {
        echo fM("  --> It does not appear sudo is installed.  Please install it and add the following to the sudoers file:\n");
        echo fM("\n      {$sudoers_line}\n");
        echo fM("\nInstallation aborted.\n");
        exit(1);
    } else {
        $includedir = getParameterValue('includedir', $sudoers_file, ' ');
        if ($includedir) {
            if (is_dir($includedir)) {
                $sudoers_file = $includedir . '/99_' . $module_name;
            }
        }
        $cmd = "echo '{$sudoers_line}' >> {$sudoers_file} 2>/dev/null";
        if (strpos(file_get_contents($sudoers_file), $sudoers_line) === false) {
            $sudoers_update = system($cmd, $retval);
            if ($retval) {
                echo fM("  --> The sudoers entry cannot be added.\n{$cmd}\n");
            } else {
                echo fM("  --> The sudoers entry has been added.\n");
            }
            @chmod($sudoers_file, 0440);
        } else {
            echo fM("  --> The sudoers entry already exists...skipping\n");
        }
    }
}
Esempio n. 10
0
 function sanify($value)
 {
     if (findFile($this->_themefile($value), true)) {
         return $value;
     }
     return $this->default_value;
 }
                    <!-- Portfolio Item Row -->
                    <div class="row">
                        <div class="col-md-8">
                            <img class="img-responsive" src="../pictures/Gallery/<?php 
echo getPicture($_GET['id'], true);
?>
" alt="">
                        </div>

                        <div class="col-md-4">
                            <h3><?php 
echo str_replace("_", " ", $_GET['id']);
?>
</h3>
                            <p><?php 
echo findFile($_GET['id'], true);
?>
</p>
                        </div>
                    </div>
                    <!-- /.row -->

                    <!-- Related Projects Row -->
                    <div class="row">
                        <div class="col-lg-12">
                            <h3 class="page-header">Other Pictures</h3>
                        </div>

                        <?php 
include 'random.php';
?>
                    <!-- Portfolio Item Row -->
                    <div class="row">
                        <div class="col-md-4">
                            <img style="margin: 0 auto;" class="img-responsive" src="../pictures/Architects/<?php 
echo getPicture($_GET['id'], false);
?>
" alt="">
                        </div>

                        <div class="col-md-8" align="justify">
                            <h1 style="text-align:center;"><u><b><?php 
echo str_replace("_", " ", $_GET['id']);
?>
<b></u></h1>
                            <p><h3><?php 
echo findFile($_GET['id'], false);
?>
</h3></p>
                        </div>
                    </div>
                    <!-- /.row -->

                </div>
            </div>

            <!-- /.row -->

            <hr>

            <!-- Footer -->
            <footer>
Esempio n. 13
0
function ls($splitLine)
{
    global $groups, $files, $numGroups, $numFiles, $loggedon, $user, $numUsers, $users, $logMessage;
    $index = findFile($splitLine[1]);
    $log = $files[$index[1]] . " " . $files[$index[1] + 1] . " " . $files[$index[1] + 2] . " " . $files[$index[1] + 3] . " " . $files[$index[1] + 4] . " " . $files[$index[1] + 5] . "\n";
    $exists = findFile($splitLine[1]);
    if ($exists[1] < 0) {
        $log = "File does not exist for reading\n";
    }
    $logMessage = $logMessage . $log;
}