View file www/adm/game/red_game.php

File size: 6.17Kb
<div class="ramka">
Менеджер редактирования приложений.
</div>
<?php
Defined('ADMIN_S_S') or die ('Доступ запрещен!!!');
if ((int)$_GET['game_del'] == 1 && is_dir($cms.'game/'.$_GET['del_app'].'') && is_file($cms.'game/'.$_GET['del_app'].'/setup/name.txt'))
{

 if ($_POST['red_name'] == '' && $_POST['red_opis'] == '' && $_POST['red_ukaz'] == '')
 {
 include($cms.'game/'.$_GET['del_app'].'/setup/set.php');
 echo '
 <form name="" action="" method="post">
 Редактирование приложения "'.file_get_contents($cms.'game/'.$_GET['del_app'].'/setup/name.txt').'"<br />
 Указатель приложения: '.$_GET['del_app'].'<br />
 <input name="red_ukaz" type="hidden" value="'.trim($_GET['del_app']).'">
 Название приложения<br />
 <input name="red_name" type="text" value="'.file_get_contents($cms.'game/'.$_GET['del_app'].'/setup/name.txt').'"><br />
 Справочная информация приложения<br />
 ';
 include($cms.'flud/js/bb.php');
 include($cms.'flud/js/smyle.php');
 $ms_pol = 'red_opis';
 include($cms.'flud/js/smyler.php');
 include($cms.'flud/js/bber.php');
 $mess1 = file_get_contents($cms.'game/'.$_GET['del_app'].'/setup/help.php');
 include($cms.'flud/anti_y.php');
 $opis = $mess1;
 echo '
 <textarea style="width: 99%;" name="red_opis" rows=10>'.$opis.'</textarea><br />
 Тип приложения<br />
 <select size="1" name="red_typ">
  <option value="1">Игра</option>
  <option value="2">Программа</option>
 </select>
 <br />
 Размер окна фрейма:<br />
 Ширина: <input name="set_w" type="text" value="'.$app_w.'"><br />
 Высота: &nbsp;&nbsp;<input name="set_h" type="text" value="'.$app_h.'">
 <br />
 Приложение доступно:<br />
 <select size="1" name="set_d">
  <option value="user">Только пользователям</option>
  <option value="all">Всем, даже гостям</option>
 </select>
 <br />
 Версия приложения:<br />
 <input name="version" type="text" value="'.file_get_contents($cms.'game/'.$_GET['del_app'].'/setup/ver.txt').'">
 <table><tr>
 <td>
 <input class="knopka" type="submit" value="Да">
 </td>
 <td>
 <a class="knopka" href="?id=51">Нет</a>
 </td>
 </tr></table>
 </form>
 ';
 }
 else
 {
  $del_dire = trim($_POST['red_ukaz']);
  if (is_file($cms.'game/'.$del_dire.'/game.app'))
  {
   echo '<div class="ramka">
   Cохраняем данные..
   </div>';
   $mess1 = $_POST['red_name'];
   include($cms.'flud/anti_x.php');
   $name = $mess1;

   $mess1 = $_POST['red_opis'];
   include($cms.'flud/anti_x.php');
   $opis = $mess1;

    if ($_POST['red_typ'] == 1)
     $typ = 'game';
    else
     $typ = 'app';

   $fp = fopen ($cms.'game/'.$_GET['del_app'].'/setup/name.txt', "w+");
   fwrite ($fp, $name);
   fclose ($fp);

   $fp = fopen ($cms.'game/'.$_GET['del_app'].'/setup/help.php', "w+");
   fwrite ($fp, stripslashes($opis));
   fclose ($fp);

   $fp = fopen ($cms.'game/'.$_GET['del_app'].'/setup/type.txt', "w+");
   fwrite ($fp, $typ);
   fclose ($fp);

   $fp = fopen ($cms.'game/'.$_GET['del_app'].'/setup/ver.txt', "w+");
   fwrite ($fp, trim($_POST['version']));
   fclose ($fp);

   $fp = fopen ($cms.'game/'.$_GET['del_app'].'/setup/set.php', "w+");
   fwrite ($fp, '<?php
   $app_w = \''.$_POST['set_w'].'\';
   $app_h = \''.$_POST['set_h'].'\';
   $app_d = \''.$_POST['set_d'].'\';
   ?>');
   fclose ($fp);

   echo '<div class="ramka">Приложение отредактировано. Подождите 5 секунд.</div>
   <META HTTP-EQUIV="Refresh" CONTENT="6; URL=?id=51&game_del='.$_GET['game_del'].'&del_app='.$_GET['del_app'].'">
   ';
  }
  else
  {
   echo $cms.'game/'.$del_dire.'/game.app'.'<br />';
   echo '<div class="error">Ошибка доступа. Неверный указатель.</div>';
  }
 }
}
else
{
$gm = $cms.'game/';
$gb_1 = $_GET['game'];
$gb = $gm.$_GET['game'].'/';
// $gb - путь к твоей игре
$conf = $gb.'conf/';
$base = $gb.'base/';

          echo '<div class="ramka">Список доступных приложений</div>';
          $dire = opendir ($cms.'game');
          while ($filee = readdir ($dire))
         { if (( $filee != ".") && ($filee != 'error_log') && ($filee != "..") && ($filee != "cgf")  && ($filee != "index.html") && ($filee != "TFrame.php"))
          {
           echo '<div class="ramka"><table><tr>';
           if (is_file($gm.$filee.'/setup/logo.png'))
           {
            echo '<td>';
            echo '<a target="_blank" href="/?page=game&int='.$filee.'"><img src="/game/'.$filee.'/setup/logo.png" width="50" alt="" border="0"></a>';
            echo '</td>';
           }
           else
           {
           	echo '<td>';
           	echo '<a target="_blank" href="/?page=game&int='.$filee.'"><img src="/flud/logo_game.png" width="50" alt="" border="0"></a>';
            echo '</td>';
           }
           echo '<td width="80%">';
           if (is_file($gm.$filee.'/setup/name.txt'))
           {
            echo file_get_contents($gm.$filee.'/setup/name.txt');
           }
           else
           {
           	echo $filee;
           }
           echo '<br />';
           if (is_file($gm.$filee.'/setup/ver.txt'))
           {
            echo 'Версия: '.file_get_contents($gm.$filee.'/setup/ver.txt');
           }
           else
           {
           	echo 'Версия не указана';
           }
           echo '</td>';
           if (is_file($gm.$filee.'/setup/type.txt'))
           {
            if (trim(file_get_contents($gm.$filee.'/setup/type.txt')) == 'game')
            {
             echo '<td>
             <img src="/flud/ico_game.png" width="50" alt="" border="0">
             </td>';
            }
            else
            {
             echo '<td>
             <img src="/flud/ico_app.png" width="50" alt="" border="0">
             </td>';
            }
           }
           else
           {
           	echo '<td>
            Тип не опознан
           	</td>';
           }

           echo '<td>
           <a href="?id='.$_GET['id'].'&game_del=1&del_app='.$filee.'">
           <div style="
           background-color: #FFD5D5;
           padding: 10px;
           color: #FF0000;
           ">
           Редактировать
           </div></a>
           </td>';
           echo '</tr></table>';
           echo '</div>';

          }
         }
          closedir ($dire);
}
?>