Exemple #1
0
 function getAllLog($currentpage, $pagesize = 10, $logtype = 0)
 {
     $sql = "select * from I_log where logtype={$logtype}  order by id desc  limit " . ($currentpage - 1) * $pagesize . ",{$pagesize}";
     //echo $sql;
     $result = getresult($sql);
     $i = 0;
     while ($row = getresultarray($result)) {
         $this->allLogs[$i] = new Log();
         //echo $row["id"];
         $this->allLogs[$i]->id = $row["id"];
         $this->allLogs[$i]->adminName = $row["adminname"];
         $this->allLogs[$i]->operateContent = $row["operatecontent"];
         $this->allLogs[$i]->ip = $row["ip"];
         $this->allLogs[$i]->operateTime = $row["operatetime"];
         //echo $allLogs[$i]->id;
         $i++;
     }
     //print_r($this->allLogs);
 }
Exemple #2
0
function showfield($columnid)
{
    $result = getresult("select * from I_field where columnid={$columnid}");
    if (getresultnumrows($result) < 1) {
        echo "<tr>";
        echo "<td colspan='6' height='25' align='center'>" . gettext_r("haveNot") . gettext_r("field") . "</td>";
        echo "<tr>";
        return;
    }
    while ($row = getresultarray($result)) {
        echo "<tr class='list'>";
        echo "<td align='center'>" . $row["id"] . "</td>\n";
        echo "<td align='center'>" . $row["fieldname"] . "</td>";
        echo "<td align='center'>" . $row["info"] . "</td>";
        echo "<td align='center' width='100'>";
        echo "<a href=\"admin_field.php?action=modify&fieldid=" . $row["id"] . "&columnid={$columnid}\">" . gettext_r("update") . "</a>";
        echo " | ";
        echo "<a href=\"javascript:if(confirm('" . gettext_r("ifDelete") . "'))jump('admin_field.php','delete'," . $row["id"] . ")\">" . gettext_r("delete") . "</a>";
        echo "</td>\n";
        echo "</tr>";
    }
}
Exemple #3
0
function showcomment($columnid, $currentpage, $pagesize = 10)
{
    global $childcolumnString;
    getchildcolumnid_improveed($columnid);
    $result = getresult("select * from I_comment where articleid in (" . getarticleidlist($columnid) . ") order by id desc limit " . ($currentpage - 1) * $pagesize . "," . "{$pagesize}");
    //echo "select * from I_comment where articleid in (".getarticleidlist($columnid).") limit ".($currentpage-1)*$pagesize.","."$pagesize";
    if ($currentpage > 1 && getresultNumrows($result) < 1) {
        echo "<script type=\"text/javascript\">window.location='admin_comment.php?columnid={$columnid}&currentpage=" . ($currentpage - 1) . "'</script>";
        return;
    }
    if (getresultnumrows($result) < 1) {
        echo "<tr>";
        echo "<td colspan='6' height='25' align='center'>" . gettext_r("haveNot") . gettext_r("comment") . "</td>";
        echo "<tr>";
        return;
    }
    while ($row = getresultarray($result)) {
        echo "<tr class='list'>";
        echo "<td align='center'><input type='checkbox'  name='list'  value='" . $row["id"] . "'></td>\n";
        echo "<td align='center'>" . $row["id"] . "</td>\n";
        echo "<td align='center'>";
        echo getresultData(getresult("select title from I_article where id=" . $row["articleid"]), 0, "title");
        echo "</td>\n";
        echo "<td align='center'>" . $row["commentcontent"] . "</td>\n";
        echo "<td align='center'>" . $row["username"] . "</td>\n";
        echo "<td align='center'>";
        if ($row["ifpass"] === "0") {
            echo gettext_r("notPass");
        } else {
            echo gettext_r("havePass");
        }
        echo "</td>\n";
        echo "<td align='center' width='100'><a href=\"javascript:if(confirm('" . gettext_r("ifDelete") . "'))jump('admin_comment.php','delete'," . $row["id"] . ")\">" . gettext_r("delete") . "</a></td>\n";
        echo "</tr>";
    }
}
Exemple #4
0
function translateSdefFeildlabel($template)
{
    global $id;
    //文章id
    $id = $_GET["articleid"] != NULL ? $_GET["articleid"] : $id;
    $columnid = $_GET["columnid"] != NULL ? $_GET["columnid"] : getarticleinfo($_GET["articleid"], "columnid");
    if ($columnid == NULL && $id != NULL) {
        $columnid = getarticleinfo($id, "columnid");
    }
    if ($columnid != NULL && $columnid > 0 || $id != NULL && $id > 0) {
        //如果栏目id为空或者小于1,则不对模板进行处理
        $sdef_fields = getresult("select * from I_field where columnid in (" . getChanelidByColumnid($columnid) . ")");
        //echo "select * from I_field where columnid in (".getChanelidByColumnid($columnid).")";
        $fieldname = "";
        $fieldvalue = "";
        while ($row = getresultarray($sdef_fields)) {
            $fieldname = $row["fieldname"];
            $temparticle = getresult("select * from I_article where id={$id}");
            if (!$temparticle) {
                continue;
            }
            $fieldvalue = getresultData($temparticle, 0, $fieldname);
            //如果值为空,则替换为空串
            if ($fieldvalue == NULL) {
                $fieldvalue = "";
            }
            $template = str_replace("【#" . $fieldname . "】", $fieldvalue, $template);
        }
    }
    return $template;
}
Exemple #5
0
" /></td>
  </tr>
  <tr>
    <td class='label'>修改时间:</td>
    <td class='attributeinput'><input type="text" name="modifytime" value="<?php 
        echo date("Y-m-d H:i:s");
        ?>
" /></td>
  </tr>
  <!--自定义字段-->
   <tr>
    <td class='label'>属性:</td>
    <td class='attributeinput'>
    <?php 
        $sdef_fields = getresult("select * from I_field where columnid=" . getChanelidByColumnid($columnid));
        while ($row = getresultarray($sdef_fields)) {
            echo $row["info"] . ":<input type='text' name='" . $row["fieldname"] . "' value='" . getresultData($result, 0, $row["fieldname"]) . "'><br>";
        }
        ?>
    </td>
  </tr>
  <!--自定义字段-->
  <tr>
    <td class='label'>简介:</td>
    <td class='attributeinput'><textarea name="notes"><?php 
        echo $notes;
        ?>
</textarea></td>
  </tr>
  <tr>
    <td class='label'>正文:<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />缩略图预览:<br />
Exemple #6
0
function translateSearchlist($template)
{
    global $pagesize;
    //如果指定页大小,则用用户参数填充$pagesize
    //匹配自定义文章列表标签正则
    $flag = "/【searchlist(\\(\\d*,\\d*,\\d*,\\d*\\))】([\\s\\S]*?)【\\/searchlist】/";
    preg_match_all($flag, $template, $matches, PREG_SET_ORDER);
    //替换所有articlelist标签
    $html = $template;
    //echo $template;
    foreach ($matches as $matche) {
        //得到需要循环的部分
        $str = $matche[2];
        //得到标签参数参数
        $parameter = substr($matche[1], 1, strlen($matche[1]) - 2);
        $parameter = split(',', $parameter);
        $articlenum = $parameter[0];
        $titlelen = $parameter[1];
        $timetype = $parameter[2];
        $sorttype = $parameter[3];
        //定义排序方式的字串
        if ($sorttype == "0") {
            //id降序
            $sortstr = "order by id desc";
        } else {
            $sortstr = "order by id asc";
        }
        //得到url参数
        $pagesize = $articlenum;
        //($_GET["pagesize"]==NULL || $_GET["pagesize"]<=0)?10:$_GET["pagesize"];
        $currentpage = $_GET["currentpage"] == NULL || $_GET["currentpage"] <= 0 ? 1 : $_GET["currentpage"];
        //根据参数从数据库取得数据
        $searchSql = "select *,left(title,{$titlelen}) as title from I_article where ifpass=1";
        if ($_GET["title"] != NULL && $_GET["title"] != "") {
            $searchSql .= " and title like '%" . $_GET["title"] . "%'";
        }
        if ($_GET["columnid"] != NULL && $_GET["columnid"] > 0) {
            $sdef_fields = getresult("select * from I_field where columnid=" . getChanelidByColumnid($_GET["columnid"]));
            while ($row = getresultarray($sdef_fields)) {
                if ($_GET[$row["fieldname"]] == NULL || $_GET[$row["fieldname"]] == "") {
                    continue;
                }
                if ($row["datatype"] == "double") {
                    $searchSql .= " and " . $row["fieldname"] . " " . $_GET[$row["fieldname"] . "ctype"] . $_GET[$row["fieldname"]];
                    //echo $_GET[$row["fieldname"]."ctype"]."测试";
                } else {
                    $searchSql .= " and " . $row["fieldname"] . " like '" . $_GET[$row["fieldname"]] . "'";
                }
            }
            //在所有子栏目中搜索
            $childcolumnStr = "";
            getchildcolumnid($_GET["columnid"], $childcolumnStr);
            $searchSql .= " and columnid in (" . $childcolumnStr . ")";
            //echo "Iron".$searchSql;
        }
        $searchSql .= " " . $sortstr . " limit " . ($currentpage - 1) * $pagesize . ",{$pagesize}";
        //echo $searchSql;
        $result = getresult($searchSql);
        //匹配循环部分的标签
        $tag_flag = "/【#[\\s\\S]*?】/";
        preg_match_all($tag_flag, $str, $data_tag, PREG_SET_ORDER);
        $tag_index = null;
        //记录标签循环部分每中标签出现的次数,如果出现第二次,则视为要显示两列数据,依次类推...
        //将要输出的html代码;
        $temphtml = "";
        while ($row = getresultArray($result)) {
            $str = $matche[2];
            foreach ($data_tag as $temp) {
                //$tempindex = 0;
                for (;;) {
                    if ($tag_index[$temp[0]] < 1) {
                        //初始化一篇文章数据
                        initarticledata($row);
                        //替换标签
                        $str = replace_once($temp[0], $str, getvalue($temp[0], $timetype));
                        //当前匹配标签计数器加1
                        if (isset($tag_index[$temp[0]])) {
                            $tag_index[$temp[0]]++;
                        } else {
                            $tag_index[$temp[0]] = 1;
                        }
                        break;
                    } else {
                        //取新文章数据
                        $row = getresultArray($result);
                        //第二次出现的标签都会引发取得新数据,故产生错误
                        //初始化数据
                        initarticledata($row);
                        //当前匹配标签计数器加1
                        $tag_index = NULL;
                    }
                }
            }
            $tag_index = NULL;
            $temphtml .= $str;
        }
        //echo $matche[0]."<br>";//.$temphtml;
        if (trim($temphtml) == "") {
            $html = str_replace($matche[0], gettext_r("haveNot") . gettext_r("search") . gettext_r("result"), $html);
        } else {
            $html = str_replace($matche[0], $temphtml, $html);
        }
    }
    //显示搜索表单
    $html = str_replace("【#searchform】", getsearchform(), $html);
    //显示分页
    $html = str_replace("【#showpage】", getsearchPage($pagesize), $html);
    return $html;
}