getWhere() public method

public getWhere ( $table, $where )
Beispiel #1
0
	    <div class="checkbox">
		  <label>
		    <input type="checkbox" name="user_avatars" value="1"> Allow custom user avatars
		  </label>
            </div>
            <hr>
	    <input type="submit" class="btn btn-primary" value="Submit">
	  </form>
	  <?php 
                    } else {
                        if ($step === "account") {
                            if (!isset($queries)) {
                                $queries = new Queries();
                                // Initialise queries
                            }
                            $allow_mcnames = $queries->getWhere("settings", array("name", "=", "displaynames"));
                            $allow_mcnames = $allow_mcnames[0]->value;
                            // Can the user register with a non-Minecraft username?
                            if (Input::exists()) {
                                $validate = new Validate();
                                $data = array('email' => array('required' => true, 'min' => 2, 'max' => 64), 'password' => array('required' => true, 'min' => 6, 'max' => 64), 'password_again' => array('required' => true, 'matches' => 'password'));
                                if ($allow_mcnames === "false") {
                                    // Custom usernames are disabled
                                    $data['username'] = array('min' => 2, 'max' => 20, 'isvalid' => true);
                                } else {
                                    // Custom usernames are enabled
                                    $data['username'] = array('min' => 2, 'max' => 20);
                                    $data['mcname'] = array('min' => 2, 'max' => 20, 'isvalid' => true);
                                }
                                $validation = $validate->check($_POST, $data);
                                // validate
Beispiel #2
0
            });
        }
    }
}
/* 
 *  Initialise
 */
if ($page !== 'install') {
    $queries = new Queries();
    $user = new User();
    $smarty = new Smarty();
    $c = new Cache();
}
// Error reporting?
if ($page !== 'install') {
    $error_reporting = $queries->getWhere('settings', array('name', '=', 'error_reporting'));
    $error_reporting = $error_reporting[0]->value;
    if ($error_reporting !== '0') {
        // Enabled
        ini_set('display_startup_errors', 1);
        ini_set('display_errors', 1);
        error_reporting(-1);
    } else {
        // Disabled
        error_reporting(0);
        ini_set('display_errors', 0);
    }
}
// Process if user has checked "remember me"
if ($page !== 'install') {
    if (Cookie::exists(Config::get('remember/cookie_name')) && !Session::exists(Config::get('session/session_name'))) {
Beispiel #3
0
            });
        }
    }
}
/* 
 *  Initialise
 */
if ($page !== 'install') {
    $queries = new Queries();
    $user = new User();
    $smarty = new Smarty();
    $c = new Cache();
}
// Error reporting?
if ($page !== 'install') {
    $error_reporting = $queries->getWhere('settings', array('name', '=', 'error_reporting'));
    $error_reporting = $error_reporting[0]->value;
    if ($error_reporting !== '0') {
        // Enabled
        ini_set('display_startup_errors', 1);
        ini_set('display_errors', 1);
        error_reporting(-1);
    } else {
        // Disabled
        error_reporting(0);
        ini_set('display_errors', 0);
    }
}
if ($page !== 'query_alerts' && $page !== 'query_pms' && $page !== 'install' && $page !== 'api' && $page !== 'query_apps' && $page !== 'banner') {
    // Set path for Smarty
    $smarty->setCompileDir('cache/templates_c');
Beispiel #4
0
            });
        }
    }
}
/* 
 *  Initialise
 */
if ($page !== 'install') {
    $queries = new Queries();
    $user = new User();
    $smarty = new Smarty();
    $c = new Cache();
}
// Error reporting?
if ($page !== 'install') {
    $error_reporting = $queries->getWhere('settings', array('name', '=', 'error_reporting'));
    $error_reporting = $error_reporting[0]->value;
    if ($error_reporting !== '0') {
        // Enabled
        ini_set('display_startup_errors', 1);
        ini_set('display_errors', 1);
        error_reporting(-1);
    } else {
        // Disabled
        error_reporting(0);
        ini_set('display_errors', 0);
    }
}
// Process if user has checked "remember me"
if ($page !== 'install') {
    if (Cookie::exists(Config::get('remember/cookie_name')) && !Session::exists(Config::get('session/session_name'))) {
Beispiel #5
0
 }
 /*
  * Install file check 
  */
 if ($page === "admin") {
     clearstatcache();
     if (file_exists($path . "install.php")) {
         Session::flash('adm-alert', '<div class="alert alert-danger">The installation file (install.php) exists. Please remove it!</div>');
     }
 }
 /*
  * Maintenance mode 
  * TODO: Tidy up the message
  */
 if ($page === "forum") {
     $maintenance = $queries->getWhere("settings", array("name", "=", "maintenance"));
     if ($maintenance[0]->value === "true") {
         if ($user->data()->group_id != 2) {
             echo 'Sorry, the forums are in maintenance mode. Please head back to the <a href="../">homepage</a>.';
             die;
         }
     }
 }
 /*
  *  Are there any open reports for moderators?
  */
 if ($user->isLoggedIn() && ($user->data()->group_id == 2 || $user->data()->group_id == 3)) {
     $reports = $queries->getWhere("reports", array('status', '<>', '1'));
     if (count($reports)) {
         $reports = true;
         // Open reports
Beispiel #6
0
 *
 *  License: MIT
 */
// Require files
if (!isset($queries)) {
    require '../../core/config.php';
    require '../../core/classes/Config.php';
    require '../../core/classes/DB.php';
    require '../../core/classes/Queries.php';
    require '../../core/includes/arrays.php';
    $queries = new Queries();
} else {
    require 'core/includes/arrays.php';
}
if (isset($_GET["key"])) {
    $key = $queries->getWhere('settings', array('name', '=', 'unique_id'));
    if ($_GET["key"] !== $key[0]->value) {
        die('Invalid key');
    }
} else {
    die('Invalid key');
}
// Which donor store are we using?
$webstore = $queries->getWhere('donation_settings', array('name', '=', 'store_type'));
$webstore = $webstore[0]->value;
if ($webstore == 'bc') {
    // Buycraft
    require 'integration/buycraft.php';
    /*
     * PACKAGES SYNC
     */
Beispiel #7
0
                            ?>
		<br />
		<input type="submit" class="btn btn-primary" value="Submit">
	  </form>
	    <?php 
                        } else {
                            echo '<script>window.location.replace("/install/?step=account");</script>';
                            die;
                        }
                    } else {
                        if ($step === "account") {
                            if (!isset($queries)) {
                                $queries = new Queries();
                                // Initialise queries
                            }
                            $allow_mcnames = $queries->getWhere("settings", array("name", "=", "displaynames"));
                            $allow_mcnames = $allow_mcnames[0]->value;
                            // Can the user register with a non-Minecraft username?
                            if (Input::exists()) {
                                $validate = new Validate();
                                $data = array('email' => array('required' => true, 'min' => 2, 'max' => 64), 'password' => array('required' => true, 'min' => 6, 'max' => 64), 'password_again' => array('required' => true, 'matches' => 'password'));
                                if ($allow_mcnames === "false") {
                                    // Custom usernames are disabled
                                    $data['username'] = array('min' => 2, 'max' => 20, 'isvalid' => true);
                                } else {
                                    // Custom usernames are enabled
                                    $data['username'] = array('min' => 2, 'max' => 20);
                                    $data['mcname'] = array('min' => 2, 'max' => 20, 'isvalid' => true);
                                }
                                $validation = $validate->check($_POST, $data);
                                // validate
<?php

/*
 *	Made by Samerton
 *  http://worldscapemc.co.uk
 *
 *  License: MIT
 */
if (!isset($queries)) {
    $queries = new Queries();
}
$API = $queries->getWhere("settings", array("name", "=", "buycraft_key"));
$API = $API[0]->value;
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, 'http://www.minecraftmarket.com/api/1.5/' . $API . '/gui');
$mm_gui = curl_exec($ch);
$mm_gui = json_decode(str_replace("&quot;", "\"", strip_tags($mm_gui)), true);
// Packages and categories
curl_setopt($ch, CURLOPT_URL, 'http://www.minecraftmarket.com/api/1.5/' . $API . '/recentdonor');
$mm_donors = curl_exec($ch);
$mm_donors = json_decode(str_replace("&quot;", "\"", strip_tags($mm_donors)), true);
curl_close($ch);
Beispiel #9
0
	    <div class="checkbox">
		  <label>
		    <input type="checkbox" name="user_avatars" value="1"> Allow custom user avatars
		  </label>
	    </div>
		<br />
		<input type="submit" class="btn btn-primary" value="Submit">
	  </form>
	  <?php 
                        } else {
                            if ($step === "account") {
                                if (!isset($queries)) {
                                    $queries = new Queries();
                                    // Initialise queries
                                }
                                $allow_mcnames = $queries->getWhere("settings", array("name", "=", "displaynames"));
                                $allow_mcnames = $allow_mcnames[0]->value;
                                // Can the user register with a non-Minecraft username?
                                if (Input::exists()) {
                                    $validate = new Validate();
                                    $data = array('email' => array('required' => true, 'min' => 2, 'max' => 64), 'password' => array('required' => true, 'min' => 6, 'max' => 64), 'password_again' => array('required' => true, 'matches' => 'password'));
                                    if ($allow_mcnames === "false") {
                                        // Custom usernames are disabled
                                        $data['username'] = array('min' => 2, 'max' => 20, 'isvalid' => true);
                                    } else {
                                        // Custom usernames are enabled
                                        $data['username'] = array('min' => 2, 'max' => 20);
                                        $data['mcname'] = array('min' => 2, 'max' => 20, 'isvalid' => true);
                                    }
                                    $validation = $validate->check($_POST, $data);
                                    // validate
Beispiel #10
0
/*
 *  Query the database
 */
$modernbb_topics = $mysqli->query("SELECT * FROM {$prefix}topics");
$modernbb_topics->data_seek(0);
/*
 *  Loop through the topics
 */
while ($row = $modernbb_topics->fetch_assoc()) {
    // Get new category ID
    $category = $row["forum_id"];
    $category = $mysqli->query("SELECT * FROM {$prefix}forums WHERE id = {$category}");
    $category->data_seek(0);
    $category = $category->fetch_assoc();
    $category = $category["forum_name"];
    $category_id = $queries->getWhere("forums", array("forum_title", "=", $category));
    $category_id = $category_id[0]->id;
    // Get original poster's ID
    $poster = "'" . escape($row["poster"]) . "'";
    $poster = $mysqli->query("SELECT * FROM {$prefix}users WHERE username = {$poster}");
    $poster = $poster->fetch_assoc();
    $poster_id = $poster["id"];
    $poster = null;
    $category = null;
    $queries->create("topics", array("id" => $row["id"], "forum_id" => $category_id, "topic_title" => htmlspecialchars($row["subject"]), "topic_creator" => $poster_id, "topic_last_user" => $row["last_poster_id"], "topic_date" => date('Y-m-d H:i:s', $row["posted"]), "topic_reply_date" => date('Y-m-d H:i:s', $row["last_post"]), "topic_views" => $row["num_views"], "locked" => $row["closed"], "sticky" => $row["sticky"]));
}
$modernbb_topics = null;
/*
 *  Posts
 */
/*
Beispiel #11
0
            });
        }
    }
}
/* 
 *  Initialise
 */
if ($page !== 'install') {
    $queries = new Queries();
    $user = new User();
    $smarty = new Smarty();
    $c = new Cache();
}
// Error reporting?
if ($page !== 'install') {
    $error_reporting = $queries->getWhere('settings', array('name', '=', 'error_reporting'));
    $error_reporting = $error_reporting[0]->value;
    if ($error_reporting !== '0') {
        // Enabled
        ini_set('display_startup_errors', 1);
        ini_set('display_errors', 1);
        error_reporting(-1);
    } else {
        // Disabled
        error_reporting(0);
        ini_set('display_errors', 0);
    }
}
if ($page !== 'query_alerts' && $page !== 'query_pms' && $page !== 'install') {
    // Set path for Smarty
    $smarty->setCompileDir('cache/templates_c');
Beispiel #12
0
        $group = null;
        $queries->create("users", array("username" => htmlspecialchars($row["username"]), "password" => '', "pass_method" => "default", "mcname" => htmlspecialchars($row["username"]), "uuid" => "", "joined" => $row["register_date"], "group_id" => $group_id, "email" => $row["email"], "isbanned" => $row["is_banned"], "lastip" => "", "active" => 1, "signature" => "", "reset_code" => "", "reputation" => $row["like_count"]));
    }
}
$xf_users = null;
/*
 *  Passwords
 */
$password = $mysqli->query("SELECT * FROM {$prefix}user_authenticate");
require 'core/includes/password.php';
while ($row = $password->fetch_assoc()) {
    $user_id = $row['user_id'];
    $user_id = $mysqli->query("SELECT * FROM {$prefix}user WHERE user_id = {$user_id}");
    $user_id = $user_id->fetch_assoc();
    $user_id = $user_id['username'];
    $user_id = $queries->getWhere('users', array('username', '=', $user_id));
    $user_id = $user_id[0]->id;
    $data = unserialize($row['data']);
    $new_password = $data['hash'];
    $queries->update('users', $user_id, array('password' => $new_password));
}
$password = null;
/*
 *  Signatures
 */
$signatures = $mysqli->query("SELECT * FROM {$prefix}user_profile");
while ($row = $signatures->fetch_assoc()) {
    $user_id = $row['user_id'];
    $user_id = $mysqli->query("SELECT * FROM {$prefix}user WHERE user_id = {$user_id}");
    $user_id = $user_id->fetch_assoc();
    $user_id = $user_id['username'];