Exemple #1
0
<?php
require('lib.php');
 
  
$json = array();

$sql = mysql_query("SELECT * from locations order by label");

while ($row = mysql_fetch_assoc($sql)) {
    $loc = array(
    	'id'=> $row['id'],
    	'name'=> $row['label'],
    	'lat'=>$row['latitude'],
    	'lng'=>$row['longitude']
	);
	$json[] = $loc;
}
 

jsonOutput($json);

?>
Exemple #2
0
<?php
require('lib.php');


$json = array();

$sql = mysql_query("SELECT * from clothes order by name ASC");

while ($row = mysql_fetch_assoc($sql)) {
	$name = array(
		'id'=> $row['id'],
		'name'=> $row['name']
	);
	$json[] = $name;
}

header('Content-type: application/x-javascript');


echo "var clothes =";
jsonOutput($json, false);
echo ";";
?>
Exemple #3
0
}
if ($action == 'edit') {
    if (!$g_user->hasPermission('plugin_soundcloud_update')) {
        jsonOutput(null, array('title' => getGS('Error'), 'text' => getGS('You do not have the right to update SoundCloud tracks.'), 'type' => 'error'));
        exit;
    }
    $track = $soundcloud->trackLoad($track);
    if (empty($track)) {
        jsonOutput(null, array('title' => getGS('Edit error'), 'text' => getGS('Track not found'), 'type' => 'error'));
        exit;
    }
    $track['release_date'] = empty($track['release_year']) ? '' : "{$track['release_year']}-{$track['release_month']}-{$track['release_day']}";
    ob_start();
    require_once 'templates/edit.php';
    $content = ob_get_clean();
    jsonOutput($content, $message, $js, $otherParams);
}
function jsonOutput($content, $message = array(), $js = null, $otherParams = array(), $json = true)
{
    if ($json) {
        header('Content-Type: application/json');
    }
    $output = array();
    if ($content) {
        $output['html'] = $content;
    }
    if ($message) {
        $output['message'] = $message;
    }
    if ($js) {
        $output['js'] = $js;
Exemple #4
0
         $navinfos = J::t('nav')->fetch_all();
         foreach ($navinfos as $k => $v) {
             if ($v['pid'] == 0) {
                 $pinfos[$v['id']] = $v;
             } else {
                 $group[$v['pid']][] = $v;
             }
         }
         foreach (multi_array_sort($pinfos, 'displayorder') as $k => $v) {
             $sortpinfos[$v['id']] = $v;
         }
         foreach ($group as $k => $v) {
             $sortpinfos[$k]['downnav'] = multi_array_sort($v, 'displayorder');
         }
         J::t('setting')->replace('nav', $sortpinfos);
         jsonOutput($return);
     }
     exit;
 } else {
     if (empty($_B['setting']['nav'])) {
         $navinfos = J::t('nav')->fetch_all();
         foreach ($navinfos as $k => $v) {
             if ($v['pid'] == 0) {
                 $pinfos[$v['id']] = $v;
             } else {
                 $group[$v['pid']][] = $v;
             }
         }
         foreach (multi_array_sort($pinfos, 'displayorder') as $k => $v) {
             $sortpinfos[$v['id']] = $v;
         }
Exemple #5
0
        if ($errorcode < 0) {
            $data = $upload->errormsg();
            @unlink($file['target']);
            jsonOutput(2, $data);
        }
        //判断是否开启了exif,并获取照片的exif信息
        $my_exif = array();
        if (extension_loaded('exif') && extension_loaded('mbstring')) {
            $my_exif = exif_read_data($file['target'], "EXIF");
        }
        $image = new class_image($file['target']);
        $image->exif = $my_exif;
        $status = $image->Thumb();
        if ($status <= 0) {
            $data = $image->errormsg($status);
            @unlink($file['target']);
            jsonOutput(2, $data);
        }
        $insert = array('uid' => $_B['uid'], 'aid' => 0, 'path' => $file['imgurl'], 'type' => 'article', 'size' => $image->imginfo['size'], 'width' => $image->imginfo['width'], 'height' => $image->imginfo['height'], 'thumbH' => $image->imginfo['thumbH'], 'status' => 0, 'dateline' => TIMESTAMP);
        $aid = J::t('image')->insert($insert, true);
        if (!is_numeric($aid) || $aid <= 0) {
            @unlink($file['target']);
            jsonOutput(2, '上传失败  0071');
        }
        $data['url'] = $_B['siteurl'] . $file['imgurl'] . '.thumb.jpg';
        $data['aid'] = $aid;
        jsonOutput(1, $data);
        break;
    case 'view':
    case 'new':
}
Exemple #6
0
    $assn_json = json_decode($row['json']);
    $assn_id = $row['assn_id'];
}
if ($assn_id == false) {
    jsonError('This assignment is not yet set up');
    return;
}
// Compute the user's grade
$grade = computeGrade($assn_id, $assn_json, $user_id);
if ($grade <= 0) {
    jsonError('Nothing to grade for this user', $row);
    return;
}
// Lookup the result row if we are grading the non-current user
$result = false;
if ($user_id != $USER->id) {
    $result = lookupResult($LTI, $user_id);
}
// Send the grade
$debug_log = array();
$status = LTIX::gradeSend($grade, $result, $debug_log);
// This is the slow bit
if ($status === true) {
    if ($user_id != $USER->id) {
        jsonOutput(array("status" => $status, "debug" => $debug_log));
    } else {
        jsonOutput(array("status" => $status, "grade" => $grade, "debug" => $debug_log));
    }
} else {
    jsonError($status, $debug_log);
}
Exemple #7
0
        jsonOutput(2, '数据出错,请刷新重试');
    }
    $aid = $_GET['aid'];
    $comlimit = 30;
    $start = ($_B['page'] - 1) * $comlimit;
    $comlist = J::t('comment')->fetch_list('*', "classify='article' AND aid={$aid} AND `status`=1", $start, $comlimit);
    $next = '';
    if ($comlist) {
        require_once libfile('article');
        foreach ($comlist as $k => $v) {
            $comlist[$k]['formattime'] = btime($v['dateline'], 1);
            $comlist[$k]['time'] = btime($v['dateline']);
            $comlist[$k]['avatar'] = IMGDIR . 'jam.png';
            $comlist[$k]['content'] = ubb2html($v['content']);
        }
        if (count($comlist) >= $comlimit) {
            $next = 'index.php?m=comment&do=get&aid=' . $aid . '&page=' . ($_B['page'] + 1);
        }
    }
    $data['content'] = display('_comment', 0, true, array('comlist' => $comlist));
    $data['next'] = $next;
    jsonOutput(1, $data);
} elseif ($do == 'zan') {
    if (!$_B['ajax']) {
        jsonOutput(2, '不允许的操作');
    }
    if (!is_numeric($_GET['cid']) || $_GET['cid'] <= 0) {
        jsonOutput(2, '数据出错,请刷新重试');
    }
    jsonOutput(1, -1);
}
	$outformat = html_entity_decode($outformat);
?>
<?php
	try { $db = new PDO('sqlite:./otc/RatingSystem.db'); }
	catch (PDOException $e) { die($e->getMessage()); }

	include('querytojson.php');
	if ($outformat == 'json'){
		$signqueries = array('ANY' => ' ', 'POS' => ' AND ratings.rating > 0', 'NEG' => ' AND ratings.rating < 0');
		$typequeries = array('RECV' => "users2.nick LIKE ? ESCAPE '|' AND users2.id = ratings.rated_user_id AND users.id = ratings.rater_user_id", 'SENT' => "users.nick LIKE ? ESCAPE '|' AND users.id = ratings.rater_user_id AND users2.id = ratings.rated_user_id");
		$sql = "SELECT ratings.id as id, users.nick as rater_nick, users2.nick as rated_nick, ratings.created_at as created_at, ratings.rating as rating, ratings.notes as notes from users, users as users2, ratings WHERE " . $typequeries[$type] . $signqueries[$sign];
		$sth = $db->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY));
		$sth->setFetchMode(PDO::FETCH_ASSOC);
		$sth->execute(array($nickfilter));
		if (!$sth) echo "[]";
		else	jsonOutput($sth);
		exit();
	}
	
?>

<!DOCTYPE html>

<?php
 $pagetitle = "Rating Details for User '" . htmlentities($nick) . "'";
 include("header.php");
?>

<div class="breadcrumbs">
<a href="/">Home</a> &rsaquo;
<a href="trust.php">Web of Trust</a> &rsaquo;
Exemple #9
0
         }
         $insert = array('subject' => $subject, 'content' => $res_content['content'], 'authorid' => $_B['uid'], 'author' => $_B['username'], 'dateline' => TIMESTAMP, 'image' => $image, 'views' => 1);
         $aid = J::t('article')->insert($insert);
         if ($aid && $image) {
             $str_ids = join(',', $res_content['image']);
             J::t('image')->update(array('aid' => $aid, 'status' => 1), "uid=" . $_B['uid'] . " AND id IN({$str_ids})");
             $data = $_B['siteurl'] . 'index.php?m=article&do=view&id=' . $aid;
         } else {
             if (!$aid) {
                 $status = 2;
                 $data = '添加失败';
             } else {
                 $data = '添加成功';
             }
         }
         jsonOutput($status, $data);
     }
     if (!$_B['uid']) {
         shownotice('请先登录', array('referer' => $_B['referer']));
     }
     $navtitle = $_B['setting']['blog']['blogName'] . ' - 写文章';
     $defaultcontent = '';
     break;
 case 'update':
     if ($_B['ajax'] && $_GET['type'] == 'update') {
     }
     $aid = $_GET['aid'] ?: 0;
     if (!$aid || !is_numeric($aid)) {
         shownotice('该文章不存在', array('referer' => $_B['referer']));
     }
     $article = J::t('article')->find_by_pk($aid);