Example #1
0
<?php

if (!defined('ROOT')) {
    exit('No direct script access allowed');
}
$arr = array();
$arr["TIMESTAMP"] = _timestamp(false);
$arr["SITE"] = SITENAME;
$arr["SERVER"] = $GLOBALS['LOGIKS']["_SERVER"]["HTTP_HOST"];
$arr["SERVER SOFTWARE"] = $GLOBALS['LOGIKS']["_SERVER"]["SERVER_SOFTWARE"];
//$arr["HTTPS"]=$GLOBALS['LOGIKS']["_SERVER"]["HTTPS"];
//printArray($GLOBALS['LOGIKS']["_SERVER"]);
printServiceMsg($arr);
Example #2
0
} else {
    printDefaultAvatar();
}
$method = "email";
if (isset($_REQUEST['method'])) {
    $method = $_REQUEST['method'];
}
if (!in_array($method, $avlMethods)) {
    printServiceErrorMsg("Method Not Supported");
    //printDefaultAvatar();
    exit;
}
//printArray($_REQUEST);exit($method);
if (isset($_REQUEST['action'])) {
    if ($_REQUEST['action'] == "src") {
        printServiceMsg($avlMethods);
    } else {
        printAvatarPhoto($method);
    }
} else {
    printAvatarPhoto($method);
}
function printAvatarPhoto($method)
{
    if (isset($_REQUEST['authorid']) && strlen($_REQUEST['authorid']) > 0) {
        $authorid = explode("@", $_REQUEST['authorid']);
        $authorid = $authorid[0];
        if ($method == "facebook") {
            //$url="http://graph.facebook.com/{$authorid}/picture?type=large";//?redirect=false
            $url = "http://avatars.io/facebook/{$authorid}/large";
            $data = file_get_contents($url);
Example #3
0
     } else {
         printServiceMsg("error");
     }
     break;
 case "check-title":
     if (isset($_REQUEST['title']) || isset($_REQUEST['title'])) {
         $status = checkTitle($_REQUEST['title']);
         printServiceMsg($status);
     } else {
         printServiceMsg("error");
     }
     break;
 case "get-tags":
     //if(isset($_REQUEST['tags']) || isset($_REQUEST['tags']) ) {
     $tags = getTags($_REQUEST['tags']);
     printServiceMsg($tags);
     //}else{
     // printServiceMsg("error");
     // }
     break;
 case 'upload-tmp-file':
     checkServiceSession();
     if ($_FILES['file']) {
         $result = uploadTmpFile();
         echo json_encode($result);
     }
     break;
 case 'approve-api':
     checkServiceSession();
     if (isset($_REQUEST['apid'])) {
         $sql = _db()->_updateQ("api_toc", array("approved" => "true", "approved_on" => date("Y-m-d H:i:s"), "approver" => $_SESSION['SESS_USER_ID'], "userid" => $_SESSION['SESS_USER_ID'], "dtoe" => date("Y-m-d H:i:s")), array("id" => $_POST['apid']));
Example #4
0
 case "fetch-category":
     $guides_cat = getCategory();
     printServiceMsg($guides_cat);
     break;
 case "search-list":
     if (isset($_REQUEST['q'])) {
         $api_list = searchList($_REQUEST['q']);
         printServiceMsg($api_list);
     } else {
         printServiceMsg(array());
     }
     break;
 case "create-guide":
     checkServiceSession();
     $status = saveGuide();
     printServiceMsg($status);
     break;
 case "publish-guide":
     checkServiceSession();
     if (isset($_POST['gid'])) {
         $sql = _db()->_updateQ("guides_tbl", array("status" => "published", "approved" => "false", "userid" => $_SESSION['SESS_USER_ID'], "dtoe" => date("Y-m-d H:i:s")), array("id" => $_POST['gid']));
         $res = _dbQuery($sql);
         if ($res) {
             echo "success";
         } else {
             echo "Sorry, couldn't publish your article, try again later.";
         }
     } else {
         printServiceErrorMsg(501, "GID Missing");
     }
     break;
Example #5
0
function loadForm()
{
    $dataPost = $_POST;
    if (isset($dataPost["frmID"])) {
        $sForm = $dataPost["frmID"];
        unset($dataPost["frmID"]);
    } else {
        $sForm = null;
    }
    $sTable = "";
    $sWhere = "";
    $sCols = "";
    $sql = "";
    if ($sForm != null && strlen($sForm) > 0) {
        $tbl = _dbtable("forms");
        $sql = "SELECT submit_table,submit_wherecol,datatable_cols FROM {$tbl} WHERE id={$sForm} AND blocked='false'";
        $res1 = _dbQuery($sql);
        if ($res1 && _db()->recordCount($res1) > 0) {
            $data = _db()->fetchData($res1);
            $sTable = $data["submit_table"];
            $sWhere = $data["submit_wherecol"];
            $sCols = $data["datatable_cols"];
        }
    } elseif (isset($dataPost["submit_table"]) && isset($dataPost["submit_wherecol"])) {
        $sTable = $dataPost["submit_table"];
        $sWhere = $dataPost["submit_wherecol"];
        if (isset($dataPost["frmCols"])) {
            $sCols = $dataPost["frmCols"];
            unset($dataPost["frmCols"]);
        }
        unset($dataPost["submit_table"]);
        unset($dataPost["submit_wherecol"]);
    } elseif (isset($dataPost["table"]) && isset($dataPost["wherecols"])) {
        $sTable = $dataPost["table"];
        $sWhere = $dataPost["wherecols"];
        if (isset($dataPost["cols"])) {
            $sCols = $dataPost["cols"];
            unset($dataPost["cols"]);
        }
        unset($dataPost["table"]);
        unset($dataPost["wherecols"]);
    }
    $sWhere = explode(",", $sWhere);
    $arr = array();
    foreach ($sWhere as $a => $b) {
        if (isset($dataPost[$b])) {
            $arr[$b] = $dataPost[$b];
        }
    }
    $sWhere = $arr;
    $sWhere = generateWhere($sWhere);
    $tblCols = _db()->getTableInfo($sTable);
    $arrCols = array();
    foreach ($tblCols[0] as $a => $b) {
        $arrCols[$b] = $tblCols[1][$a];
    }
    $tblCols = $arrCols;
    if ($sCols == null && strlen(trim($sCols)) <= 0) {
        $sCols = array();
        foreach ($dataPost as $a => $b) {
            if (array_key_exists($a, $tblCols)) {
                array_push($sCols, $a);
            }
        }
        $sCols = implode(",", $sCols);
    } else {
        $tempCols = explode(",", $sCols);
        $sCols = array();
        foreach ($tempCols as $a) {
            if (array_key_exists($a, $tblCols)) {
                array_push($sCols, $a);
            }
        }
        $sCols = implode(",", $sCols);
    }
    if (strlen($sCols) <= 0) {
        exit("");
    }
    $sql = "SELECT {$sCols} FROM {$sTable}";
    if (strlen($sWhere) > 0) {
        $sql .= " WHERE {$sWhere}";
    }
    $res1 = _dbQuery($sql);
    if ($res1 && _db()->recordCount($res1) > 0) {
        $data = _db()->fetchData($res1);
        foreach ($data as $a => $b) {
            if ($b == null || $b == "null") {
                $data[$a] = "";
            } elseif ($tblCols[$a] == "date") {
                $data[$a] = _pDate($b);
            } elseif ($tblCols[$a] == "datetime") {
                $b = explode(" ", $b);
                $data[$a] = _pDate($b[0]) . " {$b[1]}";
            }
        }
        if (!isset($_REQUEST["format"])) {
            $_REQUEST["format"] = "json";
        }
        //printFormattedArray($data);
        printServiceMsg($data);
    }
}