Ejemplo n.º 1
0
<?php

header("Content-Type: text/html; charset=utf-8");
header("Cache-Control: no-cache, must-revalidate");
ini_set("session.gc_maxlifetime", 120 * 60 * 60);
session_set_cookie_params(120 * 60 * 60, '/');
session_start();
include_once 'admin/defines/globals.php';
include_once 'admin/functions.php';
$TRANS = array();
$lang = isset($_GET['lang']) ? $_GET['lang'] : '';
$DB = new Db_MySQL();
$DB->connect(DB_HOST, DB_USER, DB_PASS);
$DB->selectDb(DB_NAME);
$_S = new Session();
if (defined('SESSION_PREFIX')) {
    $_S->prefix = SESSION_PREFIX;
}
$TPL = new TemplateParser();
$TPL->tplsPath = TEMPLATES_PATH;
$TPL->tplsExt = TEMPLATES_EXT;
$TPL->tplsMain = TEMPLATES_CONTAINER_FILE;
/**
 * Initializing the log object.
 * Usage: $LOG->write($contentToWrite, 'filename');
 * The "filename.LOGS_EXT" will be created/updated in LOGS_PATH
 */
$LOG = new Log();
/**
 * Global variable $TIMER used for keeping the execution time calculated by Utils::startTimer() and Utils::endTimer() functions.
 * Usage:
Ejemplo n.º 2
0
 /**
  * Check if record exists in the database.
  *
  * Used for checking if a value already exists in the database.
  * Ex.: username, Partner ID
  *
  * @param mixed $values Column value
  * @param mixed $type Table column name
  * @param string $condition
  * @return boolean TRUE on success and FALSE on failure
  */
 public static function checkExists($values, $type = 'username', $condition = 'AND')
 {
     if (is_array($values) && is_string($type) && $condition == 'OR') {
         $sqlAdd = $type . '=';
         $sqlAdd .= implode(' ' . $condition . ' ' . $type . '=', array_map(array('Db_MySQL', 'filterStaticData'), $values));
     } else {
         if (is_array($values) && is_array($type)) {
             if (count($values) == count($type)) {
                 $sqlAddArray = array();
                 foreach ($values as $key => $value) {
                     $sqlAddArray[] = $type[$key] . '=' . Db_MySQL::filterStaticData($value);
                 }
                 $sqlAdd = implode(' ' . $condition . ' ', $sqlAddArray);
             } else {
                 return false;
             }
         } else {
             $sqlAdd = $type . '=' . Db_MySQL::filterStaticData($values);
         }
     }
     $sql = "SELECT ?f FROM ?f WHERE {$sqlAdd}";
     self::getDB()->query($sql, static::$idField, static::$table_name);
     return self::getDB()->numRows() > 0 ? true : false;
 }
Ejemplo n.º 3
0
function myErrorHandler($errno, $errstr, $errfile, $errline) {
//    $ErrorDB = new Db_OnImportErrors();
    $ErrorDB = new Db_MySQL();
    $ErrorDB->connect(DB_HOST, DB_USER, DB_PASS);
    $ErrorDB->selectDb(DB_NAME);
    $errdate = date('Y-m-d H:i:s');

    $dataArray = array(
        'errno'=>$errno ,
        'errstr' => $errstr ,
        'errfile'=>$errfile,
        'errline' => $errline,
        'errdate' => $errdate
    );
    $ErrorDB->insert(TAB_ERRORS,$dataArray);

}