function getDoaList($lang, $page_start) { if ($lang != '') { return table_data('q_doa', "doa_lang='{$lang}' limit {$page_start},10"); } return table_data('q_doa', "1 limit {$page_start},10"); }
function getHadithList($lang, $page_start) { if ($lang != '') { return table_data('q_hadith', "hadith_lang='{$lang}' limit {$page_start},10"); } return table_data('q_hadith', "1 limit {$page_start},10"); }
function connect_table($table_name){ //Подключаем .php файл внутрь этой функции require_once($_SERVER['DOCUMENT_ROOT']."/tables/$table_name.php"); //Возвращаем готовую табличку return table_data(); }
*/ $data = json_decode(file_get_contents("php://input")); if (!$data) { die; } $sub = mysql_real_escape_string($data->sub); if ($sub == 'addName') { // Add New Name $args = array('name_details' => $data->nameName, 'name_lang' => $data->nameLang); $chk = insert_data('q_allah_name', $args); if ($chk) { echo success_json(); } else { echo err_json(); } } else { if ($sub == 'getName') { // Get All Names print_r(table_data('q_allah_name')); } else { if ($sub == 'delName') { // Delete Name $chk = delete_data('q_allah_name', "name_id='" . $data->nameID . "'"); if ($chk) { echo success_json(); } else { echo err_json(); } } } }
function dump_all($data = false) { global $db_name; ob_cleanup(); define('DEBUG_CONSOLE_HIDE', 1); set_time_limit(0); $tables = list_tables(); $table_filter = get('table_filter'); $tables = table_filter($tables, $table_filter); header("Cache-control: private"); header("Content-type: application/octet-stream"); header('Content-Disposition: attachment; filename=' . date('Ymd') . '_' . $db_name . '.sql'); foreach ($tables as $key => $table) { table_structure($table); if ($data) { table_data($table); } flush(); } exit; }
<?php /** * SPA comment API * @author Shahriar * @version 1.0.1 */ session_start(); $data = json_decode(file_get_contents("php://input")); if (!$data) { die; } $sub = mysql_real_escape_string($data->sub); if ($sub == 'addComment') { // Add new comment date_default_timezone_set('Asia/Dhaka'); $args = array('postid' => $data->postid, 'viewer' => $data->name, 'comment' => $data->comment, 'comdate' => date("d-m-Y")); $chk = insert_data('comments', $args); if ($chk) { echo success_json(); } else { echo err_json('Submission error'); } } elseif ($sub == 'getComment') { // Get single post $chk = table_data("comments", "postid='" . $data->postid . "' order by comid desc"); print_r($chk); } else { echo err_json('Login Error'); }
/** * SPA user API * @author Shahriar * @version 1.0.1 */ session_start(); $data = json_decode(file_get_contents("php://input")); if (!$data) { die; } $sub = mysql_real_escape_string($data->sub); if ($sub == 'regUser') { // Add new user date_default_timezone_set('Asia/Dhaka'); $args = array('username' => $data->username, 'email' => $data->email, 'password' => md5($data->password), 'joindate' => date("d-m-Y")); $chk = insert_data('users', $args); if ($chk) { login_user($data); } else { echo err_json('Registration Error'); } } elseif ($sub == 'loginUser') { // user login login_user($data); } elseif ($sub == 'joinUser') { // user details $chk = table_data("users", "id='" . $data->uid . "'", "id,username,joindate"); print_r($chk); } else { echo err_json('Login Error'); }
function getSura($select, $serial, $type) { return table_data('q_sura', "sura_lang='" . $select . "' and sura_no='" . $serial . "' and sura_type='" . $type . "'", "sura_details"); }
function getSuraList($select, $page_start) { return table_data('q_sura', "sura_lang='" . $select . "' and sura_type='0' order by sura_no limit {$page_start},10", "sura_id,sura_no,sura_name,sura_info"); }
<?php /** * SPA post API * @author Shahriar * @version 1.0.1 */ session_start(); $data = json_decode(file_get_contents("php://input")); if (!$data) { die; } $sub = mysql_real_escape_string($data->sub); if ($sub == 'getPost') { // Get all posts print_r(table_data("post", "1 ORDER BY postid DESC")); } elseif ($sub == 'singlePost') { // Get single post $chk = table_data("post", "postid='" . $data->postid . "'"); print_r($chk); } else { echo err_json('Login Error'); }
function dump_all($data = false) { // @dump // @structure // @data GET("table_filter", "string"); global $db_driver, $db_server, $db_name; ob_cleanup(); define('DEBUG_CONSOLE_HIDE', 1); set_time_limit(0); $tables = list_tables(); $table_filter = $_GET["table_filter"]; $tables = table_filter($tables, $table_filter); header("Cache-control: private"); header("Content-type: application/octet-stream"); header('Content-Disposition: attachment; filename=' . $db_name . '.sql'); echo "--\n"; if ($data) { echo "-- Dump type: DATA & STRUCTURE\n"; } else { echo "-- Dump type: STRUCTURE ONLY\n"; } if ("sqlite" == $db_driver) { echo "-- Database file: {$db_server}\n"; } else { echo "-- Database: {$db_name}\n"; } $date = date("Y-m-d"); echo "-- Exported on: {$date}\n"; $version = DBKISS_VERSION; echo "-- Powered by: DBKiss (http://www.gosu.pl/dbkiss/)\n"; echo "--\n\n"; foreach ($tables as $key => $table) { echo "-- TABLE: \"{$table}\"\n\n"; table_structure($table); if ($data) { echo "-- INSERTS for: \"{$table}\"\n\n"; table_data($table); } flush(); } unset($table); $views = list_tables(true); foreach ($views as $key => $view) { echo "-- VIEW: \"{$view}\"\n\n"; table_structure($view, "view"); flush(); } echo "--\n"; echo "-- END OF DUMP\n"; echo "--\n"; exit; }
function JLMS_check_table_is_empty($table_name, $msg) { $out = array(); $out[] = ''; if (!table_data($table_name)) { $out[] = $msg; $status = 'ERROR: ' . $msg; JLMS_insert_log($table_name . " data", $status); } else { $out[] = ''; } return $out; }
* @author Shahriar * @version 1.0.1 */ $data = json_decode(file_get_contents("php://input")); if (!$data) { die; } $sub = mysql_real_escape_string($data->sub); if ($sub == 'addHadith') { // Add new hadith $args = array('hadith_book' => $data->hadithBook, 'hadith_ref' => $data->hadithRef, 'hadith_details' => $data->hadithDet, 'hadith_lang' => $data->hadithLang, 'hadith_type' => $data->hadithType); $chk = insert_data('q_hadith', $args); if ($chk) { echo success_json('Successfully added!'); } else { echo err_json('Insert failed!'); } } elseif ($sub == 'getHadith') { // Get all hadith list print_r(table_data('q_hadith', '1', 'hadith_id,hadith_book,hadith_ref,hadith_type,hadith_lang')); } elseif ($sub == 'delHadith') { // Delete hadith $chk = delete_data('q_hadith', "hadith_id='" . $data->hadithID . "'"); if ($chk) { echo success_json('Deleted!'); } else { echo err_json('Deletion failed!'); } } else { echo err_json(); }
* @author Shahriar * @version 1.0.1 */ $data = json_decode(file_get_contents("php://input")); if (!$data) { die; } $sub = mysql_real_escape_string($data->sub); if ($sub == 'addSura') { // Add new language $args = array('sura_id' => '', 'sura_no' => $data->suraNo, 'sura_name' => $data->suraName, 'sura_details' => isset($data->suraAyat) ? json_encode($data->suraAyat) : '', 'sura_info' => json_encode($data->suraInfo), 'sura_lang' => $data->suraLang, 'sura_type' => $data->suraType); $chk = insert_data('q_sura', $args); if ($chk) { success_json(); } else { err_json(); } } elseif ($sub == 'getSura') { // Get all sura list print_r(table_data('q_sura', '1', 'sura_id,sura_no,sura_name,sura_lang,sura_type')); } elseif ($sub == 'delSura') { // Delete sura $chk = delete_data('q_sura', "sura_id='" . $data->suraID . "'"); if ($chk) { success_json(); } else { err_json(); } } else { err_json(); }
/** * Single post sub comments * @param post id (int) * @return JSON object */ function sub_comments($postId, $tmp) { return json_decode(table_data("forum_comment inner join forum_user", "forum_comment.uid=forum_user.uid and post_id='{$postId}' and forum_comment.comment_root='{$tmp}'", "comment_id,comment_root,image,name,comment_desc,comment_date")); }
* @author Shahriar * @version 1.0.1 */ $data = json_decode(file_get_contents("php://input")); if (!$data) { die; } $sub = mysql_real_escape_string($data->sub); if ($sub == 'addDoa') { // Add New Doa $args = array('doa_name' => $data->doaName, 'doa_details' => $data->doaDet, 'doa_lang' => $data->doaLang, 'doa_type' => $data->doaType); $chk = insert_data('q_doa', $args); if ($chk) { echo success_json(); } else { echo err_json(); } } elseif ($sub == 'getDoa') { // Get all Doa list print_r(table_data('q_doa', '1', 'doa_id,doa_name,doa_type,doa_lang')); } elseif ($sub == 'delDoa') { // Delete Doa $chk = delete_data('q_Doa', "doa_id='{$data->doaID}'"); if ($chk) { success_json(); } else { echo err_json(); } } else { echo err_json(); }
*/ $data = json_decode(file_get_contents("php://input")); if (!$data) { die; } $sub = mysql_real_escape_string($data->sub); if ($sub == 'addLang') { // Add new language $args = array('lang_name' => $data->langName); $chk = insert_data('q_lang', $args); if ($chk) { success_json(); } else { err_json(); } } else { if ($sub == 'getLang') { // Get all language print_r(table_data('q_lang')); } else { if ($sub == 'delLang') { // Delete language $chk = delete_data('q_lang', "lang_id='" . $data->langID . "'"); if ($chk) { success_json(); } else { err_json(); } } } }