当前位置: 首页>>代码示例>>PHP>>正文


PHP showjsmessage函数代码示例

本文整理汇总了PHP中showjsmessage函数的典型用法代码示例。如果您正苦于以下问题:PHP showjsmessage函数的具体用法?PHP showjsmessage怎么用?PHP showjsmessage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了showjsmessage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: runquery

function runquery($sql)
{
    global $tablepre, $db;
    if (!isset($sql) || empty($sql)) {
        return;
    }
    $sql = str_replace("\r", "\n", str_replace('33hao_', $tablepre, $sql));
    $ret = array();
    $num = 0;
    foreach (explode(";\n", trim($sql)) as $query) {
        $ret[$num] = '';
        $queries = explode("\n", trim($query));
        foreach ($queries as $query) {
            $ret[$num] .= isset($query[0]) && $query[0] == '#' || isset($query[1]) && isset($query[1]) && $query[0] . $query[1] == '--' ? '' : $query;
        }
        $num++;
    }
    unset($sql);
    foreach ($ret as $key => $query) {
        $query = trim($query);
        if ($query) {
            if (substr($query, 0, 12) == 'CREATE TABLE') {
                $line = explode('`', $query);
                $data_name = $line[1];
                showjsmessage('数据表' . ' ' . $data_name . ' ... ' . '建立成功', $key);
                $db->query($query);
            } elseif (substr($query, 0, 11) == 'ALTER TABLE') {
                $db->query($query);
            } else {
                $db->query($query);
            }
        }
    }
}
开发者ID:qqq232575,项目名称:shopx,代码行数:34,代码来源:index.php

示例2: add_site_config

function add_site_config()
{
    global $tablepre, $db;
    $sql = "INSERT INTO `" . $tablepre . "site_config` (`id`, `parent_id`, `code`, `type`, `store_range`, `store_dir`, `value`, `sort_order`) VALUES (NULL, '1', 'statis_code', 'textarea', '', '', '', '23')";
    $db->query($sql);
    $sql = "INSERT INTO `" . $tablepre . "site_config` (`id`, `parent_id`, `code`, `type`, `store_range`, `store_dir`, `value`, `sort_order`) VALUES (NULL, '1', 'max_left_days', 'text', '', '', '2', '32')";
    $db->query($sql);
    $sql = "INSERT INTO `" . $tablepre . "site_config` (`id`, `parent_id`, `code`, `type`, `store_range`, `store_dir`, `value`, `sort_order`) VALUES (NULL, '0', 'open_platform', 'group', '', '', '', '24')";
    $db->query($sql);
    $parent_id = $db->insert_id();
    $sql = "INSERT INTO `" . $tablepre . "site_config` (`id`, `parent_id`, `code`, `type`, `store_range`, `store_dir`, `value`, `sort_order`) VALUES (NULL, {$parent_id}, 'qq_appid', 'text', '', '', '', '25')";
    $db->query($sql);
    $sql = "INSERT INTO `" . $tablepre . "site_config` (`id`, `parent_id`, `code`, `type`, `store_range`, `store_dir`, `value`, `sort_order`) VALUES (NULL, {$parent_id}, 'qq_appkey', 'text', '', '', '', '26')";
    $db->query($sql);
    $sql = "INSERT INTO `" . $tablepre . "site_config` (`id`, `parent_id`, `code`, `type`, `store_range`, `store_dir`, `value`, `sort_order`) VALUES (NULL, {$parent_id}, 'qq_open', 'select', '0,1', '', '1', '27')";
    $db->query($sql);
    $sql = "INSERT INTO `" . $tablepre . "site_config` (`id`, `parent_id`, `code`, `type`, `store_range`, `store_dir`, `value`, `sort_order`) VALUES (NULL, {$parent_id}, 'sina_wb_akey', 'text', '', '', '', '28')";
    $db->query($sql);
    $sql = "INSERT INTO `" . $tablepre . "site_config` (`id`, `parent_id`, `code`, `type`, `store_range`, `store_dir`, `value`, `sort_order`) VALUES (NULL, {$parent_id}, 'sina_wb_skey', 'text', '', '', '', '29')";
    $db->query($sql);
    $sql = "INSERT INTO `" . $tablepre . "site_config` (`id`, `parent_id`, `code`, `type`, `store_range`, `store_dir`, `value`, `sort_order`) VALUES (NULL, {$parent_id}, 'sina_wb_office_id', 'text', '', '', '', '30')";
    $db->query($sql);
    $sql = "INSERT INTO `" . $tablepre . "site_config` (`id`, `parent_id`, `code`, `type`, `store_range`, `store_dir`, `value`, `sort_order`) VALUES (NULL, {$parent_id}, 'sina_wb_open', 'select', '0,1', '', '1', '31')";
    $db->query($sql);
    showjsmessage('增加新的系统设置项 ... 完成');
}
开发者ID:yunsite,项目名称:tp-coupon,代码行数:26,代码来源:112to116_2.php

示例3: runquery

function runquery($sql, $showmessage = TRUE)
{
    global $db;
    $dbcharset = "utf8";
    $sql = str_replace("\r", "\n", $sql);
    $ret = array();
    $num = 0;
    foreach (explode(";\n", trim($sql)) as $query) {
        $queries = explode("\n", trim($query));
        foreach ($queries as $query) {
            @($ret[$num] .= $query[0] == '#' || $query[0] . $query[1] == '--' ? '' : $query);
        }
        $num++;
    }
    unset($sql);
    foreach ($ret as $query) {
        $query = trim($query);
        if ($query) {
            if (substr($query, 0, 12) == 'CREATE TABLE') {
                $name = preg_replace("/CREATE TABLE IF NOT EXISTS ([a-z0-9_]+) .*/is", "\\1", $query);
                $showmessage && showjsmessage('建立数据表 ' . $name . ' ... 成功!');
                $db->query(createtable($query, $dbcharset));
            } else {
                $db->query($query);
            }
        }
    }
}
开发者ID:kbglobal51,项目名称:yii-trackstar-sample,代码行数:28,代码来源:install.func.php

示例4: add_site_config

function add_site_config()
{
    global $tablepre, $db;
    $sql = "SELECT id FROM " . $tablepre . "site_config WHERE code='hidden' LIMIT 1";
    $group_hidden_id = $db->fetch_array($db->query($sql));
    if (!$group_hidden_id) {
        $sql = "INSERT INTO `" . $tablepre . "site_config` (`id`, `parent_id`, `code`, `type`, `store_range`, `store_dir`, `value`, `sort_order`)\r\n\t\t\t VALUES(null, 0, 'hidden', 'hidden', '', '', '', 1)";
        $db->query($sql);
        $group_hidden_id = $db->insert_id();
    } else {
        $group_hidden_id = $group_hidden_id['id'];
    }
    if (!$db->fetch_array($db->query("SELECT id FROM " . $tablepre . "site_config WHERE code='captcha' LIMIT 1"))) {
        $sql = "INSERT INTO `" . $tablepre . "site_config` (`id`, `parent_id`, `code`, `type`, `store_range`, `store_dir`, `value`, `sort_order`)\r\n\t\t\t VALUES(null, '{$group_hidden_id}', 'captcha', 'hidden', '', '', '', 1)";
        $db->query($sql);
    }
    if (!$db->fetch_array($db->query("SELECT id FROM " . $tablepre . "site_config WHERE code='captcha_width' LIMIT 1"))) {
        $sql = "INSERT INTO `" . $tablepre . "site_config` (`id`, `parent_id`, `code`, `type`, `store_range`, `store_dir`, `value`, `sort_order`)\r\n\t\t\t VALUES(null, '{$group_hidden_id}', 'captcha_width', 'hidden', '', '', '', 1)";
        $db->query($sql);
    }
    if (!$db->fetch_array($db->query("SELECT id FROM " . $tablepre . "site_config WHERE code='captcha_height' LIMIT 1"))) {
        $sql = "INSERT INTO `" . $tablepre . "site_config` (`id`, `parent_id`, `code`, `type`, `store_range`, `store_dir`, `value`, `sort_order`)\r\n\t\t\t VALUES(null, '{$group_hidden_id}', 'captcha_height', 'hidden', '', '', '', 1)";
        $db->query($sql);
    }
    showjsmessage('增加新的系统设置项 ... 完成');
}
开发者ID:yunsite,项目名称:tp-coupon,代码行数:26,代码来源:116to117_2.php

示例5: edit_table_user

function edit_table_user()
{
    global $tablepre, $db;
    $sql = "ALTER TABLE `" . $tablepre . "user` ADD `invite` MEDIUMINT( 8 ) UNSIGNED NOT NULL DEFAULT '0',ADD INDEX ( `invite` )";
    $db->query($sql);
    $sql = "ALTER TABLE `" . $tablepre . "user` ADD `addtime` INT( 11 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `credit`";
    $db->query($sql);
    showjsmessage('修改user表结构 ... 完成');
}
开发者ID:yunsite,项目名称:tp-coupon,代码行数:9,代码来源:101to110_2.php

示例6: runquery

function runquery($sql, $tablepre, $db)
{
    global $lang, $tablepre, $db;
    require_once 'install_lang.php';
    if (!isset($sql) || empty($sql)) {
        return;
    }
    $orig_tablepre = "keke_";
    $sql = str_replace("\r", "\n", str_replace(' ' . $orig_tablepre, ' ' . $tablepre, $sql));
    $sql = str_replace("\r", "\n", str_replace(' `' . $orig_tablepre, ' `' . $tablepre, $sql));
    $ret = array();
    $num = 0;
    foreach (explode(";\n", trim($sql)) as $query) {
        $ret[$num] = '';
        $queries = explode("\n", trim($query));
        foreach ($queries as $query) {
            $ret[$num] .= isset($query[0]) && $query[0] == '#' || isset($query[1]) && isset($query[1]) && $query[0] . $query[1] == '--' ? '' : $query;
        }
        $num++;
    }
    unset($sql);
    foreach ($ret as $query) {
        $query = trim($query);
        $info = '';
        if ($query) {
            if (substr($query, 0, 12) == 'CREATE TABLE') {
                $name = preg_replace("/CREATE TABLE \\`([a-z0-9_]+)\\` .*/is", "\\1", $query);
                showjsmessage($lang['create_table'] . ' ' . $name . ' ... ' . $lang['succeed']);
                $db->query(createtable($query));
            } else {
                $db->query($query);
            }
            $info .= $query . "\n";
        }
    }
    return $info;
}
开发者ID:xupnge1314,项目名称:project,代码行数:37,代码来源:install_function.php

示例7: showjsmessage

    if ($limit > 1000) {
        $limit = 1000;
    }
    $data_list = $db->query("SELECT id,site_name,name FROM {$table} LIMIT " . $begin . ',' . $limit);
    showjsmessage("开始更新数据表 goods {$begin} 到 " . ($begin + $limit) . " 行");
    $data_count = count($data_list);
    for ($j = 0; $j < $data_count; $j++) {
        $data = $data_list[$j];
        $db->query('INSERT INTO ' . $table_match . ' (id,content) VALUES(' . $data['id'] . ',\'' . segmentToUnicode(clearSymbol($data['site_name'] . $data['name'])) . '\')');
    }
    showjsmessage("更新数据表 goods {$begin} 到 " . ($begin + $limit) . " 行  成功");
    if ($limit < 1000) {
        showjsmessage(U('Index/updatetable', array('table' => 'area', 'begin' => 0)), 5);
        exit;
    } else {
        showjsmessage(U('Index/updatetable', array('table' => 'goods', 'begin' => $begin + $limit)), 5);
        exit;
    }
}
/**
 * utf8字符转Unicode字符
 * @param string $char 要转换的单字符
 * @return void
 */
function utf8ToUnicode($char)
{
    switch (strlen($char)) {
        case 1:
            return ord($char);
        case 2:
            $n = (ord($char[0]) & 0x3f) << 6;
开发者ID:dalinhuang,项目名称:concourse,代码行数:31,代码来源:goods.table.php

示例8: runquery

function runquery($sql)
{
    global $lang, $db, $multitable;
    if (!isset($sql) || empty($sql)) {
        return;
    }
    $sql = str_replace("\r", "\n", $sql);
    $ret = array();
    $num = 0;
    foreach (explode(";\n", trim($sql)) as $query) {
        $ret[$num] = '';
        $queries = explode("\n", trim($query));
        foreach ($queries as $query) {
            $ret[$num] .= isset($query[0]) && $query[0] == '#' || isset($query[1]) && isset($query[1]) && $query[0] . $query[1] == '--' ? '' : $query;
        }
        $num++;
    }
    unset($sql);
    foreach ($ret as $query) {
        $query = trim($query);
        if ($query) {
            if (substr($query, 0, 12) == 'CREATE TABLE') {
                if (false !== strpos($query, '__tblname__')) {
                    if ($multitable > 0) {
                        $prefixs = array();
                        $prefixs = genPrefix();
                        foreach ($prefixs as $v) {
                            $name = "user_" . $v;
                            $new_sql = str_replace("__tblname__", $name, $query);
                            showjsmessage(lang('create_table') . ' ' . $name . ' ... ' . lang('succeed'));
                            $db->query("DROP TABLE IF EXISTS `{$name}`;");
                            $db->query(createtable($new_sql));
                        }
                    } else {
                        $name = "user";
                        $new_sql = str_replace("__tblname__", $name, $query);
                        showjsmessage(lang('create_table') . ' ' . $name . ' ... ' . lang('succeed'));
                        $db->query("DROP TABLE IF EXISTS `{$name}`;");
                        $db->query(createtable($new_sql));
                    }
                } else {
                    $name = preg_replace("/CREATE TABLE IF NOT EXISTS ([`a-z0-9_]+) .*/is", "\\1", $query);
                    showjsmessage(lang('create_table') . ' ' . $name . ' ... ' . lang('succeed'));
                    $db->query(createtable($query));
                }
            } else {
                $db->query($query);
            }
        }
    }
}
开发者ID:AlvarodelRosal,项目名称:xppass,代码行数:51,代码来源:index.php

示例9: runquery

function runquery($sql)
{
    global $lang, $dbcharset, $tablepre, $db, $config;
    $sql = str_replace(array("\r\n", "\r"), "\n", str_replace('`jishigou_', "`" . $config['db_table_prefix'], $sql));
    $ret = array();
    $num = 0;
    foreach (explode(";\n", trim($sql)) as $query) {
        $queries = explode("\n", trim($query));
        foreach ($queries as $query) {
            $ret[$num] .= $query[0] == '#' || $query[0] . $query[1] == '--' ? '' : $query . ' ';
        }
        $num++;
    }
    unset($sql);
    foreach ($ret as $query) {
        $query = trim($query);
        if ($query) {
            $_msg = '';
            $name = preg_replace("/(?:CREATE TABLE|REPLACE INTO|INSERT INTO)[\\w\\s`]*?([a-z0-9_]+)`?\\s?.*/is", "\\1", $query);
            $w12 = trim(strtoupper(substr($query, 0, 12)));
            if ($w12 == 'CREATE TABLE') {
                $ex = '';
                if ($config['table_partitions_num'] > 1) {
                    $tpname = str_replace($config['db_table_prefix'], '', $name);
                    $partitions = array('members', 'memberfields', 'topic', 'topic_more', 'topic_reply');
                    if (mysql_get_server_info() >= '5.1' && in_array($tpname, $partitions)) {
                        if ($tpname == 'members' || $tpname == 'memberfields') {
                            $ex = ' PARTITION BY HASH (uid) PARTITIONS ' . $config['table_partitions_num'];
                        }
                        if ($tpname == 'topic' || $tpname == 'topic_more' || $tpname == 'topic_reply') {
                            $ex = ' PARTITION BY HASH (tid) PARTITIONS ' . $config['table_partitions_num'];
                        }
                    }
                }
                $sql = createtable($query, $dbcharset, $ex);
                if ($ex) {
                    $_ret = $db->query($sql, 'SILENT');
                    if (!$_ret) {
                        $errno = $db->errno();
                        if (1289 == $errno || 1290 == $errno || false !== strpos(strtolower($db->error()), 'partition')) {
                            $sql = createtable($query, $dbcharset, '');
                            $db->query($sql);
                        } else {
                            $db->halt('MySQL Query Error', $sql);
                        }
                    }
                } else {
                    $db->query($sql);
                }
                $_msg = $lang['create_table'];
            } else {
                $db->query($query);
                if (false !== strpos($w12, ' INTO')) {
                    $_msg = $lang['db_insert'];
                }
            }
            if ($name && $_msg) {
                showjsmessage($_msg . ' ' . $name . ' ... ' . $lang['succeed']);
            }
        }
    }
}
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:62,代码来源:global.func.php

示例10: runquery

function runquery($sql)
{
    global $lang, $dbcharset, $tablepre, $db;
    $sql = str_replace("\r", "\n", str_replace(' onez_', ' ' . $tablepre, $sql));
    $ret = array();
    $num = 0;
    foreach (explode(";\n", trim($sql)) as $query) {
        $queries = explode("\n", trim($query));
        foreach ($queries as $query) {
            $ret[$num] .= $query[0] == '#' || $query[0] . $query[1] == '--' ? '' : $query;
        }
        $num++;
    }
    unset($sql);
    foreach ($ret as $query) {
        $query = trim($query);
        if ($query) {
            if (substr($query, 0, 12) == 'CREATE TABLE') {
                $name = preg_replace("/CREATE TABLE ([a-z0-9_]+) .*/is", "\\1", $query);
                showjsmessage($lang['create_table'] . ' ' . $name . ' ... ' . $lang['succeed']);
                $db->query(createtable($query, $dbcharset));
            } else {
                $db->query($query);
            }
        }
    }
}
开发者ID:shenhua4286,项目名称:gxw,代码行数:27,代码来源:global.func.php

示例11: restore

 /**
  * 执行SQL脚本文件
  *
  * @param array $filelist
  * @return string
  */
 private function restore($file)
 {
     $db = $this->getDB();
     $sql = file_get_contents($file);
     $sql = $this->remove_comment($sql);
     $sql = trim($sql);
     $bln = true;
     $tables = array();
     //若非UTF-8,则转化为UTF-8
     if (!$this->is_utf8($sql)) {
         $sql = $this->to_utf8($sql);
     }
     $segmentSql = explode(";\r", $sql);
     $segmentSql = str_replace("\r", '', $segmentSql);
     unset($segmentSql[0]);
     $table = "";
     foreach ($segmentSql as $k => $itemSql) {
         $itemSql = trim(str_replace("%DB_PREFIX%", C('DB_PREFIX'), $itemSql));
         if (!$itemSql) {
             continue;
         }
         if (strtoupper(substr($itemSql, 0, 12)) == 'CREATE TABLE') {
             $table = preg_replace("/CREATE TABLE (?:IF NOT EXISTS |)(?:`|)([a-z0-9_]+)(?:`|).*/is", "\\1", $itemSql);
             if (!in_array($table, $tables)) {
                 $tables[] = $table;
             }
             if ($db->query($itemSql) === false) {
                 $bln = false;
                 showjsmessage("建立数据表 " . $table . " ... 失败", 1);
                 break;
             } else {
                 showjsmessage("建立数据表 " . $table . " ... 成功");
             }
         } elseif (strtoupper(substr(trim($itemSql), 0, 11)) == 'ALTER TABLE' && strpos(strtoupper($itemSql), 'ADD') !== FALSE) {
             //如果字段已经存在就不执行
             $matches = array();
             preg_match_all('/ALTER TABLE(.*)ADD(.*) /i', $itemSql, $matches);
             $table_name = trim($matches[1][0]);
             $column_sql = explode(' ', trim($matches[2][0]));
             $column = trim($column_sql[0]);
             if (strpos(strtoupper($column), 'COLUMN') !== FALSE) {
                 $column = trim($column_sql[1]);
             }
             $result = $db->query("DESCRIBE {$table_name} {$column}");
             //获取字段信息
             if (empty($result[0])) {
                 //若字段不存在就执行
                 if ($db->query($itemSql) === false) {
                     $bln = false;
                     showjsmessage("执行查询  " . $itemSql . " ... 失败", 1);
                     break;
                 }
             } else {
                 showjsmessage("表  " . $table_name . "中的" . $column . "已经存在 ... 跳过", 2);
             }
         } else {
             if ($db->query($itemSql) === false) {
                 echo $itemSql;
                 $bln = false;
                 showjsmessage("执行查询  " . $itemSql . " ... 失败", 1);
                 break;
             }
         }
     }
     return $bln;
 }
开发者ID:BGCX261,项目名称:zhubao-tupu-svn-to-git,代码行数:72,代码来源:IndexAction.class.php

示例12: date

        }
        $yearmonth = date('Ym_', time());
        loginit($yearmonth . 'illegallog');
        loginit($yearmonth . 'cplog');
        loginit($yearmonth . 'errorlog');
        dir_clear(ROOT_PATH . './data/template');
        dir_clear(ROOT_PATH . './data/cache');
        foreach ($serialize_sql_setting as $k => $v) {
            $v = addslashes(serialize($v));
            $db->query("REPLACE INTO {$tablepre}setting VALUES ('{$k}', '{$v}')");
        }
        if ($runqueryerror) {
            showjsmessage('<span class="red">' . $lang['error_quit_msg'] . '</span>');
            exit;
        }
        showjsmessage('系统数据安装成功!请点击下一步设置管理员</span>');
        echo '<script type="text/javascript">function setlaststep() {document.getElementById("laststep").disabled=false;}</script><script type="text/javascript">setTimeout(function(){window.location=\'index.php?step=4\'}, 30000);setlaststep();</script>' . "\r\n";
        show_footer();
    }
    show_form($form_db_init_items, $error_msg);
} elseif ($method == 'admin_init') {
    $submit = true;
    $adminemail = 'admin@admin.com';
    $error_msg = array();
    if (isset($form_admin_init_items) && is_array($form_admin_init_items)) {
        foreach ($form_admin_init_items as $key => $items) {
            ${$key} = getgpc($key, 'p');
            if (!isset(${$key}) || !is_array(${$key})) {
                $submit = false;
                break;
            }
开发者ID:druphliu,项目名称:dzzoffice,代码行数:31,代码来源:index.php

示例13: runquery

function runquery($sql) {
	global $lang, $tablepre, $db;

	if(!isset($sql) || empty($sql)) return;

	$sql = str_replace("\r", "\n", str_replace('tp_', $tablepre, $sql));
	$ret = array();
	$num = 0;
	foreach(explode(";\n", trim($sql)) as $query) {
		$ret[$num] = '';
		$queries = explode("\n", trim($query));
		foreach($queries as $query) {
			$ret[$num] .= (isset($query[0]) && $query[0] == '#') || (isset($query[1]) && isset($query[1]) && $query[0].$query[1] == '--') ? '' : $query;
		}
		$num++;
	}
	unset($sql);

	foreach($ret as $query) {
		$query = trim($query);
		if($query) {
			if(substr($query, 0, 12) == 'CREATE TABLE') {
				$line = explode('`',$query);
				$data_name = $line[1];
				showjsmessage(lang('create_table').' '.$data_name.' ... '.lang('succeed'));
				$db->query(droptable($data_name));
				/**
				 * 转码
				 */
				if (strtoupper(DBCHARSET) == 'GBK'){
					$query = iconv('GBK','UTF-8',$query);
				}
				$db->query(createtable($query));
				unset($line,$data_name);
			} else {
				$db->query($query);
			}
		}
	}
}
开发者ID:kevicki,项目名称:pig,代码行数:40,代码来源:index.php

示例14: Modify_User_Signature

 function Modify_User_Signature()
 {
     $uid = (int) $this->Post['uid'];
     if ($uid < 1) {
         showjsmessage("请先登录或者注册一个帐号");
     }
     if (jdisallow($uid)) {
         json_error("您无权修改此用户签名");
     }
     $rets = jclass('misc')->sign_modify($uid, $this->Post['signature']);
     if (is_array($rets) && $rets['error']) {
         json_error($rets['msg']);
     } else {
         json_result($rets);
     }
 }
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:16,代码来源:topic.mod.php

示例15: installplugin

function installplugin($plugindata, $plugin_info)
{
    global $lang, $dbcharset, $tablepre, $db;
    $plugindata = preg_replace("/(#.*\\s+)*/", '', $plugindata);
    $pluginarray = daddslashes(unserialize(base64_decode($plugindata)), 1);
    $query = $db->query("SELECT pluginid FROM {$tablepre}plugins WHERE identifier='{$pluginarray[plugin][identifier]}' LIMIT 1");
    if ($db->num_rows($query)) {
        showjsmessage('插件 ' . $plugin_info . ' 已安装 ... 跳过');
    } else {
        $sql1 = $sql2 = $comma = '';
        foreach ($pluginarray['plugin'] as $key => $val) {
            if ($key == 'directory') {
                //compatible for old versions
                $val .= !empty($val) && substr($val, -1) != '/' ? '/' : '';
            }
            $sql1 .= $comma . $key;
            $sql2 .= $comma . '\'' . $val . '\'';
            $comma = ',';
        }
        $db->query("INSERT INTO {$tablepre}plugins ({$sql1}) VALUES ({$sql2})");
        $pluginid = $db->insert_id();
        foreach (array('hooks', 'vars') as $pluginconfig) {
            if (is_array($pluginarray[$pluginconfig])) {
                foreach ($pluginarray[$pluginconfig] as $config) {
                    $sql1 = 'pluginid';
                    $sql2 = '\'' . $pluginid . '\'';
                    foreach ($config as $key => $val) {
                        $sql1 .= ',' . $key;
                        $sql2 .= ',\'' . $val . '\'';
                    }
                    $db->query("INSERT INTO {$tablepre}plugin{$pluginconfig} ({$sql1}) VALUES ({$sql2})");
                }
            }
        }
        showjsmessage('正在安装插件 ' . $plugin_info . '  ... 成功');
    }
}
开发者ID:royburns,项目名称:project-nowhere,代码行数:37,代码来源:global.func.php


注:本文中的showjsmessage函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。