-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.php
42 lines (37 loc) · 1.25 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
include_once('lib/Smarty-3.1.4/libs/Smarty.class.php');
include_once('lib/config.lib.php');
include_once('lib/session.lib.php');
include_once('lib/ohShopify/shopify.php');
$action = (isset($_GET['action'])) ? $_GET['action'] : 'index';
// Check for shopify authentication
if (isset($_SESSION['shop']) && isset($_SESSION['token'])){
$shopifyClient = new ShopifyClient($_SESSION['shop'], $_SESSION['token'], SHOPIFY_API_KEY, SHOPIFY_SECRET);
// setup links in view
$returnURL = 'http://' . $shopifyClient->shop_domain . '/admin';
}else{
// not authorized to get into the app so show them the authorization form
$action = "authorize";
$smarty->assign('mainnav', array(
array('name' => 'Install', 'href' => getLink('authorize'), 'class' => '')));
}
/* based on the action, get a url */
function getLink($action='') {
if (strlen($action) == 0)
return 'index.php';
else
return 'index.php?action=' . $action;
}
/*
*
* Include the code and templates for this action
*
*/
if (file_exists('core/' . $action . '.php'))
include('core/' . $action . '.php');
$smarty->display('templates/header.tpl');
$smarty->display('templates/main.tpl');
$smarty->display('templates/modal.tpl');
$smarty->display('templates/app-js.tpl');
$smarty->display('templates/footer.tpl');
?>