Example #1
0
        if ($result->num_rows > 0) {
            if ($annotation->role) {
                while ($row = $result->fetch_assoc()) {
                    if ($annotation->role != $row['role']) {
                        return false;
                    }
                }
            }
            $db->close();
            return true;
        } else {
            $db->close();
            return false;
        }
    }
    function extendAuthentication($ticket)
    {
        $db = new Database('tazapi');
        $db->open();
        $dateTime = new DateTime('+1 hour', new DateTimeZone('Europe/Vilnius'));
        $expires = $dateTime->format('Y-m-d H:i:s');
        $sql = "UPDATE tickets SET expires='" . $expires . "' WHERE ticket = '" . $ticket . "';";
        $db->conn()->query($sql);
        $db->close();
    }
}
$indexWebscript = new Index();
$indexWebscript->process($_GET['webscript'], $_GET['method']);
?>
             
Example #2
0
        $request_data['action'] = $args['action'];
        unset($args['action']);
    } else {
        if (DEBUG) {
            echo "Warning: No action defined. Usage: index.php --action=<action>\n";
        }
    }
    /**
     * Load the script arguments.
     */
    $request_data['args'] = $args;
} else {
    /**
     * Has an action been defined.
     */
    if (isset($_GET['action'])) {
        $request_data['action'] = $_GET['action'];
    } else {
        if (DEBUG) {
            echo "Warning: No action defined. <br/>Usage: index.php?action=&lt;action&gt;<br/>";
        }
    }
    /**
     * Load the page data.
     */
    $request_data['data']['get'] = $_GET;
    $request_data['data']['post'] = $_POST;
}
$index = new Index($request_data);
$index->process();
 public function testTemplateManagerWithDifferentTemplate()
 {
     $app = new Index();
     $app->controller = "index";
     $app->action = "test";
     $app->template = "template_2.php";
     $app->process();
     $this->assertTrue(is_a($app, "index"));
     $this->assertEquals($app->table, "foo");
     $html = $app->loadApp();
     $this->assertTrue(strpos($html, "DOCTYPE html>") > 0);
     $this->assertTrue(strpos($html, "<meta charset=\"UTF-8\">") > 0);
     $this->assertTrue(strpos($html, "<title>A template with a different title</title>") > 0);
     $this->assertTrue(strpos($html, "Some text inside the view:FooBar-foo") > 0);
     $this->assertTrue(strpos($html, "</html>") > 0);
 }