Esempio n. 1
0
 /**
  * * returns interface to DBWrapper singleton
  * @param $host - - server host name
  * @param $dbname - - db name
  * @param $user - - db user name
  * @param $password - - db user password
  * @return IDBWrapper cast of DBWrapper object
  */
 public static function instance($host = NULL, $dbname = NULL, $user = NULL, $password = NULL)
 {
     DBG::log(__CLASS__, __FUNCTION__, 'before:', array($host, $dbname, $user));
     if (!isset(self::$dbwrapper)) {
         self::$dbwrapper = new DBWrapper($host, $dbname, $user, $password);
     }
     $cast = DBWrapper::castIDBWrapper(self::$dbwrapper);
     DBG::log(__CLASS__, __FUNCTION__, 'after:', array(self::$dbwrapper, $cast));
     return $cast;
 }
<?php

//Give access to some utility functions/variables.
include_once "GlobalUtils.php";
//Database wrapper for MySQL Calls. Not really simpler than using MySQLi directly, but who cares.
$database = new DBWrapper();
//The user authentification class handles registration and log-in. It has access to the database, and should get its data from $_POST. Constructor handles registration requests.
$userAuth = new UserAuthentification($database);
//Try to log-in with the current $_POST. Sets cookies if needed (Supports sessions)
$userAuth->tryLogin();
//Only viewable by members.
if ($userAuth->userGroup == UserAuthentification::$GUEST) {
    setcookie("mustlogin");
    header('Location: index.php');
    exit;
}
//Itemset displayed in the creator. Empty by default.
$itemset = new ItemSet();
//How will the ItemSet be saved? On a new ID, or based on an old one? create = new, some id = old one
$type = "create";
if (isset($_GET["edit"])) {
    $type = $_GET["edit"];
    $stmt3 = $database->mysqli->prepare("SELECT m.ItemSetID, m.ItemID, m.ItemCount, s.OwnerID, s.Title, s.Type, s.Map, s.Mode, s.Sortrank, s.Champion, IFNULL(v.Rating, 0) AS Rating, s.Date, b.Name, b.recMath, b.minSumLvl, b.maxSumLvl, b.showIfSumSpell, b.hideIfSumSpell, i.Gold, i.Name AS ItemName, i.Description, ibi.BuildsIntoID, ibf.BuildsFromID FROM `ItemSetMap` m JOIN `ItemSets` s ON m.ItemSetID = s.ID JOIN `ItemBlocks` b ON m.BlockID = b.ID JOIN `Items` i ON m.ItemID = i.ID LEFT JOIN `ItemBuildsFrom` ibf ON m.ItemID = ibf.ItemID LEFT JOIN `ItemBuildsInto` ibi ON m.ItemID = ibi.ItemID LEFT JOIN (SELECT ItemsetID, SUM(Rating) AS Rating FROM `Votes` GROUP BY ItemsetID) v ON v.ItemsetID = m.ItemSetID WHERE m.ItemSetID = ?;");
    $stmt3->bind_param("i", $_GET["edit"]);
    $stmt3->execute();
    $res = $stmt3->get_result();
    $ret = array();
    while ($row = $res->fetch_assoc()) {
        array_push($ret, $row);
    }
    $stmt3->free_result();
Esempio n. 3
0
<?php

/**
 * cPanel4J
 * sql_install.php
 * Author: Vivek Soni (contact@viveksoni.net)
 * Instructions & More Info: www.cpanel4j.com
 * Released under the GNU General Public License
 */
namespace cPanel4jCore;

//CRON JOBS TO BE RUN AS ROOT
require_once "DBWrapper.php";
require_once "Tomcat.php";
$dbWrapper = new DBWrapper();
$tomCat = new Tomcat();
$records = $dbWrapper->getRecordForCron();
while ($row = mysqli_fetch_array($records)) {
    if ($row['delete_flag'] == 0) {
        $userName = $row['user_name'];
        $domainName = $row['domain_name'];
        $ajp_port = $row['ajp_port'];
        $tomcatVersion = $row['tomcat_version'];
        if ($row['installed'] == 0) {
            //install instnac
            $catalinaHome = "/cPanel4jCore/tomcat-" . $tomcatVersion . "-engine";
            $userTomcatDir = "/home/" . $userName . "/" . $domainName . "/tomcat-" . $tomcatVersion . "/";
            // Step 4 creating service startup sh file
            $fileName = "/cPanel4jCore/service-files/" . $userName . "-" . $domainName . "-tomcat-" . $tomcatVersion . ".sh";
            exec("rm -f {$fileName}");
            $serviceFileContent = "#!/bin/bash \n#description: Tomcat-" . $domainName . " start stop restart \n#processname: tomcat-" . $userName . "-" . $domainName . " \n\n#chkconfig: 234 20 80 \n CATALINA_HOME=" . $catalinaHome . " \n export CATALINA_BASE=" . $userTomcatDir . " \n\n\t\t\tcase \$1 in \n start) \n sh \$CATALINA_HOME/bin/startup.sh \n ;; \n stop) \n sh \$CATALINA_HOME/bin/shutdown.sh \n ;; \n\n\t\t\trestart) \n sh \$CATALINA_HOME/bin/shutdown.sh \n sh \$CATALINA_HOME/binstartup.sh \n;; \n esac \n exit 0";
Esempio n. 4
0
<?php

require_once 'DBWrapper.php';
require_once 'DBTypes.php';
require_once 'Debugger.php';
DBG::setLevel(DBG::enabled);
$dbw = DBWrapper::instance('localhost', 'tores', 'root', 'n15174326dc');
$object = new Pracownik(array(NULL, 'usis', '506036763', '632', 'zajebiste', NULL));
$dbw->addObject(Objects::Pracownik, $object);
$objects = $dbw->getObjects(Objects::Pracownik);