예제 #1
0
 public static function style()
 {
     if (file_exists(WEB . "css" . DS . "style.css")) {
         echo "<link rel=\"stylesheet\" href=\"css/style.css\" type=\"text/css\" />\n";
     }
     $gitCss = System::get('git_css');
     if ($gitCss) {
         echo "<link rel=\"stylesheet\" href=\"css/gitstyle.css\" type=\"text/css\" />\n";
     }
 }
예제 #2
0
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     // Type
     $fields->addFieldToTab('Root.Main', new DropdownField('Location', 'Location', $this->dbObject('Location')->enumValues()), 'Content');
     // Dates
     $fields->addFieldToTab('Root.Dates', $startDate = new DateField('StartDate', 'Start Date', $this->StartDate));
     $startDate->setConfig('showcalendar', true);
     $fields->addFieldToTab('Root.Dates', $endDate = new DateField('EndDate', 'End Date', $this->EndDate));
     $endDate->setConfig('showcalendar', true);
     // The systems are editable with a list of checkboxes - more obvious and specific than a
     // tagfield.
     $systems = System::get()->sort('Title', 'ASC');
     if (empty($systems)) {
         $fields->addFieldToTab('Root.Systems', new LiteralField('NoSystems', 'There are no game systems listed - add at least one in the "Systems" tab on the left.'));
     } else {
         $fields->addFieldToTab('Root.Systems', new CheckboxSetField('Systems', 'Systems', $systems->map()));
     }
     return $fields;
 }
예제 #3
0
파일: index.php 프로젝트: dreamvids/api
require_once System::get()->getModels() . 'Client.php';
require_once System::get()->getModels() . 'Controller.php';
require_once System::get()->getModels() . 'Permission.php';
require_once System::get()->getModels() . 'Rank.php';
require_once System::get()->getModels() . 'Token.php';
Token::flush();
// TODO: Remplacer 'root' par '' en prod absolument !!
$tokenString = $_SERVER['HTTP_X_TOKEN'] ?? 'root';
if (Token::exists('token', $tokenString)) {
    $token = Token::getBy('token', $tokenString);
    Request::get()->setClient(new Client($token->client_id));
}
$controller = Controller::getBy('uri', Request::get()->getArg(0));
$filename = System::get()->getControllers() . $controller->uri . '.php';
$classname = ucfirst($controller->uri) . "Ctrl";
if (!file_exists($filename)) {
    HTTPError::NotFound();
    exit;
}
if (!in_array(Request::get()->getMethod(), array('GET', 'POST'))) {
    parse_str(file_get_contents('php://input'), $_POST);
}
require_once System::get()->getSystem() . 'ControllerInterface.php';
require_once $filename;
$method = Request::get()->getMethodToCall();
if (Permission::isPermit($controller, $method)) {
    $classname::$method();
} else {
    HTTPError::Forbidden();
}
Request::get()->sendJSON();
예제 #4
0
 function getDescription($proj)
 {
     $repoSuffix = System::get('repo_suffix');
     $path = Git::repoPath($proj);
     return file_get_contents("{$path}{$repoSuffix}/description");
 }
예제 #5
0
파일: show.php 프로젝트: hongweipeng/screen
<?php

require '../include/init.inc.php';
$list = Flash::getList(array('status' => 1));
foreach ($list as &$val) {
    preg_match('#{{(\\d)}}#', $val['url'], $matches);
    if (count($matches) > 0) {
        if ($matches[1] > 0) {
            if (strpos($val['url'], '?')) {
                $val['url'] .= '&start_date=' . date("Y-m-d", time() - 86400 * $matches[1]);
            } else {
                $val['url'] .= '?start_date=' . date("Y-m-d", time() - 86400 * $matches[1]);
            }
            $val['url'] .= '&end_date=' . date("Y-m-d", time());
        }
        $val['url'] = preg_replace('#{{\\d}}#', '', $val['url']);
    }
}
Template::assign('flashtime', System::get('flashtime') * 1000);
Template::assign('list', json_encode($list));
Template::display('flash/show.tpl');
예제 #6
0
                if (file_exists($filepath)) {
                    return include $filepath;
                }
            }
        }
    }
    //lib库文件
    $filepath = ADMIN_BASE_LIB . $filename;
    if (file_exists($filepath)) {
        return include $filepath;
    }
    throw new Exception($filepath . ' NOT FOUND!');
}
spl_autoload_register('OSAdminAutoLoad');
if (!isset($_SESSION['osa_timezone'])) {
    $timezone = System::get('timezone');
    $_SESSION['osa_timezone'] = $timezone;
}
date_default_timezone_set($_SESSION['osa_timezone']);
/*
不需要登录就可以访问的链接,也可以是某个目录,不含子目录
如"/nologin/","/nologin/aaa/"
*/
$no_need_login_page = array("/block.php", "/panel/login.php", "/panel/logout.php");
//如果不需要登录就可以访问的话
$action_url = Common::getActionUrl();
if (OSAdmin::checkNoNeedLogin($action_url, $no_need_login_page)) {
    //for login.php logout.php etc....
} else {
    //else之后 需要验证登录信息
    if (empty($_SESSION[UserSession::SESSION_NAME])) {
예제 #7
0
 private static function getLastNCommits($proj, $options = array())
 {
     $gitBinary = System::get('git_binary');
     $options = array_merge(array('since' => 'HEAD', 'until' => 'HEAD', 'count' => 10, 'dry' => false, 'params' => array()), $options);
     if ($options['count'] == 1) {
         $query = $options['since'];
     } else {
         $query = implode('..', array($options['since'], $options['until']));
         if (in_array($query, array('..', 'HEAD..HEAD'))) {
             $query = '--all';
         }
     }
     // --full-history --topo-order --skip=0
     $params = array();
     $params[] = "max-count={$options['count']}";
     foreach ($options['params'] as $param) {
         $params[] = $param;
     }
     $params = implode(' --', $params);
     if (!empty($params)) {
         $params = "--{$params}";
     }
     $format = array();
     $format[] = 'parents %P';
     $format[] = 'tree %T';
     $format[] = 'author %aN';
     $format[] = 'email %aE';
     $format[] = 'timestamp %at';
     $format[] = 'subject %s';
     $format[] = 'endrecord%n';
     $format = implode('%n', $format);
     $cmd = "GIT_DIR=" . self::$repos[$proj] . System::get('repo_suffix') . " {$gitBinary} rev-list {$query} {$params} --pretty=format:\"{$format}\"";
     if ($options['dry']) {
         return $cmd;
     }
     $out = array();
     exec($cmd, &$out);
     $commit = array();
     $results = array();
     foreach ($out as $line) {
         $line = trim($line);
         if (empty($line)) {
             $results[] = array_merge(array('parents' => array()), $commit);
             $commit = array();
             continue;
         }
         if ($line == 'endrecord') {
             // Commit exists, we can generate extra data here
             continue;
         }
         $descriptor = strstr($line, ' ', true);
         $info = trim(strstr($line, ' '));
         if ($descriptor == 'commit') {
             $commit['hash'] = $info;
         } else {
             if ($descriptor == 'parents') {
                 $commit['parents'] = explode(' ', $info);
             } else {
                 if ($descriptor == 'tree') {
                     $commit['tree'] = $info;
                 } else {
                     if ($descriptor == 'author') {
                         $commit['author'] = $info;
                     } else {
                         if ($descriptor == 'email') {
                             $commit['email'] = $info;
                         } else {
                             if ($descriptor == 'timestamp') {
                                 $commit['timestamp'] = $info;
                             } else {
                                 if ($descriptor == 'subject') {
                                     $commit['subject'] = $info;
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return $results;
 }
예제 #8
0
<?php

$project = isset($this->_request->params['project']) ? $this->_request->params['project'] : 'projectname';
?>
<div id="git-help">
<table>
<tr><td>To clone: </td><td>git clone <?php 
echo System::get('http_method_prefix') . $project;
?>
 yourpath</td></tr>
<tr><td>To communicate: </td><td><a href=<?php 
echo System::get('help_link');
?>
>Visit this page</a></td></tr>
</table>
</div>
예제 #9
0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
        <title>
            <?php 
$title = System::get('title');
?>
            <?php 
if ($title) {
    ?>
                <?php 
    echo $title;
    ?>
            <?php 
} else {
    ?>
                <?php 
    echo $this->_request->params['controller'] . '/' . $this->_request->params['action'];
    ?>
            <?php 
}
?>
        </title>
        <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
        <meta NAME="ROBOTS" CONTENT="NOFOLLOW" />
        <link rel="stylesheet" href="/css/gitstyle.css" type="text/css" />
    </head>
    <body>
        <div id="gitbody">
            <?php 
echo $this->element('breadcrumbs');