?> <?php if (iACP::MP('FILE.UPLOAD')) { ?> <a href="<?php echo APP_URI; ?> &do=add&from=modal&id=<?php echo $rs[$i]['id']; ?> " class="btn btn-small" data-toggle="modal" data-meta='{"width":"500px","height":"300px"}' title="重新上传"><i class="fa fa-upload"></i> 上传</a> <?php } ?> <?php if (iACP::MP('FILE.DELETE')) { ?> <a href="<?php echo APP_FURI; ?> &do=del&id=<?php echo $rs[$i]['id']; ?> &indexid=<?php echo $rs[$i]['indexid']; ?> " target="iPHP_FRAME" class="del btn btn-small" title='永久删除' onclick="return confirm('确定要删除?');"/><i class="fa fa-trash-o"></i> 删除</a> <?php } ?> </td>
function li($mType, $id, $level = 1) { if (!iACP::MP($id)) { return false; } $a = $this->menu_array[$id]; if ($a['app'] == "separator") { return '<li class="' . $a['class'] . '"></li>'; } $a['href'] && ($href = __ADMINCP__ . '=' . $a['href']); $a['target'] == 'iPHP_FRAME' && ($href .= '&frame=iPHP'); if (strstr($a['href'], 'http://') || strstr($a['href'], '#')) { $href = $a['href']; } $a['href'] == '__SELF__' && ($href = __SELF__); $a['href'] == '#' && ($href = 'javascript:;'); $isSM = count($this->root_array[$id]); if ($isSM && $level && $mType == 'nav') { $a['class'] = 'dropdown-submenu'; } if ($mType == 'sidebar' && $isSM && $level == 1) { $href = 'javascript:;'; $a['class'] = 'submenu'; $label = '<span class="label">' . $this->subcount($id) . '</span>'; } if ($mType == 'tab') { $href = "#" . $a['href']; } $li = '<li class="' . $a['class'] . '" title="' . $a['name'] . '" data-level="' . $level . '" data-menu="m' . $id . '">'; $link = '<a href="' . $href . '"'; $a['title'] && ($link .= ' title="' . $a['title'] . '"'); $a['a_class'] && ($link .= ' class="' . $a['a_class'] . '"'); $a['target'] && ($link .= ' target="' . $a['target'] . '"'); if ($mType == 'sidebar' && $a['data-toggle'] == 'modal') { $link .= ' data-toggle="' . $a['data-toggle'] . '"'; } elseif ($mType == 'nav') { $a['data-toggle'] && ($link .= ' data-toggle="' . $a['data-toggle'] . '"'); } elseif ($mType == 'tab') { $link .= ' data-toggle="tab"'; } $a['data-target'] && ($link .= ' data-target="' . $a['data-target'] . '"'); $a['data-meta'] && ($link .= " data-meta='" . $a['data-meta'] . "'"); $link .= ">"; $li .= $link; $a['icon'] && ($li .= '<i class="' . $a['icon'] . '"></i> '); $li .= '<span>' . $a['name'] . '</span>' . $label; $a['caret'] && ($li .= $a['caret']); $li .= '</a>'; if ($isSM) { $SMli = ''; foreach ((array) $this->root_array[$id] as $rootid => $M) { $SMli .= $this->li($mType, $M['id'], $level + 1); } $mType == 'nav' && ($SMul = '<ul class="dropdown-menu">' . $SMli . '</ul>'); if ($mType == 'sidebar') { $SMul = $level > 1 ? $SMli : '<ul style="display: none;">' . $SMli . '</ul>'; } } $li .= $SMul . '</li>'; return $li; }
function do_delfile() { iACP::MP('FILE.DELETE', 'alert'); $_GET['path'] or iPHP::alert("请选择要删除的文件"); strpos($_GET['path'], '..') !== false && iPHP::alert("文件路径中带有.."); $hash = md5($_GET['path']); $FileRootPath = iFS::fp($_GET['path'], '+iPATH'); if (iFS::del($FileRootPath)) { $msg = 'success:#:check:#:文件删除完成!'; $_GET['ajax'] && iPHP::json(array('code' => 1, 'msg' => $msg)); } else { $msg = 'warning:#:warning:#:找不到相关文件,文件删除失败!'; $_GET['ajax'] && iPHP::json(array('code' => 0, 'msg' => $msg)); } iPHP::dialog($msg, 'js:parent.$("#' . $hash . '").remove();'); }
function do_manage($stype = 'normal') { $cid = (int) $_GET['cid']; $pid = $_GET['pid']; //$stype OR $stype = iACP::$app_do; $stype_map = array('inbox' => '0', 'normal' => '1', 'trash' => '2', 'examine' => '3', 'off' => '4'); $map_where = array(); //status:[0:草稿][1:正常][2:回收][3:待审核][4:不合格] //postype: [0:用户][1:管理员] $stype && ($this->_status = $stype_map[$stype]); if (isset($_GET['pt']) && $_GET['pt'] != '') { $this->_postype = (int) $_GET['pt']; } $sql = "WHERE `status`='{$this->_status}'"; $this->_postype === 'all' or $sql .= " AND `postype`='{$this->_postype}'"; if (iACP::MP("ARTICLE.VIEW")) { $_GET['userid'] && ($sql .= iPHP::where($_GET['userid'], 'userid')); } else { $sql .= iPHP::where(iMember::$userid, 'userid'); } if (isset($_GET['pid']) && $pid != '-1') { $uri_array['pid'] = $pid; if (empty($_GET['pid'])) { $sql .= " AND `pid`=''"; } else { iPHP::import(iPHP_APP_CORE . '/iMAP.class.php'); map::init('prop', $this->appid); $map_where += map::where($pid); } } $cp_cids = iACP::CP('__CID__', 'cs'); //取得所有有权限的栏目ID if ($cp_cids) { if (is_array($cp_cids)) { if ($cid) { array_search($cid, $cp_cids) === false && iACP::permission_msg('栏目[cid:' . $cid . ']', $ret); } else { $cids = $cp_cids; } } else { $cids = $cid; } if ($_GET['sub'] && $cid) { $cids = $this->categoryApp->get_ids($cid, true); array_push($cids, $cid); } if ($_GET['scid'] && $cid) { iPHP::import(iPHP_APP_CORE . '/iMAP.class.php'); map::init('category', $this->appid); $map_where += map::where($cids); } else { $sql .= iPHP::where($cids, 'cid'); } } else { $sql .= iPHP::where('-1', 'cid'); } if ($_GET['keywords']) { $kws = $_GET['keywords']; switch ($_GET['st']) { case "title": $sql .= " AND `title` REGEXP '{$kws}'"; break; case "tag": $sql .= " AND `tags` REGEXP '{$kws}'"; break; case "source": $sql .= " AND `source` REGEXP '{$kws}'"; break; case "weight": $sql .= " AND `weight`='{$kws}'"; break; case "id": $sql .= " AND `id` REGEXP '{$kws}'"; break; case "tkd": $sql .= " AND CONCAT(title,keywords,description) REGEXP '{$kws}'"; break; } } $_GET['title'] && ($sql .= " AND `title` like '%{$_GET['title']}%'"); $_GET['tag'] && ($sql .= " AND `tags` REGEXP '[[:<:]]" . preg_quote(rawurldecode($_GET['tag']), '/') . "[[:>:]]'"); $_GET['starttime'] && ($sql .= " AND `pubdate`>='" . iPHP::str2time($_GET['starttime'] . " 00:00:00") . "'"); $_GET['endtime'] && ($sql .= " AND `pubdate`<='" . iPHP::str2time($_GET['endtime'] . " 23:59:59") . "'"); isset($_GET['pic']) && ($sql .= " AND `haspic` ='" . ($_GET['pic'] ? 1 : 0) . "'"); isset($_GET['userid']) && ($uri_array['userid'] = (int) $_GET['userid']); isset($_GET['keyword']) && ($uri_array['keyword'] = $_GET['keyword']); isset($_GET['tag']) && ($uri_array['tag'] = $_GET['tag']); isset($_GET['pt']) && ($uri_array['pt'] = $_GET['pt']); isset($_GET['cid']) && ($uri_array['cid'] = $_GET['cid']); $uri_array && ($uri = http_build_query($uri_array)); $orderby = $_GET['orderby'] ? $_GET['orderby'] : "id DESC"; $maxperpage = $_GET['perpage'] > 0 ? (int) $_GET['perpage'] : 20; if ($map_where) { $map_sql = iCMS::map_sql($map_where); $sql = ",({$map_sql}) map {$sql} AND `id` = map.`iid`"; } $total = iPHP::total(false, articleTable::count_sql($sql), "G"); iPHP::pagenav($total, $maxperpage, "篇文章"); $limit = 'LIMIT ' . iPHP::$offset . ',' . $maxperpage; if ($map_sql || iPHP::$offset) { // if($map_sql){ $ids_array = iDB::all("\n SELECT `id` FROM `#iCMS@__article` {$sql}\n ORDER BY {$orderby} {$limit}\n "); //iDB::debug(1); $ids = iCMS::get_ids($ids_array); $ids = $ids ? $ids : '0'; $sql = "WHERE `id` IN({$ids})"; // }else{ // $sql = ",( // SELECT `id` AS aid FROM `#iCMS@__article` {$sql} // ORDER BY {$orderby} {$limit} // ) AS art WHERE `id` = art.aid "; // } $limit = ''; } $rs = iDB::all("SELECT * FROM `#iCMS@__article` {$sql} ORDER BY {$orderby} {$limit}"); //iDB::debug(1); $_count = count($rs); include iACP::view("article.manage"); }
<?php if (iACP::MP('FILE.BROWSE')) { ?> <li><a href="<?php echo __ADMINCP__; ?> =files&do=browse&from=modal&click=file&callback=<?php echo $callback; ?> " data-toggle="modal" title="从网站选择"><i class="fa fa-search"></i> 从网站选择</a></li> <li class="divider"></li> <?php } ?> <?php if (iACP::MP('FILE.EDIT')) { ?> <li><a href="<?php echo __ADMINCP__; ?> =files&do=editpic&from=modal&callback=<?php echo $callback; ?> " data-toggle="modal" title="使用美图秀秀编辑图片" class="modal_photo_<?php echo $unid; ?> tip"><i class="fa fa-edit"></i> 编辑</a></li> <li class="divider"></li> <?php if ($indexid) { ?>