예제 #1
0
function main()
{
    if ($_SERVER['argc'] <= 1 || false === is_dir($_SERVER['argv'][1])) {
        echo usage();
        exit(-1);
    } else {
        setup();
        init($_SERVER['argv'][1]);
    }
}
예제 #2
0
 /** 
  * Test load method.
  */
 public function test_setup()
 {
     // Setup
     \WP_Mock::expectActionAdded('init', 'TenUp\\WP_Documentor_Tools\\Core\\i18n');
     \WP_Mock::expectActionAdded('init', 'TenUp\\WP_Documentor_Tools\\Core\\init');
     \WP_Mock::expectAction('wpd_tools_loaded');
     // Act
     setup();
     // Verify
     $this->assertConditionsMet();
 }
예제 #3
0
 /** 
  * Test load method.
  */
 public function test_setup()
 {
     // Setup
     \WP_Mock::expectActionAdded('init', 'TenUp\\Primary_Tag\\Core\\i18n');
     \WP_Mock::expectActionAdded('init', 'TenUp\\Primary_Tag\\Core\\init');
     \WP_Mock::expectAction('primarytag_loaded');
     // Act
     setup();
     // Verify
     $this->assertConditionsMet();
 }
예제 #4
0
 /**
  * Test setup method.
  */
 public function test_setup()
 {
     // Setup
     \WP_Mock::expectActionAdded('after_setup_theme', 'TenUp\\WP_Documenter\\Core\\i18n');
     \WP_Mock::expectActionAdded('wp_head', 'TenUp\\WP_Documenter\\Core\\header_meta');
     \WP_Mock::expectActionAdded('wp_enqueue_scripts', 'TenUp\\WP_Documenter\\Core\\scripts');
     \WP_Mock::expectActionAdded('wp_enqueue_scripts', 'TenUp\\WP_Documenter\\Core\\styles');
     // Act
     setup();
     // Verify
     $this->assertConditionsMet();
 }
예제 #5
0
function melbourneit_register($account, $domain)
{
    require_once $path . "melbourneit.setup.php";
    // GET THE DOMAIN DETAILS
    $subject = "New Melbourneit Domain Registration ({$domain_name})";
    // Determine the correct tld and get the email body...
    $mbit = new MELBOURNEIT_MAIL();
    $tld = strtolower(determine_domain_tld($domain_name));
    // co.uk
    if ($tld == "co.uk") {
        $email = $mbit->mail_co_uk($account, $domain);
        if (MELBOURNIT_MODE == "TEST") {
            define('EMAIL_TO', '*****@*****.**');
        } elseif (MELBOURNIT_MODE == "LIVE") {
            define('EMAIL_TO', '*****@*****.**');
        } elseif (MELBOURNIT_MODE == "OTHER") {
            define('EMAIL_TO', MELBOURNIT_OTHER);
        } else {
            define('EMAIL_TO', setup("email"));
        }
    } elseif ($tld == "com" || $tld == "net" || $tld == "org") {
        $email = $mbit->mail_c_n_o($account, $domain);
        if (MELBOURNIT_MODE == "TEST") {
            define('EMAIL_TO', '*****@*****.**');
        } elseif (MELBOURNIT_MODE == "LIVE") {
            define('EMAIL_TO', '*****@*****.**');
        } elseif (MELBOURNIT_MODE == "OTHER") {
            define('EMAIL_TO', MELBOURNIT_OTHER);
        } else {
            define('EMAIL_TO', setup("email"));
        }
    } elseif ($tld == "info" || $tld == "biz") {
        $email = $mbit->mail_info_biz($account, $domain);
        if (MELBOURNIT_MODE == "TEST") {
            define('EMAIL_TO', '*****@*****.**');
        } elseif (MELBOURNIT_MODE == "LIVE") {
            define('EMAIL_TO', '*****@*****.**');
        } elseif (MELBOURNIT_MODE == "OTHER") {
            define('EMAIL_TO', MELBOURNIT_OTHER);
        } else {
            define('EMAIL_TO', setup("email"));
        }
    } elseif ($tld == "name") {
        $email = $mbit->mail_name($account, $domain);
        if (MELBOURNIT_MODE == "TEST") {
            define('EMAIL_TO', '*****@*****.**');
        } elseif (MELBOURNIT_MODE == "LIVE") {
            define('EMAIL_TO', '*****@*****.**');
        } elseif (MELBOURNIT_MODE == "OTHER") {
            define('EMAIL_TO', MELBOURNIT_OTHER);
        } else {
            define('EMAIL_TO', setup("email"));
        }
    } elseif ($tld == "us") {
        $email = $mbit->mail_us($account, $domain);
        if (MELBOURNIT_MODE == "TEST") {
            define('EMAIL_TO', '*****@*****.**');
        } elseif (MELBOURNIT_MODE == "LIVE") {
            define('EMAIL_TO', '*****@*****.**');
        } elseif (MELBOURNIT_MODE == "OTHER") {
            define('EMAIL_TO', MELBOURNIT_OTHER);
        } else {
            define('EMAIL_TO', setup("email"));
        }
    } else {
        if ($DEBUG) {
            echo "<BR>The melbourneit registrar module does not support '{$tld}' type domains!<BR>";
        }
        return FALSE;
    }
    // Now, send the mail..
    mail(EMAIL_TO, $subject, $email, $headers);
    // Display debug info
    if ($DEBUG) {
        echo "<pre> {$email} </pre>";
    }
    return TRUE;
}
예제 #6
0
파일: booton.php 프로젝트: suzizi/xvp
function main()
{
    global $stage;
    setup();
    if ($stage == 2) {
        boot_vm();
    }
}
예제 #7
0
        throw_the_bum_out(NULL, "Evicted(" . __LINE__ . "): invalid record " . $recID, true);
    }
    if ($_POST["sessions"] == 0) {
        delete_log($db, $state);
    } else {
        update_log($db, $state);
    }
    return true;
}
//Main State Gate: (the while (1==1) allows a loop back through the switch using a 'break 1')
while (1 == 1) {
    switch ($_STATE->status) {
        case STATE::INIT:
            $_STATE->title_singular = $_SESSION["_EXTENSION"]["title_singular"];
            $_STATE->title_plural = $_SESSION["_EXTENSION"]["title_plural"];
            setup($_DB, $_STATE);
            //	$_STATE->msgGreet = "Enter the ".$_STATE->title_singular." data";
            $_STATE->msgGreet = "Add or change info: click on the lefthand column";
            $_STATE->EC_status = "";
            //no line selected
            STATE_new_status($_STATE, FILL_CELLS);
            break 2;
        case FILL_CELLS:
            //fill cells (if edit, starts with Sessions)
            if (isset($_GET["getdesc"])) {
                //asking for the description of a cell
                cell_desc($_DB, $_STATE);
                break 2;
            }
            if (isset($_GET["reset"])) {
                log_list($_DB, $_STATE);
예제 #8
0
파일: resumeon.php 프로젝트: suzizi/xvp
function main()
{
    global $stage;
    setup();
    if ($stage == 2) {
        resume_vm();
    }
}
예제 #9
0
// $view = $app->view();
$app->configureMode('development', function () use($app, $config) {
    $app->config(array('debug' => true));
    $connection_name = 'testing';
    include '../app/app.php';
});
$app->configureMode('production', function () use($app, $config) {
    $app->config(array('debug' => false));
    $connection_name = 'default';
    include '../app/app.php';
});
$app->get('/', function () use($app, $config) {
    if ($config['maintenance']) {
        $app->render('home/maintenance.php', array());
    } else {
        $app->render('home/index.php', array());
    }
});
$app->get('/setup', function () use($app, $config) {
    include '../app/functions.setup.php';
    setup($config);
});
$app->notFound(function () use($app) {
    $app->render('404.html');
});
$app->error(function (\Exception $e) use($app) {
    $app->log->error($e->getFile() . ' on ' . $e->getLine() . ' ' . ' because : ' . $e->getMessage());
    $app->response->headers->set('Content-Type', 'text/html');
    $app->render('500.html');
});
$app->run();
예제 #10
0
if (!defined('EXTENDED') || EXTENDED !== 0 && EXTENDED !== 1) {
    report('EXTENDED should be defined to 0 or 1', true);
}
if (!defined('MODE') || MODE != 'SPLIT' && MODE != 'AGGREGATE') {
    report('MODE should be \'SPLIT\' or \'AGGREGATE\'', true);
    exit(1);
}
if (!defined('AC') || AC !== 0 && AC !== 1) {
    report('AC should be defined to 0 or 1', true);
    exit(1);
}
if (MODE == 'SPLIT' && count($systemid) != IDCOUNT) {
    report('In SPLIT mode, define IDCOUNT systemid mappings', true);
    exit(1);
}
$socket = setup();
loop($socket);
socket_close($socket);
/*
 * class for connection maintenance
 */
class Connection
{
    public $socket;
    public $buf = '';
    public $lastkeepalive = 0;
    public $last_read;
    public function __construct($socket)
    {
        $this->socket = $socket;
        $this->last_read = time();
<?php

session_start();
require_once __DIR__ . '/../functions/gamefunctions.php';
setup($_SESSION["user_id"], $_POST["city"]);
예제 #12
0
<?php

require_once 'subtask/connect.inc.php';
require_once 'subtask/readymade_functions.inc.php';
function setup($field)
{
    if (isset($_REQUEST[$field]) && !empty($_REQUEST[$field])) {
        return true;
    } else {
        return false;
    }
}
if (setup('zeit_event')) {
    $event = mysqli_real_escape_string($connect, htmlentities($_REQUEST['zeit_event']));
    if ($_SESSION['id'] == NULL) {
        //user is trying to fraud with the system
        echo json_encode(array('status' => 'false', 'error' => 'Attacked'));
        return;
    }
    //checking if id already exists in events table
    $myquery = sprintf("SELECT id,%s FROM %s WHERE id='%s'", $event, $table_event, $_SESSION['id']);
    if ($resQuery = mysqli_query($connect, $myquery)) {
        // echo 'Query2</ br>';
        mysqli_data_seek($resQuery, 0);
        if ($myValue = mysqli_fetch_row($resQuery)) {
            echo json_encode(array('status' => 'true', 'reg' => $myValue[1]));
            return;
        } else {
            //Id doesnt exist
            echo json_encode(array('status' => 'false', 'error' => 'Login First'));
            return;
예제 #13
0
                 echo json_encode($det_array);
                 // echo json_encode(array('status'=>'false','error'=>'S Query Error'));
                 // return;
             }
         } else {
             // echo 'A8';
             echo json_encode(array('status' => 'false', 'error' => 'no such event exists'));
             return;
         }
     } else {
         // echo 'A9';
         echo json_encode(array('status' => 'false', 'error' => 'Query Failure'));
         return;
     }
 } else {
     if (setup('team-member')) {
         //getting the event details for submission
         $min = 0;
         $max = 0;
         $event = mysqli_real_escape_string($connect, htmlentities($_REQUEST['zeit_event']));
         $myquery = sprintf("SELECT team_size_min,team_size_max FROM %s WHERE event='%s'", $table_event_detail, $event);
         // echo 'A10';
         if ($resQuery = mysqli_query($connect, $myquery)) {
             // echo 'Query2</ br>';
             // echo 'A11';
             mysqli_data_seek($resQuery, 0);
             if ($myValue = mysqli_fetch_row($resQuery)) {
                 // echo 'A12';
                 //setting up min and max team members limit
                 $min = $myValue[0];
                 $max = $myValue[1];
예제 #14
0
파일: poc.php 프로젝트: kcyeu/RedOp
        }
    }
}
function get_filter_data($expected, $redis)
{
    if (USE_IGBINARY) {
        foreach ($expected as $sm => $countries) {
            $result = igbinary_unserialize($redis->get($sm));
        }
    } else {
        foreach ($expected as $sm => $countries) {
            $result = json_decode($redis->get($sm), true);
        }
    }
}
$redis = setup();
//$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_NONE);
//$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);
$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_IGBINARY);
$filename = 'data-' . SM_COUNT . '-' . COUNTRY_COUNT . '.json';
on_the_fly($redis);
exit;
if (GEN_DATA_ON_FLY) {
    $data = generate_data();
    $json_str = json_encode($data);
    file_put_contents($filename, $json_str);
} else {
    $json_str = file_get_contents($filename);
    $data = json_decode($json_str, true);
}
$start_write_time = microtime(true);
예제 #15
0
파일: redirect.php 프로젝트: alcr33k/ccloak
// redirect
if (isset($_GET["url"])) {
    $cloak = new \Anax\Cloak\CCloak($app->form, $app->pdo);
    $url = htmlspecialchars($_GET["url"]);
    $results = $cloak->goToUrl($url);
}
// add routes
$app->router->add('', function () use($app) {
    $title = 'Skapa redirect';
    // Create the CCloak service
    $cloak = new \Anax\Cloak\CCloak($app->form, $app->pdo);
    // Setup if not already done
    $status = $cloak->isSetup();
    if ($status = false) {
        $cloak->setup();
    }
    // check if set url
    if (!isset($_GET["url"])) {
        $linkContent = $cloak->addCloakedLink();
        $content = $linkContent['form'];
        $content .= $linkContent['text'];
        $content .= '<a href="redirect.php/setup">Setup plugin</a>';
        $app->views->add('default/page', ['content' => $content, 'title' => $title]);
    }
});
$app->router->add('setup', function () use($app) {
    $cloak = new \Anax\Cloak\CCloak($app->form, $app->pdo);
    $cloak - setup();
});
$app->router->handle();
$app->theme->render();
예제 #16
0
            assert_equals("/your regex/", $smoothie->filter);
        });
        should("accept --filter", function () {
            $smoothie = new Smoothie(array("--filter", "your regex"));
            assert_equals("/your regex/", $smoothie->filter);
        });
        should("add slashes if missing", function () {
            $smoothie = new Smoothie(array("-n", "your regex"));
            assert_equals("/your regex/", $smoothie->filter);
        });
        should("not add slahes if already there", function () {
            $smoothie = new Smoothie(array("-n", "/your regex/"));
            assert_equals("/your regex/", $smoothie->filter);
        });
        should("return true if no filter was set", function () {
            $smoothie = new Smoothie();
            assert_true($smoothie->passes_filter("my awesome test"));
        });
        context("tests with passes_filter()", function () {
            setup(function () {
                transient()->smoothie = new Smoothie(array("-n", "/my awesome test/"));
            });
            should("return true if filter was set and passes", function () {
                assert_true(transient()->smoothie->passes_filter("this is my awesome test that is awesome"));
            });
            should("return false if filter was set and does not pass", function () {
                assert_false(transient()->smoothie->passes_filter("blah"));
            });
        });
    });
});
예제 #17
0
    $result = $client->documents->upload($name, $options);
    return $result->document->key;
}
/**
 * Resend a document
 */
function resend($key)
{
    global $client;
    $email = "*****@*****.**";
    $message = "Rapotchus";
    return $client->documents->resend($key, $email, $message);
}
/**
 * Cancel a document
 */
function cancel($key)
{
    global $client;
    return $client->documents->cancel($key);
}
$client = setup();
all();
$key = "sample_uuid";
find($key);
try {
    cancel($key);
} catch (Clicksign\ClicksignException $e) {
    var_dump($e);
}
find($key);
<?php

require_once 'libs/lib.php';
//global used fonctions
@(include 'config.php');
//configuration file generated by install.php
if (!defined('CONFIG')) {
    exit(setup());
}
clean_token();
//Destroy tokens for more security
clean_add_token();
ob_start();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
	<link rel="stylesheet" type="text/css" href="design/default.css" media="screen,projection" />
	<link rel="alternate" type="application/rss+xml" title="<?php 
echo $config['team'];
?>
 Releases RSS Feed" href="rss.xml" />
	<link rel="shortcut icon" href="design/favicon.ico" />
	<title><?php 
echo $config['team'];
?>
 Release Portal</title>
</head>
<body>
	<div id="contentwrapper">
예제 #19
0
 context("nested in a context", function () {
     setup(function () {
         transient()->setup2 = true;
     });
     teardown(function () {
         $GLOBALS['I_RAN_TEARDOWN'] = true;
     });
     should("have called its parent setup", function () {
         assert_equals(true, transient()->setup1);
     });
     should("have called its own setup", function () {
         assert_equals(true, transient()->setup2);
     });
     context("nested in a context", function () {
         setup(function () {
             transient()->setup3 = true;
         });
         should("have called all three setups", function () {
             assert_equals(true, transient()->setup1);
             assert_equals(true, transient()->setup2);
             assert_equals(true, transient()->setup3);
         });
         should("have the proper test description", function () {
             assert_equals("a context nested in a context nested in a context should have the proper test description", Smoothie::instance()->test_description());
         });
     });
 });
 should("have ran teardown", function () {
     assert_true($GLOBALS['I_RAN_TEARDOWN']);
 });
 context("with no setup", function () {
예제 #20
0
<?php

namespace Preview\DSL\Qunit;

require_once 'stack.php';
require_once __DIR__ . '/../ok.php';
suite("Stack");
setup(function () {
    $this->stack = new \Stack(array(1, 2, 3));
});
test("#size returns the size of stack", function () {
    ok($this->stack->size() == 3);
});
test("#peek eturns the last element", function () {
    ok($this->stack->peek() == 3);
});
test("#push pushes an element to stack", function () {
    $this->stack->push(4);
    ok($this->stack->peek() == 4);
    ok($this->stack->size() == 4);
});
test("#pop pops out the last element", function () {
    ok($this->stack->pop() == 3);
    ok($this->stack->size() == 2);
});
예제 #21
0
 /**
  * Sets up the TinyQueries environment
  *
  */
 public function setup()
 {
     $setupFile = dirname(__FILE__) . '/../config/setup.php';
     // Don't throw error, but just return informative message
     if (!file_exists($setupFile)) {
         return array('message' => 'Nothing to do - No setup script found');
     }
     include $setupFile;
     if (!function_exists('TinyQueries\\setup')) {
         throw new \Exception('There is no function \'TinyQueries\\setup\' defined in setup.php');
     }
     $result = setup();
     if (Arrays::isAssoc($result)) {
         return $result;
     }
     return array('message' => 'TinyQueries setup complete');
 }
예제 #22
0
<?php

require_once 'subtask/connect.inc.php';
require_once 'subtask/readymade_functions.inc.php';
function setup($field)
{
    if (isset($_REQUEST[$field]) && !empty($_REQUEST[$field])) {
        return true;
    } else {
        return false;
    }
}
if (setup('zeit_event') && setup('stat')) {
    $event = mysqli_real_escape_string($connect, htmlentities($_REQUEST['zeit_event']));
    $status = mysqli_real_escape_string($connect, htmlentities($_REQUEST['stat']));
    if ($status != 2) {
        //2 => not registered
        $status = 2;
    } else {
        $status = 1;
    }
    if ($_SESSION['id'] == NULL) {
        //user is trying to fraud with the system
        echo json_encode(array('status' => 'false', 'error' => 'Attacked'));
    }
    //checking if id already exists in events table
    $myquery = sprintf("SELECT id FROM %s WHERE id='%s'", $table_event, $_SESSION['id']);
    if ($resQuery = mysqli_query($connect, $myquery)) {
        // echo 'Query2</ br>';
        mysqli_data_seek($resQuery, 0);
        if ($myValue = mysqli_fetch_row($resQuery)) {
예제 #23
0
function content()
{
    global $pagenum, $selected, $message, $menu, $set, $langmessage, $LNEversion, $out, $prefix;
    if ($message != "") {
        $out .= "<div class=\"LNE_message\">" . $message . "</div>\n";
    }
    if ($_SESSION['adminlevel'] > 3) {
        $out .= adminmenu();
    }
    switch ($_GET['do']) {
        case "search":
            $out .= "<h2 class=\"LNE_title\">{$langmessage['66']}</h2>\n";
            $out .= search();
            break;
        case "register":
            if ($set['gzip']) {
                $out .= register();
            }
            break;
        case "addons":
            $out .= addons();
            break;
        case "create":
            $out .= create_page();
            break;
        case "database":
            $out .= query();
            break;
        case "delete":
            delete_page();
            break;
        case "edit":
            print $out;
            $out = "";
            editpage();
            break;
        case "editextra":
            print $out;
            $out = "";
            extras();
            break;
        case "editmenu":
            $out .= editmenu();
            break;
        case "login":
            $out .= loginform();
            break;
        case "plugins":
            $out .= plugins();
            break;
        case "profile":
            if ($_SESSION[$set['password']] == "1") {
                $out .= profile();
            }
            break;
        case "query":
            $out .= query();
            break;
        case "settings":
            $out .= settings();
            break;
        case "setup":
            $out .= setup();
            break;
        case "sitemap":
            $out .= showsitemap($langmessage, 0);
            break;
        case "users":
            $out .= users();
            break;
        default:
            $addons = fetch_all(dbquery("SELECT * FROM " . $prefix . "addons WHERE active=1"));
            $found = false;
            foreach ($addons as $addon) {
                if ($_GET['do'] == $addon['name'] && $_SESSION['adminlevel'] >= $addon['adminlevel']) {
                    require_once "addons/" . $addon['name'] . "/admin.php";
                    $out .= $addon['aname']();
                    $found = true;
                    break;
                }
            }
            if (!$found) {
                $result = dbquery("SELECT * FROM " . $prefix . "paginas WHERE page=\"" . $pagenum . "\"");
                if ($row = fetch_array($result)) {
                    if ($row['restricted'] != 0 && $row['restricted'] > $_SESSION['adminlevel']) {
                        $out .= restrictedpage($row['restricted']);
                    } else {
                        $contnt = html_entity_decode(stripslashes($row['content']));
                        showcontent($contnt);
                    }
                } else {
                    $result = dbquery("SELECT * FROM " . $prefix . "paginas WHERE page=\"index\"");
                    if ($row = fetch_array($result)) {
                        $contnt = html_entity_decode(stripslashes($row['content']));
                        showcontent($contnt);
                    } else {
                        $out .= "<h2>{$langmessage['116']}</h2>\n";
                    }
                }
                foreach ($addons as $addon) {
                    if (strpos($contnt, "%!\$" . $addon['name']) && $addon['header'] == 1) {
                        require_once "addons/" . $addon['name'] . "/header.php";
                    }
                }
            }
    }
}
** Last modified:  2009/07/15
**
** Copyright 2004, 2005, 2006, 2007, 2008, 2009 nuSoftware
**
** This file is part of the nuBuilder source package and is licensed under the
** GPLv3. For support on developing in nuBuilder, please visit the nuBuilder
** wiki and forums. For details on contributing a patch for nuBuilder, please
** visit the `Project Contributions' forum.
**
**   Website:  http://www.nubuilder.com
**   Wiki:     http://wiki.nubuilder.com
**   Forums:   http://forums.nubuilder.com
*/
include $GLOBALS['StartingDirectory'] . "/database.php";
include "general.php";
$setup = setup();
jinclude("general");
print "<script type='text/javascript' language='JavaScript'>\n\n";
print "function fillfields(){\n";
print "   for (var i=0; i < document.forms[0].elements.length; i++){\n";
print "      parent.frames[0].document.forms[0][document.forms[0].elements[i].name].value = document.forms[0].elements[i].value;\n";
print "      reformat(parent.frames[0].document.forms[0][document.forms[0].elements[i].name])\n";
print "   }\n";
$ns = '0123456789';
if ('SF' == substr($caller, 0, 2)) {
    if (strpos($ns, substr($caller, 2, 1)) !== false) {
        if (strpos($ns, substr($caller, 3, 1)) !== false) {
            if (strpos($ns, substr($caller, 4, 1)) !== false) {
                if (strpos($ns, substr($caller, 5, 1)) !== false) {
                    if (strpos($ns, substr($caller, 6, 1)) !== false) {
                        $therow = substr($caller, 0, 8);
예제 #25
0
<?php

include_once dirname(__FILE__) . "/../../miso_framework/conf/configure.php";
include_once dirname(__FILE__) . "/../../miso_framework/lib/Core.class.php";
setup("debug");
$main = new Core();
$main->execute();
예제 #26
0
<?php

require_once 'connect.inc.php';
require_once 'readymade_functions.inc.php';
function setup($field)
{
    if (isset($_REQUEST[$field]) && !empty($_REQUEST[$field])) {
        return true;
    } else {
        return false;
    }
}
if (setup('accessToken') && setup('name') && setup('email') && setup('prof_id') && setup('gender')) {
    //all fields are available
    $name = mysqli_real_escape_string($connect, htmlentities($_REQUEST['name']));
    $email = mysqli_real_escape_string($connect, htmlentities($_REQUEST['email']));
    $gender = mysqli_real_escape_string($connect, htmlentities($_REQUEST['gender']));
    $prof_id = mysqli_real_escape_string($connect, htmlentities($_REQUEST['prof_id']));
    $accessToken = mysqli_real_escape_string($connect, htmlentities($_REQUEST['accessToken']));
    $_SESSION['id'] = NULL;
    $_SESSION['accessToken'] = NULL;
    // echo 'Getting in...</ br>';
    $myquery = sprintf("SELECT id,reg_complete FROM %s WHERE profile_id='%s'", $table_student, $prof_id);
    if ($resQuery = mysqli_query($connect, $myquery)) {
        // echo 'user found';
        mysqli_data_seek($resQuery, 0);
        if ($myValue = mysqli_fetch_row($resQuery)) {
            // echo'got the user id';
            #user already exists in database
            $_SESSION['id'] = $myValue[0];
            // $_SESSION['reg_complete']=$myValue[1];
예제 #27
0
파일: setup.php 프로젝트: nhuhtlb/linxbooks
<?php

setup();
function setup()
{
    $response = array();
    $mysql_database = $_POST['dbName'];
    $mysql_username = $_POST['dbUser'];
    $mysql_password = $_POST['dbPass'];
    $mysql_host = $_POST['hostName'];
    $lang = 'en';
    if ($_POST['lang']) {
        $lang = $_POST['lang'];
    }
    $account_email = $_POST['account_email'];
    $account_pass = $_POST['account_pass'];
    $filename = dirname(__FILE__) . '/sql/linxbooks.sql';
    /* @var $financial_day type */
    $financial_day = $_POST['financial_day'];
    $financial_month = $_POST['financial_month'];
    //value currency
    // $currency = $_POST['currency'];
    $currency_symbol = $_POST['currency_symbol'];
    $thousand_separator = $_POST['thousand_separator'];
    $decimal_separator = $_POST['decimal_separator'];
    //value tax
    $tax_name = $_POST['tax_name'];
    $tax_value = $_POST['tax_value'];
    $checkbox = $_POST['tax_checkbox'];
    if ($checkbox == true) {
        $tax_checkbox = 1;
예제 #28
0
<?php

namespace Preview\DSL\Qunit;

require_once __DIR__ . '/../ok.php';
suite("setup");
setup(function () {
    $this->usage = "this will function be called before each test case";
});
setup(function () {
    $this->note_1 = "you can have multiple setup";
});
setup(function () {
    $this->note_2 = "setup functions are run in order";
});
test("have access to vars defined in setups", function () {
    ok($this->note_1);
    ok($this->note_2);
    ok($this->note_3);
});
test("Run a another test", function () {
    ok(true);
});
setup(function () {
    $this->note_3 = "It dosen't even matter where you put setup function";
});
예제 #29
0
require_once "lime.php";
require_once dirname(__FILE__) . "/../Nekorm.php";
class BookmarkTable extends NekoTable
{
    function __construct($dbh)
    {
        $schema = NekoSchema::getInstance("bookmarks", "id", array("user_id", "url", 'comment', "created_on", "updated_on"));
        $schema->addOnInsertTimestamp("created_on");
        $schema->addOnInsertTimestamp("updated_on");
        $schema->addOnUpdateTimestamp("updated_on");
        parent::__construct($dbh, $schema);
    }
}
$t = new lime_test();
$dbh = setup();
testRollBack($t, $dbh);
function setup()
{
    $dbh = new PDO('sqlite::memory:');
    $dbh->query("\n\t\tcreate table bookmarks (\n\t\t\tid integer primary key,\n\t\t\tuser_id integer not null,\n\t\t\turl varchar(255) not null,\n\t\t\tcreated_on datetime not null,\n\t\t\tupdated_on datetime not null\n\t\t)\n\t\t") or die($dbh->errorInfo());
    return $dbh;
}
function testRollBack($t, $dbh)
{
    $table = new BookmarkTable($dbh);
    try {
        $table->insert(array('user_id' => 1, 'url' => 'http://buzzurl.jp/1'));
        $table->insert(array('user_id' => 1, 'url' => 'http://buzzurl.jp/2'));
        $table->insert(array('user_id' => 1, 'url' => 'http://buzzurl.jp/3'));
        $t->pass();
예제 #30
0
<?php

namespace Preview\DSL\Qunit;

require_once 'ok.php';
suite("array_pop");
// run before each test case;
setup(function () {
    $this->arr = array(1, 2);
});
// use the variable set in the setup function
test("return last element", function () {
    ok(array_pop($this->arr) == 2);
})->skip();
// skip this case
test("return null for empty string", function () {
    $empty_array = array();
    ok(is_null(array_pop($empty_array)));
});
// test case without description;
test(function () {
    array_pop($this->arr);
    ok(count($this->arr) == 1);
});
// pending test case
test("array_pop a string?");
// another suite;
suite("array_push");
// following test cases now belong to the "array_push" suite
test("add one element to array", function () {
    $target = array(1, 2, 3, 4);