本文整理匯總了PHP中model::tbn方法的典型用法代碼示例。如果您正苦於以下問題:PHP model::tbn方法的具體用法?PHP model::tbn怎麽用?PHP model::tbn使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類model
的用法示例。
在下文中一共展示了model::tbn方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: doSave
function doSave()
{
$id = (int) $_POST['id'];
$name = dhtmlspecialchars($_POST['name']);
$table = dhtmlspecialchars($_POST['table']);
$description = dhtmlspecialchars($_POST['desc']);
$show = (int) $_POST['show'];
$position = $_POST['position'];
$position2 = $_POST['pos'];
$form = dhtmlspecialchars($_POST['form']);
$binding = isset($_POST['binding']) ? 1 : 0;
empty($name) && javascript::alert('模塊名稱不能為空!');
empty($table) && $binding && javascript::alert('模塊名不能為空!');
if (!$binding && empty($id)) {
if (empty($table)) {
include iPATH . 'include/cn.class.php';
$table = CN::pinyin($name);
}
}
!preg_match("/[a-zA-Z]/", $table[0]) && javascript::alert('模型表名隻能以英文字母開頭');
!preg_match("/[a-zA-Z0-9_\\-~]/", $table) && javascript::alert('模型表名隻能由英文字母或數字組成');
//model::isSysTable($table) && javascript::alert('您所填寫的模塊表名是係統表!請重新填寫.');
if ($id) {
iCMS_DB::getValue("SELECT `id` FROM `#iCMS@__model` where `table` = '{$table}' and `id`!='{$id}'") && javascript::alert('該模塊已經存在!請檢查是否重複');
iCMS_DB::query("UPDATE `#iCMS@__model` SET `name` = '{$name}', `table` = '{$table}', `binding` = '{$binding}', `description` = '{$description}', `show` = '{$show}', `position` = '{$position}', `position2` = '{$position2}', `form` = '{$form}' WHERE `id` = '{$id}';");
if (!$binding) {
$oTable = iCMS_DB::getValue("SELECT `table` FROM `#iCMS@__model` where `id` ='{$id}'");
if ($oTable != $table) {
iCMS_DB::query("RENAME TABLE `#iCMS@__" . model::tbn($oTable) . "` TO `#iCMS@__" . model::tbn($table) . "`");
}
}
} else {
iCMS_DB::getValue("SELECT `id` FROM `#iCMS@__model` where `table` = '{$table}'") && javascript::alert('該模塊已經存在!請檢查是否重複');
$field = $binding ? '' : model::$defaultField;
iCMS_DB::query("INSERT INTO `#iCMS@__model`(`name`, `table`, `field`, `binding`, `description`,`show`, `position`,`position2`,`form`, `addtime`)VALUES ('{$name}', '{$table}','{$field}', '{$binding}', '{$description}','{$show}', '{$position}','{$position2}','{$form}', '" . time() . "');");
$id = iCMS_DB::$insert_id;
if (!$binding) {
//創建模塊基礎表
$tableSQL = "CREATE TABLE `#iCMS@__" . model::tbn($table) . "` (\n\t\t\t\t\t `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n\t\t\t\t\t `fid` int(10) unsigned NOT NULL DEFAULT '0',\n\t\t\t\t\t `orderNum` smallint(6) NOT NULL DEFAULT '0',\n\t\t\t\t\t `title` varchar(255) NOT NULL DEFAULT '',\n\t\t\t\t\t `clink` varchar(255) NOT NULL DEFAULT '',\n\t\t\t\t\t `editor` varchar(200) NOT NULL DEFAULT '',\n\t\t\t\t\t `userid` int(10) unsigned NOT NULL DEFAULT '0',\n\t\t\t\t\t `tags` varchar(255) NOT NULL DEFAULT '',\n\t\t\t\t\t `pubdate` int(10) unsigned NOT NULL DEFAULT '0',\n\t\t\t\t\t `hits` int(10) unsigned NOT NULL DEFAULT '0',\n\t\t\t\t\t `comments` int(10) unsigned NOT NULL DEFAULT '0',\n\t\t\t\t\t `good` int(10) unsigned NOT NULL DEFAULT '0',\n\t\t\t\t\t `bad` int(10) unsigned NOT NULL DEFAULT '0',\n\t\t\t\t\t `vlink` varchar(255) NOT NULL DEFAULT '',\n\t\t\t\t\t `type` smallint(6) NOT NULL DEFAULT '0',\n\t\t\t\t\t `top` smallint(6) NOT NULL DEFAULT '0',\n\t\t\t\t\t `postype` tinyint(1) unsigned NOT NULL DEFAULT '0',\n\t\t\t\t\t `status` tinyint(1) unsigned NOT NULL DEFAULT '1',\n\t\t\t\t\t PRIMARY KEY (`id`),\n\t\t\t\t\t KEY `pubdate` (`pubdate`),\n\t\t\t\t\t KEY `comment` (`comments`),\n\t\t\t\t\t KEY `hit` (`hits`),\n\t\t\t\t\t KEY `order` (`orderNum`),\n\t\t\t\t\t KEY `sortid` (`fid`,`id`),\n\t\t\t\t\t KEY `topord` (`top`,`orderNum`),\n\t\t\t\t\t KEY `userid` (`userid`),\n\t\t\t\t\t KEY `postype` (`postype`,`id`),\n\t\t\t\t\t KEY `status` (`status`,`postype`,`id`)\n\t\t\t\t\t ) ENGINE=MyISAM DEFAULT CHARSET=" . DB_CHARSET;
iCMS_DB::query($tableSQL);
}
}
model::cache();
$moreaction = array(array("text" => "下一步添加字段", "url" => __SELF__ . "?mo=models&do=addfield&id=" . $id), array("text" => "返回模塊列表", "url" => __SELF__ . "?mo=models&do=manage"));
javascript::dialog('模塊' . ($id ? '編輯' : '添加') . '完成!<br />模塊基礎建表完成...<br />10秒後返回模塊列表', "url:" . __SELF__ . "?mo=models&do=manage", $moreaction, 10);
}
示例2: doupdateHTML
function doupdateHTML()
{
!$_GET['id'] && javascript::alert("請選擇要更新的項目");
$mid = (int) $_GET['mid'];
$table = model::tbn($_GET['table']);
include iPATH . 'include/iHtml.class.php';
iHtml::content($_GET['id'], $mid, $table) && javascript::dialog('更新完成!', "url:1");
}
示例3: dopreview
function dopreview()
{
$id = (int) $_GET['id'];
$mid = $_GET['mid'];
$table = model::tbn($_GET['table']);
$id = $_GET['id'];
!$id && javascript::alert("請選擇要刪除的文章");
$id && ($rs = iCMS_DB::getRow("SELECT * FROM `#iCMS@__{$table}` where `id`='{$id}' AND userid='" . member::$uId . "' AND postype='0'", ARRAY_A));
echo '<style type="text/css">
.preview .title { height:53px; line-height:53px; margin:0px auto 0px; text-align: center; }
.preview .title h1 { font-size:24px; font-weight: bold; }
.preview .content { overflow:hidden; margin:10px auto; color:#444; font-size:14px; line-height:160%; padding:5px; }
.preview .content p { font-size: 14px; margin-top: 10px; margin-right: auto; margin-bottom: 0px; margin-left: auto; line-height: 25px; text-indent: 2em; padding: 0px; }
.preview .content img { clear: both; display: block; margin: 0 auto; }
.preview .content a { border-bottom:1px dotted #0B3B8C; color:#0B3B8C; text-decoration:none; }
</style>';
echo '<div class="preview"><div class="title"><h1>' . $rs['title'] . '</h1></div>';
echo '<div class="content"><pre>';
print_r($rs);
echo '</pre></div></div>';
}