当前位置: 首页>>代码示例>>PHP>>正文


PHP ConnectionFactory类代码示例

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


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


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