All values to the core are located in 'sys.options_table' and 'sys.config_values' the values added by Web Press Creative developers are all in fixed positions and can not be moved to any other order than the original list.
An example of the method of adding new settings and values to the core version from plug-in's and other 3rd party add-on applications is shown below.
<?php
$doc_root=$_SERVER['DOCUMENT_ROOT'];
include_once ($doc_root.'/core/system/config/config.php');
$t_stamp=date(DATE_W3C);
// New options table settings values to add to existing:
// installed item description
$inst_desc='';
// install directory path with trailing slash
$inst_path='';
// comma separated lists:
// new setting descriptions each starts with [x]
$new_set_desc='';
// new setting values list
$new_set_vals='';
// *********************************
$con=mysql_connect($db_host,$db_user,$db_pass);
@mysql_select_db($db_name, $con) or die(mysql_error());
unset($values);
$values=mysql_query("SELECT pagename, content FROM wpc_core WHERE pagename = 'sys.options_table'");
if($values !== NULL) {$a_values = mysql_fetch_row($values);
@mysql_free_result($values);
unset($values);}else{$error='yes';}
$array_val=urldecode($a_values[1]);
unset($options);
$options=explode(',',$array_val);
$marix=array_reverse(str_split($inst_desc));
foreach($marix as $var){$numbr=$numbr.ord($var);}
$app_id=substr($numbr, 0, 7);
str_replace(',', '', $new_set_desc, $sets+1);
$install_id=strtoupper(substr($inst_desc, 0, 3)).$app_id.'SP'.$sets;
$opts_bak='data.'.strtolower($install_id).'_opts_bak';
$new_set_desc='['.$install_id.'] '.$new_set_desc.',[end],';
$new_set_desc=str_replace('%2C', '%0D%0A',urlencode($new_set_desc));
$options_temp=explode(',', $options);
$opt_temp=str_replace('[end]', $new_set_desc, $options_temp[0]);
$options_temp[0]=NULL;
$opt_set=$opt_temp.urlencode(','.implode(',', $options_temp).','.$install_id.','.$new_set_vals);
$inst_data="/* Installed item description: ".$inst_desc." on: ".$t_stamp."\n\n"."Setting descriptions: ".$new_set_desc."\n\n"."Setting values: ".$new_set_vals." */\n\n"."\$options_bak=\"".$a_values[1]."\";\n\n"."\$inst_id=\"".$install_id."\";\n\n";
$inst_file=$doc_root.$inst_path.'install_data.php';
$handle = fopen($inst_file, "a+");
fwrite($handle, $inst_data);
fclose($handle);
@mysql_query("DELETE QUICK FROM wpc_core WHERE pagename = '$opts_bak'");
@mysql_query("INSERT INTO wpc_core(pagename, content) VALUES( '$opts_bak', '$a_values[1]')");
@mysql_query("DELETE QUICK FROM wpc_core WHERE pagename = 'data.'");
@mysql_query("INSERT INTO wpc_core(pagename, content) VALUES( 'sys.options_table', '$opt_set')");
unset($values);
$values=mysql_query("SELECT pagename, content FROM wpc_core WHERE pagename = 'sys.options_table'");
if($values !== NULL) {$x_values = mysql_fetch_row($values);
@mysql_free_result($values);
unset($values);}else{$error='yes';}
$array_valx=urldecode($x_values[1]);
unset($opt_x);
$opt_x=explode(',',$array_valx);
$zxy=0;
foreach($options as $var){if($zxy > 0){if($var !== $opt_x[$zxy]){$error='yes';}}$zxy++;}
echo $error;
mysql_close($con);
unset($a_values);
unset($values);
?>
No comments:
Post a Comment