当前位置: 首页>>代码示例>>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;未经允许,请勿转载。