本文整理汇总了PHP中model::data方法的典型用法代码示例。如果您正苦于以下问题:PHP model::data方法的具体用法?PHP model::data怎么用?PHP model::data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model
的用法示例。
在下文中一共展示了model::data方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doadd
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}'", 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'] = empty(member::$Rs->name) ? member::$Rs->username : member::$Rs->name);
empty($rs['userid']) && ($rs['userid'] = member::$uId);
$rs['orderNum'] = _int($rs['orderNum']);
$rs['top'] = _int($rs['top']);
$formArray = FormArray($mid, $fArray, $rs);
$strpos = strpos(__REF__, '?');
$REFERER = $strpos === false ? '' : substr(__REF__, $strpos);
include admincp::tpl();
}
示例2: doEditField
function doEditField()
{
$fid = (int) $_POST['fid'];
$mid = (int) $_POST['mid'];
$name = dhtmlspecialchars($_POST['name']);
$field = dhtmlspecialchars($_POST['field']);
$ofield = dhtmlspecialchars($_POST['ofield']);
if (empty($field)) {
include iPATH . 'include/cn.class.php';
$field = CN::pinyin($name);
}
$type = $_POST['type'];
$show = $_POST['show'];
$default = dhtmlspecialchars($_POST['default']);
$validate = $_POST['validate'];
$description = dhtmlspecialchars($_POST['description']);
$option = addslashes(serialize($_POST['option']));
$hidden = isset($_POST['hidden']) ? 1 : 0;
!preg_match("/[a-zA-Z]/", $field[0]) && javascript::alert('字段只能以英文字母开头');
!preg_match("/[a-zA-Z0-9_\\-~]/", $field) && javascript::alert('字段只能由英文字母或数字组成');
model::isDefField($field) && javascript::alert('您所填写的字段是默认字段!请重新填写.');
$model = model::data($mid);
$oFieldA = explode(',', $model['field']);
$sql = "ALTER TABLE `#iCMS@__" . model::tbn($model['table']) . "`";
if ($fid) {
iCMS_DB::getValue("SELECT `id` FROM `#iCMS@__field` where `field` = '{$field}' and `mid`='{$mid}' and `id`!='{$fid}'") && javascript::alert('该字段已经存在!请检查是否重复');
iCMS_DB::query("UPDATE `#iCMS@__field` SET `name` = '{$name}', `field` = '{$field}', `mid` = '{$mid}', `type` = '{$type}',`show` = '{$show}', `default` = '{$default}', `validate` = '{$validate}', `hidden` = '{$hidden}', `description` = '{$description}', `option` = '{$option}' WHERE `id` = '{$fid}';");
$sql .= " CHANGE COLUMN `{$ofield}` `{$field}`";
if ($field != $ofield) {
$fKey = array_search($ofield, $oFieldA);
unset($oFieldA[$fKey]);
}
} else {
iCMS_DB::getValue("SELECT `id` FROM `#iCMS@__field` where `field` = '{$field}' and `mid`='{$mid}'") && javascript::alert('该字段已经存在!请检查是否重复');
iCMS_DB::query("INSERT INTO `#iCMS@__field` (`name`, `field`, `mid`, `type`,`show`, `default`, `validate`, `hidden`, `description`, `option`) VALUES ('{$name}', '{$field}', '{$mid}', '{$type}', '{$show}', '{$default}', '{$validate}', '{$hidden}', '{$description}', '{$option}');");
$sql .= " ADD COLUMN `{$field}`";
//新增
$col = iCMS_DB::getCol("describe `#iCMS@__" . model::tbn($model['table']) . "`");
$AfterSql = ' after `' . end($col) . '`';
}
$SqlType = model::SqlType($type, $default);
iCMS_DB::query($sql . $SqlType . $AfterSql);
if ($field != $ofield) {
array_push($oFieldA, $field);
$mField = implode(',', array_unique($oFieldA));
iCMS_DB::query("update `#iCMS@__model` SET `field`='{$mField}' where id='{$mid}'");
}
model::cache();
javascript::dialog('字段添加完成!<br />10秒后返回字段管理', "url:" . __SELF__ . "?mo=models&do=managefield&id=" . $mid);
}
示例3: delContent
function delContent($id, $mid, $uid = '0', $postype = '1')
{
$uid && ($sql = "and `userid`='{$uid}' and `postype`='{$postype}'");
$model = model::data($mid);
$table = $model['tbn'];
$FArray = model::field($mid);
$MF = explode(',', $model['field']);
$rs = iCMS_DB::getRow("SELECT * FROM `#iCMS@__{$table}` where `id`='{$id}' {$sql}", ARRAY_A);
foreach ($MF as $field) {
if ($FArray[$field]['type'] == 'upload') {
$rs[$field] && ($msg .= delpic($rs[$field]));
}
}
$rs['tags'] && ($msg .= deltag($rs['tags']));
iCMS_DB::query("DELETE FROM `#iCMS@__comment` WHERE indexId='{$id}' and mid='{$mid}'");
$msg .= '评论数据删除…<span style=\'color:green;\'>√</span><br />';
iCMS_DB::query("DELETE FROM `#iCMS@__{$table}` WHERE id='{$id}'");
iCMS_DB::query("DELETE FROM `#iCMS@__vlink` WHERE indexId='{$id}' AND modelId='{$mid}'");
$msg .= '内容数据删除…<span style=\'color:green;\'>√</span><br />';
iCMS_DB::query("UPDATE `#iCMS@__forum` SET `count` = count-1 WHERE `fid` ='" . $rs['fid'] . "' LIMIT 1");
$msg .= '栏目数据更新…<span style=\'color:green;\'>√</span><br />';
$msg .= '删除完成…<span style=\'color:green;\'>√</span><hr />';
return $msg;
}
示例4: domanage
function domanage()
{
$mid = $_GET['mid'];
$model = model::data($mid);
$table = $model['tbn'];
$forum = new forum();
$fid = (int) $_GET['fid'];
$sql = " where `userid`='" . (int) member::$uId . "' AND `postype`='0'";
//postype: [0:用户][1:管理员] status:[0:草稿][1:正常][2:回收]
$_GET['keyword'] && ($sql .= " AND CONCAT(title,tags) REGEXP '{$_GET['keyword']}'");
$_GET['status'] != "" && ($sql .= " AND `status`='" . $_GET['status'] . "'");
if ($fid) {
$fidIN = $forum->fid($fid) . $fid;
if (isset($_GET['sub']) && strstr($fidIN, ',')) {
$sql .= " AND fid IN(" . $fidIN . ")";
} else {
$sql .= " AND fid ='{$fid}'";
}
//$sql.=" OR `vlink` REGEXP '[[:<:]]".preg_quote($fid, '/')."[[:>:]]')";
}
// $_GET['starttime'] && $sql.=" and `pubdate`>='".strtotime($_GET['starttime'])."'";
// $_GET['endtime'] && $sql.=" and `pubdate`<='".strtotime($_GET['endtime'])."'";
isset($_GET['keyword']) && ($uri .= '&keyword=' . $_GET['keyword']);
$orderby = $_GET['orderby'] ? $_GET['orderby'] : "id DESC";
$maxperpage = (int) $_GET['perpage'] > 0 ? $_GET['perpage'] : 20;
$total = $page == 1 || empty($_GET['rowNum']) ? iCMS_DB::getValue("SELECT count(*) FROM `#iCMS@__{$table}` {$sql}") : (int) $_GET['rowNum'];
page($total, $maxperpage, "条记录");
$rs = iCMS_DB::getArray("SELECT * FROM `#iCMS@__{$table}` {$sql} order by {$orderby} LIMIT {$this->firstcount} , {$maxperpage}");
$_count = count($rs);
include $this->tpl();
}