Esempio n. 1
0
        if (isset($_GET['squadID'])) {
            $squadID = (int) $_GET['squadID'];
        } else {
            $squadID = '';
        }
        if ($action == "show") {
            $get = mysql_fetch_array(safe_query("SELECT name FROM `" . PREFIX . "squads` WHERE squadID='{$squadID}'"));
            define('PAGETITLE', settitle($_language->module['squads'] . '  »  ' . $get['name']));
        } else {
            define('PAGETITLE', settitle($_language->module['squads']));
        }
        break;
    case 'static':
        if (isset($_GET['staticID'])) {
            $staticID = (int) $_GET['staticID'];
        } else {
            $staticID = '';
        }
        $get = mysql_fetch_array(safe_query("SELECT name FROM `" . PREFIX . "static` WHERE staticID='{$staticID}'"));
        define('PAGETITLE', settitle($get['name']));
        break;
    case 'usergallery':
        define('PAGETITLE', settitle($_language->module['usergallery']));
        break;
    case 'whoisonline':
        define('PAGETITLE', settitle($_language->module['whoisonline']));
        break;
    default:
        define('PAGETITLE', settitle($_language->module['news']));
        break;
}
// 本程序主页:http://www.sablog.net
// ==============================================================//
if (!defined('SABLOG_ROOT')) {
    exit('Access Denied');
}
if ($stats['article_count']) {
    $articledb = array();
    $query = $DB->query("SELECT articleid,title,dateline,comments,readpassword,alias FROM {$db_prefix}articles WHERE visible='1' ORDER BY dateline DESC");
    while ($article = $DB->fetch_array($query)) {
        $date = sadate('Y-m', $article['dateline']);
        $article['dateline'] = sadate('m/d', $article['dateline']);
        $article['url'] = getpermalink($article['articleid'], $article['alias']);
        $articledb[$date][] = $article;
    }
}
if (!$options['meta_keywords']) {
    $tmp = $comma = '';
    if (is_array($catecache) && count($catecache)) {
        foreach ($catecache as $data) {
            $tmp .= $comma . $data['name'];
            $comma = ',';
        }
        $options['meta_keywords'] = $tmp;
    }
}
$options['meta_keywords'] = '文章归档,' . $options['meta_keywords'];
$options['meta_description'] = $options['meta_description'] ? $options['meta_description'] : $options['description'];
$options['title_keywords'] = $options['title_keywords'] ? ' - ' . $options['title_keywords'] : '';
$pagefile = 'archives';
$options['title'] = settitle('文章归档');
Esempio n. 3
0
function draw_admin($name = false, $tokens = false)
{
    global $onload, $body;
    global $error;
    global $client;
    settitle('Admin');
    setmenu('admin');
    $onload = "document.forms[0].name.focus()";
    $body = 'No admin stuff yet';
}
Esempio n. 4
0
// 本程序版本:SaBlog-X Ver 2.0
// --------------------------------------------------------------//
// 本程序主页:http://www.sablog.net
// ==============================================================//
if (!defined('SABLOG_ROOT')) {
    exit('Access Denied');
}
$query = $DB->query("SELECT name,url,note FROM {$db_prefix}links WHERE visible = '1' ORDER BY home DESC, name ASC");
$linkdb = array();
while ($link = $DB->fetch_array($query)) {
    $link['note'] = $link['note'] ? $link['note'] : $link['url'];
    $linkdb[] = $link;
}
unset($link);
$DB->free_result($query);
if (!$options['meta_keywords']) {
    $tmp = $comma = '';
    if (is_array($catecache) && count($catecache)) {
        foreach ($catecache as $data) {
            $tmp .= $comma . $data['name'];
            $comma = ',';
        }
        $options['meta_keywords'] = $tmp;
    }
}
$options['meta_keywords'] = '友情链接,' . $options['meta_keywords'];
$options['meta_description'] = $options['meta_description'] ? $options['meta_description'] : $options['description'];
$options['title_keywords'] = $options['title_keywords'] ? ' - ' . $options['title_keywords'] : '';
$pagefile = 'links';
$options['title'] = settitle('友情链接');
     } else {
         $getnum = true;
     }
     // 检查是否设置$setday参数
     $setday = (int) $_GET['setday'];
     if ($setday && is_numeric($setday)) {
         $getnum = true;
         if ($setday > 31 || $setday < 1) {
             $setday = sadate('d');
         }
         $navtext = $setyear . '年' . $setmonth . '月' . $setday . '日的文章';
         $start = strtotime($setyear . '-' . $setmonth . '-' . $setday);
         $end = $start + 86400;
         $pageurl = getdaylink($setdate, $setday);
     }
     $options['title'] = settitle($navtext);
     $indexpage = 0;
 }
 //*******************************//
 $startadd = $start ? " AND a.dateline >= '" . correcttime($start) . "' " : '';
 $endadd = $end ? " AND a.dateline < '" . correcttime($end) . "' " : '';
 //*******************************//
 if ($getnum) {
     $query = $DB->query("SELECT COUNT(articleid) FROM {$db_prefix}articles a WHERE a.visible='1' " . $startadd . $endadd);
     $total = $DB->result($query, 0);
 }
 //置顶文章
 if (!$startadd && !$endadd && !$r['cid'] && !$stickycount) {
     $stickycount = $stickids['count'];
     $stickyaids = $stickids['aids'];
 }
Esempio n. 6
0
    function draw_history($start = 1, $count = false)
    {
        global $body;
        global $error;
        global $client;
        $t = $client->t;
        if ($count === false) {
            $count = $this->historycount();
        }
        $times = $client->gethistorytimes();
        if (is_string($times)) {
            $error = $times;
        } elseif (count($times) == 0) {
            $error = "No saved history";
        } else {
            settitle('History');
            setmenu('balance');
            // Need controls for pagination, and date search.
            // Eventually, recipient, note, and amount search, too.
            $cnt = count($times);
            $count2 = $count <= 0 ? $cnt : $count;
            if ($count2 >= $cnt) {
                $start = 1;
            }
            $strt = $start - 1;
            $end = $strt + $count2;
            if ($end > $cnt) {
                $end = $cnt;
            }
            $idx = 0;
            $body = "<br/>\n";
            $this->scroller($start, $count, $cnt);
            $body .= <<<EOT
<form method="post" action="./" autocomplete="off">
<input type="hidden" name="cmd" value="dohistory"/>
<input type="hidden" name="start" value="{$start}"/>
<input type="hidden" name="count" value="{$count}"/>
<input type="hidden" name="chkcnt" value="{$cnt}"/>
<table border="1">
<caption><b>=== History ===</b></caption>
<tr>
<th>Time</th>
<th>Request</th>
<th>From</th>
<th>To</th>
<th colspan="2">Amount</th>
<th>Note</th>
<th>Response</th>
<th>x</th>
</tr>

EOT;
            $nickcnt = 0;
            for ($i = $strt; $i < $end; $i++) {
                $time = $times[$i];
                $items = $client->gethistoryitems($time);
                if (is_string($items)) {
                    $error = $items;
                    break;
                }
                $datestr = datestr($time);
                $timestr = hsc($time);
                $datestr = "<span title=\"{$timestr}\">{$datestr}</span>";
                $body .= <<<EOT
<tr>

EOT;
                // There are currently three types of history items:
                // 1) Spend
                // 2) Process Inbox
                //   a) Accept or reject of somebody else's spend
                //   b) Acknowledgement of somebody else's accept or reject of my spend
                $item = $items[0];
                $request = $item[$t->REQUEST];
                if ($request == $t->SPEND) {
                    $req = 'spend';
                    $from = 'You';
                    $toid = $item[$t->ID];
                    $to = id_namestr($toid, $contact);
                    if (!@$contact[$t->CONTACT] && $toid != $client->id && $toid != 'coupon') {
                        $to .= <<<EOT
<br/>
<input type="hidden" name="nickid{$nickcnt}" value="{$toid}"/>
Nickname:
<input type="text" name="nick{$nickcnt}" size="10"/>
EOT;
                        $nickcnt++;
                    }
                    $amount = $item[$t->FORMATTEDAMOUNT];
                    $assetname = $item[$t->ASSETNAME];
                    $note = @$item[$t->NOTE];
                    if (!$note) {
                        $note = '&nbsp;';
                    }
                    $body .= <<<EOT
<td>{$datestr}</td>
<td>{$req}</td>
<td>{$from}</td>
<td>{$to}</td>
<td align="right" style="border-right-width: 0;">{$amount}</td>
<td style="border-left-width: 0;">{$assetname}</td>
<td>{$note}</td>
<td>&nbsp;</td>
<td>
<input type="hidden" name="time{$idx}" value="{$timestr}"/>
<input type="checkbox" name="chk{$idx}"/>
</td>

EOT;
                } elseif ($request == $t->PROCESSINBOX) {
                    $rows = array();
                    $req = false;
                    for ($j = 1; $j < count($items); $j++) {
                        for (; $j < count($items); $j++) {
                            $item = $items[$j];
                            $request = $item[$t->REQUEST];
                            if ($request == $t->SPENDACCEPT || $request == $t->SPENDREJECT) {
                                if ($req) {
                                    break;
                                }
                                $req = $request == $t->SPENDACCEPT ? 'accept' : 'reject';
                                $cancelp = $item[$t->CUSTOMER] == $client->id;
                                $response = $item[$t->NOTE];
                                $toid = $item[$t->CUSTOMER];
                                $to = id_namestr($toid, $contact, 'You');
                                if (!@$contact[$t->CONTACT] && $toid != $client->id && $toid != 'coupon') {
                                    $to .= <<<EOT
<br/>
<input type="hidden" name="nickid{$nickcnt}" value="{$toid}"/>
Nickname:
<input type="text" name="nick{$nickcnt}" size="10"/>
EOT;
                                    $nickcnt++;
                                }
                            } elseif ($request == $t->SPEND) {
                                $fromid = $item[$t->CUSTOMER];
                                $from = id_namestr($fromid, $contact, 'You');
                                if (!@$contact[$t->CONTACT] && $fromid != $client->id && $toid != 'coupon') {
                                    $from .= <<<EOT
<br/>
<input type="hidden" name="nickid{$nickcnt}" value="{$fromid}"/>
Nickname:
<input type="text" name="nick{$nickcnt}" size="10"/>
EOT;
                                    $nickcnt++;
                                }
                                $toid = $item[$t->ID];
                                if ($to) {
                                    // $to set above by spendaccept/spendredeem code
                                    if ($toid == 'coupon') {
                                        $to = "Coupon redeemed by:<br/>{$to}";
                                    }
                                } else {
                                    $to = id_namestr($toid, $contact, 'You');
                                    if (!$contact[$t->CONTACT] && $toid != $client->id && $toid != 'coupon') {
                                        $to .= <<<EOT
<br/>
<input type="hidden" name="nickid{$nickcnt}" value="{$toid}"/>
Nickname:
<input type="text" name="nick{$nickcnt}" size="10"/>
EOT;
                                        $nickcnt++;
                                    }
                                }
                                $amount = $item[$t->FORMATTEDAMOUNT];
                                $assetname = $item[$t->ASSETNAME];
                                $note = @$item[$t->NOTE];
                                if ($item[$t->ATREQUEST] == $t->ATSPEND) {
                                    $req = $cancelp ? "={$req}" : "@{$req}";
                                }
                            }
                        }
                        if ($req) {
                            $row = array('req' => $req, 'from' => $from, 'to' => $to, 'amount' => $amount, 'assetname' => $assetname, 'note' => $note, 'response' => $response);
                            $rows[] = $row;
                            if ($j > 1) {
                                $j--;
                            }
                            $req = false;
                            $from = false;
                            $to = false;
                            $amount = false;
                            $assetname = false;
                            $note = false;
                            $response = false;
                        }
                    }
                    $rowcnt = count($rows);
                    if ($rowcnt > 0) {
                        $body .= "<td rowspan=\"{$rowcnt}\">{$datestr}</td>\n";
                        $first = true;
                        foreach ($rows as $row) {
                            if (!$first) {
                                $body .= "<tr>\n";
                            }
                            $req = $row['req'];
                            $from = $row['from'];
                            $to = $row['to'];
                            $amount = $row['amount'];
                            $assetname = $row['assetname'];
                            $note = $row['note'];
                            $response = $row['response'];
                            $checkcode = '';
                            if ($first) {
                                $checkcode = <<<EOT

<td rowspan="{$rowcnt}">
<input type="hidden" name="time{$idx}" value="{$timestr}"/>
<input type="checkbox" name="chk{$idx}"/>
</td>
EOT;
                                $first = false;
                            }
                            if (!$note) {
                                $note = '&nbsp;';
                            }
                            if (!$response) {
                                $response = '&nbsp;';
                            }
                            $body .= <<<EOT
<td>{$req}</td>
<td>{$from}</td>
<td>{$to}</td>
<td align="right" style="border-right-width: 0;">{$amount}</td>
<td style="border-left-width: 0;">{$assetname}</td>
<td>{$note}</td>
<td>{$response}</td>{$checkcode}
</tr>

EOT;
                        }
                    }
                } else {
                    $req = hsc($req);
                    $body .= <<<EOT
<td>{$datestr}</td>
<td>{$req}</td>
<td colspan="6">Unknown request type</td>

EOT;
                }
                $body .= "</tr>\n";
                $idx++;
            }
            if ($nickcnt > 0) {
                $body .= <<<EOT
<input type="hidden" name="nickcnt" value="{$nickcnt}"/>

EOT;
                $submitlabel = "Delete Checked & Add Nicknames";
            } else {
                $submitlabel = "Delete Checked";
            }
            $body .= <<<EOT
</table>
<br/>
<input type="submit" name="delete" value="{$submitlabel}"/>
<input type="submit" name="deleteolder" value="Delete Checked & Older"/>
</form>

EOT;
            $this->scroller($start, $count, $cnt);
            if (hideinstructions()) {
                $body .= <<<EOT
<a href="./?cmd=toggleinstructions&page=history">Show Instructions</a>

EOT;
            } else {
                $body .= <<<EOT
<table border="1">
<caption><b>=== Key ===</b></caption>
<tr><td>spend</td><td>You made a spend</td></tr>
<tr><td>accept</td><td>You accepted a spend</td></tr>
<tr><td>reject</td><td>You rejected a spend</td></tr>
<tr><td>@accept</td><td>You acknowledged acceptance of your spend</td></tr>
<tr><td>@reject</td><td>You acknowledged rejection of your spend</td></tr>
<tr><td>=reject</td><td>You acknowledged your cancel of a spend</td></tr>
<tr><td>=accept</td><td>You acknowledged your acceptance of a coupon you spent to yourself</td></tr>
</table>
<br/>
<a href="./?cmd=toggleinstructions&page=history">Hide Instructions</a>

EOT;
            }
        }
        if ($error) {
            draw_balance();
        }
    }
    if ($counts) {
        $min_count = @min($counts);
        $spread = @max($counts) - $min_count;
        if ($spread <= 0) {
            $spread = 1;
        }
        $font_spread = $largest - $smallest;
        if ($font_spread < 0) {
            $font_spread = 1;
        }
        $font_step = $font_spread / $spread;
        foreach ($tagdb as $mid => $tag) {
            $tagdb[$mid]['fontsize'] = $smallest + ($tag['counts'] - $min_count) * $font_step;
        }
    }
}
if (!$options['meta_keywords']) {
    $tmp = $comma = '';
    if (is_array($catecache) && count($catecache)) {
        foreach ($catecache as $data) {
            $tmp .= $comma . $data['name'];
            $comma = ',';
        }
        $options['meta_keywords'] = $tmp;
    }
}
$options['meta_keywords'] = '标签,' . $options['meta_keywords'];
$options['meta_description'] = $options['meta_description'] ? $options['meta_description'] : $options['description'];
$options['title_keywords'] = $options['title_keywords'] ? ' - ' . $options['title_keywords'] : '';
$options['title'] = settitle('标签');
$pagefile = 'tag';
Esempio n. 8
0
                $commentStacks[] = $commentid;
            }
            if ($comment_parent != 0 && isset($commentdb[$comment_parent])) {
                if ($commentdb[$commentid]['level'] > 5) {
                    $commentdb[$commentid]['comment_parent'] = $comment_parent = $commentdb[$comment_parent]['comment_parent'];
                }
                $commentdb[$comment_parent]['children'][] = $commentid;
            }
        }
        if (!$options['comment_order']) {
            $commentdb = array_reverse($commentdb, true);
            $commentStacks = array_reverse($commentStacks);
        }
        if ($article_comment_num) {
            //翻页的话如果请求页面比最大页大,则取最大页。否则会取不到评论内容
            $all_comment_num = count($commentStacks);
            $maxpage = @ceil($all_comment_num / $article_comment_num);
            if ($page > $maxpage) {
                $page = $maxpage;
            }
            $multipage = multi($all_comment_num, $article_comment_num, $page, $article['url']);
            $commentStacks = array_slice($commentStacks, ($page - 1) * $article_comment_num, $article_comment_num);
        }
        //$commentdb = compact('commentdb','commentStacks','multipage');
    }
    if ($options['seccode'] && $sax_group != 1 && $sax_group != 2) {
        $seccode = random(6, 1);
    }
}
$options['title'] = settitle($article['title']);
$pagefile = 'show';
Esempio n. 9
0
function modify()
{
    global $home, $site, $dateformat, $url;
    requirelogin();
    settitle("Modificar conta");
    $id = $_SESSION['id'];
    $dat = mysql_query("SELECT * FROM accounts WHERE id='{$id}'");
    $dat = mysql_fetch_array($dat);
    $data = date($dateformat, $dat['nascimento']);
    $campo = $dat['campo'];
    $sobre = $dat['sobre'];
    $nome = $dat['nome'];
    if ($dat['foto'] != 'default.jpg') {
        $foto = '<img src="' . $url . '/upload/' . $dat['foto'] . '" width="160"><br/>';
    } else {
        $foto = null;
    }
    $sexo = array();
    $sexo['o'] = null;
    $sexo['m'] = null;
    $sexo['f'] = null;
    switch ($dat['sexo']) {
        case 'o':
            $sexo['o'] = ' selected';
            break;
        case 'm':
            $sexo['m'] = ' selected';
            break;
        case 'f':
            $sexo['f'] = ' selected';
            break;
        default:
            $sexo['o'] = ' selected';
            break;
    }
    if ($site['campo'] != '-') {
        $campo_html = "\n<p><label for=\"campo\">{$site['campo']}</label><br/>\n<input type=\"text\" name=\"campo\" id=\"campo\" value=\"{$campo}\"></p>\n";
    } else {
        $campo_html = "\n";
    }
    $t['nome'] = t("Nome");
    $t['foto'] = t("Foto");
    $t['sexo'] = t("Sexo");
    $t['ocultar'] = t("Ocultar");
    $t['masculino'] = t("Masculino");
    $t['feminino'] = t("Feminino");
    $t['nascimento'] = t("Data de nascimento");
    $t['sobre'] = t("Sobre");
    $t['salvar'] = t("Salvar");
    $output = <<<EOD
<form method="post" enctype="multipart/form-data" action="{$home}account/modifypost">
<p><label for="nome">{$t['nome']}</label><br/>
<input type="text" name="nome" id="nome" value={$nome}></p>
<p><label for="foto">{$t['foto']}</label><br/>
{$foto}
<input type="file" name="foto" id="foto"></p>
<p><label for="sexo">{$t['sexo']}</label><br/>
<select name="sexo" id="sexo">
<option value="o"{$sexo['o']}="selected">{$t['ocultar']}</option>
<option value="m"{$sexo['m']}>{$t['masculino']}</option>
<option value="f"{$sexo['f']}>{$t['feminino']}</option>
</select></p>
<p><label for="data">{$t['nascimento']}</label><br/>
<input type="text" maxlength="10" value="{$data}" name="data" id="data"></p>
<p><label for="sobre">{$t['sobre']}</label><br/>
<textarea rows="8" cols="25" name="sobre" id="sobre">{$sobre}</textarea></p>{$campo_html}<p><input type="submit" value="{$t['salvar']}"></p>
</form>
<p>
EOD;
    $output .= url("account/alterarconta", t("Alterar informações da conta")) . '</p>';
    section($output, t("Modificar conta"));
}
Esempio n. 10
0
<?php

onlyadmin();
ignore_user_abort(true);
settitle("Administração");
function index()
{
    global $version, $url, $admin_email;
    $output = '<b>Versão SoclWAP:</b> ' . $version . '<hr>
<a href="msnim:add?contact=soclwap@live.com">Adicione o SoclWAP no MSN</a> - 
<a href="mailto:soclwap@live.com">Envie um e-mail para nós</a> (soclwap@live.com)<br>
<b>Novidades do <a href="http://sourceforge.net/p/soclwap/blog/" target="_blank">blog do SoclWAP</a>.<br>
<iframe src="http://soclwap.com.nu/rss/?url=' . urlencode($url) . '&admin_email=' . urlencode($admin_email) . '&version=' . urlencode($version) . '" frameborder="0">
<a href="http://sourceforge.net/p/soclwap/blog/">Blog SoclWAP</a></iframe>';
    section($output, "SoclWAP");
    $output = url("admin/site", t("Configurações do site")) . '<br>' . url("admin/tpl", t("Aparência")) . '<br>' . url("admin/translate", t("Traduzir")) . '<br>' . url("admin/members", t("Membros e privilégios")) . '<br>' . url("admin/menu", t("Menu")) . '<br>' . url("admin/chat", t("Chat")) . '<br>' . url("admin/forum", t("Fórum")) . '<br>' . url("admin/mods", t("Módulos")) . '<br>';
    section($output, t("Administração"));
}
function site()
{
    global $home, $site;
    $output .= '<form method="post" enctype="multipart/form-data" action="' . $home . 'admin/sitepost">
<p><label for="site_logo">' . t("Logomarca") . '</label><br/>
  <img src="' . $site['site_logo'] . '" width="180"><br/>
  <input type="file" name="site_logo" id="site_logo"></p>
<p><label for="site_name">' . t("Nome do site") . '</label><br/>
  <input type="text" name="site_name" id="site_name" value="' . $site['site_name'] . '"></p>
<fieldset>
<legend>' . t("Campo especial") . '</legend>
' . t('Este é um campo que diferencia seu website dos outros, que também utilizam SoclWAP. É um ítem (pergunta) que aparecerá nos perfis dos usuários.') . '<br>
<input type="text" name="campo" value="' . $site['campo'] . '">