Ghooti logo
ما به سوتی دهنده نمی خنديم (پس به کی می خنديم؟!!)، به خود سوتی می خنديم!™
Source of /index.php:
<?php include_once("config.inc.php"); ?>
<?php
function addBody() {
?>
<br>
<div align="center" style="color: #60f; font-size: 24px; font-family: Mitra, Arial">
سلام دوستداران قوطی! اکنون که دست استکبار جهانی از آستين برون آمده و با خباثت تمام قوطی را به قعر فنا و نيستی سپرده است، ...<br>
خلاصه کلام: قوطی به علّت خرابی آفتاب و/يا خورشيد، فعلا در دسترس نمی باشد. لطفا شماره گيری نفرماييد.
<?//خلاصه کلام: قوطی به علّت تغييرات، فعلا در دسترس نمی باشد. لطفا شماره گيری نفرماييد.?>
</div>
<br>
<?php
}

//if (!isset($_GET['debug'])) { $GLOBALS['dontLog'] = true; HTML::simplePage('صبر کنيد!', null, "addBody"); }

include_once(CLASSES_PREFIX."Security.php");
include_once(
CLASSES_PREFIX."HTML.php");
include_once(
CLASSES_PREFIX."Misc.php");
include_once(
CLASSES_PREFIX."SQL.php");

$sql SQL::getNewObject();

$admin Security::isLoggedIn();
/*if (!$admin) {
//    require("temp.php");
    require("temp2.php");
    die();
}
$_GET["num"] = 5;*/

$start Misc::getPositiveInt("start"0);
$num Misc::getPositiveInt("num"DEFAULT_NUM);
Misc::checkInputs();

/*$start = intval(Misc::GET("start", 0));
$num = intval(Misc::GET("num", DEFAULT_NUM));*/

HTML::startHTML("قوطی""onload='l()'");
?>
<?php 
/*    <button onclick="document.location = '<?php out(FILE_ADMIN); ?>'">مديريت</button><br><br>*/ ?>

<!--center>
<div class="news"></div>
</center-->
    <br>
    <center><div class="nazar" align="center">
<?php /*    به زودی در اين محل يک سيستم امتيازدهی تأسيس می شود!*/ ?>
<?php 
/*    حالا حالا ها در اين محل سيستم امتيازدهی تأسيس نمی شود!*/ ?>
قابلیت جدید: جستجو از درون مرورگر (<a href="#" onclick="window.external.AddSearchProvider('<?php out(FILE_OPENSEARCH_DES_ABSOLUTE); ?>');">اينجا</a> را کليک کنيد)
    </div></center>
<?php
addAddSootiForm
();
addSearchForm();

/*$sql = SQL::getNewObject(null, true, false);
//$sql->dbExists();
$sql->selectDB();*/
//$sql->tableExists(ghootiTableName, array(fromColumnName => fromColumnType, senderColumnName => senderColumnType, sootiColumnName => sootiColumnType, correctColumnName => correctColumnType, dateColumnName => dateColumnType, approvedColumnName => approvedColumnType));

$time1 Misc::gettime();
$totalNum $sql->count(ghootiTableName, array(approvedColumnName => 1));
$result $sql->select(ghootiTableName, array(approvedColumnName => 1), truetrue, array($start$num), dateColumnNametrue);
if (
$result === false) {
    
$sql->errorPage();
}
if (
$start $num $totalNum)
    
$num2 = ($totalNum $start);
else
    
$num2 $num;
startPage($start$num2$totalNum);

if (
$totalNum == 0) {
?>
سوتی ای یافت نشد.
<?php
}
else {
    
startSooties($start$num$totalNum);
    while(
$row mysql_fetch_assoc($result)) {
        
addSooti($row);
    }
    
endSooties();
}
$time2 Misc::gettime();

Misc::delete($sql);
endPage($start$num$totalNum$time1$time2);

addSuggestionForm();
addSokhanTable();

HTML::endHTML();


function 
addSearchForm() {
?>
<div id="search" style="display: none">
<form id="searchForm" action="<?php out(FILE_SEARCH); ?>" method="GET"> 
<table class="searchTable" border="1" align=center>
<tr class="searchTR">
<th align="center" class="searchTH" colspan="2">جستجو</th>
</tr>
<?php /*<tr class="searchTR">
<td class="searchTD"><label for="searchFrom">صاحب سوتی:</label></td><td class="searchTD"><input type="text" id="searchFrom" name="from" maxlength="<?php out(fromColumnMax); ?>" size="100"></td>
</tr>*/ 
?>
<tr class="searchTR">
<td class="searchTD"><label for="searchSender">فرستنده سوتی:</label></td><td class="searchTD"><input type="text" id="searchSender" name="sender" maxlength="<?php out(senderColumnMax); ?>" size="100"></td>
</tr>
<tr class="searchTR">
<td class="searchTD"><label for="searchSooti">متن سوتی:</label></td><td class="searchTD"><input type="text" id="searchSooti" name="sooti" size="100" onblur="s()"></td>
</tr>
<tr class="searchTR">
<td class="searchTD"><label for="searchCorrect">منظور از سوتی:</label></td><td class="searchTD"><input type="text" id="searchCorrect" name="correct" size="100"></td>
</tr>
<tr class="searchTR">
<td class="searchTD" colspan="2" align="center"><input type="submit" value="بگرد!"><?php HTML::addSpace(8); ?><input type="reset" value="نگرد" onclick="toggleSearch()"></td>
</tr>
</table>
</form>
</div>
<?php
}

function 
addBackLinkInTable($start$num) {
    
$style "";
    if (
$start <= 0)
        
$style 'style="visibility: hidden" ';
    
?><td <?php /* XSS-safe */ out_unsafe($style); ?>align="right" class="linkTD"><?php HTML::addBackLink($start$num); ?></td><?php
/*    if ($start > 0) {
?>
            <td align="right" class="linkTD"><?php HTML::addBackLink($start, $num); ?></td>
<?php
    }
    else {
?>
            <td align="right" class="linkTD">&nbsp;</td>
<?php
    }*/
}

function 
addNextLinkInTable($start$num$totalNum) {
    
$style "";
    if (
$start $num >= $totalNum)
        
$style 'style="visibility: hidden" ';
    
?><td <?php /* XSS-safe */ out_unsafe($style); ?>align="left" class="linkTD"><?php HTML::addNextLink($start$num); ?></td><?php
}

function 
addAddSootiForm($nesfe false) {
?>
<iframe id="hif" name="hif" style="display: none;"></iframe>
<div class="msg" id="addSootiMsgDiv" style="display: none;" align="center"></div>
<table width="100%">
<tr>
<?php if (!$nesfe) { ?>
<td align="right">
<button id="addSootiButton" onclick="toggleAddSooti()">يه سوتی جديد</button>
</td>
<td align="center">
<button id="searchButton" onclick="toggleSearch()">جستجو</button>
</td>
<?php /*<td align="center">
<button id="sokhanButton" onclick="toggleSokhan()">سخن قوطيان!</button>
</td>*/
?>
<?php 
?>
<td align="left">
<button onclick="sug(event)">نظرات و پيشنهادها</button>
</td>
</table>
<?php if (!$nesfe) { ?>
<div id="addSooti" style="display: none">
<form id="sootiForm" action="<?php out(FILE_ADD_SOOTI_JS); ?>" method="POST" onsubmit="return ch()" target="hif">
<input type="hidden" name="_id">
<table class="addSootiTable" border="1" align=center>
<?php /*<tr class="addSootiTR">
<td class="addSootiTD"><label for="addSootiFrom">صاحب سوتی:</label></td><td class="addSootiTD"><input type="text" id="addSootiFrom" name="from" maxlength="<?php out(fromColumnMax); ?>" size="100"></td>
</tr>*/ 
?>
<tr class="addSootiTR">
<th align="center" class="addSootiTH" colspan="2">يه سوتی جديد</th>
</tr>
<tr class="searchTR">
    <td colspan="2" align="center" class="searchTD">لطفاً سوتي ها را تا حد امکان به همراه جمله ي کامل وارد کنيد (غلام با تو ام!)</td>
</tr>
<tr class="addSootiTR">
<td class="addSootiTD"><label for="addSootiSender">فرستنده سوتی:</label></td><td class="addSootiTD"><input type="text" id="addSootiSender" name="sender" maxlength="<?php out(senderColumnMax); ?>" size="100"></td>
</tr>
<tr class="addSootiTR">
<td class="addSootiTD"><label for="addSootiSooti">متن سوتی:</label></td><td class="addSootiTD"><input type="text" id="addSootiSooti" name="sooti" size="100" onblur="s()"></td>
</tr>
<tr class="addSootiTR">
<td class="addSootiTD"><label for="addSootiCorrect">منظور از سوتی:</label></td><td class="addSootiTD"><input type="text" id="addSootiCorrect" name="correct" size="100"></td>
</tr>
<tr class="addSootiTR">
<td class="addSootiTD" colspan="2" align="center"><input type="submit" value="برو تو قوطی!"><?php HTML::addSpace(8); ?><input type="reset" value="نرو!" onclick="toggleAddSooti()"></td>
</tr>
</table>
</form>
</div>
<?php ?>
<?php
}

function 
addSuggestionForm() {
?>
<img id="disIMG" class="disabled" style="display: none" src="images/disabled.png" width="110%" height="110%" alt="disabled">
<table id="sug_table" class="sugTable" style="display: none" width="100%" height="100%">
    <tr align="center" valign="middle">
        <td align="center" valign="middle">
        <div id="sug_header" class="sugHeader"><div class="sugCloseBut" align=center onclick="sug_close();" onmouseover="sugCloseButOver()" onmouseout="sugCloseButOut()" id="sugCloseBut">X</div></div>
            <div id="sug_div" class="sugDiv">
                <div id="sug_title" class="title" style="display: none"></div>
                <form method="POST" action="<?php out(FILE_ADD_SUGGEST_JS); ?>" target="hif" id="cf" onsubmit="return sug2()">
                <table>
                    <tr class="sugTR">
                        <td class="sugTD"></td>
                    </tr>
                    <tr class="sugTR">
                        <td class="sugTD">شما؟</td>
                        <td class="sugTD"><input type="text" id="sugName" name="name" maxlength="<?php out(senderColumnMax); ?>"></td>
                    </tr>
                    <tr class="sugTR">
                        <td class="sugTD">نظر:</td>
                        <td class="sugTD"><textarea id="sugSug" name="sug" cols="35" rows="15"></textarea></td>
                    </tr>
                    <tr class="sugTR">
                        <td class="sugTD" colspan=2 align="center"><input type="submit" value="بُريم">&nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" value="اشتباه اومدم!" onclick="sug_close()"></td>
                    </tr>
                </table>
                </form>
            </div>
        </td>
    </tr>
</table>
<!--/div-->
<?php
}

function 
addSokhanTable() {
?>
<table id="sokhanTable" class="sokhanTable" width="100%" height="100%" style="display: none; position: absolute; top: 0px; left: 0px;">
<tr valign=middle><td align=center>
<div class="sokhanDiv" align=right><?php addQuote(); ?></div>
</td></tr>
</table>
<?php
}

function 
startPage($start$num$totalNum) {
?>
    <br>
    <table class="bar" width="100%" cellspacing="0">
        <tr>
            <td>سوتی ها:</td>
<?php if ($totalNum 0) { ?>
            <td align="left">نتايج <b><?php outFarsiNum($start 1); ?></b> تا <b><?php outFarsiNum($start $num); ?></b> از حدود <b><?php outFarsiNum($totalNum); ?></b> نتيجه نمايش داده شده اند&nbsp;&nbsp;</td>
<?php ?>
        </tr>
    </table>
<?php
}

function 
addPage($i$num$start) {
//    HTML::addSpace(2);
    
$s = (int) ($num $i);
    if (
$s != $start) {
        
$href "";
        if (
$s 0)
            
$href Misc::addGET($href"start=$s"false);
        if (
$num != DEFAULT_NUM)
            
$href Misc::addGET($href"num=$num"false);
        if (
$href == "")
            
$href "?";
        
?><li><a href="<?php out($href); ?>"><?php outFarsiNum($i 1); ?></a></li><?php
    
}
    else {
        
?><li class="currentPageNumber"><?php outFarsiNum($i 1); ?></li><?php
    
}
}

function 
startSooties($start$num$totalNum) {
    global 
$admin;
?>
<center>
    <table class="bar2" width="100%" cellspacing="0">
        <tr>
<?php
    addBackLinkInTable
($start$num);
    if (
$totalNum 0) {
        
?><td style="width: 50%;" align="center"><div class="pageNumber"><ul><li class="pageNumberTitle">برو به صفحه</li><?php
        addPage
(0$num$start);
        
$n ceil($totalNum $num);
        
$page = (int) ($start $num);
        if (
$n 1) {
            if (
$page 3) {
//                HTML::addSpace(2);
                
?><li class="pageNumberMore"><b>...</b></li><?php
            
}

            
$s max($page 21);
            
$e min($page 2$n 2);
            for (
$i $s$i <= $e$i++) {
                
addPage($i$num$start);
            }

            if (
$page $n 4) {
//                HTML::addSpace(2);
                
?><li class="pageNumberMore"><b>...</b></li><?php
            
}

            
addPage($n 1$num$start);
        }
        
?></ul></div></td><?php
    
}
    
addNextLinkInTable($start$num$totalNum);
?>
        </tr>
    </table>
<table width="100%" class="sootiTable" border="1">
<tr class="sootiTRHead">
<?php /* <th class="sootiTH">صاحب سوتی</th> */ ?>
<?php 
if ($admin) { ?><th class="sootiTH">فرستنده سوتی</th><?php ?>
<th class="sootiTH">متن سوتی</th>
<th class="sootiTH">منظور از سوتی</th>
<th class="sootiTH">تاريخ ثبت سوتی</th>
<?php if ($admin) { ?><th class="sootiTH">بروزرسانی</th><?php ?>
<?php 
if ($admin) { ?><th class="sootiTH">حذف</th><?php ?>
</tr>
<?php
}

function 
addSooti($sooti) {
    global 
$admin;
    
$id intval($sooti[TABLES_COLUMN_PRIMARYID]);
?>
<tr>
<?php /* <td class="sootiTD sootiTD_Name" nowrap><?php out($sooti[fromColumnName]); ?></td> */ ?>
<?php 
if ($admin) { ?><td class="sootiTD"><input type="text" id="sender<?php out($id?>" value="<?php out($sooti[senderColumnName]); ?>"></td><?php ?>
<td><?php if ($admin) { ?><input type="text" id="sooti<?php out($id?>" value="<?php out($sooti[sootiColumnName]); if ($admin) { ?>"><?php ?></td>
<td><?php if ($admin) { ?><input type="text" id="correct<?php out($id?>" value="<?php out($sooti[correctColumnName]); if ($admin) { ?>"><?php ?></td>
<td class="sootiTD_Date" align="center" nowrap><?php HTML::addDate(intval($sooti[dateColumnName])); ?></td>
<?php if ($admin) { ?><td class="sootiTD"><button onclick="u(<?php out($id); ?>)">بروزرسانی</button></td><?php ?>
<?php 
if ($admin) { ?><td class="sootiTD"><button onclick="d(<?php out($id); ?>)">حذف</button></td><?php ?>
</tr>
<?php
}

function 
endSooties() {
?>
</table>
</center>
<?php
}

function 
endPage($start$num$totalNum$time1$time2) {
?>
    <br>
    <table width="100%" cellspacing="0">
        <tr class="bar2">
<?php
    addBackLinkInTable
($start$num);
?>
            <td align="center">زمان لازم برای نشان دادن نتايج: <b><?php outFarsiNum($time2 $time1); ?></b> ثانيه</td>
<?php
    addNextLinkInTable
($start$num$totalNum);
?>
        </tr>
    </table>
    <br>
<?php
}

?>

ويو سورس!
هیچ حقی برای هیچ کس (حتّی قوطی™!) محفوظ نیست!