Exemplo n.º 1
0
 public function action_import_profile($input)
 {
     $tikilib = TikiLib::lib('tiki');
     $perms = Perms::get();
     if (!$perms->admin) {
         throw new Services_Exception_Denied(tr('Reserved for administrators'));
     }
     unset($success);
     $confirm = $input->confirm->int();
     if ($confirm) {
         $transaction = $tikilib->begin();
         $installer = new Tiki_Profile_Installer();
         $yaml = $input->yaml->string();
         $name = "tracker_import:" . md5($yaml);
         $profile = Tiki_Profile::fromString('{CODE(caption="yaml")}' . "\n" . $yaml . "\n" . '{CODE}', $name);
         if ($installer->isInstallable($profile) == true) {
             if ($installer->isInstalled($profile) == true) {
                 $installer->forget($profile);
             }
             $installer->install($profile);
             $feedback = $installer->getFeedback();
             $transaction->commit();
             return $feedback;
             $success = 1;
         } else {
             return false;
         }
     }
     return array('title' => tr('Import Tracker From Profile/YAML'), 'modal' => $input->modal->int());
 }
Exemplo n.º 2
0
 public function action_import_profile($input)
 {
     global $tikilib, $access;
     $access->check_permission('tiki_p_admin');
     $transaction = $tikilib->begin();
     $installer = new Tiki_Profile_Installer();
     $yaml = $input->yaml->string();
     $name = "tracker_import:" . md5($yaml);
     $profile = Tiki_Profile::fromString('{CODE(caption="yaml")}' . "\n" . $yaml . "\n" . '{CODE}', $name);
     if ($installer->isInstallable($profile) == true) {
         if ($installer->isInstalled($profile) == true) {
             $installer->forget($profile);
         }
         $installer->install($profile);
         $feedback = $installer->getFeedback();
         $transaction->commit();
         return $feedback;
     } else {
         return false;
     }
 }