Example #1
0
<?php

include_once 'session_check.php';
include_once '../scripts/myErrorHandler.php';
include_once '../scripts/utf8ToEntities.php';
include_once '../scripts/Database.php';
$reason = "BAD_USER";
$tid = NULL;
$isHasCategories = FALSE;
$productName = null;
if (isset($_GET['tid'])) {
    $tid = $_GET['tid'];
    $db = new Database();
    $categories = $db->getCategories($tid);
    if ($categories != NULL) {
        $isHasCategories = TRUE;
        if ($tid == 2) {
            $productName = "Single";
        } else {
            $productName = "Paczki";
        }
    }
    $db->destroy();
}
$wap_title = "mobiKAR - kategorie";
include "add_head.php";
?>
<h1><?php 
echo $productName;
?>
</h1>
Example #2
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');