print_stop_message('saved_holiday_x_successfully', $vbulletin->GPC['title']); } // ################# Delete a Holiday ########################### if ($_REQUEST['do'] == 'removeholiday') { $vbulletin->input->clean_array_gpc('r', array('holidayid' => TYPE_INT)); print_form_header('admincalendar', 'doremoveholiday', 0, 1, '', '75%'); construct_hidden_code('holidayid', $vbulletin->GPC['holidayid']); print_table_header(construct_phrase($vbphrase['confirm_deletion_of_holiday_x'], $vbphrase['holiday' . $vbulletin->GPC['holidayid'] . '_title'])); print_description_row("\n\t\t\t<blockquote><br />\n\t\t\t" . construct_phrase($vbphrase['are_you_sure_you_want_to_delete_the_holiday_called_x'], $vbphrase['holiday' . $vbulletin->GPC['holidayid'] . '_title'], $vbulletin->GPC['holidayid']) . "\n\t\t\t<br /></blockquote>\n\t"); print_submit_row($vbphrase['yes'], 0, 2, $vbphrase['no']); } // ################ Really Delete a Holiday #################### if ($_POST['do'] == 'doremoveholiday') { $vbulletin->input->clean_array_gpc('p', array('holidayid' => TYPE_INT)); // delete phrases $db->query_write("\n\t\tDELETE FROM " . TABLE_PREFIX . "phrase\n\t\tWHERE fieldname = 'holiday' AND\n\t\t\t\tvarname IN ('holiday" . $vbulletin->GPC['holidayid'] . "_title', 'holiday" . $vbulletin->GPC['holidayid'] . "_desc')\n\t"); $db->query_write("DELETE FROM " . TABLE_PREFIX . "holiday WHERE holidayid=" . $vbulletin->GPC['holidayid']); require_once DIR . '/includes/adminfunctions_language.php'; build_language(); require_once DIR . '/includes/functions_databuild.php'; build_events(); define('CP_REDIRECT', 'admincalendar.php?do=modifyholiday'); print_stop_message('deleted_holiday_successfully'); } print_cp_footer(); /*======================================================================*\ || #################################################################### || # Downloaded: 12:56, Sat Oct 11th 2008 || # CVS: $RCSfile$ - $Revision: 25644 $ || #################################################################### \*======================================================================*/
/** * Updates the setting table based on data passed in then rebuilds the datastore. * Only entries in the array are updated (allows partial updates). * * @param array Array of settings. Format: [setting_name] = new_value */ function save_settings($settings) { global $vbulletin, $vbphrase, $stylevar; $varnames = array(); foreach (array_keys($settings) as $varname) { $varnames[] = $vbulletin->db->escape_string($varname); } $oldsettings = $vbulletin->db->query_read("\n\t\tSELECT value, varname, datatype, optioncode\n\t\tFROM " . TABLE_PREFIX . "setting\n\t\tWHERE varname IN ('" . implode("', '", $varnames) . "')\n\t\tORDER BY varname\n\t"); while ($oldsetting = $vbulletin->db->fetch_array($oldsettings)) { switch ($oldsetting['varname']) { // ************************************************** case 'bbcode_html_colors': $settings['bbcode_html_colors'] = serialize($settings['bbcode_html_colors']); break; // ************************************************** // ************************************************** case 'styleid': $vbulletin->db->query_write("\n\t\t\t\t\tUPDATE " . TABLE_PREFIX . "style\n\t\t\t\t\tSET userselect = 1\n\t\t\t\t\tWHERE styleid = " . $settings['styleid'] . "\n\t\t\t\t"); break; // ************************************************** // ************************************************** case 'banemail': build_datastore('banemail', $settings['banemail']); $settings['banemail'] = ''; break; // ************************************************** // ************************************************** case 'editormodes': $vbulletin->input->clean_array_gpc('p', array('fe' => TYPE_UINT, 'qr' => TYPE_UINT, 'qe' => TYPE_UINT)); $settings['editormodes'] = serialize(array('fe' => $vbulletin->GPC['fe'], 'qr' => $vbulletin->GPC['qr'], 'qe' => $vbulletin->GPC['qe'])); break; // ************************************************** // ************************************************** case 'cookiepath': case 'cookiedomain': if ($settings[$oldsetting['varname'] . '_other'] and $settings[$oldsetting['varname'] . '_value']) { $settings[$oldsetting['varname']] = $settings[$oldsetting['varname'] . '_value']; } break; // ************************************************** // ************************************************** default: ($hook = vBulletinHook::fetch_hook('admin_options_processing')) ? eval($hook) : false; if ($oldsetting['optioncode'] == 'multiinput') { $store = array(); foreach ($settings["{$oldsetting['varname']}"] as $value) { if ($value != '') { $store[] = $value; } } $settings["{$oldsetting['varname']}"] = serialize($store); } else { if (preg_match('#^usergroup:[0-9]+$#', $oldsetting['optioncode'])) { // serialize the array of usergroup inputs if (!is_array($settings["{$oldsetting['varname']}"])) { $settings["{$oldsetting['varname']}"] = array(); } $settings["{$oldsetting['varname']}"] = array_map('intval', $settings["{$oldsetting['varname']}"]); $settings["{$oldsetting['varname']}"] = serialize($settings["{$oldsetting['varname']}"]); } } } $newvalue = validate_setting_value($settings["{$oldsetting['varname']}"], $oldsetting['datatype']); // this is a strict type check because we want '' to be different from 0 // some special cases below only use != checks to see if the logical value has changed if (strval($oldsetting['value']) !== strval($newvalue)) { switch ($oldsetting['varname']) { case 'activememberdays': case 'activememberoptions': if ($oldsetting['value'] != $newvalue) { $vbulletin->options["{$oldsetting['varname']}"] = $newvalue; require_once DIR . '/includes/functions_databuild.php'; build_birthdays(); } break; case 'showevents': case 'showholidays': if ($oldsetting['value'] != $newvalue) { $vbulletin->options["{$oldsetting['varname']}"] = $newvalue; require_once DIR . '/includes/functions_calendar.php'; build_events(); } break; case 'languageid': if ($oldsetting['value'] != $newvalue) { $vbulletin->options['languageid'] = $newvalue; require_once DIR . '/includes/adminfunctions_language.php'; build_language($vbulletin->options['languageid']); } break; case 'cpstylefolder': $admindm =& datamanager_init('Admin', $vbulletin, ERRTYPE_CP); $admindm->set_existing($vbulletin->userinfo); $admindm->set('cssprefs', $newvalue); $admindm->save(); unset($admindm); break; case 'storecssasfile': if (!is_demo_mode() and $oldsetting['value'] != $newvalue) { $vbulletin->options['storecssasfile'] = $newvalue; require_once DIR . '/includes/adminfunctions_template.php'; print_rebuild_style(-1, '', 1, 0, 0, 0); } break; case 'loadlimit': update_loadavg(); break; case 'view_tagcloud_as_usergroup': build_datastore('tagcloud', serialize(''), 1); break; case 'censorwords': case 'codemaxlines': if ($oldsetting['value'] != $newvalue) { $vbulletin->db->query_write("TRUNCATE TABLE " . TABLE_PREFIX . "postparsed"); if ($vbulletin->options['templateversion'] >= '3.6') { $vbulletin->db->query_write("TRUNCATE TABLE " . TABLE_PREFIX . "sigparsed"); } } ($hook = vBulletinHook::fetch_hook('admin_options_processing_censorcode')) ? eval($hook) : false; break; default: ($hook = vBulletinHook::fetch_hook('admin_options_processing_build')) ? eval($hook) : false; } if (is_demo_mode() and in_array($oldsetting['varname'], array('storecssasfile', 'attachfile', 'usefileavatar', 'errorlogdatabase', 'errorlogsecurity', 'safeupload', 'tmppath'))) { continue; } $vbulletin->db->query_write("\n\t\t\t\tUPDATE " . TABLE_PREFIX . "setting\n\t\t\t\tSET value = '" . $vbulletin->db->escape_string($newvalue) . "'\n\t\t\t\tWHERE varname = '" . $vbulletin->db->escape_string($oldsetting['varname']) . "'\n\t\t\t"); } } build_options(); }
else { $show['birthdays'] = false; } // ### TODAY'S EVENTS ################################################# if ($vbulletin->options['showevents']) { require_once(DIR . '/includes/functions_calendar.php'); $future = gmdate('n-j-Y' , TIMENOW + 86400 + 86400 * $vbulletin->options['showevents']); if (!is_array($vbulletin->eventcache) OR $future != $vbulletin->eventcache['date']) { // Need to update! $eventstore = build_events(); DEVDEBUG('Updated Events'); } else { $eventstore = $vbulletin->eventcache; } unset($eventstore['date']); $events = array(); $eventcount = 0; $holiday_calendarid = 0; foreach ($eventstore AS $eventid => $eventinfo) { $offset = $eventinfo['dst'] ? $vbulletin->userinfo['timezoneoffset'] : $vbulletin->userinfo['tzoffset'];
/** * Additional data to update after a delete call (such as denormalized values in other tables). * * @param boolean Do the query? */ function post_delete($doquery = true) { $activity = new vB_ActivityStream_Manage('calendar', 'event'); $activity->set('contentid', intval($this->fetch_field('eventid'))); $activity->delete(); $this->dbobject->query_write("DELETE FROM " . TABLE_PREFIX . "subscribeevent WHERE eventid = " . intval($this->fetch_field('eventid'))); require_once DIR . '/includes/functions_calendar.php'; build_events(); ($hook = vBulletinHook::fetch_hook('eventdata_delete')) ? eval($hook) : false; return true; }
/** * Additional data to update after a delete call (such as denormalized values in other tables). * * @param boolean Do the query? */ function post_delete($doquery = true) { $this->dbobject->query_write("DELETE FROM " . TABLE_PREFIX . "subscribeevent WHERE eventid = " . intval($this->fetch_field('eventid'))); require_once(DIR . '/includes/functions_calendar.php'); build_events(); ($hook = vBulletinHook::fetch_hook('eventdata_delete')) ? eval($hook) : false; return true; }
/** * Step #1 * */ function step_1() { require_once DIR . '/includes/functions_calendar.php'; build_events(); $this->show_message($this->phrase['version']['380rc1']['rebuild_event_cache']); }