Esempio n. 1
0
/**
 * Output the database table...
 *
 * Ideally, you would have a view in your application where the tracking
 * information would be output. The possibilites here are endless, however,
 * I will just quickly output the data from the database.
 */
function outputHTML()
{
    //Output the HTML table...
    echo '<table class="u-full-width">';
    echo '<caption><h2>SQLite Database Output</h2></caption>';
    echo '<thead>';
    echo '<th>Email</th>';
    echo '<th>Subject</th>';
    echo '<th>Opened</th>';
    echo '</thead>';
    echo '<tbody>';
    $db = new PDO('sqlite:../data/_main.db');
    $result = $db->query('SELECT email, subject, opened FROM email_log');
    foreach ($result as $row) {
        echo '<tr>';
        echo '<td>' . $row['email'] . '</td>';
        echo '<td>' . $row['subject'] . '</td>';
        echo '<td>' . $row['opened'] . '</td>';
        echo '</tr>';
    }
    echo '</tbody>';
    echo '</table>';
    //Reset the database
    resetDatabase($db);
}
Esempio n. 2
0
include_once 'htmlDefault.php';
include_once 'scoreFunctions.php';
$action = $_GET["action"];
if (!isset($action)) {
    print $html_string;
    exit;
}
define("ACTION_FAILED", -1);
define("UNKNOWN_ACTION", -2);
$connection = mysql_connect("localhost", "cookbook", "cookbook") or die(mysql_error());
mysql_select_db('cookbook_highscores');
switch ($action) {
    case 'get':
        getPlayer();
        break;
    case 'set':
        setPlayer();
        break;
    case 'xml':
        toXML();
        break;
    case 'html':
        toHTML();
        break;
    case 'reset':
        resetDatabase();
        break;
    default:
        print UNKNOWN_ACTION;
}
mysql_close($connection);
Esempio n. 3
0
if (isset($_POST['demoKey']) && $_POST['demoKey'] == $DEMOPUSHKEY) {
    $target_dir = dirname(dirname(__FILE__)) . "/temp/";
    $target_file = $target_dir . basename($_FILES["fileupload"]["name"]);
    if (move_uploaded_file($_FILES["fileupload"]["tmp_name"], $target_file)) {
        $branchName = $_POST['branch'];
        $commitHash = $_POST['commitHash'];
        echo "The file " . basename($_FILES["fileupload"]["name"]) . " has been uploaded.\r\n";
        echo "Commit Hash: " . $commitHash;
        $delPath = dirname(dirname(__FILE__)) . "/" . $branchName;
        delTree($delPath);
        $p = new ZipArchive();
        $p->open($target_file);
        $p->extractTo($target_dir);
        //extract the code\
        $p->close();
        rename($target_dir . "/churchcrm", $delPath);
        // move the repository from the temp folder to the root
        $srcComposer = json_decode(file_get_contents($delPath . "/composer.json"));
        $srcComposer->commitHash = $commitHash;
        file_put_contents($delPath . "/composer.json", json_encode($srcComposer));
        $version = $srcComposer->version;
        copy(dirname(__FILE__) . "/configFiles/" . $branchName . "/Include/Config.php", $delPath . "/Include/Config.php");
        //copy any config files necessary
        resetDatabase('localhost', "gdawoud_church_crm_" . $branchName, $DBUSERNAME, $DBPASSWORD, $delPath . "/mysql/install/Install.sql", $version);
    } else {
        echo "Sorry, there was an error uploading your file.";
    }
} else {
    echo "Incorrect or missing build password";
}
exit;
Esempio n. 4
0
 // SET CONTENTS
 if (isset($_POST['action'])) {
     // Create Database
     if ($_POST['action'] == 'createDatabase' && isset($_POST['document']) && ($document = $section->getDocumentById($_POST['document']))) {
         $dbh = createDatabase($document->getId());
         parseGEXF($document->getFile(), $dbh);
     }
     // Delete Database
     if ($_POST['action'] == 'deleteDatabase' && isset($_POST['delete']) && $_POST['delete'] == "y" && isset($_POST['document']) && ($document = $section->getDocumentById($_POST['document']))) {
         if (!deleteDatabase($document->getId())) {
             echo "Deletion failed";
         }
     }
     // Reset Database (formerly 'update')
     if ($_POST['action'] == 'updateDatabase' && isset($_POST['document']) && ($document = $section->getDocumentById($_POST['document']))) {
         $dbh = resetDatabase($document->getId());
         parseGEXF($document->getFile(), $dbh);
     }
     // Change Attribute Viz Type
     if ($_POST['action'] == 'changeViz' && isset($_POST['document']) && ($document = $section->getDocumentById($_POST['document']))) {
         if (isset($_POST['attribute']) && isset($_POST['viz'])) {
             try {
                 $dbh = new PDO("sqlite:../data/exploredbs/" . $document->getId());
                 $g = new gRaph($dbh);
                 if ($attribute = $g->getAttributeById($_POST['attribute'])) {
                     $attribute->setViz($_POST['viz']);
                     if (isset($_POST['rewritedattributename'])) {
                         $attribute->setRewrittenName($_POST['rewritedattributename']);
                     }
                 }
             } catch (PDOException $e) {