本文整理汇总了PHP中Sql_Table_exists函数的典型用法代码示例。如果您正苦于以下问题:PHP Sql_Table_exists函数的具体用法?PHP Sql_Table_exists怎么用?PHP Sql_Table_exists使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Sql_Table_exists函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
$this->coderoot = dirname(__FILE__) . '/' . __CLASS__ . '/';
parent::__construct();
if (!Sql_Table_exists($GLOBALS['table_prefix'] . 'restapi_request_log')) {
saveConfig(md5('plugin-restapi-initialised'), false, 0);
$this->initialise();
}
}
示例2: dirname
<?php
require_once dirname(__FILE__) . '/accesscheck.php';
if (!defined('PHPLISTINIT')) {
exit;
}
$types = array('textline', 'checkbox', 'checkboxgroup', 'radio', 'select', 'hidden', 'textarea', 'date');
if (defined('IN_WEBBLER') && IN_WEBBLER || defined('WEBBLER') && WEBBLER) {
$types[] = 'avatar';
}
$formtable_exists = Sql_Table_exists('formfield');
#ob_end_flush();
#foreach ($_POST as $key => $val) {
# print "$key = ".print_r($val)."<br/>";
#}
#return;
print '<div class="panel"><div class="header"></div><div class="content">';
if (isset($_POST['action'])) {
if (isset($_POST['name'])) {
while (list($id, $val) = each($_POST['name'])) {
if (!$id && isset($_POST['name'][0]) && $_POST['name'][0] != '') {
# it is a new one
$lc_name = getNewAttributeTablename($_POST['name'][0]);
if ($lc_name == 'email') {
print Warn(s('Email is a system attribute'));
}
#print "New attribute: ".$lc_name."<br/>";
if (empty($_POST['required'][0])) {
$nRequired = 0;
} else {
$nRequired = $_POST['required'][0];
示例3: initialise
function initialise()
{
global $config;
foreach ($this->DBstructure as $table => $val) {
if (!Sql_Table_exists($table)) {
# print "creating $table <br>\n";
Sql_Create_Table($this->tables[$table], $this->DBstructure[$table]);
}
}
}
示例4: preg_match
preg_match("/([\\w_]+)/", $page, $regs);
$page = $regs[1];
if (!is_file($page . '.php') && !isset($_GET['pi'])) {
$page = 'home';
}
if (!$GLOBALS["admin_auth_module"]) {
# stop login system when no admins exist
if (!Sql_Table_Exists($tables["admin"])) {
$GLOBALS["require_login"] = 0;
} else {
$num = Sql_Query("select * from {$tables["admin"]}");
if (!Sql_Affected_Rows()) {
$GLOBALS["require_login"] = 0;
}
}
} elseif (!Sql_Table_exists($GLOBALS['tables']['config'])) {
$GLOBALS['require_login'] = 0;
}
$page_title = NAME;
@(include_once dirname(__FILE__) . "/lan/" . $_SESSION['adminlanguage']['iso'] . "/pagetitles.php");
print '<script language="javascript" type="text/javascript" src="js/select_style.js"></script>';
print '<meta http-equiv="Cache-Control" content="no-cache, must-revalidate">';
// HTTP/1.1
print '<meta http-equiv="Pragma" content="no-cache">';
// HTTP/1.1
print "<title>" . NAME . " :: ";
if (isset($GLOBALS["installation_name"])) {
print $GLOBALS["installation_name"] . ' :: ';
}
print "{$page_title}</title>";
if (isset($GLOBALS["require_login"]) && $GLOBALS["require_login"]) {
示例5: loadUser
function loadUser($loginname = '')
{
if (!Sql_Table_exists('user')) {
return;
}
initialiseUserSession();
if (!$loginname) {
if ($_SESSION['userloggedin'] != '' && $_SESSION['username'] != '') {
$loginname = $_SESSION['username'];
} else {
return '';
}
}
$att_req = Sql_Query(sprintf('select attribute.id,
%s.name,%s.type,
%s.value,%s.tablename from %s,%s,%s
where %s.userid = %s.id and %s.email = "%s" and %s.id = %s.attributeid', 'attribute', 'attribute', 'user_attribute', 'attribute', 'user', 'user_attribute', 'attribute', 'user_attribute', 'user', 'user', addslashes($loginname), 'attribute', 'user_attribute'));
while ($att = Sql_fetch_array($att_req)) {
# if (!defined($_SESSION["userdata"]["attribute".$att["id"]])) {
$_SESSION['userdata']['attribute' . $att['id']] = array('name' => $att['name'], 'value' => $att['value'], 'type' => $att['type'], 'attid' => $att['id'], 'displayvalue' => $att['value']);
switch ($att['type']) {
case 'textline':
case 'hidden':
$_SESSION['userdata']['attribute' . $att['id']]['displayvalue'] = $att['value'];
break;
case 'creditcardno':
$_SESSION['userdata']['attribute' . $att['id']]['displayvalue'] = obscureCreditCard($att['value']);
break;
case 'select':
$_SESSION['userdata']['attribute' . $att['id']]['displayvalue'] = AttributeValue($att['tablename'], $att['value']);
break;
case 'date':
$_SESSION['userdata']['attribute' . $att['id']]['displayvalue'] = formatDate($att['value']);
break;
}
# }
}
$d_req = Sql_Fetch_Array_Query("select * from user where email = \"{$loginname}\"");
$_SESSION['userid'] = $d_req['id'];
foreach (array('email', 'disabled', 'confirmed', 'htmlemail', 'uniqid', 'password', 'foreignkey') as $field) {
# if (!defined($_SESSION["userdata"][$field])) {
$_SESSION['userdata'][$field] = array('name' => $field, 'value' => $d_req[$field], 'type' => 'static', 'displayvalue' => $d_req[$field]);
# }
}
$_SESSION['usergroups'] = userGroups($loginname);
if (is_array($GLOBALS['config']['usergreeting'])) {
$_SESSION['usergreeting'] = '';
foreach ($GLOBALS['config']['usergreeting'] as $att) {
$_SESSION['usergreeting'] .= $_SESSION['userdata'][$att]['displayvalue'] . ' ';
}
$_SESSION['usergreeting'] = rtrim($_SESSION['usergreeting']);
}
dbg('done loading user');
return 1;
}
示例6: Error
print Error($GLOBALS['I18N']->get('You only have privileges to view this page, not change any of the information'));
return;
}
break;
case "none":
default:
$subselect = " and " . $tables["list"] . ".id = 0";
$subselect_where = " where " . $tables["list"] . ".owner = 0";
break;
}
if ($access != "all") {
$delete_message = '<br />' . $GLOBALS['I18N']->get('Delete will delete user from the list') . '<br />';
} else {
$delete_message = '<br />' . $GLOBALS['I18N']->get('Delete will delete user and all listmemberships') . '<br />';
}
$usegroups = Sql_Table_exists("groups") && Sql_Table_exists('user_group');
if ($_POST["change"] && ($access == "owner" || $access == "all")) {
if (!verifyToken()) {
print Error($GLOBALS['I18N']->get('No Access'));
return;
}
if (!$id) {
$id = addNewUser($_POST['email']);
$newuser = 1;
}
if (!$id) {
print $GLOBALS['I18N']->get('Error adding user, please check that the user exists');
return;
}
# read the current values to compare changes
$old_data = Sql_Fetch_Array_Query(sprintf('select * from %s where id = %d', $tables["user"], $id));
示例7: initialise
function initialise()
{
/* Make sure database is up to date */
global $table_prefix;
$imgtbl = $this->tables['image'];
$msgtbl = $this->tables['msg'];
if (Sql_Table_exists($imgtbl) && !Sql_Table_Column_Exists($imgtbl, "cksum") || Sql_Table_exists($msgtbl) && !Sql_Table_Column_Exists($msgtbl, "original")) {
// Have old database tables?
// Drop the old tables
Sql_Drop_Table($imgtbl);
Sql_Drop_Table($msgtbl);
// Flag the plugin as not intialized so that the parent will create the new tables
$entry = md5('plugin-inlineImagePlugin-initialised');
$query = sprintf("delete from %s where item='%s'", $GLOBALS["tables"]["config"], $entry);
Sql_Query($query);
// Force reloading of config arrays, so that our parent sees the plugin
// as not initialized.
unset($_SESSION['config']);
unset($GLOBALS['config']);
unset($_SESSION["dbtables"]);
// Empty the cache that still contains our table names
}
parent::initialise();
}
示例8: ignore_user_abort
$dbversion = "Older than 1.4.1";
}
print '<p>Your database version: ' . $dbversion . '</p>';
if ($dbversion == VERSION) {
print "Your database is already the correct version, there is no need to upgrade";
} else {
if ($_GET["doit"] == 'yes') {
$success = 1;
# once we are off, this should not be interrupted
ignore_user_abort(1);
# rename tables if we are using the prefix
include $GLOBALS["coderoot"] . "structure.php";
while (list($table, $value) = each($DBstruct)) {
set_time_limit(500);
if (isset($table_prefix)) {
if (Sql_Table_exists($table) && !Sql_Table_Exists($tables[$table])) {
Sql_Verbose_Query("alter table {$table} rename {$tables[$table]}", 1);
}
}
}
ob_end_flush();
print '<script language="Javascript" src="js/progressbar.js" type="text/javascript"></script>';
print '<script language="Javascript" type="text/javascript"> document.write(progressmeter); start();</script>';
# upgrade depending on old version
# $dbversion = ereg_replace("-dev","",$dbversion);
# output some stuff to make sure it's not buffered in the browser
for ($i = 0; $i < 10000; $i++) {
print ' ' . "\n";
}
print '<p>' . $GLOBALS['I18N']->get('Please wait, upgrading your database, do not interrupt') . '</p>';
for ($i = 0; $i < 10000; $i++) {
示例9: dirname
<?php
require_once dirname(__FILE__) . '/accesscheck.php';
ob_end_flush();
$upgrade_required = 0;
$canUpgrade = checkAccess("upgrade");
if (Sql_Table_exists($tables["config"], 1)) {
$dbversion = getConfig("version");
if ($dbversion != VERSION && $canUpgrade) {
Error($GLOBALS['I18N']->get('Your database is out of date, please make sure to upgrade') . '<br/>' . $GLOBALS['I18N']->get('Your version') . ' : ' . $dbversion . '<br/>' . $GLOBALS['I18N']->get('phplist version') . ' : ' . VERSION . '<br/>' . PageLink2("upgrade", $GLOBALS['I18N']->get('Upgrade')));
$upgrade_required = 1;
}
} else {
Info($GLOBALS['I18N']->get('Database has not been initialised') . '. ' . $GLOBALS['I18N']->get('go to') . ' ' . PageLink2("initialise&firstinstall=1", $GLOBALS['I18N']->get('Initialise Database')) . ' ' . $GLOBALS['I18N']->get('to continue'), 1);
$GLOBALS["firsttime"] = 1;
$_SESSION["firstinstall"] = 1;
return;
}
## trigger this somewhere else?
refreshTlds();
# check for latest version
$checkinterval = sprintf('%d', getConfig("check_new_version"));
if (!isset($checkinterval)) {
$checkinterval = 7;
}
$showUpdateAvail = !empty($_GET['showupdate']);
## just to check the design
$thisversion = VERSION;
$thisversion = preg_replace("/[^\\.\\d]/", "", $thisversion);
$latestversion = getConfig('updateavailable');
$showUpdateAvail = $showUpdateAvail || !empty($latestversion) && !versionCompare($thisversion, $latestversion);
示例10: flushbuffer
print $message . "\n";
flushbuffer();
flush();
}
flush();
}
function flushbuffer()
{
for ($i = 0; $i < 10000; ++$i) {
print " \n";
}
flush();
}
include dirname(__FILE__) . '/structure.php';
set_time_limit(60000);
if (!Sql_Table_exists($GLOBALS['tables']['linktrack_forward']) || !Sql_Table_exists($GLOBALS['tables']['linktrack_ml']) || !Sql_Table_exists($GLOBALS['tables']['linktrack_uml_click'])) {
output('creating tables');
Sql_Query('drop table ' . $GLOBALS['tables']['linktrack_forward']);
Sql_Query('drop table ' . $GLOBALS['tables']['linktrack_ml']);
Sql_Query('drop table ' . $GLOBALS['tables']['linktrack_uml_click']);
Sql_Create_Table($GLOBALS['tables']['linktrack_ml'], $DBstruct['linktrack_ml']);
Sql_Create_Table($GLOBALS['tables']['linktrack_forward'], $DBstruct['linktrack_forward']);
Sql_Create_Table($GLOBALS['tables']['linktrack_uml_click'], $DBstruct['linktrack_uml_click']);
output(s('creating tables done'));
}
$process_id = getPageLock();
if (empty($process_id)) {
return;
}
## only convert up to a week ago.
$lastweek = date('Y-m-d', time() - 24 * 7 * 3600);
示例11: session_set_save_handler
# try to set the configuration
if (empty($GLOBALS["SessionTableName"])) {
return;
}
# only necessary on main pages, not in lt/dl etc
if (basename($_SERVER['SCRIPT_NAME']) != 'index.php') {
return;
}
@ini_set("session.save_handler", "user");
$SessionTableName = $GLOBALS["SessionTableName"];
if (ini_get("session.save_handler") == "user") {
session_set_save_handler('mysql_session_open', 'mysql_session_close', 'mysql_session_read', 'mysql_session_write', 'mysql_session_destroy', 'mysql_session_gc');
} else {
# @ini_set("session.save_handler","files");
}
if (!Sql_Table_exists($GLOBALS["SessionTableName"])) {
Sql_Create_Table($GLOBALS["SessionTableName"], array("sessionid" => array("CHAR(32) NOT NULL PRIMARY KEY", ""), "lastactive" => array("INTEGER NOT NULL", ""), "data" => array("LONGTEXT", "")));
}
function mysql_session_open($save_path, $session_name)
{
return true;
}
function mysql_session_close()
{
return true;
}
function mysql_session_read($SessionID)
{
# dbg("Reading session info for $SessionID");
$SessionTableName = $GLOBALS["SessionTableName"];
$SessionID = addslashes($SessionID);
示例12: dirname
<?php
require_once dirname(__FILE__) . '/accesscheck.php';
## fetch updated translation
#var_dump($LANGUAGES);
if (!Sql_Table_exists($GLOBALS['tables']['i18n'])) {
include dirname(__FILE__) . '/structure.php';
Sql_Create_Table($GLOBALS['tables']['i18n'], $DBstruct['i18n']);
}
if (isset($_GET['lan'])) {
## Non-JS version
include 'actions/updatetranslation.php';
}
$force = !empty($_GET['force']);
$LU = getTranslationUpdates();
if (!$LU || !is_object($LU)) {
print Error(s('Unable to fetch list of languages, please check your network or try again later'));
return;
}
#var_dump($LU);
print '<ul>';
foreach ($LU->translation as $lan) {
# var_dump($lan);
$lastupdated = getConfig('lastlanguageupdate-' . $lan->iso);
if (!empty($LANGUAGES[(string) $lan->iso])) {
$lan_name = $LANGUAGES[(string) $lan->iso][0];
} else {
$lan_name = $lan->name;
}
if ($force || $lan->iso == $_SESSION['adminlanguage']['iso'] && $lan->lastmodified > $lastupdated) {
$updateLink = pageLinkAjax('updatetranslation&lan=' . $lan->iso, $lan_name);
示例13: Sql_Create_Table
if ($minor < 9 || $minor == 9 && $sub < 5) {
Sql_Create_Table($tables["user_message_forward"], $DBstruct["user_message_forward"]);
Sql_Query("alter table {$tables["user_attribute"]} add index userattid (attributeid,userid)");
Sql_Query("alter table {$tables["user_attribute"]} add index attuserid (userid,attributeid)");
Sql_Query("alter table {$tables["message"]} change column status status varchar(255)");
Sql_Create_Table($tables["userstats"], $DBstruct["userstats"]);
Sql_Create_Table($tables["bounceregex"], $DBstruct["bounceregex"]);
Sql_Create_Table($tables["bounceregex_bounce"], $DBstruct["bounceregex_bounce"]);
}
if ($minor < 10 || $minor == 10 && $sub < 13) {
Sql_Create_Table($tables["admintoken"], $DBstruct["admintoken"]);
}
break;
}
## make sure the token table exists
if (!Sql_Table_exists($tables["admintoken"], 1)) {
Sql_Create_Table($tables["admintoken"], $DBstruct["admintoken"]);
}
## add index on bounces, but ignore the error
Sql_Query("create index statusindex on {$tables["user_attribute"]} (status(10))", 1);
Sql_Query("create index message_lookup using btree on {$tables["user_message_bounce"]} (message)", 1);
## mantis issue 9001, make sure that the "repeat" column in the messages table is renamed to repeatinterval
# to avoid a name clash with Mysql 5.
# problem is that this statement will fail if the DB is already running Mysql 5
if (Sql_Table_Column_Exists($GLOBALS['tables']['message'], 'repeat')) {
Sql_Query(sprintf('alter ignore table %s change column repeat repeatinterval integer default 0', $GLOBALS['tables']['message']));
}
# check whether it worked and otherwise throw an error to say it needs to be done manually
if (Sql_Table_Column_Exists($GLOBALS['tables']['message'], 'repeat')) {
print 'Error, unable to rename column "repeat" in the table ' . $GLOBALS['tables']['message'] . ' to be "repeatinterval"<br/>
Please do this manually, refer to http://mantis.phplist.com/view.php?id=9001 for more information';
示例14: dirname
<?php
require_once dirname(__FILE__) . '/accesscheck.php';
ob_end_flush();
$upgrade_required = 0;
$canUpgrade = checkAccess('upgrade');
if (Sql_Table_exists($tables['config'], 1)) {
$dbversion = getConfig('version');
if ($dbversion != VERSION && $canUpgrade) {
Error($GLOBALS['I18N']->get('Your database is out of date, please make sure to upgrade') . '<br/>' . $GLOBALS['I18N']->get('Your version') . ' : ' . $dbversion . '<br/>' . $GLOBALS['I18N']->get('phplist version') . ' : ' . VERSION . '<br/>' . PageLink2('upgrade', $GLOBALS['I18N']->get('Upgrade')));
$upgrade_required = 1;
}
} else {
Info($GLOBALS['I18N']->get('Database has not been initialised') . '. ' . $GLOBALS['I18N']->get('go to') . ' ' . PageLink2('initialise&firstinstall=1', $GLOBALS['I18N']->get('Initialise Database')) . ' ' . $GLOBALS['I18N']->get('to continue'), 1);
$GLOBALS['firsttime'] = 1;
$_SESSION['firstinstall'] = 1;
return;
}
## trigger this somewhere else?
refreshTlds();
# check for latest version
$checkinterval = sprintf('%d', getConfig('check_new_version'));
if (!isset($checkinterval)) {
$checkinterval = 7;
}
$showUpdateAvail = !empty($_GET['showupdate']);
## just to check the design
$thisversion = VERSION;
$thisversion = preg_replace("/[^\\.\\d]/", '', $thisversion);
$latestversion = getConfig('updateavailable');
$showUpdateAvail = $showUpdateAvail || !empty($latestversion) && !versionCompare($thisversion, $latestversion);
示例15: session_set_save_handler
# try to set the configuration
if (empty($GLOBALS['SessionTableName'])) {
return;
}
# only necessary on main pages, not in lt/dl etc
if (basename($_SERVER['SCRIPT_NAME']) != 'index.php') {
return;
}
@ini_set('session.save_handler', 'user');
$SessionTableName = $GLOBALS['SessionTableName'];
if (ini_get('session.save_handler') == 'user') {
session_set_save_handler('mysql_session_open', 'mysql_session_close', 'mysql_session_read', 'mysql_session_write', 'mysql_session_destroy', 'mysql_session_gc');
} else {
# @ini_set("session.save_handler","files");
}
if (!Sql_Table_exists($GLOBALS['SessionTableName'])) {
Sql_Create_Table($GLOBALS['SessionTableName'], array('sessionid' => array('CHAR(32) NOT NULL PRIMARY KEY', ''), 'lastactive' => array('INTEGER NOT NULL', ''), 'data' => array('LONGTEXT', '')));
}
function mysql_session_open($save_path, $session_name)
{
return true;
}
function mysql_session_close()
{
return true;
}
function mysql_session_read($SessionID)
{
# dbg("Reading session info for $SessionID");
$SessionTableName = $GLOBALS['SessionTableName'];
$SessionID = addslashes($SessionID);