Beispiel #1
0
 function __construct(REQUEST $req = NULL, DATABASE $db, &$info, $flags = 0)
 {
     parent::__construct($props, $flags);
     if ($flags & GRAPHAxes::PRIVATE_AXES) {
         $prefix = "{$req->props['db_server']}__{$req->props['db_name']}__";
     } else {
         $prefix = "";
     }
     if (!$info['table']) {
         throw new ADEIException("The axes table is not specified in the reader configuration");
     }
     if (!$info['id']) {
         throw new ADEIException("The id column for axes table is not specified in the reader configuration");
     }
     $query = "";
     if (is_array($info['properties'])) {
         foreach ($info['properties'] as $prop => $col) {
             $query .= ", {$col} AS {$prop}";
         }
     }
     $axes = $db->Query("SELECT {$info['id']} AS axis_id{$query} FROM {$this->col_quote}{$info['table']}{$this->col_quote}");
     foreach ($axes as $axis) {
         $this->axis_info[$prefix . $axis['axis_id']] = $axis;
     }
 }
 public static function doCall($table, $data, $debug = false)
 {
     $DBobject = parent::init();
     foreach ($data as $key => $value) {
         $key = self::escape($key);
         $value = self::escape($value);
         $keys .= $key . ", ";
         if ($value == null) {
             $values .= "null, ";
         } else {
             $values .= "'" . $value . "', ";
         }
     }
     $keys = rtrim($keys, ', ');
     $values = rtrim($values, ', ');
     $sql = "INSERT INTO {$table} (" . $keys . ") VALUES (" . $values . ")";
     if ($debug == true) {
         $_SESSION['debug'][] = __FUNCTION__ . ': $sql is <strong>' . $sql . '</strong>';
     }
     $DBobject->query($sql);
     if ($DBobject->errno) {
         $_SESSION['errors'][] = '<p>' . __FUNCTION__ . ' failed: ' . $DBobject->error . '<br> statement was: <strong> ' . $sql . '</strong></p>';
     }
     //self::$insertID = self::$db->insert_id;
 }
 /**
  * Obtiene la instancia Singleton
  * @return DB
  */
 public static function getInstance()
 {
     if (self::$instance == null) {
         self::$instance = new self();
     }
     return self::$instance;
 }
 public function insert($post)
 {
     extract($post);
     $ip = $_SERVER['REMOTE_ADDR'];
     $verification = DATABASE::DB()->prepare("SELECT * FROM result WHERE ip = :id");
     $verification->bindvalue(':id', $ip, PDO::PARAM_STR);
     $verification->execute();
     $correspondance = $verification->fetch();
     if (!$correspondance) {
         $query = "\n\t\t\tINSERT INTO result (\n\t\t\tip,question_1, question_2, question_3, question_4, question_5, question_6, \n\t\t\tquestion_7, question_8, question_9, question_10_1, question_10_2, question_10_3, \n\t\t\tquestion_11, question_12) \n\t\t\tVALUES (\n\t\t\t:ip,:question_1, :question_2, :question_3, :question_4, :question_5, :question_6, \n\t\t\t:question_7, :question_8, :question_9, :question_10_1, :question_10_2, :question_10_3, \n\t\t\t:question_11, :question_12)";
         $insert = DATABASE::DB()->prepare($query);
         $insert->bindvalue(':ip', $ip, PDO::PARAM_STR);
         $insert->bindvalue(':question_1', $question_1, PDO::PARAM_STR);
         $insert->bindvalue(':question_2', $question_2, PDO::PARAM_STR);
         $insert->bindvalue(':question_3', $question_3, PDO::PARAM_STR);
         $insert->bindvalue(':question_4', $question_4, PDO::PARAM_STR);
         $insert->bindvalue(':question_5', $question_5, PDO::PARAM_STR);
         $insert->bindvalue(':question_6', $question_6, PDO::PARAM_STR);
         $insert->bindvalue(':question_7', $question_7, PDO::PARAM_STR);
         $insert->bindvalue(':question_8', $question_8, PDO::PARAM_STR);
         $insert->bindvalue(':question_9', $question_9, PDO::PARAM_STR);
         $insert->bindvalue(':question_10_1', $question_10_1, PDO::PARAM_STR);
         $insert->bindvalue(':question_10_2', $question_10_2, PDO::PARAM_STR);
         $insert->bindvalue(':question_10_3', $question_10_3, PDO::PARAM_STR);
         $insert->bindvalue(':question_11', $question_11, PDO::PARAM_STR);
         $insert->bindvalue(':question_12', $question_12, PDO::PARAM_STR);
         $insert->execute();
         return $info = "GOOD";
     } else {
         return $info = "ERROR_IP";
     }
 }
/**
 * Obtiene el nombre de la provincia por el ID dado.
 * @param type $id
 * @return string
 */
function ObtenerNombreProvincia($id)
{
    $db = DATABASE::getInstance();
    if ($datos = $db->select("provincias", "nombre", "cod={$id}")) {
        return $datos[0]["nombre"];
    }
    return "Desconocida";
}
Beispiel #6
0
 /**
  * Compile the current element
  */
 protected function compile()
 {
     $sb = $this->select_bill;
     $db = DATABASE::getInstance();
     $stmt = $db->prepare("SELECT * FROM tl_my_modul WHERE id=?");
     $res = $stmt->execute($sb);
     $rowA = $res->fetchAssoc();
     $this->Template->all = $rowA;
 }
 private function FirstConnectToDB()
 {
     self::$CONNECTION = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
     if (!self::$CONNECTION) {
         exit(mysqli_connect_error($this->CONNECTION));
     }
     mysqli_query(self::$CONNECTION, "SET CHARACTER SET UTF8");
     mysqli_query(self::$CONNECTION, "SET NAMES SET UTF8");
 }
 protected static function init()
 {
     // load configfile
     $config = $GLOBALS['config'];
     if (self::$INSTANCE == null) {
         self::$INSTANCE = new mysqli($config['DBHOST'], $config['DBUSER'], $config['DBPASSWORD'], $config['DBNAME']);
         if (self::$INSTANCE->connect_errno) {
             print "DATABASE: MySQL connection failed: " . self::$INSTANCE->connect_error;
         }
         self::$INSTANCE->query("SET NAMES utf8;");
     }
     return self::$INSTANCE;
 }
Beispiel #9
0
 /**
  * Updating meta row data
  * @param integer $idMeta
  * @param string $titulo
  * @param string $descripcion
  * @param DateTime $fechaLim
  * @param string $categoria
  * @param integer $prioridad
  * @return PDOStatement|number
  */
 public static function update($idMeta, $titulo, $descripcion, $fechaLim, $categoria, $prioridad)
 {
     //Creating UPDATE statement
     $query = "UPDATE meta " . "SET titulo=:titulo, descripcion=:descripcion, fechaLim=:fechaLim, categoria=:categoria, prioridad=:prioridad " . "WHERE idMeta = :idMeta";
     try {
         //Preparing statement
         $statement = DATABASE::getInstance()->getDb()->prepare($query);
         //Relationing and executing statement
         $statement->execute(array(":titulo" => $titulo, ":descripcion" => $descripcion, ":fechaLim" => $fechaLim, ":categoria" => $categoria, ":prioridad" => $prioridad));
         return $statement;
     } catch (PDOException $e) {
         return -1;
     }
 }
Beispiel #10
0
 public function connect($post)
 {
     extract($post);
     $finalpass = base64_encode(sha1($password, true));
     $select = DATABASE::DB()->prepare("SELECT * FROM users WHERE name = :name AND password = :password");
     $select->bindvalue(':name', $username, PDO::PARAM_STR);
     $select->bindvalue(':password', $finalpass, PDO::PARAM_STR);
     $select->execute();
     $correspondance = $select->fetch();
     if ($correspondance) {
         $_SESSION['login'] = '******';
         $_SESSION['id'] = $correspondance['id'];
         $_SESSION['name'] = $correspondance['name'];
         $_SESSION['nb_survey'] = $correspondance['nb_survey'];
     }
 }
Beispiel #11
0
 private function getUserDates()
 {
     $user = DATABASE::select('users', '*', "`userID`='" . $_SESSION['userID'] . "' AND `isEnabled`='1'", '');
     if (count($user) == 1) {
         $this->GROUP = $user[0]['userGroup'];
         $this->EMAIL = $user[0]['email'];
         $this->USERNAME = $user[0]['userName'];
         $this->USERLATNAME = $user[0]['userLastName'];
         $this->USERID = $user[0]['userID'];
         $this->PASSWORD = $user[0]['password'];
         $this->LOGIN = $user[0]['userLogin'];
         $this->ACCESS_ADMIN_PANEL = $user[0]['accessAdminPanel'];
     } else {
         print_r($user);
     }
 }
 public function InfoFile($path, $file)
 {
     $getInfoFromDB = DATABASE::select("filemanager", "*", "`path`='" . $path . "' AND `file`='" . $file . "' AND `isEnabled`='1'", '');
     if (is_file(dirname(__FILE__) . "/../../../" . $path . '/' . $file)) {
         $getExtenstion = explode('.', $file);
         if (in_array($getExtenstion[count($getExtenstion) - 1], $this->extensions)) {
             self::$Icons[] = $this->icons[array_search($getExtenstion[count($getExtenstion) - 1], $this->extensions)];
         } else {
             self::$Icons[] = 'file-o';
         }
     } else {
         self::$Icons[] = 'folder';
     }
     $userInfo = new USER($getInfoFromDB[0]['userID']);
     self::$fileInfo[] = array($file, substr($getInfoFromDB[0]['timestamp'], 0, 10), substr($getInfoFromDB[0]['timestamp'], 10), $userInfo->USERLATNAME);
     if (is_file(dirname(__FILE__) . "/../../../" . $path . '/' . $file)) {
         self::$fileInfo[][4] = new ADMIN_TRANSLATION(LANG, 'download', 1, 0);
     }
 }
 public static function doCall($sql, $return = true, $debug = false)
 {
     $DBobject = parent::init();
     //call the database
     $result = $DBobject->query($sql);
     if ($DBobject->errno) {
         $_SESSION['errors'][] = '<p>select failed: ' . $DBobject->error . '<br> statement was: <strong>' . $sql . '</strong></p>';
         return array();
     } elseif ($return == true) {
         $ret = array();
         while ($row = $result->fetch_assoc()) {
             $ret[] = $row;
         }
         return $ret;
     }
     if ($debug == true) {
         logfile::doLog(__FUNCTION__ . ' : $sql is ' . $sql);
     }
 }
 public static function doCall($table, $primary, $wnummer, $data, $debug = false)
 {
     $DBobject = parent::init();
     $sql = "UPDATE {$table} SET ";
     foreach ($data as $key => $value) {
         if ($value == null) {
             $sql .= "{$key} = null, ";
         } else {
             $sql .= "{$key} = '{$value}', ";
         }
     }
     $sql = rtrim($sql, ", ");
     $sql .= " WHERE " . $primary . " = '" . $wnummer . "'";
     if ($debug == true) {
         logfile::doLog(__FUNCTION__ . ' : $sql is ' . $sql);
     }
     $DBobject->query($sql);
     if ($DBobject->errno) {
     }
 }
Beispiel #15
0
 public function OpenFolder($path)
 {
     if ($path !== '.') {
         $dir = opendir(dirname(__FILE__) . "/../../../" . $path);
     } else {
         $dir = opendir(dirname(__FILE__) . "/../../../");
     }
     while ($name = readdir($dir)) {
         $getInfoFromDB = DATABASE::select("filemanager", "`size`,`timestamp`", "`path`='" . $path . "' AND `file`='" . $name . "' AND `isEnabled`='1'", '');
         if (count($getInfoFromDB) > 0) {
             $infoFile = $getInfoFromDB[0];
         } else {
             $insertIntoDB = DATABASE::insert('filemanager', '`file`,`path`,`timeseconds`,`userID`,`isEnabled`,`size`', "'" . $name . "','" . $path . "','" . ADMIN_CONFIGURATION::$CONFIG['timeseconds'] . "','1','1','" . filesize(dirname(__FILE__) . "/../../../" . $path . '/' . $name) . "'", '0');
         }
         if (isset($infoFile)) {
             $userInfo = new USER($infoFile['userID']);
         } else {
             $userInfo = new USER($_SESSION['userID']);
         }
         if ($name == '.') {
             $name = new ADMIN_TRANSLATION(LANG, 'FileManagerRoot', 1, 0);
         }
         if ($name == '..') {
             $name = new ADMIN_TRANSLATION(LANG, 'FileManagerUP', 1, 0);
         }
         self::$fileInfo[] = ADMIN_CONFIGURATION::$CONFIG['adminURL'] . LANG . '/filemanager/?modal=1path=' . urlencode($path) . '&file=' . urlencode($name);
         if (is_file(dirname(__FILE__) . "/../../../" . $path . '/' . $name)) {
             $getExtenstion = explode('.', $name);
             if (in_array($getExtenstion[count($getExtenstion) - 1], $this->extensions)) {
                 self::$Icons[] = $this->icons[array_search($getExtenstion[count($getExtenstion) - 1], $this->extensions)];
             } else {
                 self::$Icons[] = 'file-o';
             }
         } else {
             self::$Icons[] = 'folder';
         }
         self::$files[] = array($name, $userInfo->USERNAME . ' ' . $userInfo->USERLATNAME, $infoFile['size'], $infoFile['timestamp']);
     }
 }
Beispiel #16
0
 /**
  * @param DATABASE $db Database from which to load values.
  */
 public function load($db)
 {
     $this->_exists = true;
     $this->kind = $db->f('kind');
     $this->folder_id = $db->f('folder_id');
     $this->ref_id = $db->f('ref_id');
     $this->importance = $db->f('importance');
     $this->privileges->load($db);
 }
 /**
  * @param DATABASE $db Database from which to load values.
  */
 public function load($db)
 {
     $this->_exists = true;
     $this->user_id = $db->f('user_id');
     $this->global_privileges->load($db);
     $this->allow_privileges->load($db, 'allow_');
     $this->deny_privileges->load($db, 'deny_');
 }
Beispiel #18
0
 private function FindPageInDB()
 {
     //echo $this->LANG.' '.$this->MODULE.' '.$this->ID;
     $getPage = parent::select('modules', '`moduleDirectory`', "`moduleTitle`='{$this->MODULE}'", '');
     if (count($getPage) == 0) {
         header("HTTP/1.0 404 Not Found");
         require_once dirname(__FILE__) . '/../../common/views/404.php';
         exit;
     }
 }
Beispiel #19
0
 /**
  * accepts a finalised sql statement and prepares SQL for DATABASE
  * 
  * @param string $sql
  * @param boolean $void set whether or not the statement is
  * an insert, update, delete or typical select statement,
  * i.e. select * from dual
  * 
  * @return the class object
  */
 public function __compiled_str($sql, $void = false)
 {
     $this->__setIsVoid();
     if (is_bool($void)) {
         if (!$void) {
             if (DATABASE::startswith(strtoupper($sql), "SELECT")) {
                 $this->__setIsSelect();
             }
             if (DATABASE::startswith(strtoupper($sql), "UPDATE")) {
                 $this->__setIsUpdate();
             }
             if (DATABASE::startswith(strtoupper($sql), "DELETE")) {
                 $this->__setIsDelete();
             }
             if (DATABASE::startswith(strtoupper($sql), "INSERT")) {
                 $this->__setIsInsert();
             }
         }
     } elseif (is_int($void)) {
         if ($void === DATABASE::ALL) {
             $this->__setIsSelect();
         }
         if ($void === DATABASE::UPD) {
             $this->__setIsUpdate();
         }
         if ($void === DATABASE::DEL) {
             $this->__setIsDelete();
         }
         if ($void === DATABASE::INS) {
             $this->__setIsInsert();
         }
     }
     $this->__statement__ = $sql;
     $this->__fix_where();
     return $this;
 }
Beispiel #20
0
<?php

require "c:/xampp/security/pixelp/_connector.php";
require "include/init.php";
require "classes/db.php";
require "classes/pixelp.php";
$db = new DATABASE();
$db->connect(DB_HOST, DB_NAME, DB_USER, DB_PASS, DB_CHARSET, DB_COLLATION);
$import = new PIXELP_IMPORT($db);
//$import->add_queue();
$import->process_queue();
Beispiel #21
0
 /**
  * @param DATABASE $db
  */
 public function load($db)
 {
     $this->options_id = $db->f('options_id');
     $this->trunk_id = $db->f('trunk_id');
     parent::load($db);
 }
Beispiel #22
0
    // show_login_page($t, $o);
}
$ad = new LDAP();
// AD objekt
$ad->debug = $w->debug;
if (!$ad->connect()) {
    $t->errors[ERROR][] = 'L002 ' . $l->txt_err_ldap_connect;
}
if (!$ad->bind($p->uname, $p->secret)) {
    // create a syslog entry
    syslog(LOG_NOTICE, sprintf("AD bind failed. user: %s remote_addr: %s method: %s token: %s", $p->uname, $w->remote_addr, $auth_method, $o->token));
    // AD bind failis. Nüüd proovime lokaalse kasutajaga.
    require INC_DIR . '/local.php';
    if ($w->allow_local) {
        if (!isset($d)) {
            $d = new DATABASE();
            // lokaalsed kasutajad paiknevad DB's. Siiani pole DB'd vaja läinud.
            $d->debug = $w->debug;
            if (!$d->connect(DB_HOST, DB_USER, DB_PASS, DATABASE)) {
                $t->errors[ERROR][] = 'C001.1 ' . $l->txt_err_open_database;
            }
        }
        //        print_r($d);
        if (local_login($d, $p->uname, $p->secret, $u)) {
            $auth_method = 'local';
            $authok = true;
        } else {
            // create a syslog entry
            syslog(LOG_NOTICE, sprintf("User not found. user: %s remote_addr: %s method: %s token: %s", $p->uname, $w->remote_addr, $auth_method, $o->token));
            $t->errors[ERROR][] = 'L003 ' . $l->txt_err_authentication;
        }
Beispiel #23
0
<h3>Screenings</h3>

<?php 
require_once "classes/Database.php";
require_once "classes/Screening.php";
require_once "classes/ScreeningFetcher.php";
require_once "classes/Cinema.php";
require_once "classes/Movie.php";
require_once "includes/ticketForm.php";
$db = DATABASE::getInstance();
$fetcher = new ScreeningFetcher($db);
$fetcher->getAllScreeningsFromDb();
$screeningsArray = $fetcher->getArrayWithScreenings();
if (!empty($screeningsArray)) {
    echo "<ul>";
    foreach ($screeningsArray as $screening) {
        $movieName = $screening->getMovie()->getName();
        $movieId = $screening->getMovie()->getId();
        $cinemaName = $screening->getCinema()->getName();
        $cinemaId = $screening->getCinema()->getId();
        $screeningId = $screening->getId();
        $date = $screening->getDate();
        $dateFormatted = substr($date, 0, 16);
        echo "<li><a href='showInfo.php?type=movie&id={$movieId}'>{$movieName}</a>, <a href='showInfo.php?type=cinema&id={$cinemaId}'>{$cinemaName}</a>, Date & Time: {$dateFormatted}";
        renderTicketForm($screeningId);
        echo "</li>";
    }
    echo "</ul>";
} else {
    echo "No screenings";
}
Beispiel #24
0
<?php

/**
 * Koodi include auth protsessiloogika arusaadavuse tagamiseks.
 * Vajab $u objekti. Loob lokaalseks arvepidamiseks uued olemid.
 *
 * @author: walker
 */
if (!isset($d)) {
    $d = new DATABASE();
    $d->debug = $w->debug;
    if (!$d->connect(DB_HOST, DB_USER, DB_PASS, DATABASE)) {
        $t->errors[ERROR][] = 'C001 ' . $l->txt_err_open_database;
        show_error_page($t, $o);
        // todo - erinevad tekstid
    }
}
$s = new SESSION($d);
$s->debug = $w->debug;
$s->d = $d;
// Kas selline ettevõte eksisteerib juba lokaalses andmebaasis?
if (!$s->get_organization_id($u->company)) {
    $c->name = $u->company;
    $c->country_id = '1';
    // TODO
    if (!$s->create_organization($c)) {
        $t->errors[ERROR][] = 'L005 ' . $l->txt_err_user_update;
        show_login_page($t, $o);
    }
    unset($c);
}
 /**
  * @param DATABASE $db Database from which to load values.
  */
 public function load($db)
 {
     $this->id = $db->f('id');
 }
Beispiel #26
0
					}
					?>
						<div>
						Delete frame "<?=$frame['name']?>"?
						</div>
						<div class="formbuttons">
							<button type="button" onClick="deleteframe(true)">Delete</button>
							<button type="button" onClick="clearform()">Cancel</button>
						</div>
					<?


				break;

				case "editform":
					$frame = DATABASE::record("sprite_frame","sprite_frame_id",$_GET['id']);
				?>
					<form id="frameform">
						<input type="hidden" name="action" value="edititem">
						<input type="hidden" name="sprite_id" value="<?=$frame['sprite_id']?>">
						<input type="hidden" name="sprite_frame_id" value="<?=$_GET['id']?>">
						<div style="clear:both;padding-top:10px;text-align:right;">	Name:<input type="text" name="name" style="width:175px;" value="<?=$frame['name']?>">
																					X:<input type="text" name="x" style="width:35px;" value="<?=$frame['x']?>">
																					Y:<input type="text" name="y" style="width:35px;" value="<?=$frame['y']?>">
																					W:<input type="text" name="w" style="width:35px;" value="<?=$frame['w']?>">
																					H:<input type="text" name="h" style="width:35px;" value="<?=$frame['h']?>">
																					MipMap:<input type="text" name="m" style="width:35px;" value="<?=$frame['mip']?>">
						</div>
						<div style="text-align:center;padding: 10px;">
							<canvas id="plottingcanvas" style="background-color:#000; margin-top:10px;" width="300" height="300"></canvas>
							<canvas id="previewcanvas" style="background-color:#000; margin:10px;" width="150" height="150"></canvas>
Beispiel #27
0
function DoCache(&$req)
{
    global $user_req;
    global $verbose;
    global $ROOT_DB;
    global $syslock;
    try {
        $reader = $req->CreateReader(REQUEST::READER_FORBID_CACHEREADER);
    } catch (ADEIException $e) {
        if ($e->getCode() == ADEIException::DISCONNECTED) {
            return;
        }
        $e->logInfo(translate("READER constructor is failed"), $req);
        return $req->GetLocationString() . ", Error: " . $e->getInfo();
    }
    try {
        $opts =& $req->GetOptions();
        $rootdb = $opts->Get('root_database');
        $list = $req->GetGroups($reader);
    } catch (ADEIException $e) {
        $e->logInfo(translate("Problem processing options"), $reader);
        return $req->GetLocationString() . ", Error: " . $e->getInfo();
    }
    if ($rootdb) {
        if (strchr($rootdb, "/")) {
            $db_info = false;
            $inq_app = adei_app("csv2root", "--file " . $rootdb . " --inquiry-latest-data", true);
            $app = adei_app("csv2root", "--file " . $rootdb, true);
        } else {
            try {
                $db_info = $ROOT_DB;
                $db_info['database'] = $rootdb;
                $database = new DATABASE($db_info);
            } catch (ADEIException $e) {
                unset($db_info['database']);
                try {
                    $database = new DATABASE($ROOT_DB);
                    $database->CreateDatabase($rootdb);
                } catch (ADEIException $e) {
                    $e->logInfo(translate("Problem accessing ROOT database \"%s\"", $rootdb), $req);
                    echo translate("Problem accessing ROOT database \"%s\": %s\n", $rootdb, $e->getInfo());
                    $rootdb = false;
                }
            }
            if ($rootdb) {
                $conprm = $db_info['driver'] . "://" . $db_info['host'] . ($db_info['port'] ? ":" . $db_info['port'] : "") . "/" . $rootdb;
                $inq_app = adei_app("csv2root", "--db " . $conprm . " --inquiry-latest-data", true);
                $app = adei_app("csv2root", "--db " . $conprm, true);
            }
        }
        if ($rootdb) {
            if (!$app || !$inq_app) {
                echo "csv2root is not present";
                $rootdb = false;
            } else {
                $groups = $reader->GetGroupList(REQUEST::NEED_INFO);
            }
        }
    }
    foreach ($list as $gid => $greq) {
        if (isset($user_req->props['db_group']) && $user_req->props['db_group'] != $gid) {
            continue;
        }
        if ($verbose) {
            echo "{$greq->props['db_server']} -- {$greq->props['db_name']} -- {$gid}:";
        }
        $syslocked = false;
        $prelocked = false;
        try {
            $cache = $greq->CreateCacheUpdater($reader);
            $syslock->Lock(LOCK::BLOCK);
            $syslocked = true;
            if (!$cache->PreLock()) {
                if ($verbose) {
                    echo " busy\n";
                }
                continue;
            }
            $prelocked = true;
            $syslocked = false;
            $syslock->UnLock();
            $cache->Update($ivl = NULL, CACHE::DIM_AUTO, verbose ? CACHE::VERBOSE : 0);
            $prelocked = false;
            $cache->UnLock();
            if ($rootdb) {
                $grname = " --group \"" . $groups[$gid]["name"] . "\"";
                ROOTCache($cache, $db_info, $app . $grname, $inq_app . $grname, $conprm ? $conprm : $rootdb);
            }
            unset($cache);
        } catch (ADEIException $e) {
            if ($prelocked) {
                $cache->UnLock();
            }
            if ($syslocked) {
                $syslock->UnLock();
            }
            if ($e->getCode() != ADEIException::DISABLED) {
                $e->logInfo(translate("Failed to update CACHE"), $cache ? $cache : $greq);
                if ($verbose) {
                    echo " failed\n";
                }
                return $greq->GetLocationString() . ", Error: " . $e->getInfo();
            }
        }
        if ($verbose) {
            echo " done\n";
        }
    }
    return 0;
}
Beispiel #28
0
 public function add_survey($post)
 {
     extract($post);
     isset($choice_1) ? $choice_1 = $choice_1 : ($choice_1 = '');
     isset($choice_2) ? $choice_2 = $choice_2 : ($choice_2 = '');
     isset($choice_3) ? $choice_3 = $choice_3 : ($choice_3 = '');
     isset($choice_4) ? $choice_4 = $choice_4 : ($choice_4 = '');
     isset($choice_5) ? $choice_5 = $choice_5 : ($choice_5 = '');
     $insert = DATABASE::DB()->prepare("INSERT INTO surveys (id_user, name, description, choice_1, choice_2, choice_3, choice_4, choice_5) VALUES (:id_user, :name, :description, :choice_1, :choice_2, :choice_3, :choice_4, :choice_5)");
     $insert->bindvalue(':id_user', $_SESSION['id'], PDO::PARAM_INT);
     $insert->bindvalue(':name', $name, PDO::PARAM_STR);
     $insert->bindvalue(':description', $description, PDO::PARAM_STR);
     $insert->bindvalue(':choice_1', $choice_1, PDO::PARAM_STR);
     $insert->bindvalue(':choice_2', $choice_2, PDO::PARAM_STR);
     $insert->bindvalue(':choice_3', $choice_3, PDO::PARAM_STR);
     $insert->bindvalue(':choice_4', $choice_4, PDO::PARAM_STR);
     $insert->bindvalue(':choice_5', $choice_5, PDO::PARAM_STR);
     $insert->execute();
 }
Beispiel #29
0
 public static function INIT($host, $driver, $user, $pass, $name)
 {
     if (class_exists('PDO') === false) {
         $error = "This server does not support PDO.";
         throw new Exception($error);
         return false;
     }
     if (!in_array($driver, self::DRIVERS())) {
         $error = "Database driver '" . $driver . "' not supported on this server.";
         throw new Exception($error);
         return false;
     }
     try {
         self::$PDO = new PDO($driver . ':host=' . $host . ';dbname=' . $name, $user, $pass);
         self::$PDO->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
         self::$FETCHMODE = PDO::FETCH_ASSOC;
     } catch (PDOException $e) {
         $error = "Unable to connect to " . $driver . ":host=" . $host . ";dbname=" . $name . "\n";
         $error .= 'ERROR: ' . $e->getMessage();
         throw new Exception($e);
         return false;
     }
     return true;
 }
Beispiel #30
0
/**
 * Devuelve los datos del usuario dado, ignorando su hash de contraseña.
 * Si el usuario no existe se devuelve false.
 * @param type $usuario
 * @return boolean
 */
function getUsuario($usuario)
{
    if (!existeUsuario($usuario)) {
        return false;
    }
    $db = DATABASE::getInstance();
    $result = $db->select("usuarios", "usuario, tipo", "usuario='{$usuario}'");
    return $result[0];
}