Exemple #1
0
session_start();
/**
 *  Archivo que inicia todo el
 */
/**
 * Función que realiza la autocarga de clases y archivos
 * @param string $className 
 */
function __autoload($className)
{
    $file = dirname(__FILE__) . '/../class/' . $className . '.php';
    if (!file_exists($file)) {
        $file = dirname(__FILE__) . '/controller/' . $className . '.php';
        if (!file_exists($file)) {
            $file = dirname(__FILE__) . '/config/' . $className . '.php';
            if (file_exists($file)) {
                require_once $file;
            }
        } else {
            require_once $file;
        }
    } else {
        require_once $file;
    }
}
// index.php?site=maria
$controller = new SiteController();
$controller->update();
//$controller->insert();
//$controller->index();
Exemple #2
0
    UserController::updateUsername($id);
});
$routes->get('/user/:id/password', function ($id) {
    UserController::editPassword($id);
});
$routes->post('/user/:id/password', function ($id) {
    UserController::updatePassword($id);
});
//site
$routes->get('/site/new_site', 'check_logged_in', function () {
    SiteController::new_site();
});
$routes->get('/site/show_site/:id', 'check_logged_in', function ($id) {
    SiteController::show($id);
});
$routes->get('/site/show_site/:id/edit', 'check_logged_in', function ($id) {
    SiteController::edit($id);
});
$routes->post('/site/show_site/:id/edit', 'check_logged_in', function ($id) {
    SiteController::update($id);
});
$routes->post('/site/:id/destroy', 'check_logged_in', function ($id) {
    SiteController::destroy($id);
});
$routes->post('/site', 'check_logged_in', function () {
    SiteController::save();
});
//comment
$routes->post('/comment', 'check_logged_in', function () {
    CommentController::save();
});