function doadd() { include iPATH . 'include/from.fun.php'; $mid = $_GET['mid']; $table = model::tbn($_GET['table']); $model = model::data($mid); $fArray = explode(',', $model['field']); $_count = count($fArray); $rs = array(); $id = $_GET['id']; $id && ($rs = iCMS_DB::getRow("SELECT * FROM `#iCMS@__{$table}` where `id`='{$id}' AND userid='" . member::$uId . "' AND postype='0'", ARRAY_A)); $rs['mName'] = $_GET['table']; $rs['mid'] = $mid; $rs['fid'] = empty($rs['fid']) ? intval($_GET['fid']) : $rs['fid']; $rs['pubdate'] = empty($id) ? get_date('', "Y-m-d H:i:s") : get_date($rs['pubdate'], 'Y-m-d H:i:s'); empty($rs['editor']) && ($rs['editor'] = member::$nickname); empty($rs['userid']) && ($rs['userid'] = member::$uId); $rs['orderNum'] = _int($rs['orderNum']); $rs['top'] = _int($rs['top']); $formArray = FormArray($mid, $fArray, $rs, true); $strpos = strpos(__REF__, '?'); $REFERER = $strpos === false ? '' : substr(__REF__, $strpos); include $this->tpl(); }
switch ($operation) { case 'add': include iPATH . 'include/from.fun.php'; $model = $iCMS->db->getRow("SELECT * FROM `#iCMS@__model` where id='{$mid}'"); // $__MODEL__ = $iCMS->cache('model.id','include/syscache',0,true); // $model = $__MODEL__[$mid]; $fArray = explode(',', $model->field); $_count = count($fArray); $rs = array(); $id && ($rs = $iCMS->db->getRow("SELECT * FROM `#iCMS@__{$__TABLE__}` WHERE id='{$id}'", ARRAY_A)); $rs['cid'] = empty($rs['cid']) ? intval($_GET['cid']) : $rs['cid']; $rs['pubdate'] = empty($id) ? get_date('', "Y-m-d H:i:s") : get_date($rs['pubdate'], 'Y-m-d H:i:s'); empty($rs['editor']) && ($rs['editor'] = empty($Admin->admin->name) ? $Admin->admin->username : $Admin->admin->name); empty($rs['userid']) && ($rs['userid'] = $Admin->uId); $rs['mid'] = $mid; $form = FormArray($mid, $fArray, $rs); $fcount = count($form); include iCMS_admincp_tpl("content.add"); break; case 'manage': // $Admin->MP(array("menu_article_manage","menu_article_draft","menu_article_user_manage","menu_article_user_draft")); $__MODEL__ = $iCMS->cache('model.id', 'include/syscache', 0, true); $model = $__MODEL__[$mid]; $catalog = new catalog(); $cid = (int) $_GET['cid']; $act = $_GET['act']; $sql = " where "; $sql .= $_GET['type'] == 'draft' ? "`visible` ='0'" : "`visible` ='1'"; $sql .= $act == 'user' ? " AND `postype`='0'" : " AND `postype`='1'"; $_GET['title'] && ($sql .= " AND `title` like '%{$_GET['title']}%'"); $_GET['tag'] && ($sql .= " AND `tags` REGEXP '[[:<:]]" . preg_quote(rawurldecode($_GET['tag']), '/') . "[[:>:]]'");