Skip to content
Snippets Groups Projects
Commit 57e97058 authored by alvaro's avatar alvaro
Browse files

Merge remote-tracking branch 'upstream/master'

parents 7023cd54 7a22a9e4
No related branches found
No related tags found
No related merge requests found
...@@ -24,7 +24,10 @@ USAGE=$USAGE" List namespaces:\t\t\t\t\t$0 list namespaces\n" ...@@ -24,7 +24,10 @@ USAGE=$USAGE" List namespaces:\t\t\t\t\t$0 list namespaces\n"
USAGE=$USAGE"\n===MODULES===\n" USAGE=$USAGE"\n===MODULES===\n"
USAGE=$USAGE" Enable module:\t\t\t\t\t\t$0 enable module position\n" USAGE=$USAGE" Enable module:\t\t\t\t\t\t$0 enable module position\n"
USAGE=$USAGE" Disable module:\t\t\t\t\t$0 disable module\n" USAGE=$USAGE" Disable module:\t\t\t\t\t$0 disable module\n"
USAGE=$USAGE" List modules:\t\t\t\t\t$0 list modules\n" USAGE=$USAGE" List modules:\t\t\t\t\t\t$0 list modules\n"
USAGE=$USAGE"\n===VARIABLES===\n"
USAGE=$USAGE" Add any variable:\t\t\t\t\t$0 add variable value\n"
USAGE=$USAGE" Where variable has the form conf.something or lodspk.something\n"
USAGE=$USAGE" \n===ADMIN USER===\n" USAGE=$USAGE" \n===ADMIN USER===\n"
USAGE=$USAGE" Change password:\t\t\t\t\t$0 change password NEWPASSWORD\n" USAGE=$USAGE" Change password:\t\t\t\t\t$0 change password NEWPASSWORD\n"
USAGE=$USAGE"\n===VERSION==\n" USAGE=$USAGE"\n===VERSION==\n"
...@@ -131,7 +134,7 @@ fi ...@@ -131,7 +134,7 @@ fi
## Add ## Add
if [[ $currentOperation == "add" ]]; then if [[ $currentOperation == "add" ]]; then
addOperation=( endpoint namespace ) addOperation=( endpoint namespace variable )
if [[ ${addOperation[@]} =~ $2 && $2 != "" && $3 != "" ]] if [[ ${addOperation[@]} =~ $2 && $2 != "" && $3 != "" ]]
then then
addOperation=$2 addOperation=$2
...@@ -141,12 +144,17 @@ if [[ $currentOperation == "add" ]]; then ...@@ -141,12 +144,17 @@ if [[ $currentOperation == "add" ]]; then
exit 1 exit 1
fi fi
cd $DIR/.. cd $DIR/..
php $DIR/modules/add-$addOperation.php $3 $4 args=$@
php $DIR/modules/add-$addOperation.php $3 "${4}"
rc=$? rc=$?
if [[ $rc != 0 ]] ; then if [[ $rc = 123 ]] ; then
echo -e "The $addOperation with prefix '$3' already exist, please remove it first." >&2 echo -e "The $addOperation with prefix '$3' already exist, please remove it first." >&2
exit exit
fi fi
if [[ $rc = 124 ]] ; then
echo -e "The $addOperation with did not stated with 'conf' or 'lodspk'. Please correct that." >&2
exit
fi
echo -e "The $addOperation $4 was added successfully as $3!" >&2 echo -e "The $addOperation $4 was added successfully as $3!" >&2
exit exit
fi fi
......
<?php
error_reporting(E_ERROR);
$s = 'settings.inc.php';
$c = file_get_contents($s);
$varArray = explode(".", $argv[1]);
//Convert varName into a proper variable for LODSPeaKr
$varName = array_shift($varArray);
if($varName != "conf" && $varName != "lodspk"){
exit(124);
}
$varString = $varName."['".join("']['",$varArray)."'];";
$varValue = $argv[2];
$newLines = array();
$lines = explode("\n", $c);
foreach($lines as $k => $v){
if(preg_match("/\?>/", $v) == 0){
if(strstr($v, $varString) === FALSE){
array_push($newLines,$v);
}
}
}
$newLine = "\$".$varString." = '".$varValue."';";
array_push($newLines,$newLine);
array_push($newLines,"?>");
$c = implode("\n", $newLines);
file_put_contents($s, $c);
?>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment