Example #1
0
 public function postCreate()
 {
     if ($this->main->__var_custom_exec) {
         lxshell_direct($this->main->__var_custom_exec);
     }
 }
Example #2
0
 function doCustomAction()
 {
     global $gbl, $sgbl, $login, $ghtml;
     if ($this->isClass('ssession')) {
         return;
     }
     if ($this->isClass('general')) {
         return;
     }
     if ($this->isClass('sp_specialplay')) {
         return;
     }
     if ($this->isClass('sp_childspecialplay')) {
         return;
     }
     if ($this->isClass('notification')) {
         return;
     }
     if ($this->isClass('resourceplan')) {
         return;
     }
     $acto = $login->getObject('general')->customaction_b;
     $var = "{$this->get__table()}__{$this->dbaction}__{$this->subaction}";
     if (isset($acto->{$var}) && $acto->{$var}) {
         $action = $acto->{$var};
         $action = str_replace('%contactemail%', $this->contactemail, $action);
         $action = str_replace('%nname%', $this->nname, $action);
         lxshell_direct($action);
     }
     if (!$this->isClass('vps')) {
         return;
     }
     $sq = new Sqlite(null, 'customaction');
     if ($this->dbaction === 'add') {
         $query = "action = '{$this->dbaction}' AND class = '{$this->getClass()}'";
     } else {
         $query = "action = '{$this->dbaction}' AND subaction = '{$this->subaction}' AND class = '{$this->getClass()}'";
     }
     $this->__var_custom_exec = null;
     dprint($query);
     $list = $sq->getRowsWhere($query);
     if (!$list) {
         return;
     }
     dprintr($list);
     foreach ($list as $k => $l) {
         $ex = $l['exec'];
         $ex = str_replace('%contactemail%', $this->contactemail, $ex);
         $ex = str_replace('%nname%', $this->nname, $ex);
         $ex = str_replace('%hostname%', $this->hostname, $ex);
         $ex = str_replace('%vpsid%', $this->vpsid, $ex);
         if ($l['where_to_exec'] === 'master') {
             lxshell_direct($ex);
         } else {
             $this->__var_custom_exec = $ex;
         }
     }
 }