當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DBManager::getInstance方法代碼示例

本文整理匯總了PHP中DBManager::getInstance方法的典型用法代碼示例。如果您正苦於以下問題:PHP DBManager::getInstance方法的具體用法?PHP DBManager::getInstance怎麽用?PHP DBManager::getInstance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DBManager的用法示例。


在下文中一共展示了DBManager::getInstance方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 public function __construct()
 {
     if (SessionManager::getInstance()->isAdmin()) {
         $aid = SessionManager::getInstance()->getAdminID();
         $admin = DBManager::getInstance()->getAdmin($aid);
         $this->isGlobalAdmin = $admin['isGlobalAdmin'];
         $this->adminGroups = DBManager::getInstance()->getAdminGroupsByAdminID($aid);
         $this->servers = DBManager::getInstance()->getAdminGroupServersByAdminId($aid);
         $this->perms = array();
         foreach ($this->adminGroups as $group) {
             foreach ($group['adminOnServers'] as $serverId) {
                 foreach ($group['perms'] as $perm => $value) {
                     if ($perm != 'serverID' && $perm != 'groupID') {
                         if (!isset($this->perms[$serverId])) {
                             $this->perms[$serverId] = array();
                         }
                         $this->perms[$serverId][$perm] = $value;
                     }
                 }
             }
         }
     } else {
         $this->isGlobalAdmin = false;
         $this->perms = DBManager::$defaultAdminGroupPerms;
         $this->servers = array();
     }
 }
開發者ID:nicolasjoly,項目名稱:MumPI,代碼行數:27,代碼來源:PermissionManager.php

示例2: renderTableGestion

 public function renderTableGestion()
 {
     $this->man = DBManager::getInstance();
     //crea instancia
     $this->man->connect();
     //conectate a la bbdd
 }
開發者ID:nemoNoboru,項目名稱:ET3,代碼行數:7,代碼來源:renderTableGestion.php

示例3: __construct

 public function __construct($plugin_file = __FILE__)
 {
     $manager = DBManager::getInstance();
     $manager->bootEloquent();
     if (method_exists($this, 'up')) {
         register_activation_hook($plugin_file, [$this, 'up']);
     }
     if (method_exists($this, 'down')) {
         register_uninstall_hook($plugin_file, [$this, 'down']);
     }
 }
開發者ID:hieu-pv,項目名稱:NFWP,代碼行數:11,代碼來源:NFDatabase.php

示例4: Cancerbero

 public function Cancerbero($Pagename)
 {
     if (!($this->man = DBManager::getInstance())) {
         die("No se puede crear un DBManager");
     } else {
         if (!$this->man->connect()) {
             die("No se puede conectar a la bd");
         }
     }
     $this->page = $Pagename;
 }
開發者ID:nemoNoboru,項目名稱:ET3,代碼行數:11,代碼來源:cancerbero.php

示例5: loginAsAdmin

 /**
  *
  * @param string $name
  * @param string $pw
  * @return void
  * @throws Exception on failed login
  */
 public function loginAsAdmin($name, $pw)
 {
     if (DBManager::getInstance()->checkAdminLogin($_POST['username'], $_POST['password'])) {
         $_SESSION['adminLoggedIn'] = true;
         $admin = DBManager::getInstance()->getAdminByName($name);
         $_SESSION['adminLoggedInAs'] = $admin['id'];
     } else {
         Logger::log("[{$_SERVER['REMOTE_ADDR']}] failed to log in as admin {$name}.", Logger::LEVEL_SECURITY);
         throw new Exception('Login failed');
     }
 }
開發者ID:nicolasjoly,項目名稱:MumPI,代碼行數:18,代碼來源:SessionManager.php

示例6: renderNavBar

function renderNavBar()
{
    //Conexion a la BD
    $db = DBManager::getInstance();
    $db->connect();
    $dbm = Driver::getInstance();
    $navBar = new TemplateEngine();
    //---x---x--- Por defecto ---x---x---
    $navBar->log = 0;
    //el usuario NO está logeado
    $navBar->admin = 0;
    //por lo tanto no puede ser administrador
    $navBar->materia = 0;
    //ni administrador de materia
    $navBar->user_id = null;
    //y no hay ID de usuario
    //Se ha hecho login?
    if (isset($_SESSION["name"])) {
        //---x---x--- Si se ha hecho... ---x---x---
        $navBar->log = 1;
        //el usuario está logeado
        $usuario = new Usuario($dbm);
        $usuario = $usuario->findBy('user_name', $_SESSION['name']);
        //CAMBIAME
        $navBar->user_id = $usuario[0]->getUser_id();
        //El usuario es un administrador?
        if ($db->existUserRol($_SESSION["name"], "AdminApuntorium")) {
            $navBar->admin = 1;
            //el usuario es administrador
        } else {
            //El usuario es administrador de materia?
            $administra = new Administra($dbm);
            if ($administra->findBy('user_id', $usuario[0]->getUser_id()) != null) {
                $navBar->materia = 1;
                //el usuario administra una materia
            }
        }
    } else {
    }
    return $navBar->render('navbar_v.php');
}
開發者ID:MOGP95,項目名稱:ET3,代碼行數:41,代碼來源:navbar.php

示例7: getView

<?php

require "DBManager.inc";
require "viewer.inc";
getView("HeaderView.inc", null);
$host = "mysql.hostinger.com.ua";
$dbName = "u825515718_bbrat";
$user = "u825515718_bbrat";
$password = "B1gBenMafia";
DBManager::getInstance()->connect($host, $dbName, $user, $password);
echo "<html><body><div id='feed' style='margin-left: 300px;'><div style='text-align:left'>";
$res = SQL("Select  Name from Players order by Name DESC")->getAll();
foreach ($res as $player) {
    echo "<p>" . $player['Name'] . "</p>";
}
echo "</div></div></body></html>";
開發者ID:MayRiv,項目名稱:BigBenOpen,代碼行數:16,代碼來源:showplayers.php

示例8: get

 /**
  * Shortcut static method to retrieve the database connection for a given
  * key.
  *
  * Example usage:
  * @code
  * // instead of
  * $db = DBManager::getInstance()->getConnection("studip");
  *
  * // this can be shortened to
  * $db = DBManager::get("studip");
  *
  * // or in this case (as "studip" is the default key)
  * $db = DBManager::get();
  * @endcode
  *
  * @param  string  the key
  *
  * @return StudipPDO     the database connection
  */
 public static function get($database = 'studip')
 {
     $manager = DBManager::getInstance();
     return $manager->getConnection($database);
 }
開發者ID:ratbird,項目名稱:hope,代碼行數:25,代碼來源:DBManager.class.php

示例9: session_start

<?php

// Controlador de login hecho por FVieira.
session_start();
// se inicia el manejo de sesiones
require_once '../views/templateEngine.php';
// se carga la clase TemplateEngine
require_once '../cancerbero/php/DBManager.php';
// se carga el driver de cancerbero
require_once 'modal.php';
$db = DBManager::getInstance();
$db->connect();
$renderMain = new TemplateEngine();
$renderlogin = new TemplateEngine();
//instancias de TemplateEngine
$renderlogin->status = null;
//por defecto no hay ningun error (en la plantilla login_v la variable $status valdrá <br/>)
if (isset($_POST['name']) && isset($_POST['pass'])) {
    // si ya se hizo algun post
    if ($db->tryLogin($_POST['name'], $_POST['pass'])) {
        //comprueba los datos nombre de Usuario y contrseña
        $_SESSION["name"] = $_POST['name'];
        header("location: home.php");
    }
    $status = "Usuario y/o contraseña invalido";
    $contenido = "Por favor, compruebe sus datos de acceso y compruebe si no tiene la tecla bloq mayus activada";
    $renderlogin->status = renderModalError($status, $contenido);
}
$renderMain->title = "Login";
$renderMain->navbar = null;
//el login no tiene navbar
開發者ID:MOGP95,項目名稱:ET3,代碼行數:31,代碼來源:login.php

示例10: log_registration

 public static function log_registration($uname)
 {
     DBManager::getInstance()->append('log_register.log', time() . ';' . $_SERVER['REMOTE_ADDR'] . ';' . $_SERVER['HTTP_REFERER'] . ';uname:' . $uname);
 }
開發者ID:nicolasjoly,項目名稱:MumPI,代碼行數:4,代碼來源:Logger.php

示例11: renderComboboxUsuario

 public function renderComboboxUsuario()
 {
     $this->man = DBManager::getInstance();
     $this->man->connect();
 }
開發者ID:naraah,項目名稱:iu-esei-proyecto,代碼行數:5,代碼來源:renderCombobox.php

示例12: session_id

///////////////////////////////////////////////////////////////////////////////
////	SETTING DEFAULT VAR VALUES
// Track the number of SQL queiries
$sql_queries = 0;
$GLOBALS['log'] = LoggerManager::getLogger('SugarCRM');
$error_notice = '';
$use_current_user_login = false;
// Allow for the session information to be passed via the URL for printing.
if (isset($_GET['PHPSESSID'])) {
    if (!empty($_COOKIE['PHPSESSID']) && strcmp($_GET['PHPSESSID'], $_COOKIE['PHPSESSID']) == 0) {
        session_id($_REQUEST['PHPSESSID']);
    } else {
        unset($_GET['PHPSESSID']);
    }
}
if (!empty($sugar_config['session_dir'])) {
    session_save_path($sugar_config['session_dir']);
}
$db =& DBManager::getInstance();
$dbmann = DBManager::getInstance();
$timedate = new TimeDate();
$locale = new Localization();
// Emails uses the REQUEST_URI later to construct dynamic URLs.
// IIS does not pass this field to prevent an error, if it is not set, we will assign it to ''.
if (!isset($_SERVER['REQUEST_URI'])) {
    $_SERVER['REQUEST_URI'] = '';
}
$current_user = new User();
$current_entity = null;
////	END SETTING DEFAULT VAR VALUES
///////////////////////////////////////////////////////////////////////////////
開發者ID:BackupTheBerlios,項目名稱:livealphaprint,代碼行數:31,代碼來源:entryPoint.php

示例13: renderNavBar

function renderNavBar()
{
    //Conexion a la BD
    $db = DBManager::getInstance();
    $db->connect();
    $dbm = Driver::getInstance();
    $navBar = new TemplateEngine();
    //---x---x--- Por defecto ---x---x---
    $navBar->log = 0;
    //el usuario NO está logeado
    $navBar->admin = 0;
    //por lo tanto no puede ser administrador
    $navBar->materia = 0;
    //ni administrador de materia
    $navBar->user_id = null;
    //y no hay ID de usuario
    //Se ha hecho login?
    if (isset($_SESSION["name"])) {
        //---x---x--- Si se ha hecho... ---x---x---
        $navBar->log = 1;
        //el usuario está logeado
        $usuario = new Usuario($dbm);
        $usuario = $usuario->findBy('user_name', $_SESSION['name']);
        //CAMBIAME
        $navBar->user_id = $usuario[0]->getUser_id();
        //El usuario es un administrador?
        if ($db->existUserRol($_SESSION["name"], "AdminApuntorium")) {
            $navBar->admin = 1;
            //el usuario es administrador
        } else {
            //El usuario es administrador de materia?
            $administra = new Administra($dbm);
            if ($administra->findBy('user_id', $usuario[0]->getUser_id()) != null) {
                $navBar->materia = 1;
                //el usuario administra una materia
            }
        }
        //Gestión de notificaciones
        $notificaciones = new Notificacion($dbm);
        $notificaciones = $notificaciones->findBy("user_id", $navBar->user_id);
        $navBar->nuevasNotificaciones = 0;
        $navBar->nuevosApuntes = 0;
        $navBar->displayNotificaciones = array();
        $displayNotificaciones = array();
        foreach ($notificaciones as $key) {
            $navBar->nuevasNotificaciones = $navBar->nuevasNotificaciones + 1;
            $tipo = preg_split("/[\\s,]+/", $key->getContenido(), null);
            if ($tipo[0] == "Nuevos") {
                $navBar->nuevosApuntes = $navBar->nuevosApuntes + 1;
            } else {
                if ($tipo[0] == "Ahora") {
                    $displayNotificaciones[$navBar->nuevasNotificaciones - $navBar->nuevosApuntes] = $key->getContenido();
                    //'</a>'REDIRECCIÓN PENDIENTE
                } else {
                    $displayNotificaciones[$navBar->nuevasNotificaciones - $navBar->nuevosApuntes] = '<a href="misNotas.php">' . $key->getContenido() . '</a>';
                }
            }
        }
        if ($navBar->nuevosApuntes > 0) {
            $displayNotificaciones[$navBar->nuevasNotificaciones - $navBar->nuevosApuntes] = '<a href="apuntesComunidad.php">' . $navBar->nuevosApuntes . ' nuevos apuntes en tus materias</a>';
        }
        $navBar->displayNotificaciones = $displayNotificaciones;
    }
    return $navBar->render('navbar_v.php');
}
開發者ID:nemoNoboru,項目名稱:ET3,代碼行數:65,代碼來源:navbar.php

示例14: catch

} else {
    if (isset($_GET['action']) && $_GET['action'] == 'dologin') {
        // parse and handle login form data
        try {
            SessionManager::getInstance()->loginAsAdmin($_POST['username'], $_POST['password']);
            $isLoggedIn = true;
            echo '<script type="text/javascript">location.replace("?page=meta")</script>';
            echo 'Login successfull.<br/>
					Go on to the <a href="?page=meta">Meta Page</a>.';
        } catch (Exception $exc) {
            echo '<div class="infobox infobox_error">Login failed.</div>';
        }
    }
    if (!$isLoggedIn) {
        // display login form
        if (!DBManager::getInstance()->doesAdminExist()) {
            echo '<div class="infobox infobox_info">';
            echo 'No admin Account exists yet.<br/>';
            echo 'To create an account, <b>just log in with your desired login-credentials</b>. The account will automatically created for you!<br/><br/>';
            echo 'If you experience problems and the account is not created for you, please check that your webserver has write permissions to the data folder.';
            echo '</div>';
        }
        ?>
<form class="mpi_login_form" action="?page=login&amp;action=dologin" method="post" onsubmit="
		if (jQuery('#mpi_login_username').attr('value').length == 0) {alert('You did not enter a username!'); return false;}
		if (jQuery('#mpi_login_password').attr('value').length == 0) {alert('You did not enter a password!'); return false;}">
	<label for="mpi_login_username">Username</label>
	<input type="text" name="username" id="mpi_login_username" />
	<label for="mpi_login_password">Password</label>
	<input type="password" name="password" id="mpi_login_password" />
	<input type="submit" value="Login" />
開發者ID:nicolasjoly,項目名稱:MumPI,代碼行數:31,代碼來源:login.template.php

示例15:

 function &getInstance($instanceName = '')
 {
     $instance = DBManager::getInstance($instanceName);
     return $instance;
 }
開發者ID:BackupTheBerlios,項目名稱:livealphaprint,代碼行數:5,代碼來源:PearDatabase.php


注:本文中的DBManager::getInstance方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。