I am working on repairing an install of AvantFAX on my Elastix box, digging around I found a script that would repair a know flaw that would cause the site to come up blank. I did not write this script and here is the original http://sourceforge.net/p/avantfax/discussion/540878/thread/441bd3dc/
It is not working when I run it. I get the error:
[root@elastix includes]# bash scriptfilename.sh
File "classes.php" edit.
scriptfilename.sh: line 4: syntax error near unexpected token `;'
scriptfilename.sh: line 4: `if ; then'
#
echo "File \"classes.php\" edit."
for i in $(ls ); do
if ; then
NAME=$i
i=${i:0:1}
LETTER=$(echo $i | sed -e 's///g')
if ; then
sed -i "/config.php/aequire_once \'$NAME\';" classes.php
sed -i "/config.php/aequire_once \'htmlMimeMail5.php\';" classes.php
fi
fi
done
echo "Function \"__autoload\" comment out."
sed -i "/function __autoload/c\/** function __autoload" classes.php
n=$(grep -niw 'function __autoload' classes.php|awk -F: '{ print $1
}');
n=$(($n+3));
sed -i "$(echo $n)i\ */" classes.php
--------------------------------------------------------------------------------
Using php5.3.7 on centos 6.0
Johann
There are several syntactic errors: The if ; then
lines are not valid commands, because the condition is missing. A command returning a 0 or non 0 value at command finalization is missing in them. Which the condiciotn should be, I have not the slightest idea.
I have posted an article showing the fix for avantfax once you upgrade above php 5.3 here
this is the code:
#!/bin/bash
#
echo "File \"classes.php\" edit."
for i in $(ls ); do
if [ -f $i ]; then
NAME=$i
i=$
LETTER=$(echo $i | sed -e 's/[^A-Z]//g')
if [ ! -z $LETTER ]; then
sed -i "/config.php/aequire_once \'$NAME\';" classes.php
sed -i "/config.php/aequire_once \'htmlMimeMail5.php\';" classes.php
fi
fi
done
echo "Function \"__autoload\" comment out."
sed -i "/function __autoload/c\/** function __autoload" classes.php
n=$(grep -niw 'function __autoload' classes.php|awk -F: '{ print $1 }');
n=$(($n+3));
sed -i "$(echo $n)i\ */" classes.php