function update_recipes_request()
{
    if (!empty($_POST["id"])) {
        $post_id = $_POST["id"];
        $post = get_post($post_id);
        $url = post_permalink($post_id);
        $ingredients = get_post_meta($post_id, 'RECIPE_META_ingredients', true);
        $nutrition_facts = process_request($ingredients);
        if (isValid($nutrition_facts)) {
            if (!add_post_meta($post_id, META_KEY, $nutrition_facts, true)) {
                update_post_meta($post_id, META_KEY, $nutrition_facts);
            }
            echo json_encode(array('ID' => $post->ID, 'post_title' => $post->post_title, 'url' => $url, 'success' => true, 'error' => false, 'message' => 'Update successful.'));
        } else {
            echo json_encode(array('ID' => $post->ID, 'post_title' => $post->post_title, 'url' => $url, 'success' => false, 'error' => true, 'message' => 'Update unsuccessful.'));
        }
    }
    die;
}
Example #2
0
<?php

error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING);
require_once "images.php";
$location = process_request($_POST['files'], $_POST['chunks'], $_POST['skin'], 0);
?>
<html>
<head>
	<meta http-equiv="Content-type" content="text/html; charset=utf-8">
	<title></title>
	<style>
		body, html{
			height:100%;
			font-family:Tahoma;
			font-size:12px;
		}
	</style>
	<body>
		Ready code stored at <?php 
echo $location;
?>
<br/><br/><br/>
		<a href='zip.php?location=<?php 
echo urlencode($location);
?>
' target="_blank">Download generated files</a><br/><br/>
	</body>
</head>
</html>
Example #3
0
<?php

error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING);
require_once "images.php";
$location = process_request($_POST['files'], $_POST['chunks'], $_POST['skin'], $_POST['iconset'], 1);
?>
<html>
<head>
	<meta http-equiv="Content-type" content="text/html; charset=utf-8">
	<title></title>
	<style>
		body, html{
			height:100%;
			font-family:Tahoma;
			font-size:12px;
		}
	</style>
	<body>
		Ready code stored at <?php 
echo $location;
?>
<br/><br/><br/>
		<a href='zip.php?location=<?php 
echo urlencode($location);
?>
' target="_blank">Download generated files</a><br/><br/>
	</body>
</head>
</html>
Example #4
0
<?php

require_once './inc/func.php';
$variables = process_request();
print theme_output($variables);
Example #5
0
/**
 * Author: plFlok
 */
define('ENTRY_POINT', true);
include_once 'api_header.php';
include_once '../engine/pagination.php';
function process_request()
{
    $item_id = isset($_GET['item_id']) ? intval($_GET['item_id']) : false;
    if ($item_id == false || $item_id <= 0) {
        api_wrong_args();
        return;
    }
    $item = db_get_item($item_id);
    if (!$item) {
        api_echo_as_json("Item not found", 'msg');
        return;
    }
    db_delete_item($item_id);
    $mc_handler = memcache_connect('localhost');
    pagination_rebuild_ids($mc_handler, $item['id']);
    pagination_rebuild_prices($mc_handler, $item['price']);
    if (memcache_get($mc_handler, 'total_rows') !== false) {
        memcache_decrement($mc_handler, 'total_rows');
    }
    api_echo_as_json('Item deleted', 'msg');
    memcache_delete($mc_handler, "item_" . $item_id);
}
process_request();
Example #6
0
                $sarg = $sargs[$i];
                debug($sql . "\narray(" . implode(",", $sarg) . ")\n");
                db_exec($sql, $sarg);
            }
        }
        if (isset($arg['edit'])) {
            /* on edit and add, we will send Location: but with "edit" again,
               stripping add and the token */
            if (isset($arg['add'])) {
                $args = "?gid={$gid}&edit";
            } else {
                generate_edit_form($tpl, $gid);
            }
        }
        if (count($sqls)) {
            header("Location: /admin/gmessage.phtml{$args}");
        }
    }
}
$tpl = new YATT($template_dir . '/admin', 'gmessage.yatt');
process_request($tpl, $_REQUEST);
generate_table($tpl);
/*
if (!empty($debug)) {
    $tpl->set('debug',$debug);
    $tpl->parse('debug');
}
*/
page_header("Global Messages");
echo $tpl->output();
page_footer();
Example #7
0
        $screen();
        exit;
    }
}
//if vfs_id is set we're not browsing a regular folder but a virtual filesystem, e.g.
//a search result set or the contents of an archive
$vfs_id = empty($_REQUEST['vfs_id']) ? false : $_REQUEST['vfs_id'];
//try the value in $_REQUEST then $fm_config['HOME_FOLDER'] then default value '/'
$folder = empty($_REQUEST['folder']) ? empty($fm_config['HOME_FOLDER']) ? '/' : $fm_config['HOME_FOLDER'] : $_REQUEST['folder'];
$folder = validate_folder($folder);
//check if it's a valid folder and if it's within the tree we're allowed to access
if (empty($folder)) {
    $logmessage = 'Folder does not exist or you do not have permissions to access it';
} else {
    $folder_contents = reload_folder($folder);
    if (empty($folder_contents)) {
        $logmessage = 'Folder does not exist or you do not have permissions to access it';
        $screen = '';
    } else {
        $logmessage = '';
        $screen = process_request($_REQUEST, $folder);
    }
}
if (!empty($screen) && function_exists($screen)) {
    $screen();
} else {
    if (!empty($screen) && !function_exists($screen)) {
        $logmessage = "Internal error: no such screen: {$screen}";
    }
    screen_error();
}
Example #8
0
    }
}
if (@$config["help"]) {
    print_help();
    exit(1);
}
if (@count($config["feeds"]) < 1) {
    echo "No Feeds Specified\n";
    exit(1);
}
if (@count($config["items"]) > 0) {
    $items = $config["items"][0];
} else {
    $items = 1;
}
process_request($config);
function process_request($config)
{
    # GOT THE FEEDS, PROCESS AND OUTPUT
    require_once 'rss_php.php';
    $rss = new rss_php();
    # SET DEFAULT ITEM COUNT, IN CASE ONE NOT SPECIFIED
    $count = $config["items"][0];
    if (@(!$count)) {
        $count = 1;
    }
    $feeds = $config["feeds"];
    for ($i = 0; $i < count($feeds); $i++) {
        $url = $feeds[$i];
        $rss->load($url);
        $items = $rss->getItems();
Example #9
0
<?php

//Create review SQL Operation
include '../components/SQL_Operation.php';
include '../components/formatting.php';
session_start();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if (!isset($_SESSION['UID'])) {
        echo $_SESSION;
        echo 'You must be logged in to post a review.';
        exit;
    }
    $vars = process_request($_POST);
    $review = (new AddReview($vars['author'], $vars['account'], $vars['category'], $_POST['body'], $vars['rating'], $vars['emoji']))->execute();
    echo 'Review submitted';
}
Example #10
0
<?php

error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING);
require_once "images.php";
$location = process_request($_POST['files'], $_POST['chunks'], $_POST['skin'], $_POST['iconset'], 1, $_POST["compress"] == "1");
?>
<html>
<head>
	<meta http-equiv="Content-type" content="text/html; charset=utf-8">
	<title></title>
	<style>
		body, html{
			height:100%;
			font-family:Tahoma;
			font-size:12px;
		}
	</style>
	<body>
		Ready code stored at <?php 
echo $location;
?>
<br/><br/><br/>
		<a href='zip.php?location=<?php 
echo urlencode($location);
?>
' target="_blank">Download generated files</a><br/><br/>
	</body>
</head>
</html>
Example #11
0
$routeInfo = $dispatcher->dispatch($httpMethod, $uri);
switch ($routeInfo[0]) {
    case FastRoute\Dispatcher::NOT_FOUND:
        $result = process_request($settings['page_404'], [], $httpMethod);
        http_response_code(404);
        echo $result;
        break;
    case FastRoute\Dispatcher::METHOD_NOT_ALLOWED:
        $result = process_request($settings['page_405'], [], $httpMethod);
        http_response_code(405);
        echo $result;
        break;
    case FastRoute\Dispatcher::FOUND:
        $handler = $routeInfo[1];
        $vars = $routeInfo[2];
        $result = process_request($handler, $vars, $httpMethod);
        echo $result;
}
function process_request($handler, $vars, $httpMethod)
{
    if (!is_array($handler)) {
        throw new ErrorException('Handler must be a an array');
    }
    $controller = new $handler[0]();
    $manualParams = isset($handler[1]) ? $handler[1] : [];
    $controller->setMethod($httpMethod);
    $controller->setParams($vars + $manualParams);
    $controller->setGET($_GET);
    $controller->setPOST($_POST);
    $controller->setViewDispatcher(\view_engine\ViewDispatcher::getInstance());
    return $controller->process();