Ejemplo n.º 1
0
     } else {
         $template_file = $spracheResponse->error_table;
     }
 } else {
     if (isset($server) and $ui->smallletters('action', 2, 'post') == 'md' and isset($ui->post['use']) and $ui->id('id', 10, 'post') != false) {
         $query = $sql->prepare("SELECT `snapshot`,`name`,`sid`,`channels` FROM `voice_server_backup` WHERE `id`=? AND `uid`=? AND `resellerid`=? LIMIT 1");
         $query->execute(array($ui->id('id', 10, 'post'), $user_id, $reseller_id));
         while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
             $snapshot = @gzuncompress($row['snapshot']);
             $connection = new TS3($queryip, $queryport, 'serveradmin', $querypassword);
             $errorcode = $connection->errorcode;
             if (strpos($errorcode, 'error id=0') === false) {
                 $template_file = $spracheResponse->error_ts_query_connect . $errorcode;
             } else {
                 $connection->StartServer($volocalserverid);
                 $reply = $connection->Snapshotdeploy($volocalserverid, $snapshot);
                 if (isset($reply[0]['id']) and $reply[0]['id'] == '0') {
                     $move = array();
                     $channelListOld = @json_decode($row['channels']);
                     $channelListDeployed = @json_decode($connection->channelList($volocalserverid));
                     if (is_object($channelListDeployed) and is_object($channelListOld)) {
                         foreach ($channelListOld as $k => $v) {
                             if (isset($channelListDeployed->{$k})) {
                                 $move[$v] = $channelListDeployed->{$k};
                             }
                         }
                     }
                     tsbackup('deploy', $ssh2user, $serverdir, $masterserver, $volocalserverid, $ui->id('id', 10, 'post'), $move);
                     $query = $sql->prepare("SELECT CONCAT(`ip`,':',`port`) AS `address` FROM `voice_server` WHERE `id`=? AND `userid`=? AND `resellerid`=? LIMIT 1");
                     $query->execute(array($row['sid'], $user_id, $reseller_id));
                     $address = $query->fetchColumn();