| 1 |
<?php |
| 2 |
|
| 3 |
////////////////////////////////////////////////////////////// |
| 4 |
//=========================================================== |
| 5 |
// license.php |
| 6 |
//=========================================================== |
| 7 |
// PAGELAYER |
| 8 |
// Inspired by the DESIRE to be the BEST OF ALL |
| 9 |
// ---------------------------------------------------------- |
| 10 |
// Started by: Pulkit Gupta |
| 11 |
// Date: 23rd Jan 2017 |
| 12 |
// Time: 23:00 hrs |
| 13 |
// Site: http://pagelayer.com/wordpress (PAGELAYER) |
| 14 |
// ---------------------------------------------------------- |
| 15 |
// Please Read the Terms of use at http://pagelayer.com/tos |
| 16 |
// ---------------------------------------------------------- |
| 17 |
//=========================================================== |
| 18 |
// (c)Pagelayer Team |
| 19 |
//=========================================================== |
| 20 |
////////////////////////////////////////////////////////////// |
| 21 |
|
| 22 |
// Are we being accessed directly ? |
| 23 |
if(!defined('PAGELAYER_VERSION')) { |
| 24 |
exit('Hacking Attempt !'); |
| 25 |
} |
| 26 |
|
| 27 |
include_once(PAGELAYER_DIR.'/main/settings.php'); |
| 28 |
|
| 29 |
// The License Page |
| 30 |
function pagelayer_license(){ |
| 31 |
|
| 32 |
global $pl_error; |
| 33 |
|
| 34 |
if(!empty($_REQUEST['install_pro'])){ |
| 35 |
pagelayer_install_pro(); |
| 36 |
return; |
| 37 |
} |
| 38 |
|
| 39 |
// Is there a license key ? |
| 40 |
if(isset($_POST['save_pl_license'])){ |
| 41 |
|
| 42 |
$license = pagelayer_optpost('pagelayer_license'); |
| 43 |
|
| 44 |
// Check if its a valid license |
| 45 |
if(empty($license)){ |
| 46 |
$pl_error['lic_invalid'] = __('The license key was not submitted', 'pagelayer'); |
| 47 |
return pagelayer_license_T(); |
| 48 |
} |
| 49 |
|
| 50 |
$resp = wp_remote_get(PAGELAYER_API.'license.php?license='.$license, array('timeout' => 30)); |
| 51 |
|
| 52 |
if(is_array($resp)){ |
| 53 |
$json = json_decode($resp['body'], true); |
| 54 |
//print_r($json); |
| 55 |
}else{ |
| 56 |
|
| 57 |
$pl_error['resp_invalid'] = __('The response was malformed<br>'.var_export($resp, true), 'pagelayer'); |
| 58 |
return pagelayer_license_T(); |
| 59 |
|
| 60 |
} |
| 61 |
|
| 62 |
// Save the License |
| 63 |
if(empty($json['license'])){ |
| 64 |
|
| 65 |
$pl_error['lic_invalid'] = __('The license key is invalid', 'pagelayer'); |
| 66 |
return pagelayer_license_T(); |
| 67 |
|
| 68 |
}else{ |
| 69 |
|
| 70 |
update_option('pagelayer_license', $json); |
| 71 |
|
| 72 |
// Load license |
| 73 |
pagelayer_load_license(); |
| 74 |
|
| 75 |
// Mark as saved |
| 76 |
$GLOBALS['pl_saved'] = true; |
| 77 |
} |
| 78 |
|
| 79 |
} |
| 80 |
|
| 81 |
pagelayer_license_T(); |
| 82 |
|
| 83 |
} |
| 84 |
|
| 85 |
// The License Page - THEME |
| 86 |
function pagelayer_license_T(){ |
| 87 |
|
| 88 |
global $pagelayer, $pl_error; |
| 89 |
|
| 90 |
pagelayer_page_header('Pagelayer License'); |
| 91 |
|
| 92 |
// Saved ? |
| 93 |
if(!empty($GLOBALS['pl_saved'])){ |
| 94 |
echo '<div id="message" class="updated"><p>'. __('The settings were saved successfully', 'pagelayer'). '</p></div><br />'; |
| 95 |
} |
| 96 |
|
| 97 |
// If the license is active and you are the free version, then suggest to install the pro |
| 98 |
if(!empty($pagelayer->license['status']) && !defined('PAGELAYER_PREMIUM') && empty($_REQUEST['install_pro'])){ |
| 99 |
echo '<div class="updated"><p>'. __('You have activated the license, but are using the Free version ! <a href="'.admin_url('admin.php?page=pagelayer_license&install_pro=1').'" class="button button-primary">Install Pro Now</a>', 'pagelayer'). '</p></div><br />'; |
| 100 |
} |
| 101 |
|
| 102 |
if(date('Ymd') <= 20200331 && !defined('PAGELAYER_PREMIUM')){ |
| 103 |
echo '<div class="updated"><p><span style="font-size: 14px"><b>Promotional Offer</b></span> : If you buy <a href="'.PAGELAYER_PRO_URL.'"><b>Pagelayer Pro</b></a> before <b>31st March, 2020</b> then you will get an additional year free and your license will expire on <b>31st March, 2022</b></p></div><br />.'; |
| 104 |
} |
| 105 |
|
| 106 |
// Any errors ? |
| 107 |
if(!empty($pl_error)){ |
| 108 |
pagelayer_report_error($pl_error);echo '<br />'; |
| 109 |
} |
| 110 |
|
| 111 |
?> |
| 112 |
|
| 113 |
<div class="postbox"> |
| 114 |
|
| 115 |
<button class="handlediv button-link" aria-expanded="true" type="button"> |
| 116 |
<span class="screen-reader-text">Toggle panel: System Information</span> |
| 117 |
<span class="toggle-indicator" aria-hidden="true"></span> |
| 118 |
</button> |
| 119 |
|
| 120 |
<h2 class="hndle ui-sortable-handle"> |
| 121 |
<span><?php echo __('System Information', 'pagelayer'); ?></span> |
| 122 |
</h2> |
| 123 |
|
| 124 |
<div class="inside"> |
| 125 |
|
| 126 |
<form action="" method="post" enctype="multipart/form-data"> |
| 127 |
<?php wp_nonce_field('pagelayer-options'); ?> |
| 128 |
<table class="wp-list-table fixed striped users" cellspacing="1" border="0" width="95%" cellpadding="10" align="center"> |
| 129 |
<?php |
| 130 |
echo ' |
| 131 |
<tr> |
| 132 |
<th align="left" width="25%">'.__('Pagelayer Version', 'pagelayer').'</th> |
| 133 |
<td>'.PAGELAYER_VERSION.(defined('PAGELAYER_PREMIUM') ? ' (PRO Version)' : '').'</td> |
| 134 |
</tr>'; |
| 135 |
|
| 136 |
echo ' |
| 137 |
<tr> |
| 138 |
<th align="left" valign="top">'.__('Pagelayer License', 'pagelayer').'</th> |
| 139 |
<td align="left"> |
| 140 |
'.(defined('PAGELAYER_PREMIUM') && empty($pagelayer->license) ? '<span style="color:red">Unlicensed</span> ' : '').' |
| 141 |
<input type="text" name="pagelayer_license" value="'.(empty($pagelayer->license) ? '' : $pagelayer->license['license']).'" size="30" placeholder="e.g. PAGEL-11111-22222-33333-44444" style="width:300px;" /> |
| 142 |
<input name="save_pl_license" class="button button-primary" value="Update License" type="submit" />'; |
| 143 |
|
| 144 |
if(!empty($pagelayer->license)){ |
| 145 |
|
| 146 |
$expires = $pagelayer->license['expires']; |
| 147 |
$expires = substr($expires, 0, 4).'/'.substr($expires, 4, 2).'/'.substr($expires, 6); |
| 148 |
|
| 149 |
echo '<div style="margin-top:10px;">License Status : '.(empty($pagelayer->license['status_txt']) ? 'N.A.' : $pagelayer->license['status_txt']).' |
| 150 |
License Expires : '.($pagelayer->license['expires'] <= date('Ymd') ? '<span style="color:red">'.$expires.'</span>' : $expires).' |
| 151 |
</div>'; |
| 152 |
} |
| 153 |
|
| 154 |
|
| 155 |
echo |
| 156 |
'</td> |
| 157 |
</tr>'; |
| 158 |
|
| 159 |
echo '<tr> |
| 160 |
<th align="left">'.__('URL', 'pagelayer').'</th> |
| 161 |
<td>'.get_site_url().'</td> |
| 162 |
</tr> |
| 163 |
<tr> |
| 164 |
<th align="left">'.__('Path', 'pagelayer').'</th> |
| 165 |
<td>'.ABSPATH.'</td> |
| 166 |
</tr> |
| 167 |
<tr> |
| 168 |
<th align="left">'.__('Server\'s IP Address', 'pagelayer').'</th> |
| 169 |
<td>'.$_SERVER['SERVER_ADDR'].'</td> |
| 170 |
</tr> |
| 171 |
<tr> |
| 172 |
<th align="left">'.__('wp-config.php is writable', 'pagelayer').'</th> |
| 173 |
<td>'.(is_writable(ABSPATH.'/wp-config.php') ? '<span style="color:red">Yes</span>' : '<span style="color:green">No</span>').'</td> |
| 174 |
</tr>'; |
| 175 |
|
| 176 |
if(file_exists(ABSPATH.'/.htaccess')){ |
| 177 |
echo ' |
| 178 |
<tr> |
| 179 |
<th align="left">'.__('.htaccess is writable', 'pagelayer').'</th> |
| 180 |
<td>'.(is_writable(ABSPATH.'/.htaccess') ? '<span style="color:red">Yes</span>' : '<span style="color:green">No</span>').'</td> |
| 181 |
</tr>'; |
| 182 |
|
| 183 |
} |
| 184 |
|
| 185 |
?> |
| 186 |
</table> |
| 187 |
</form> |
| 188 |
|
| 189 |
</div> |
| 190 |
</div> |
| 191 |
|
| 192 |
<?php |
| 193 |
|
| 194 |
pagelayer_page_footer(); |
| 195 |
|
| 196 |
} |
| 197 |
|
| 198 |
// The Pagelayer Admin Dashbaoard |
| 199 |
function pagelayer_dashboard_T(){ |
| 200 |
|
| 201 |
global $pl_error; |
| 202 |
|
| 203 |
pagelayer_page_header('Pagelayer License'); |
| 204 |
|
| 205 |
echo '<script src="'.PAGELAYER_API.(defined('PAGELAYER_PREMIUM') ? 'news_pro.js' : 'news.js').'"></script><br>'; |
| 206 |
|
| 207 |
// Saved ? |
| 208 |
if(!empty($GLOBALS['pl_saved'])){ |
| 209 |
echo '<div id="message" class="updated"><p>'. __('The settings were saved successfully', 'pagelayer'). '</p></div><br />'; |
| 210 |
} |
| 211 |
|
| 212 |
// Any errors ? |
| 213 |
if(!empty($pl_error)){ |
| 214 |
pagelayer_report_error($pl_error);echo '<br />'; |
| 215 |
} |
| 216 |
|
| 217 |
pagelayer_page_footer(); |
| 218 |
|
| 219 |
} |