public function read($type, $start, $end, $max)
 {
     if (!Auth::load()->role('admin')) {
         $uploads = DB::load()->query("SELECT ID, Timestamp, Slug FROM Uploads WHERE User_ID = ? " . "ORDER BY ID DESC", array(Session::getKey('User', 'ID')), 'Uploads', array('start' => $start, 'end' => $end, 'max' => $max))->results();
     } else {
         $uploads = DB::load()->query("SELECT ID, Timestamp, Slug FROM Uploads " . "ORDER BY ID DESC", null, 'Uploads', array('start' => $start, 'end' => $end, 'max' => $max))->results();
     }
     return (object) array('data' => $uploads, 'total' => DB::load()->_records);
 }
Пример #2
0
    $app->get('Cache')->setExt($app->get('config.cache.ext'));
    $app->get('Cache')->setIgnore($app->get('config.cache.ignore'));
}
/*
 * Set database
 */
use WebSupportDK\PHPScrud\DB;
if ($app->get('config.database.status')) {
    $app->set('DB', DB::load($app->get('config.database.driver'), $app->get('config.database.host'), $app->get('config.database.name'), $app->get('config.database.username'), $app->get('config.database.password')));
}
/*
 * Set auth
 */
use WebSupportDK\PHPAuthFramework\Auth;
if ($app->get('config.auth.status')) {
    $app->set('Auth', Auth::load());
    $app->get('Auth')->setAttribute('db', $app->get('DB'));
    $app->get('Auth')->setAttribute('token', $app->get('config.app.key'));
    $app->get('Auth')->setAttribute('sessionName', $app->get('config.session.name'));
}
/*
 * Set mailer
 */
if ($app->get('config.mail.status')) {
    // Get mail driver
    req($app->get('__DIR__') . 'vendor/phpmailer/phpmailer/PHPMailerAutoload');
    // Set driver
    $app->set('Mailer', new PHPMailer());
    if (!is_null($app->get('config.mail.driver'))) {
        $app->get('Mailer')->isSMTP();
    }
Пример #3
0
 public function logout()
 {
     Auth::load()->logout();
     Session::set('SUCCESS', I18n::get('AUTH_LOGOUT'));
     Redirect::to($this->data['project_url'] . 'login#form');
 }