Beispiel #1
0
function edit_action($id)
{
    $row = get_row($id);
    $rows = get_all_rows();
    $html = render_template("view/edit.php", array('row' => $row, 'rows' => $rows));
    return $html;
}
Beispiel #2
0
function read_wiki() {
  global $wiki_stylesheet;
  global $columns;
  $data=array();

  $f=fopen($wiki_stylesheet, "r");
  unset($this_part);

  while($r=fgets($f)) {
    $r=chop($r);

    if(ereg("==([^=]+)==", $r, $m)) {
      $mode=0;
      $part=trim($m[1]);
    }

    if(substr($r, 0, 1)=="|") {
      $this_row=get_row($r, $f);

      if($this_row&&($columns[$part])) { 
	$src=array();
	foreach($this_row as $i=>$r2) {
	  $src[$columns[$part][$i]]=trim($r2);
	}
      
	$data[$part][]=$src;
      }
    }
  }

  fclose($f);
  return $data;
}
Beispiel #3
0
 public function index()
 {
     $testimonials = get_row('testimonials');
     echo view('head', array('css' => 'testimonials', 'class' => 'testimonials content', 'title' => $testimonials->seo_title ? $testimonials->seo_title : 'Getuigenissen', 'description' => $testimonials->seo_content ? $testimonials->seo_content : ''));
     echo view('testimonials', array('testimonials' => $testimonials));
     echo view('foot', array());
 }
Beispiel #4
0
 public function index()
 {
     $services = get_row('services');
     echo view('head', array('title' => $services && $services->seo_title ? $services->seo_title : 'Diensten', 'description' => $services && $services->seo_content ? $services->seo_content : ''));
     echo view('services', array('services' => $services));
     echo view('foot', array());
 }
Beispiel #5
0
 public function quest_end($config, $player)
 {
     $quest = (int) $quest;
     if ($player->in_quest != 0) {
         $quest = get_row("select * , unix_timestamp() as tnow from quests where q_id = " . $player->in_quest);
         if ($quest->tnow >= $player->in_quest_time) {
             $text = '';
             if ($quest->q_exp > 0) {
                 $exp = floor($quest->q_exp * ($player->lvl + 1) * 1.77);
                 call("update users set in_quest = 0,in_quest_time = 0, exp = exp + " . $exp . " where usr_id = " . $player->usr_id);
                 call("update users set skills = skills + 1, exp = exp - exp_lvl, exp_lvl = exp_lvl * 1.45, lvl = lvl + 1 where exp >= exp_lvl and usr_id = " . $player->usr_id);
                 $text .= 'Twój heros zdobył ' . $exp . ' doświadczenia<br/>';
             }
             if ($quest->q_res > 0) {
                 $res = floor($quest->q_res * ($player->lvl + 1) * 1.77);
                 call("update users set in_quest = 0,in_quest_time = 0 where usr_id = " . $player->usr_id);
                 require_once 'functions/TownMgr.php';
                 $TownMgr = new TownMgr();
                 $TownMgr->change_resources($config, $player->actual_town, $res, $res, $res, 0);
                 $text .= 'Twój heros zdobył ' . $res . ' każdego z surowców<br/>';
             }
             require_once 'functions/MsgMgr.php';
             $MsgMgr = new MsgMgr();
             $MsgMgr->raport($config, $player->usr_id, $text);
         }
     }
 }
Beispiel #6
0
function show_action($id)
{
    //$id=$_REQUEST['id'];
    //$sql="SELECT * FROM `pages` WHERE `id`=$id";
    //$row=get_all_rows($sql);
    $rows = get_row($id);
    $html = render_template("View/show.php", array('rows' => $rows));
    return $html;
}
Beispiel #7
0
 public function event_stop($config, $event, $town)
 {
     $town = (int) $town;
     $event = (int) $event;
     $event_data = get_row("select e_type, e_end - unix_timestamp() as etime from events where e_done = 0 and e_id = {$event} and e_t_id = {$town}");
     call("\n\t\tupdate events set e_done = 1 \n\t\twhere e_done = 0 and e_id = {$event} and e_t_id = {$town}\n\t\t");
     if (!empty($event_data)) {
         call("\n\t\t\tupdate events set e_start = e_start -  {$event_data->etime},\n\t\t\te_end = e_end -  {$event_data->etime}\n\t\t\twhere e_done = 0  and e_t_id = {$town} and e_type =  {$event_data->e_type}\n\t\t\tand e_id > {$event}\n\t\t\t");
     }
 }
Beispiel #8
0
 public function index()
 {
     $home = get_row('home');
     $sale = where('sold = 0 && purpose = 1')->limit(5)->order_by('create_date DESC')->get('skarabee/property');
     $rent = where('sold = 0 && purpose = 2')->limit(5)->order_by('create_date DESC')->get('skarabee/property');
     $projects = where('sold = 0 && type = 3')->limit(5)->order_by('create_date DESC')->get('skarabee/property');
     echo view('head', array('class' => 'home', 'css' => 'home', 'title' => $home->seo_title ? $home->seo_title : $home->title, 'description' => $home->seo_content ? $home->seo_content : $home->content));
     echo view('home', array('home' => $home, 'sale' => $sale, 'rent' => $rent, 'projects' => $projects));
     echo view('foot', array('js' => 'home'));
 }
Beispiel #9
0
 public function caravan_send($config, $player, $town, $wood, $stone, $iron)
 {
     $town = textV($town);
     $wood = (int) $wood;
     $stone = (int) $stone;
     $iron = (int) $iron;
     if ($wood + $stone + $iron < 1) {
         $msg = 'wyślij minimum 1 sztukę jakiegoś surowca';
     } elseif ($player->clan_id == 0) {
         $msg = 'nie jesteś w klanie, karawany można wysyłać tylko do sojuszników w swoim klanie';
     } elseif ($player->town->t_wood < $wood || $player->town->t_stone < $stone || $player->town->t_iron < $iron) {
         $msg = 'nie posiadasz tyle surowców';
     } else {
         $can = get_row($q = "select clan_id, t_id from users inner join towns on t_usr_id = usr_id where t_name = '" . $town . "' limit 1");
         if (empty($can)) {
             $msg = 'takie miasto nie istnieje';
         } elseif ($can->clan_id != $player->clan_id) {
             $msg = 'te miasto nie jest w tym samym klanie co ty';
         } else {
             $event_check = get_one("select count(*) from events where (e_type = 20 or e_type = 21) and e_done = 0 and e_t_id = " . $player->actual_town);
             if ($event_check > 9) {
                 $msg = 'masz już maksymalną ilość karawan w podróży';
             } else {
                 $market_lvl = get_one("select go_lvl from game_objects where go_type = 1 and go_subtype = 6 and go_t_id = " . $player->actual_town);
                 if (empty($market_lvl)) {
                     $msg = 'nie posiadasz rynku, jak chcesz wysłać karawanę??';
                 } elseif ($market_lvl <= $event_check) {
                     $msg = 'masz już maksymalną ilość karawan w podróży';
                 } else {
                     $y = get_row("select * from map where m_t_id =" . $can->t_id);
                     $x = get_row("select * from map where m_t_id =" . $player->actual_town);
                     if ($x->m_x != $y->m_x && $x->m_y == $y->m_y) {
                         $range = abs($y->m_x - $x->m_x) * 300;
                     } elseif ($x->m_x == $y->m_x && $x->m_y != $y->m_y) {
                         $range = abs($y->m_y - $x->m_y) * 300;
                     } else {
                         $range = floor(sqrt(pow(abs($y->m_x - $x->m_x), 2) + pow(abs($y->m_y - $x->m_y), 2))) * 300;
                     }
                     call("insert into caravan(ca_from, ca_to, ca_wood, ca_stone, ca_iron)\n\t\t\t\t\t\t\tvalue(" . $player->actual_town . "," . $can->t_id . "," . $wood . "," . $stone . "," . $iron . ")");
                     $ca = get_row("select last_insert_id() as ca, unix_timestamp() as estart");
                     require_once 'functions/TownMgr.php';
                     $TownMgr = new TownMgr();
                     $TownMgr->change_resources($config, $player->actual_town, -$wood, -$stone, -$iron, 0);
                     require_once 'functions/EventsMgr.php';
                     $EventMgr = new EventsMgr();
                     $EventMgr->event_add($config, $player->actual_town, 20, $can->t_id, $ca->ca, 0, $ca->estart, $ca->estart + $range, 0);
                     $msg = 'wysłano karawanę do miasta ' . $town;
                 }
             }
         }
     }
     return $msg;
 }
Beispiel #10
0
function summa($type)
{
    $total_in = gmp_init('0');
    $query = "\n        SELECT SUM(amount) AS sum\n        FROM purses\n        WHERE type='{$type}'\n        ";
    $result = do_query($query);
    $row = get_row($result);
    $v = gmp_init($row['sum']);
    $total_in = gmp_add($total_in, $v);
    $query = "\n        SELECT SUM(amount) AS sum\n        FROM orderbook\n        WHERE type='{$type}' AND status='OPEN'\n        ";
    $result = do_query($query);
    $row = get_row($result);
    if (isset($row['sum'])) {
        $v = gmp_init($row['sum']);
        $total_in = gmp_add($total_in, $v);
    }
    $query = "\n        SELECT SUM(amount) AS sum\n        FROM requests\n        WHERE curr_type='{$type}' AND req_type='WITHDR' AND status='VERIFY'\n        ";
    $result = do_query($query);
    $row = get_row($result);
    if (isset($row['sum'])) {
        $v = gmp_init($row['sum']);
        $total_in = gmp_add($total_in, $v);
    }
    $total_in = gmp_strval($total_in);
    $total_out = gmp_init('0');
    $query = "\n        SELECT SUM(amount) AS sum\n        FROM requests\n        WHERE curr_type='{$type}' AND req_type='DEPOS' AND status='FINAL'\n        ";
    $result = do_query($query);
    $row = get_row($result);
    if (isset($row['sum'])) {
        $v = gmp_init($row['sum']);
        $total_out = gmp_add($total_out, $v);
    }
    $query = "\n        SELECT SUM(amount) AS sum\n        FROM requests\n        WHERE curr_type='{$type}' AND req_type='WITHDR' AND status='FINAL'\n        ";
    $result = do_query($query);
    $row = get_row($result);
    if (isset($row['sum'])) {
        $v = gmp_init($row['sum']);
        $total_out = gmp_sub($total_out, $v);
    }
    $total_out = gmp_strval($total_out);
    echo "{$type} = {$total_in}\t  {$total_out}\n";
    if (gmp_cmp($total_in, $total_out) != 0) {
        echo "*********** MISMATCH ****************\n";
    }
}
Beispiel #11
0
 public function login($config, $login, $pass)
 {
     $msg = '';
     $login = textV($login);
     $pass = sha1(md5(textV($pass)));
     $user = get_row("select * from users where login = '******' and pass = '******' limit 1");
     if (!empty($user)) {
         if ($user->banned == 1) {
             $msg = 'gracz zbanowany';
         } elseif (is_numeric($user->usr_id) && $user->usr_id > 0) {
             $_SESSION = array();
             $_SESSION['user'] = $user->usr_id;
             reload($config, 'town', '');
         } else {
             $msg = 'nieoczekiwany błąd';
         }
     } else {
         $msg = 'Wprowadzono błędne dane ';
     }
     return $msg;
 }
Beispiel #12
0
 public function register($config, $login, $pass, $mail)
 {
     $login = textV($login);
     $pass = textV($pass);
     $mail = textV($mail);
     if (strlen($login) < 5) {
         $msg .= ' login za krótki [5-15 znaków] <br/>';
     } elseif (strlen($login) > 15) {
         $msg .= ' login za długi [5-15 znaków] <br/>';
     }
     if (strlen($pass) < 5) {
         $msg .= ' hasło za krótkie [5-15 znaków] <br/>';
     } elseif (strlen($pass) > 15) {
         $msg .= ' hasło za długie [5-15 znaków] <br/>';
     }
     if (empty($msg)) {
         $msg = "Błąd <br/>";
         $query = "\n\t\t\t\tselect login  as e_login, email as e_email\n\t\t\t\tfrom arena_users where email='" . $mail . "' or login = '******'\n\t\t\t";
         $info = get_row($query);
         $users_count = get_one("select count(*) from arena_users");
         if ($users_count < 500) {
             if (empty($info->e_login) && empty($info->e_email)) {
                 call("\n\t\t\t\t\tinsert into arena_users (login, pass,  email, last_inc)\n\t\t\t\t\tvalue ('" . $login . "','" . md5($pass) . "','" . $mail . "', unix_timestamp())\n\t\t\t\t\t");
                 $msg = "Poprawnie zarejestowano użytkownika " . $login;
             } else {
                 if (!empty($info->e_login)) {
                     $msg .= " login zajęty <br/>";
                 }
                 if (!empty($info->e_email)) {
                     $msg .= " email zajęty <br/>";
                 }
             }
         } else {
             $msg = 'limit graczy';
         }
     } else {
         $msg = "Błąd <br/>" . $msg;
     }
     return $msg;
 }
function Get_table_view($table, $extra = null, $extraLink = null, $notIMPCol = null, $DefaultOpotion_LINK_display = null, $topLink = null)
{
    global $db;
    if ($DefaultOpotion_LINK_display == null) {
        $DefaultOpotion_LINK_display = null;
    }
    if ($notIMPCol == null) {
        $notIMPCol = array();
    }
    $columns = $db->get_results("SHOW FULL COLUMNS FROM {$table}");
    $ColCount = count($columns);
    if (isset($_GET['Col'])) {
        $connectQuery = "WHERE " . $_GET['Col'] . "=" . $_GET['Colid'];
    } else {
        $connectQuery = '';
    }
    $tags = $db->get_results("SELECT * FROM {$table} {$connectQuery}");
    $tableCol = $db->get_row("SHOW FULL COLUMNS FROM {$table}");
    $tableColumn = $tableCol->Field;
    //echo GetCount('Tag','WebsiteID');
    if ($tags) {
        ?>
	  <div class="box-header">
								
								<?php 
        if ($DefaultOpotion_LINK_display == null && $topLink == null) {
            ?>
								
								<?php 
            echo LoadTOPMenuLink();
        } elseif ($table == 'Website') {
            echo LoadTOPMenuLink();
        } elseif ($table == 'Tag') {
            echo LoadTOPMenuLink();
        }
        ?>
								
								
								
                                    <h3 class="box-title"><?php 
        echo $table;
        ?>
</h3>
									
									
									
								
									
                                </div><!-- /.box-header -->
										
										 <div class="box-body table-responsive">
<table id="example1" class="table table-bordered table-striped">
                                        <thead>
                                            <tr>
                                                <?php 
        $dir = $_SERVER['DOCUMENT_ROOT'] . '/admin/seo_images/' . $table . '/';
        $no = '';
        foreach ($columns as $col) {
            $no += 1;
            if (in_array($col->Field, $notIMPCol)) {
            } else {
                $pos = strpos($col->Field, "_t");
                //$id = strpos($col->Field, "_id");
                //$count= GetCount('Tag',$col->Field);
                if ($tableColumn == $col->Field) {
                    $colName = $col->Comment;
                    $colName = explode('|', $colName);
                    $colName = $colName[0];
                    echo '<th>' . $colName . '</th>';
                }
                if ($pos) {
                    $colName = $col->Comment;
                    $colName = explode('|', $colName);
                    $colName = $colName[0];
                    echo '<th>' . $colName . '</th>';
                }
                if ($no == 3) {
                    if (is_dir($dir)) {
                        echo '<th> Image</th>';
                    } else {
                        //	echo'<th>Not True</th>';
                    }
                }
                if ($extra != null && in_array($col->Field, $extra)) {
                    if ($col->Comment == '') {
                        $colName = $col->Field;
                    } else {
                        $colName = $col->Comment;
                        $colName = explode('|', $colName);
                        $colName = $colName[0];
                    }
                    echo '<th>' . $colName . '</th>';
                }
                //     trace square for ggetting other tabel data.
                if ($extra != null) {
                    foreach ($extra as $ext) {
                        $square = explode('[', $ext);
                        $realColname = $square[0];
                        $colEnd = end($square);
                        $square1 = explode(']', $colEnd);
                        $squCount = count($square);
                        //print_r($square);
                        if ($squCount == 2) {
                            $square1 = explode('.', $square1[0]);
                            $tablename = $square1[0];
                            $viewcolname = $square1[1];
                            if ($col->Field == $realColname) {
                                $getCOl = $db->get_row("SHOW FULL COLUMNS FROM {$tablename} ");
                                $tabelCol = $getCOl->Comment;
                                echo '<th>' . $col->Comment . '</th>';
                            } else {
                                //echo'<th>'.$realColname.'sdfgh'.$col->Field.'=='.$realColname.'</th>';
                            }
                        }
                    }
                }
            }
            if ($col->Comment == 'Status') {
                echo '<th>Status</th>';
            }
            if ($no == $ColCount) {
                echo '<th>Option</th>';
            }
        }
        ?>

                                            </tr>
                                        </thead>
                                        <tbody>
										
										
										
										
										<?php 
        foreach ($tags as $tag) {
            $no = '';
            ?>
<tr>

<?php 
            foreach ($columns as $col) {
                $no += 1;
                if ($col->Field == $tableColumn) {
                    $pos = strpos($col->Field, "_t");
                    //$id = strpos($col->Field, "_id");
                    $field = $col->Field;
                    $ColId = $tag->{$field};
                }
                if (in_array($col->Field, $notIMPCol)) {
                } else {
                    $pos = strpos($col->Field, "_t");
                    //$id = strpos($col->Field, "_id");
                    $field = $col->Field;
                    if ($col->Field == $tableColumn) {
                        echo '<td>' . $tag->{$field} . '</td>';
                        $ColId = $tag->{$field};
                    }
                    if ($pos) {
                        echo '<td>' . $tag->{$field} . '</td>';
                    } else {
                        // echo'TNOt macth'.$col->Field.'<br />';
                    }
                    if ($no == 3) {
                        if (is_dir($dir)) {
                            echo '<td>';
                            echo LoadPopImg($ColId, $table);
                            echo ' </td>';
                        } else {
                            //echo'<th>Not True</th>';
                        }
                    }
                    if ($extra != null && in_array($col->Field, $extra)) {
                        if ($tag->{$field} != '') {
                            $totalCount = strpos($tag->{$field}, ",");
                            if ($totalCount) {
                                $totalCount = explode(',', $tag->{$field});
                                $totalCount = count($totalCount);
                                echo '<td>' . $totalCount . '</td>';
                            } else {
                                echo '<td>' . $tag->{$field} . '</td>';
                            }
                        } else {
                            echo '<td></td>';
                        }
                    } else {
                        //     trace square for ggetting other tabel data.
                        if ($extra != null) {
                            foreach ($extra as $ext) {
                                $square = explode('[', $ext);
                                $realColname = $square[0];
                                $colEnd = end($square);
                                $square1 = explode(']', $colEnd);
                                $squCount = count($square);
                                //print_r($square);
                                if ($squCount == 2) {
                                    $square1 = explode('.', $square1[0]);
                                    $tablename = $square1[0];
                                    $viewcolname = explode(',', $square1[1]);
                                    $getCOl = $db->get_row("SHOW FULL COLUMNS FROM {$tablename} ");
                                    $tabelRelId = $getCOl->Field;
                                    //print_r($getCOl);
                                    if ($tag->{$realColname} != '') {
                                        //echo $tablename,$tabelRelId.'='.$tag->$realColname;
                                        $data = get_row($tablename, $tabelRelId . '=' . $tag->{$realColname});
                                    }
                                    if ($col->Field == $realColname) {
                                        if ($tag->{$realColname} != 0 && $tag->{$realColname} != '') {
                                            if (@$data->{$tabelRelId} != '') {
                                                echo '<td>';
                                                foreach ($viewcolname as $col) {
                                                    echo @$data->{$col} . ' ';
                                                }
                                                echo '</td>';
                                            } else {
                                                echo '<td><code>Data Not Availabel.</code><a data-original-title="You have deletd row in ' . $tablename . ' table. " data-toggle="tooltip" title="" ><i class="fa fa-fw fa-comment"></i></a></td>';
                                            }
                                        } else {
                                            //echo'<td><code><a title="User not selected  value of '.$tablename.' , When user added new record of '.$table.' ."  ><i class="fa fa-fw fa-bug"></i></a></code></td>';
                                            echo '<td></td>';
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                if (@$col->Comment == 'Status') {
                    $stas = $tag->{$field};
                }
                if (@$col->Comment == 'Status') {
                    echo '<td>';
                    echo StatusTable($ColId, $stas);
                    echo '</td>';
                }
                if ($no == $ColCount) {
                    echo '<td>';
                    echo LinkTable($ColId, $extraLink, $DefaultOpotion_LINK_display, $table);
                    echo '</td>';
                }
            }
            ?>
		  </tr>
		  <?php 
        }
        ?>
										
										
                                        </tbody>
                             </table>
							 
							 </div>
	<?php 
    } else {
        ?>
<div class="box-body">
<div class="alert alert-danger alert-dismissable">
                                        <i class="fa fa-ban"></i>
                                        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">X</button>
                                        <b>Alert!</b> Data Not Available.
                                    </div>
                                    </div>
									<?php 
        if ($DefaultOpotion_LINK_display == null && $topLink == null) {
            ?>
									<a data-original-title="Add New"  href="dashboard.php?page=<?php 
            echo $_GET['page'];
            if (isset($_GET['type'])) {
                ?>
&type=<?php 
                echo $_GET['type'];
            }
            ?>
&view=add" class="btn btn-danger btn-sm" data-toggle="tooltip" title="Add New"><i class="fa fa-plus"></i> Add New</a>
									<?php 
        }
    }
}
Beispiel #14
0
<?php

if ((segment(2) == 'te-koop' || segment(2) == 'te-huur') && segment(1) == 'index') {
    $background = true;
    $background_image = get_random_row('home/images');
} else {
    $background = false;
}
?>

<?php 
$contact = get_row('contact');
define('EMAIL', $contact->email);
define('PHONE', $contact->phone);
define('STREET', $contact->address_address);
define('POSTAL', $contact->address_postal_code);
define('CITY', $contact->address_city);
?>

<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<title><?php 
echo isset($title) && $title != '' ? $title . ' &mdash; ' : '';
?>
Swevers Vastgoed</title>
Beispiel #15
0
 public function build_end($town, $type, $subtype, $count, $start, $end)
 {
     //pobierz dane obiektu
     $object = get_row("\n\t\t\tselect * from game_objects_param \n\t\t\tleft join game_objects \n\t\t\ton go_t_id = " . $town . "\n\t\t\tand go_gop_id = gop_id\n\t\t\twhere gop_type = " . $type . " and gop_subtype = " . $subtype . "\n\t\t\tlimit 1\n\t\t");
     //jeżeli obiektu nie ma na liście obiektów wybudowanych, to bierz pod uwagę parametry startowe
     if (empty($object->go_id)) {
         $object->go_lvl = 0;
     }
     switch ($type) {
         case 1:
             switch ($subtype) {
                 case 1:
                     //tartak
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                         call("update towns set t_wood_inc = t_wood_inc + 50 where t_id = {$town}");
                     } else {
                         call("update towns set t_wood_inc = t_wood_inc * 1.2 where t_id = {$town}");
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                     }
                     break;
                 case 2:
                     //cegielnia
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                         call("update towns set t_stone_inc = t_stone_inc + 50 where t_id = {$town}");
                     } else {
                         call("update towns set t_stone_inc = t_stone_inc * 1.2 where t_id = {$town}");
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                     }
                     break;
                 case 3:
                     //Kopalnia złota
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                         call("update towns set t_iron_inc = t_iron_inc + 50 where t_id = {$town}");
                     } else {
                         call("update towns set t_iron_inc = t_iron_inc * 1.2 where t_id = {$town}");
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                     }
                     break;
                 case 4:
                     //młyn
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                         call("update towns set t_pop_max = t_pop_max * 1.3  where t_id = {$town}");
                     } else {
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                         call("update towns set t_pop_max = t_pop_max * 1.3 where t_id = {$town}");
                         if ($object->go_lvl == 2) {
                             call("update town_objects set to_can = 1 where to_gop_id = 7 and to_t_id = {$town}");
                         }
                     }
                     break;
                 case 5:
                     //koszary
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                         call("update town_objects set to_can = 1 where to_t_id = {$town} and to_gop_id = 9 or to_gop_id = 21");
                     } else {
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                         switch ($object->go_lvl) {
                             case 2:
                                 call("update town_objects set to_can = 1 where to_t_id = {$town} and to_gop_id = 10");
                                 break;
                             case 4:
                                 call("update town_objects set to_can = 1 where to_t_id = {$town} and to_gop_id = 11 or to_gop_id = 22");
                                 break;
                             case 5:
                                 call("update town_objects set to_can = 1 where to_t_id = {$town} and to_gop_id = 15");
                                 break;
                             case 6:
                                 call("update town_objects set to_can = 1 where to_t_id = {$town} and to_gop_id = 12");
                                 break;
                             case 9:
                                 call("update town_objects set to_can = 1 where to_t_id = {$town} and to_gop_id = 13 or to_gop_id = 23");
                                 break;
                             case 14:
                                 call("update town_objects set to_can = 1 where to_t_id = {$town} and to_gop_id = 14");
                                 break;
                             default:
                                 break;
                         }
                     }
                     break;
                 case 7:
                     //ratusz
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                         call("update town_objects set to_can = 1 where to_t_id = {$town} and to_gop_id >= 16 and to_gop_id <= 20");
                     } else {
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                         if ($object->go_lvl == 2) {
                             call("update town_objects set to_can = 1 where to_gop_id = 6 and to_t_id = {$town}");
                         } elseif ($object->go_lvl == 1) {
                             call("update town_objects set to_can = 1 where to_gop_id = 5 and to_t_id = {$town}");
                         }
                     }
                     break;
                 case 8:
                     //magazyn
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                         call("update towns set t_res_max = t_res_max * 1.3  where t_id = {$town}");
                     } else {
                         call("update towns set t_res_max = t_res_max * 1.3  where t_id = {$town}");
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                     }
                     break;
                 default:
                     //inne
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                     } else {
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                     }
                     break;
             }
             break;
         case 2:
             switch ($subtype) {
                 case 1:
                     //Wycinka Drzew
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                         call("update towns set t_wood_inc = t_wood_inc * 1.1 where t_id = {$town}");
                     } else {
                         call("update towns set t_wood_inc = t_wood_inc * 1.1 where t_id = {$town}");
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                     }
                     break;
                 case 2:
                     //Wiedza o glebie
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                         call("update towns set t_stone_inc = t_stone_inc * 1.1 where t_id = {$town}");
                     } else {
                         call("update towns set t_stone_inc = t_stone_inc * 1.1where t_id = {$town}");
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                     }
                     break;
                 case 3:
                     //Wiedza o skałach
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                         call("update towns set t_iron_inc = t_iron_inc * 1.1 where t_id = {$town}");
                     } else {
                         call("update towns set t_iron_inc = t_iron_inc * 1.1 where t_id = {$town}");
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                     }
                     break;
                 case 4:
                     //higiena
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                         call("update towns set t_pop_max = t_pop_max * 1.1  where t_id = {$town}");
                     } else {
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                         call("update towns set t_pop_max = t_pop_max * 1.1  where t_id = {$town}");
                     }
                     break;
                 case 5:
                     //magazynynowanie
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                         call("update towns set t_res_max = t_res_max * 1.2  where t_id = {$town}");
                     } else {
                         call("update towns set t_res_max = t_res_max * 1.2  where t_id = {$town}");
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                     }
                     break;
             }
             break;
         case 3:
             //units
             $is_unit = get_one("select go_id from game_objects where go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype} limit 1");
             if (empty($is_unit)) {
                 call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time, go_attack, go_defence, go_life, go_range, go_lvl)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} , {$object->gop_stone} , {$object->gop_iron}, {$object->gop_pop}, {$object->gop_time},{$object->gop_attack}, {$object->gop_defence}, {$object->gop_life}, {$object->gop_range}, {$count})");
             } else {
                 call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + {$count}\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
             }
             break;
         case 10:
             require_once 'functions/SpyMgr.php';
             $SpyMgr = new SpyMgr();
             $newevent->e_t_id = $town;
             $newevent->e_type = $type;
             $newevent->e_subtype = $subtype;
             $newevent->e_count = $count;
             $newevent->e_start = $start;
             $newevent->e_end = $end;
             $SpyMgr->spy_battle($config, $newevent);
             break;
         case 11:
             require_once 'functions/SpyMgr.php';
             $SpyMgr = new SpyMgr();
             $SpyMgr->spy_dismis($config, $town, $count);
             break;
         case 20:
             require_once 'functions/MarketMgr.php';
             $MarketMgr = new MarketMgr();
             $MarketMgr->caravan_unload($config, $subtype, $count);
             $back = $MarketMgr->caravan_back($config, $town, $count);
             break;
         case 21:
             require_once 'functions/MarketMgr.php';
             $MarketMgr = new MarketMgr();
             $MarketMgr->caravan_unload($config, $town, $count);
             $back = $MarketMgr->caravan_dismis($config, $count);
             break;
         case 30:
             require_once 'functions/ArmyMgr.php';
             $ArmyMgr = new ArmyMgr();
             $newevent->e_t_id = $town;
             $newevent->e_type = $type;
             $newevent->e_subtype = $subtype;
             $newevent->e_count = $count;
             $newevent->e_start = $start;
             $newevent->e_end = $end;
             $ArmyMgr->army_battle($config, $newevent);
             break;
         case 31:
             require_once 'functions/ArmyMgr.php';
             $ArmyMgr = new ArmyMgr();
             $ArmyMgr->army_dismis($config, $town, $count);
             break;
         case 70:
             require_once 'functions/ColectorsMgr.php';
             $ColectorsMgr = new ColectorsMgr();
             $newevent->e_t_id = $town;
             $newevent->e_type = $type;
             $newevent->e_subtype = $subtype;
             $newevent->e_count = $count;
             $newevent->e_start = $start;
             $newevent->e_end = $end;
             $ColectorsMgr->colectors_work($config, $newevent);
             break;
         case 71:
             require_once 'functions/ColectorsMgr.php';
             $ColectorsMgr = new ColectorsMgr();
             $back = $ColectorsMgr->colectors_dismis($config, $town, $count);
             break;
         case 80:
             require_once 'functions/ThiefsMgr.php';
             $ThiefsMgr = new ThiefsMgr();
             $newevent->e_t_id = $town;
             $newevent->e_type = $type;
             $newevent->e_subtype = $subtype;
             $newevent->e_count = $count;
             $newevent->e_start = $start;
             $newevent->e_end = $end;
             $ThiefsMgr->thiefs_work($config, $newevent);
             break;
         case 81:
             require_once 'functions/ThiefsMgr.php';
             $ThiefsMgr = new ThiefsMgr();
             $back = $ThiefsMgr->thiefs_dismis($config, $town, $count);
             break;
         case 90:
             require_once 'functions/AssasinsMgr.php';
             $AssasinsMgr = new AssasinsMgr();
             $newevent->e_t_id = $town;
             $newevent->e_type = $type;
             $newevent->e_subtype = $subtype;
             $newevent->e_count = $count;
             $newevent->e_start = $start;
             $newevent->e_end = $end;
             $AssasinsMgr->assasins_battle($config, $newevent);
             break;
         case 91:
             require_once 'functions/AssasinsMgr.php';
             $AssasinsMgr = new AssasinsMgr();
             $AssasinsMgr->assasins_dismis($config, $town, $count);
             break;
         default:
             break;
     }
 }
Beispiel #16
0
 public function colectors_send($config, $player, $town, $count)
 {
     $town = textV($town);
     $count = (int) $count;
     if ($count < 1) {
         $msg = 'wyślij minimum 1 zwiadowcę';
     } else {
         $can = get_row($q = "select go_lvl from game_objects where go_type = 3 and go_subtype = 8 and go_t_id =" . $player->actual_town);
         if (empty($can)) {
             $msg = 'nie posiadasz zbieraczy';
         } elseif ($can->go_lvl < $count) {
             $msg = 'nie posiadasz zbieraczy';
         } else {
             $event_check = get_one("select count(*) from events where (e_type = 70 or e_type = 71) and e_done = 0 and e_t_id = " . $player->actual_town);
             if ($event_check > 9) {
                 $msg = 'masz już maksymalną ilość wysłanych grup zbieraczy';
             } else {
                 $can = get_row("select t_id, t_usr_id from towns where t_name ='" . $town . "' limit 1");
                 if (empty($can)) {
                     $msg = 'nie ma takiego miasta';
                 } else {
                     $y = get_row("select * from map where m_t_id =" . $can->t_id);
                     $x = get_row("select * from map where m_t_id =" . $player->actual_town);
                     if ($x->m_x != $y->m_x && $x->m_y == $y->m_y) {
                         $range = abs($y->m_x - $x->m_x) * 300;
                     } elseif ($x->m_x == $y->m_x && $x->m_y != $y->m_y) {
                         $range = abs($y->m_y - $x->m_y) * 300;
                     } else {
                         $range = floor(sqrt(pow(abs($y->m_x - $x->m_x), 2) + pow(abs($y->m_y - $x->m_y), 2))) * 300;
                     }
                     $tnow = get_one("select unix_timestamp()");
                     call("update game_objects set go_lvl = go_lvl - {$count} where go_type = 3 and go_subtype = 8 and go_t_id =" . $player->actual_town);
                     call("insert into colectors (co_counts) value (" . $count . ")");
                     $id = get_one("select last_insert_id()");
                     require_once 'functions/EventsMgr.php';
                     $EventMgr = new EventsMgr();
                     $EventMgr->event_add($config, $player->actual_town, 70, $can->t_id, $id, 0, $tnow, $tnow + $range, 0);
                     $msg = 'wysłano wyprawę do miasta ' . $town;
                 }
             }
         }
     }
     return $msg;
 }
Beispiel #17
0
function get_guest($myid)
{
    $myinfo = get_row('gid', 'zx_guest', 'wgid=' . $myid);
    $ip = GetIP();
    $browser = get_userAgent($_SERVER['HTTP_USER_AGENT']);
    $time = time();
    if (empty($myinfo)) {
        $result = get_insert('zx_guest', 'wgid,logins,last,lastip,browser', "'{$myid}',1,{$time},'{$ip}','{$browser}'");
    } else {
        $result = get_update('zx_guest', "last={$time},lastip='{$ip}',browser='{$browser}',logins=logins+1", 'wgid=' . $myid);
    }
    $myinfo = get_row('*', 'zx_guest', 'wgid=' . $myid);
    return $myinfo;
}
<?

require_once("../_shared/config.inc.php");
include_once("../_shared/func.inc.php");
open_db($db_host,$db_user,$db_passw,$datbase);
$data = get_row("referenz","name,pos,imgs","id='".$id."'");

if ($f_cancel) {
	echo "<script language=\"javascript\">window.close(this)</script>";
	exit;
}

if ($f_rem) {
	if ($data['imgs']) {
		$pics = explode("#",$data['imgs']);
		for ($x = 0; $x < 6; $x++) {
			if ($pics[$x] != "---") {
				unlink($img_ref.$id."_".$x."_sm.jpg");
				unlink($img_ref.$id."_".$x."_lg.jpg");
			}
		}
	}
	remove_data("referenz","id=".$id);
	update_data("referenz","pos=pos-1","pos>".$data['pos']);
	mysql_close;
	echo "<script language=\"javascript\">window.opener.location.href='list.php'</script>";
	echo "<script language=\"javascript\">window.close(this)</script>";
}

echo "<html>\n";
echo "<head>\n";
Beispiel #19
0
                 $echo .= "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><a href='?action=clan&act=forum&thread=" . $thread->thread . "'>" . $thread->title . "</a></td>\n\t\t\t\t\t\t<td>" . $thread->posts . "</td>\n\t\t\t\t\t\t<td>" . $thread->date . " | {$op}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t";
             }
             $echo .= "</table><hr/>";
         }
         $echo .= "\n\t\t\t<form action='?action=clan&act=forum' method='post'>\n\t\t\t\t<div class='box'>\n\t\t\t\t\t<div class='formbox'>\n\t\t\t\t\t\t<div class='row'>\n\t\t\t\t\t\t\tdodan nowy temat\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t<div class='row'>\n\t\t\t\t\t\t\ttytuł:\n\n\t\t\t\t\t\t\t<div class='right' style='margin:0px'>\n\t\t\t\t\t\t\t\t<input type='text' name='title' style='width:250px'/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class='row'>\n\t\t\t\t\t\t\ttreść:\n\t\t\t\n\t\t\t\t\t\t\t<div class='right' style='margin:0px'>\n\t\t\t\t\t\t\t<textarea class='form' id='msg' rows='8' cols='106' name='textf'></textarea>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t   \n\n\t\t\t\t\t\t<div class='buttonrow'>\n\t\t\t\t\t\t\t<input type='submit' value='dodaj' name='submit'>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t</form>\n\t\t\t";
         echo $echo;
     }
     break;
 case 'options':
     if ($player->clan_id == 0) {
         reload($config, 'clan');
     }
     if ($status != 2) {
         reload($config, 'clan');
     }
     $clan = get_row("select * from clans where c_id = " . $player->clan_id);
     if ($clan->herb > 0) {
         $av = "<img src='herb/" . $player->clan_id . ".jpg' alt='' style='max-width:150px; max-height:150px'/>";
     }
     echo "\n\t\t<form action='?action=clan&act=options' method='post' enctype='multipart/form-data'>\n\t\t<input type='hidden' name='MAX_FILE_SIZE' value='100000' />\t\t\t\t\n\t\t\t<div class='box'>\n\t\t\t\t<div class='formbox'>\n\t\t\t\t\t<div class='row'>\n\t\t\t\t\t\tZmień herb klanu\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div class='row'>\n\t\t\t\t\t\t\n\n\t\t\t\t\t\t<div class='left'>\n\t\t\t\t\t\t\t" . $av . "\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class='right'>\n\t\t\t\t\t\t<input name='avatar' type='file' />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t   \n\n\t\t\t\t\t<div class='buttonrow'>\n\t\t\t\t\t\t<input type='submit' value='zmień' name='submit'>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</form>\n\t\t<form action='?action=clan&act=options' method='post'>\n\t\t\t<div class='box'>\n\t\t\t\t<div class='formbox'>\n\t\t\t\t\t<div class='row'>\n\t\t\t\t\t\tZmień opis klanu\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div class='row'>\n\t\t\t\t\t\t\n\n\t\t\t\t\t\t<div class='right' style='margin:0px'>\n\t\t\t\t\t\t<textarea class='form' id='msg' rows='8' cols='106' name='opis'>" . st($clan->opis) . "</textarea>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t   \n\n\t\t\t\t\t<div class='buttonrow'>\n\t\t\t\t\t\t<input type='submit' value='zapisz' name='submit'>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t</form>\n\t\t";
     break;
 case 'list':
     $clans = get_all("select *, (select count(*) from clans_users where cu_c_id = c_id and cu_status > 0) as players, (select count(*) from towns inner join users on t_usr_id = usr_id inner join clans_users on cu_usr_id = usr_id and cu_c_id = clan_id where clan_id = c_id and cu_status > 0) as townc from clans ");
     if (is_array($clans)) {
         $echo = "\n\t\t\t\t<table>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Nazwa klanu</th>\n\t\t\t\t\t<th>Graczy</th>\n\t\t\t\t\t<th>Miast</th>\n\t\t\t\t\t<th></th>\n\t\t\t\t</tr>\n\t\t\t\t";
         foreach ($clans as $clan) {
             $echo .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td>" . $clan->c_name . "</td>\n\t\t\t\t\t<td>" . $clan->players . "</td>\n\t\t\t\t\t<td>" . $clan->townc . "</td>\n\t\t\t\t\t<td><a href='?action=clan&act=clan&id=" . $clan->c_id . "'>[ zobacz klan ]</a></td>\n\t\t\t\t</tr>";
         }
         $echo .= "</table>";
         echo $echo;
     }
Beispiel #20
0
function getSysInfo($config)
{
    $sys = get_row("select * from system limit 1");
    return $sys;
}
Beispiel #21
0
function get_row_layout()
{
    // vars
    $row = get_row();
    // return
    if (isset($row['acf_fc_layout'])) {
        return $row['acf_fc_layout'];
    }
    // return
    return false;
}
Beispiel #22
0
function getNumTesters($pid)
{
    $sql = sprintf("SELECT puzzle_idea.id, COUNT(test_queue.uid) FROM puzzle_idea\n        LEFT JOIN test_queue ON puzzle_idea.id=test_queue.pid\n        WHERE puzzle_idea.id='%s'", mysql_real_escape_string($pid));
    $result = get_row($sql);
    return $result['COUNT(test_queue.uid)'];
}
Beispiel #23
0
function Camper_Detail($id = null)
{
    global $db;
    ?>

<div class="box-body table-responsive">
<table class='table table-striped table-bordered table-condensed'>



<thead><tr><th>Camper Name </th><th> Contact No.</th><th>Email Id</th></tr></thead>
<tbody>
<?php 
    if ($id != null) {
        $camper = get_row('participant', 'p_id=' . $id);
    } else {
        $camper = get_row('participant', 'p_id=' . $_GET['pid']);
    }
    ?>
<tr>
<td><?php 
    echo $camper->p_fname . ' ' . $camper->p_mname . ' ' . $camper->p_lname;
    ?>
</td>
<td><?php 
    echo $camper->p_phn_s;
    ?>
</td>
<td><?php 
    echo $camper->p_email1;
    ?>
</td>

</tr>


</tbody>

</table>
</div>
<?php 
}
Beispiel #24
0
require_once '../../util.php';
if (count($argv) < 3) {
    echo "fix_badref [bank statement ID (bid)] [deposref]\n";
    exit(-1);
}
$bid = $argv[1];
$deposref = $argv[2];
$query = "\n    SELECT entry\n    FROM bank_statement\n    WHERE\n        bid='{$bid}'\n        AND reqid IS NULL\n        AND status='BADREF'\n    ";
$result = do_query($query);
if (!has_results($result)) {
    echo "No results found for bank statement {$bid}...\n";
    exit(-1);
}
$row = get_row($result);
$entry = $row['entry'];
$entry = split(',', $entry);
$amount = $entry[6];
$amount = numstr_to_internal($amount);
$query = "\n    SELECT uid\n    FROM users\n    WHERE deposref='{$deposref}'\n    ";
$result = do_query($query);
if (!has_results($result)) {
    echo "No user found with deposref of {$deposref}...\n";
    exit(-1);
}
$row = get_row($result);
$uid = $row['uid'];
$query = "\n    INSERT INTO requests (\n        req_type,\n        uid,\n        amount,\n        curr_type\n    ) VALUES (\n        'DEPOS',\n        {$uid},\n        {$amount},\n        '" . CURRENCY . "'\n    )";
do_query($query);
$query = "\n    UPDATE bank_statement\n    SET\n        reqid=LAST_INSERT_ID(),\n        status='FINAL'\n    WHERE\n        bid='{$bid}'\n        AND reqid is NULL\n        AND status='BADREF'\n    ";
do_query($query);
echo "Done.\n";
				$pic_tits[$x] = ${"f_pic_title_".$x};
			} else {
				$pic_tits[$x] = "---";
			}
		}
		$pic_titstr = implode("#",$pic_tits);
		$fields = implode(",",get_field_names("referenz"));
		$vals = "'".$id."','".addslashes($f_name)."','".addslashes($f_txt)."','".addslashes($pic_titstr)."','".$picstr."','".$pos."'";
		replace_data("referenz",$fields,$vals);
		echo "<script language=\"javascript\">self.location.href='list.php'</script>";
		exit;
	}
}

if ($init == "do") {
	$data = get_row("referenz","id,name,txt,img_titles,imgs,pos","id=".$id);
	$f_name = $data['name'];
	$f_txt = $data['txt'];
	$pos = $data['pos'];
	if ($data['img_titles']) {
		$pic_tits = explode("#",$data['img_titles']);
		for ($x = 0; $x < count($pic_tits); $x++) {
			${"f_pic_title_".$x} = $pic_tits[$x];
		}
	}
	$picstr = $data['imgs'];
	$init = "done";
} else {
	$list = get_arr("referenz","name,pos","","pos","");
}
        echo "Skipping payment in...\n";
        continue;
    }
    $name = $info[4];
    $name = trim($name, ' "');
    # trim off the BRITCOIN
    #$lastdot = strrpos($name, ' . ');
    #$name = substr($name, 0, $lastdot);
    #print_r($name);
    $amount = $info[5];
    echo "We paid {$amount} to {$name}.\n";
    $amount = numstr_to_internal($amount);
    $query = "\n        SELECT\n            requests.reqid AS reqid\n        FROM\n            requests\n        JOIN\n            uk_requests\n        ON\n            requests.reqid=uk_requests.reqid\n        WHERE\n            requests.req_type='WITHDR'\n            AND requests.curr_type='" . CURRENCY . "'\n            AND requests.amount='{$amount}'\n            AND uk_requests.name LIKE '{$name}%'\n        ";
    $result_lookup = do_query($query);
    if (!has_results($result_lookup)) {
        echo "ERROR: could not find this withdrawal!\n";
        break;
    }
    $row = get_row($result_lookup);
    $reqid = $row['reqid'];
    echo "reqid is {$reqid}\n\n";
    # now check that this request doesn't already have an entry
    $query = "\n        SELECT 1\n        FROM bank_statement\n        WHERE reqid='{$reqid}'\n        ";
    $result_lookup = do_query($query);
    if (has_results($result_lookup)) {
        echo "ERROR: this request id already has an entry in bank_statement.";
        break;
    }
    $query = "\n        UPDATE\n            bank_statement\n        SET\n            reqid='{$reqid}',\n            status='FINAL'\n        WHERE\n            bid='{$bid}'\n        ";
    b_query($query);
}
Beispiel #27
0
function show_links($is_logged_in, $is_admin, $is_verified)
{
    $show_duo = 0;
    if ($is_logged_in) {
        require_once 'db.php';
        $result = do_query("SELECT use_duo FROM users WHERE uid={$is_logged_in}");
        $row = get_row($result);
        $show_duo = !$row['use_duo'];
    }
    if (!$is_logged_in) {
        show_link('login', _('Login'), _('Begin here'));
    }
    show_link('news', _('News'), _("What's new?"));
    show_link('trade', _('Trade'), _('Buy and sell'));
    if ($is_logged_in) {
        show_link('profile', _('Profile'), _('Dox on you'));
    }
    if ($is_logged_in) {
        show_link('statement', _('Statement'), _('Chronological ledger'));
    }
    if ($is_logged_in) {
        show_link('deposit', _('Deposit'), _('Top up your account'));
    }
    if ($is_logged_in) {
        show_link('withdraw', _('Withdraw'), _('Take out money'));
    }
    show_link('orderbook', _('Orderbook'), _('Show orders'));
    if ($show_duo) {
        show_link('turn_on_duo', _('Security'), _('Use two-factor authentification'));
    }
    if ($is_logged_in && !$is_verified) {
        show_link('identity', _('Identify'), _('Upload ID to get your account verified'));
    }
    if (CHARTS_PAGE) {
        printf("<li><a target='_blank' href='%s'>%s</a>%s\n", CHARTS_PAGE, _('Charts'), _('From bitcoincharts.com'));
    }
    show_link('help', _('Help'), _('Seek support'));
    if ($is_admin) {
        show_link('docs', _('Docs'), _('Show docs from unverified users'), 1);
    }
    if ($is_admin) {
        show_link('users', _('Users'), _('Show registered users'), 1);
    }
    if ($is_admin) {
        show_link('add_cash', _('Add cash'), _('Deposit using bank statement'), 1);
    }
    if ($is_admin) {
        show_link('commission', _('Commission'), _('Show commission statement'), 1);
    }
    if ($is_admin) {
        show_link('bank', _('Bank'), _('Show bank statement &amp; pending withdrawals'), 1);
    }
    if ($is_admin) {
        show_link('freeze', _('Freeze'), _('Stop activity on the exchange'), 1);
    }
    if ($is_admin) {
        show_link('graph', _('Charts'), _('Various admin graphs'), 1);
    }
    if ($is_logged_in) {
        show_link('logout', _('Logout'), _('End this session'));
    }
    echo "<br/><g:plusone annotation=\"bubble\" href=\"https://www.worldbitcoinexchange.com/\"></g:plusone>\n";
}
Beispiel #28
0
 $mess->msg_read($config, $player->usr_id, $_GET['m_id']);
 switch ($_GET['type']) {
     case 1:
         $message = get_row("select m_id, m_text, m_type, login, avatar, usr_id, m_date, m_status from messages inner join users on m_from = usr_id where m_to = " . $player->usr_id . " and m_type = 1 and m_id =" . $_GET['m_id']);
         $from = "Wiadomość od {$message->login}";
         break;
     case 2:
         $message = get_row("select m_id, m_text, m_type, login,  avatar, usr_id, m_date from messages inner join users on m_to = usr_id where m_from = " . $player->usr_id . " and m_type = 2 and m_id =" . $_GET['m_id']);
         $from = "Wiadomość do {$message->login}";
         break;
     case 3:
         $message = get_row("select m_id, m_text, m_type, login, avatar, usr_id, m_date, m_status from messages inner join users on m_from = usr_id where m_to = " . $player->usr_id . " and m_type = 3 and m_id =" . $_GET['m_id']);
         $from = 'Raport';
         break;
     case 4:
         $message = get_row("select m_id, m_text, m_type, login, avatar, usr_id, m_date, m_status from messages inner join users on m_from = usr_id where m_to = " . $player->usr_id . " and m_type = 4 and m_id =" . $_GET['m_id']);
         $from = 'Info ';
         break;
 }
 if (!empty($message)) {
     if ($_GET['type'] == 1) {
         $options = "\n\t\t\t\t<a id='delete' href='?action=messages&type=1&m_id={$message->m_id}&del=1'>[ usuń ]</a> | \n\t\t\t\t<a id='reply'  href='?action=messages&to={$message->login}'>[ odpowiedz ]</a>\n\t\t\t";
     } elseif ($_GET['type'] == 3) {
         $options = "\n\t\t\t\t<a id='delete' href='?action=messages&type=3&m_id={$message->m_id}&del=1'>[ usuń ]</a> \n\t\t\t";
     } elseif ($_GET['type'] == 4) {
         $options = "\n\t\t\t\t<a id='delete' href='?action=messages&type=4&m_id={$message->m_id}&del=1'>[ usuń ]</a> \n\t\t\t";
     } else {
         $options = "\n\t\t\t\t<a id='delete' href='?action=messages&type=2&m_id={$message->m_id}&del=1'>[ usuń ]</a>\n\t\t\t";
     }
     if ($message->avatar == 0) {
         $av = "<img src='avatar/noavatar.png' alt='user avatar' />";
Beispiel #29
0
function btc_pending_withdrawal()
{
    $result = do_query("\n        SELECT SUM(amount) AS sum\n        FROM requests\n        WHERE req_type = 'WITHDR'\n        AND curr_type = 'BTC'\n        AND status = 'VERIFY'\n    ");
    $row = get_row($result);
    $sum = $row['sum'];
    if (!$sum) {
        $sum = '0';
    }
    return $sum;
}
Beispiel #30
0
    }
}
// For event page OR project page: show artists
if ($table == 'events' || $table == 'projects') {
    $artists = explode(',', $content['artists_array']);
    if (!empty($artists[0])) {
        // keep first artist listed in place, shuffle the rest of the artists
        $first_artist = array_shift($artists);
        shuffle($artists);
        // mix it up
        array_unshift($artists, $first_artist);
        // add the first back on
        echo "<h3>Artists:</h3>";
        foreach ($artists as $artist) {
            $artist_slug = $artist;
            $artist = get_row('artists', 'slug', $artist);
            $pic = $artist['pic'];
            $name = $artist['name'];
            $url = $site_url . '/artists/' . $artist_slug;
            output_related_post($url, $pic, $name);
        }
    }
}
// For artists page: show projects
if ($table == 'artists') {
    $projects = search_table('projects', 'artists_array', $slug);
    if (mysqli_num_rows($projects)) {
        echo "<h3>Works On:</h3>";
        while ($project = mysqli_fetch_assoc($projects)) {
            $pic = $project['pic'];
            $name = $project['name'];