コード例 #1
0
ファイル: DB.php プロジェクト: rajinha92/mini-orm
 public static function getInstance()
 {
     if (is_null(self::$conn)) {
         self::$conn = new \PDO('mysql:host=' . Config::getHost() . ';dbname=' . Config::getDatabase(), Config::getUsername(), Config::getPassword(), []);
     }
     return self::$conn;
 }
コード例 #2
0
 public function __construct(Config $config)
 {
     $paths = [$config->getModelPath()];
     $isDevMode = $config->getDevMode();
     $dbParams = ['driver' => $config->getDriver(), 'user' => $config->getUser(), 'password' => $config->getPassword(), 'dbname' => $config->getDbname()];
     $config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode);
     $this->entityManager = DoctrineEntityManager::create($dbParams, $config);
 }
コード例 #3
0
 /**
  * @param Hypercharge\IUrl $url
  * @param Hypercharge\IRequest $request
  * @return Hypercharge\IResponse
  * @throws Hypercharge\Error
  */
 public function call(IUrl $url, IRequest $request)
 {
     $curl = Config::getFactory()->createHttpsClient(Config::getUser(), Config::getPassword());
     $serializer = new XmlSerializer();
     $responseStr = $curl->xmlPost($url->get(), $serializer->toXml($request));
     $responseDom = new \SimpleXMLElement($responseStr);
     return $request->createResponse(XmlSerializer::dom2hash($responseDom));
 }
コード例 #4
0
 /**
  * @param string $user
  * @param string $passw
  * @return Hypercharge\IHttpsClient
  */
 function createHttpsClient($user = null, $passw = null)
 {
     if ($user === null) {
         $user = Config::getUser();
     }
     if ($passw === null) {
         $passw = Config::getPassword();
     }
     return new Curl($user, $passw);
 }
コード例 #5
0
 public function login()
 {
     if (!empty($_POST['username']) and !empty($_POST['password'])) {
         if ($_POST['username'] === Config::getUser() and sha1('#1_' . $_POST["password"] . '+%6') === Config::getPassword()) {
             session_start();
             (string) ($_SESSION['user'] = $_POST['username']);
             header("Location: " . Config::getInstallPath());
             exit;
         }
     }
 }
コード例 #6
0
ファイル: authform.php プロジェクト: rumi55/BH-Mobile-SMS-API
 public function __construct($userid = null, $pass = null)
 {
     if (!isset($userid) && !isset($pass)) {
         $config = new Config();
         $userid = $config->getUsername();
         $pass = $config->getPassword();
     }
     $this->baseUrl = 'http://sso.bhmobile.bhtelecom.ba/';
     // izmjena nakon što je BH Telecom izmijenio stranicu
     $this->actionUrl = '/sso/login';
     $this->fields = array(new Field('application', ''), new Field('url', 'http://www.bhmobile.bhtelecom.ba/'), new Field('realm', 'sso'), new Field('userid', $userid), new Field('password', $pass));
 }
コード例 #7
0
ファイル: Connection.php プロジェクト: kriby/test_framework
 /**
  * @return \PDO
  */
 private function connect()
 {
     $dsn = Config::getDsn();
     $username = Config::getUsername();
     $password = Config::getPassword();
     try {
         return new \PDO($dsn, $username, $password);
     } catch (\PDOException $e) {
         echo $e->getMessage();
         die;
     }
 }
コード例 #8
0
ファイル: ConfigTest.php プロジェクト: atanenl/twinfield
 /**
  * @covers Pronamic\Twinfield\Secure\Config::getPassword
  * @todo   Implement testGetPassword().
  */
 public function testGetPassword()
 {
     $this->object->setCredentials('testUsername', 'testPassword', 'testOrganisation', 1001);
     $this->assertSame($this->object->getPassword(), 'testPassword');
 }
コード例 #9
0
 /**
  * @param string $text
  * @return string
  */
 private function getAuthenticationToken($text)
 {
     return md5(md5($this->config->getPassword()) . $this->config->getLogin() . 'send' . substr($text, 0, self::AUTH_MSG_LENGTH));
 }
コード例 #10
0
 /**
  * @param array $params simply pass $_POST into
  * @return Hypercharge\TransactionNotification
  * @throws Hypercharge\Errors\ArgumentError if $params empty or merchant password not set with Config::set()
  */
 static function notification($params)
 {
     $tn = new TransactionNotification($params);
     $passw = Config::getPassword();
     if (empty($passw)) {
         throw new Errors\ArgumentError('password is not configured! See Hypercharge\\Config::set()');
     }
     $tn->verify($passw);
     return $tn;
 }
コード例 #11
0
 /**
  * @private
  * @param string $action
  * @param string $channelToken
  * @param string $unique_id
  * @return Hypercharge\Transaction
  */
 static function request($action, $channelToken, $unique_id)
 {
     $url = new TransactionUrl(Config::ENV_SANDBOX, $channelToken, $action);
     $url = $url->get() . '/' . $unique_id;
     $curl = new Curl(Config::getUser(), Config::getPassword());
     $responseStr = $curl->xmlPost($url, '');
     $responseDom = new \SimpleXMLElement($responseStr);
     // dummy
     $request = new TransactionRequest(array('transaction_type' => 'sale'));
     return $request->createResponse(XmlSerializer::dom2hash($responseDom));
 }