Exemplo n.º 1
0
function first_schedule($tournament, $members, $numplayers)
{
    global $stage, $id, $fights, $num;
    $id = $tournament;
    $q = select("select * from ft_tournaments where TournamentID='{$id}'");
    if ($q[StatusID] != 0) {
        return 0;
    }
    if ($members + 1 != $numplayers) {
        return 0;
    }
    $r = select("select * from ft_stages where TournamentTypeID={$q['TournamentTypeID']}  and Tour1=1 limit 0,1");
    $res2 = runsql("select * from ft_tournament_members where TournamentID='{$id}' order by rand()");
    for ($k = 1; $k <= $numplayers; $k++) {
        $r2 = mysql_fetch_array($res2);
        $users[$k] = $r2[UserID];
    }
    if ($r[TypeID] == 0) {
        for ($k = 1; $k <= $numplayers; $k++) {
            runsql("update ft_tmp_agreements set UserID1='{$users[$k]}',\nLogin1=(select concat(if(GuildID>0 and GuildStatusID=1,concat('<img src=/images/gd_guilds/small/',GuildID,'.jpg border=0 align=absmiddle>','</a> '),''),'<a href=/users/',UserID,'/>',Login,'</a>') from ut_users where UserID='{$users[$k]}') \n where TournamentID='{$id}' and Tour=1 and Pair1='{$k}'");
            runsql("update ft_tmp_agreements set UserID2='{$users[$k]}',\nLogin2=(select concat(if(GuildID>0 and GuildStatusID=1,concat('<img src=/images/gd_guilds/small/',GuildID,'.jpg border=0 align=absmiddle>','</a> '),''),'<a href=/users/',UserID,'/>',Login,'</a>') from ut_users where UserID='{$users[$k]}') \n where TournamentID='{$id}' and Tour=1 and Pair2='{$k}'");
        }
    } else {
        for ($k = 1; $k <= $numplayers; $k++) {
            runsql("update ft_tmp_agreements set UserID1='{$users[$k]}',\nLogin1=(select concat(if(GuildID>0 and GuildStatusID=1,concat('<img src=/images/gd_guilds/small/',GuildID,'.jpg border=0 align=absmiddle>','</a> '),''),'<a href=/users/',UserID,'/>',Login,'</a>') from ut_users where UserID='{$users[$k]}') \n where TournamentID='{$id}' and Stage=1 and Pair1='{$k}'");
            runsql("update ft_tmp_agreements set UserID2='{$users[$k]}',\nLogin2=(select concat(if(GuildID>0 and GuildStatusID=1,concat('<img src=/images/gd_guilds/small/',GuildID,'.jpg border=0 align=absmiddle>','</a> '),''),'<a href=/users/',UserID,'/>',Login,'</a>') from ut_users where UserID='{$users[$k]}') \n where TournamentID='{$id}' and Stage=1 and Pair2='{$k}'");
            runsql("update ft_groups set UserID='{$users[$k]}',Login=(select concat(if(GuildID>0 and GuildStatusID=1,concat('<a href=/guilds/',GuildID,'><img src=/images/gd_guilds/small/',GuildID,'.jpg border=0 align=absmiddle>','</a> '),''),'<a href=/users/',UserID,'/>',Login,'</a>') from ut_users where UserID='{$users[$k]}') where TournamentID='{$id}' and Stage=1 and Pair='{$k}'");
        }
    }
    runsql("delete from ft_agreements where TournamentID='{$id}'");
    runsql("insert into ft_agreements\n(UserID1,UserID2,TypeID,ExtraGlad,LimitGlad,LimitSkl,Timeout,TournamentID,Stage,Tour,Fight,Pair,NumFights,StageTypeID,Approved,StatusID,Date,Login1,Login2) \n(select UserID1,UserID2,TypeID,ExtraGlad,LimitGlad,LimitSkl,Timeout,TournamentID ,Stage,Tour,Fight,Pair,NumFights,StageTypeID, 1,2,unix_timestamp(),Login1,Login2\nfrom ft_tmp_agreements where TournamentID='{$id}' and Tour=1 and Fight=1)");
    runsql("update ft_tournaments set StatusID=1 where TournamentID='{$id}'");
}
Exemplo n.º 2
0
 function DrawPart($parent, $pref)
 {
     $res = runsql("select t.{$this->id},t.Name_\$lang; as Name from {$this->table} t left outer join {$this->table} p on p.{$this->id}=t.{$this->id} where t.Parent='{$parent}' and t.{$this->id}<>t.Parent group by t.{$this->id} order by t.Name_\$lang;");
     if (mysql_error()) {
         print mysql_error();
         exit;
     }
     while ($r = mysql_fetch_array($res)) {
         $num++;
         unset($str);
         if ($pref) {
             $str = "{$pref}";
         }
         if ($this->numbered == 1) {
             $str .= "{$num}.";
         } elseif ($parent != '0') {
             $str .= "&nbsp;&nbsp;";
         }
         if ($this->type == "select") {
             print " <option value=\"{$r['0']}\"";
             if ($r[0] == $this->val) {
                 print " selected";
             }
             print ">{$str} {$r['1']}</option>";
         } else {
             print "{$str} <a href=\"{$PHP_SELF}?id={$r['0']}\">{$r['1']}</a>";
             print "<br>";
         }
         $r[types] += $this->DrawPart($r[0], $str);
     }
     return $r[types];
 }
Exemplo n.º 3
0
function savetag($item, $key, $wid)
{
    global $tbpref;
    if (!in_array($item, $_SESSION['TAGS'])) {
        runsql('insert into ' . $tbpref . 'tags (TgText) values(' . convert_string_to_sqlsyntax($item) . ')', "");
        get_tags($refresh = 1);
    }
    runsql('insert ignore into ' . $tbpref . 'wordtags (WtWoID, WtTgID) select ' . $wid . ', TgID from ' . $tbpref . 'tags where TgText = ' . convert_string_to_sqlsyntax($item), "");
}
Exemplo n.º 4
0
function update($conn, $tablename, $targettablename, $sql, $count)
{
    $recs = reccount($conn, $tablename);
    $added = addedcount($conn, $targettablename);
    echo "\n Records - " . $recs;
    $attempts = get_attempts($recs - $added, $count);
    for ($x = 0; $x < $attempts; $x++) {
        $start = $added + $x * $count;
        $tmp = $sql . " LIMIT " . $start . "," . $count . ";";
        //echo "\n" . $tmp;
        runsql($conn, $tmp);
    }
}
Exemplo n.º 5
0
 function rec($id)
 {
     global $_GET, $type, $_POST;
     $q = select("select AnswerID from ut_messages where MessageID='{$id}'");
     $row = runsql("select * from ut_messages where  MessageID='{$q['0']}'");
     if (mysql_num_rows($row)) {
         while ($r1 = mysql_fetch_array($row)) {
             print "<img src=/images/hr.gif height=10px width=473px style=\"margin-top:5px;margin-bottom:5px\">";
             $_GET['id'] = $r1[MessageID];
             $f = new cls_form($type, "message");
             $f->Draw();
         }
         rec($q[0]);
     }
 }
Exemplo n.º 6
0
function block_sql($paramarr, $multicachekey = '', $returncount = 0)
{
    global $_G, $_SGLOBAL, $_GET, $_SERVER;
    if (!empty($paramarr['sql'])) {
        require_once B_ROOT . './source/function/block_sql.func.php';
        if ($returncount > 0) {
            return runsql($paramarr, '', 1);
        }
        list($sqlstring, $listcount) = runsql($paramarr, '', 0, $multicachekey);
        if (!empty($paramarr['perpage'])) {
            if ($listcount) {
                $urlarr = $_GET;
                foreach ($urlarr as $key => $value) {
                    if (empty($value)) {
                        unset($urlarr[$key]);
                    } else {
                        $urlarr[$key] = rawurlencode($urlarr[$key]);
                    }
                }
                unset($urlarr['page']);
                $phpurl = arraytostring($urlarr, '=', '&');
                $phpurl = $phpurl ? 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'] . '?' . $phpurl : 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'];
                $theblockarr['multipage'] = multi($listcount, $paramarr['perpage'], $_GET['page'], rawurldecode($phpurl), 1);
                $theblockarr['listcount'] = $listcount;
            }
        }
    }
    //查詢數據
    if ($listcount) {
        //查詢
        $query = DB::query($sqlstring);
        while ($value = DB::fetch($query)) {
            if (isset($value['subjectimage'])) {
                $value['thumb'] = getattachurl($value['subjectimage'], 1);
                $value['subjectimage'] = getattachurl($value['subjectimage']);
            }
            $theblockarr[] = $value;
        }
    }
    return $theblockarr;
}
Exemplo n.º 7
0
function drawpanel($id, $blocks)
{
    global $auth, $lang;
    print "<center><table border=0 cellspacing=0 cellpadding=5><td valign=top width=160px>";
    $res = runsql("select m1.*,m1.Name_{$lang} as name,count(m2.MenuID) as cnt from en_menu m1\n\nleft outer join en_menu m2 on m2.Parent=m1.MenuID\nwhere m1.Parent='{$id}'\ngroup by m1.MenuID\n order by Rang");
    $num = 0;
    while ($r = mysql_fetch_array($res)) {
        if ($r[cnt] > 0) {
            if ($num > 0 && $num % $blocks == 0 && $num < $blocks * 3) {
                print "</td><td valign=top width=160px>";
            }
            $num++;
            print "<table border=0 width=100% cellspacing=1 cellpadding=3 bgcolor=d3d3d3 ><td class=header>";
            $r = printmenu($r);
            print "<center><b>{$r['name']}</b></a></center>";
            print "</td></table>";
            $res1 = runsql("select m1.*,m1.Name_{$lang} as name,count(m2.MenuID) as cnt from en_menu m1\n\nleft outer join en_menu m2 on m2.Parent=m1.MenuID\nwhere m1.Parent='{$r['MenuID']}'\ngroup by m1.MenuID\n order by Rang");
            while ($r1 = mysql_fetch_array($res1)) {
                print "<table border=0 width=100% cellspacing=1 cellpadding=3  bgcolor=d3d3d3 ><td bgcolor=FFFAE4>";
                $r1 = printmenu($r1);
                if (!$r1[cnt]) {
                    print "» <a href=\"{$r1['Url']}\" {$r1['Target']}>{$r1['name']}</a><br>";
                } else {
                    print "» {$r1['name']}<br>";
                }
                $res2 = runsql("select *,Name_{$lang} as name from en_menu where Name_{$lang}<>'{$r1['Name']}' and Parent='{$r1['MenuID']}' order by Rang");
                while ($r2 = mysql_fetch_array($res2)) {
                    $r2 = printmenu($r2);
                    print "&nbsp;&nbsp; -  <a href=\"{$r2['Url']}\" {$r2['Target']}>{$r2['name']}</a><br>";
                }
                print "</td></table>";
            }
            print "<br>";
        }
    }
    print "</table>";
}
Exemplo n.º 8
0
<?php 
include "../include/functions.php";
include "../include/db.php";
?>

<?php 
include "../include/params.php";
include "../include/dictionary2.php";
session_start();
opendb();
$opis = getQUERY("o");
$rbr = getQUERY("rbr");
$h = getQUERY("h");
$ppid = getQUERY("ppid");
$pointkm = getQUERY("pointkm");
$pointtime = getQUERY("pointtime");
$h1 = getQUERY("h1");
$predefined = getQUERY("predefined");
$sqlInsert = "insert into rnalogdetail (opis, ppid, hederid, rbr, poikm, poitime) values ('" . $opis . "', " . $ppid . ", " . $h . ", " . $rbr . ", " . $pointkm . ", " . $pointtime . ") ";
runsql($sqlInsert);
if ($predefined . '' == 'true') {
    $sqlInsert = "insert into rnalogdetailpre (opis, ppid, hederid, rbr, poikm, poitime) values ('" . $opis . "', " . $ppid . ", " . $h1 . ", " . $rbr . ", " . $pointkm . ", " . $pointtime . ") ";
    runsql($sqlInsert);
}
print "OK";
closedb();
Exemplo n.º 9
0
    ?>
]</td></tr>

<?php 
    $gladiator[Level] = $q[Level];
    ?>
<form name="distribution" method="post" enctype="multipart/form-data" action="/xml/gladiators/level.php?type=gladiators/train&act=distribution">
<input type="hidden" name="step" value="1"/>
<input type="hidden" name="id" value="<?php 
    echo $id;
    ?>
"/>


<?php 
    $res = runsql("select *,Name_{$lang} as Name from ut_abilities where AbilityID>=1 and AbilityID<=6 order by AbilityID");
    while ($r = mysql_fetch_array($res)) {
        if ($r[AbilityID] <= 2) {
            print "<tr bgcolor=#545E61><td>{$r['Name']}</td><td >" . $gladiator[$r[Ability]] . "</td></tr>";
        } else {
            print "<tr bgcolor=#545E61><td>{$r['Name']}</td><td>\n<input type=\"button\" onclick=\"changeAbility('{$r['Ability']}',-1)\" id=\"{$r['Ability']}Minus\" class=disabledbutton style=\"width:20;\" value=\"-\"> \n<input type=\"string\" id=\"{$r['Ability']}\" size=\"2\" name=\"{$r['Ability']}\" readonly class=clear style=\"text-align:center;height:16px\" value=\"" . $gladiator[$r[Ability]] . "\"> \n<input type=\"hidden\" id=\"Cur{$r['Ability']}\" value=\"" . $gladiator[$r[Ability]] . "\"> \n<input type=\"button\" onclick=\"changeAbility('{$r['Ability']}',1)\" id=\"{$r['Ability']}Plus\" class=bluebutton style=\"width:20\" value=\"+\"></td>";
        }
        if ($r[AbilityID] == 2) {
            print "<tr bgcolor=#545E61><td colspan=3>" . message(251) . ": <input type=\"string\" size=\"2\" name=\"Points\" id=\"Points\" readonly class=clear value=\"{$points}\" > </td></tr>";
        }
    }
    ?>
<tr><td colspan=3 bgcolor=#68717>
<input class=disabledbutton type=submit id="Submit" 
value=—охранить onclick="this.disabled = true; this.className='disabledbutton';
document.getElementById('VitMinus').disabled = true; 
Exemplo n.º 10
0
        print "\r\n                <tr>\r\n                  <td width=\"130\" align=\"center\" valign=\"top\"><img src=\"{$img_url}?id={$r['MaterialID']}&record=2\" alt=\"\" width=\"69\"></td>\r\n                  <td valign=\"top\"><h5>" . $r[Title] . "</h5>\r\n                    <p>" . $r[Headline] . "</p>\r\n                    <p align=\"right\"><a href=\"{$site_url}" . "news.php?id={$r['MaterialID']}\" class=\"lnk\">подробнее</a></p></td>\r\n                </tr>\r\n\t     ";
    }
    ?>
              </table>
<?php 
    print "<table width=100% cellspacing=0 cellpadding=2 border=0>";
    $form->Pages('');
    print "</table>";
    ?>
    
          </td>
            </tr>
            <tr>
            
              <td valign="top"><img src="images/mid/shad2.jpg" alt="" width="248" height="27"></td>

            </tr>

          </table>
<?php 
} else {
    $res = runsql("select MaterialID,Date,Headline_{$lang} as Headline, Name_{$lang} as Title, Message_{$lang} as Message, Small from ut_materials where MaterialID={$id}");
    while ($r = mysql_fetch_array($res)) {
        print "\r\n\t\t\t<h3>" . $r[Title] . "</h3><br>";
        if ($r[Small]) {
            print "<img src=\"{$img_url}?id={$r['MaterialID']}&record=1\" alt=\"{$r['Title']}\" align=\"left\" style=\"margin-right: 6px;\"></img>";
        }
        print "<p>" . settags($r[Message]) . "</p>";
    }
}
require "bottom.php";
Exemplo n.º 11
0
    ?>
images/text-guest.gif" alt="" width="172" height="17" border="0"></a></td>
                      <td><a href="/screenshots.php"><img src="<?php 
    echo $site_url;
    ?>
images/text-screenshots.gif" alt="" width="121" height="17" border="0"></a></td>
                    </tr>
                  </table>
<?php 
    if ($type != "main/screenshots") {
        ?>
				  
		<table width="500" border="0" cellspacing="8" cellpadding="0" style="margin: 0px 0px 0px 16px;">
                    <tr>
<?php 
        $res = runsql("select ScreenshotID,Name_{$lang} as Name from ut_screenshots order by rand() limit 0,3");
        while ($r = mysql_fetch_array($res)) {
            ?>
                            <td width="33%" align="center" valign="top">

	<?php 
            print "<a href=\"screen.php?record=14&amp;id={$r['0']}\">";
            print "<img src=\"/images/ut_screenshots/small/{$r['0']}.jpg\" border=0 ";
            if ($r[Name]) {
                print " alt=\"{$r['Name']}\" title=\"{$r['Name']}\"";
            }
            print "/> \n";
            ?>
	</a></td>
<?php 
        }
Exemplo n.º 12
0
<?php

$type = "products";
require "up.php";
if (!$id) {
    $id = '3';
}
$res = runsql("select p.*, p.Name_{$lang} as Name, p.Description_{$lang} as Description, t.Name_{$lang} as Type from ut_products p \r\nleft outer join ut_product_types t using(TypeID) where ProductID={$id}");
$r = mysql_fetch_array($res);
print "\r\n\t<h3>" . $r[Name] . "</h3><br>\r\n     \t<h5> ласс: " . $r[Type] . "</h5><br>";
if ($r[Image]) {
    print "<img src=\"{$img_url}?id={$r['ProductID']}&record=9\"><br>";
}
print settags($r[Description]);
require "bottom.php";
Exemplo n.º 13
0
    if ($stchange > 0) {
        $stchange = 1;
    }
} else {
    $stchange = $stchange + 0;
    $status = $oldstatus + $stchange;
    if ($status < 1) {
        $status = 1;
    }
    if ($status > 5) {
        $status = 5;
    }
}
$word = get_first_value("select WoText as value from words where WoID = " . $wid);
pagestart("Term: " . $word, false);
$m1 = runsql('update words set WoStatus = ' . $status . ', WoStatusChanged = NOW(),' . make_score_random_insert_update('u') . ' where WoID = ' . $wid, 'Status changed');
$newscore = get_first_value('select greatest(0,round(WoTodayScore,0)) AS value from words where WoID = ' . $wid) + 0;
if ($oldstatus == $status) {
    echo '<p>Status ' . get_colored_status_msg($status) . ' not changed.</p>';
} else {
    echo '<p>Status changed from ' . get_colored_status_msg($oldstatus) . ' to ' . get_colored_status_msg($status) . '.</p>';
}
echo "<p>Old score was " . $oldscore . ", new score is now " . $newscore . ".</p>";
$totaltests = $_SESSION['testtotal'];
$wrong = $_SESSION['testwrong'];
$correct = $_SESSION['testcorrect'];
$notyettested = $totaltests - $correct - $wrong;
if ($notyettested > 0) {
    if ($stchange >= 0) {
        $_SESSION['testcorrect']++;
    } else {
Exemplo n.º 14
0
$type = "city/market";
$_POST['user'] = $user;
$res = select("select MarketDate from ut_users where UserID='{$auth->user}'");
if (date("d", mktime() - 5 * 3600) != date("d", $res[0]) || date("m", mktime() - 5 * 3600) != date("m", $res[0])) {
    runsql("update ut_users set MarketDate=unix_timestamp()-5*3600 where UserID='{$auth->user}'");
    runsql("delete from ut_slaves where UserID='{$auth->user}'");
    runsql("insert into ut_slaves (TypeID, CountryID, Age, Talent, Height, Weight, UserID)\n(select @t:=\n(select TypeID from ut_gladiator_types where TypeID<8 order by rand() limit 1) as TypeID,\n(select CountryID from ut_gladiator_countries where TypeID=@t order by Rate*rand()*rand() desc,Rate desc limit 1) as CountryID,\n@age:=round(18+20*rand()) as Age,\n\n@talent:=if((select @a:=(1000*rand()))>0,\nif(@a<90,1,if(@a<280,2,if(@a<550,3,if(@a<740,4,if(@a<850,5,if(@a<950,6,if(@a<995,7,if(@a<999,8,9)))))))),\nif(@a<90,1,if(@a<280,2,if(@a<550,3,if(@a<740,4,if(@a<850,5,if(@a<950,6,if(@a<995,7,if(@a<999,8,9))))))))\n) as Talent, \n@h:=round(160+30*rand())+(select Height from ut_gladiator_types where TypeID=@t) as Height, \nround(@h-115+50*rand())+(select Weight from ut_gladiator_types where TypeID=@t) as Weight,\n\n'{$auth->user}' as UserID\n\nfrom en_numbers where Number<11)");
    $res = runsql("select CountryID,GladiatorID from ut_slaves where UserID='{$auth->user}'");
    while ($r = mysql_fetch_array($res)) {
        unset($a);
        $level = mt_rand(1, 5);
        for ($i = 1; $i <= $level * 3; $i++) {
            $a[mt_rand(0, 3)] += 1;
        }
        $n = select("select Name from ut_gladiator_names where CountryID='{$r['CountryID']}' order by rand() limit 1");
        runsql("update ut_slaves g set Name='{$n['Name']}',Level='{$level}',Acc=1+'{$a['0']}',Vit=1+'{$a['1']}',Str=1+'{$a['2']}',Dex=1+'{$a['3']}',\nPrice=round(power(1.18,'{$level}')*(12/(10-Talent)-1)*(select Coefficient from ut_gladiator_types where TypeID=g.TypeID)*1.5*EXP((Age-23)*(Age-23)/-200)*100) where GladiatorID='{$r['GladiatorID']}'");
    }
}
require $site_path . "up.php";
if ($form_ok) {
    $form = new cls_form($type, 'select');
    $act = "select";
}
require $site_path . "left.php";
?>
<center><img src="/images/art/market.jpg" width=500px height=300px></center>
<?php 
$r1 = select("select sum(Slots) as Slots from tm_buildings where UserID='{$auth->user}'");
foreach ($auth->rst[Gladiators] as $k => $v) {
    $t = $v[TypeID];
    $q = select("select Slots from ut_gladiator_types where TypeID='{$t}'");
Exemplo n.º 15
0
Developed by J. Pierre in 2011.
***************************************************************/
/**************************************************************
Call: delete_mword.php?wid=[wordid]&tid=[textid]
Delete an expression 
***************************************************************/
include "connect.inc.php";
include "settings.inc.php";
include "utilities.inc.php";
$showAll = getSetting('showallwords');
$showAll = $showAll == '' ? 1 : ((int) $showAll != 0 ? 1 : 0);
$tid = $_REQUEST['tid'];
$wid = $_REQUEST['wid'];
$word = get_first_value("select WoText as value from words where WoID = " . $wid);
pagestart("Term: " . $word, false);
$m1 = runsql('delete from words where WoID = ' . $wid, '');
adjust_autoincr('words', 'WoID');
echo "<p>OK, term deleted (" . $m1 . ").</p>";
?>
<script type="text/javascript">
//<![CDATA[
var context = window.parent.frames['l'].document;
var contexth = window.parent.frames['h'].document;
$('.word<?php 
echo $wid;
?>
', context).removeClass('status1 status2 status3 status4 status5 status98 status99 word<?php 
echo $wid;
?>
').addClass('hide').attr('data_status','').attr('data_trans','').attr('data_rom','').attr('data_wid','').attr('title','');
$('#learnstatus', contexth).html('<?php 
Exemplo n.º 16
0
function savetag($item, $key, $wid)
{
    global $tbpref;
    runsql('insert into ' . $tbpref . 'tags (TgText) values(' . convert_string_to_sqlsyntax($item) . ')', "");
    runsql('insert into ' . $tbpref . 'wordtags (WtWoID, WtTgID) select ' . $wid . ', TgID from ' . $tbpref . 'tags where TgText = ' . convert_string_to_sqlsyntax($item), "");
}
Exemplo n.º 17
0
 function TourName($large)
 {
     $res = runsql("select Name_\$lang; as Name,Tour1,Tour2,Reglament from ut_reglaments where TournamentID='{$this->tournament}' and (Tour1<={$this->tour} and Tour2>={$this->tour}) ");
     $r = mysql_fetch_array($res);
     return TName($this->tour, $r, $large);
 }
Exemplo n.º 18
0
Setting all unknown words to Well Known (99)
***************************************************************/
require_once 'settings.inc.php';
require_once 'connect.inc.php';
require_once 'dbutils.inc.php';
require_once 'utilities.inc.php';
$langid = get_first_value("select TxLgID as value from " . $tbpref . "texts where TxID = " . $_REQUEST['text']);
pagestart("Setting all blue words to Well-known", false);
$sql = 'select distinct TiText, TiTextLC from (' . $tbpref . 'textitems left join ' . $tbpref . 'words on (TiTextLC = WoTextLC) and (TiLgID = WoLgID)) where TiIsNotWord = 0 and WoID is null and TiWordCount = 1 and TiTxID = ' . $_REQUEST['text'] . ' order by TiOrder';
$res = do_mysql_query($sql);
$count = 0;
$javascript = "var title='';";
while ($record = mysql_fetch_assoc($res)) {
    $term = $record['TiText'];
    $termlc = $record['TiTextLC'];
    $count1 = 0 + runsql('insert into ' . $tbpref . 'words (WoLgID, WoText, WoTextLC, WoStatus, WoStatusChanged,' . make_score_random_insert_update('iv') . ') values( ' . $langid . ', ' . convert_string_to_sqlsyntax($term) . ', ' . convert_string_to_sqlsyntax($termlc) . ', 99 , NOW(), ' . make_score_random_insert_update('id') . ')', '');
    $wid = get_last_key();
    if ($count1 > 0) {
        $javascript .= "title = make_tooltip(" . prepare_textdata_js($term) . ",'*','','99');";
    }
    $javascript .= "\$('.TERM" . strToClassName($termlc) . "', context).removeClass('status0').addClass('status99 word" . $wid . "').attr('data_status','99').attr('data_wid','" . $wid . "').attr('title',title);";
    $count += $count1;
}
mysql_free_result($res);
echo "<p>OK, you know all " . $count . " word(s) well!</p>";
?>
<script type="text/javascript">
//<![CDATA[
var context = window.parent.frames['l'].document;
var contexth = window.parent.frames['h'].document;
<?php 
Exemplo n.º 19
0
    $allaction = $_REQUEST['allaction'];
    if ($allaction == 'delall') {
        $message = runsql('delete from tags where (1=1) ' . $wh_query, "Deleted");
        runsql("DELETE wordtags FROM (wordtags LEFT JOIN tags on WtTgID = TgID) WHERE TgID IS NULL", '');
        adjust_autoincr('tags', 'TgID');
    }
} elseif (isset($_REQUEST['del'])) {
    $message = runsql('delete from tags where TgID = ' . $_REQUEST['del'], "Deleted");
    runsql("DELETE wordtags FROM (wordtags LEFT JOIN tags on WtTgID = TgID) WHERE TgID IS NULL", '');
    adjust_autoincr('tags', 'TgID');
} elseif (isset($_REQUEST['op'])) {
    // INSERT
    if ($_REQUEST['op'] == 'Save') {
        $message = runsql('insert into tags (TgText, TgComment) values(' . convert_string_to_sqlsyntax($_REQUEST["TgText"]) . ', ' . convert_string_to_sqlsyntax_nonull($_REQUEST["TgComment"]) . ')', "Saved");
    } elseif ($_REQUEST['op'] == 'Change') {
        $message = runsql('update tags set TgText = ' . convert_string_to_sqlsyntax($_REQUEST["TgText"]) . ', TgComment = ' . convert_string_to_sqlsyntax_nonull($_REQUEST["TgComment"]) . ' where TgID = ' . $_REQUEST["TgID"], "Updated");
    }
}
// NEW
if (isset($_REQUEST['new'])) {
    ?>

	<h4>New Tag</h4>
	<form name="newtag" class="validate" action="<?php 
    echo $_SERVER['PHP_SELF'];
    ?>
" method="post">
	<table class="tab3" cellspacing="0" cellpadding="5">
	<tr>
	<td class="td1 right">Tag:</td>
	<td class="td1"><input class="notempty setfocus noblanksnocomma" type="text" name="TgText" data_info="Tag" value="" maxlength="20" size="20" /> <img src="icn/status-busy.png" title="Field must not be empty" alt="Field must not be empty" /></td>
Exemplo n.º 20
0
    $allaction = $_REQUEST['allaction'];
    if ($allaction == 'delall') {
        $message = runsql('delete from ' . $tbpref . 'tags where (1=1) ' . $wh_query, "Deleted");
        runsql("DELETE " . $tbpref . "wordtags FROM (" . $tbpref . "wordtags LEFT JOIN " . $tbpref . "tags on WtTgID = TgID) WHERE TgID IS NULL", '');
        adjust_autoincr('tags', 'TgID');
    }
} elseif (isset($_REQUEST['del'])) {
    $message = runsql('delete from ' . $tbpref . 'tags where TgID = ' . $_REQUEST['del'], "Deleted");
    runsql("DELETE " . $tbpref . "wordtags FROM (" . $tbpref . "wordtags LEFT JOIN " . $tbpref . "tags on WtTgID = TgID) WHERE TgID IS NULL", '');
    adjust_autoincr('tags', 'TgID');
} elseif (isset($_REQUEST['op'])) {
    // INSERT
    if ($_REQUEST['op'] == 'Save') {
        $message = runsql('insert into ' . $tbpref . 'tags (TgText, TgComment) values(' . convert_string_to_sqlsyntax($_REQUEST["TgText"]) . ', ' . convert_string_to_sqlsyntax_nonull($_REQUEST["TgComment"]) . ')', "Saved", $sqlerrdie = FALSE);
    } elseif ($_REQUEST['op'] == 'Change') {
        $message = runsql('update ' . $tbpref . 'tags set TgText = ' . convert_string_to_sqlsyntax($_REQUEST["TgText"]) . ', TgComment = ' . convert_string_to_sqlsyntax_nonull($_REQUEST["TgComment"]) . ' where TgID = ' . $_REQUEST["TgID"], "Updated", $sqlerrdie = FALSE);
    }
}
// NEW
if (isset($_REQUEST['new'])) {
    ?>

	<h4>New Tag</h4>
	<script type="text/javascript" src="js/unloadformcheck.js" charset="utf-8"></script>	
	<form name="newtag" class="validate" action="<?php 
    echo $_SERVER['PHP_SELF'];
    ?>
" method="post">
	<table class="tab3" cellspacing="0" cellpadding="5">
	<tr>
	<td class="td1 right">Tag:</td>
Exemplo n.º 21
0
function block_uchspace($paramarr)
{
    global $_SGLOBAL, $_SC, $_SGET;
    dbconnect(2);
    if (empty($paramarr['sql'])) {
        $sql = array();
        $sql['select'] = 'SELECT s.*';
        $sql['from'] = 'FROM ' . tname('space', '2') . ' s';
        if (!empty($paramarr['showdetail'])) {
            $sql['select'] = 'SELECT sf.*, s.*';
            $sql['from'] .= ' LEFT JOIN ' . tname('spacefield', '2') . ' sf ON sf.uid=s.uid';
        }
        $wherearr = array();
        //where
        if (!empty($paramarr['uid'])) {
            $paramarr['uid'] = getdotstring($paramarr['uid'], 'int');
            if ($paramarr['uid']) {
                $wherearr[] = 's.uid IN (' . $paramarr['uid'] . ')';
            }
        } else {
            if (!empty($paramarr['avatar'])) {
                if ($paramarr['avatar'] == 1) {
                    $wherearr[] = 's.avatar = 0';
                } else {
                    $wherearr[] = 's.avatar = 1';
                }
            }
            $scopequery = getscopequery('s', 'viewnum', $paramarr);
            if (!empty($scopequery)) {
                $wherearr[] = $scopequery;
            }
            $scopequery = getscopequery('s', 'friendnum', $paramarr);
            if (!empty($scopequery)) {
                $wherearr[] = $scopequery;
            }
        }
        $sql['where'] = '';
        if (!empty($wherearr)) {
            $sql['where'] = 'WHERE ' . implode(' AND ', $wherearr);
        }
        //order
        if (!empty($paramarr['order'])) {
            $sql['order'] = 'ORDER BY ' . $paramarr['order'];
        }
        //limit
        if (!empty($paramarr['perpage'])) {
            $paramarr['perpage'] = intval($paramarr['perpage']);
            if (empty($paramarr['perpage'])) {
                $paramarr['perpage'] = 20;
            }
            if (empty($_SGET['page'])) {
                $_SGET['page'] = 1;
            }
            $_SGET['page'] = intval($_SGET['page']);
            if ($_SGET['page'] < 1) {
                $_SGET['page'] = 1;
            }
            $start = ($_SGET['page'] - 1) * $paramarr['perpage'];
            $sql['limit'] = 'LIMIT ' . $start . ',' . $paramarr['perpage'];
        } else {
            if (empty($paramarr['limit'])) {
                $sql['limit'] = 'LIMIT 0,1';
            } else {
                $paramarr['limit'] = getdotstring($paramarr['limit'], 'int', true, array(), 1, false);
                if ($paramarr['limit']) {
                    $sql['limit'] = 'LIMIT ' . $paramarr['limit'];
                } else {
                    $sql['limit'] = 'LIMIT 0,1';
                }
            }
        }
        //query
        $sqlstring = implode(' ', $sql);
        //multi
        $listcount = 1;
        if (!empty($paramarr['perpage'])) {
            $listcount = $_SGLOBAL['db_uch']->result($_SGLOBAL['db_uch']->query('SELECT COUNT(*) FROM ' . tname('space', '2') . ' ' . $sql['where']), 0);
            if ($listcount) {
                $urlarr = $_SGET;
                unset($urlarr['page']);
                $theblockarr['multipage'] = multi($listcount, $paramarr['perpage'], $_SGET['page'], $urlarr, 0);
            }
        }
    } else {
        $uchdb = $_SGLOBAL['db_uch'];
        include_once S_ROOT . './function/block_sql.func.php';
        list($sqlstring, $listcount) = runsql($paramarr, $uchdb);
        if (!empty($paramarr['perpage'])) {
            if ($listcount) {
                $urlarr = $_SGET;
                unset($urlarr['page']);
                $theblockarr['multipage'] = multi($listcount, $paramarr['perpage'], $_SGET['page'], $urlarr, 0);
            }
        }
    }
    //查询数据
    if ($listcount) {
        //预处理
        include_once S_ROOT . './uc_client/client.php';
        //查询
        $query = $_SGLOBAL['db_uch']->query($sqlstring);
        while ($value = $_SGLOBAL['db_uch']->fetch_array($query)) {
            //头像处理
            $value['avatarflash'] = uc_avatar($_SGLOBAL['supe_uid']);
            $theblockarr[] = $value;
        }
    }
    return $theblockarr;
}
Exemplo n.º 22
0
For more information, please refer to [http://unlicense.org/].
***************************************************************/
/**************************************************************
Call: delete_word.php?wid=[wordid]&tid=[textid]
Delete a word
***************************************************************/
require_once 'settings.inc.php';
require_once 'connect.inc.php';
require_once 'dbutils.inc.php';
require_once 'utilities.inc.php';
$tid = $_REQUEST['tid'];
$wid = $_REQUEST['wid'];
$term = get_first_value("select WoText as value from " . $tbpref . "words where WoID = " . $wid);
pagestart("Term: " . $term, false);
$m1 = runsql('delete from ' . $tbpref . 'words where WoID = ' . $wid, '');
adjust_autoincr('words', 'WoID');
echo "<p>OK, term deleted, now unknown (" . $m1 . ").</p>";
?>
<script type="text/javascript">
//<![CDATA[
var context = window.parent.frames['l'].document;
var contexth = window.parent.frames['h'].document;
var title = make_tooltip(<?php 
echo prepare_textdata_js($term);
?>
,'','','');
$('.word<?php 
echo $wid;
?>
', context).removeClass('status99 status98 status1 status2 status3 status4 status5 word<?php 
Exemplo n.º 23
0
function tree($project, $daycount, $id, $task, $level, $str, $color, $parent, $own)
{
    global $lang, $j, $auth;
    $res = runsql("select TypeID, Name_{$lang} as Name  \r\n from ut_product_types \r\norder by TypeID asc");
    $parent = 0;
    $j = 1;
    if ($level == 10) {
        print "Бесконечный цикл";
        exit;
    }
    if (mysql_num_rows($res) > 0) {
        $i = 1;
        while ($r = mysql_fetch_array($res)) {
            print "<a href='javascript:;' id='menu" . $j . "parent" . $parent . "' onclick='return checkSubMenus(this)'><b>";
            print "<font color=black>";
            print $str . $i . ". {$r['Name']}</b></font>";
            $res1 = runsql("select ProductID, Name_{$lang} as Name  \r\n\t\t\tfrom ut_products \r\n\t\t\twhere TypeID='{$r['TypeID']}' order by ProductID asc");
            if (mysql_num_rows($res1) > 0) {
                $parent2 = $j;
                //$today=mktime(0,0,0,date("m",time()),date("d",time()),date("Y",time()));
                while ($r1 = mysql_fetch_array($res1)) {
                    print "<a href='products.php?id={$r1['ProductID']}'  style='display:block'  id='menu" . $j . "parent" . $parent2 . "' title='{$products}'>- {$r1['Name']}</a>";
                }
            }
            print "<br>";
            $i++;
            $j++;
        }
    }
}
Exemplo n.º 24
0
 function rec($id)
 {
     global $type, $HTTP_POST_VARS;
     $q = select("select AnswerID from ut_messages where MessageID='{$id}'");
     $row = runsql("select * from ut_messages where  MessageID='{$q['0']}'");
     if (mysql_num_rows($row)) {
         while ($r1 = mysql_fetch_array($row)) {
             print "<hr>";
             $HTTP_GET_VARS['id'] = $r1[MessageID];
             $HTTP_POST_VARS['id'] = $r1[MessageID];
             $f = new cls_form($type, "message");
             $f->Draw();
         }
         rec($q[0]);
     }
 }
Exemplo n.º 25
0
require_once 'utilities.inc.php';
$message = "";
if (isset($_REQUEST['delpref'])) {
    if ($_REQUEST['delpref'] !== '-') {
        $dummy = runsql('DROP TABLE ' . $_REQUEST['delpref'] . '_archivedtexts', '');
        $dummy = runsql('DROP TABLE ' . $_REQUEST['delpref'] . '_archtexttags', '');
        $dummy = runsql('DROP TABLE ' . $_REQUEST['delpref'] . '_languages', '');
        $dummy = runsql('DROP TABLE ' . $_REQUEST['delpref'] . '_sentences', '');
        $dummy = runsql('DROP TABLE ' . $_REQUEST['delpref'] . '_tags', '');
        $dummy = runsql('DROP TABLE ' . $_REQUEST['delpref'] . '_tags2', '');
        $dummy = runsql('DROP TABLE ' . $_REQUEST['delpref'] . '_textitems', '');
        $dummy = runsql('DROP TABLE ' . $_REQUEST['delpref'] . '_texts', '');
        $dummy = runsql('DROP TABLE ' . $_REQUEST['delpref'] . '_texttags', '');
        $dummy = runsql('DROP TABLE ' . $_REQUEST['delpref'] . '_words', '');
        $dummy = runsql('DROP TABLE ' . $_REQUEST['delpref'] . '_wordtags', '');
        $dummy = runsql('DROP TABLE ' . $_REQUEST['delpref'] . '_settings', '');
        $message = 'Table Set "' . $_REQUEST['delpref'] . '" deleted';
        if ($_REQUEST['delpref'] == substr($tbpref, 0, -1)) {
            $tbpref = "";
            LWTTableSet("current_table_prefix", $tbpref);
        }
    }
} elseif (isset($_REQUEST['newpref'])) {
    if (in_array($_REQUEST['newpref'], getprefixes())) {
        $message = 'Table Set "' . $_REQUEST['newpref'] . '" already exists';
    } else {
        $tbpref = $_REQUEST['newpref'];
        LWTTableSet("current_table_prefix", $tbpref);
        header("Location: index.php");
        exit;
    }
Exemplo n.º 26
0
 foreach ($rst[Gladiators] as $k => $gladiator) {
     //старение---------------------
     if (round(date("d", mktime())) == 1) {
         $rst[Gladiators][$k][Age] = $rst[Gladiators][$k][Age] + 1;
     }
     //тренировка--------------------
     $exp = expgained($rst, 1);
     if ($k == 103) {
         print "{$exp} -- ";
         exit;
     }
     if (strlen($exp)) {
         $rst[Gladiators][$k][Exp] = floor($rst[Gladiators][$k][Exp] + $exp);
         //print "$k=> ".$rst[Gladiators][$k][Exp]." = ".expgained($rst,1)."<br>";
         $rst[Gladiators][$k][NextTrain] = 0;
         runsql("update ut_gladiators \nset \nExp='" . $rst[Gladiators][$k][Exp] . "',\nLevel='" . $rst[Gladiators][$k][Level] . "',\nTypeID='" . $rst[Gladiators][$k][TypeID] . "',\nRating='" . $rst[Gladiators][$k][Rating] . "',\nVit='" . $rst[Gladiators][$k][Vit] . "',\nDex='" . $rst[Gladiators][$k][Dex] . "',\nAcc='" . $rst[Gladiators][$k][Acc] . "',\nStr='" . $rst[Gladiators][$k][Str] . "',\nVit='" . $rst[Gladiators][$k][Vit] . "',\n\nWin='" . $rst[Gladiators][$k][Win] . "',\nTie='" . $rst[Gladiators][$k][Tie] . "',\nLose='" . $rst[Gladiators][$k][Lose] . "'\n\nwhere GladiatorID='{$k}'");
     }
     if ($rst[Gladiators][$k][StatusID] > 1) {
         $salary += round($rst[Gladiators][$k][Price] / 10);
     }
 }
 $rst[TrainDate] = mktime();
 $money = moneygained($rst, 1);
 $rst[ShopDate] = mktime();
 //print "$money,1,$r[UserID] (лавка)<br>---------------";
 if ($money > 0) {
     $rst = short_transfer_money($rst, $money, 1, $r[UserID], 20, 0);
 }
 //print "$salary,$r[UserID],1 (зарплата гладиаторов)<br>---------------";
 if ($salary > 0) {
     $rst = short_transfer_money($rst, $salary, $r[UserID], 1, 19, 0);
Exemplo n.º 27
0
unless such conditions are required by law.

Developed by J. Pierre in 2011.
***************************************************************/
/**************************************************************
Call: insert_word_wellknown.php?tid=[textid]&ord=[textpos]
Ignore single word (new term with status 99)
***************************************************************/
include "connect.inc.php";
include "settings.inc.php";
include "utilities.inc.php";
$word = get_first_value("select TiText as value from textitems where TiWordCount = 1 and TiTxID = " . $_REQUEST['tid'] . " and TiOrder = " . $_REQUEST['ord']);
$wordlc = mb_strtolower($word, 'UTF-8');
$langid = get_first_value("select TxLgID as value from texts where TxID = " . $_REQUEST['tid']);
pagestart("Term: " . $word, false);
$m1 = runsql('insert into words (WoLgID, WoText, WoTextLC, WoStatus, WoStatusChanged,' . make_score_random_insert_update('iv') . ') values( ' . $langid . ', ' . convert_string_to_sqlsyntax($word) . ', ' . convert_string_to_sqlsyntax($wordlc) . ', 99, NOW(), ' . make_score_random_insert_update('id') . ')', 'Term added');
$wid = get_last_key();
echo "<p>OK, you know this term well!</p>";
$hex = strToClassName($wordlc);
?>
<script type="text/javascript">
//<![CDATA[
var context = window.parent.frames['l'].document;
var contexth = window.parent.frames['h'].document;
var title = make_tooltip(<?php 
echo prepare_textdata_js($word);
?>
,'*','','99');
$('.TERM<?php 
echo $hex;
?>
Exemplo n.º 28
0
        saveSetting('set-test-l-framewidth-percent', $_REQUEST['set-test-l-framewidth-percent']);
        saveSetting('set-test-r-frameheight-percent', $_REQUEST['set-test-r-frameheight-percent']);
        saveSetting('set-player-skin-name', $_REQUEST['set-player-skin-name']);
        saveSetting('set-test-main-frame-waiting-time', $_REQUEST['set-test-main-frame-waiting-time']);
        saveSetting('set-test-edit-frame-waiting-time', $_REQUEST['set-test-edit-frame-waiting-time']);
        saveSetting('set-test-sentence-count', $_REQUEST['set-test-sentence-count']);
        saveSetting('set-term-sentence-count', $_REQUEST['set-term-sentence-count']);
        saveSetting('set-archivedtexts-per-page', $_REQUEST['set-archivedtexts-per-page']);
        saveSetting('set-texts-per-page', $_REQUEST['set-texts-per-page']);
        saveSetting('set-terms-per-page', $_REQUEST['set-terms-per-page']);
        saveSetting('set-tags-per-page', $_REQUEST['set-tags-per-page']);
        saveSetting('set-show-text-word-counts', $_REQUEST['set-show-text-word-counts']);
        saveSetting('set-text-visit-statuses-via-key', $_REQUEST['set-text-visit-statuses-via-key']);
        $message = 'Settings saved';
    } else {
        $dummy = runsql("delete from settings where StKey like 'set-%'", '');
        $message = 'All Settings reset to default values';
    }
}
echo error_message_with_hide($message, 1);
?>

<form class="validate" action="<?php 
echo $_SERVER['PHP_SELF'];
?>
" method="post">
<table class="tab3" cellspacing="0" cellpadding="5">
<!-- ******************************************************* -->
<tr>
<th class="th1">Group</th>
<th class="th1">Description</th>
Exemplo n.º 29
0
    $message = runsql('delete from archivedtexts where AtID = ' . $_REQUEST['del'], "Archived Texts deleted");
    adjust_autoincr('archivedtexts', 'AtID');
    runsql("DELETE archtexttags FROM (archtexttags LEFT JOIN archivedtexts on AgAtID = AtID) WHERE AtID IS NULL", '');
} elseif (isset($_REQUEST['unarch'])) {
    $message2 = runsql('insert into texts (TxLgID, TxTitle, TxText, TxAudioURI) select AtLgID, AtTitle, AtText, AtAudioURI from archivedtexts where AtID = ' . $_REQUEST['unarch'], "Texts added");
    $id = get_last_key();
    runsql('insert into texttags (TtTxID, TtT2ID) select ' . $id . ', AgT2ID from archtexttags where AgAtID = ' . $_REQUEST['unarch'], "");
    splitText(get_first_value('select TxText as value from texts where TxID = ' . $id), get_first_value('select TxLgID as value from texts where TxID = ' . $id), $id);
    $message1 = runsql('delete from archivedtexts where AtID = ' . $_REQUEST['unarch'], "Archived Texts deleted");
    $message = $message1 . " / " . $message2 . " / Sentences added: " . get_first_value('select count(*) as value from sentences where SeTxID = ' . $id) . " / Text items added: " . get_first_value('select count(*) as value from textitems where TiTxID = ' . $id);
    adjust_autoincr('archivedtexts', 'AtID');
    runsql("DELETE archtexttags FROM (archtexttags LEFT JOIN archivedtexts on AgAtID = AtID) WHERE AtID IS NULL", '');
} elseif (isset($_REQUEST['op'])) {
    // UPDATE
    if ($_REQUEST['op'] == 'Change') {
        $message = runsql('update archivedtexts set ' . 'AtLgID = ' . $_REQUEST["AtLgID"] . ', ' . 'AtTitle = ' . convert_string_to_sqlsyntax($_REQUEST["AtTitle"]) . ', ' . 'AtText = ' . convert_string_to_sqlsyntax($_REQUEST["AtText"]) . ', ' . 'AtAudioURI = ' . convert_string_to_sqlsyntax($_REQUEST["AtAudioURI"]) . ' ' . 'where AtID = ' . $_REQUEST["AtID"], "Updated");
        $id = $_REQUEST["AtID"];
    }
    saveArchivedTextTags($id);
}
// CHG
if (isset($_REQUEST['chg'])) {
    $sql = 'select AtLgID, AtTitle, AtText, AtAudioURI from archivedtexts where AtID = ' . $_REQUEST['chg'];
    $res = mysql_query($sql);
    if ($res == FALSE) {
        die("Invalid Query: {$sql}");
    }
    if ($record = mysql_fetch_assoc($res)) {
        ?>
	
		<h4>Edit Archived Text</h4>
Exemplo n.º 30
0
function xml2bd()
{
    global $Xml, $Type, $Act, $PageID, $id, $site_path, $error;
    while (strstr($Xml, "<--")) {
        $Xml = substr($Xml, 0, strpos($Xml, "<--")) . substr($Xml, strpos($Xml, "-->", strpos($Xml, "<--")) + 3);
    }
    if (!$Type) {
        $q = select("select @Type");
        $Type = $q[0];
    }
    if (!$Site) {
        $q = select("select @Site");
        $Site = $q[0];
    }
    $id = $PageID;
    $Xml = stripslashes($Xml);
    $tmp = new cls_xml();
    $tmp->loadxml($Xml);
    $item = $tmp->documentElement;
    $a = $item->ownerDocument->nodes[0];
    $Act = $a->tagname;
    if (!$item) {
        runsql("set @error='Not valid XML'");
    } else {
        $item->Xml2File($Type, $Act);
    }
    //if(file_exists($site_path."xml/".$Site.$Type.))
}