Esempio n. 1
0
function ajaxCheckCoupon($vars)
{
    global $db, $config;
    $coupon = htmlentities($vars['coupon']);
    $res = array('msg' => '', 'errorCode' => 0);
    $ret = $db->coupon_get($vars['coupon']);
    if (!is_array($ret) || !$ret['coupon_id']) {
        $res['msg'] = $ret;
        $res['errorCode'] = 1;
    }
    return ajaxResponse($res);
}
Esempio n. 2
0
    case 'xml NOT CURRENTLY SUPPORTED':
        header("Content-type: application/xml");
        echo '<?xml version="1.0" encoding="iso-8859-1"?>' . "\n";
        echo "<" . strtolower($_REQUEST['entity']) . ">\n";
        foreach ($data as $key => $value) {
            $key = strtolower($key);
            echo "<{$key}>" . htmlentities($value) . "</{$key}>\n";
        }
        echo "</" . strtolower($_REQUEST['entity']) . ">\n";
        break;
    case 'json':
        $response = array(strtolower(validJsStr($_REQUEST['entity'])) => $data);
        if (isset($_REQUEST['loopback'])) {
            $response['loopback'] = validJsStr($_REQUEST['loopback']);
        }
        ajaxResponse($response);
        break;
    case 'text':
        header("Content-type: text/plain");
        echo join(" ", array_values($data));
        break;
}
function getFrameImage()
{
    $eventId = $_REQUEST['id'][0];
    $frameId = $_REQUEST['id'][1];
    $sql = 'select * from Frames where EventId = ? and FrameId = ?';
    if (!($frame = dbFetchOne($sql, NULL, array($eventId, $frameId)))) {
        $frame = array();
        $frame['EventId'] = $eventId;
        $frame['FrameId'] = $frameId;
Esempio n. 3
0
} elseif ($action == "start") {
    //获取任务开始链接
    list($bool, $message, $link) = $jobService->jobStartController($winduid, $id);
    if (!$bool) {
        refreshto("jobcenter.php?action=applied", $message);
    }
    if ($link == "") {
        refreshto("jobcenter.php?action=applied", "任务开始");
    } else {
        ObHeader($link);
    }
} elseif ($action == "gain") {
    if ($step == 2) {
        $id = intval($id);
        list($bool, $message) = $jobService->jobGainController($winduid, $id);
        if ($bool) {
            $jobService->jobAutoController($winduid, $groupid);
            /*自动申请*/
            $appliedHTML = $jobService->buildApplieds($winduid, $groupid);
            ajaxResponse($message, true, $appliedHTML);
        } else {
            ajaxResponse($message, false);
        }
    }
} else {
}
function ajaxResponse($message, $flag, $html = '')
{
    echo '[{"message":\'' . $message . '\',"flag":\'' . $flag . '\',"html":\'' . $html . '\'}]';
    ajax_footer();
}
Esempio n. 4
0
function actionGetWinner()
{
    $db = new DB();
    ajaxResponse(array('winner' => $db->getWinner()));
}
Esempio n. 5
0
                fwrite($exportFP, '  <columns>
    <column field="datetime">' . translate('DateTime') . '</column><column field="component">' . translate('Component') . '</column><column field="pid">' . translate('Pid') . '</column><column field="level">' . translate('Level') . '</column><column field="message">' . translate('Message') . '</column><column field="file">' . translate('File') . '</column><column field="line">' . translate('Line') . '</column>
  </columns>
  <logs count="' . count($logs) . '">
');
                foreach ($logs as $log) {
                    fprintf($exportFP, "    <log>\n      <datetime>%s</datetime>\n      <component>%s</component>\n      <pid>%d</pid>\n      <level>%s</level>\n      <message><![CDATA[%s]]></message>\n      <file>%s</file>\n      <line>%d</line>\n    </log>\n", $log['DateTime'], $log['Component'], $log['Pid'], $log['Code'], utf8_decode($log['Message']), $log['File'], $log['Line']);
                }
                fwrite($exportFP, '  </logs>
</logexport>');
                break;
                $exportExt = "xml";
                break;
        }
        fclose($exportFP);
        ajaxResponse(array('key' => $exportKey, 'format' => $format));
        break;
    case 'download':
        if (!canView('System')) {
            ajaxError('Insufficient permissions to download logs');
        }
        if (empty($_REQUEST['key'])) {
            Fatal("No log export key given");
        }
        $exportKey = $_REQUEST['key'];
        if (empty($_REQUEST['format'])) {
            Fatal("No log export format given");
        }
        $format = $_REQUEST['format'];
        switch ($format) {
            case 'text':
Esempio n. 6
0
<?php

if (empty($_POST) || !isset($_POST)) {
    ajaxResponse('error', 'Post cannot be empty.');
} else {
    $postData = $_POST;
    $dataString = implode($postData, ",");
    $mailgun = sendMailgun($postData);
    if ($mailgun) {
        ajaxResponse('success', 'Great success.', $postData, $mailgun);
    } else {
        ajaxResponse('error', 'Mailgun did not connect properly.', $postData, $mailgun);
    }
}
function ajaxResponse($status, $message, $data = NULL, $mg = NULL)
{
    $response = array('status' => $status, 'message' => $message, 'data' => $data, 'mailgun' => $mg);
    $output = json_encode($response);
    exit($output);
}
function sendMailgun($data)
{
    $api_key = 'key-251e44030015d9690768cc872bf8025d';
    $api_domain = 'genisys.io';
    $send_to = '*****@*****.**';
    // $name = $data['name'];
    $email = $data['email'];
    // $content = $data['message'];
    // $messageBody = "Contact: $name ($email)\n\nMessage: $content";
    $messageBody = "Genisys subscriber: {$email}";
    $config = array();
Esempio n. 7
0
            }
            break;
    }
}
if (canEdit('Events')) {
    switch ($_REQUEST['action']) {
        case "rename":
            if (!empty($_REQUEST['eventName'])) {
                dbQuery('UPDATE Events SET Name = ? WHERE Id = ?', array($_REQUEST['eventName'], $_REQUEST['id']));
            } else {
                ajaxError("No new event name supplied");
            }
            ajaxResponse(array('refreshEvent' => true, 'refreshParent' => true));
            break;
        case "eventdetail":
            dbQuery('UPDATE Events SET Cause = ?, Notes = ? WHERE Id = ?', array($_REQUEST['newEvent']['Cause'], $_REQUEST['newEvent']['Notes'], $_REQUEST['id']));
            ajaxResponse(array('refreshEvent' => true, 'refreshParent' => true));
            break;
        case "archive":
        case "unarchive":
            $archiveVal = $_REQUEST['action'] == "archive" ? 1 : 0;
            dbQuery('UPDATE Events SET Archived = ? WHERE Id = ?', array($archiveVal, $_REQUEST['id']));
            ajaxResponse(array('refreshEvent' => true, 'refreshParent' => false));
            break;
        case "delete":
            deleteEvent($_REQUEST['id']);
            ajaxResponse(array('refreshEvent' => false, 'refreshParent' => true));
            break;
    }
}
ajaxError('Unrecognised action or insufficient permissions');
Esempio n. 8
0
                }
            }
            $option_string = jsonEncode($options);
            if (!socket_write($socket, $option_string)) {
                ajaxError("socket_write() failed: " . socket_strerror(socket_last_error()));
            }
            ajaxResponse('Used socket');
            //socket_close( $socket );
        } else {
            $ctrlCommand .= " --id=" . $monitor['Id'];
            // Can't connect so use script
            $ctrlStatus = '';
            $ctrlOutput = array();
            exec(escapeshellcmd($ctrlCommand), $ctrlOutput, $ctrlStatus);
            if ($ctrlStatus) {
                ajaxError($ctrlCommand . '=>' . join(' // ', $ctrlOutput));
            }
            ajaxResponse('Used script');
        }
    } else {
        ajaxError("No command received");
    }
}
ajaxError('Unrecognised action or insufficient permissions');
function ajaxCleanup()
{
    global $socket;
    if (!empty($socket)) {
        @socket_close($socket);
    }
}
Esempio n. 9
0
$data = unpack("ltype", $msg);
switch ($data['type']) {
    case MSG_DATA_WATCH:
        $data = unpack("ltype/imonitor/istate/dfps/ilevel/irate/ddelay/izoom/Cdelayed/Cpaused/Cenabled/Cforced", $msg);
        $data['fps'] = sprintf("%.2f", $data['fps']);
        $data['rate'] /= RATE_BASE;
        $data['delay'] = sprintf("%.2f", $data['delay']);
        $data['zoom'] = sprintf("%.1f", $data['zoom'] / SCALE_BASE);
        ajaxResponse(array('status' => $data));
        break;
    case MSG_DATA_EVENT:
        $data = unpack("ltype/ievent/iprogress/irate/izoom/Cpaused", $msg);
        //$data['progress'] = sprintf( "%.2f", $data['progress'] );
        $data['rate'] /= RATE_BASE;
        $data['zoom'] = sprintf("%.1f", $data['zoom'] / SCALE_BASE);
        ajaxResponse(array('status' => $data));
        break;
    default:
        ajaxError("Unexpected received message type '{$type}'");
}
ajaxError('Unrecognised action or insufficient permissions');
function ajaxCleanup()
{
    global $socket, $locSockFile;
    if (!empty($socket)) {
        @socket_close($socket);
    }
    if (!empty($locSockFile)) {
        @unlink($locSockFile);
    }
}
Esempio n. 10
0
<?php

if (empty($_REQUEST['mid'])) {
    ajaxError('No monitor id supplied');
} elseif (!isset($_REQUEST['zid'])) {
    ajaxError('No zone id(s) supplied');
}
if (canView('Monitors')) {
    switch ($_REQUEST['action']) {
        case "zoneImage":
            $wd = getcwd();
            chdir(ZM_DIR_IMAGES);
            $hiColor = '0x00ff00';
            $command = getZmuCommand(" -m " . $_REQUEST['mid'] . " -z");
            if (!isset($_REQUEST['zid'])) {
                $_REQUEST['zid'] = 0;
            }
            $command .= "'" . $_REQUEST['zid'] . ' ' . $hiColor . ' ' . $_REQUEST['coords'] . "'";
            $status = exec(escapeshellcmd($command));
            chdir($wd);
            $monitor = dbFetchOne('SELECT * FROM Monitors WHERE Id = ?', NULL, array($_REQUEST['mid']));
            $points = coordsToPoints($_REQUEST['coords']);
            ajaxResponse(array('zoneImage' => ZM_DIR_IMAGES . '/Zones' . $monitor['Id'] . '.jpg?' . time(), 'selfIntersecting' => isSelfIntersecting($points), 'area' => getPolyArea($points)));
            break;
    }
}
ajaxError('Unrecognised action or insufficient permissions');
Esempio n. 11
0
function showUsersCount($vars)
{
    global $db;
    $cnt = $db->query_one("select count(*) from {$db->config['prefix']}members");
    ajaxResponse(array('msg' => $cnt, 'errorCode' => 0));
}
Esempio n. 12
0
            ajaxResponse('您所在用户组没有打卡的权限', false);
        }
        list($todayStart, $todayEnd) = array($tdtime, $tdtime + 86400);
        if ($winddb['punch'] > $todayStart && $winddb['punch'] < $todayEnd) {
            ajaxResponse('你已经打卡,请明天再试', false);
        }
        if (procLock('punch_save', $winduid)) {
            if (pwQuery::update('pw_memberdata', 'uid=:uid', array($winduid), array('punch' => $timestamp))) {
                list($bool, $information, $continues) = getPunchReward($o_punch_reward);
            }
        }
        procUnLock('punch_save', $winduid);
        if ($bool) {
            ajaxResponse("{$information}\t{$continues}", true);
        } else {
            ajaxResponse('打卡失败,请明天继续!', false);
        }
    }
} else {
}
function ajaxResponse($message, $flag, $html = '')
{
    echo '[{"message":\'' . $message . '\',"flag":\'' . $flag . '\',"html":\'' . $html . '\'}]';
    ajax_footer();
}
/*
 * 打卡领取奖励
 */
function getPunchReward($reward)
{
    global $credit, $winduid, $windid;
Esempio n. 13
0
function change_affiliate($member_id, $aff_id)
{
    global $db;
    $member = $db->get_user($member_id);
    if (!$member) {
        ajaxResponse(array("msg" => "User not found!", "errorCode" => 1));
    } else {
        $member[aff_id] = $aff_id;
        $db->update_user($member['member_id'], $member);
        ajaxResponse(array("msg" => "Success", "errorCode" => 0));
    }
}
Esempio n. 14
0
<?php

define("MSG_TIMEOUT", 2.0);
define("MSG_DATA_SIZE", 4 + 256);
if (canEdit('Monitors')) {
    $zmuCommand = getZmuCommand(" -m " . validInt($_REQUEST['id']));
    switch (validJsStr($_REQUEST['command'])) {
        case "disableAlarms":
            $zmuCommand .= " -n";
            break;
        case "enableAlarms":
            $zmuCommand .= " -c";
            break;
        case "forceAlarm":
            $zmuCommand .= " -a";
            break;
        case "cancelForcedAlarm":
            $zmuCommand .= " -c";
            break;
        default:
            ajaxError("Unexpected command '" . validJsStr($_REQUEST['command']) . "'");
    }
    ajaxResponse(exec(escapeshellcmd($zmuCommand)));
}
ajaxError('Unrecognised action or insufficient permissions');
Esempio n. 15
0
\t\t\t\t\t<div class='modalButtonsHolder'>
\t\t\t\t\t\t<a href='http://BITUnOfficial.com/chat'><div class='modalYesButton'>Yes! I want to chat!</div></a>
\t\t\t\t\t\t<div class='modalCloseButton'>Nah</div>
\t\t\t\t\t</div>
\t\t\t\t</div>
\t\t\t</div>
TILL_END;
}
?>
            <section>
				
                <div id="content">
                    <h2>Home : BIT Unofficial - Your Access to everything BIT</h2>
                    <?php 
include 'include/newCon.php';
ajaxResponse(1, TRUE);
?>
            </div> <!-- End of content div -->
            <?php 
right();
?>
	
        </section>
        <?php 
footer();
?>
        <img src='Images/loading.gif' style="display:none;">
        <script type="text/javascript">
            document.addEventListener("scroll",sendRequest,false);
            
            var xmlhttp = new XMLHttpRequest();
Esempio n. 16
0
 public function delete_product_instance_alias()
 {
     $output = [];
     try {
         if (isset($_POST['pia_id']) && ($piaId = trim($_POST['pia_id'])) !== '') {
             $success = $this->product->deleteProductInstanceAlias($piaId);
             if (!$success) {
                 throw new Exception('Delete Query Failed');
             }
             $output['status'] = $success;
             $output['message'] = 'Alias Deleted';
             $output['data'] = [];
         } else {
             throw new Exception('No Product Instance Alias Info provided. Failed to Delete');
         }
     } catch (Exception $ex) {
         $output['message'] = $ex->getMessage();
         $output['status'] = false;
     }
     ajaxResponse($output);
 }