]> git.plutz.net Git - cgilite/blobdiff - action.sh
allow dot in parameter keys
[cgilite] / action.sh
index 0077575ce2b5e62d571c851fbc76aa63c5ebbb77..caf214c410310da54f6befbe5f95cd6cfa711cf1 100755 (executable)
--- a/action.sh
+++ b/action.sh
 # You should have received a copy of the GNU Affero General Public License
 # along with Serve0.  If not, see <http://www.gnu.org/licenses/>. 
 
-ACTION="$(echo "$_GET[\"action\"]" |egrep '^[a-zA-Z0-9_-]+$')"
+ACTION="$(printf %s "${_GET[action]}" |egrep '^[a-zA-Z0-9_-]+$')"
 ACTION="${_EXEC}/actions/${ACTION}.sh"
-[ -x "$ACTION" ] || echo -n "Location: http://$HTTP_HOST/?page=error\n\n"
 
-. $ACTION
+if [ -x "$ACTION" ]; then
+  debug "trying to execute $ACTION"
+  . $ACTION
+else
+  debug "unable to execute $ACTION"
+  printf "Location: ?p=error\n\n"
+fi
+