function Run($aProjname, $aForceUpdate = false)
 {
     $this->iProjname = $aProjname;
     echo "<h3>Scanning files for project '{$aProjname}'</h3>";
     // Find full filename of all project files in the project
     $proj = $this->iDBUtils->GetProject($aProjname);
     $projidx = $proj['fld_key'];
     $q = "SELECT * FROM tbl_projfiles WHERE fld_projidx={$projidx}";
     $res = $this->iDB->Query($q);
     $n = $res->NumRows();
     $ptimer = new JpgTimer();
     while ($n-- > 0) {
         $r = $res->Fetch();
         $fname = $r['fld_name'];
         $modtime = filemtime($fname);
         $dbtime = strtotime($r['fld_dbupdtime']);
         if ($aForceUpdate || $modtime > $dbtime) {
             echo "Parsing file {$fname}...\n";
             flush();
             $dbdriver = new DBDriver($aProjname, $fname, $this->iDB);
             $ptimer->Push();
             $dbdriver->Run();
             $t = round($ptimer->Pop() / 1000, 2);
             $q = "UPDATE tbl_projfiles SET fld_dbupdtime=now() WHERE fld_key=" . $r['fld_key'];
             $this->iDB->Query($q);
             echo "[{$t} s]<br>\n";
         } else {
             echo "DB is up to date with file: '{$fname}'<br>\n";
         }
     }
     echo "<p><h3>Done.</h3>";
     HTMLGenerator::CloseWinButton();
 }
 function Run($aKey = '')
 {
     global $HTTP_POST_VARS;
     HTMLGenerator::DocHeader('Edit DDDA Class', 'Modify or create existing class');
     HTMLGenerator::DocPreamble();
     $HTTP_POST_VARS['key'] = $aKey;
     $r = $this->iDBUtils->GetMethodKey($aKey);
     $title = '<b><font face=arial>' . $r['fld_classname'] . '::' . $r['fld_name'] . '()</b></font>';
     $e = new EditMethodTable($this->iDBUtils, $r['fld_numargs'], $title);
     $e->Run($HTTP_POST_VARS, array('name' => '<b><font face=arial>' . $r['fld_classname'] . '::' . $r['fld_name'] . '()</b></font>'));
 }
 function Run($aKey = '')
 {
     global $HTTP_POST_VARS;
     HTMLGenerator::DocHeader('Edit DDDA Class', 'Modify or create existing class');
     HTMLGenerator::DocPreamble();
     $HTTP_POST_VARS['key'] = $aKey;
     $r = $this->iDBUtils->GetClassKey($aKey);
     if (!empty($r['fld_parentname'])) {
         $ext = ' <font color=lightgrey>extends ' . $r['fld_parentname'] . '</font>';
     } else {
         $ext = '';
     }
     $e = new EditClassTable($this->iDBUtils, $r['fld_name'] . $ext);
     $e->Run($HTTP_POST_VARS);
 }
Beispiel #4
0
 function PreAmble($aTitle, $aDesc)
 {
     HTMLGenerator::DocHeader($aTitle, $aDesc);
     HTMLGenerator::DocPreamble();
     GenJavascript::Stroke();
 }
Beispiel #5
0
 function Run()
 {
     if (isset($this->iProjidx) && $this->iProjidx > 0) {
         $dbchecker = new CheckProjectDB($this->iDB);
         $projname = $this->iDBUtils->GetProjNameForKey($this->iProjidx);
         if (empty($projname)) {
             die("<font color=red><b>Error: Invalid project index [{$this->iProjidx}].<b></font>");
         }
         HTMLGenerator::DocHeader('DB Consistency check: ' . $projname);
         $dbchecker->Run($projname);
     } else {
         echo "<h2>DB Consistency check</h2><hr>";
         echo "Select project to check. <p>";
         echo $this->GetListOfProjects();
         //echo "<b><font color=red>Error: No project index specified. </font></b><br>Usage: ddda_chkdb.php?idx=<i>nn</i>";
     }
 }
 function Run()
 {
     global $HTTP_POST_VARS;
     global $HTTP_GET_VARS;
     // We should go back to the project file form if we
     // a) either came from that form with a save/delete
     // b) we are going to that form from the project form
     if (empty($HTTP_POST_VARS['show_projects']) && (!empty($HTTP_POST_VARS['show_files']) && !empty($HTTP_POST_VARS['key']) && $HTTP_POST_VARS['key'] > 0 && $HTTP_POST_VARS['_x_formname'] == 'projects' || @$HTTP_POST_VARS['_x_formname'] == 'projfiles')) {
         if (@$HTTP_POST_VARS['_x_formname'] == 'projfiles') {
             $projkey = $HTTP_POST_VARS['projidx'];
         } else {
             if (!empty($HTTP_POST_VARS['_x_allprojects'])) {
                 $projkey = $HTTP_POST_VARS['_x_allprojects'];
             } else {
                 $projkey = $HTTP_POST_VARS['key'];
             }
             $HTTP_POST_VARS = array();
         }
         HTMLGenerator::DocHeader('Edit DDDA Project Files', 'Modify or Add Files To Project');
         HTMLGenerator::DocPreamble();
         GenJavascript::Stroke();
         $e = new EditProjectFiles($this->iDBUtils, $projkey);
         $pname = $this->iDBUtils->GetProjNameForKey($projkey);
         $e->Run($HTTP_POST_VARS, array('projectname' => '<b>' . $pname . '</b>'));
         HTMLGenerator::CloseWinButton();
     } else {
         HTMLGenerator::DocHeader('Edit DDDA Project', 'Modify or create new DDDA projects');
         HTMLGenerator::DocPreamble();
         GenJavascript::Stroke();
         // For the case when we return from prtojfiles we set the current project key
         // so we get back to the same project
         if (@$HTTP_POST_VARS['_x_formname'] == 'projfiles') {
             $key = @$HTTP_POST_VARS['projidx'];
             $HTTP_POST_VARS = array();
             $HTTP_POST_VARS['key'] = $key;
             $HTTP_POST_VARS['_x_allprojects'] = $key;
         }
         // Special case if we open the window to create a new project (start with empty form)
         if (empty($HTTP_GET_VARS['new']) && strlen(trim($this->iProjname)) > 0 && count($HTTP_POST_VARS) == 0) {
             $r = $this->iDBUtils->GetProject($this->iProjname);
             $HTTP_POST_VARS['key'] = $r['fld_key'];
         }
         $e = new EditProjects($this->iDBUtils);
         $e->Run($HTTP_POST_VARS);
         HTMLGenerator::CloseWinButton();
     }
 }
 function End()
 {
     echo "<h3>Successfully generated all documentation.</h3>";
     echo "<hr>";
     HTMLGenerator::CloseWinButton('left');
 }
Beispiel #8
0
 function Close()
 {
     HTMLGenerator::DocPostamble();
 }
Beispiel #9
0
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>Guess it</title>
        <link href="style.css" type="text/css"  rel="stylesheet" >
    </head>
    <body>
    	<h1>TRY to guess the hidden word!</h1>

    	<ul class="word">
    		<?php 
echo HTMLGenerator::word();
?>
        </ul>
        <h3> Hint: <?php 
echo $_SESSION["word"]["hint"];
?>
</h3>
        <div>Now you have <?php 
echo 7 - count($_SESSION['wrong']);
?>
 lives</div>
    	<h2>Choose the letter</h2>
    	<ul class="alphabet">
    		<?php 
echo HTMLGenerator::alphabet();
?>
        </ul>

        
    </body>
  </html>
Beispiel #10
0
    $retries = 0;
    //if autogal.lock there probably
    //another instance of the script
    //running. Give it some seconds
    //to finish
    while (file_exists('../../autogal.lock') && $retries < Config::max_retries) {
        //echo 'sleeping';
        sleep(1);
        $retries++;
    }
    //create a lock file so two
    //instances of the script don't
    //try to rebuild the galleries at
    //the same time
    try {
        $filelock = fopen('../../autogal.lock', 'w');
    } catch (Exception $e) {
        throw new Exeption('can\'t create autogal.lock');
    }
    $myDatabase = new Database();
    $myGenerator = new HTMLGenerator();
    $myDatabase->generateFromFile(Config::getDirURL());
    $myGenerator->generatePages($myDatabase->getCategories(), $myDatabase->getCollection());
    //Open autogal.lastmod and write the new hash of dir.txt
    $lastmod = fopen('../../autogal.lastmod', 'w');
    fwrite($lastmod, $dirhash);
    fclose($lastmod);
    fclose($filelock);
}
//Remove the lock
unlink('../../autogal.lock');