Example #1
0
# Copyright Jamit Software 2012, http://www.jamit.com
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
###########################################################################
require '../config.php';
//require ('../include/code_functions.php');
require dirname(__FILE__) . "/admin_common.php";
if ($_REQUEST['jb_code_order_by'] != false && $_SESSION['ADMIN'] != false && JB_DEMO_MODE != 'YES') {
    if (JB_DEMO_MODE != 'YES') {
        $filename = "../config.php";
        $handle = fopen($filename, "rb");
        $contents = fread($handle, filesize($filename));
        fclose($handle);
        $handle = fopen($filename, "w");
        $new_contents = JB_change_config_value($contents, 'JB_CODE_ORDER_BY', stripslashes($_REQUEST['jb_code_order_by']));
        fwrite($handle, $new_contents, strlen($new_contents));
        fclose($handle);
    }
}
JB_admin_header('Admin -> Edit Codes');
?>
<b>[Edit Codes]</b>

	<span style="background-color: #F2F2F2; border-style:outset; padding: 5px;"><a href="edit_config.php">Main</a></span>
 <span style="background-color: #F2F2F2; border-style:outset; padding:5px; "><a href="editcats.php">Categories</a></span>
 <span style="background-color: #FFFFCC; border-style:outset; padding:5px; "><a href="editcodes.php">Codes</a></span>
 <span style="background-color: #F2F2F2; border-style:outset; padding:5px; "><a href="language.php">Languages</a></span>
 <span style="background-color: #F2F2F2; border-style:outset; padding:5px; "><a href="emailconfig.php">Email Templates</a></span>	
	
	
Example #2
0
function JBPLUG_update_plugin_config($config = JB_PLUGIN_CONFIG)
{
    // $config must be serialized!
    if (JB_DEMO_MODE == 'YES') {
        return;
    }
    // load the config in
    if (!is_string($config)) {
        if (is_array($config)) {
            $config = serialize($config);
        } else {
            trigger_error('JBPLUG_update_plugin_config() should serialize the argument', E_USER_WARNING);
            return;
        }
    }
    $config_dir = jb_get_config_dir();
    $filename = $config_dir . "config.php";
    $handle = fopen($filename, "rb");
    $contents = fread($handle, filesize($filename));
    fclose($handle);
    $handle = fopen($filename, "w");
    $new_contents = JB_change_config_value($contents, 'JB_PLUGIN_CONFIG', $config);
    fwrite($handle, $new_contents, strlen($new_contents));
    fclose($handle);
}