$road_map_id = prepareIdIn($road_map_id, $host);
 $road_map_id = mysql_real_escape_string($road_map_id);
 $ReturnObject = array();
 $Query = "SELECT * FROM road_map WHERE road_map_id = " . $road_map_id;
 $DatabaseResult = mysql_query($Query) or die('Query failed: ' . mysql_error());
 while ($Database = mysql_fetch_assoc($DatabaseResult)) {
     $road_map_id = $Database['road_map_id'];
     $title = $Database['title'];
     $image = $Database['image'];
     $header = $Database['header'];
     $footer = $Database['footer'];
     $KeysQuery = "SELECT * from keys k";
     $KeysQuery .= " WHERE road_map_id = " . $road_map_id;
     $KeysQuery .= " ORDER BY name ASC";
     $KeysResults = mysql_query($KeysQuery) or die('Query failed: ' . mysql_error());
     $road_map_id = prepareIdOut($road_map_id, $host);
     $F = array();
     $F['road_map_id'] = $road_map_id;
     $F['title'] = $title;
     $F['image'] = $image;
     $F['header'] = $header;
     $F['footer'] = $footer;
     // Keys
     $F['keys'] = array();
     while ($Keys = mysql_fetch_assoc($KeysResults)) {
         $name = $Keys['name'];
         $description = $Keys['description'];
         $K = array();
         $K['name'] = $name;
         $K['description'] = $description;
         array_push($F['keys'], $K);
<?php

$route = '/url/:url_id/tags/:tag/';
$app->delete($route, function ($url_id, $tag) use($app) {
    $host = $_SERVER['HTTP_HOST'];
    $url_id = prepareIdIn($url_id, $host);
    $ReturnObject = array();
    $request = $app->request();
    $param = $request->params();
    if ($tag != '') {
        $url_id = trim(mysql_real_escape_string($url_id));
        $tag = trim(mysql_real_escape_string($tag));
        $CheckTagQuery = "SELECT Tag_ID FROM tags where Tag = '" . $tag . "'";
        $CheckTagResults = mysql_query($CheckTagQuery) or die('Query failed: ' . mysql_error());
        if ($CheckTagResults && mysql_num_rows($CheckTagResults)) {
            $Tag = mysql_fetch_assoc($CheckTagResults);
            $tag_id = $Tag['Tag_ID'];
            $DeleteQuery = "DELETE FROM url_tag_pivot where Tag_ID = " . trim($tag_id) . " AND Blog_ID = " . trim($url_id);
            $DeleteResult = mysql_query($DeleteQuery) or die('Query failed: ' . mysql_error());
        }
        $tag_id = prepareIdOut($tag_id, $host);
        $F = array();
        $F['tag_id'] = $tag_id;
        $F['tag'] = $tag;
        $F['url_count'] = 0;
        array_push($ReturnObject, $F);
    }
    $app->response()->header("Content-Type", "application/json");
    echo format_json(json_encode($ReturnObject));
});
示例#3
0
 if ($query != '') {
     $Query .= " AND (n.title LIKE '%" . $query . "%' OR n.details LIKE '%" . $query . "%')";
 }
 $Query .= " ORDER BY n." . $sort . " " . $order . " LIMIT " . $page . "," . $count;
 //echo $Query . "<br />";
 $contentResult = mysql_query($Query) or die('Query failed: ' . mysql_error());
 while ($content = mysql_fetch_assoc($contentResult)) {
     $archive = 0;
     $content_id = $content['content_id'];
     $title = $content['title'];
     $details = $content['details'];
     $post_date = $content['post_date'];
     $modified_date = $content['modified_date'];
     // manipulation zone
     $host = $_SERVER['HTTP_HOST'];
     $content_id = prepareIdOut($content_id, $host);
     $F = array();
     $F['content_id'] = $content_id;
     $F['title'] = $title;
     $F['details'] = $details;
     $F['post_date'] = $post_date;
     $F['modified_date'] = $modified_date;
     $F['tags'] = array();
     $TagQuery = "SELECT t.tag_id, t.tag from tags t";
     $TagQuery .= " INNER JOIN content_tag_pivot npt ON t.tag_id = npt.tag_id";
     $TagQuery .= " WHERE npt.content_ID = " . $content_id;
     $TagQuery .= " ORDER BY t.tag DESC";
     $TagResult = mysql_query($TagQuery) or die('Query failed: ' . mysql_error());
     while ($Tag = mysql_fetch_assoc($TagResult)) {
         $thistag = $Tag['tag'];
         $T = array();
示例#4
0
        $curated_id = mysql_real_escape_string($params['curated_id']);
    } else {
        $curated_id = 0;
    }
    $Query = "SELECT * FROM dictionary WHERE Title = '" . $title . "' AND Author = '" . $author . "'";
    //echo $Query . "<br />";
    $Database = mysql_query($Query) or die('Query failed: ' . mysql_error());
    if ($Database && mysql_num_rows($Database)) {
        $ThisCertification = mysql_fetch_assoc($Database);
        $dictionary_id = $ThisCertification['ID'];
    } else {
        $Query = "INSERT INTO dictionary(Post_Date,Title,Author,Summary,Body,Footer,News_ID)";
        $Query .= " VALUES(";
        $Query .= "'" . mysql_real_escape_string($post_date) . "',";
        $Query .= "'" . mysql_real_escape_string($title) . "',";
        $Query .= "'" . mysql_real_escape_string($author) . "',";
        $Query .= "'" . mysql_real_escape_string($summary) . "',";
        $Query .= "'" . mysql_real_escape_string($body) . "',";
        $Query .= "'" . mysql_real_escape_string($footer) . "',";
        $Query .= mysql_real_escape_string($curated_id);
        $Query .= ")";
        //echo $Query . "<br />";
        mysql_query($Query) or die('Query failed: ' . mysql_error());
        $dictionary_id = mysql_insert_id();
    }
    $host = $_SERVER['HTTP_HOST'];
    $dictionary_id = prepareIdOut($dictionary_id, $host);
    $ReturnObject['dictionary_id'] = $dictionary_id;
    $app->response()->header("Content-Type", "application/json");
    echo format_json(json_encode($ReturnObject));
});
 $Query .= " WHERE Tag = '" . $tag . "'";
 $DatabaseResult = mysql_query($Query) or die('Query failed: ' . mysql_error());
 while ($Database = mysql_fetch_assoc($DatabaseResult)) {
     $report_id = $Database['report_id'];
     $report_date = $Database['report_date'];
     $name = $Database['name'];
     $title = $Database['title'];
     $content = $Database['content'];
     // manipulation zone
     $TagQuery = "SELECT t.tag_id, t.tag from tags t";
     $TagQuery .= " INNER JOIN report_tag_pivot utp ON t.tag_id = utp.tag_id";
     $TagQuery .= " WHERE utp.Blog_ID = " . $report_id;
     $TagQuery .= " ORDER BY t.tag DESC";
     $TagResult = mysql_query($TagQuery) or die('Query failed: ' . mysql_error());
     $host = $_SERVER['HTTP_HOST'];
     $report_id = prepareIdOut($report_id, $host);
     $F = array();
     $F['report_id'] = $report_id;
     $F['report_date'] = $report_date;
     $F['name'] = $name;
     $F['title'] = $title;
     $F['content'] = $content;
     $F['tags'] = array();
     while ($Tag = mysql_fetch_assoc($TagResult)) {
         $thistag = $Tag['tag'];
         $T = array();
         $T = $thistag;
         array_push($F['tags'], $T);
         //echo $thistag . "<br />";
         if ($thistag == 'Archive') {
             $archive = 1;
 $Query .= " JOIN link  ON ltp.link_id = l.link_id";
 $Query .= " WHERE tag = '" . $tag . "'";
 $DatabaseResult = mysql_query($Query) or die('Query failed: ' . mysql_error());
 while ($Database = mysql_fetch_assoc($DatabaseResult)) {
     $link_id = $Database['link_id'];
     $created_date = $Database['created_date'];
     $url = $Database['url'];
     $short_url = $Database['short_url'];
     // manipulation zone
     $TagQuery = "SELECT t.tag_id, t.tag from tags t";
     $TagQuery .= " INNER JOIN link_tag_pivot ltp ON t.tag_id = ltp.tag_id";
     $TagQuery .= " WHERE ltp.link_id = " . $link_id;
     $TagQuery .= " ORDER BY t.tag DESC";
     $TagResult = mysql_query($TagQuery) or die('Query failed: ' . mysql_error());
     $host = $_SERVER['HTTP_HOST'];
     $link_id = prepareIdOut($link_id, $host);
     $F = array();
     $F['link_id'] = $link_id;
     $F['created_date'] = $created_date;
     $F['url'] = $url;
     $F['short_url'] = $short_url;
     $F['tags'] = array();
     while ($Tag = mysql_fetch_assoc($TagResult)) {
         $thistag = $Tag['tag'];
         $T = array();
         $T = $thistag;
         array_push($F['tags'], $T);
         //echo $thistag . "<br />";
         if ($thistag == 'Archive') {
             $archive = 1;
         }
     $Query = "SELECT * FROM authentication";
 }
 $Query .= " ORDER BY " . $sort . " " . $order . " LIMIT " . $page . "," . $count;
 //echo $Query . "<br />";
 $DatabaseResult = mysql_query($Query) or die('Query failed: ' . mysql_error());
 while ($Database = mysql_fetch_assoc($DatabaseResult)) {
     $authentication_id = $Database['authentication_id'];
     $title = $Database['title'];
     $image = $Database['image'];
     $header = $Database['header'];
     $footer = $Database['footer'];
     $KeysQuery = "SELECT * from keys k";
     $KeysQuery .= " WHERE authentication_id = " . $authentication_id;
     $KeysQuery .= " ORDER BY name ASC";
     $KeysResults = mysql_query($KeysQuery) or die('Query failed: ' . mysql_error());
     $authentication_id = prepareIdOut($authentication_id, $host);
     $F = array();
     $F['authentication_id'] = $authentication_id;
     $F['title'] = $title;
     $F['image'] = $image;
     $F['header'] = $header;
     $F['footer'] = $footer;
     // Keys
     $F['keys'] = array();
     while ($Keys = mysql_fetch_assoc($KeysResults)) {
         $name = $Keys['name'];
         $description = $Keys['description'];
         $K = array();
         $K['name'] = $name;
         $K['description'] = $description;
         array_push($F['keys'], $K);
示例#8
0
     $support_id = mysql_insert_id();
 }
 $ReturnObject = array();
 $Query = "SELECT * FROM support WHERE support_id = " . $support_id;
 $DatabaseResult = mysql_query($Query) or die('Query failed: ' . mysql_error());
 while ($Database = mysql_fetch_assoc($DatabaseResult)) {
     $support_id = $Database['support_id'];
     $title = $Database['title'];
     $image = $Database['image'];
     $header = $Database['header'];
     $footer = $Database['footer'];
     $resourcesQuery = "SELECT * from resources r";
     $resourcesQuery .= " WHERE support_id = " . $support_id;
     $resourcesQuery .= " ORDER BY title ASC";
     $resourcesResults = mysql_query($resourcesQuery) or die('Query failed: ' . mysql_error());
     $support_id = prepareIdOut($support_id, $host);
     $F = array();
     $F['support_id'] = $support_id;
     $F['title'] = $title;
     $F['image'] = $image;
     $F['header'] = $header;
     $F['footer'] = $footer;
     // resources
     $F['resources'] = array();
     while ($resources = mysql_fetch_assoc($resourcesResults)) {
         $title = $resources['title'];
         $description = $resources['description'];
         $image = $resources['image'];
         $url = $resources['url'];
         $K = array();
         $K['title'] = $title;
 //echo $Query . "<br />";
 $DatabaseResult = mysql_query($Query) or die('Query failed: ' . mysql_error());
 while ($Database = mysql_fetch_assoc($DatabaseResult)) {
     $url_id = $Database['url_id'];
     $pull_date = $Database['pull_date'];
     $title = $Database['title'];
     $content = $Database['content'];
     $url = $Database['url'];
     $TagQuery = "SELECT t.tag_id, t.tag from tags t";
     $TagQuery .= " INNER JOIN url_tag_pivot utp ON t.tag_id = utp.tag_id";
     $TagQuery .= " WHERE utp.url_id = " . $url_id;
     $TagQuery .= " ORDER BY t.tag DESC";
     $TagResult = mysql_query($TagQuery) or die('Query failed: ' . mysql_error());
     // manipulation zone
     $host = $_SERVER['HTTP_HOST'];
     $url_id = prepareIdOut($url_id, $host);
     $F = array();
     $F['url_id'] = $url_id;
     $F['pull_date'] = $pull_date;
     $F['title'] = $title;
     $F['content'] = $content;
     $F['url'] = $url;
     $F['tags'] = array();
     while ($Tag = mysql_fetch_assoc($TagResult)) {
         $thistag = $Tag['tag'];
         $T = array();
         $T = $thistag;
         array_push($F['tags'], $T);
     }
     array_push($ReturnObject, $F);
 }
<?php

$route = '/content/:content_id/images/:content_image_id';
$app->put($route, function ($content_id, $content_image_id) use($app) {
    $host = $_SERVER['HTTP_HOST'];
    $content_id = prepareIdIn($content_id, $host);
    $content_image_id = prepareIdIn($content_image_id, $host);
    $ReturnObject = array();
    $request = $app->request();
    $param = $request->params();
    if (isset($param['path'])) {
        $type = trim(mysql_real_escape_string($param['type']));
        $path = trim(mysql_real_escape_string($param['path']));
        $name = trim(mysql_real_escape_string($param['name']));
        $query = "UPDATE content_image SET type = '" . $type . "', image_url = '" . $path . "', image_name = '" . $name . "' WHERE content_image_id = " . $content_image_id;
        mysql_query($query) or die('Query failed: ' . mysql_error());
        $image_id = mysql_insert_id();
        $image_id = prepareIdOut($image_id, $host);
        $F = array();
        $F['image_id'] = $image_id;
        $F['name'] = $name;
        $F['path'] = $path;
        $F['type'] = $type;
        array_push($ReturnObject, $F);
    }
    $app->response()->header("Content-Type", "application/json");
    echo stripslashes(format_json(json_encode($ReturnObject)));
});