/** * Get the package version ID * @param string|int $package Package name or packageId from database * @param string $version * @return int */ public static function getId($package, $version) { if (!is_numeric($package)) { $packageId = \Package::getId($package); } else { $packageId = (int) $package; } $r = static::fetchOne(array('package_id' => $packageId, 'value' => $version)); if ($r === false) { $r = static::create(array('package_id' => $packageId, 'value' => $version)); } return $r->id; }
<?php /** * This file is part of the Watson package. * * @author (c) Thomas Blum <*****@*****.**> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ /** * Uninstall package * */ if (!class_exists('\\Package\\Package')) { require __DIR__ . '/lib/Package/Package.php'; } \Package\Package::uninstall();
<?php /** * This file is part of the Watson package. * * @author (c) Thomas Blum <*****@*****.**> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ /** * Install Apllication * Check AddOns and Versions * */ if (!class_exists('\\Package\\Package')) { require __DIR__ . '/lib/Package/Package.php'; } \Package\Package::install();
<?php require '../vendor/SlimFramework/Slim/Slim.php'; \Slim\Slim::registerAutoloader(); require_once '../package/Package.php'; \Package\Package::registerAutoloader(); $app = new \Slim\Slim(array('debug' => true, 'templates.path' => '../application/view/')); require_once '../application/controller/index.php'; require_once '../application/controller/error.php'; $app->hook('slim.before.router', function () use($app) { $uri = substr(preg_replace('/(\\/+)/', '/', $app->request->getResourceUri()), 1); $pieces = explode('/', $uri); $basePath = $path = realpath('../application/controller') . '/'; foreach ($pieces as $value) { $value = trim($value); if ($value !== '' && file_exists($path . $value) && is_dir($path . $value)) { $path = $path . $value . '/'; if (file_exists($path . 'index.php') && is_file($path . 'index.php') && strpos(realpath($path . 'index.php'), $basePath) === 0) { require_once realpath($path . 'index.php'); } } else { break; } } if (file_exists($path . $value . '.php') && is_file($path . $value . '.php') && strpos(realpath($path . $value . '.php'), $basePath) === 0) { require_once realpath($path . $value . '.php'); } }); $filesList = scandir('../config'); foreach ($filesList as $fileName) { if (substr($fileName, -11) == '.config.php') {
<?php /** * * @author blumbeet - web.studio * @author Thomas Blum * @author mail[at]blumbeet[dot]com Thomas Blum * */ use Package\Package; Package::requirePage();