function breakCode($startCode)
{
    global $enterInstallerMode;
    global $stopTime;
    for ($code = $startCode; $code < 10000; $code++) {
        echo "Testing code: " . sprintf("%04d", $code) . "\n";
        writeDSC("071" . $enterInstallerMode . sprintf("%04d", $code));
        $lastCode = $code;
        $loop = true;
        while ($loop) {
            // Loop until receive Invalid access code or an Error message
            $lines = readData();
            foreach ($lines as $line) {
                $res = readDSC($line);
                if ($res['code'] == 680) {
                    // Entered installer mode - exit this mode and return
                    echo "*** Installer mode entered using: " . $lastCode . " ***\n";
                    $stopTime = microtime(true);
                    sleep(4);
                    echo "Exiting installer mode, please wait couple of seconds to make sure control panel setup is not messed up!\n";
                    for ($i = 0; $i < 50; $i++) {
                        writeDSC("070#");
                        $results = readData();
                        foreach ($results as $result) {
                            $res = readDSC($result);
                            echo "  " . $res['msg'] . "\n";
                            if ($res['code'] == 650) {
                                return $lastCode;
                            }
                            // System ready, we can safely return.
                        }
                        sleep(4);
                    }
                    return $lastCode;
                } elseif ($res['code'] == 670) {
                    // Invalid access code
                    $loop = false;
                } elseif ($res['code'] == 502) {
                    $code--;
                    // Error, repeate check for this code.
                    sleep(1);
                    $loop = false;
                }
                echo "  " . $res['msg'] . "\n";
            }
        }
    }
    $stopTime = microtime(true);
    return -$lastCode;
}
Example #2
0
                    $dscReader->open($thisFile);
                    readXML($dscReader, "dsc_sc", $validHTML, $openTag, $hrefTag, $docroot);
                    $dscReader->close();
                }
                //echo '<p class="top"><a href="#top">Return to top</a></p>';
            }
            $reader->close();
            $firstSection = $k;
        }
    } else {
        $validHTML = array('p' => 'p', 'ul' => 'ul', 'li' => 'li', 'head' => 'h2', 'title' => 'em');
        $file = $appurl . "?doc=" . $doc . "_ead.xml&section=";
        $file .= $section;
        $reader = new XMLReader();
        $reader->open($file);
        readDSC($reader, $section, $validHTML, $openTag, $hrefTag);
    }
}
// end FOREACH $section
if ($repName != "") {
    /*
            try {
                    $options = array(
                    CURLOPT_RETURNTRANSFER => true,     // return web page
                    CURLOPT_HEADER         => false,    // don't return headers
                    CURLOPT_FOLLOWLOCATION => true,     // follow redirects
                    CURLOPT_ENCODING       => "",       // handle all encodings
                    CURLOPT_USERAGENT      => "spider", // who am i
                    CURLOPT_AUTOREFERER    => true,     // set referer on redirect
                    CURLOPT_CONNECTTIMEOUT => 120,      // timeout on connect
                    CURLOPT_TIMEOUT        => 120,      // timeout on response
Example #3
0
        }
        $reader->close();
        $firstSection = $k;
    }
} else {
    $debug = "";
    if ($env != "") {
        $debug = '<p style="font-size:10px;"><a href="' . $file . '" target="_blank" style="color:red;">debug</a></p>';
    }
    $reader = new XMLReader();
    $reader->open($file);
    $validHTML = array('p' => 'p', 'ul' => 'ul', 'li' => 'li', 'head' => 'h3', 'title' => 'em', 'dsc_series' => 'blockquote', 'child' => 'blockquote');
    // debug
    echo $debug;
    // from helpers.php
    readDSC($reader, $section, $validHTML, $openTag, $hrefTag, $repName, $file);
}
print "</div> <!-- page -->\n";
//drawContentMenu($appurl, $phpurl, $doc, $section, $menuOrder, $level1, $level2, $validHTML);
drawContentMenu($appurl, $phpurl, $docOrig, $section, $menuOrder, $level1, $level2, $validHTML, $docroot);
?>
</td></tr></table>
<?php 
//getToolbar($phpurl, $doc, $repository, 2);
?>

<?php 
/* ******************************************************* */
function getCitation($citeurl, $coinsurl, $docroot)
{
    $cite = "";