public static function save($script_)
 {
     Logger::debug('main', 'Starting Abstract_Script::save for \'' . $script_->id . '\'');
     $SQL = SQL::getInstance();
     $id = $script_->id;
     if (!Abstract_Script::load($id)) {
         Logger::debug('main', "Abstract_Script::save({$script_}) unable to load script, we must create it");
         $id = Abstract_Script::create($script_);
         if (!$id) {
             Logger::error('main', "Abstract_Script::save({$script_}) Abstract_Script::create failed");
             return false;
         }
     }
     if ($script_->name == '') {
         $script_->name = "Untitled " . $id;
     }
     $SQL->DoQuery('UPDATE #1 SET @2=%3,@4=%5,@6=%7,@8=%9 WHERE @10 = %11 LIMIT 1', self::$table, 'name', $script_->name, 'os', $script_->os, "type", $script_->type, 'data', $script_->data, 'id', $id);
     return true;
 }
Beispiel #2
0
 public function scripts_groups_list($group_id_)
 {
     $this->check_authorized('viewScripts');
     $liaisons = Abstract_Liaison::load('Scripts', NULL, $group_id_);
     $res = array();
     if (count($liaisons) > 0) {
         foreach ($liaisons as $liaison) {
             $script = Abstract_Script::load($liaison->element);
             if (!is_object($script)) {
                 continue;
             }
             $res[$script->id] = self::generate_script_array($script);
         }
     }
     return $res;
 }