本文整理汇总了PHP中Sql_Table_Exists函数的典型用法代码示例。如果您正苦于以下问题:PHP Sql_Table_Exists函数的具体用法?PHP Sql_Table_Exists怎么用?PHP Sql_Table_Exists使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Sql_Table_Exists函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dirname
<?php
require_once dirname(__FILE__) . '/accesscheck.php';
#$spb ='<li>';
#$spe = '</li>';
# Replace the $spb & $spe by <li id="li_ID"> & </li>
$html = '<ul>';
$html .= '<li id="users">' . PageLink2('users', $GLOBALS['I18N']->get('search subscribers')) . '</li>';
$html .= '<li id="attributes">' . PageLink2('attributes', $GLOBALS['I18N']->get('manage subscriber attributes')) . '</li>';
$attributehtml = '';
if ($tables['attribute'] && Sql_Table_Exists($tables['attribute'])) {
$attrmenu = array();
$res = Sql_Query("select * from {$tables['attribute']}", 1);
while ($row = Sql_Fetch_array($res)) {
if ($row['type'] == 'checkboxgroup' || $row['type'] == 'select' || $row['type'] == 'radio') {
$attrmenu['editattributes&id=' . $row['id']] = strip_tags($row['name']);
}
}
}
foreach ($attrmenu as $page => $desc) {
$link = PageLink2($page, $desc);
if ($link) {
$attributehtml .= '<li>' . $link . '</li>';
}
}
if (!empty($attributehtml)) {
$html .= '<li id="edit-values">' . $GLOBALS['I18N']->get('edit values for attributes') . '<ul>' . $attributehtml . '</ul>';
}
$html .= '<li id="reconcileusers">' . PageLink2('reconcileusers', $GLOBALS['I18N']->get('Reconcile Subscribers')) . '</li>';
$html .= '<li id="massunconfirm">' . PageLink2('suppressionlist', $GLOBALS['I18N']->get('Suppression list')) . '</li>';
$html .= '<li id="massremove">' . PageLink2('massremove', $GLOBALS['I18N']->get('Bulk remove subscribers')) . '</li>';
示例2: printf
printf('<li><input type="hidden" name="listname[%d]" value="%s"><input type="checkbox" name="lists[%d]" value="%d">%s', $c, stripslashes($row["name"]), $c, $row["id"], stripslashes($row["name"]));
$some = 1;
$c++;
}
*/
if (!$some) {
echo $GLOBALS['I18N']->get('No lists available') . ' ' . PageLink2("editlist", $GLOBALS['I18N']->get('Add a list'));
} else {
$selected_lists = getSelectedLists('lists');
print listSelectHTML($selected_lists, 'lists', $subselect, s('Select the lists to add the emails to'));
}
}
/*
}
*/
if (defined('IN_WEBBLER') && Sql_Table_Exists("groups")) {
$result = Sql_query("SELECT id,name FROM groups ORDER BY listorder");
$c = 0;
if (Sql_Affected_Rows() == 1) {
$row = Sql_fetch_array($result);
printf('<p class="information"><input type="hidden" name="groupname[%d]" value="%s"><input type="hidden" name="groups[%d]" value="%d">Adding users to group <b>%s</b></p>', $c, $row["name"], $c, $row["id"], $row["name"]);
} else {
print '<p class="information">' . $GLOBALS['I18N']->get('Select the groups to add the users to') . '</p>';
while ($row = Sql_fetch_array($result)) {
if ($row["id"] == $everyone_groupid) {
printf('<li><input type="hidden" name="groupname[%d]" value="%s"><input type="hidden" name="groups[%d]" value="%d"><b>%s</b> - ' . $GLOBALS['I18N']->get('automatically added'), $c, $row["name"], $c, $row["id"], $row["name"]);
} else {
printf('<li><input type="hidden" name="groupname[%d]" value="%s"><input type="checkbox" name="groups[%d]" value="%d">%s', $c, $row["name"], $c, $row["id"], $row["name"]);
}
$some = 1;
$c++;
示例3: dirname
require_once dirname(__FILE__) . '/accesscheck.php';
# quick installation checklist
# initialise database
# setup config values
# configure attributes
# create lists
# create subscribe pages
# add subscribers
$alldone = 1;
$html = '';
$html .= '<table class="setupMain">';
$link = PageLink2('initialise', $GLOBALS['I18N']->get('Go there'));
if (!empty($link)) {
$html .= '<tr><td>' . $GLOBALS['I18N']->get('Initialise Database') . '</td>
<td>' . $link . '</td><td>';
if (Sql_Table_Exists($tables['config'], 1)) {
$html .= $GLOBALS['img_tick'];
} else {
$html .= $GLOBALS['img_cross'];
$alldone = 0;
}
$html .= '</td></tr>';
}
$link = PageLink2('admin&id=1', s('Go there'));
if (!empty($link) && $GLOBALS['require_login']) {
$html .= '<tr><td>' . s('Change admin password') . ' </td>
<td>' . $link . '</td><td>';
$curpwd = Sql_Fetch_Row_Query("select password from {$tables['admin']} where loginname = \"admin\"");
if ($curpwd[0] != 'phplist' && $curpwd[0] != encryptPass('phplist')) {
$html .= $GLOBALS['img_tick'];
} else {
示例4: dirname
<?php
require_once dirname(__FILE__) . '/accesscheck.php';
# convert the database to add the prefix
# dangerous, should not be used, particularly not if the prefix already exists
if (!$GLOBALS["table_prefix"]) {
print "No prefix defined, nothing to do";
return;
}
include "structure.php";
while (list($table, $value) = each($DBstruct)) {
if ($table != $tables[$table]) {
Sql_Drop_Table($tables[$table]);
Sql_Verbose_Query("alter table {$table} rename {$tables[$table]}", 0);
}
}
$req = Sql_Verbose_Query("select tablename from " . $tables["attribute"]);
while ($row = Sql_Fetch_Row($req)) {
set_time_limit(500);
if (Sql_Table_Exists("listattr_" . $row[0]) && $table_prefix) {
Sql_Verbose_Query("alter table listattr_{$row['0']} rename {$table_prefix}" . "listattr_" . $row[0]);
}
if (Sql_Table_Exists($table_prefix . "listattr_" . $row[0])) {
Sql_Query("alter table {$table_prefix}" . "listattr_" . $row[0] . " add column listorder integer default 0", 0);
}
}
flush();
示例5: SaveConfig
function SaveConfig($item, $value, $editable = 1, $ignore_errors = 0)
{
global $tables;
## in case DB hasn't been initialised
if (empty($_SESSION['hasconf'])) {
$_SESSION['hasconf'] = Sql_Table_Exists($tables['config']);
}
if (empty($_SESSION['hasconf'])) {
return;
}
if (isset($GLOBALS['default_config'][$item])) {
$configInfo = $GLOBALS['default_config'][$item];
} else {
$configInfo = array('type' => 'unknown', 'allowempty' => true, 'value' => '');
}
## to validate we need the actual values
$value = str_ireplace('[domain]', $GLOBALS['domain'], $value);
$value = str_ireplace('[website]', $GLOBALS['website'], $value);
switch ($configInfo['type']) {
case 'boolean':
if ($value == 'false' || $value == 'no') {
$value = 0;
} elseif ($value == 'true' || $value == 'yes') {
$value = 1;
}
break;
case 'integer':
$value = sprintf('%d', $value);
if ($value < $configInfo['min']) {
$value = $configInfo['min'];
}
if ($value > $configInfo['max']) {
$value = $configInfo['max'];
}
break;
case 'email':
if (!empty($value) && !is_email($value)) {
## hmm, this is displayed only later
# $_SESSION['action_result'] = s('Invalid value for email address');
return $configInfo['description'] . ': ' . s('Invalid value for email address');
$value = '';
}
break;
case 'emaillist':
$valid = array();
$hasError = false;
$emails = explode(',', $value);
foreach ($emails as $email) {
if (is_email($email)) {
$valid[] = $email;
} else {
$hasError = true;
}
}
$value = implode(',', $valid);
/*
* hmm, not sure this is good or bad for UX
*
*/
if ($hasError) {
return $configInfo['description'] . ': ' . s('Invalid value for email address');
}
break;
case 'image':
include 'class.image.inc';
$image = new imageUpload();
$imageId = $image->uploadImage($item, 0);
if ($imageId) {
$value = $imageId;
}
## we only use the image type for the logo
flushLogoCache();
}
## reset to default if not set, and required
if (empty($configInfo['allowempty']) && empty($value)) {
$value = $configInfo['value'];
}
if (!empty($configInfo['hidden'])) {
$editable = 0;
}
## force reloading config values in session
unset($_SESSION['config']);
## and refresh the config immediately https://mantis.phplist.com/view.php?id=16693
unset($GLOBALS['config']);
Sql_Query(sprintf('replace into %s set item = "%s", value = "%s", editable = %d', $tables['config'], sql_escape($item), sql_escape($value), $editable));
return false;
## true indicates error, and which one
}
示例6: logEvent
function logEvent($msg)
{
global $tables;
if (isset($GLOBALS['page'])) {
$p = $GLOBALS['page'];
} elseif (isset($_GET['page'])) {
$p = $_GET['page'];
} elseif (isset($_GET['p'])) {
$p = $_GET['p'];
} else {
$p = 'unknown page';
}
if (Sql_Table_Exists($tables["eventlog"])) {
Sql_Query(sprintf('insert into %s (entered,page,entry) values(now(),"%s","%s")', $tables["eventlog"], $p, addslashes($msg)));
}
}
示例7: dirname
<?php
require_once dirname(__FILE__) . '/accesscheck.php';
# convert the database to add the prefix
# dangerous, should not be used, particularly not if the prefix already exists
if (!$GLOBALS['table_prefix']) {
print 'No prefix defined, nothing to do';
return;
}
include 'structure.php';
while (list($table, $value) = each($DBstruct)) {
if ($table != $tables[$table]) {
Sql_Verbose_Query("drop table if exists {$tables[$table]}", 0);
Sql_Verbose_Query("alter table {$table} rename {$tables[$table]}", 0);
}
}
$req = Sql_Verbose_Query('select tablename from ' . $tables['attribute']);
while ($row = Sql_Fetch_Row($req)) {
set_time_limit(500);
if (Sql_Table_Exists('listattr_' . $row[0]) && $table_prefix) {
Sql_Verbose_Query("alter table listattr_{$row['0']} rename {$table_prefix}" . 'listattr_' . $row[0]);
}
if (Sql_Table_Exists($table_prefix . 'listattr_' . $row[0])) {
Sql_Query("alter table {$table_prefix}" . 'listattr_' . $row[0] . ' add column listorder integer default 0', 0);
}
}
flush();
示例8: logEvent
function logEvent($msg)
{
$logged = false;
foreach ($GLOBALS['plugins'] as $pluginname => $plugin) {
$logged = $logged || $plugin->logEvent($msg);
}
if ($logged) {
return;
}
global $tables;
if (isset($GLOBALS['page'])) {
$p = $GLOBALS['page'];
} elseif (isset($_GET['page'])) {
$p = $_GET['page'];
} elseif (isset($_GET['p'])) {
$p = $_GET['p'];
} else {
$p = 'unknown page';
}
if (!Sql_Table_Exists($tables['eventlog'])) {
return;
}
Sql_Query(sprintf('insert into %s (entered,page,entry) values(now(),"%s","%s")', $tables['eventlog'], $p, sql_escape($msg)));
}
示例9: dirname
require_once dirname(__FILE__) . '/accesscheck.php';
# quick installation checklist
# initialise database
# setup config values
# configure attributes
# create lists
# create subscribe pages
# add subscribers
$alldone = 1;
$html = '';
$html .= '<table class="setupMain">';
$link = PageLink2("initialise", $GLOBALS['I18N']->get('Go there'));
if (!empty($link)) {
$html .= '<tr><td>' . $GLOBALS['I18N']->get('Initialise Database') . '</td>
<td>' . $link . '</td><td>';
if (Sql_Table_Exists($tables["config"], 1)) {
$html .= $GLOBALS["img_tick"];
} else {
$html .= $GLOBALS["img_cross"];
$alldone = 0;
}
$html .= '</td></tr>';
}
$link = PageLink2("admin&id=1", s('Go there'));
if (!empty($link) && $GLOBALS["require_login"]) {
$html .= '<tr><td>' . s('Change admin password') . ' </td>
<td>' . $link . '</td><td>';
$curpwd = Sql_Fetch_Row_Query("select password from {$tables["admin"]} where loginname = \"admin\"");
if ($curpwd[0] != "phplist" && $curpwd[0] != encryptPass('phplist')) {
$html .= $GLOBALS["img_tick"];
} else {
示例10: upgradeTable
function upgradeTable($table, $tablestructure)
{
global $tmpdir;
$columns = array();
$records = array();
$fname = tempnam($tmpdir, "");
$fp = fopen($fname, "w");
if (Sql_Table_Exists($table)) {
$cols = Sql_Query("show columns from {$table}");
while ($row = Sql_Fetch_Row($cols)) {
array_push($columns, $row[0]);
}
#$fp = tmpfile();
# print "Writing tempfile $fname<br>";
$recs = Sql_Query("select * from {$table}");
while ($data = Sql_Fetch_Array($recs)) {
reset($columns);
foreach ($columns as $column) {
fwrite($fp, "{$column}:" . base64_encode($data[$column]) . "\n");
}
fwrite($fp, "--\n");
}
}
fclose($fp);
Sql_Query("drop table if exists {$table}");
Sql_Create_table($table, $tablestructure);
$fp = fopen($fname, "r");
if (!$fp) {
unlink($fname);
return 0;
}
# print "Reading tempfile<br>";
while (!feof($fp)) {
# read one record
$buffer = "";
$record = array();
$buffer = fgets($fp, 4096);
while (!feof($fp) && !ereg("^--", $buffer)) {
list($column, $value) = explode(":", $buffer);
if ($column && $value) {
$record[$column] = base64_decode($value);
}
$buffer = fgets($fp, 4096);
}
$collist = "";
$vallist = "";
if (sizeof($record)) {
reset($tablestructure);
while (list($column, $value) = each($tablestructure)) {
if ($column != "primary key" && $column != "unique") {
$collist .= "{$column},";
$vallist .= sprintf('"%s",', addslashes($record[$column]));
}
}
$collist = substr($collist, 0, -1);
$vallist = substr($vallist, 0, -1);
$query = "replace into {$table} ({$collist}) values({$vallist})";
# print $query . "<br>";
if (!Sql_Query($query)) {
unlink($fname);
return 0;
}
}
}
fclose($fp);
unlink($fname);
return 1;
}
示例11: SaveConfig
function SaveConfig($item, $value, $editable = 1, $ignore_errors = 0)
{
global $tables;
## in case DB hasn't been initialised
if (empty($_SESSION['hasconf'])) {
$_SESSION['hasconf'] = Sql_Table_Exists($tables["config"]);
}
if (empty($_SESSION['hasconf'])) {
return;
}
if (isset($GLOBALS['default_config'][$item])) {
$configInfo = $GLOBALS['default_config'][$item];
} else {
$configInfo = array('type' => 'unknown', 'allowempty' => true, 'value' => '');
}
## to validate we need the actual values
$value = str_ireplace('[domain]', $GLOBALS['domain'], $value);
$value = str_ireplace('[website]', $GLOBALS['website'], $value);
switch ($configInfo['type']) {
case 'boolean':
if ($value == "false" || $value == "no") {
$value = 0;
} elseif ($value == "true" || $value == "yes") {
$value = 1;
}
break;
case 'integer':
$value = sprintf('%d', $value);
if ($value < $configInfo['min']) {
$value = $configInfo['min'];
}
if ($value > $configInfo['max']) {
$value = $configInfo['max'];
}
break;
case 'email':
if (!is_email($value)) {
## hmm, this is displayed only later
# $_SESSION['action_result'] = s('Invalid value for email address');
return $configInfo['description'] . ': ' . s('Invalid value for email address');
$value = '';
}
break;
case 'emaillist':
$valid = array();
$hasError = false;
$emails = explode(',', $value);
foreach ($emails as $email) {
if (is_email($email)) {
$valid[] = $email;
} else {
$hasError = true;
}
}
$value = join(',', $valid);
/*
* hmm, not sure this is good or bad for UX
*
*/
if ($hasError) {
return $configInfo['description'] . ': ' . s('Invalid value for email address');
}
break;
}
## reset to default if not set, and required
if (empty($configInfo['allowempty']) && empty($value)) {
$value = $configInfo['value'];
}
if (!empty($configInfo['hidden'])) {
$editable = false;
}
## force reloading config values in session
unset($_SESSION['config']);
## and refresh the config immediately https://mantis.phplist.com/view.php?id=16693
unset($GLOBALS['config']);
Sql_Replace($tables["config"], array('item' => $item, 'value' => $value, 'editable' => $editable), 'item');
return false;
## true indicates error, and which one
}
示例12: WebblerListing
print '</div>';
$bouncels = new WebblerListing($GLOBALS['I18N']->get('Bounces'));
$bouncelist = '';
$bounces = array();
# check for bounces
$req = Sql_Query(sprintf('select *,date_format(time,"%%e %%b %%Y %%T") as ftime from %s where user = %d', $tables['user_message_bounce'], $user['id']));
if (Sql_Affected_Rows()) {
while ($row = Sql_Fetch_Array($req)) {
$bouncels->addElement($row['bounce'], PageURL2('bounce', $GLOBALS['I18N']->get('view'), 'id=' . $row['bounce']));
$bouncels->addColumn($row['bounce'], $GLOBALS['I18N']->get('msg'), $row['message']);
$bouncels->addColumn($row['bounce'], $GLOBALS['I18N']->get('time'), $row['ftime']);
$bounces[$row['message']] = $row['ftime'];
}
}
$ls = new WebblerListing($GLOBALS['I18N']->get('Messages'));
if (Sql_Table_Exists($tables['usermessage'])) {
$msgs = Sql_Query(sprintf('select messageid,entered,viewed,(viewed = 0 or viewed is null) as notviewed,
abs(unix_timestamp(entered) - unix_timestamp(viewed)) as responsetime from %s where userid = %d and status = "sent" order by entered desc', $tables['usermessage'], $user['id']));
$num = Sql_Affected_Rows();
} else {
$num = 0;
}
printf('%d ' . $GLOBALS['I18N']->get('messages sent to this user') . '<br/>', $num);
if ($num) {
$resptime = 0;
$totalresp = 0;
$ls->setElementHeading($GLOBALS['I18N']->get('Campaign Id'));
while ($msg = Sql_Fetch_Array($msgs)) {
$ls->addElement($msg['messageid'], PageURL2('message', $GLOBALS['I18N']->get('view'), 'id=' . $msg['messageid']));
if (defined('CLICKTRACK') && CLICKTRACK) {
$clicksreq = Sql_Fetch_Row_Query(sprintf('select sum(clicked) as numclicks from %s where userid = %s and messageid = %s', $GLOBALS['tables']['linktrack_uml_click'], $user['id'], $msg['messageid']));
示例13: logEvent
function logEvent($msg)
{
global $tables;
if (isset($GLOBALS['page'])) {
$p = $GLOBALS['page'];
} elseif (isset($_GET['page'])) {
$p = $_GET['page'];
} elseif (isset($_GET['p'])) {
$p = $_GET['p'];
} else {
$p = 'unknown page';
}
$p = removeXss($p);
if (Sql_Table_Exists($tables["eventlog"])) {
Sql_Query(sprintf('insert into %s (entered,page,entry) values(now(),"%s","%s")', $tables["eventlog"], sql_escape($p), htmlspecialchars(sql_escape($msg))));
}
}
示例14: logEvent
function logEvent($msg)
{
$logged = false;
foreach ($GLOBALS['plugins'] as $pluginname => $plugin) {
$logged = $logged || $plugin->logEvent($msg);
}
if ($logged) {
return;
}
global $tables;
if (isset($GLOBALS['page'])) {
$p = $GLOBALS['page'];
} elseif (isset($_GET['page'])) {
$p = $_GET['page'];
} elseif (isset($_GET['p'])) {
$p = $_GET['p'];
} else {
$p = 'unknown page';
}
if (!Sql_Table_Exists($tables["eventlog"])) {
return;
}
$query = ' insert into %s' . ' (entered,page,entry)' . ' values' . ' (current_timestamp, ?, ?)';
$query = sprintf($query, $tables["eventlog"]);
Sql_Query_Params($query, array($p, $msg));
}
示例15: elseif
if (!isset($_GET['page'])) {
$page = $GLOBALS['homepage'];
} else {
$page = $_GET['page'];
}
if (preg_match("/([\\w_]+)/", $page, $regs)) {
$page = $regs[1];
} else {
$page = '';
}
if (!is_file($page . '.php') && !isset($_GET['pi'])) {
$page = $GLOBALS['homepage'];
}
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;
}
if (!empty($_GET['pi']) && isset($GLOBALS['plugins'][$_GET['pi']])) {
$page_title = $GLOBALS['plugins'][$_GET['pi']]->pageTitle($page);
} else {
$page_title = $GLOBALS['I18N']->pageTitle($page);
}