Esempio n. 1
0
 $currentArticle = $data[0];
 if ($currentArticle == NULL || !isset($currentArticle['articleId']) || !$currentArticle['articleId'] > 0) {
     die("该文章不存在");
 }
 $pageId = validateId(htmlspecialchars($_POST["pageId"]));
 date_default_timezone_set("Asia/Chongqing");
 $now = date("Y-m-d H:i:s");
 $type = 0;
 $picturePath = "";
 if (isset($_POST['isTopArticle'])) {
     $type = 1;
     if (empty($_FILES['topArticlePicture']['name'])) {
         //没有修改置顶图片
         $picturePath = $currentArticle['picturePath'];
     } else {
         $picturePath = saveImageFile("topArticlePicture", "picture/");
         //新的置顶图片上传,删除原来图片
         if ($currentArticle['type'] == 1) {
             deleteFile($currentArticle['picturePath']);
         }
     }
 } else {
     //这不是置顶文章,或者这被改为不是置顶文章
     //需要删除原先的置顶图片
     if ($currentArticle['type'] == 1) {
         deleteFile($currentArticle['picturePath']);
     }
 }
 $title = validateText(htmlspecialchars($_POST["title"]));
 $author = validateText(htmlspecialchars($_POST["author"]));
 $content = validateText($_POST["content"]);
Esempio n. 2
0
    $keys = array_keys($put_vars);
    $values = array_values($put_vars);
    $value = rest_post($keys, $values);
    exit(json_encode($value));
});
$app->put('/profile/:id', function ($id) use($app) {
    include 'profile.php';
    $put_vars = $app->request->put();
    $keys = array_keys($put_vars);
    $values = array_values($put_vars);
    $value = rest_put($id, $keys, $values);
    exit(json_encode($value));
});
$app->post('/profile/image', function () use($app) {
    include 'putProfileImage.php';
    $value = saveImageFile();
    exit(json_encode($value));
});
$app->post('/profile/image/update', function () use($app) {
    include 'putProfileImage.php';
    $value = updateImageFile($app->request->post('filename_old'));
    exit(json_encode($value));
});
$app->get('/thumbImageList/:category(/)(/:timeStamp)', function ($category, $timeStamp = NULL) {
    include __DIR__ . '\\image_test\\thumbnailImage.php';
    if (isset($timeStamp)) {
        $value = rest_get_image_list_by_timestamp($category, $timeStamp);
    } else {
        $value = rest_get_image_list($category);
    }
    exit(json_encode($value));