• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP ConnectionFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中ConnectionFactory的典型用法代码示例。如果您正苦于以下问题:PHP ConnectionFactory类的具体用法?PHP ConnectionFactory怎么用?PHP ConnectionFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ConnectionFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: dispatch

 public function dispatch()
 {
     $connection = ConnectionFactory::getDataConnection();
     $bookmarks = $connection->getBookmarks();
     $template = new BookmarksTemplate($bookmarks, "Bookmarks");
     $template->showTemplate();
 }
开发者ID:johnymarek,项目名称:eboda-hd-for-all-500,代码行数:7,代码来源:ViewBookmarksPageAction.php


示例2: check

 public function check()
 {
     $this->setView('reclaim/index');
     if (Session::isLoggedIn()) {
         return Error::set('You\'re logged in!');
     }
     $this->view['valid'] = true;
     $this->view['publicKey'] = Config::get('recaptcha:publicKey');
     if (empty($_POST['recaptcha_challenge_field']) || empty($_POST['recaptcha_response_field'])) {
         return Error::set('We could not find the captcha validation fields!');
     }
     $recaptcha = Recaptcha::check($_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field']);
     if (is_string($recaptcha)) {
         return Error::set(Recaptcha::$errors[$recaptcha]);
     }
     if (empty($_POST['username']) || empty($_POST['password'])) {
         return Error::set('All forms are required.');
     }
     $reclaims = new reclaims(ConnectionFactory::get('mongo'));
     $good = $reclaims->authenticate($_POST['username'], $_POST['password']);
     if (!$good) {
         return Error::set('Invalid username/password.');
     }
     $reclaims->import($_POST['username'], $_POST['password']);
     $users = new users(ConnectionFactory::get('mongo'));
     $users->authenticate($_POST['username'], $_POST['password']);
     header('Location: ' . Url::format('/'));
 }
开发者ID:Zandemmer,项目名称:HackThisSite-Old,代码行数:28,代码来源:reclaim.php


示例3: handler

 public static function handler($data = null)
 {
     if (isset($_SESSION['done_autoauth'])) {
         return;
     }
     if (empty($_SERVER['SSL_CLIENT_RAW_CERT'])) {
         return self::done();
     }
     if (Session::isLoggedIn()) {
         return self::done();
     }
     $certs = new certs(ConnectionFactory::get('mongo'), ConnectionFactory::get('redis'));
     $userId = $certs->check($_SERVER['SSL_CLIENT_RAW_CERT']);
     if ($userId == NULL) {
         return self::done();
     }
     $users = new users(ConnectionFactory::get('mongo'));
     $user = $users->get($userId, false);
     if (empty($user)) {
         return;
     }
     if (!in_array('autoauth', $user['auths'])) {
         return self::done();
     }
     if ($user['status'] == users::ACCT_LOCKED) {
         return self::done();
     }
     Session::setBatchVars($user);
     return self::done();
 }
开发者ID:Zandemmer,项目名称:HackThisSite-Old,代码行数:30,代码来源:autoauth.php


示例4: getModel

 private static function getModel()
 {
     if (empty(self::$missions)) {
         self::$missions = new missions(ConnectionFactory::get('mongo'));
     }
     return self::$missions;
 }
开发者ID:Zandemmer,项目名称:HackThisSite-Old,代码行数:7,代码来源:mission.php


示例5: basic

 public function basic($arguments)
 {
     $missions = new missions(ConnectionFactory::get('mongo'));
     if (!empty($arguments[0])) {
         // A specific mission has been requested.
         $mission = $missions->get('basic', intval($arguments[0]));
         if (empty($mission)) {
             return Error::set('Mission does not exist.');
         }
         $this->view['valid'] = true;
         $this->view['num'] = $arguments[0];
         $this->view['basic'] = new BasicMissions();
         $this->view['name'] = $mission['name'];
         $this->view['next'] = $arguments[0] != 6;
         $good = call_user_func(array($this->view['basic'], 'validateMission' . $this->view['num']));
         if ($good !== null) {
             // BALANCED.  TERNARY.
             if (!$good) {
                 return Error::set('Wrong!');
             }
             $this->view['valid'] = false;
             $this->view['good'] = true;
         }
     } else {
         // Just show a listing of possible missions.
         $this->view['valid'] = true;
         $this->view['missions'] = $missions->getMissionsByType('basic');
         $this->setView('missions/base');
     }
 }
开发者ID:Zandemmer,项目名称:HackThisSite-Old,代码行数:30,代码来源:missions.php


示例6: index

 public function index($arguments)
 {
     $news = new news(ConnectionFactory::get('mongo'));
     $articles = new articles(ConnectionFactory::get('mongo'));
     $notices = new notices(ConnectionFactory::get('redis'));
     $irc = new irc(ConnectionFactory::get('redis'));
     $quotes = new quotes(ConnectionFactory::get('mongo'));
     $forums = new forums(ConnectionFactory::get('redis'));
     // Set all site-wide notices.
     foreach ($notices->getAll() as $notice) {
         Error::set($notice, true);
     }
     // Fetch the easy data.
     $this->view['news'] = $news->getNewPosts();
     $this->view['shortNews'] = $news->getNewPosts(true);
     $this->view['newArticles'] = $articles->getNewPosts('new', 1, 5);
     $this->view['ircOnline'] = $irc->getOnline();
     $this->view['randomQuote'] = $quotes->getRandom();
     $this->view['fPosts'] = $forums->getNew();
     // Get online users.
     $apc = new APCIterator('user', '/' . Cache::PREFIX . 'user_.*/');
     $this->view['onlineUsers'] = array();
     while ($apc->valid()) {
         $current = $apc->current();
         array_push($this->view['onlineUsers'], substr($current['key'], strlen(Cache::PREFIX) + 5));
         $apc->next();
     }
     // Set title.
     Layout::set('title', 'Home');
 }
开发者ID:Zandemmer,项目名称:HackThisSite-Old,代码行数:30,代码来源:index.php


示例7: getInstance

 public static function getInstance()
 {
     if (!self::$instance) {
         self::$instance = new ConnectionFactory();
     }
     return self::$instance;
 }
开发者ID:laiello,项目名称:imovelaqui,代码行数:7,代码来源:ConnectionFactory[hosted].class.php


示例8: parseFavouriteSites

 /**
  * Retrieve favourite sites and fill data in template.
  */
 private function parseFavouriteSites($template)
 {
     try {
         $connection = ConnectionFactory::getDataConnection();
         $favourites = $connection->getWebsiteFavourites();
         foreach ($favourites as $id => $favourite) {
             $name = $favourite->getName();
             $link = SERVER_HOST_AND_PATH . "php/scraper" . $favourite->getLink();
             switch ($favourite->getType()) {
                 case "movie":
                     $template->setFavouriteMovieWebsite(array($name, $link));
                     break;
                 case "serie":
                     $template->setFavouriteSerieWebsite(array($name, $link));
                     break;
                 case "documentary":
                     $template->setFavouriteDocumentaryWebsite(array($name, $link));
                     break;
                 case "anime":
                     $template->setFavouriteAnimeWebsite(array($name, $link));
                     break;
             }
         }
     } catch (Exception $e) {
         //Ignored exception
     }
 }
开发者ID:johnymarek,项目名称:eboda-hd-for-all-500,代码行数:30,代码来源:ViewHomePageAction.php


示例9: createConnection

 /**
  * Searches for the configuration for the connection and creates it. If the configuration is not found then it will
  * return NULL
  *
  * @param string $name
  * @return null|\PDO
  */
 protected function createConnection($name)
 {
     if (!isset($this->config[$name]['pdo'])) {
         return null;
     }
     return ConnectionFactory::factory($this->config[$name]['pdo']);
 }
开发者ID:brian978,项目名称:Acamar-SkeletonApplication,代码行数:14,代码来源:ConnectionRegistry.php


示例10: transactionIdExists

 public static function transactionIdExists($transaction_id)
 {
     $conditions = array();
     $conditions['transaction_id'] = $transaction_id;
     $success = ConnectionFactory::SelectValue("transaction_id", "diamond_purchased_history", $conditions);
     return $success;
 }
开发者ID:ng2k12,项目名称:MercInc,代码行数:7,代码来源:DiamondPurchasedHistory.php


示例11: getFactory

 public static function getFactory()
 {
     if (!self::$factory) {
         self::$factory = new ConnectionFactory();
     }
     return self::$factory;
 }
开发者ID:rbudhu,项目名称:SPD,代码行数:7,代码来源:ConnectionFactory.php


示例12: queryAllSelect

 public function queryAllSelect()
 {
     $sql = "SELECT id_area, nome FROM {$this->table}";
     $stmt = ConnectionFactory::prepare($sql);
     $stmt->execute();
     return $stmt->fetchAll();
 }
开发者ID:alexdiasgonsales,项目名称:organizador,代码行数:7,代码来源:AreaMySqlDAO.class.php


示例13: getInstance

 /**
  * Retorna um objeto da classe ConnectionFactory
  * @return ConnectionFactory object
  */
 public static function getInstance()
 {
     if (!isset(self::$instance)) {
         $c = __CLASS__;
         self::$instance = new $c();
     }
     return self::$instance;
 }
开发者ID:AlexandreSantos,项目名称:design-patterns,代码行数:12,代码来源:ConnectionFactory.class.php


示例14: update

 /**
  * atualiza um registro da tabela
  *
  * @parametro TematicaMySql tematica
  */
 public function update(Log $log)
 {
     $sql = "UPDATE {$this->table} SET tabela = :tabela, acao = :acao, descricao=:descricao WHERE id_log = :id";
     $id = $log->getIdLog();
     $stmt = ConnectionFactory::prepare($sql);
     $stmt->bindParam(':id_log', $id);
     return $stmt->execute();
 }
开发者ID:alexdiasgonsales,项目名称:organizador,代码行数:13,代码来源:LogMysqlDAO.class.php


示例15: queryAllAreaAvaliador

 public function queryAllAreaAvaliador($id)
 {
     $sql = "SELECT aa.fk_area as area FROM area a JOIN avaliador_area aa ON a.id_area = aa.fk_area AND fk_avaliador = :id";
     $stmt = ConnectionFactory::prepare($sql);
     $stmt->bindParam(':id', $id, PDO::PARAM_INT);
     $stmt->execute();
     return $stmt->fetch();
 }
开发者ID:alexdiasgonsales,项目名称:organizador,代码行数:8,代码来源:AvaliadorAreaMySqlDAO.class.php


示例16: getJsonResponse

 public function getJsonResponse($cidade, $bairro, $rua)
 {
     $this->connection = ConnectionFactory::getInstance()->createConnection(false);
     $locEspecificaBI = new LocEspecificaBI($this->connection);
     $jsonResponse = $locEspecificaBI->getJsonResponse($cidade, $bairro, $rua);
     $locEspecificaBI->releaseConnection($this->connection);
     return $jsonResponse;
 }
开发者ID:laiello,项目名称:imovelaqui,代码行数:8,代码来源:LocEspecificaController.class.php


示例17: getJsonResponse

 public function getJsonResponse($lat, $long, $distance)
 {
     $this->connection = ConnectionFactory::getInstance()->createConnection(false);
     $posicaoAtualBI = new PosicaoAtualBI($this->connection);
     $jsonResponse = $posicaoAtualBI->createJSONResponse($lat, $long, $distance);
     $posicaoAtualBI->releaseConnection($this->connection);
     return $jsonResponse;
 }
开发者ID:laiello,项目名称:imovelaqui,代码行数:8,代码来源:PosicaoAtualController.class.php


示例18: update

 /**
  * atualiza um registro da tabela
  *
  * @parametro UsuarioPermissaoMySql usuarioPermissao
  */
 public function update(UsuarioPermissao $UsuarioPermissao)
 {
     $sql = "UPDATE {$this->table} SET  WHERE fk_usuario = :id";
     $id = $UsuarioPermissao->getFkUsuario();
     $stmt = ConnectionFactory::prepare($sql);
     $stmt->bindParam(':id', $id);
     return $stmt->execute();
 }
开发者ID:alexdiasgonsales,项目名称:organizador,代码行数:13,代码来源:UsuarioPermissaoMySqlDAO.class.php


示例19: listTasks

 public static function listTasks()
 {
     $db = ConnectionFactory::getDB();
     $tasks = array();
     foreach ($db->tasks() as $task) {
         //vai para o banco de dados dentro da tabela tasks
         $tasks[] = array('id' => $task['id'], 'description' => $task['description'], 'done' => $task['done']);
     }
 }
开发者ID:EltonCustodio,项目名称:php-todolist,代码行数:9,代码来源:TaskService.php


示例20: delete

 public static function delete($id)
 {
     $db = ConnectionFactory::getDB();
     $task = $db->tasks[$id];
     if ($task) {
         $task->delete();
         return true;
     }
     return false;
 }
开发者ID:ricardo-faria,项目名称:php-todolist,代码行数:10,代码来源:TaskService.php



注:本文中的ConnectionFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ConnectionHandler类代码示例发布时间:2022-05-23
下一篇:
PHP Connection类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap