示例#1
0
        render_json($reasons->toArray());
    });
    $app->get('/stats', function () use($app) {
        $beginOfDay = strtotime("midnight", time());
        $stats = array();
        $stats['signinsToday'] = signInQuery::create()->filterByCreatedAt(array('min' => $beginOfDay))->count();
        $stats['uniqueUsers'] = UserQuery::create()->count();
        render_json($stats);
    });
});
$app->group('/users', function () use($app) {
    $app->get('/list', function () use($app) {
        if (!require_admin()) {
            return;
        }
        render_json(all_users()->toArray());
    });
    $app->get('/skills/:netid', function ($netid) use($app) {
        render_json(skills_netid($netid));
    });
    $app->post('/skills/:netid', function ($netid) use($app) {
        // We need to be logged in, AND have it be the correct user (or an admin)
        if (!require_authenticated(false, $netid, true)) {
            return;
        }
        $data = $app->request->getBody();
        if (!$data) {
            $app->stop();
        }
        $data = json_decode($data, true);
        update_skills($netid, $data);
 private function readFile()
 {
     require_once $this->file;
     $this->permissions = array();
     foreach (all_users() as $username => $user) {
         $this->permissions[$username] = array('permissions' => $this->getPermissions($username), 'language' => $user['language']);
     }
 }
<?php

require_once 'includes/load.php';
if (!$session->isUserLoggedIn(true)) {
    redirect('index.php', false);
}
$all_users = all_users();
include_once 'layouts/header.php';
?>
<div class="row">
   <div class="col-md-12">
     <?php 
echo display_msg($msg);
?>
   </div>
</div>
<div class="row">
  <div class="col-md-12">
    <div class="panel panel-info">
     <div class="panel-body">
      <table class="table table-bordered table-striped">
        <thead>
          <tr>
            <th>Name </th>
            <th>Username</th>
            <th>Actions</th>
          </tr>
        </thead>
        <tbody>
        <?php 
foreach ($all_users as $a_user) {
示例#4
0
文件: common.php 项目: ronak2ram/fnji
            }
        }
    }
    //end post fb
}
//--fetch all pages--//
$all_pages = all_pages($database);
$tpl->all_pages = $all_pages;
//--fetch all topic with limit--//
$get_topics = all_topic($database);
$tpl->all_topics = $get_topics;
//--fetch all author with limit--//
$get_author = all_author($database);
$tpl->all_author = $get_author;
//--fetch all author with limit--//
$get_users = all_users($database);
$tpl->all_users = $get_users;
//--get poem of the day--//
$get_poem_of_day = poem_of_day($database);
$tpl->poem_of_day = $get_poem_of_day;
//--get user information--//
$user_image = get_user_info($database);
$tpl->user_image = $user_image;
//--get ad_zones--//
$getads = get_ad_zones($database);
$tpl->ads = $getads;
function showad($id, $getads)
{
    foreach ($getads as $k => $v) {
        if (array_key_exists('id', $v)) {
            if ($v['id'] == $id) {
示例#5
0
文件: index.php 项目: bobseven/slim-1
$app->get('/', function () use($app) {
    $app->render('main.php');
});
$app->get('/hello', function () use($app) {
    $request = $app->request();
    $name = $request->params('name');
    $app->render('hello.php', ["name" => $name]);
});
$app->get('/rate', function () use($app) {
    $request = $app->request();
    $rating = $request->params('stars');
    $app->render('rate.php', ["rating" => $rating]);
});
$app->get('/database', function () use($app) {
    require_once 'lib/db.php';
    $app->render('database.php', ["users" => all_users()]);
});
$app->get('/test', function () use($app) {
    $app->render('test.php');
});
$app->post('/test', function () use($app, $mailer) {
    $request = $app->request();
    $body = $request->getBody();
    $answers = explode("&", $body);
    $app->render('test.php', ["answers" => $answers]);
    //email block
    $resultEmail = $app->view->fetch('email/test.php');
    $message = Swift_Message::newInstance('Результат тестирования')->setFrom(['*****@*****.**' => 'robomail'])->setTo('*****@*****.**')->setBody($resultEmail)->setContentType("text/html");
    //$mailer->send($message);
});
$app->run();