Example #1
0
 /**
  * Формирование данных доступных в шаблоне страницы результатов поиска.
  */
 function ResultPage()
 {
     if (!empty($_REQUEST['sort'])) {
         A_Session::set(SECTION . '_rsort', $_REQUEST['sort']);
     }
     if (!empty($_REQUEST['rows'])) {
         A_Session::set(SECTION . '_rrows', $_REQUEST['rows']);
     }
     $sort = escape_order_string(A_Session::get(SECTION . '_rsort', !empty(A::$OPTIONS['mysort']) ? A::$OPTIONS['mysort'] : A::$OPTIONS['sort']));
     $rows = (int) A_Session::get(SECTION . '_rrows', A::$OPTIONS['rrows']);
     $this->Assign("rows", $rows);
     $this->Assign("sort", $sort);
     $_GET['filter'] = 1;
     $fields = array('name' => 'string', 'content' => 'string', 'tags' => 'string', 'art' => 'string', 'date' => 'int', 'price' => 'int', 'favorite' => 'bool', 'new' => 'bool');
     $where = $this->frontfilter('', $fields);
     if (!empty($_GET['idcat'])) {
         if (is_array($_GET['idcat'])) {
             $where2 = array();
             foreach ($_GET['idcat'] as $idcat) {
                 if ($idcats = $this->childCategories((int) $idcat)) {
                     $where2[] = "(idcat IN(" . implode(",", $idcats) . ") OR idcat1 IN(" . implode(",", $idcats) . ") OR idcat2 IN(" . implode(",", $idcats) . "))";
                 }
             }
             $where .= " AND (" . implode(" OR ", $where2) . ")";
         } elseif (empty($this->idcat)) {
             if ($this->category = A::$DB->getRowById($_GET['idcat'], SECTION . "_categories")) {
                 A::goUrl(shoplite_createCategoryLink($this->category['id'], SECTION) . 'result.html?' . getenv('QUERY_STRING'));
             }
         }
     }
     if ($this->category) {
         $this->category['link'] = shoplite_createCategoryLink($this->category['id'], SECTION);
         if (A::$OPTIONS['usetags']) {
             $this->category['tags'] = A_SearchEngine::getInstance()->convertTags($this->category['tags']);
         }
         $this->category = A::$OBSERVER->Modifier('fcategory_prepareValues', SECTION, $this->category);
         $this->Assign("category", $this->category);
         if ($idcats = $this->childCategories($this->idcat)) {
             $where .= " AND (idcat IN(" . implode(",", $idcats) . ") OR idcat1 IN(" . implode(",", $idcats) . ") OR idcat2 IN(" . implode(",", $idcats) . "))";
         }
     }
     $items = array();
     $pager = new A_Pager($rows);
     $pager->query("SELECT *,svote/cvote AS vote  FROM " . SECTION . "_catalog WHERE active='Y'{$where} ORDER BY {$sort}");
     while ($row = $pager->fetchRow()) {
         $row['link'] = shoplite_createItemLink($row['id'], SECTION);
         $row['tobasketlink'] = getSectionLink(SECTION) . "?action=addbasket&id=" . $row['id'];
         $row['tocomparelink'] = getSectionLink(SECTION) . "?action=addcompare&id=" . $row['id'];
         $row['category'] = getTreePath(SECTION . "_categories", $row['idcat']);
         $row['vote'] = round($row['vote'], 2);
         $row['available'] = $row['iscount'] > 0;
         if (A::$OPTIONS['useimages']) {
             $row['images'] = A::$DB->getAll("SELECT * FROM " . DOMAIN . "_images WHERE idsec=? AND iditem=? ORDER BY sort", array(SECTION_ID, $row['id']));
             $row['idimg'] = isset($row['images'][0]['id']) ? $row['images'][0]['id'] : 0;
         }
         if (A::$OPTIONS['usefiles']) {
             $row['files'] = A::$DB->getAll("SELECT * FROM " . DOMAIN . "_files WHERE idsec=? AND iditem=? ORDER BY sort", array(SECTION_ID, $row['id']));
             foreach ($row['files'] as $i => $data) {
                 $row['files'][$i]['link'] = (LANG == DEFAULTLANG ? "" : "/" . LANG) . "/getfile/" . $data['id'] . "/" . $data['name'];
                 $row['files'][$i]['size'] = sizestring($data['size']);
             }
             $row['idfile'] = isset($row['files'][0]['id']) ? $row['files'][0]['id'] : 0;
         }
         if (A::$OPTIONS['modprices']) {
             $mprices = !empty($row['mprices']) ? unserialize($row['mprices']) : array();
             $row['mprices'] = array();
             foreach ($mprices as $i => $mp) {
                 $row['mprices'][] = array('id' => $i, 'name' => $mp['name'], 'price' => $mp['price']);
             }
         }
         if (A::$OPTIONS['usetags']) {
             $row['tags'] = A_SearchEngine::getInstance()->convertTags($row['tags']);
         }
         prepareValues(SECTION, $row);
         $row = A::$OBSERVER->Modifier('shoplite_prepareValues', SECTION, $row);
         $items[] = $row;
     }
     $this->Assign("items", $items);
     $this->Assign("items_pager", $pager);
     $data = $pars = array();
     foreach ($_GET as $field => $value) {
         if (!empty($value)) {
             if (is_array($value)) {
                 $p = array();
                 foreach ($value as $val) {
                     $p[] = "{$field}[]=" . (int) $val;
                 }
                 $pars[$field] = implode("&", $p);
                 $data[$field] = implode(",", $value);
             } else {
                 $pars[$field] = "{$field}=" . urlencode($value);
                 $data[$field] = $value;
             }
         }
     }
     prepareValues(SECTION, $data);
     $filters = array();
     A::$DB->query("SELECT * FROM " . DOMAIN . "_fields WHERE item='" . SECTION . "' ORDER BY sort");
     while ($row = A::$DB->fetchRow()) {
         if (!empty($data[$row['field']])) {
             $filters[] = array('field' => $row['field'], 'caption' => $row['name_' . A::$LANG], 'value' => $data[$row['field']], 'link' => getSectionLink(SECTION) . "result.html?" . $pars[$row['field']]);
         }
     }
     A::$DB->free();
     $this->Assign("filters", $filters);
     $this->AddNavigation(SECTION_NAME, getSectionLink(SECTION));
     $this->AddNavCategories($this->idcat);
 }
Example #2
0
        echo $mail_title_encode;
        ?>
"><?php 
        if (strncmp($maildata[$i]["TITLE"], "Re: ", 4)) {
            echo "★" . htmlspecialchars($maildata[$i]["TITLE"]);
        } else {
            echo htmlspecialchars($maildata[$i]["TITLE"]);
        }
        ?>
 </a></td>
	<td class="mt3"><?php 
        echo strftime("%b&nbsp;%e&nbsp;%H&nbsp;:%M", $maildata[$i]["POSTTIME"]);
        ?>
</td>
	  <td class="mt3" style="text-align:right;padding-right:10pt;"><?php 
        echo sizestring($maildata[$i]['EFFSIZE']);
        ?>
</td>
	<td class="mt4"><input type="button" name="del" value="删除" class="bt1" onclick="bbsconfirm('bbsmailact.php?act=del&<?php 
        echo "dir=" . urlencode($mail_path) . "&file=" . urlencode($maildata[$i]["FILENAME"]) . "&title=" . $mail_title_encode;
        ?>
','确认删除该邮件吗?')"></td>
</tr>
<?php 
    }
}
?>
</table>
<table cellpadding="3" cellspacing="0" width="95%" border="0" class="b9">
<tr><td class="b9">
<input type="button" value="发送邮件" class="bt1" onclick="window.location.href='bbspstmail.php'">
Example #3
0
function pc_file_showfiles($pc, $c_dir, $root_pid)
{
    global $file_access;
    $c_files = array();
    if (!$c_dir->uf_readdir($c_files)) {
        exit($c_dir->err);
    }
    $c_files_num = sizeof($c_files);
    ?>
<hr width="100%">
<p class="f2">&nbsp;&nbsp;&nbsp;&nbsp;
[当前目录:<?php 
    echo $c_dir->fid == $root_pid ? '根目录' : $c_dir->filename;
    ?>
]</p>
<center>
<table cellspacing="0" cellpadding="5" width="95%" class="t1" border="0">
<tr>
	<td class="t2" width="40">&nbsp;</td>
	<td class="t2">文件名</td>
	<td class="t2" width="60">权限</td>
	<td class="t2" width="80">大小</td>
	<td class="t2" width="160">类型</td>
	<td class="t2" width="120">修改时间</td>
	<td class="t2" width="20">改</td>
	<td class="t2" width="20">删</td>
	<td class="t2" width="20">复</td>
	<td class="t2" width="20">剪</td>
	
</tr>
<?php 
    if ($root_pid != $c_dir->fid) {
        echo '<tr><td colspan="10" class="t8">[<a href="' . $_SERVER["PHP_SELF"] . '?userid=' . $pc["USER"] . '&pid=' . $root_pid . '">返回根目录</a>]</td></tr>' . '<tr><td colspan="10" class="t8">[<a href="' . $_SERVER["PHP_SELF"] . '?userid=' . $pc["USER"] . '&pid=' . $c_dir->pid . '">返回上层目录</a>]</td></tr>';
    }
    if ($c_files_num) {
        $start = 1;
        for ($i = 0; $i < $c_files_num; $i++) {
            if (!($file = new UserFile($c_files[$i], $c_dir->uid))) {
                continue;
            }
            if (!$file->fid) {
                continue;
            }
            if ($file->type == 1) {
                echo '<tr><td class="t3">目录</td>';
                $link_url = '<a href="' . $_SERVER["PHP_SELF"] . '?userid=' . $pc["USER"] . '&pid=' . $file->fid . '" title="' . htmlspecialchars($file->remark) . '">';
            } else {
                echo '<tr><td class="t3">' . $start . '</td>';
                $start++;
                $link_url = '<a href="';
                $link_url .= 'pcdownload.php?fid=' . $file->fid . '" title="' . htmlspecialchars($file->remark) . '" target="_blank">';
            }
            echo '<td class="t5">' . $link_url . html_format($file->filename) . '</a></td>' . '<td class="t3">' . $file_access[$file->access] . '</td>' . '<td class="t4">' . sizestring($file->filesize) . '</td>' . '<td class="t3">' . html_format($file->filetype) . '</td>' . '<td class="t4">' . time_format($file->filetime) . '</td>' . '<td class="t3"><a href="' . $_SERVER['PHP_SELF'] . '?userid=' . $pc['USER'] . '&act=edit&fid=' . $file->fid . '&pid=' . $c_dir->fid . '">改</a></td>' . '<td class="t3"><a href="#" onclick="bbsconfirm(\'' . $_SERVER['PHP_SELF'] . '?userid=' . $pc['USER'] . '&act=rm&fid=' . $file->fid . '&pid=' . $c_dir->fid . '\',\'确实要删除' . addslashes(htmlspecialchars($file->filename)) . '吗?\')" >删</a></td>';
            if ($_COOKIE['PCFILEFID']) {
                if ($file->type == 1) {
                    echo '<td colspan="2" class="t3"><a href="' . $_SERVER['PHP_SELF'] . '?userid=' . $pc['USER'] . '&act=pt&fid=' . intval($_COOKIE['PCFILEFID']) . '&pid=' . $c_dir->fid . '&tid=' . $file->fid . '">粘</a></td>';
                } else {
                    echo '<td colspan="2" class="t3">-</td>';
                }
            } else {
                echo '<td class="t3"><a href="' . $_SERVER['PHP_SELF'] . '?userid=' . $pc['USER'] . '&act=cp&fid=' . $file->fid . '&pid=' . $c_dir->fid . '">复</a></td>' . '<td class="t3"><a href="' . $_SERVER['PHP_SELF'] . '?userid=' . $pc['USER'] . '&act=mv&fid=' . $file->fid . '&pid=' . $c_dir->fid . '">剪</a></td>';
            }
            unset($file);
        }
    }
    ?>
</table>
<?php 
    if ($_COOKIE['PCFILEFID']) {
        echo '<br />[<a href="' . $_SERVER['PHP_SELF'] . '?userid=' . $pc['USER'] . '&act=pt&fid=' . intval($_COOKIE['PCFILEFID']) . '&pid=' . $root_pid . '&tid=' . $root_pid . '">粘贴到根目录</a>]&nbsp;' . '[<a href="' . $_SERVER['PHP_SELF'] . '?userid=' . $pc['USER'] . '&act=cl&pid=' . $c_dir->fid . '">清空剪贴板</a>]<br/>';
    }
    ?>
</center>
<hr width="100%">
<?php 
}
Example #4
0
}
echo sizestring($rem);
?>
 字节</b></font>.</p>
</form>

<form name="deleteattach" ENCTYPE="multipart/form-data" method="post" class="left" action=""> 
<?php 
if ($sessionid) {
    echo "<input type='hidden' name='sid' value='{$sessionid}' />";
}
?>
<ol style="padding-left: 2em; margin-left: 0em;">帖子内的附件列表: (最多能上传 <?php 
echo BBS_MAXATTACHMENTCOUNT;
?>
 个, 还能上传 <font color="#FF0000"><b><?php 
echo BBS_MAXATTACHMENTCOUNT - $filecount;
?>
</b></font> 个)
<?php 
for ($i = 0; $i < $filecount; $i++) {
    $f = $attachments[$i];
    echo "<li><a target='_blank' href='#' id='att" . $i . "'>" . $f["name"] . "</a> (" . sizestring($f["size"]) . "字节) <a href=\"javascript:deletesubmit('" . ($i + 1) . "');\">删除</a></li>";
}
?>
</ol>
</form>
</div>
</body>
</html>
Example #5
0
            if (is_uploaded_file($_FILES['attachfile']['tmp_name'])) {
                if (move_uploaded_file($_FILES['attachfile']['tmp_name'], $tmpfilename) == FALSE) {
                    echo "保存失败";
                } else {
                    echo "文件导入成功!";
                    $ret = bbs_csv_to_al($tmpfilename);
                    echo "共导入" . $ret . "项";
                    @unlink($tmpfilename);
                    break;
                }
            }
            echo "保存文件失败!";
            break;
        case UPLOAD_ERR_INI_SIZE:
        case UPLOAD_ERR_FORM_SIZE:
            echo "文件超过预定的大小" . sizestring(BBS_MAXATTACHMENTSIZE) . "字节";
            break;
        case UPLOAD_ERR_PARTIAL:
            echo "文件传输出错!";
            break;
        case UPLOAD_ERR_NO_FILE:
            echo "没有文件上传!";
            break;
        case 100:
            echo "无效的文件名!";
        default:
            echo "未知错误";
    }
    echo "<br />";
    page_footer(FALSE);
}
Example #6
0
</form>

<form name="deleteattach" ENCTYPE="multipart/form-data" method="post" class="left" action=""> 
<input type="hidden" name="type" value="<?php 
echo $type;
?>
" />
<?php 
if ($sessionid) {
    echo "<input type='hidden' name='sid' value='{$sessionid}' />";
}
?>
<ol style="padding-left: 2em; margin-left: 0em;">已经上传的附件列表: (最多能上传 <?php 
echo $max_file_count;
?>
 个, 还能上传 <font color="#FF0000"><b><?php 
echo $max_file_count - $filecount;
?>
</b></font> 个)
<?php 
for ($i = 0; $i < $filecount; $i++) {
    $f = $attachments[$i];
    echo "<li>" . $f["name"] . " (" . sizestring($f["size"]) . "字节) <a href=\"javascript:deletesubmit('" . base64_encode($f["name"]) . "');\">删除</a></li>";
}
?>
</ol>
</form>
</div>
</body>
</html>
Example #7
0
 /**
  * Формирование данных доступных в шаблоне.
  */
 function createData()
 {
     $this->supportCached();
     $this->addCacheParam_Get('page');
     if ($this->month == 0) {
         $this->month = date('m');
     }
     if ($this->year == 0) {
         $this->year = date('Y');
     }
     $checkeds = !empty(A::$OPTIONS['sections']) ? unserialize(A::$OPTIONS['sections']) : array();
     $srows = $sections = array();
     foreach ($checkeds as $idsec) {
         if ($srow = A::$DB->getRowById($idsec, DOMAIN . "_sections")) {
             $section = DOMAIN . "_" . $srow['lang'] . "_" . $srow['name'];
             $sections[$section] = $srow['module'];
             $srows[$section] = $srow;
         }
     }
     $calendar = new A_Calendar($sections);
     $this->Assign("calendar", $calendar->getMonthHTML($this->day, $this->month, $this->year));
     if ($this->day > 0) {
         $date1 = mktime(0, 0, 0, $this->month, $this->day, $this->year);
         $date2 = mktime(23, 59, 59, $this->month, $this->day, $this->year);
         $this->Assign("date", $date1);
     } else {
         $date1 = mktime(0, 0, 0, $this->month, 1, $this->year);
         $date2 = mktime(0, 0, 0, $this->month + 1 > 12 ? 1 : $this->month + 1, 1, $this->month + 1 > 12 ? $this->year + 1 : $this->year) - 1;
         $this->Assign("date1", $date1);
         $this->Assign("date2", $date2);
     }
     $items = array();
     foreach ($sections as $section => $module) {
         $srows[$section]['caption'] = $srows[$section]['caption_' . LANG];
         $srows[$section]['link'] = getSectionLink($section);
         A::$DB->query("SELECT *,svote/cvote AS vote FROM {$section}_catalog WHERE date>={$date1} AND date<={$date2} AND active='Y' ORDER BY date");
         while ($row = A::$DB->fetchRow()) {
             $row['section'] = $section;
             $items[] = $row;
         }
         A::$DB->free();
     }
     $items = array_multisort_key($items, 'date');
     $pager = new A_Pager(A::$OPTIONS['rows']);
     $items = $pager->setItems($items);
     foreach ($items as $i => $row) {
         $section = $row['section'];
         $row['section'] = $srows[$section];
         $row['section_name'] = $srows[$section]['caption'];
         $row['section_link'] = $srows[$section]['link'];
         $row['link'] = catalog_createItemLink($row['id'], $section);
         $row['vote'] = round($row['vote'], 2);
         $row['category'] = getTreePath("{$section}_categories", $row['idcat']);
         $row['images'] = A::$DB->getAll("SELECT * FROM " . DOMAIN . "_images WHERE idsec=? AND iditem=? ORDER BY sort", array($srows[$section]['id'], $row['id']));
         $row['idimg'] = isset($row['images'][0]['id']) ? $row['images'][0]['id'] : 0;
         $row['files'] = A::$DB->getAll("SELECT * FROM " . DOMAIN . "_files WHERE idsec=? AND iditem=? ORDER BY sort", array($srows[$section]['id'], $row['id']));
         foreach ($row['files'] as $i => $data) {
             $row['files'][$i]['link'] = (LANG == DEFAULTLANG ? "" : "/" . LANG) . "/getfile/" . $data['id'] . "/" . $data['name'];
             $row['files'][$i]['size'] = sizestring($data['size']);
         }
         $row['idfile'] = isset($row['files'][0]['id']) ? $row['files'][0]['id'] : 0;
         if (!empty($row['tags'])) {
             $row['tags'] = A_SearchEngine::getInstance()->convertTags($row['tags']);
         }
         prepareValues($section, $row);
         $items[$i] = $row;
     }
     $this->Assign("items", $items);
     $this->Assign("items_pager", $pager);
     $this->AddNavigation(SECTION_NAME);
 }
Example #8
0
 /**
  * Формирование данных доступных в шаблоне детальной страницы материала.
  */
 function ItemPage()
 {
     $this->supportCached();
     if ($this->idcat > 0) {
         $this->category['link'] = catalog_createCategoryLink($this->category['id'], SECTION);
         if (A::$OPTIONS['usetags']) {
             $this->category['tags'] = A_SearchEngine::getInstance()->convertTags($this->category['tags']);
         }
         $this->category = A::$OBSERVER->Modifier('fcategory_prepareValues', SECTION, $this->category);
         $this->Assign("category", $this->category);
     }
     $itemdata = $this->itemdata;
     $itemdata['vote'] = $itemdata['cvote'] > 0 ? round($itemdata['svote'] / $itemdata['cvote'], 2) : 0;
     if (A::$OPTIONS['useimages']) {
         $itemdata['images'] = A::$DB->getAll("SELECT * FROM " . DOMAIN . "_images WHERE idsec=? AND iditem=? ORDER BY sort", array(SECTION_ID, $itemdata['id']));
         $itemdata['idimg'] = isset($itemdata['images'][0]['id']) ? $itemdata['images'][0]['id'] : 0;
     }
     if (A::$OPTIONS['usefiles']) {
         $itemdata['files'] = A::$DB->getAll("SELECT * FROM " . DOMAIN . "_files WHERE idsec=? AND iditem=? ORDER BY sort", array(SECTION_ID, $this->iditem));
         foreach ($itemdata['files'] as $i => $data) {
             $itemdata['files'][$i]['link'] = (LANG == DEFAULTLANG ? "" : "/" . LANG) . "/getfile/" . $data['id'] . "/" . $data['name'];
             $itemdata['files'][$i]['size'] = sizestring($data['size']);
         }
         $itemdata['idfile'] = isset($itemdata['files'][0]['id']) ? $itemdata['files'][0]['id'] : 0;
     }
     if (A::$OPTIONS['usetags']) {
         $itemdata['tags'] = A_SearchEngine::getInstance()->convertTags($itemdata['tags']);
     }
     prepareValues(SECTION, $itemdata);
     $itemdata = A::$OBSERVER->Modifier('catalog_prepareValues', SECTION, $itemdata);
     $this->Assign("item", $itemdata);
     if (A::$OPTIONS['usecomments']) {
         $comments = array();
         A::$DB->query("SELECT * FROM " . DOMAIN . "_comments WHERE idsec=" . SECTION_ID . " AND iditem={$this->iditem} AND active='Y' ORDER BY date");
         while ($row = A::$DB->fetchRow()) {
             if ($row['iduser'] > 0 && A::$AUTH->section) {
                 if ($row['user'] = A::$DB->getRowById($row['iduser'], A::$AUTH->section)) {
                     prepareValues(A::$AUTH->section, $row['user']);
                 }
             }
             $comments[] = $row;
         }
         A::$DB->free();
         $this->Assign("comments", $comments);
         $form = array();
         $form['name'] = !empty($_REQUEST['name']) ? $_REQUEST['name'] : (A::$AUTH->isLogin() ? A::$AUTH->data['name'] : "");
         $form['message'] = !empty($_REQUEST['message']) ? $_REQUEST['message'] : "";
         $this->Assign("form", $form);
         $this->Assign("captcha", $captcha = substr(time(), rand(0, 6), 4));
         A_Session::set("captcha", md5($captcha));
     }
     if (A::$OPTIONS['usevote']) {
         $this->Assign("isvote", A_Session::get(SECTION . "_vote_" . $this->iditem, false));
         $this->addCacheParam_Session(SECTION . "_vote_" . $this->iditem);
     }
     $this->AddNavigation(SECTION_NAME, getSectionLink(SECTION));
     if (isset($this->category)) {
         $this->AddNavCategories($this->category['id']);
     }
     $this->title = $this->itemdata['name'] . (!empty($this->title) ? " - " . $this->title : "");
     if (!empty($this->itemdata['keywords'])) {
         $this->keywords = $this->itemdata['keywords'];
     }
     $this->description = $this->itemdata['description'];
 }
Example #9
0
function atomic_mail()
{
    global $currentuser;
    atomic_mail_header();
    $mail_fullpath = bbs_setmailfile($currentuser["userid"], ".DIR");
    $mail_num = bbs_getmailnum2($mail_fullpath);
    if ($mail_num <= 0 || $mail_num > 30000) {
        atomic_error("读取邮件数据失败!");
    }
    $start = isset($_GET["start"]) ? @intval($_GET["start"]) : 999999;
    $num = ARTCNT;
    if ($start > $mail_num - ARTCNT + 1) {
        $start = $mail_num - ARTCNT + 1;
    }
    if ($start <= 0) {
        $start = 1;
        if ($num > $mail_num) {
            $num = $mail_num;
        }
    }
    $maildata = bbs_getmails($mail_fullpath, $start - 1, $num);
    if ($maildata == FALSE) {
        atomic_error("读取邮件数据失败!");
    }
    $html = '<form action="?" method="get"><input type="hidden" name="act" value="mail"/>';
    $html .= '<a href="?act=mailpost">写信</a> ';
    if ($start > 1) {
        $i = $start - ARTCNT;
        if ($i < 1) {
            $i = 1;
        }
        $html .= '<a href="?act=mail&start=1">第一页</a> ';
        $html .= '<a href="?act=mail&start=' . $i . '">上一页</a> ';
    } else {
        $html .= '第一页 上一页 ';
    }
    if ($start <= $mail_num - ARTCNT) {
        $i = $start + ARTCNT;
        if ($i > $mail_num) {
            $i = $mail_num;
        }
        $html .= '<a href="?act=mail&start=' . $i . '">下一页</a> ';
        $html .= '<a href="?act=mail">最后一页</a> ';
    } else {
        $html .= '下一页 最后一页 ';
    }
    $html .= '<input type="submit" value="跳转到"/> 第 <input type="text" name="start" size="3" /> 篇</form>';
    $html .= '<pre> 编号    发信者       日  期  标  题<br/>';
    for ($i = 0; $i < count($maildata); $i++) {
        $article = $maildata[$i];
        $title = $article["TITLE"];
        if (strncmp($title, "Re: ", 4) != 0) {
            $title = "★ " . $title;
        }
        $html .= sprintf("%5d ", $start + $i);
        $html .= $maildata[$i]["FLAGS"];
        $html .= sprintf(" %-12.12s ", $article["OWNER"]);
        $html .= strftime("%b %e ", $article["POSTTIME"]);
        $html .= $maildata[$i]["ATTACHPOS"] > 0 ? "@" : " ";
        $html .= "<a href='?act=mailread&num=" . ($start + $i) . "'>" . htmlspecialchars($title) . " </a> (" . sizestring($maildata[$i]['EFFSIZE']) . ")<br/>";
    }
    $html .= "</pre>";
    echo $html;
    atomic_footer();
}
Example #10
0
 /**
  * Формирование данных доступных в шаблоне.
  */
 function createData()
 {
     static $useitems = array();
     if ($this->params['sort'] != 5) {
         $this->supportCached();
     }
     $this->params['idcat'] = (int) $this->params['idcat'];
     $this->params['rows'] = (int) $this->params['rows'];
     if ($this->params['idcat']) {
         $catrow = A::$DB->getRowById($this->params['idcat'], "{$this->section}_categories");
         $catrow['link'] = catalog_createCategoryLink($this->params['idcat'], $this->section);
         $this->Assign("category", $catrow);
     }
     if ($this->section == SECTION && A::$MAINFRAME->iditem) {
         $useitems[$this->section][] = A::$MAINFRAME->iditem;
     }
     switch ($this->params['sort']) {
         default:
         case 1:
             $sort = "date DESC";
             break;
         case 2:
             $sort = "date";
             break;
         case 3:
             $sort = "name";
             break;
         case 4:
             $sort = "sort";
             break;
         case 5:
             $sort = "RAND()";
             break;
     }
     $where = array();
     if ($this->params['idcat']) {
         $idcat = $this->params['idcat'];
         $childcats = array($idcat);
         getTreeSubItems($this->section . "_categories", $idcat, $childcats);
         $where[] = "idcat IN(" . implode(",", $childcats) . ")";
     }
     if (!empty($this->params['filter'])) {
         $where[] = $this->params['filter'];
     }
     if (!empty($useitems[$this->section]) && !empty($this->params['nodouble'])) {
         $where[] = "NOT id IN(" . implode(',', $useitems[$this->section]) . ")";
     }
     $sql = "\r\r\n\tSELECT *,svote/cvote AS vote FROM {$this->section}_catalog\r\r\n\tWHERE active='Y'" . (!empty($where) ? " AND " . implode(" AND ", $where) : "") . "\r\r\n\tORDER BY {$sort}";
     if ($this->params['rows']) {
         A::$DB->queryLimit($sql, 0, $this->params['rows']);
     } else {
         A::$DB->query($sql);
     }
     $items = array();
     while ($row = A::$DB->fetchRow()) {
         $row['category'] = getTreePath($this->section . "_categories", $row['idcat']);
         $row['link'] = catalog_createItemLink($row['id'], $this->section);
         $row['vote'] = round($row['vote'], 2);
         if ($this->options['useimages']) {
             $row['images'] = A::$DB->getAll("\r\r\n\t    SELECT * FROM " . getDomain($this->section) . "_images\r\r\n\t    WHERE idsec=? AND iditem=? ORDER BY sort", array($this->section_id, $row['id']));
             $row['idimg'] = isset($row['images'][0]['id']) ? $row['images'][0]['id'] : 0;
         }
         if ($this->options['usefiles']) {
             $row['files'] = A::$DB->getAll("\r\r\n\t    SELECT * FROM " . getDomain($this->section) . "_files\r\r\n\t    WHERE idsec=? AND iditem=? ORDER BY sort", array($this->section_id, $row['id']));
             foreach ($row['files'] as $i => $data) {
                 $row['files'][$i]['link'] = (LANG == DEFAULTLANG ? "" : "/" . LANG) . "/getfile/" . $data['id'] . "/" . $data['name'];
                 $row['files'][$i]['size'] = sizestring($data['size']);
             }
             $row['idfile'] = isset($row['files'][0]['id']) ? $row['files'][0]['id'] : 0;
         }
         if ($this->options['usetags']) {
             $row['tags'] = A_SearchEngine::getInstance()->convertTags($row['tags']);
         }
         prepareValues($this->section, $row);
         $row = A::$OBSERVER->Modifier('catalog_prepareValues', $this->section, $row);
         $useitems[$this->section][] = $row['id'];
         $items[] = $row;
     }
     A::$DB->free();
     $this->Assign("items", $items);
     $this->Assign("items_count", count($items));
 }
Example #11
0
 /**
  * Формирование данных доступных в шаблоне.
  */
 function createData()
 {
     static $useitems = array();
     if ($this->params['sort'] != 5) {
         $this->supportCached();
     }
     $this->params['idcat'] = (int) $this->params['idcat'];
     $this->params['rows'] = (int) $this->params['rows'];
     if ($this->params['idcat']) {
         $catrow = A::$DB->getRowById($this->params['idcat'], "{$this->section}_categories");
         $catrow['link'] = shoplite_createCategoryLink($this->params['idcat'], $this->section);
         $this->Assign("category", $catrow);
     }
     if ($this->section == SECTION && A::$MAINFRAME->iditem) {
         $useitems[] = A::$MAINFRAME->iditem;
     }
     if (!empty($this->params['mysort'])) {
         $sort = $this->params['mysort'];
     } else {
         switch ($this->params['sort']) {
             case 1:
                 $sort = "name";
                 break;
             case 2:
                 $sort = "price DESC";
                 break;
             case 3:
                 $sort = "price";
                 break;
             case 4:
                 $sort = "sort";
                 break;
             case 5:
                 $sort = "RAND()";
                 break;
         }
     }
     $where = array();
     if ($this->params['idcat']) {
         $idcat = $this->params['idcat'];
         $childcats = array($idcat);
         getTreeSubItems($this->section . "_categories", $idcat, $childcats);
         $where[] = "(idcat IN(" . implode(",", $childcats) . ") OR idcat1 IN(" . implode(",", $childcats) . ") OR idcat2 IN(" . implode(",", $childcats) . "))";
     }
     switch ($this->params['filter']) {
         case 1:
             $where[] = "favorite='Y'";
             break;
         case 2:
             $where[] = "new='Y'";
             break;
     }
     if (!empty($this->params['myfilter'])) {
         $where[] = $this->params['myfilter'];
     }
     if ($useitems && !empty($this->params['nodouble'])) {
         $where[] = "NOT id IN(" . implode(',', $useitems) . ")";
     }
     $sql = "\r\r\n\tSELECT * FROM {$this->section}_catalog\r\r\n\tWHERE active='Y'" . (!empty($where) ? " AND " . implode(" AND ", $where) : "") . "\r\r\n\tORDER BY {$sort}";
     if ($this->params['rows']) {
         A::$DB->queryLimit($sql, 0, $this->params['rows']);
     } else {
         A::$DB->query($sql);
     }
     $items = array();
     while ($row = A::$DB->fetchRow()) {
         if ($this->params['idcat'] == 0) {
             $row['category'] = getTreePath($this->section . "_categories", $row['idcat']);
         }
         $row['link'] = shoplite_createItemLink($row['id'], $this->section);
         $row['tobasketlink'] = getSectionLink($this->section) . "?action=addbasket&id=" . $row['id'];
         $row['vote'] = $row['cvote'] > 0 ? round($row['svote'] / $row['cvote'], 2) : 0;
         $row['available'] = $row['iscount'] > 0;
         if ($this->options['useimages']) {
             $row['images'] = A::$DB->getAll("\r\r\n\t    SELECT * FROM " . getDomain($this->section) . "_images\r\r\n\t    WHERE idsec=? AND iditem=? ORDER BY sort", array($this->section_id, $row['id']));
             $row['idimg'] = isset($row['images'][0]['id']) ? $row['images'][0]['id'] : 0;
         }
         if ($this->options['usefiles']) {
             $row['files'] = A::$DB->getAll("\r\r\n\t    SELECT * FROM " . getDomain($this->section) . "_files\r\r\n\t    WHERE idsec=? AND iditem=? ORDER BY sort", array($this->section_id, $row['id']));
             foreach ($row['files'] as $i => $data) {
                 $row['files'][$i]['link'] = (LANG == DEFAULTLANG ? "" : "/" . LANG) . "/getfile/" . $data['id'] . "/" . $data['name'];
                 $row['files'][$i]['size'] = sizestring($data['size']);
             }
             $row['idfile'] = isset($row['files'][0]['id']) ? $row['files'][0]['id'] : 0;
         }
         if ($this->options['modprices']) {
             $mprices = !empty($row['mprices']) ? unserialize($row['mprices']) : array();
             $row['mprices'] = array();
             foreach ($mprices as $i => $mp) {
                 $row['mprices'][] = array('id' => $i, 'name' => $mp['name'], 'price' => $mp['price']);
             }
         }
         if ($this->options['usetags']) {
             $row['tags'] = A_SearchEngine::getInstance()->convertTags($row['tags']);
         }
         prepareValues($this->section, $row);
         $row = A::$OBSERVER->Modifier('shoplite_prepareValues', $this->section, $row);
         $useitems[] = $row['id'];
         $items[] = $row;
     }
     A::$DB->free();
     $this->Assign("items", $items);
     $this->Assign("items_count", count($items));
     $this->Assign('valute', $this->options['valute']);
 }