small php+sql web-comic system. No bloat, you gloat.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
1.0 KiB

printf -v file "%q" "$1"
printf -v title "%q" "$2"
printf -v hover "%q" "$3"
file=$(printf '%s\n' "$file"|sed -e 's/[\/&]/\\&/g')
title=$(printf '%s\n' "$title"|sed -e 's/[\/&]/\\&/g')
hover=$(printf '%s\n' "$hover"|sed -e 's/[\/&]/\\&/g')
dialect=$(grep '^dialect=' config.ini.php|sed 's/.*=//'|sed 's/"//g')
user=$(grep '^user=' config.ini.php|sed 's/.*=//'|sed 's/"//g')
password=$(grep '^password=' config.ini.php|sed 's/.*=//'|sed 's/"//g')
dsn=$(grep '^dsn=' config.ini.php|sed 's/.*=//'|sed 's/"//g')
case $dialect in
dbname=$(grep dbname config.ini.php|sed 's/.*dbname=\([a-zA-Z]*\).*/\1/')
mysql -u$user -e"SET @file = '$file'; SET @title = '$title'; SET @hover = '$hover'; $(<add_image.sql)" $dbname
echo "$(<add_image.sql)"|sed "s/@file/\'$file\'/"|sed "s/@title/\'$title\'/"|sed "s/@hover/\'$hover\'/"| sqlite3 $dsn
echo "sorry, database dialect $dialect not yet supported. It will only take one line in, so please fix and submit a pull request."