Example #1
0
function textarea_edit($string)
{
    if (!is_array($string)) {
        return forTag($string);
    }
    foreach ($string as $key => $val) {
        $string[$key] = textarea_edit($val);
    }
    return $string;
}
 function getOpts()
 {
     $opts = ts_cache("site_options");
     if (!$opts) {
         $map['appname'] = "thinksns";
         $data = $this->where($map)->findAll();
         foreach ($data as $k => $v) {
             $opts[$v["name"]] = forTag($v["value"]);
         }
         //缓存起来
         ts_cache("site_options", $opts);
     }
     return $opts;
 }
 function getOpts4Edit()
 {
     $te_arr = array("allow_ips", "deny_ips", "verify", "feed_privacy", "gonggao", "danxing", "fuxing");
     $data = $this->where("appname='thinksns'")->findAll();
     foreach ($data as $k => $v) {
         if ($v["name"] != "privacy") {
             if (in_array($v["name"], $te_arr)) {
                 $opts[$v["name"]] = forDisIp($v["value"]);
             } else {
                 $opts[$v["name"]] = forTag($v["value"]);
             }
         } else {
             $opts[$v["name"]] = $v["value"];
         }
     }
     return $opts;
 }
        $dao->where($map)->save($data);
    } else {
        $dao->add($data);
    }
}
//删除
if ($_GET["do"] == "d") {
    $map["id"] = $_GET["id"];
    $r = $dao->where($map)->delete();
}
//修改页
if ($_GET["do"] == "m") {
    $map["id"] = $_GET["id"];
    $feed = $dao->where($map)->find();
    foreach ($feed as $k => $v) {
        $feed["{$k}"] = forTag($v);
    }
    $ttt = <<<EOD
<h3>修改 Feed 模板</h3>
<center>
<p>
&nbsp;
<form method="post" action="?do=dom">
\t<input type="hidden" id="" name="id" size="60" value="{$feed['id']}"/>
\tFeed Type: <input type="text" id="" name="type" size="60" value="{$feed['type']}"/><p>
\tFeed Title: <input type="text" id="" name="title" size="60" value="{$feed['title']}"/><p>
\t<span style="float:left;padding-left:380px">Feed Body:  </span><br/>
\t<textarea name="body" rows="10" cols="60">{$feed['body']}</textarea>
\t&nbsp;<p><input type="submit" id="" value="提交"/>
</form>
</center>
        $dao->where($map)->save($data);
    } else {
        $dao->add($data);
    }
}
//删除
if ($_GET["do"] == "d") {
    $map["id"] = $_GET["id"];
    $r = $dao->where($map)->delete();
}
//修改页
if ($_GET["do"] == "m") {
    $map["id"] = $_GET["id"];
    $Notify = $dao->where($map)->find();
    foreach ($Notify as $k => $v) {
        $Notify["{$k}"] = forTag($v);
    }
    $ttt = <<<EOD
<h3>修改 Notify 模板</h3>
<center>
<p>
&nbsp;
<form method="post" action="?do=dom">
\t<input type="hidden" id="" name="id" size="60" value="{$Notify['id']}"/>
\tNotify Type: <input type="text" id="" name="type" size="60" value="{$Notify['type']}"/><p>
\tNotify Type_cn: <input type="text" id="" name="type_cn" size="60" value="{$Notify['type_cn']}"/><p>
\tNotify Deal: <input type="text" id="" name="deal" size="60" value="{$Notify['deal']}"/><p>
\tNotify Title: <input type="text" id="" name="title" size="60" value="{$Notify['title']}"/><p>
\t<span style="float:left;padding-left:380px">Notify Body:  </span><br/>
\t<textarea name="body" rows="10" cols="60">{$Notify['body']}</textarea><p>
\t&nbsp;<p><input type="submit" id="" value="提交"/>