Example #1
0
<?php

include "includes.php";
?>

<?php 
//check whether user logged in or not
session_start();
$json_encoded_user = $_SESSION[$conf['appId'] . '_user'];
$user = !empty($json_encoded_user) ? json_decode($json_encoded_user) : null;
session_write_close();
$appFb = new AppFb();
$appFb->init($conf);
$manager = new appManager();
$manager->init($conf);
$method = $_REQUEST['method'];
$params = $_REQUEST;
error_log("user in action:" . print_r($user, true));
$actionManager = new actionManager();
echo json_encode($actionManager->handleAction($user, $method, $params, $manager, $appFb));
                        // If there is any tag...
                        if (count(array_intersect($json["tags"], $rsctags_array)) > 0 || count($rsctags) == 0) {
                            // Check tags
                            array_push($resources, $json_data);
                        }
                    } else {
                        array_push($resources, $json_data);
                    }
                }
            }
        }
        error_log(json_encode($resources));
        return json_encode($resources);
    }
}
$myappManager = new appManager();
// Main controller...
switch ($_POST["action"]) {
    case "getMenus":
        echo $myappManager->getMenus();
        break;
    case "getAllApps":
        echo $myappManager->getAllApps();
        break;
    case "getSelectedApps":
        $rsctags = array();
        if (isset($_POST['rsctags'])) {
            $rsctags = $_POST["rsctags"];
        }
        echo $myappManager->getSelectedApps($_POST["rsctype"], $_POST["rscsubject"], $rsctags);
        break;