예제 #1
0
function SendResponse($QueryType, $index, $type = 'empty', $message = 'empty')
{
    $con = mysqli_connect(HOST, USR, PSWD, DB);
    if ($QueryType == 'add' || $QueryType == 'remove' || $QueryType == 'update') {
        $query = AddParams($QueryType, $index);
        $log;
        $Ltype;
        if (!mysqli_query($con, $query)) {
            $log = 'esecuzione query(' . $query . ') fallita : ' . mysqli_error($con);
            $Ltype = 'qerr';
        } else {
            $log = $query;
            $Ltype = 'query';
        }
        //aggiorno i record visualizzati chiamando nuovamente la funzione con querytype = 1
        $QueryType = 'load';
        SendResponse($QueryType, $index, $Ltype, $log);
    } else {
        $query = AddParams($QueryType, $index);
        $result = mysqli_query($con, $query);
        $log;
        $Ltype;
        if ($result) {
            if ($message == 'empty') {
                $log = $query;
                $Ltype = 'query';
            } else {
                $log = $message;
                $Ltype = $type;
            }
        } else {
            if ($message == 'empty') {
                $log = 'esecuzione query (' . $query . ') fallita : ' . mysqli_error($con) . '</p>';
                $Ltype = 'qerr';
            } else {
                $log = $message;
                $Ltype = $type;
            }
        }
        PrintResult($result, $log, $Ltype, $index);
    }
    mysqli_close($con);
}
예제 #2
0
# This program is distributed under the terms and conditions of the GPL
# Contributor(s):
# A-thon srl <*****@*****.**>
# Alberto Castellini
# See the LICENSE files for details
# ------------------------------------------------------------------------------------
require_once "./config/REP_configuration.php";
if ($repository_status == "O") {
    $errorcode[] = "XDSRepositoryNotAvailable";
    $error_message[] = "Repository is down for maintenance";
    $status_response = makeSoapedFailureResponse($error_message, $errorcode);
    writeTimeFile($_SESSION['idfile'] . "--Repository: Repository is down");
    $file_input = $idfile . "-down_failure_response.xml";
    writeTmpFiles($status_response, $file_input, true);
    //SendResponseFile($tmp_path.$file_input);
    SendResponse($status_response);
    exit;
}
ob_start();
//Non stampa niente a monitor ma mette tutto su un buffer
$connessione = connectDB();
//ob_get_clean();//OKKIO FONDAMENTALE!!!!! Pulisco il buffer
//ob_end_flush();// Spedisco il contenuto del buffer
$token = $_GET["token"];
$get_token = "SELECT URI,MIMETYPE,CRYPT FROM DOCUMENTS WHERE KEY_PROG={$token}";
$res_token = query_select2($get_token, $connessione);
// Da verificare se si possono usare funzioni php al posto di java
if ($ATNA_active == 'A') {
    $eventOutcomeIndicator = "0";
    //EventOutcomeIndicator 0 OK 12 ERROR
    $today = date("Y-m-d");
예제 #3
0
}
$stmt = $dbconnection->prepare('SELECT jams.status AS jamstatus, games.submitterid FROM jams INNER JOIN games ON jams.id = games.jamid WHERE jams.id = ? AND games.id = ?;');
$stmt->execute(array($jamid, $gameid));
if ($stmt->rowCount() == 0) {
    SendResponse(array('success' => false, 'message' => 'Invalid jam or game specified.'));
} else {
    $status = $stmt->fetchAll()[0];
    if ($status['submitterid'] == $session->GetUserID()) {
        SendResponse(array('success' => false, 'message' => 'You can not judge your own game.'));
    } else {
        if ($status['jamstatus'] == JamStatus::ReceivingGameSubmissions || $status['jamstatus'] == JamStatus::Judging) {
            $stmt = $dbconnection->prepare('SELECT id FROM categories WHERE jamid = ?;');
            $stmt->execute(array($jamid));
            $categories = $stmt->fetchAll();
            foreach ($categories as $category) {
                $stmt = $dbconnection->prepare('DELETE FROM ratings WHERE categoryid = ? AND gameid = ? AND userid = ?;');
                $stmt->execute(array($category['id'], $gameid, $session->GetUserID()));
                foreach ($ratings as $rating) {
                    if ($rating['categoryid'] == $category['id']) {
                        $stmt = $dbconnection->prepare('INSERT INTO ratings (categoryid, gameid, userid, value) VALUES (?, ?, ?, ?);');
                        $stmt->execute(array($category['id'], $gameid, $session->GetUserID(), $rating['value']));
                        break;
                    }
                }
            }
            SendResponse(array('success' => true));
        } else {
            SendResponse(array('success' => false, 'message' => 'Jam is no longer recieving ratings for the games.'));
        }
    }
}
예제 #4
0
function connectDB()
{
    # IMPORT MYSQL PARAMETERS (NOTE: IT WORKS WITH ABSOLUTE PATH ONLY !!)
    include './config/repository_mysql_db.php';
    # open connection to db
    $connessione = mysql_connect($ip, $user_db, $password_db);
    if (!$connessione) {
        $errorcode = array();
        $error_message = array();
        $errorcode[] = "XDSRepositoryError";
        $error_message[] = mysql_error();
        $database_error_response = makeSoapedFailureResponse($error_message, $errorcode);
        writeTimeFile($_SESSION['idfile'] . "--Repository: database_error_response");
        $file_input = $_SESSION['idfile'] . "-database_error_response-" . $_SESSION['idfile'];
        writeTmpFiles($database_error_response, $file_input);
        SendResponse($database_error_response);
        exit;
    }
    # open  db
    mysql_select_db($db_name);
    return $connessione;
}
예제 #5
0
파일: log.php 프로젝트: athoncopy/athon
function writeTmpFiles($log_text, $file_name, $mandatory = false)
{
    ### PATH COMPLETO AL FILE
    if (!isset($_SESSION['tmp_path'])) {
        $pathToFile = "./tmp/" . $file_name;
    } else {
        $pathToFile = $_SESSION['tmp_path'] . $file_name;
    }
    $writef = false;
    $nfile = 0;
    //Se il file è obbligatorio devo accertarmi che venga salvato
    if ($mandatory) {
        while (!$writef && $nfile < 10) {
            ### APERTURA DEL FILE IN FORMA TAIL ED IN SOLA SCRITTURA
            $handler_log = fopen($pathToFile, "wb+");
            if ($handler_log) {
                ## CASO DI DATO TIPO ARRAY
                if (is_array($log_text)) {
                    $txt = "";
                    ### IMPOSTA L'ARRAY NELLA FORMA [etichetta] = valore
                    foreach ($log_text as $element => $value) {
                        $txt = $txt . "{$element} = {$value}\n";
                    }
                    //END OF foreach
                    $log_text = $txt;
                }
                //END OF if(is_array($log_text))
                if (fwrite($handler_log, $log_text) === FALSE) {
                    sleep(1);
                    $nfile++;
                } else {
                    // Caso OK Riesce a aprire e scrivere il file correttamente
                    $writef = true;
                }
            } else {
                sleep(1);
                $nfile++;
            }
        }
        //Fine while
        #### CHIUDO L'HANDLER
        fclose($handler_log);
        if (!$writef) {
            $errorcode[] = "XDSRepositoryError";
            $error_message[] = "Repository can't create tmp file. ";
            $tmp_response = makeSoapedFailureResponse($error_message, $errorcode);
            writeTimeFile($_SESSION['idfile'] . "--Repository: Tmp File error");
            $file_input = $idfile . "-tmp_failure_response-" . $idfile;
            writeTmpFiles($tmp_response, $file_input);
            SendResponse($tmp_response);
            exit;
        }
    } else {
        $handler_log = fopen($pathToFile, "wb+");
        ## CASO DI DATO TIPO ARRAY
        if (is_array($log_text)) {
            $txt = "";
            ### IMPOSTA L'ARRAY NELLA FORMA [etichetta] = valore
            foreach ($log_text as $element => $value) {
                $txt = $txt . "{$element} = {$value}\n";
            }
            //END OF foreach
            $log_text = $txt;
        }
        //END OF if(is_array($log_text))
        fwrite($handler_log, $log_text);
        fclose($handler_log);
    }
    #### RITORNO IL PATH AL FILE SCRITTO
    return $pathToFile;
}
예제 #6
0
function giveboundary($headers)
{
    if (stripos($headers["Content-Type"], "boundary")) {
        writeTimeFile($_SESSION['idfile'] . "--Repository: Il boundary e' presente");
        if (preg_match('(boundary="[^\\t\\n\\r\\f\\v";]+")', $headers["Content-Type"])) {
            writeTimeFile($_SESSION['idfile'] . "--Repository: Ho trovato il boundary di tipo boundary=\"bvdwetrct637crtv\"");
            $content_type = stristr($headers["Content-Type"], 'boundary');
            $pre_boundary = substr($content_type, strpos($content_type, '"') + 1);
            $fine_boundary = strpos($pre_boundary, '"') + 1;
            //BOUNDARY ESATTO
            $boundary = '';
            $boundary = substr($pre_boundary, 0, $fine_boundary - 1);
            writeTimeFile($idfile . "--Repository: Il boundary " . $boundary);
        } else {
            if (preg_match('(boundary=[^\\t\\n\\r\\f\\v";]+[;])', $headers["Content-Type"])) {
                writeTimeFile($_SESSION['idfile'] . "--Repository: Ho trovato il boundary di tipo boundary=bvdwetrct637crtv;");
                $content_type = stristr($headers["Content-Type"], 'boundary');
                $pre_boundary = substr($content_type, strpos($content_type, '=') + 1);
                $fine_boundary = strpos($pre_boundary, ';');
                //BOUNDARY ESATTO
                $boundary = '';
                $boundary = substr($pre_boundary, 0, $fine_boundary);
                writeTimeFile($_SESSION['idfile'] . "--Repository: Il boundary " . $boundary);
            } else {
                $errorcode[] = "XDSRepositoryError";
                $error_message[] = "Repository can't recognize boundary. ";
                $folder_response = makeSoapedFailureResponse($error_message, $errorcode);
                writeTimeFile($_SESSION['idfile'] . "--Repository: Il boundary non e' del tipo boundary=\"bvdwetrct637crtv\" o boundary=bvdwetrct637crtv;");
                $file_input = $idfile . "-boundary_failure_response-" . $idfile;
                writeTmpFiles($folder_response, $file_input);
                SendResponse($folder_response);
                exit;
            }
        }
        $MTOM = false;
    } else {
        writeTimeFile($_SESSION['idfile'] . "--Repository: non e' dichiarato il boundary");
        $MTOM = true;
        //$boundary = "--boundary_per_MTOM";
    }
    $ret = array($boundary, $MTOM);
    return $ret;
}
예제 #7
0
} else {
    $jam = $stmt->fetchAll()[0];
    if ($jam['status'] == JamStatus::JamRunning || $jam['status'] == JamStatus::ReceivingGameSubmissions) {
        $stmt = $dbconnection->prepare('SELECT id from games WHERE jamid = ? AND submitterid = ?;');
        $stmt->execute(array($jamid, $session->GetUserID()));
        if ($stmt->rowCount() > 0) {
            $gameid = $stmt->fetchAll()[0]['id'];
            $stmt = $dbconnection->prepare('UPDATE games SET name = ?, description = ?, partner = ?, thumbnailurl = ? WHERE id = ? AND jamid = ? AND submitterid = ?;');
            $stmt->execute(array($name, $description, $partner, $thumbnail, $gameid, $jamid, $session->GetUserID()));
            $stmt = $dbconnection->prepare('DELETE FROM images WHERE gameid = ?;');
            $stmt->execute(array($gameid));
            $stmt = $dbconnection->prepare('DELETE FROM links WHERE gameid = ?;');
            $stmt->execute(array($gameid));
        } else {
            $stmt = $dbconnection->prepare('INSERT INTO games (name, description, submitterid, partner, thumbnailurl, jamid) VALUES (?, ?, ?, ?, ?, ?);');
            $stmt->execute(array($name, $description, $session->GetUserID(), $partner, $thumbnail, $jamid));
            $gameid = $dbconnection->lastInsertId('games_id_seq');
        }
        $stmt = $dbconnection->prepare('INSERT INTO images (url, gameid) VALUES (?, ?);');
        foreach ($images as $image) {
            $stmt->execute(array($image['url'], $gameid));
        }
        $stmt = $dbconnection->prepare('INSERT INTO links (title, url, gameid) VALUES (?, ?, ?);');
        foreach ($links as $link) {
            $stmt->execute(array($link['title'], $link['url'], $gameid));
        }
        SendResponse(array('success' => true));
    } else {
        SendResponse(array('success' => false, 'message' => 'Jam is no longer recieving game submissions.'));
    }
}
예제 #8
0
                if ($existingid != -1 && $found) {
                    $stmt = $dbconnection->prepare('UPDATE votes SET value = ? WHERE id = ?;');
                    $stmt->execute(array($votevalue, $existingid));
                } else {
                    if ($existingvotecount < $jam['votesperuser'] && $found) {
                        $stmt = $dbconnection->prepare('INSERT INTO votes (voterid, themeid, round, value, jamid) VALUES (?, ?, ?, ?, ?);');
                        $stmt->execute(array($session->GetUserID(), $vote['themeid'], $round, $votevalue, $jamid));
                        $existingvotecount++;
                    } else {
                        $failed = true;
                    }
                }
            }
        }
        if (!$failed) {
            SendResponse(array('success' => true));
        } else {
            SendResponse(array('success' => false, 'message' => 'You have already submitted the maximum number of votes.'));
        }
    } else {
        SendResponse(array('success' => false, 'message' => 'Jam is no longer recieving votes.'));
    }
}
function CompareVotes($A, $B)
{
    if ($A['value'] == $B['value']) {
        return 0;
    } else {
        return abs($A['value']) < abs($B['value']) ? -1 : 1;
    }
}
예제 #9
0
<?php

if (strlen($username) > 20) {
    $error = 'Username max length is 20 characters.';
} else {
    if (strlen($username) == 0) {
        $error = 'Username can not be blank.';
    } else {
        if (strlen($password) == 0) {
            $error = 'Password can not be blank.';
        } else {
            if (strlen($email) == 0) {
                $error = 'Email can not be blank.';
            } else {
                if (!EmailValid($email)) {
                    $error = 'Email address is invalid.';
                }
            }
        }
    }
}
if (isset($error)) {
    SendResponse(array('success' => false, 'message' => $error));
} else {
    if ($session->TryRegister($username, $password, $email)) {
        SendResponse(array('success' => true));
    } else {
        SendResponse(array('success' => false, 'message' => 'Username or Email is already in use.'));
    }
}
예제 #10
0
        if ($res_DocUniqueId[0][3] == "A") {
            $file[$i] = decrypt($keycrypt, file_get_contents("./" . $res_DocUniqueId[0][1], "r"));
        } else {
            $file[$i] = file_get_contents("./" . $res_DocUniqueId[0][1], "r");
        }
        $documento_encoded64[$i] = base64_encode($file[$i]);
        writeTimeFile($idfile . "--Repository Retrieve: File {$i}: " . $file[$i]);
    } else {
        writeTimeFile($idfile . "--GetDocument Retrieve: il repository UniqueId non corrisponde " . $res_repUniqueId[0][0] . " diverso da " . $DocumentRequests_array[$i][0]);
        //Devo gestire un errore
        $errorcode[] = "XDSRepositoryMetadataError";
        $error_message[] = "Repository.uniqueID '" . $res_repUniqueId[0][0] . "' is different form your submission '" . $DocumentRequests_array[$i][0] . "'";
        $repositoryUniqueId_response = makeSoapedFailureResponse($error_message, $errorcode, $Action);
        $file_input = $_SESSION['idfile'] . "-repositoryUniqueId_failure_response-" . $_SESSION['idfile'];
        writeTmpRetrieveFiles($repositoryUniqueId_response, $file_input);
        SendResponse($repositoryUniqueId_response);
    }
}
$boundary = md5(time());
$Content_ID = md5(time() + 1);
$messageID = md5(time() + 2);
$idDoc = array();
$SOAP_stringaxml = "<?xml version='1.0' encoding='UTF-8'?>" . CRLF . "<soapenv:Envelope xmlns:soapenv=\"http://www.w3.org/2003/05/soap-envelope\"\n    xmlns:wsa=\"http://www.w3.org/2005/08/addressing\">\n    <soapenv:Header>\n        <wsa:Action>urn:ihe:iti:2007:RetrieveDocumentSetResponse</wsa:Action>\n        <wsa:RelatesTo>{$MessageID}</wsa:RelatesTo>\n    </soapenv:Header>";
$SOAP_stringaxml .= "\n    <soapenv:Body>\n        <xdsb:RetrieveDocumentSetResponse xmlns:xdsb=\"urn:ihe:iti:xds-b:2007\">\n            <rs:RegistryResponse xmlns:rs=\"urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0\"\n                status=\"urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Success\"/>";
for ($y = 0; $y < $numero_documenti; $y++) {
    $idDoc[$y] = md5(time() + 3 + $y);
    $SOAP_stringaxml .= "\n            <xdsb:DocumentResponse>\n\t\t<xdsb:RepositoryUniqueId>" . $DocumentRequests_array[$y][0] . "</xdsb:RepositoryUniqueId>\n                <xdsb:DocumentUniqueId>" . $DocumentRequests_array[$y][1] . "</xdsb:DocumentUniqueId>\n                <xdsb:mimeType>" . $res_DocUniqueId[$y][2] . "</xdsb:mimeType>\n\t\t<xdsb:Document>" . $documento_encoded64[$y] . "</xdsb:Document>\n            </xdsb:DocumentResponse>";
}
$SOAP_stringaxml .= "\n        </xdsb:RetrieveDocumentSetResponse>\n    </soapenv:Body>\n</soapenv:Envelope>" . CRLF;
$fp_forwarded = fopen($tmp_retrieve_path . $idfile . "-repositoryGet_response.xml", "wb+");
fwrite($fp_forwarded, $SOAP_stringaxml);
예제 #11
0
$sessionID = $_POST['sessionId'];
$isCallActive = $_POST['isActive'];
if ($isCallActive == 1 && $direction == "Inbound") {
    //hang up
    //construct response
    $response = '<?xml version="1.0" encoding="UTF-8"?>';
    $response .= '<Response>';
    $response .= '<Reject/>';
    $response .= '</Response>';
    header('Content-type: text/plain');
    echo $response;
    //immediately call user back
    $gateway = new AfricasTalkingGateway($aitusername, $aitkey);
    try {
        $gateway->call($aitnumber, $callerNumber);
    } catch (Exception $e) {
        echo "error: " . $e->getMessage();
    }
} elseif ($isCallActive == 1 && $direction == "Outbound") {
    //redirect call to be processed on other page
    $url = "https://santa-slybard.c9users.io/wishlist.php";
    //construct response
    $response = '<?xml version="1.0" encoding="UTF-8"?>';
    $response .= '<Response>';
    $response .= '<Redirect>' . $url . '</Redirect>';
    $response .= '</Response>';
    header('Content-type: text/plain');
    echo $response;
} else {
    SendResponse(false, "Goodbye!");
}
예제 #12
0
    $redis = new Predis\Client();
    $callstate = GetCallState($redis, $sessionID, $caller);
    if ($isCallActive == 1 && $direction == "Outbound") {
        if ($callstate == "Intro") {
            $str = "Welcome to the North Pole. I am Elfie. Press 1 followed by the hash sign to continue";
            $callstate = "Reception";
            SetCallState($redis, $sessionID, $caller, $callstate);
            SendResponse(true, $str);
        } elseif ($callstate == "Reception") {
            $userinput = $_POST['dtmfDigits'];
            if ($userinput == "1") {
                $str = "Okay. What would you like for Christmas. Press 1 followed by hash if you want a cup for Christmas. Press 2 followed by hash if you want a girlfriend for Christmas";
                $callstate = "Options";
                SetCallState($redis, $sessionID, $caller, $callstate);
                SendResponse(true, $str);
            }
        } elseif ($callstate == "Options") {
            $userinput = $_POST['dtmfDigits'];
            $callstate = "End";
            if ($userinput == "1" || $userinput == "2") {
                $str = "That is a good choice. We've sent the Northern Express to deliver. Merry Christmas";
            }
            SetCallState($redis, $sessionID, $caller, $callstate);
            SendResponse(false, $str);
        }
    } else {
        SendResponse(false);
    }
} catch (Exception $e) {
    echo $e->getMessage();
}
예제 #13
0
파일: lienhe.php 프로젝트: nsknet/dandabook
<?php

$error = "";
$style = '';
if (isset($_POST['submit'])) {
    if ($_POST['ten'] != "") {
        if ($_POST['email'] != "") {
            if ($_POST['tieude'] != "") {
                if ($_POST['noidung'] != "") {
                    if (SendResponse($_POST['email'], $_POST['tieude'], $_POST['ten'], $_POST['noidung'])) {
                        $error = "Đã gởi mail thành công";
                        $style = 'style="color:green;"';
                    } else {
                        $error = "Gởi mail không thành công! ";
                    }
                } else {
                    $error = "bạn chưa nhập nội dung";
                }
            } else {
                $error = "Bạn chưa nhập tiêu đề";
            }
        } else {
            $error = "Bạn chưa nhập mail";
        }
    } else {
        $error = "Bạn chưa nhập tên";
    }
}
$ten = "";
$email = "";
if (isset($_SESSION['taikhoan'])) {
예제 #14
0
<?php

require SCRIPTROOT . 'jamstates.php';
$stmt = $dbconnection->prepare('SELECT * FROM jams ORDER BY suggestionsbegin DESC;');
$stmt->execute();
$rows = $stmt->fetchAll();
$jams = array();
foreach ($rows as $row) {
    $jam = array();
    $jam['id'] = $row['id'];
    $jam['title'] = $row['title'];
    $jam['status'] = $row['status'];
    $jam['suggestionsbegin'] = SuggestionsBegin($row);
    $jam['votingbegins'] = VotingBegins($row);
    $jam['themeannounce'] = ThemeAnnounce($row);
    $jam['jambegins'] = JamBegins($row);
    $jam['submissionsbegin'] = SubmissionsBegin($row);
    $jam['submissionsend'] = SubmissionsEnd($row);
    $jam['judgingends'] = JudgingEnds($row);
    array_push($jams, $jam);
}
SendResponse($jams);
예제 #15
0
파일: xml.php 프로젝트: hungnv0789/vhtm
     * Of course, we check to make sure it's a valid requestmethod before trying to call it.
     */
    default:
        if (!is_callable(array($handlerObject, $handlerMethod)) and !is_callable("{$handlerObject}::{$handlerMethod}")) {
            SendResponse(true, 'Invalid request type');
        }
        $response = false;
        $handlerMethodReflector = new ReflectionMethod($handlerObject, $handlerMethod);
        $handlerMethodParameterReflector = $handlerMethodReflector->getParameters();
        $newFunctionParams = false;
        $newFunctionParams = false;
        foreach ($handlerMethodParameterReflector as &$handlerMethodParam) {
            $response[] = $handlerMethodParam->getName();
            if (array_key_exists($handlerMethodParam->getName(), $function_params)) {
                //leave it
                $newFunctionParams[] = $function_params[$handlerMethodParam->getName()];
            } else {
                //add a null
                $newFunctionParams[] = '';
            }
        }
        if (is_object($handlerObject)) {
            $response = $handlerMethodReflector->invokeArgs($handlerObject, $newFunctionParams);
        } else {
            $response = $handlerMethodReflector->invokeArgs(null, $newFunctionParams);
        }

        SendResponse(true, $response);
        break;
}
예제 #16
0
<?php

if ($session->TryLogin($username, $password)) {
    SendResponse(array('success' => true));
} else {
    SendResponse(array('success' => false, 'message' => 'Username or Password was incorrect.'));
}
예제 #17
0
function connectDB()
{
    include './config/repository_oracle_db.php';
    //putenv("ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0");
    # open connection to db
    $conn = oci_connect($user_db, $password_db, $db);
    if (!$conn) {
        $errorcode = array();
        $error_message = array();
        $errorcode[] = "XDSRepositoryError";
        $err = ocierror();
        $error_message[] = $err['message'];
        $database_error_response = makeSoapedFailureResponse($error_message, $errorcode);
        writeTimeFile($_SESSION['idfile'] . "--Repository: database_error_response");
        $file_input = $_SESSION['idfile'] . "-database_error_response-" . $_SESSION['idfile'];
        writeTmpFiles($database_error_response, $file_input);
        SendResponse($database_error_response);
        exit;
    }
    return $conn;
}
예제 #18
0
    // find a way to handle this
    $stmt = $dbconnection->prepare('UPDATE jams SET title = ?, themesperuser = ?, autoapprovethemes = ?, initialvotingrounds = ?, votesperuser = ?, topthemesinfinal = ?, suggestionsbegin = ?, suggestionslength = ?, approvallength = ?, votinglength = ?, themeannouncelength = ?, jamlength = ?, submissionslength = ?, judginglength = ?, status = ? WHERE id = ?;');
    $stmt->execute(array($title, $themesperuser, $autoapprovethemes ? 1 : 0, $initialvotingrounds, $votesperuser, $topthemesinfinal, $suggestionsbegin, $suggestionslength, $approvallength, $votinglength, $themeannouncelength, $jamlength, $submissionslength, $judginglength, JamStatus::WaitingSuggestionsStart, $id));
    $stmt = $dbconnection->prepare('SELECT id FROM categories WHERE jamid = ?');
    $stmt->execute(array($id));
    $oldcategories = $stmt->fetchAll();
    foreach ($categories as $category) {
        $found = false;
        if (isset($category['id'])) {
            foreach ($oldcategories as $oldcatkey => $oldcategory) {
                if ($category['id'] == $oldcategory['id']) {
                    $stmt = $dbconnection->prepare('UPDATE categories SET name = ?, description = ? WHERE id = ?;');
                    $stmt->execute(array($category['name'], $category['description'], $category['id']));
                    $found = true;
                    unset($oldcategories[$oldcatkey]);
                }
            }
        }
        if (!$found) {
            $stmt = $dbconnection->prepare('INSERT INTO categories (jamid, name, description) VALUES (?, ?, ?);');
            $stmt->execute(array($id, $category['name'], $category['description']));
        }
    }
    foreach ($oldcategories as $oldcategory) {
        $stmt = $dbconnection->prepare('DELETE FROM categories WHERE id = ?;');
        $stmt->execute(array($oldcategory['id']));
        $stmt = $dbconnection->prepare('DELETE FROM ratings WHERE categoryid = ?;');
        $stmt->execute(array($oldcategory['id']));
    }
    SendResponse(array('success' => true));
}
예제 #19
0
<?php

require SCRIPTROOT . 'markdown.php';
SendResponse(array('result' => ParseMarkdown($text)));
예제 #20
0
파일: test.php 프로젝트: l04d/ZnoteAAC
<?php

$filepath = '../../../../';
require_once '../../../module.php';
// Configure module version number
$response['version']['module'] = 1;
UseClass('player');
$player = new Player(1129);
$response['player'] = $player->fetch('name');
$response['test'] = $player->fetch('level');
SendResponse($response);
예제 #21
0
                    $newFunctionParams[] = $handlerMethodParam->getDefaultValue();
                }
	        }
	        if (is_object($handlerObject)) {
                $response = $handlerMethodReflector->invokeArgs($handlerObject, $newFunctionParams);
            } else {
                $response = $handlerMethodReflector->invokeArgs(null, $newFunctionParams);
            }
        }

        if(is_array($response) && isset($response[0]) && $response[0] === false){
            if(isset($response[1]) && !empty($response[1])){
                SendResponse(false, $response[1]);
            } else {
                SendResponse(false, $response);
            }
        }
    
        if(is_array($response) && isset($response[0]) && $response[0] === true){
            if(isset($response[1])){
                $response = (empty($response[1])) ? null : $response[1];
                SendResponse(true, $response);
            } else {
                SendResponse(true, null);
            }
        }
        
        if(empty($response)){SendResponse(false, $response);}else{SendResponse(true, $response);}
        break;
}
예제 #22
0
function verificaExtrinsicObject($dom_ebXML)
{
    $ExtrinsicObject_array = $dom_ebXML->get_elements_by_tagname("ExtrinsicObject");
    $conta_EO = count($ExtrinsicObject_array);
    if ($conta_EO > 0) {
        //RESTITUISCE IL MESSAGGIO DI ERRORE
        $errorcode[] = "XDSMissingDocument";
        $error_message[] = "XDSDocumentEntry exists in metadata with no corresponding attached document";
        $failure_response = makeSoapedFailureResponse($error_message, $errorcode);
        $file_input = $_SESSION['idfile'] . "-Document_missing-" . $_SESSION['idfile'];
        writeTmpFiles($failure_response, $file_input);
        SendResponse($failure_response);
        exit;
        //PULISCO IL BUFFER DI USCITA
        ob_get_clean();
        //OKKIO FONDAMENTALE!!!!!
    } else {
        return true;
    }
}
예제 #23
0
<?php

if (!isset($afterdate)) {
    $afterdate = 0;
}
if (!isset($beforedate)) {
    $beforedate = time();
}
if ($beforedate > time()) {
    $beforedate = time();
}
$stmt = $dbconnection->prepare('SELECT id, title, date, summary, content FROM news WHERE date >= ? AND date <= ? ORDER BY date ASC;');
$stmt->execute(array($afterdate, $beforedate));
$rows = $stmt->fetchAll();
SendResponse($rows);
예제 #24
0
         sleep(1);
         $nfile++;
     }
 }
 //Fine while
 #### CHIUDO L'HANDLER
 fclose($fp_allegato);
 // Se dopo 10 volte non sono riuscito a salvare il file riporto un errore
 if (!$writef) {
     $errorcode[] = "XDSRepositoryError";
     $error_message[] = "Repository can't save files. ";
     $File_response = makeSoapedFailureResponse($error_message, $errorcode);
     writeTimeFile($_SESSION['idfile'] . "--Repository: File error");
     $file_input = $idfile . "-file_failure_response-" . $idfile;
     writeTmpFiles($File_response, $file_input);
     SendResponse($File_response);
     exit;
 }
 ##############################################À
 ### SALVATAGGIO DELL'ALLEGATO SU FILESYSTEM
 ##################################################################
 #### MI ASSICURO CHE URI,SIZE ED HASH NON SIANO GIA' SPECIFICATE NEL METADATA
 $mod = modifiable($ExtrinsicObject_node);
 $datetime = "CURRENT_TIMESTAMP";
 $insert_into_DOCUMENTS = "INSERT INTO DOCUMENTS (XDSDOCUMENTENTRY_UNIQUEID,DATA,URI,MIMETYPE,CRYPT) VALUES ('" . $UniqueId_valid_array[1][$o] . "'," . $datetime . ",'" . $document_URI2 . "','" . $AllegatiExtrinsicObject[2][$o] . "','" . $REP_crypt . "')";
 //writeTimeFile($idfile."--Repository: INSERT INTO DOCUMENTS".$insert_into_DOCUMENTS);
 $ris = query_execute2($insert_into_DOCUMENTS, $connessione);
 //FINO A QUA OK!!!
 $selectTOKEN = "SELECT KEY_PROG FROM DOCUMENTS WHERE XDSDOCUMENTENTRY_UNIQUEID = '" . $UniqueId_valid_array[1][$o] . "'";
 //writeTimeFile($idfile."--Repository: uniqueid".$selectTOKEN);
 //$selectTOKEN= "SELECT MAX(TOKEN_ID) AS TOKEN_ID FROM TOKEN";
예제 #25
0
<?php

require_once 'config.php';
include 'library.php';
$parameter_name_prodotti = array('Id', 'Nome_Prodotto', 'Marca', 'Magazzino', 'Prezzo_Acquisto', 'Iva');
$parameter_name_utenti = array('Username', 'Password', 'Administrator', 'Nome', 'Cognome');
$QueryType = $_POST['query'];
switch ($QueryType) {
    case 'init':
        Init();
        break;
    case 'logout':
        session_start();
        session_destroy();
        break;
    default:
        if (checkUser($QueryType)) {
            if ($_POST['currentTable'] == 'Prodotti') {
                SendResponse($QueryType, $parameter_name_prodotti);
            } else {
                SendResponse($QueryType, $parameter_name_utenti);
            }
        }
        break;
}