Ejemplo n.º 1
0
 function __construct($accountIdentifier, $projectIdentifier)
 {
     $this->_shell = Loader::library('ShellAdapter');
     $repoHome = $this->_shell->getRepoHome();
     $this->_path = $repoHome . DS . $accountIdentifier . DS . $projectIdentifier . '.git';
     $this->_currentBranch = $this->_shell->getCurrentBranch($this);
 }
 public function index($userName, $projectName)
 {
     /**
      * @var \Proxy\ProjectProxy $projectProxy
      */
     $projectProxy = Loader::proxy('ProjectProxy');
     $memberCount = $projectProxy->getProjectMemberCount($this->project->id);
     $roles = $projectProxy->getProjectMemberWithRole($this->project->id);
     /**
      * @var \Proxy\NoticeProxy $noticeProxy
      */
     $noticeProxy = Loader::proxy('NoticeProxy');
     $notices = $noticeProxy->getNoticeByProject($this->project->id, 5);
     Loader::library('NoticeAdapter/NoticeAdapter', null, FALSE);
     $noticeFormats = [];
     foreach ($notices as $notice) {
         $noticeFormats[] = NoticeAdapter::newNotice($notice);
     }
     /**
      * @var Model/Repository $repo
      */
     $repo = $this->project->repository();
     $readme = $repo->readme();
     View::render('project_index', array('pageName' => 'project_index', 'account' => $this->account, 'project' => $this->project, 'memberCount' => $memberCount, 'roles' => $roles, 'notices' => $noticeFormats, 'readme' => $readme));
 }
Ejemplo n.º 3
0
 public function createRepository($accountIdentifer, $projectIdentifier)
 {
     /**
      * @var \Extend\Library\ShellAdapter $projectShell
      */
     $projectShell = Loader::library('ShellAdapter');
     $projectShell->createProject($accountIdentifer . DIRECTORY_SEPARATOR . $projectIdentifier);
 }
 /**
  * 抽象方法,触发命令执行
  *
  * @return mixed
  */
 public function fire()
 {
     if (Loader::library('FindProjects', $this->args)->execute()) {
         exit(0);
     } else {
         exit(1);
     }
 }
 /**
  * 抽象方法,触发命令执行
  *
  * @return mixed
  */
 public function fire()
 {
     $key = $this->args[0];
     $originCommand = getenv('SSH_ORIGINAL_COMMAND');
     $shell = Loader::library('FindShell', ['keyId' => $key, 'command' => $originCommand]);
     if ($shell->execute()) {
         exit(0);
     } else {
         exit(1);
     }
 }
 public function handle(array $params = null)
 {
     $turbo = Loader::library('Turbolink');
     if ($turbo->isPjax()) {
         $response = Response::getInstance();
         if (is_a($response, 'Foundation\\Http\\Response')) {
             $content = (string) $response->getOutput();
             $body = $turbo->extract($content);
             $response->setOutput($body);
         }
     }
 }
 function __construct()
 {
     parent::__construct();
     $this->validation = Loader::library('Validation');
     $this->validation->load('Api');
     if (!$this->validation->run()) {
         $errors = $this->validation->error();
         foreach ($errors as $key => $value) {
             if (!empty($value)) {
                 ErrorManager::throwCustomException(500, $value);
             }
         }
     }
 }
 public function processLogin()
 {
     $args = Input::post();
     /**
      * @var \Foundation\Library\Connection\Connection $connection
      */
     $connection = Loader::library('Connection/Connection');
     $remote = $connection->loadRemote('ucenter.User.UserController');
     $result = $remote->login(array('username' => $args['username'], 'password' => $args['password']), 'POST', 'json');
     if ($result['code'] == '0') {
         $uid = $result['data']['id'];
         $account = Account::findOne(array('uid' => $uid));
         if (!empty($account)) {
             $account->ucenter_token = $result['data']['authInfo']['token'];
             $account->token_expired = $result['data']['authInfo']['expired'];
             $account->save();
             $result['data']['account'] = $account->getOriginalData();
         } else {
             ErrorManager::getInstance()->throwException(10001);
         }
         $tokenName = $this->app->config->get('App.cookie_prefix') . $this->app->config->get('App.token_cookie_name');
         Input::setCookie($tokenName, $result['data']['authInfo']['token']);
     }
     Response::json($result);
 }
Ejemplo n.º 9
0
 function __construct()
 {
     parent::__construct();
     $connection = Loader::library('Connection/Connection');
     $this->_c = $connection->loadRemote('find');
 }