コード例 #1
0
ファイル: ORM.php プロジェクト: dalinhuang/51mook
 /**
  * Constructor
  * @param int | dbPrimaryKey , if not, param = false
  * @param string | dbConfig , if emptu = "default"
  */
 public function __construct($dbPrimaryKey = false, $dbConfigName = "default")
 {
     self::$db = Mysql::init($dbPrimaryKey, $dbConfigName);
     self::$db->setCharset("UTF8");
     if ($dbPrimaryKey) {
         if ($tmpRow = $this->fetchRow($dbPrimaryKey)) {
             foreach ($tmpRow as $key => $value) {
                 // $this->attributes[$key] = $value;
                 $this->{$key} = $value;
             }
         } else {
             foreach ($this->fields as $key => $value) {
                 // $this->attributes[$key] = false;
                 $this->{$key} = false;
             }
         }
     }
 }
コード例 #2
0
ファイル: Database.php プロジェクト: froq/froq-beta-archive
 /**
  * Instance creator.
  *
  * @param  string $vendor
  * @return Application\Database\Vendor\{Mysql, Couch, Mongo}
  * @throws \Exception
  */
 public static final function init(string $vendor)
 {
     if (isset(self::$instances[$vendor])) {
         return self::$instances[$vendor];
     }
     $app = app();
     $cfg = $app->config->get('db');
     if (!isset($cfg[$vendor][$app->env])) {
         throw new \Exception("`{$vendor}` options not found in config!");
     }
     switch ($vendor) {
         // only mysql for now
         case self::VENDOR_MYSQL:
             self::$instances[$vendor] = Mysql::init($cfg[$vendor][$app->env]);
             break;
         default:
             throw new \Exception('Unimplemented vendor given!');
     }
     return self::$instances[$vendor];
 }
コード例 #3
0
ファイル: Database.php プロジェクト: froq/froq-database
 /**
  * Init.
  * @param  string $vendor
  * @return Froq\Database\Vendor\VendorInterface
  */
 public static final function init(string $vendor) : VendorInterface
 {
     if (!isset(self::$instances[$vendor])) {
         $app = app();
         $appEnv = $app->env;
         $appConfig = $app->config;
         $cfg = $appConfig['db'];
         if (!isset($cfg[$vendor][$appEnv])) {
             throw new DatabaseException("'{$vendor}' options not found for '{$appEnv}' env in config!");
         }
         switch ($vendor) {
             // only mysql for now
             case self::VENDOR_MYSQL:
                 self::$instances[$vendor] = Mysql::init($cfg[$vendor][$appEnv]);
                 break;
             default:
                 throw new DatabaseException('Unimplemented vendor given!');
         }
     }
     return self::$instances[$vendor];
 }
コード例 #4
0
ファイル: functions.php プロジェクト: ionutmilica/my-archive
function set_log($message, $type)
{
    $DB = Mysql::init();
    $data = array('id' => null, 'type' => $type, 'user_id' => isset($_SESSION['user_data']['id']) ? $_SESSION['user_data']['id'] : 0, 'message' => $DB->escape($message), 'date' => date('Y-m-d H:i:s'));
    return $DB->insert(ACCOUNT_DATABASE . '.site_logs', $data);
}
コード例 #5
0
ファイル: database.php プロジェクト: ionutmilica/my-archive
<?php

$CFG->load('database');
$DB = Mysql::init($CFG->get('mysql_host'), $CFG->get('mysql_user'), $CFG->get('mysql_password'), $CFG->get('mysql_database'));
$DB->set_names();
Registry::init()->set('DB', $DB);
$CFG->unload('database');
コード例 #6
0
<?php

if (!defined('BASEPATH')) {
    exit('Nu poti accesa acest fisier direct.');
}
set_title(site_name() . ' - Parola depozit');
$DB = Mysql::init();
check_login();
$step = 'request';
if (isset($_POST['sendStoragePassword'])) {
    $data = $DB->select("id, login, email", ACCOUNT_DATABASE . ".account", "`id`='" . $_SESSION['user_data']['id'] . "'");
    if (is_array($data)) {
        $storage_pass = $DB->select('password', PLAYER_DATABASE . '.safebox', "`account_id`='" . $_SESSION['user_data']['id'] . "'");
        if ($storage_pass == '') {
            $step = 'error';
        } else {
            // trimitem email
            $arr = array('login' => $data['login'], 'password' => $storage_pass['password'], 'site_name' => site_name(), 'site_url' => site_url());
            $email_ses = email()->load('passwordlost/storagepassword');
            $email_ses->assign($arr);
            $email_ses->set('noreply@' . rtrim(site_name(), '/'), '', $data['email'], 'Metin2 - Parola Depozit');
            $email_ses->send();
            $step = 'sent';
        }
    }
}
assign('content_tpl', 'content/storagepassword/' . $step);
コード例 #7
0
ファイル: index.php プロジェクト: nikis/Go
 public function connection()
 {
     return Mysql::init();
 }