Esempio n. 1
0
File: api.php Progetto: saji89/whube
<?php

/*
 *  License:     AGPLv3
 *  Author:      Paul Tagliamonte <*****@*****.**>
 *  Description:
 *    AJAX callbacks for getting internal data
 */
session_start();
$app_root = dirname(__FILE__) . "/../../";
include $app_root . "conf/site.php";
include $app_root . "libs/php/globals.php";
include $app_root . "model/user.php";
requireLocalIP();
$hooks = array();
if ($handle = opendir(dirname(__FILE__) . "/" . "api-hooks/")) {
    while (false !== ($file = readdir($handle))) {
        // The "i" after the pattern delimiter indicates a case-insensitive search
        if ($file != "." && $file != "..") {
            $ftest = $file;
            if (preg_match("/.*\\.php\$/i", $ftest)) {
                include dirname(__FILE__) . "/" . "api-hooks/" . $file;
            }
        }
    }
}
$s = new sql();
$d['errors'] = true;
$d['success'] = false;
$d['message'] = "Unknown error";
$p = htmlentities($_GET['p'], ENT_QUOTES);
Esempio n. 2
0
<?php

/*
 *  License:     AGPLv3
 *  Author:      Paul Tagliamonte <*****@*****.**>
 *  Description:
 *    For the email daemon.
 */
$d['errors'] = true;
$d['message'] = "Unknown Error";
$ip = $_SERVER['REMOTE_ADDR'];
include "conf/site.php";
include "libs/php/globals.php";
if (requireLocalIP()) {
    // check list
    include "model/bug.php";
    include "model/user.php";
    include "model/project.php";
    $b = new bug();
    $o = new user();
    $p = new project();
    $meta = array();
    foreach ($_POST as $key => $value) {
        $meta[clean($key)] = clean($value);
        // f**k you, user
    }
    if (isset($meta['email']) && isset($meta['project']) && isset($meta['title']) && isset($meta['body'])) {
        $o->getByCol("email", $meta['email']);
        $submitter = $o->getNext();
        if (isset($submitter['uID'])) {
            // OK to insert