コード例 #1
0
ファイル: apidoc.php プロジェクト: dapepe/tymio
 public function __construct($locale)
 {
     include LIB_DIR . 'docbook/src/docbook.core.php';
     include LIB_DIR . 'docbook/src/docbook.html.php';
     include LIB_DIR . 'docbook/src/docbook.srcparser.php';
     include LIB_DIR . 'docbook/src/docbook.apidoc.php';
     $doc = new \Docbook\APIdoc('res/docs/index.xml', 1);
     $doc->setSCRPath(API_DIR);
     $doc->setImgURL('res/docs/img/');
     $doc->setDemoURL(\Xily\Config::get('app.url') . 'index.php');
     // $doc->addInclude('<link media="all" rel="stylesheet" type="text/css" href="./assets/lib/bootstrap/css/bootstrap.min.css" />');
     // $doc->addInclude('<link media="all" rel="stylesheet" type="text/css" href="./assets/lib/bootstrap/css/bootstrap-responsive.min.css" />');
     $doc->addInclude('<script type="text/javascript" src="./assets/lib/mootools/mootools-core-1.4.4.js"></script>');
     $doc->addInclude('<script type="text/javascript" src="./assets/lib/mootools/mootools-more-1.4.0.1.js"></script>');
     $data = new \Xily\Dictionary($doc->parse());
     /*
     $toc = '<ul class="nav nav-list">';
     foreach ($data->get('sections') as $key => $value) {
     	$toc .= '<li class="lev'.substr_count($key, '.').'"><a href="#sect'.$key.'" style="padding-left: '.(substr_count($key, '.') * 10).'px">'.$value.'</a></li>';
     }
     $toc .= '</ul>';
     $data->set('toc', $toc);
     $data->set('css', file_get_contents('lib/docbook/html/apidoc.dyn.css'));
     */
     die($data->insertInto(file_get_contents('lib/docbook/html/apidoc.frame.html')));
 }
コード例 #2
0
ファイル: util.inc.php プロジェクト: dapepe/tymio
/**
 * Creates a link to an application view
 *
 * @param sting $view
 * @param string $index
 * @return string
 */
function buildLink($view, $index = false)
{
    if (\Xily\Config::get('app.seo') == 1) {
        return \Xily\Config::getDir('app.url') . $view . ($index ? '/' . $index : '');
    } else {
        return 'index.php?view=' . $view . ($index ? '&index=' . $index : '');
    }
}
コード例 #3
0
ファイル: kickstart.router.php プロジェクト: dapepe/tymio
 public static function run()
 {
     // USE LOCALTOR INSTEAD!
     // USE STRUCTURE FROM index.php
     $locale = self::getLang();
     $arg = array();
     $crumps = explode($this->routeSeparator, $_REQUEST['page']);
     // Check the cache first
     if ($this->cacheDir) {
         $cacheFile = $this->cacheDir . $page . '-' . $locale[0] . '-' . $locale[1] . '.htm';
         if (\Xily\Config::get('opt.cache') == 1 && file_exists($cacheFile)) {
             return file_get_contents($cacheFile);
         }
     }
     // Check, if there is a controller for the view
     if (file_exists($this->controllerDir . $view . '.php')) {
         include_once 'controllers/' . $view . '.php';
     }
     $controllerClass = $view . 'Controller';
     if (class_exists($controllerClass)) {
         $controller = new $controllerClass();
         $xlyPage = $controller->getView();
     } else {
         $file = 'views/' . $view . '.xml';
         if (!file_exists($file)) {
             $file = 'views/404.xml';
         }
         $xlyPage = \Xily\Bean::create($file, 1);
     }
     $doc = $xmlDoc->attribute('doc');
     $cache = \Xily\Config::get('opt.cache') == 1 ? true : !$xmlDoc->isFalse('cache');
     // If no crump is a valid page identifier, something is fishy and the user should get the notfound page
     // Same, if the indexed document is not found
     if (!file_exists(\Xily\Config::get('app.dir') . 'views/' . $doc) || is_dir(\Xily\Config::get('app.dir') . 'views/' . $doc) || isset($crumps) && sizeof($crumps) == sizeof($arg)) {
         $doc = 'notfound.xml';
         $arg = array();
         $cache = false;
     }
     $xlyPage = \Xily\Bean::create(\Xily\Config::get('app.dir') . 'views/' . $doc, 1);
     // Dynamic parameters do not matter for cached views
     $xlyPage->setAttribute('lang', $locale[0]);
     $xlyPage->setAttribute('region', $locale[1]);
     if (array_key_exists('page', $_REQUEST)) {
         $xlyPage->setAttribute('page', $_REQUEST['page']);
     }
     if ($this->cacheDir) {
         $html = $xlyPage->run();
         xilyBase::fileWrite($cacheFile, $html);
         return $html;
     } else {
         $xlyPage->setDataset($arg, 'arg');
         $xlyPage->setDataset($_GET, 'get');
         $xlyPage->setDataset($_POST, 'post');
         $xlyPage->setDataset($_REQUEST, 'request');
         return $xlyPage->run();
     }
 }
コード例 #4
0
ファイル: docbook.core.php プロジェクト: dapepe/tymio
 /**
  * Contructs the docbook object
  *
  * @param string|\Xily\Xml $mxtDoc The \Xily\Xml object or an XML document or file
  * @param bool $bolLoadFile Load the XML data from a file
  */
 public function __construct($mxtDoc, $bolLoadFile = false)
 {
     $this->extend();
     $this->setImgPath(\Xily\Config::get('doc.imgpath'));
     if ($mxtDoc instanceof \Xily\Xml) {
         $this->xmlDoc = $mxtDoc;
     } elseif (!($this->xmlDoc = \Xily\Xml::create($mxtDoc, $bolLoadFile))) {
         return false;
     }
     $this->build();
     $this->arrConverterKeys = array_keys($this->arrConverters);
     if ($bolLoadFile) {
         $this->setIncludePath(realpath(dirname($mxtDoc)));
     }
     return true;
 }
コード例 #5
0
ファイル: config.php プロジェクト: dapepe/tymio
<?php

// This file generated by Propel 1.6.1 convert-conf target
// from XML runtime conf file Z:\htdocs\tymio\lib\entities\runtime-conf.xml
$conf = array('datasources' => array('tymio' => array('adapter' => \Xily\Config::get('db.type'), 'connection' => array('dsn' => \Xily\Config::get('db.type') . ':host=' . \Xily\Config::get('db.host') . ';dbname=' . \Xily\Config::get('db.name'), 'database' => \Xily\Config::get('db.name'), 'user' => \Xily\Config::get('db.user'), 'password' => \Xily\Config::get('db.password'))), 'default' => 'tymio'), 'generator_version' => '1.6.9');
$conf['classmap'] = (include dirname(__FILE__) . DIRECTORY_SEPARATOR . 'classmap-tymio-conf.php');
return $conf;
コード例 #6
0
ファイル: api.class.php プロジェクト: dapepe/tymio
 /**
  * @return Authenticator
  */
 public static function getAuthenticator()
 {
     if (self::$authenticator === null) {
         self::$authenticator = new Authenticator();
         $cookieSalt = \Xily\Config::get('app.salt', 'string', '');
         if ((string) $cookieSalt !== '') {
             self::$authenticator->salt = $cookieSalt;
         }
     }
     return self::$authenticator;
 }
コード例 #7
0
ファイル: UserPeer.php プロジェクト: dapepe/tymio
 /**
  * Returns the user authenticated by the supplied login name and password.
  *
  * @param string $loginName
  * @param string $password The password.
  * @param PropelPDO $con Optional. The database connection to use.
  *     Default is NULL.
  * @return User|null The {@link User} object, or NULL on failure.
  * @uses verifyPassword()
  * @see UserQuery
  */
 public static function getAuthenticatedUser($loginName, $password, PropelPDO $con = null)
 {
     $user = UserQuery::create()->findOneByFQN($loginName, $con);
     if ($user === null) {
         $user = UserQuery::create()->findOneByEmail($loginName, $con);
     }
     if ($user === null) {
         return null;
     } elseif (\Xily\Config::get('app.useldap', 'bool', false) && self::ldapAuthenticate($user, $password, $con)) {
         return $user;
     } else {
         return self::verifyPassword($password, $user->getPasswordHash()) ? $user : null;
     }
 }
コード例 #8
0
ファイル: index.php プロジェクト: dapepe/tymio
             if ($api instanceof API) {
                 $res = $api->exceptionToResult($e);
             } else {
                 $res = array('error' => $e->getMessage());
                 if (isset($_REQUEST['debug'])) {
                     $res['trace'] = $e->getTrace();
                 }
             }
             echo json_encode($res);
         }
     }
 } elseif (isset($_REQUEST['_lang'])) {
     /* RETURN THE LANGUAGE FILE AS A JAVASCRIPT OBJECT
     		-------------------------------------------------------------------- */
     header('Content-type: text/javascript; charset=utf-8');
     echo 'var $LANG = ' . $locale->getJSON(\Xily\Config::get('app.cache', 'bool', false) ? CACHE_DIR . 'locales' : false) . ';';
 } elseif (!empty($_POST['return']) and Form::verify('login')) {
     HTTP::forwardTo(HTTP::readPOST('return') . '?username='******'username']) ? $_POST['username'] : ''));
 } else {
     /* LOAD THE VIEW/CONTROLLER/MODULE
     		-------------------------------------------------------------------- */
     $view = isset($_REQUEST['view']) ? $_REQUEST['view'] : VIEW_DEFAULT;
     $xmlMeta = new \Xily\Xml();
     // The meta object will be passed on when the bean is run
     try {
         if (!preg_match('`^[a-z]{1,32}$`', $view)) {
             throw new Exception('View "' . $view . '" not found.');
         }
         if (!$userAuthenticated) {
             if (isset($_REQUEST['username']) && $_REQUEST['username'] != '') {
                 $message = 'Wrong username or password!';
コード例 #9
0
ファイル: common.php プロジェクト: dapepe/tymio
require LIB_DIR . '/kickstart/kickstart.localizer.php';
require LIB_DIR . '/kickstart/kickstart.validator.php';
require LIB_DIR . '/kickstart/utils.excel.php';
require LIB_DIR . '/kickstart/compatibility.php';
require LIB_DIR . '/kickstart/form.php';
require LIB_DIR . '/kickstart/html.php';
require LIB_DIR . '/kickstart/http.php';
require LIB_DIR . '/kickstart/keyreplace.php';
require LIB_DIR . '/kickstart/ldap.php';
require LIB_DIR . '/kickstart/recentlist.php';
require LIB_DIR . '/kickstart/session.php';
require LIB_DIR . '/kickstart/util.php';
require LIB_DIR . '/cryptastic/cryptastic.class.php';
require LIB_DIR . '/spyc/spyc.php';
require LIB_DIR . '/tymio/controller.class.php';
require LIB_DIR . '/tymio/localizer.class.php';
require LIB_DIR . '/tymio/api.class.php';
require LIB_DIR . '/tymio/util.inc.php';
require LIB_DIR . '/tymio/ixml.inc.php';
require LIB_DIR . '/tymio/entityarray.php';
require LIB_DIR . '/tymio/search.php';
require APP_DIR . '/api/account.php';
require APP_DIR . '/api/clocking.php';
require APP_DIR . '/api/domain.php';
require APP_DIR . '/api/holiday.php';
require APP_DIR . '/api/plugin.php';
require APP_DIR . '/api/transaction.php';
require APP_DIR . '/api/user.php';
$locale = Localizer::getInstance($langAccepted, $langDefault);
$locale->load(APP_DIR . 'locales', \Xily\Config::get('app.cache', 'bool', false) ? CACHE_DIR . 'locales' : false);