#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
#    You can use Quran Analysis code, framework or corpora in your website
#	 or application (commercial/non-commercial) provided that you link
#    back to www.qurananalysis.com and sufficient credits are given.
#
#  ====================================================================
error_reporting(E_ALL);
include dirname(__FILE__) . "/../libs/core.lib.php";
include dirname(__FILE__) . "/../dal/SQLite3DataLayer.class.php";
$email = $_POST['email'];
$name = $_POST['name'];
$title = $_POST['title'];
$entityVal = $_POST['entity'];
if (empty($email)) {
    echo "ERROR";
    exit;
}
$dbPath = dirname(__FILE__) . "/../data/databases/main.sqlite";
$sqliteDBObj = new SQLite3DataLayer();
$sqliteDBObj->openDB($dbPath, "rw");
$sqliteDBObj->execOnewayQuery(MAILING_LIST_TABLE);
$sqliteDBObj->execOnewayQuery("INSERT INTO EmailList " . "(name, title, entity, email) " . "VALUES " . "('{$name}', '{$title}','{$entityVal}','{$email}')");
$error = handleDBError($sqliteDBObj);
if (empty($error)) {
    $body = "New subscription<br>Name:{$name}<br>Title:{$title}<br>Entity:{$entityVal}<br>Email:{$email}<br>";
    include "sendEmail.inc.php";
    echo "DONE";
} else {
    echo "Error occured! please report it using the contact page" . $error;
}
#
#    You can use Quran Analysis code, framework or corpora in your website
#	 or application (commercial/non-commercial) provided that you link
#    back to www.qurananalysis.com and sufficient credits are given.
#
#  ====================================================================
error_reporting(E_ALL);
include dirname(__FILE__) . "/../libs/core.lib.php";
include dirname(__FILE__) . "/../dal/SQLite3DataLayer.class.php";
$email = $_POST['email'];
$name = $_POST['name'];
$feedbackType = $_POST['feedbackType'];
$feedbackText = $_POST['feedbackText'];
if (empty($email)) {
    echo "ERROR";
    exit;
}
$dbPath = dirname(__FILE__) . "/../data/databases/main.sqlite";
$sqliteDBObj = new SQLite3DataLayer();
$sqliteDBObj->openDB($dbPath, "rw");
$sqliteDBObj->execOnewayQuery(FEEDBACK_TABLE);
$sqliteDBObj->execOnewayQuery("INSERT INTO Feedback " . "(name, email, type, feedback_text) " . "VALUES " . "('{$name}', '{$email}', '{$feedbackType}', '{$feedbackText}')");
$error = handleDBError($sqliteDBObj);
if (empty($error)) {
    $body = "New Feedback<br>Name:{$name}<br>Email:{$email}<br>Type:{$feedbackType}<br>Text:{$feedbackText}<br>";
    include "sendEmail.inc.php";
    echo "DONE";
} else {
    echo "Error occured! please report it using the contact page";
    //$error;
}