function upgrade($prev_version) { global $installer; if ($prev_version < 1.2) { $installer->add_query('DROP', 'reviews_main'); $installer->add_query('INSERT', 'config_custom', "'Reviews', 'title', ''"); $installer->add_query('INSERT', 'config_custom', "'Reviews', 'description', ''"); } if (version_compare($prev_version, '2.1.0', '<')) { $installer->add_query('INSERT', 'config_custom', "'Reviews', 'anon_comments', '0'"); } if (version_compare($prev_version, '2.1.1', '<')) { $installer->add_query('INSERT', 'config_custom', "'Reviews', 'allow_bbcode', '1'"); Cache::array_delete('MAIN_CFG'); } return true; }
public function uninstall() { global $installer; foreach ($this->dbtables as $table) { $installer->add_query('DROP', $table); } $installer->add_query('DELETE', 'config_custom', "cfg_name='" . $this->prefix . "'"); Cache::array_delete('categories', basename(dirname(__FILE__))); return true; }
// $sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . ' SET max_filesize = ' . $new_size . ' WHERE max_filesize = ' . $old_size; $db->sql_query($sql); } $sql = "UPDATE " . ATTACH_CONFIG_TABLE . " SET config_value = '" . Fix_Quotes($new_attach[$config_name]) . "'\n\t\t\tWHERE config_name = '{$config_name}'"; } else { $sql = "UPDATE " . ATTACH_CONFIG_TABLE . " SET config_value = '" . Fix_Quotes($new_attach[$config_name]) . "'\n\t\t\tWHERE config_name = '{$config_name}'"; } $db->sql_query($sql); if ($config_name == 'max_filesize' || $config_name == 'attachment_quota' || $config_name == 'max_filesize_pm') { $new_attach[$config_name] = $old; } } } Cache::array_delete('attach_config', 'Forums'); $select_size_mode = size_select('size', $size); $select_quota_size_mode = size_select('quota_size', $quota_size); $select_pm_size_mode = size_select('pm_size', $pm_size); // // Search Imagick // if ($search_imagick) { $imagick = ''; if (false !== stripos($imagick, 'convert')) { return TRUE; } else { if ($imagick != 'none') { if (!WINDOWS) { $retval = exec('whereis convert'); $paths = explode(' ', $retval);
} $log = nl2br(CVS::formatlog($log)); cpg_error($log, _TB_INFO); } cpg_error($log['error']); } } elseif (isset($_POST['save_cfg'])) { foreach ($MAIN_CFG['global'] as $key => $val) { if (isset($_POST[$key]) && in_array($key, array('multilingual', 'useflags'))) { $value = $_POST[$key]; if ($value != $val) { $db->sql_query('UPDATE ' . $prefix . "_config_custom SET cfg_value='" . Fix_Quotes($value) . "' WHERE cfg_name='global' AND cfg_field='{$key}'"); } } } Cache::array_delete('MAIN_CFG'); URL::redirect(URL::admin('&cfg')); } else { $pagetitle .= ' ' . _BC_DELIM . ' Languages' . (isset($_GET['cfg']) ? ' ' . _BC_DELIM . ' ' . _TB_CONFIG : ''); require_once 'header.php'; GraphicAdmin('_AMENU1'); OpenTable(); if (isset($_GET['cfg'])) { echo '<span class="genmed"><strong>Dragonfly Language Pack Management</strong></span><br /> <a href="' . URL::admin() . '">Language Packs</a> | <strong>' . _TB_CONFIG . '</strong> | <a href="' . URL::admin('&upd=all') . '">' . sprintf(_UPGRADE, _ALL . ' ' . _LanguagesLANG) . '</a> <br /><br /> <form action="' . URL::admin() . '" method="post" enctype="multipart/form-data" accept-charset="utf-8"> <table border="0" width="40%" cellpadding="3" cellspacing="1" class="forumline"> <tr> <td class="row1"><span class="genmed">' . _ACTMULTILINGUAL . '</span></td> <td class="row2">' . yesno_option('multilingual', $MAIN_CFG['global']['multilingual']) . '</td> </tr><tr>
$smile_code = trim($_POST['smile_code']); $smile_url = trim($_POST['smile_url']); $smile_emotion = trim($_POST['smile_emotion']); // If no code was entered complain ... if ($smile_code == '') { cpg_error(sprintf(_ERROR_NOT_SET, 'Smiley code')); } elseif ($smile_url == '') { cpg_error(sprintf(_ERROR_NOT_SET, 'Smiley url')); } // Convert < and > to proper htmlentities for parsing. $smile_code = str_replace('<', '<', $smile_code); $smile_code = str_replace('>', '>', $smile_code); // Save the data to the smiley table. $sql = "INSERT INTO " . SMILIES_TABLE . " (code, smile_url, emoticon)\n\t\t\t\t\tVALUES ('" . Fix_Quotes($smile_code) . "', '" . Fix_Quotes($smile_url) . "', '" . Fix_Quotes($smile_emotion) . "')"; $db->sql_query($sql); Cache::array_delete('smilies', 'bb'); cpg_error('The new smiley was successfully added', 'Smiles Utility', URL::admin('smilies')); break; } } else { // This is the main display of the page before the admin has selected any options. showheader(); require_once CORE_PATH . 'nbbcode.php'; $smilies = get_smilies(); echo 'From this page you can add, remove and edit the smilies that your users can use in various places across your site<br /> Smilies are stored in the "' . $smilies_path . '" directory<br /><br /> <form method="post" action="' . URL::admin($op) . '" enctype="multipart/form-data" accept-charset="utf-8"> <table class="forumline" cellspacing="1" cellpadding="4" border="0"> <tr> <th class="thCornerL">Code</th> <th class="thTop">Smile</th>
$sql = "UPDATE " . CONFIG_TABLE . " SET\n\t\t\t\tconfig_value = '" . Fix_Quotes($new[$config_name]) . "'\n\t\t\t\tWHERE config_name = '{$config_name}'"; $db->sql_query($sql); Cache::array_delete('board_config', 'Forums'); } } Cache::array_save('board_config', 'Forums'); } elseif (isset($_POST['submit'])) { foreach ($board_config as $config_name => $config_value) { $new[$config_name] = isset($_POST[$config_name]) ? $_POST[$config_name] : $board_config[$config_name]; if ($config_name == 'smilies_path') { $new['smilies_path'] = 'images/smiles'; } $sql = "UPDATE " . CONFIG_TABLE . " SET\n\t\t\tconfig_value = '" . Fix_Quotes($new[$config_name]) . "'\n\t\t\tWHERE config_name = '{$config_name}'"; $db->sql_query($sql); } Cache::array_delete('board_config', 'Forums'); } if (isset($_POST['submit'])) { $message = $lang['Config_updated'] . "<br /><br />" . sprintf($lang['Click_return_config'], "<a href=\"" . URL::admin("&do=board") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . URL::admin($op) . "\">", "</a>"); message_die(GENERAL_MESSAGE, $message); return; } $html_tags = $board_config['allow_html_tags']; $override_user_style_yes = $board_config['override_user_style'] ? "checked=\"checked\"" : ""; $override_user_style_no = !$board_config['override_user_style'] ? "checked=\"checked\"" : ""; $html_yes = $board_config['allow_html'] ? "checked=\"checked\"" : ""; $html_no = !$board_config['allow_html'] ? "checked=\"checked\"" : ""; $bbcode_yes = $board_config['allow_bbcode'] ? "checked=\"checked\"" : ""; $bbcode_no = !$board_config['allow_bbcode'] ? "checked=\"checked\"" : ""; $board_email_form_yes = $board_config['board_email_form'] ? "checked=\"checked\"" : ""; $board_email_form_no = !$board_config['board_email_form'] ? "checked=\"checked\"" : "";
function BlocksEditSave($bid) { global $prefix, $db; if (!Security::check_post()) { cpg_error(_SEC_ERROR); } $update['title'] = $_POST['title']; $update['content'] = $_POST['content']; $update['url'] = empty($_POST['url']) ? '' : $_POST['url']; $oldposition = $_POST['oldposition']; $update['bposition'] = $_POST['bposition']; $update['active'] = $_POST['active']; $update['refresh'] = isset($_POST['refresh']) ? intval($_POST['refresh']) : 0; $update['blanguage'] = $_POST['blanguage']; $update['blockfile'] = empty($_POST['blockfile']) ? '' : $_POST['blockfile']; $update['view'] = intval($_POST['view']); $update['weight'] = intval($_POST['weight']); $update['in_module'] = ''; if ($update['url'] != '') { $update['time'] = time(); if (0 !== stripos($update['url'], 'http://')) { $update['url'] = 'http://' . $update['url']; } require_once CORE_PATH . 'classes/rss.php'; if (!($update['content'] = CPG_RSS::format(CPG_RSS::read($update['url'])))) { rssfail(); return; } } # can be removed if ($oldposition != $update['bposition']) { $db->sql_query('UPDATE ' . $prefix . '_blocks SET weight=weight+1 WHERE weight>=' . $update['weight'] . " AND bposition='{$update['bposition']}'"); $db->sql_query('UPDATE ' . $prefix . '_blocks SET weight=weight-1 WHERE weight>' . $update['weight'] . " AND bposition='{$oldposition}'"); } $db->sql_update($prefix . '_blocks', $update, 'bid=' . $bid); $count = empty($_POST['in_module']) ? 0 : count($_POST['in_module']); for ($i = 0; $i < $count; $i++) { if (!intval($_POST['in_module'][$i])) { continue; } else { $new_in_modules[intval($_POST['in_module'][$i])] = intval($_POST['in_module'][$i]); } } $table_data = array(); # select all data $result = $db->sql_query('SELECT a.mid, a.bid, MAX(b.weight) FROM ' . $prefix . '_blocks_custom a, ' . $prefix . '_blocks_custom b GROUP BY a.mid, a.bid'); if ($db->sql_numrows($result)) { while ($row = $db->sql_fetchrow($result, SQL_NUM)) { # block is there but module id has not been posted so delete from it if ($row[1] == $bid && !isset($new_in_modules[$row[0]])) { $db->sql_uquery('DELETE FROM ' . $prefix . "_blocks_custom WHERE bid={$bid} AND mid=" . $row[0]); $db->sql_uquery('UPDATE ' . $prefix . "_blocks_custom SET weight=weight-1 WHERE weight>{$row[2]} AND mid=" . $row[0]); } else { if ($row[1] == $bid && isset($new_in_modules[$row[0]])) { # module id has been posted and it exists within the table: clearing posteded data $new_in_modules[$row[0]] = ''; } } if (!isset($table_data[$row[0]])) { # save what we need for later use $table_data[$row[0]] = $row[2]; } } $db->sql_freeresult($result); } $values = array(); # insert anything left from the posted data if (!empty($new_in_modules)) { foreach ($new_in_modules as $mid) { if (!empty($mid)) { $values[] = "('{$bid}', '{$mid}', '{$update['bposition']}', '" . ($table_data[$mid] + 1) . "')"; } } } if (!empty($values)) { $db->sql_uquery('INSERT INTO ' . $prefix . '_blocks_custom (bid, mid, side, weight) VALUES ' . implode(',', $values)); } Cache::array_delete('blocks_list'); URL::redirect(URL::admin('blocks')); }
$move = intval($_GET['move']); $forum_id = intval($_GET[POST_FORUM_URL]); $forum_info = get_info('forum', $forum_id); $cat_id = $forum_info['cat_id']; $db->sql_query('UPDATE ' . FORUMS_TABLE . " SET forum_order = forum_order + {$move} WHERE forum_id = {$forum_id}"); renumber_order('forum', $forum_info['cat_id']); $show_index = TRUE; break; case 'cat_order': # Change order of categories in the DB $move = intval($_GET['move']); $cat_id = intval($_GET[POST_CAT_URL]); $db->sql_query('UPDATE ' . CATEGORIES_TABLE . " SET cat_order = cat_order + {$move} WHERE cat_id = {$cat_id}"); renumber_order('category'); $show_index = TRUE; Cache::array_delete('category_rows', $module_name); break; case 'forum_sync': sync('forum', intval($_GET[POST_FORUM_URL])); $show_index = TRUE; break; default: message_die(GENERAL_MESSAGE, $lang['No_mode']); return; } if ($show_index != TRUE) { return; } } # Start page proper $template->set_filenames(array('body' => 'forums/admin/forum_admin_body.html'));
$result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { $unset_mod[] = $row['user_id']; } $db->sql_freeresult($result); if (!empty($set_mod)) { // die(print_r($set_mod)); $db->sql_query("UPDATE " . USERS_TABLE . " SET user_level = " . MOD . ' WHERE user_id IN (' . implode(',', $set_mod) . ')'); } if (!empty($unset_mod)) { // die(print_r($unset_mod)); $db->sql_query("UPDATE " . USERS_TABLE . " SET user_level = " . USER . ' WHERE user_id IN (' . implode(',', $unset_mod) . ')'); } } message_die(GENERAL_MESSAGE, $message); Cache::array_delete('forum_moderators', 'Forums'); } else { if ($mode == 'user' && (isset($_POST['username']) || $user_id) || $mode == 'group' && $group_id) { if (isset($_POST['username'])) { $this_userdata = getusrdata($_POST['username']); if (!is_array($this_userdata)) { message_die(GENERAL_MESSAGE, $lang['No_such_user']); return; } $user_id = $this_userdata['user_id']; } // // Front end // $result = $db->sql_query("SELECT * FROM " . FORUMS_TABLE . " ORDER BY forum_order"); $forum_access = array();
} else { $mods[$class] = array('mid' => 0, 'title' => $class, 'custom_title' => "modules/{$class}/cpg_inst.php is missing class: {$class}", 'active' => 0, 'view' => 0, 'inmenu' => 1, 'uninstall' => 0); } } else { $db->sql_query("INSERT INTO " . $prefix . "_modules (title) VALUES ('{$class}')"); $mods[$class] = array('mid' => $db->sql_nextid('mid'), 'title' => $class, 'custom_title' => '', 'active' => 0, 'view' => 0, 'inmenu' => 1, 'uninstall' => 0); $result = $db->sql_query('SELECT bid, bposition FROM ' . $prefix . '_blocks WHERE active=1'); if ($db->sql_numrows($result)) { $in_modules = array(); $l = $c = $r = $d = 1; while ($row = $db->sql_fetchrow($result, SQL_NUM)) { $in_modules[] = "({$row['0']}, '{$mods[$class]['mid']}', '{$row['1']}', " . ${$row}[1] . ")"; ++${$row}[1]; } $db->sql_query('INSERT INTO ' . $prefix . '_blocks_custom (bid, mid, side, weight) VALUES ' . implode(',', $in_modules)); Cache::array_delete('blocks_list'); } $db->sql_freeresult($result); } } } } closedir($handle); $pagetitle .= ' ' . _BC_DELIM . ' ' . _MODULESADMIN; require 'header.php'; GraphicAdmin('_AMENU1'); OpenTable(); echo '<span class="genmed"><strong>' . _MODULESADDONS . '</strong></span><br /> ' . _MODULEHOMENOTE . '<br /><br />' . _NOTINMENU . '<br /><br /> <a href="' . URL::admin('&a=all') . '">' . _ACTIVATE . ' ' . _ALL . '</a> | <a href="' . URL::admin('&a=none') . '">' . _DEACTIVATE . ' ' . _ALL . '</a><br /><br /> <form action="' . URL::admin() . '" method="post" enctype="multipart/form-data" accept-charset="utf-8">