protected function applist($state)
 {
     $dao = D("App");
     //有0存 或重复的排序 则重新排序
     if (0 < $dao->where('order2=0')->count() || $dao->query("Select order2,Count(*) From " . C('DB_PREFIX') . "app Group By order2 Having Count(*) > 1")) {
         $arrapplist = $dao->order('order2 asc')->findall();
         foreach ($arrapplist as $key => $val) {
             $dao->setField('order2', $key + 1, 'id=' . $val['id']);
         }
     }
     if (isset($state)) {
         $map["status"] = $state;
     }
     $data = $dao->where($map)->order("order2 asc")->findPage(10);
     foreach ($data['data'] as $key => $val) {
         $APP_URL = str_replace('http://{APPS_URL}', SITE_URL . '/apps', $val['url']);
         $data['data'][$key]['url'] = $APP_URL;
         $data['data'][$key]['add_url'] = str_replace('http://{APP_URL}', $APP_URL, $val['add_url']);
         $data['data'][$key]['icon'] = str_replace('http://{APP_URL}', $APP_URL, $val['icon']);
         $data['data'][$key]['uid_url'] = str_replace('http://{APP_URL}', $APP_URL, $val['uid_url']);
     }
     $data["data"] = textarea_output($data["data"]);
     $this->assign('apps', $data["data"]);
     $this->assign('page', $data["html"]);
     $this->display('index');
 }
 function index()
 {
     $dao = D("App");
     $map["status"] = 1;
     $data = $dao->where($map)->order("order2 asc")->findPage(10);
     $data["data"] = textarea_output($data["data"]);
     $this->assign('apps', $data["data"]);
     $this->assign('page', $data["html"]);
     $this->display();
 }
示例#3
0
function textarea_output($string)
{
    if (!is_array($string)) {
        return nl2br(htmlspecialchars($string));
    }
    foreach ($string as $key => $val) {
        $string[$key] = textarea_output($val);
    }
    return $string;
}