本文整理匯總了PHP中DB_fetchArray函數的典型用法代碼示例。如果您正苦於以下問題:PHP DB_fetchArray函數的具體用法?PHP DB_fetchArray怎麽用?PHP DB_fetchArray使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了DB_fetchArray函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: execute
/**
* Here we do the work
*/
function execute($comment)
{
global $_CONF, $_USER, $_TABLES, $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 = 'MTBlacklist'", 1);
$nrows = DB_numRows($result);
// named entities
$comment = html_entity_decode($comment);
// decimal notation
$comment = preg_replace('/&#(\\d+);/me', "chr(\\1)", $comment);
// hex notation
$comment = preg_replace('/&#x([a-f0-9]+);/mei', "chr(0x\\1)", $comment);
$ans = 0;
// Found Flag
for ($i = 1; $i <= $nrows; $i++) {
list($val) = DB_fetchArray($result);
if (@preg_match("#{$val}#i", $comment)) {
$ans = 1;
// quit on first positive match
SPAMX_log($LANG_SX00['fsc'] . $val . $LANG_SX00['fsc1'] . $uid . $LANG_SX00['fsc2'] . $_SERVER['REMOTE_ADDR']);
break;
}
}
return $ans;
}
示例2: 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;
}
示例3: 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}'");
}
}
示例4: fixTopic
/**
* Update array if need be with correct topic.
*
* @param array $A Array of articles from db
* @param string $tid_list List of child topics of current topic
*/
function fixTopic(&$A, $tid_list)
{
global $_TABLES, $topic;
if (!empty($topic)) {
// This case may happen if a article belongs to the current topic but the default topic for the article is a child of the current topic.
$sql = "SELECT t.topic, t.imageurl\n FROM {$_TABLES['topics']} t, {$_TABLES['topic_assignments']} ta\n WHERE t.tid = ta.tid\n AND ta.type = 'article' AND ta.id = '{$A['sid']}' AND ta.tid = '{$topic}'\n " . COM_getLangSQL('tid', 'AND', 't') . COM_getPermSQL('AND', 0, 2, 't');
$result = DB_query($sql);
$nrows = DB_numRows($result);
if ($nrows > 0) {
$B = DB_fetchArray($result);
$A['topic'] = $B['topic'];
$A['imageurl'] = $B['imageurl'];
} else {
// Does not belong to current topic so check inherited
// Make sure sort order the same as in TOPIC_getTopic or articles with multiple topics might not display in the right topic when clicked
$sql = "SELECT t.topic, t.imageurl\n FROM {$_TABLES['topics']} t, {$_TABLES['topic_assignments']} ta\n WHERE t.tid = ta.tid\n AND ta.type = 'article' AND ta.id = '{$A['sid']}'\n AND (ta.tid IN({$tid_list}) AND (ta.inherit = 1 OR (ta.inherit = 0 AND ta.tid = '{$topic}')))\n " . COM_getLangSQL('tid', 'AND', 't') . COM_getPermSQL('AND', 0, 2, 't') . "\n ORDER BY ta.tdefault DESC, ta.tid ASC";
$result = DB_query($sql);
$nrows = DB_numRows($result);
if ($nrows > 0) {
$B = DB_fetchArray($result);
$A['topic'] = $B['topic'];
$A['imageurl'] = $B['imageurl'];
}
}
}
}
示例5: 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;
}
示例6: 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);
}
}
}
}
示例7: unlockTimesheet
function unlockTimesheet($startDateStamp, $endDateStamp, $uid)
{
$lockedRanges = array();
$errorMargin = 4 * 3600;
// allow for 8 hour deviation (4 both ways), should be ok since all times should be around nidnight anyways
$sql = "SELECT `startdate`, `enddate` FROM {$this->fulltablename} WHERE `uid`={$uid}";
$result = DB_query($sql);
while ($data = DB_fetchArray($result)) {
if ($startDateStamp >= $data['startdate'] - $errorMargin && $startDateStamp <= $data['startdate'] + $errorMargin && ($endDateStamp >= $data['enddate'] - $errorMargin && $endDateStamp <= $data['enddate'] + $errorMargin)) {
$lockedRanges[] = array('startdate' => $data['startdate'], 'enddate' => $data['enddate']);
}
}
// this should probably only ever have one entry, but just in case there are issues with setting the timestamps and they're slightly off, we'll loop
if ($lockedRanges) {
$sql = "DELETE FROM {$this->fulltablename} WHERE `uid`={$uid} AND (";
foreach ($lockedRanges as $range) {
$sql .= "(`startdate`={$range['startdate']} AND `enddate`={$range['enddate']}) OR ";
}
$sql = substr($sql, 0, -4) . ")";
}
//$sql="DELETE FROM {$this->fulltablename} WHERE uid={$uid} AND startdate={$startDateStamp} AND enddate={$endDateStamp}";
DB_query($sql);
if (DB_error()) {
return false;
} else {
return true;
}
}
示例8: draw_user_information
function draw_user_information($error)
{
global $_USER, $_CONF, $LANG_ECOM;
$res = get_user_row($_USER['uid']);
#If it's users first time to enter there information will have to add them to database.
if (DB_numRows($res) <= 0) {
add_user_row($_USER['uid']);
#Create the row to hold ecom_userinfo
$res = get_user_row($_USER['uid']);
}
$user_info = DB_fetchArray($res);
#load template for editing user
$T = new Template($_CONF['path'] . 'plugins/ecommerce/templates');
$T->set_file('text', 'user_info.thtml');
$T->set_var('site_url', $PHP_SELF);
$T->set_var('error', $error);
$T->set_var('full_name', $user_info['fullname']);
$T->set_var('email', $user_info['email']);
$T->set_var('phone_number', $user_info['ecom_phone_number']);
$T->set_var('dob_month', $user_info['ecom_dob_month']);
$T->set_var('dob_day', $user_info['ecom_dob_day']);
$T->set_var('dob_year', $user_info['ecom_dob_year']);
$T->set_var('driver_license_number', $user_info['ecom_drivers_license_number']);
$T->set_var('driver_license_state', $user_info['ecom_drivers_license_state']);
$T->set_var('msg_1', $LANG_ECOM[1]);
$T->set_var('msg_12', $LANG_ECOM[12]);
$T->set_var('msg_146', $LANG_ECOM[146]);
$T->set_var('msg_147', $LANG_ECOM[147]);
$T->set_var('msg_148', $LANG_ECOM[148]);
$T->set_var('msg_149', $LANG_ECOM[149]);
$T->set_var('msg_150', $LANG_ECOM[150]);
echo $T->parse('output', 'text');
}
示例9: view
function view()
{
global $_CONF, $_TABLES;
$retval = '';
$sql = "SELECT L.tag_id, L.tag, COUNT(m.tag_id) AS cnt, L.hits " . "FROM {$_TABLES['tag_list']} AS L " . "LEFT JOIN {$_TABLES['tag_map']} AS m " . "ON L.tag_id = m.tag_id " . "GROUP BY m.tag_id " . "ORDER BY cnt DESC, tag";
$result = DB_query($sql);
if (DB_error()) {
return $retval . '<p>' . TAG_str('db_error') . '</p>';
} else {
if (DB_numRows($result) == 0) {
return $retval . '<p>' . TAG_str('no_tag') . '</p>';
}
}
$T = new Template($_CONF['path'] . 'plugins/tag/templates');
$T->set_file('stats', 'admin_stats.thtml');
$T->set_var('xhtml', XHTML);
$T->set_var('this_script', COM_buildURL($_CONF['site_admin_url'] . '/plugins/tag/index.php'));
$T->set_var('lang_desc_admin_stats', TAG_str('desc_admin_stats'));
$T->set_var('lang_lbl_tag', TAG_str('lbl_tag'));
$T->set_var('lang_lbl_count', TAG_str('lbl_count'));
$T->set_var('lang_lbl_hit_count', TAG_str('lbl_hit_count'));
$T->set_var('lang_delete_checked', TAG_str('delete_checked'));
$T->set_var('lang_ban_checked', TAG_str('ban_checked'));
$sw = 1;
$body = '';
while (($A = DB_fetchArray($result)) !== false) {
$tag_id = $A['tag_id'];
$body .= '<tr class="pluginRow' . $sw . '">' . '<td><input id="tag' . TAG_escape($tag_id) . '" name="tag_ids[]" ' . 'type="checkbox" value="' . TAG_escape($A['tag_id']) . '"' . XHTML . '><label for="tag' . TAG_escape($tag_id) . '">' . TAG_escape($A['tag']) . '</label></td>' . '<td style="text-align: right;">' . TAG_escape($A['cnt']) . '</td><td style="text-align: right;">' . TAG_escape($A['hits']) . '</td></tr>' . LB;
$sw = $sw == 1 ? 2 : 1;
}
$T->set_var('body', $body);
$T->parse('output', 'stats');
$retval = $T->finish($T->get_var('output'));
return $retval;
}
示例10: MG_editUser
function MG_editUser($uid)
{
global $_CONF, $_MG_CONF, $_TABLES, $_USER, $LANG_MG00, $LANG_MG01;
$retval = '';
$active = 0;
$quota = 0;
$username = DB_getItem($_TABLES['users'], 'username', "uid=" . $uid);
$result = DB_query("SELECT active,quota FROM {$_TABLES['mg_userprefs']} WHERE uid=" . $uid);
$nRows = DB_numRows($result);
if ($nRows > 0) {
$row = DB_fetchArray($result);
$active = $row['active'];
$quota = $row['quota'] / 1048576;
} else {
$active = 1;
$quota = $_MG_CONF['member_quota'] / 1048576;
}
$T = new Template($_MG_CONF['template_path'] . '/admin');
$T->set_file('admin', 'useredit.thtml');
$T->set_var('site_url', $_CONF['site_url']);
$T->set_var('site_admin_url', $_CONF['site_admin_url']);
$active_select = '<input type="checkbox" name="active" value="1" ' . ($active ? ' CHECKED' : '') . '/>';
$T->set_var(array('s_form_action' => $_MG_CONF['admin_url'] . 'edituser.php', 'lang_user_edit' => $LANG_MG01['edit_user'], 'lang_username' => $LANG_MG01['username'], 'lang_active' => $LANG_MG01['active'], 'lang_quota' => $LANG_MG01['quota'], 'lang_save' => $LANG_MG01['save'], 'lang_cancel' => $LANG_MG01['cancel'], 'lang_reset' => $LANG_MG01['reset'], 'lang_unlimited' => $LANG_MG01['zero_unlimited'], 'uid' => $uid, 'active' => $active_select, 'quota' => $quota, 'username' => $username));
$T->parse('output', 'admin');
$retval .= $T->finish($T->get_var('output'));
return $retval;
}
示例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: adduserevent
/**
* Adds an event to the user's calendar
*
* The user has asked that an event be added to their personal
* calendar. Show a confirmation screen.
*
* @param string $eid event ID to add to user's calendar
* @return string HTML for confirmation form
*
*/
function adduserevent($eid)
{
global $_CONF, $_TABLES, $LANG_CALJP_1;
$retval = '';
$eventsql = "SELECT * FROM {$_TABLES['eventsjp']} WHERE eid='{$eid}'" . COM_getPermSql('AND');
$result = DB_query($eventsql);
$nrows = DB_numRows($result);
if ($nrows == 1) {
$retval .= COM_startBlock(sprintf($LANG_CALJP_1[11], COM_getDisplayName()));
$A = DB_fetchArray($result);
$cal_template = COM_newTemplate($_CONF['path'] . 'plugins/calendarjp/templates/');
$cal_template->set_file(array('addevent' => 'addevent.thtml'));
$cal_template->set_var('intro_msg', $LANG_CALJP_1[8]);
$cal_template->set_var('lang_event', $LANG_CALJP_1[12]);
$event_title = stripslashes($A['title']);
if (!empty($A['url']) && $A['url'] != 'http://') {
$event_title_and_url = COM_createLink($event_title, $A['url'], array('class' => 'url'));
$cal_template->set_var('event_url', $A['url']);
$cal_template->set_var('event_begin_anchortag', '<a href="' . $A['url'] . '" class="url">');
$cal_template->set_var('event_end_anchortag', '</a>');
} else {
$event_title_and_url = $event_title;
$cal_template->set_var('event_url', '');
$cal_template->set_var('event_begin_anchortag', '');
$cal_template->set_var('event_end_anchortag', '');
}
$cal_template->set_var('event_title', $event_title_and_url);
$cal_template->set_var('event_title_only', $event_title);
$cal_template->set_var('lang_starts', $LANG_CALJP_1[13]);
$cal_template->set_var('lang_ends', $LANG_CALJP_1[14]);
$thestart = COM_getUserDateTimeFormat($A['datestart'] . ' ' . $A['timestart']);
$theend = COM_getUserDateTimeFormat($A['dateend'] . ' ' . $A['timeend']);
if ($A['allday'] == 0) {
$cal_template->set_var('event_start', $thestart[0]);
$cal_template->set_var('event_end', $theend[0]);
} else {
$cal_template->set_var('event_start', strftime($_CONF['shortdate'], $thestart[1]));
$cal_template->set_var('event_end', strftime($_CONF['shortdate'], $theend[1]));
}
$cal_template->set_var('lang_where', $LANG_CALJP_1[4]);
$location = stripslashes($A['location']) . '<br' . XHTML . '>' . stripslashes($A['address1']) . '<br' . XHTML . '>' . stripslashes($A['address2']) . '<br' . XHTML . '>' . stripslashes($A['city']) . ', ' . stripslashes($A['state']) . ' ' . $A['zipcode'];
$cal_template->set_var('event_location', $location);
$cal_template->set_var('lang_description', $LANG_CALJP_1[5]);
$description = stripslashes($A['description']);
if (empty($A['postmode']) || $A['postmode'] == 'plaintext') {
$description = COM_nl2br($description);
}
$cal_template->set_var('event_description', PLG_replaceTags($description));
$cal_template->set_var('event_id', $eid);
$cal_template->set_var('lang_addtomycalendar', $LANG_CALJP_1[9]);
$cal_template->set_var('gltoken_name', CSRF_TOKEN);
$cal_template->set_var('gltoken', SEC_createToken());
$cal_template->parse('output', 'addevent');
$retval .= $cal_template->finish($cal_template->get_var('output'));
$retval .= COM_endBlock();
} else {
$retval .= COM_showMessage(23);
}
return $retval;
}
示例13: MG_adminEXIF
function MG_adminEXIF()
{
global $_TABLES, $_MG_CONF, $_CONF, $LANG_MG01, $LANG_MG04;
$retval = '';
$T = new Template($_MG_CONF['template_path'] . '/admin/');
$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_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'));
$T->parse('output', 'admin');
$retval .= $T->finish($T->get_var('output'));
return $retval;
}
示例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: _mg_deletecomment
/**
* Plugin function to delete a comment
* $cid Comment to be deleted
* $id Item id to which $cid belongs
*
*/
function _mg_deletecomment($cid, $id)
{
global $_CONF, $_MG_CONF, $_TABLES, $MG_albums;
// find the album that holds this peice of media
$sql = "SELECT album_id FROM {$_TABLES['mg_media_albums']} WHERE media_id='" . DB_escapeString($id) . "'";
$result = DB_query($sql);
$nRows = DB_numRows($result);
if ($nRows > 0) {
$row = DB_fetchArray($result);
$aid = $row['album_id'];
if ($MG_albums[0]->owner_id) {
$access = 3;
} else {
$access = $MG_albums[$aid]->access;
}
} else {
$access = 0;
}
if ($access == 3 || SEC_hasRights('mediagallery.admin')) {
if (CMT_deleteComment($cid, $id, 'mediagallery') == 0) {
//reduce count in media table
$comments = DB_count($_TABLES['comments'], array('sid', 'type'), array(DB_escapeString($id), 'mediagallery'));
DB_change($_TABLES['mg_media'], 'media_comments', $comments, 'media_id', DB_escapeString($id));
// Now redirect the program flow to the view of the file and its comments
return COM_refresh($_MG_CONF['site_url'] . "/media.php?s={$id}");
} else {
return false;
}
} else {
return false;
}
}