<?php

// *****************************
// *                           *
// *        Wizard_Menu        *
// *                           *
// *****************************

  $doc_root = $_SERVER['DOCUMENT_ROOT'];
  include ($doc_root . "/connect/config.php");
  include ("check_session.php");
  include ("get_web_mode.php");
/*  include ("get_user_ID.php"); */
  include ("menu_builder_utilities.php");

  $menu = file_get_contents('php://input');

  if (!empty($menu)) {

    $menus = get_menu_label_list("*",false,"page_name IN ('" . str_replace(",","','",trim($menu,",")) . "')");
    foreach ($menus as $key => $menu) {
      $wizArray[$menu['page_name'] . "_page"] = $menu['page_name'];
      $wizArray[$menu['page_name'] . "_sort"] = $key;
      $wizArray[$menu['page_name'] . "_link_text"] = $menu['link_text'];
      $wizArray[$menu['page_name'] . "_plugin_id"] = ($menu['plugin_id']>-1?$menu['plugin_id']:"");
    }
  }

  if (!empty($image) && is_array($image)) {
    foreach ($image as $key => $img) {
      if (!empty($img['name']) && !empty($img['tag'])) {
        $wizArray[$img['tag']] = $img['name'];
      }
    }
  }

echo json_encode($wizArray);
//echo "<pre>\n";
//print_r($wizArray);
//echo "\n</pre>\n";

?>