Exemplo n.º 1
0
$couch_subscriptions = new couchClient($config->databases->subscriptions->connectionString,
                                       $config->databases->subscriptions->name);
$subscription_results = $couch_subscriptions->getView('views','subscriptions');
if( $subscription_results->total_rows == 0 || empty($subscription_results->rows)){
    echo "No Subscriptions Found. Exiting\n";
    exit(0);
}
$subscriptions = __::pluck($subscription_results->rows, "value");


/* =======================
   Get the currently defined Talking Points
   ----------------------- */
$couch_talkingPoints = new couchClient($config->databases->talkingpoints->connectionString,
                                       $config->databases->talkingpoints->name);
$points_results = $couch_talkingPoints->key(date("m-d-Y"))->getView('views','pointsByDate');
if( $points_results->total_rows == 0 || empty($points_results->rows)){
    echo "No Talking Points Found. Exiting\n";
    exit(0);
}
$points = __::reduce(
            $points_results->rows,
            function($memo, $row){
                $memo[$row->value->handle] = $row->value->points;
                return $memo;
            },array() );

/* =======================
   Configure SubscriptionFulfilment
   ----------------------- */
$fulfillment = new SubscriptionFulfillment(new EmailSubscriptionFulfillment());
Exemplo n.º 2
0
require_once "./config.default.php";
# If there are any overrides include them now
if (!is_readable('./config.php')) {
    echo "<H2>WARNING: Configuration file config.php does not exist. Please\n         notify your system administrator.</H2>";
} else {
    include_once './config.php';
}
require_once 'lib/couch.php';
require_once 'lib/couchClient.php';
require_once 'lib/couchDocument.php';
// set a new connector to the CouchDB server
$client = new couchClient('http://' . $couchdb_server . ':' . $couchdb_port, $couchdb_database);
// view fetching, using the view option limit
try {
    #    $view = $client->limit(100)->asArray()->getView('cronview','by_host');
    $client->key(-1);
    $view = $client->limit(100)->asArray()->getView('cronview', 'by_job_duration');
} catch (Exception $e) {
    echo "ERROR while getting view contents: " . $e->getMessage() . "<BR>\n";
}
##############################################################
# Did we get any response for the key we were looking for
##############################################################
if (sizeof($view["rows"]) > 0) {
    print "<h2>Currently Running Jobs</h2><p>\n  <table cellspacing=1 class=tablesorter border=1>\n  <thead>\n  <tr><th>Start time</th><th>Has been running so far (secs)</th><th>Username</th><th>Hostname</th><th>Command</th></tr>\n  </thead>\n  <tbody>";
    foreach ($view["rows"] as $key => $row) {
        $job_time = time() - strtotime($row["value"]["time"]);
        print "<tr><td>" . $row["value"]["time"] . "</td>" . "<td align=center>" . $job_time . "</td>" . "<td>" . $row["value"]["username"] . "</td>" . "<td>" . $row["value"]["hostname"] . "</td>" . "<td>" . $row["value"]["command_line"] . "</td>" . "</tr>\n";
    }
    print "</tbody></table>";
} else {
Exemplo n.º 3
0
<?php

require_once('couch.php');

$couch = new couchClient($config->database->connectionString, $config->database->name);
$results = $couch->key(date("m-d-Y"))->getView("views","pointsByDate");


render_header();
if($results->total_rows == 0 || empty($results->rows)){
  include('views/no_points.php');
} else {
  $points = $results->rows;
  include('views/points.php');
}
render_footer();
Exemplo n.º 4
0
    include_once './config.php';
}
require_once 'lib/couch.php';
require_once 'lib/couchClient.php';
require_once 'lib/couchDocument.php';
$couch_url = 'http://' . $couchdb_server . ':' . $couchdb_port;
$couch_url_full = $couch_url . "/" . $couchdb_database;
// set a new connector to the CouchDB server
$client = new couchClient($couch_url, $couchdb_database);
?>

<?php 
// view fetching, using the view option limit
try {
    if (isset($_GET['command'])) {
        $client->key($_GET['command']);
    }
    $view = $client->limit(100)->asArray()->getView('cronview', 'by_commandline');
} catch (Exception $e) {
    echo "ERROR while getting view contents: " . $e->getMessage() . "<BR>\n";
}
##############################################################
# Did we get any response for the key we were looking for
##############################################################
if (sizeof($view["rows"]) > 0) {
    print "\n  <table cellspacing=1 class=tablesorter border=1>\n  <thead>\n  <tr><th>Start time</th><th>Job duration</th><th>Return code</th>\n  <th>Username</th><th>Hostname</th><th>Command</th>\n  <th>StdOut (Bytes)</th><th>StdErr (Bytes)</th>\n  </tr>\n  </thead>\n  <tbody>";
    foreach ($view["rows"] as $key => $row) {
        if (!$row["value"]["_attachments"]["stderr"]["length"] > 0) {
            continue;
        }
        $docid = $row["value"]["_id"];
<?php
$handle = preg_replace('/[^a-z0-9]/i',"",$_REQUEST['handle']);

require_once("couch.php");

$couch = new couchClient($config->database->connectionString, $config->database->name);
$results = $couch->key(array(date("m-d-Y"), $handle))->getView("views","pointsByDateAndHandle");

if($results->total_rows == 0 || empty($results->rows)){
  echo "[]"; exit();
}

echo json_encode($results->rows[0]->value);
<?php
$username = preg_replace('/[^a-zA-Z0-9._+\-]/i',"",$_REQUEST['username']);
$password = md5($_REQUEST['password']);

require_once("couch.php");

$couch = new couchClient($config->database->connectionString, $config->database->name);
$results = $couch->key($username)->getView("views","teacherByUsername");

if(empty($results->rows)){
  echo "{}"; exit();
}

$user = $results->rows[0]->value;

if($user->password != $password){
  echo "{}"; exit();
}

unset($user->password);
$user->token = md5("k232jaslkadf90".$user->username);
echo json_encode($user);
Exemplo n.º 7
0
<?php
$username = preg_replace('/[^a-zA-Z0-9._+\-]/i',"",$_REQUEST['username']);
$password = md5($_REQUEST['password']);

function login_failed(){
    global $SITE;
    $_SESSION['login_flash'] = "Login failed";
    header("Location: $SITE"); exit(0);
}

require_once("couch.php");

$couch = new couchClient($config->database->connectionString, $config->database->name);
$results = $couch->key($username)->getView("views","adminByUsername");

if(empty($results->rows)){
  login_failed();
}

$user = $results->rows[0]->value;

if($user->password != $password){
  login_failed();
}

$_SESSION['user'] = $user;
header("Location: ?action=points"); exit(0);