示例#1
0
 public function handler_licenses_final($page, $no_reason = false)
 {
     $softwares = License::getSoftwares();
     $keys = array();
     if (Post::has('disagree') || !$no_reason && !Post::has('resend') && (!Post::has('reason') || Post::v('reason') == "") || !Post::has('software') || !in_array(Post::v('software'), array_keys($softwares))) {
         $this->handler_licenses($page);
     } else {
         $page->changeTpl('licenses/licenses_final.tpl');
         $page->assign('title', "Demande de licence pour {$softwares[Post::v('software')]}");
         $page->assign('software', Post::s('software'));
         $page->assign('software_name', $softwares[Post::s('software')]);
         if (($key = License::adminKey(Post::s('software'))) && License::hasRights(S::user())) {
             $key->give(S::user());
             $page->assign('direct', true);
         } elseif (Post::has('resend')) {
             $l = License::fetch(array('id' => Post::i('id')));
             if ($l[0]->uid() == S::user()->id()) {
                 License::send($l);
             } else {
                 die("La license n'appartient pas à l'utilisateur courant");
             }
             $page->assign('direct', true);
         } else {
             $lv = new LicensesValidate(Post::s('software'), Post::s('reason'));
             $v = new Validate(array('writer' => S::user(), 'group' => Group::from('licenses'), 'item' => $lv, 'type' => 'licenses'));
             $v->insert();
             $page->assign('direct', false);
         }
     }
 }
示例#2
0
 public function softwareName()
 {
     $s = License::getSoftwares();
     return $s[$this->software];
 }