本文整理匯總了PHP中DB_query函數的典型用法代碼示例。如果您正苦於以下問題:PHP DB_query函數的具體用法?PHP DB_query怎麽用?PHP DB_query使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了DB_query函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: update_tables
function update_tables()
{
global $_TABLES;
global $_CONF;
//マスタのデータ
$_SQL = array();
//=====SQL 定義 ココから
// 更新が必要なところの條件を変更して使用してください
if (1 === 0) {
//カテゴリ定義に親カテゴリIDとグループID追加
$_SQL[] = "\n\t\tCREATE TABLE {$_TABLES['DATABOX_def_fieldset']} (\n\t\t`fieldset_id` int(11) NOT NULL,\n\t\t`name` varchar(64) NOT NULL,\n\t\t`description` mediumtext,\n\t\t`udatetime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\n\t\t`uuid` mediumint(8) NOT NULL,\n\t\tPRIMARY KEY (`fieldset_id`)\n\t\t) ENGINE=MyISAM\n\t\t";
//屬性セット関連
$_SQL[] = "\n\t\tCREATE TABLE {$_TABLES['DATABOX_def_fieldset_assignments']} (\n\t\t`seq` int(11) NOT NULL AUTO_INCREMENT,\n\t\t`fieldset_id` int(11) NOT NULL,\n\t\t`field_id` int(11) NOT NULL,\n\t\tPRIMARY KEY (`seq`),\n\t\tKEY `fieldset_id` (`fieldset_id`)\n\t\t) ENGINE=MyISAM\n\t\t";
$_SQL[] = "\n ALTER TABLE {$_TABLES['DATABOX_base']}\n\t\tADD `fieldset_id` int(11) NOT NULL default 0 AFTER `orderno`,\n ";
}
//=====SQL 定義 ココまで
//------------------------------------------------------------------
for ($i = 1; $i <= count($_SQL); $i++) {
$w = current($_SQL);
DB_query(current($_SQL));
next($_SQL);
}
if (DB_error()) {
COM_errorLog("error DataBox table update ", 1);
return false;
}
COM_errorLog("Success - DataBox table update", 1);
return "end";
}
示例2: GEEKLOGJP_disablePlugins
/**
* Disable incompatible plugins to prevent an error which will occur during
* the upgrade process.
*
* @link http://code.google.com/p/geeklog-jp/wiki/manage151
*/
function GEEKLOGJP_disablePlugins()
{
global $_TABLES;
/**
* Geeklog-1.5.xで動作確認の取れているプラグインのリスト。
* $allowed_plugins['プラグイン英語名'] = '動作する最低バージョン' のフォー
* マット。Geeklogに同梱されているプラグインはチェック不要なので、バージョン
* は '*' とする。
*/
$allowed_plugins = array('staticpages' => '*', 'links' => '*', 'polls' => '*', 'calendar' => '*', 'autotags' => '1.01', 'calendarjp' => '1.1.6', 'captcha' => '3.5.5', 'custommenu' => '0.2.2', 'dataproxy' => '2.0.0', 'dbman' => '0.7.1', 'filemgmt' => '1.6.0.jp3', 'forum' => '2.9.0hg', 'japanize' => '2.1.0', 'mycaljp' => '2.0.5', 'nmoxtopicown' => '1.0.12', 'sitemap' => '1.1.2', 'themedit' => '1.2.1');
$sqls = array();
$sql = "SELECT pi_name, pi_version " . "FROM {$_TABLES['plugins']} " . "WHERE (pi_enabled = '1') ";
$result = DB_query($sql);
if (!DB_error()) {
while (($A = DB_fetchArray($result)) !== false) {
$pi_name = $A['pi_name'];
$pi_version = $A['pi_version'];
if (array_key_exists($pi_name, $allowed_plugins)) {
if ($allowed_plugins[$pi_name] == '*' or version_compare($pi_version, $allowed_plugins[$pi_name]) >= 0) {
continue;
}
}
$sqls[] = "UPDATE {$_TABLES['plugins']} " . "SET pi_enabled = '0' " . "WHERE (pi_name = '" . addslashes($pi_name) . "') ";
}
if (count($sqls) > 0) {
foreach ($sqls as $sql) {
DB_query($sql);
}
}
}
}
示例3: spamx_upgrade
function spamx_upgrade()
{
global $_TABLES, $_CONF, $_SPX_CONF;
$currentVersion = DB_getItem($_TABLES['plugins'], 'pi_version', "pi_name='spamx'");
switch ($currentVersion) {
case '1.1.0':
case '1.1.1':
case '1.1.2':
case '1.1.3':
case '1.1.4':
case '1.1.5':
case '1.1.6':
case '1.1.7':
case '1.1.8':
case '1.1.9':
case '1.2.0':
$c = config::get_instance();
$c->add('fs_sfs', NULL, 'fieldset', 0, 1, NULL, 0, true, 'spamx');
$c->add('sfs_username_check', false, 'select', 0, 1, 1, 10, true, 'spamx');
$c->add('sfs_email_check', true, 'select', 0, 1, 1, 20, true, 'spamx');
$c->add('sfs_ip_check', true, 'select', 0, 1, 1, 30, true, 'spamx');
$c->add('sfs_username_confidence', '99.00', 'text', 0, 1, 1, 40, true, 'spamx');
$c->add('sfs_email_confidence', '50.00', 'text', 0, 1, 1, 50, true, 'spamx');
$c->add('sfs_ip_confidence', '25.00', 'text', 0, 1, 1, 60, true, 'spamx');
default:
DB_query("UPDATE {$_TABLES['plugins']} SET pi_version='" . $_SPX_CONF['pi_version'] . "',pi_gl_version='" . $_SPX_CONF['gl_version'] . "' WHERE pi_name='spamx' LIMIT 1");
break;
}
if (DB_getItem($_TABLES['plugins'], 'pi_version', "pi_name='spamx'") == $_SPX_CONF['pi_version']) {
return true;
} else {
return false;
}
}
示例4: MG_displaySessions
function MG_displaySessions()
{
global $_CONF, $_MG_CONF, $_TABLES, $_USER, $LANG_MG00, $LANG_MG01;
$retval = '';
$T = new Template($_MG_CONF['template_path'] . '/admin');
$T->set_file(array('sessions' => 'sessions.thtml', 'empty' => 'sess_noitems.thtml', 'sessitems' => 'sessitems.thtml'));
$T->set_var(array('site_url' => $_CONF['site_url'], 'lang_select' => $LANG_MG01['select'], 'lang_checkall' => $LANG_MG01['check_all'], 'lang_uncheckall' => $LANG_MG01['uncheck_all']));
$sql = "SELECT * FROM {$_TABLES['mg_sessions']} WHERE session_status=1";
$result = DB_query($sql);
$numRows = DB_numRows($result);
$rowclass = 0;
if ($numRows == 0) {
// we have no active sessions
$T->set_var(array('lang_no_sessions' => $LANG_MG01['no_sessions']));
$T->parse('noitems', 'empty');
} else {
$totalSess = $numRows;
$T->set_block('sessitems', 'sessRow', 'sRow');
for ($x = 0; $x < $numRows; $x++) {
$row = DB_fetchArray($result);
$res2 = DB_query("SELECT COUNT(id) FROM {$_TABLES['mg_session_items']} WHERE session_id='" . $row['session_id'] . "' AND status=0");
list($count) = DB_fetchArray($res2);
$T->set_var(array('row_class' => $rowclass % 2 ? '1' : '2', 'session_id' => $row['session_id'], 'session_owner' => DB_getItem($_TABLES['users'], 'username', "uid={$row['session_uid']}"), 'session_description' => $row['session_description'], 'session_continue' => $_MG_CONF['site_url'] . '/batch.php?mode=continue&sid=' . $row['session_id'], 'count' => $count));
$T->parse('sRow', 'sessRow', true);
$rowclass++;
}
$T->parse('sessitems', 'sessitems');
}
$T->set_var(array('s_form_action' => $_MG_CONF['admin_url'] . 'sessions.php', 'mode' => 'sessions', 'lang_category_manage_help' => $LANG_MG01['category_manage_help'], 'lang_catid' => $LANG_MG01['cat_id'], 'lang_cat_name' => $LANG_MG01['cat_name'], 'lang_cat_description' => $LANG_MG01['cat_description'], 'lang_save' => $LANG_MG01['save'], 'lang_cancel' => $LANG_MG01['cancel'], 'lang_delete' => $LANG_MG01['delete'], 'lang_select' => $LANG_MG01['select'], 'lang_checkall' => $LANG_MG01['check_all'], 'lang_uncheckall' => $LANG_MG01['uncheck_all'], 'lang_session_id' => $LANG_MG01['cat_id'], 'lang_session_description' => $LANG_MG01['description'], 'lang_session_owner' => $LANG_MG01['owner'], 'lang_session_count' => $LANG_MG01['count'], 'lang_action' => $LANG_MG01['action']));
$T->parse('output', 'sessions');
$retval .= $T->finish($T->get_var('output'));
return $retval;
}
示例5: links_upgrade
function links_upgrade()
{
global $_TABLES, $_CONF, $_LI_CONF;
$currentVersion = DB_getItem($_TABLES['plugins'], 'pi_version', "pi_name='links'");
switch ($currentVersion) {
case '2.0.0':
case '2.0.1':
$c = config::get_instance();
$c->add('target_blank', FALSE, 'select', 0, 1, 0, 55, true, 'links');
case '2.0.2':
case '2.0.3':
case '2.0.4':
case '2.0.5':
case '2.0.6':
case '2.0.7':
case '2.0.8':
case '2.0.9':
case '2.1.0':
case '2.1.1':
case '2.1.2':
$c = config::get_instance();
$c->add('displayblocks', 0, 'select', 0, 0, 13, 60, true, 'links');
case '2.1.3':
case '2.1.4':
default:
DB_query("UPDATE {$_TABLES['plugins']} SET pi_version='" . $_LI_CONF['pi_version'] . "',pi_gl_version='" . $_LI_CONF['gl_version'] . "' WHERE pi_name='links' LIMIT 1");
break;
}
if (DB_getItem($_TABLES['plugins'], 'pi_version', "pi_name='links'") == $_LI_CONF['pi_version']) {
return true;
} else {
return false;
}
}
示例6: db
function db($user, $password)
{
$_SESSION['UserID'] = $user;
$sql = "SELECT userid,\n\t\t\t\t\t\taccesslevel\n\t\t\t\tFROM www_users\n\t\t\t\tWHERE userid='" . DB_escape_string($user) . "'\n\t\t\t\tAND (password='" . CryptPass(DB_escape_string($password)) . "'\n\t\t\t\tOR password='" . DB_escape_string($password) . "')";
$Auth_Result = DB_query($sql, $_SESSION['db']);
$myrow = DB_fetch_row($Auth_Result);
if (DB_num_rows($Auth_Result) > 0) {
$sql = 'SELECT tokenid FROM securitygroups
WHERE secroleid = ' . $_SESSION['AccessLevel'];
$Sec_Result = DB_query($sql, $db);
$_SESSION['AllowedPageSecurityTokens'] = array();
if (DB_num_rows($Sec_Result) == 0) {
return NoAuthorisation;
} else {
$i = 0;
while ($myrow = DB_fetch_row($Sec_Result)) {
$_SESSION['AllowedPageSecurityTokens'][$i] = $myrow[0];
$i++;
}
}
return $_SESSION['db'];
} else {
return NoAuthorisation;
}
}
示例7: MG_adminEXIF
function MG_adminEXIF()
{
global $_TABLES, $_MG_CONF, $_CONF, $LANG_MG01, $LANG_MG04;
$retval = '';
$T = new Template($_MG_CONF['template_path']);
$T->set_file('admin', 'exif_tags.thtml');
$T->set_var('site_url', $_CONF['site_url']);
$T->set_var('site_admin_url', $_CONF['site_admin_url']);
$T->set_var('xhtml', XHTML);
$T->set_block('admin', 'exifRow', 'eRow');
$sql = "SELECT * FROM {$_TABLES['mg_exif_tags']}";
$result = DB_query($sql);
$nrows = DB_numRows($result);
for ($i = 0; $i < $nrows; $i++) {
$row = DB_fetchArray($result);
$properties[] = $row['name'];
$tag[$row['name']][] = $row['selected'];
}
$exifKeys = getExifKeys();
$x = 0;
foreach ($properties as $property) {
$title = $exifKeys[$property][0];
$T->set_var(array('exif_tag' => $title, 'selected' => $tag[$property][0] ? ' checked="checked"' : '', 'tag' => $property, 'rowcounter' => $x % 2));
$T->parse('eRow', 'exifRow', true);
$x++;
}
$T->set_var(array('lang_select' => $LANG_MG01['select'], 'lang_exiftag' => $LANG_MG01['exiftag'], 'lang_exif_admin_help' => $LANG_MG01['exif_admin_help'], 'lang_check_all' => $LANG_MG01['check_all'], 'lang_uncheck_all' => $LANG_MG01['uncheck_all'], 'lang_save' => $LANG_MG01['save'], 'lang_cancel' => $LANG_MG01['cancel'], 's_form_action' => $_MG_CONF['admin_url'] . 'exif_admin.php'));
$retval .= $T->finish($T->parse('output', 'admin'));
return $retval;
}
示例8: MG_selectUsers
function MG_selectUsers($page)
{
global $glversion, $_CONF, $_MG_CONF, $_TABLES, $_USER, $LANG_MG00, $LANG_MG01;
$retval = '';
$T = new Template($_MG_CONF['template_path']);
$T->set_file('admin', 'createmembers.thtml');
$T->set_var(array('site_admin_url' => $_CONF['site_admin_url'], 'site_url' => $_CONF['site_url'], 'xhtml' => XHTML));
$T->set_block('admin', 'UserRow', 'uRow');
$start = $page * 50;
$end = 50;
$sql = "SELECT COUNT(gl.uid) AS count " . "FROM {$_TABLES['users']} AS gl " . "LEFT JOIN {$_TABLES['mg_userprefs']} AS mg ON gl.uid=mg.uid " . "WHERE gl.status = 3 AND gl.uid > 2 AND (mg.member_gallery IS NULL OR mg.member_gallery < 1)";
$result = DB_query($sql);
list($total_records) = DB_fetchArray($result);
$sql = "SELECT gl.uid, gl.status, gl.username, gl.fullname, mg.member_gallery " . "FROM {$_TABLES['users']} AS gl " . "LEFT JOIN {$_TABLES['mg_userprefs']} AS mg ON gl.uid=mg.uid " . "WHERE gl.status = 3 AND gl.uid > 2 AND (mg.member_gallery IS NULL OR mg.member_gallery < 1) " . "ORDER BY gl.username ASC LIMIT {$start},{$end}";
$result = DB_query($sql);
while ($row = DB_fetchArray($result)) {
if ($glversion[1] < 4) {
$row['status'] = 3;
}
$uid = $row['uid'];
$remote = SEC_inGroup("Remote Users", $uid) ? '(r)' : '';
$username = $row['username'];
$member_gallery = $row['member_gallery'];
$T->set_var(array('uid' => $uid, 'username' => $username . ' ' . $remote . ' - ' . $row['fullname'], 'select' => '<input type="checkbox" name="user[]" value="' . $uid . '"' . XHTML . '>'));
$T->parse('uRow', 'UserRow', true);
}
$T->set_var(array('lang_userid' => $LANG_MG01['userid'], 'lang_username' => $LANG_MG01['username'], 'lang_select' => $LANG_MG01['select'], 'lang_checkall' => $LANG_MG01['check_all'], 'lang_uncheckall' => $LANG_MG01['uncheck_all'], 'lang_save' => $LANG_MG01['save'], 'lang_cancel' => $LANG_MG01['cancel'], 'lang_reset' => $LANG_MG01['reset'], 's_form_action' => $_MG_CONF['admin_url'] . 'createmembers.php', 'pagenav' => COM_printPageNavigation($_MG_CONF['admin_url'] . 'createmembers.php', $page + 1, ceil($total_records / 50))));
$retval .= $T->finish($T->parse('output', 'admin'));
return $retval;
}
示例9: draw
function draw()
{
global $_TABLES, $_CONF, $LANG_ECOM;
$T = new Template($_CONF['path'] . 'plugins/ecommerce/templates/admin');
$T->set_file(array('sales_tax' => 'sales_tax.thtml', 'sales_tax_row' => 'sales_tax_row.thtml'));
$T->set_var('msg_112', $LANG_ECOM[112]);
$T->set_var('msg_113', $LANG_ECOM[113]);
//Get left colunm
$res = DB_query("SELECT ecom_tax_code, ecom_tax_id FROM {$_TABLES['ecom_tax']} WHERE ecom_tax_enabled = false");
while ($row = DB_fetchArray($res)) {
$T->set_var('tax_code', $row['ecom_tax_code']);
$T->set_var('link', 'index.php?op=tax&add=');
$T->set_var('tax_id', $row['ecom_tax_id']);
$T->set_var('display', 'add');
$T->parse('disabled_tax', 'sales_tax_row', true);
}
//Get right colunm
$T->set_var('msg_114', $LANG_ECOM[114]);
$res = DB_query("SELECT ecom_tax_code, ecom_tax_id FROM {$_TABLES['ecom_tax']} WHERE ecom_tax_enabled = true");
while ($row = DB_fetchArray($res)) {
$T->set_var('tax_code', $row['ecom_tax_code']);
$T->set_var('link', 'index.php?op=tax&remove=');
$T->set_var('tax_id', $row['ecom_tax_id']);
$T->set_var('display', 'remove');
$T->parse('enabled_tax', 'sales_tax_row', true);
}
$T->parse('output', 'sales_tax');
echo $T->finish($T->get_var('output'));
}
示例10: nexform_importForm
function nexform_importForm($_SQL, $cntr)
{
global $CONF_FE, $_TABLES;
DB_query($_SQL[0], '1');
if (DB_error()) {
COM_errorLog("nexform SQL error importing form: {$_SQL[0]}");
}
$newformid = DB_insertID();
/* Delete any previous imported form field definition records
New field definition records will have a formid of '99999' assigned
Insert the new records and then update to match the new form definition
*/
DB_query("DELETE FROM {$_TABLES['nxform_fields']} WHERE formid='{$cntr}'");
next($_SQL);
// Increment to the field definition records
for ($i = 1; $i < count($_SQL); $i++) {
DB_query(current($_SQL), '1');
if (DB_error()) {
COM_errorLog("executing " . current($_SQL));
COM_errorLog("Error executing SQL", 1);
exit;
}
next($_SQL);
}
DB_query("UPDATE {$_TABLES['nxform_fields']} set formid='{$newformid}' WHERE formid='{$cntr}'");
// Need to cycle thru the fields now and update any fieldnames if auto fieldname used
$query = DB_query("SELECT id,type FROM {$_TABLES['nxform_fields']} WHERE formid='{$newformid}' AND field_name LIKE '%_frm%'");
while (list($fieldid, $fieldtype) = DB_fetchArray($query)) {
$fieldname = "{$CONF_FE['fieldtypes'][$fieldtype][0]}{$newformid}_{$fieldid}";
DB_query("UPDATE {$_TABLES['nxform_fields']} set field_name='{$fieldname}' WHERE id='{$fieldid}'");
}
}
示例11: plugin_autouninstall_nexproject
/**
* Automatic uninstall function for plugins
*
* @return array
*
* This code is automatically uninstalling the plugin.
* It passes an array to the core code function that removes
* tables, groups, features and php blocks from the tables.
* Additionally, this code can perform special actions that cannot be
* foreseen by the core code (interactions with other plugins for example)
*
*/
function plugin_autouninstall_nexproject()
{
global $_PRJCONF, $_TABLES;
$out = array('tables' => array('prj_category', 'prj_department', 'prj_location', 'prj_objective', 'prj_permissions', 'prj_users', 'prj_projects', 'prj_sorting', 'prj_task_users', 'prj_tasks', 'prj_statuslog', 'prj_session', 'prj_filters', 'prj_lockcontrol', 'prj_projPerms', 'prj_taskSemaphore', 'prj_config'), 'groups' => array('nexProject Admin'), 'features' => array('nexproject.admin'), 'php_blocks' => array('phpblock_projectFilter'), 'vars' => array());
if (prj_forumExists()) {
//using this row's config value, we'll delete all forums with this ID as the parent and then chuck out the category itself...
$sql = "SELECT * FROM {$_TABLES['gf_forums']} where forum_cat={$_PRJCONF['forum_parent']}";
$forumres = DB_query($sql);
while ($X = DB_fetchArray($forumres)) {
forum_deleteForum($X['forum_id']);
}
DB_query("DELETE FROM {$_TABLES['gf_categories']} where id={$_PRJCONF['forum_parent']}");
}
if (prj_nexFileExists()) {
PLG_itemDeleted($_PRJCONF['nexfile_parent'], 'nexproject_filefolder');
}
DB_query("DELETE FROM {$_TABLES['nexlistitems']} WHERE lid={$_PRJCONF['nexlist_locations']}");
DB_query("DELETE FROM {$_TABLES['nexlistfields']} WHERE lid={$_PRJCONF['nexlist_locations']}");
DB_query("DELETE FROM {$_TABLES['nexlist']} WHERE id={$_PRJCONF['nexlist_locations']}");
DB_query("DELETE FROM {$_TABLES['nexlistitems']} WHERE lid={$_PRJCONF['nexlist_departments']}");
DB_query("DELETE FROM {$_TABLES['nexlistfields']} WHERE lid={$_PRJCONF['nexlist_departments']}");
DB_query("DELETE FROM {$_TABLES['nexlist']} WHERE id={$_PRJCONF['nexlist_departments']}");
DB_query("DELETE FROM {$_TABLES['nexlistitems']} WHERE lid={$_PRJCONF['nexlist_category']}");
DB_query("DELETE FROM {$_TABLES['nexlistfields']} WHERE lid={$_PRJCONF['nexlist_category']}");
DB_query("DELETE FROM {$_TABLES['nexlist']} WHERE id={$_PRJCONF['nexlist_category']}");
DB_query("DELETE FROM {$_TABLES['nexlistitems']} WHERE lid={$_PRJCONF['nexlist_objective']}");
DB_query("DELETE FROM {$_TABLES['nexlistfields']} WHERE lid={$_PRJCONF['nexlist_objective']}");
DB_query("DELETE FROM {$_TABLES['nexlist']} WHERE id={$_PRJCONF['nexlist_objective']}");
return $out;
}
示例12: polls_upgrade
function polls_upgrade()
{
global $_TABLES, $_CONF, $_PO_CONF;
$currentVersion = DB_getItem($_TABLES['plugins'], 'pi_version', "pi_name='polls'");
switch ($currentVersion) {
case '2.0.0':
case '2.0.1':
case '2.0.2':
case '2.0.3':
case '2.0.4':
case '2.0.5':
case '2.0.6':
case '2.0.7':
case '2.0.8':
case '2.0.9':
case '2.1.0':
$c = config::get_instance();
$c->add('displayblocks', 0, 'select', 0, 0, 13, 85, true, 'polls');
case '2.1.1':
DB_query("ALTER TABLE {$_TABLES['pollanswers']} CHANGE `pid` `pid` VARCHAR(128) NOT NULL DEFAULT '';", 1);
DB_query("ALTER TABLE {$_TABLES['pollquestions']} CHANGE `pid` `pid` VARCHAR(128) NOT NULL;", 1);
DB_query("ALTER TABLE {$_TABLES['polltopics']} CHANGE `pid` `pid` VARCHAR(128) NOT NULL;", 1);
DB_query("ALTER TABLE {$_TABLES['pollvoters']} CHANGE `pid` `pid` VARCHAR(128) NOT NULL DEFAULT '';", 1);
default:
DB_query("UPDATE {$_TABLES['plugins']} SET pi_version='" . $_PO_CONF['pi_version'] . "',pi_gl_version='" . $_PO_CONF['gl_version'] . "' WHERE pi_name='polls' LIMIT 1");
break;
}
if (DB_getItem($_TABLES['plugins'], 'pi_version', "pi_name='polls'") == $_PO_CONF['pi_version']) {
return true;
} else {
return false;
}
}
示例13: upgrade_plugins_141
function upgrade_plugins_141()
{
global $_TABLES;
if (DB_count($_TABLES['plugins'], 'pi_name', 'links') == 1) {
DB_query("UPDATE {$_TABLES['plugins']} SET pi_version = '1.0.1', pi_gl_version = '1.4.1' WHERE pi_name = 'links'");
}
// add remarks-field to polls
if (DB_count($_TABLES['plugins'], 'pi_name', 'polls') == 1) {
DB_query("ALTER TABLE {$_TABLES['pollanswers']} ADD remark varchar(255) NULL AFTER votes");
DB_query("UPDATE {$_TABLES['plugins']} SET pi_version = '1.1.0', pi_gl_version = '1.4.1' WHERE pi_name = 'polls'");
}
if (DB_count($_TABLES['plugins'], 'pi_name', 'spamx') == 1) {
// delete MT-Blacklist entries from Spam-X plugin
DB_query("DELETE FROM {$_TABLES['spamx']} WHERE name = 'MTBlacklist'");
// the count of deleted spams was introduced in 1.4.0 but not added
// when upgrading from an older database, so add it now if it's missing
$val = DB_getItem($_TABLES['vars'], 'value', "name = 'spamx.counter'");
if (empty($val)) {
DB_save($_TABLES['vars'], 'name,value', "'spamx.counter','0'");
}
DB_query("UPDATE {$_TABLES['plugins']} SET pi_version = '1.1.0', pi_gl_version = '1.4.1' WHERE pi_name = 'spamx'");
}
// add field to support advanced editor and a help link in staticpages
if (DB_count($_TABLES['plugins'], 'pi_name', 'staticpages') == 1) {
DB_query("ALTER TABLE {$_TABLES['staticpage']} ADD postmode varchar(16) DEFAULT 'html' NOT NULL AFTER sp_inblock");
DB_query("ALTER TABLE {$_TABLES['staticpage']} ADD sp_help varchar(255) default '' AFTER sp_centerblock");
DB_query("UPDATE {$_TABLES['plugins']} SET pi_version = '1.4.3', pi_gl_version = '1.4.1' WHERE pi_name = 'staticpages'");
}
}
示例14: execute
/**
* Here we do the work
*/
public function execute($comment)
{
global $_CONF, $_TABLES, $_USER, $LANG_SX00;
if (isset($_USER['uid']) && $_USER['uid'] > 1) {
$uid = $_USER['uid'];
} else {
$uid = 1;
}
/**
* Include Blacklist Data
*/
$result = DB_query("SELECT value FROM {$_TABLES['spamx']} WHERE name='Personal'", 1);
$nrows = DB_numRows($result);
// named entities
$comment = html_entity_decode($comment);
// decimal notation
$comment = preg_replace_callback('/&#(\\d+);/m', array($this, 'callbackDecimal'), $comment);
// hex notation
$comment = preg_replace_callback('/&#x([a-f0-9]+);/mi', array($this, 'callbackHex'), $comment);
$ans = 0;
for ($i = 1; $i <= $nrows; $i++) {
list($val) = DB_fetchArray($result);
$val = str_replace('#', '\\#', $val);
if (preg_match("#{$val}#i", $comment)) {
$ans = 1;
// quit on first positive match
SPAMX_log($LANG_SX00['foundspam'] . $val . $LANG_SX00['foundspam2'] . $uid . $LANG_SX00['foundspam3'] . $_SERVER['REMOTE_ADDR']);
break;
}
}
return $ans;
}
示例15: execute
/**
* Here we do the work
*/
public function execute($comment)
{
global $_CONF, $_TABLES, $LANG_SX00;
$uid = $this->getUid();
/**
* Check for IP of url in blacklist
*/
/*
* regex to find urls $2 = fqd
*/
$regx = '(ftp|http|file)://([^/\\s]+)';
$num = preg_match_all("#{$regx}#", html_entity_decode($comment), $urls);
$result = DB_query("SELECT value FROM {$_TABLES['spamx']} WHERE name='IPofUrl'", 1);
$nrows = DB_numRows($result);
$ans = PLG_SPAM_NOT_FOUND;
for ($j = 1; $j <= $nrows; $j++) {
list($val) = DB_fetchArray($result);
for ($i = 0; $i < $num; $i++) {
$ip = gethostbyname($urls[2][$i]);
if ($val == $ip) {
$ans = PLG_SPAM_FOUND;
// quit on first positive match
$this->updateStat('IPofUrl', $val);
SPAMX_log($LANG_SX00['foundspam'] . $urls[2][$i] . $LANG_SX00['foundspam2'] . $uid . $LANG_SX00['foundspam3'] . $_SERVER['REMOTE_ADDR']);
break;
}
}
if ($ans == PLG_SPAM_FOUND) {
break;
}
}
return $ans;
}