http://www.icyphoenix.com/viewtopic.php?f=28&t=6453&p=44324#p44324
-----------------------------------
Lopalong
Sat 12 Sep, 2009 11:37

Re: BETA - Limit Users Post Edit TIme
-----------------------------------
Here's what I did by creating admin_modifications.php, but I know it can be done another way too; where each mod has its own subcategory in "Modifications" and not just a page for all the "minor" MODS. ;)

But! I'm still learning and playing! :P

[spoiler][code linenumbers=false]<?php
/**
*
* @package Icy Phoenix
* @version $Id: admin_modifications.php 2009-09-12 19:54:45Z Lopalong $
* @copyright (c) 2009 Icy Phoenix
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
*
* @Extra credits for this file
* 
*
*/

define('IN_ICYPHOENIX', true);

// Admin Panel
if( !empty($setmodules) )
{
	$filename = basename(__FILE__);
	$module['Modifications']['Grouped Configurations'] = $filename;

	return;
}

// Load default header
if (!defined('IP_ROOT_PATH')) define('IP_ROOT_PATH', './../');
if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
require('./pagestart.' . PHP_EXT);
include_once(IP_ROOT_PATH . 'includes/functions_admin.' . PHP_EXT);
$db->clear_cache('config_');

// Pull all config data
$sql = "SELECT * FROM " . CONFIG_TABLE;
if(!$result = $db->sql_query($sql))
{
	message_die(CRITICAL_ERROR, "Could not query config information in admin_board", "", __LINE__, __FILE__, $sql);
}
else
{
	while($row = $db->sql_fetchrow($result))
	{
		$config_name = $row['config_name'];
		$config_value = $row['config_value'];
		//$default_config[$config_name] = isset($_POST['submit']) ? addslashes($config_value) : $config_value;
		$default_config[$config_name] = $config_value;
		$new[$config_name] = (isset($_POST[$config_name])) ? $_POST[$config_name] : $default_config[$config_name];
		fix_config_values($config_name, $config_value);

		if(isset($_POST['submit']))
		{
			set_config($config_name, $new[$config_name]);
		}
	}
	if(isset($_POST['submit']))
	{
		set_config('board_disable_message', $_POST['message_board_disable_text']);

		$message = $lang['Config_updated'] . '<br /><br />' . sprintf($lang['Click_return_url_posting'], '<a href="' . append_sid('admin_modifications.' . PHP_EXT) . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid('index.' . PHP_EXT . '?pane=right') . '">', '</a>');

		message_die(GENERAL_MESSAGE, $message);
	}
}

// START Advanced mouse hover preview
$display_first_msg = ($new['display_first'] == MSG_DISPLAY_FIRST) ? "checked=\"checked\"" : "";
$display_last_msg = ($new['display_first'] == MSG_DISPLAY_LAST) ? "checked=\"checked\"" : "";
$display_none = ($new['display_first'] == MSG_DISPLAY_NONE) ? "checked=\"checked\"" : "";
// END Advanced mouse hover preview


$template->set_filenames(array('body' => ADM_TPL . 'admin_modifications_body.tpl'));


$template->assign_vars(array(
	'S_CONFIG_ACTION' => append_sid('admin_modifications.' . PHP_EXT),
	'L_MODIFICATION_TITLE' => $lang['modifications_title'],
	'L_MODIFICATION_EXPLAIN' => $lang['modification_explain'],

// START Url Posting Restrictions
	'L_URL_POST_SETTINGS' => $lang['url_post_settings'],
	'L_URL_POST_DAYS' => $lang['url_post_days'],
	'L_URL_POST_DAYS_EXPLAIN' => $lang['url_post_days_explain'],
	'URL_POST_DAYS' => $new['url_post_days'],
	'L_URL_POST_POSTS' => $lang['url_post_posts'],
	'L_URL_POST_POSTS_EXPLAIN' => $lang['url_post_posts_explain'],
	'URL_POST_POSTS' => $new['url_post_posts'],
// END Url Posting Restrictions

// START Security Question
	'L_SECURITYQUESTION' => $lang['security_question'],
	'L_SECURITYQUESTION_EXPLAIN' => $lang['security_question_explain'],
	'L_SECURITYANSWER' => $lang['security_answer'],
	'L_SECURITYANSWER_EXPLAIN' => $lang['security_answer_explain'],
	'L_SECURITY_QUESTION_SETTINGS' => $lang['security_question_settings'],
	'SECURITY_QUESTION' => $new['securityquestion'],
	'SECURITY_ANSWER' => $new['securityanswer'],
// END Security Question

// START Edit Time for Posts
	'L_EDIT_TIME' => $lang['edit_time'], 
	'L_EDIT_TIME_EXPLAIN' => $lang['edit_time_explain'],
 	'L_EDIT_POST_TIME_SETTINGS' => $lang['edit_post_time_settings'],
	'EDIT_TIME' => $new['edit_time'],
// END Edit Time for Posts

// START Advanced mouse hover preview
	'L_CHAR_LIMIT' => $lang['Char_limit'],
	'L_MSG_DISPLAY' => $lang['Msg_display'],
 	'L_MSG_DISPLAY_EXPLAIN' => $lang['Msg_display_exp'], 
	'L_MSG_FIRST' => $lang['Msg_first'], 
	'L_MSG_LAST' => $lang['Msg_last'],

	'CHAR_LIMIT' => $new['char_limit'],
	'DISPLAY_NONE_MSG' => MSG_DISPLAY_NONE, 
	'DISPLAY_NONE_CHECKED' => $display_none,
	'DISPLAY_FIRST_MSG' => MSG_DISPLAY_FIRST, 
	'DISPLAY_FIRST_CHECKED' => $display_first_msg,
	'DISPLAY_LAST_MSG' => MSG_DISPLAY_LAST, 
	'DISPLAY_LAST_CHECKED' => $display_last_msg,
// END Advanced mouse hover preview
	)
);

$template->pparse('body');

// Page Footer
include('page_footer_admin.' . PHP_EXT);
?>[/code][/spoiler]

Which brings me to another question.

Is it possible to have preg replace "Global" entries so that it can be used to replace core entries by using preg-replace $data_strings in a MOD?

I know I've probably said that badly, and I'll throw up a sample of what I mean if you need it - But I'll have to find it and dig it out. ;)


