Skip to content

Commit

Permalink
zeugs
Browse files Browse the repository at this point in the history
  • Loading branch information
pewegrzy committed Nov 20, 2013
1 parent 747e696 commit 12b5af1
Show file tree
Hide file tree
Showing 61 changed files with 13,222 additions and 4 deletions.
10 changes: 6 additions & 4 deletions config.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
* To change this template use File | Settings | File Templates.
*/

$user = "root";
$password = "";
$db = "financedb";
$path = "localhost";
class config {
public static $dbuser = "root";
public static $dbpass = "";
public static $dbname = "financedb";
public static $dbhost = "localhost";
}
28 changes: 28 additions & 0 deletions dbConnect.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
/**
* Created by JetBrains PhpStorm.
* User: Peter Wegrzynek
* Date: 20.11.13
* Time: 14:53
* To change this template use File | Settings | File Templates.
*/

require_once('config.php');

class dbConnect {

public static function getConnection() {
$dbhost=config::$dbhost;
$dbuser=config::$dbuser;
$dbpass=config::$dbpass;
$dbname=config::$dbname;
try{
$dbh = new PDO("mysql:host=$dbhost;dbname=$dbname", $dbuser, $dbpass);
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$dbh->exec("set names utf8");
return $dbh;
} catch(PDOException $e) {
echo '{"error":{"text":'. $e->getMessage() .'}}';
}
}
}
14 changes: 14 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
/**
* Created by JetBrains PhpStorm.
* User: Peter Wegrzynek
* Date: 20.11.13
* Time: 15:05
* To change this template use File | Settings | File Templates.
*/

require 'vendor/autoload.php';

class index {

}
7 changes: 7 additions & 0 deletions vendor/autoload.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

// autoload.php @generated by Composer

require_once __DIR__ . '/composer' . '/autoload_real.php';

return ComposerAutoloaderInitc767b3e91220762d179d714c74caa39d::getLoader();
246 changes: 246 additions & 0 deletions vendor/composer/ClassLoader.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,246 @@
<?php

/*
* This file is part of Composer.
*
* (c) Nils Adermann <[email protected]>
* Jordi Boggiano <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Composer\Autoload;

/**
* ClassLoader implements a PSR-0 class loader
*
* See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md
*
* $loader = new \Composer\Autoload\ClassLoader();
*
* // register classes with namespaces
* $loader->add('Symfony\Component', __DIR__.'/component');
* $loader->add('Symfony', __DIR__.'/framework');
*
* // activate the autoloader
* $loader->register();
*
* // to enable searching the include path (eg. for PEAR packages)
* $loader->setUseIncludePath(true);
*
* In this example, if you try to use a class in the Symfony\Component
* namespace or one of its children (Symfony\Component\Console for instance),
* the autoloader will first look for the class under the component/
* directory, and it will then fallback to the framework/ directory if not
* found before giving up.
*
* This class is loosely based on the Symfony UniversalClassLoader.
*
* @author Fabien Potencier <[email protected]>
* @author Jordi Boggiano <[email protected]>
*/
class ClassLoader
{
private $prefixes = array();
private $fallbackDirs = array();
private $useIncludePath = false;
private $classMap = array();

public function getPrefixes()
{
return call_user_func_array('array_merge', $this->prefixes);
}

public function getFallbackDirs()
{
return $this->fallbackDirs;
}

public function getClassMap()
{
return $this->classMap;
}

/**
* @param array $classMap Class to filename map
*/
public function addClassMap(array $classMap)
{
if ($this->classMap) {
$this->classMap = array_merge($this->classMap, $classMap);
} else {
$this->classMap = $classMap;
}
}

/**
* Registers a set of classes, merging with any others previously set.
*
* @param string $prefix The classes prefix
* @param array|string $paths The location(s) of the classes
* @param bool $prepend Prepend the location(s)
*/
public function add($prefix, $paths, $prepend = false)
{
if (!$prefix) {
if ($prepend) {
$this->fallbackDirs = array_merge(
(array) $paths,
$this->fallbackDirs
);
} else {
$this->fallbackDirs = array_merge(
$this->fallbackDirs,
(array) $paths
);
}

return;
}

$first = $prefix[0];
if (!isset($this->prefixes[$first][$prefix])) {
$this->prefixes[$first][$prefix] = (array) $paths;

return;
}
if ($prepend) {
$this->prefixes[$first][$prefix] = array_merge(
(array) $paths,
$this->prefixes[$first][$prefix]
);
} else {
$this->prefixes[$first][$prefix] = array_merge(
$this->prefixes[$first][$prefix],
(array) $paths
);
}
}

/**
* Registers a set of classes, replacing any others previously set.
*
* @param string $prefix The classes prefix
* @param array|string $paths The location(s) of the classes
*/
public function set($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirs = (array) $paths;

return;
}
$this->prefixes[substr($prefix, 0, 1)][$prefix] = (array) $paths;
}

/**
* Turns on searching the include path for class files.
*
* @param bool $useIncludePath
*/
public function setUseIncludePath($useIncludePath)
{
$this->useIncludePath = $useIncludePath;
}

/**
* Can be used to check if the autoloader uses the include path to check
* for classes.
*
* @return bool
*/
public function getUseIncludePath()
{
return $this->useIncludePath;
}

/**
* Registers this instance as an autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not
*/
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
}

/**
* Unregisters this instance as an autoloader.
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
}

/**
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return bool|null True if loaded, null otherwise
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
include $file;

return true;
}
}

/**
* Finds the path to the file where the class is defined.
*
* @param string $class The name of the class
*
* @return string|false The path if found, false otherwise
*/
public function findFile($class)
{
// work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
if ('\\' == $class[0]) {
$class = substr($class, 1);
}

if (isset($this->classMap[$class])) {
return $this->classMap[$class];
}

if (false !== $pos = strrpos($class, '\\')) {
// namespaced class name
$classPath = strtr(substr($class, 0, $pos), '\\', DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
$className = substr($class, $pos + 1);
} else {
// PEAR-like class name
$classPath = null;
$className = $class;
}

$classPath .= strtr($className, '_', DIRECTORY_SEPARATOR) . '.php';

$first = $class[0];
if (isset($this->prefixes[$first])) {
foreach ($this->prefixes[$first] as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
foreach ($dirs as $dir) {
if (file_exists($dir . DIRECTORY_SEPARATOR . $classPath)) {
return $dir . DIRECTORY_SEPARATOR . $classPath;
}
}
}
}
}

foreach ($this->fallbackDirs as $dir) {
if (file_exists($dir . DIRECTORY_SEPARATOR . $classPath)) {
return $dir . DIRECTORY_SEPARATOR . $classPath;
}
}

if ($this->useIncludePath && $file = stream_resolve_include_path($classPath)) {
return $file;
}

return $this->classMap[$class] = false;
}
}
9 changes: 9 additions & 0 deletions vendor/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

// autoload_classmap.php @generated by Composer

$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);

return array(
);
10 changes: 10 additions & 0 deletions vendor/composer/autoload_namespaces.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

// autoload_namespaces.php @generated by Composer

$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);

return array(
'Slim' => array($vendorDir . '/slim/slim'),
);
43 changes: 43 additions & 0 deletions vendor/composer/autoload_real.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

// autoload_real.php @generated by Composer

class ComposerAutoloaderInitc767b3e91220762d179d714c74caa39d
{
private static $loader;

public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}

public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}

spl_autoload_register(array('ComposerAutoloaderInitc767b3e91220762d179d714c74caa39d', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInitc767b3e91220762d179d714c74caa39d', 'loadClassLoader'));

$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);

$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}

$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}

$loader->register(true);

return $loader;
}
}
Loading

0 comments on commit 12b5af1

Please sign in to comment.