-
Notifications
You must be signed in to change notification settings - Fork 43
/
file.php
117 lines (87 loc) · 3.7 KB
/
file.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php
include('_lib.php');
// sanitize token or alias
$token = (isset($_REQUEST['token']) && sanitize('token',$_REQUEST['token'])) ? $_REQUEST['token'] : FALSE;
$alias = (isset($_REQUEST['alias']) && sanitize('alias',$_REQUEST['alias'])) ? $_REQUEST['alias'] : FALSE;
// pull token if alias was supplied
if ($alias) {
$aliasSQL = sprintf("SELECT token FROM aliases WHERE alias = '%s';",$alias);
$aliasResult = mysql_query($aliasSQL);
if ($a = mysql_fetch_assoc($aliasResult)){
$token = $a['token'];
}
}
// pull makefile from DB
$opts['raw'] = (isset($_GET['raw'])) ? TRUE : FALSE;
$opts['alias'] = ($alias) ? $alias : FALSE;
$makefile = generateMakefile($token,$opts);
if (!$makefile){
$fail = 'fail';
$error = "Something broke :(\r\n
Check your URL...\r\n\r\n\r\n
...or if there's an error onscreen and you feel generous,
you could post it at https://github.com/rupl/drush_make_generator/issues - thanks!";
}
// output mode?
if (isset($opts['raw']) && $opts['raw'] == 'raw') {
// raw/permalink
header("Content-type: text/plain\r\n");
print $makefile;
exit;
} else {
// bookmarking/sharing
?><!doctype html>
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]-->
<!--[if IE 7 ]> <html lang="en" class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]> <html lang="en" class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Drush Make Generator ❤ a UI to Customize Drupal Installs</title>
<meta name="description" content="http://drushmake.me helps you build install profiles or quickly install Drupal using drush make. Powered by Four Kitchens. ">
<meta name="author" content="Chris Ruppel">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="/favicon.ico">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Droid+Sans">
<link rel="stylesheet" href="/css/960.css" media="only all and (min-width: 960px)">
<link rel="stylesheet" href="/css/formalize.css" media="only screen and (min-width: 481px)">
<link rel="stylesheet" href="/css/style.css">
<script src="/js/libs/modernizr.custom.js"></script>
</head>
<body class="container_12">
<header class="grid_12">
<h1>Drush Make Generator</h1>
<nav>
<ol>
<li><a href="/">what's going on?</a></li>
<li><a href="/#generate">generate</a></li>
<li><a href="http://drupal.org/project/drush_make">make</a></li>
</ol>
</nav>
</header>
<div class="grid_12" id="makefile">
<?php if (isset($fail)){ ?>
<h2>Dang it...</h2>
<textarea name="makefile" id="makefile" class="<?php print $fail ?>"><?php print $error; ?></textarea>
<?php } else { ?>
<h2>Your makefile is ready</h2>
<p>We've saved it for you as well!</p>
<ul>
<li><a href="<?php print fileURL($token,$opts); ?>">Bookmark</a></li>
<li><a href="<?php $opts['raw'] = 'raw'; print fileURL($token,$opts); ?>">raw makefile</a></li>
<li>or (in the future) update previous makefiles</li>
</ul>
<textarea name="makefile" id="makefile"><?php print $makefile; ?></textarea>
<?php } ?>
</div>
<div class="grid_12" id="deploy">
<h2>Deploy your makefile</h2>
<p><a href="http://drupal.org/project/drush">Drush</a> and <a href="http://drupal.org/project/drush_make">Drush Make</a> turn your makefile into a Drupal installation. Then you can get building!</p>
</div>
<?php include('footer.php'); ?>
</body>
</html>
<?php } /* end of output mode */