269 lines
12 KiB
PHP
269 lines
12 KiB
PHP
<?php
|
|
/*
|
|
+--------------------------------------------------------------------------
|
|
| CubeCart 4
|
|
| ========================================
|
|
| CubeCart is a registered trade mark of Devellion Limited
|
|
| Copyright Devellion Limited 2006. All rights reserved.
|
|
| Devellion Limited,
|
|
| 5 Bridge Street,
|
|
| Bishops Stortford,
|
|
| HERTFORDSHIRE.
|
|
| CM23 2JU
|
|
| UNITED KINGDOM
|
|
| http://www.devellion.com
|
|
| UK Private Limited Company No. 5323904
|
|
| ========================================
|
|
| Web: http://www.cubecart.com
|
|
| Email: info (at) cubecart (dot) com
|
|
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
|
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
|
+--------------------------------------------------------------------------
|
|
| index.inc.php
|
|
| ========================================
|
|
| Main Homepage of Admin
|
|
+--------------------------------------------------------------------------
|
|
*/
|
|
if(!defined('CC_INI_SET')){ die("Access Denied"); }
|
|
|
|
$lang = getLang("admin".CC_DS."admin_misc.inc.php");
|
|
require($glob['adminFolder'].CC_DS."includes".CC_DS."header.inc.php");
|
|
|
|
// no Products
|
|
$query = "SELECT count(productId) as noProducts FROM ".$glob['dbprefix']."CubeCart_inventory";
|
|
$noProducts = $db->select($query);
|
|
|
|
// no Categories
|
|
$query = "SELECT count(cart_order_id) as noOrders FROM ".$glob['dbprefix']."CubeCart_order_sum";
|
|
$noOrders = $db->select($query);
|
|
|
|
// no Ccustomers
|
|
$query = "SELECT count(customer_id) as noCustomers FROM ".$glob['dbprefix']."CubeCart_customer WHERE type = 1 OR type = 2";
|
|
$noCustomers = $db->select($query);
|
|
|
|
// no Ccustomers
|
|
$query = "SELECT * FROM ".$glob['dbprefix']."CubeCart_admin_sessions ORDER BY time DESC LIMIT 1, 1";
|
|
$lastSession = $db->select($query);
|
|
|
|
## check if setup folder remains after install/upgrade
|
|
if ($glob['installed'] == true && $config['debug'] == false && file_exists(CC_ROOT_DIR."/setup")) {
|
|
echo sprintf('<p class="warnText">%s</p>', $lang['admin_common']['setup_folder_exists']);
|
|
}
|
|
|
|
if (substr(PHP_OS, 0, 3) !== "WIN" && cc_is_wriatble("includes".CC_DS."global.inc.php")) {
|
|
echo sprintf('<p class="warnText">%s</p>', $lang['admin_common']['other_global_risk']);
|
|
}
|
|
|
|
## check if setup folder remains after install/upgrade
|
|
if ($glob['dbusername'] == 'root') {
|
|
echo sprintf('<p class="warnText">%s</p>', 'WARNING: You are currently connected to the MySQL database using the root account. This is very insecure, and should be changed if possible.');
|
|
}
|
|
?>
|
|
<p class="pageTitle"><?php echo $lang['admin_common']['other_welcome_note']; ?></p>
|
|
<?php
|
|
if ($lastSession == true) {
|
|
$loginTime = formatTime($lastSession[0]['time']);
|
|
if ($lastSession[0]['success'] == true) {
|
|
echo "<p class='infoText'>".sprintf($lang['admin_common']['other_last_login_success'], strip_tags($lastSession[0]['username']), $loginTime)."</p>";
|
|
} else {
|
|
echo "<p class='warnText'>".sprintf($lang['admin_common']['other_last_login_failed'], strip_tags($lastSession[0]['username']), $loginTime)."</p>";
|
|
}
|
|
}
|
|
?>
|
|
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
|
<tr>
|
|
<td width="50%" valign="top" style="padding-right: 5px;">
|
|
<?php
|
|
$query = "SELECT cart_order_id, name, time, ".$glob['dbprefix']."CubeCart_order_sum.customer_id FROM ".$glob['dbprefix']."CubeCart_order_sum INNER JOIN ".$glob['dbprefix']."CubeCart_customer ON ".$glob['dbprefix']."CubeCart_order_sum.customer_id = ".$glob['dbprefix']."CubeCart_customer.customer_id WHERE ".$glob['dbprefix']."CubeCart_order_sum.status = 1 OR ".$glob['dbprefix']."CubeCart_order_sum.status = 2 ORDER BY `time` DESC";
|
|
|
|
$poPerPage = 12;
|
|
$pendingOrders = $db->select($query, $poPerPage, $_GET['po']);
|
|
$numrows = $db->numrows($query);
|
|
$pagination = paginate($numrows, $poPerPage, $_GET['po'], "po");
|
|
|
|
if ($pendingOrders) {
|
|
?>
|
|
|
|
<table width="100%" border="0" cellpadding="3" cellspacing="1" class="toDoTable">
|
|
<tr>
|
|
<td width="50%" class="tdtoDo"><?php echo $lang['admin_common']['other_pending_orders']; ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td width="50%" rowspan="3" align="left" valign="top" class="tdText"><?php
|
|
|
|
for ($i=0; $i<count($pendingOrders); $i++)
|
|
{
|
|
echo "<a href='".$GLOBALS['rootRel'].$glob['adminFile']."?_g=orders/orderBuilder&edit=".$pendingOrders[$i]['cart_order_id']."' class='txtDash'>".$pendingOrders[$i]['cart_order_id']."</a> - <a href='".$glob['adminFile']."?_g=orders/index&searchStr=".$pendingOrders[$i]['customer_id']."' class='txtDash'>".$pendingOrders[$i]['name']."</a><br />(".formatTime($pendingOrders[$i]['time']).") <br />";
|
|
}
|
|
|
|
echo $pagination;
|
|
?>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<br />
|
|
<?php
|
|
}
|
|
?>
|
|
<table width="100%" border="0" cellpadding="3" cellspacing="1" class="mainTable">
|
|
<tr>
|
|
<td colspan="2" class="tdTitle"><?php echo $lang['admin_common']['other_quick_search']; ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td><span class="tdText"><?php echo $lang['admin_common']['other_order_no']; ?></span></td>
|
|
<td>
|
|
<form name="orderSearch" method="get" action="<?php echo $glob['adminFile']; ?>">
|
|
<input type="hidden" name="_g" value="orders/index" />
|
|
<input name="oid" type="text" class="textbox" size="30" <?php if(permission("orders","read")==FALSE) { echo "disabled"; } ?> />
|
|
<input name="submit" type="submit" class="submit" id="submit" value="<?php echo $lang['admin_common']['other_search_now']; ?>" <?php if(permission("orders","read")==FALSE) { echo "disabled"; } ?> />
|
|
</form></td>
|
|
</tr>
|
|
<tr>
|
|
<td><span class="tdText"><?php echo $lang['admin_common']['other_customer']; ?></span></td>
|
|
<td>
|
|
<form name="customerSearch" method="get" action="<?php echo $glob['adminFile']; ?>">
|
|
<input type="hidden" name="_g" value="customers/index" />
|
|
<input name="searchStr" type="text" class="textbox" id="searchStr" size="30" <?php if(permission("customers","read")==FALSE) { echo "disabled"; } ?> />
|
|
<input name="search" type="submit" class="submit" id="search" value="<?php echo $lang['admin_common']['other_search_now']; ?>" <?php if(permission("customers","read")==FALSE) { echo "disabled"; } ?> />
|
|
</form></td>
|
|
</tr>
|
|
</table>
|
|
<br />
|
|
<table width="100%" border="0" cellpadding="3" cellspacing="1" class="mainTable">
|
|
<tr>
|
|
<td class="tdTitle"><?php echo $lang['admin_common']['other_announcements']; ?></td>
|
|
</tr>
|
|
|
|
<?php
|
|
if (isset($config['latestNewsRRS']) && !empty($config['latestNewsRRS'])) {
|
|
|
|
## include MagpieRSS to Parse News RSS into Array
|
|
require("classes".CC_DS."magpie".CC_DS."rss_fetch.inc");
|
|
$rss = fetch_rss($config['latestNewsRRS']);
|
|
|
|
foreach ($rss->items as $item ) {
|
|
echo "<tr><td class=\"tdText\"><a href=".$item['link']." target=\"_blank\" class=\"txtLink\">".$item['title']."</a></td></tr>";
|
|
}
|
|
} else {
|
|
echo "<tr><td class=\"tdText\">".$lang['admin_common']['other_no_announcements']."</td></tr>";
|
|
}
|
|
?>
|
|
</table>
|
|
<?php if (!isset($config['lk'])) { ?>
|
|
<br />
|
|
<iframe src="<?php echo $glob['adminFile']; ?>?_g=misc/licForm" style="border: none; margin: 0px; overflow: hidden; padding: 0px; <?php if(ereg("MSIE",@$_SERVER["HTTP_USER_AGENT"])){ echo "width: 99%"; } else { ?>width: 100%<?php } ?>;" frameborder="0"></iframe>
|
|
<?php } ?>
|
|
|
|
</td>
|
|
<td width="50%" valign="top" style="padding-left: 5px;">
|
|
<?php
|
|
$query = sprintf("SELECT R.id, R.name, R.time FROM %1\$sCubeCart_reviews AS R LEFT JOIN %1\$sCubeCart_inventory as I ON R.productId = I.productId WHERE R.approved = 0 ORDER BY time ASC", $glob['dbprefix']);
|
|
$reviewsPerPage = 5;
|
|
$reviews = $db->select($query, $reviewsPerPage, $_GET['rev']);
|
|
$numrows = $db->numrows($query);
|
|
$pagination = paginate($numrows, $reviewsPerPage, $_GET['rev'], "rev");
|
|
|
|
if ($reviews == true) {
|
|
?>
|
|
<table width="100%" border="0" cellpadding="3" cellspacing="1" class="toDoTable">
|
|
<tr>
|
|
<td width="50%" class="tdtoDo"><?php echo $lang['admin_common']['other_product_reviews']; ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td width="50%" align="left" valign="top" class="tdText">
|
|
<?php
|
|
for ($i=0; $i<count($reviews); $i++) {
|
|
echo "<a href='".$glob['adminFile']."?_g=reviews/index&edit=".$reviews[$i]['id']."' class='txtDash'>".$reviews[$i]['name']."</a> (".formatTime($reviews[$i]['time']).")<br />";
|
|
}
|
|
echo $pagination;
|
|
?>
|
|
</td>
|
|
</tr>
|
|
</table><br />
|
|
<?php
|
|
}
|
|
|
|
if ($config['stock_warn_type'] == 1) {
|
|
$query = "SELECT name, stock_level, productId FROM ".$glob['dbprefix']."CubeCart_inventory WHERE useStockLevel = 1 AND stock_level <= stockWarn ORDER BY stock_level ASC";
|
|
} else {
|
|
if (!isset($config['stock_warn_level'])) $config['stock_warn_level'] = 5;
|
|
$query = "SELECT name, stock_level, productId FROM ".$glob['dbprefix']."CubeCart_inventory WHERE useStockLevel = 1 AND stock_level <= ".$config['stock_warn_level']." ORDER BY stock_level ASC";
|
|
}
|
|
|
|
$stockPerPage = 20;
|
|
$stock = $db->select($query, $stockPerPage, $_GET['po']);
|
|
$numrows = $db->numrows($query);
|
|
$pagination = paginate($numrows, $stockPerPage, $_GET['po'], "po");
|
|
|
|
if ($stock == true) {
|
|
?>
|
|
<table width="100%" border="0" cellpadding="3" cellspacing="1" class="toDoTable">
|
|
<tr>
|
|
<td width="50%" align="left" valign="top" class="tdtoDo"><?php echo $lang['admin_common']['other_stock_warnings'];?></td>
|
|
</tr>
|
|
<tr>
|
|
<td width="50%" align="left" valign="top" class="tdText">
|
|
<?php
|
|
for ($i=0; $i<count($stock); $i++) {
|
|
echo " <a href='".$glob['adminFile']."?_g=products/index&edit=".$stock[$i]['productId']."' class='txtDash'>".$stock[$i]['name']."</a> (".$stock[$i]['stock_level'].")<br />";
|
|
}
|
|
echo $pagination;
|
|
?>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<br />
|
|
<?php } ?>
|
|
<table width="100%" border="0" cellpadding="3" cellspacing="1" class="mainTable">
|
|
<tr>
|
|
<td colspan="2" class="tdTitle"><?php echo $lang['admin_common']['other_store_overview']; ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td width="33%" class="tdText"><a href="http://www.cubecart.com" target="_blank" class="txtLink">CubeCart</a> <?php echo $lang['admin_common']['other_version']; ?></td>
|
|
<td width="50%" class="tdText"><span style="float: right;"><a href="https://www.cubecart.com/site/customers/" target="_blank"><img src="https://www.cubecart.com/external/vCheck4.php?v=<?php echo urlencode($ini['ver']);?>" alt="<?php echo $lang['admin_common']['other_visit_cc'];?>" border="0" title="" /></a></span><?php echo $ini['ver']; ?> </td>
|
|
</tr>
|
|
<tr>
|
|
<td width="33%"><a href="http://www.php.net" target="_blank" class="txtLink">PHP</a> <span class="tdText"><?php echo $lang['admin_common']['other_version']; ?></span></td>
|
|
<td width="50%"><span class="tdText"><?php echo phpversion();?></span></td>
|
|
</tr>
|
|
<tr>
|
|
<td width="33%"><a href="http://www.mysql.com" target="_blank" class="txtLink">MySQL</a> <span class="tdText"><?php echo $lang['admin_common']['other_version']; ?></span></td>
|
|
<td width="50%"><span class="tdText"><?php echo mysql_get_server_info(); ?></span></td>
|
|
</tr>
|
|
<tr>
|
|
<td width="33%" class="tdText"><?php echo $lang['admin_common']['other_img_upload_size']; ?></td>
|
|
<td width="50%" class="tdText">
|
|
<?php
|
|
echo format_size($config['uploadSize']);
|
|
?> </td>
|
|
</tr>
|
|
<tr>
|
|
<td width="33%" class="tdText"><?php echo $lang['admin']['misc_server_software']; ?></td>
|
|
<td width="50%" class="tdText"><?php echo @$_SERVER["SERVER_SOFTWARE"]; ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td width="33%" class="tdText"><?php echo $lang['admin']['misc_client_browser']; ?></td>
|
|
<td width="50%" class="tdText"><?php echo @$_SERVER["HTTP_USER_AGENT"]; ?></td>
|
|
</tr>
|
|
</table>
|
|
<br />
|
|
<table width="100%" border="0" cellpadding="3" cellspacing="1" class="mainTable">
|
|
<td colspan="2" class="tdTitle"><?php echo $lang['admin_common']['other_store_inventory']; ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td width="33%" class="tdText"><span class="tdText"><?php echo $lang['admin_common']['other_no_products'];?></span></td>
|
|
<td width="50%" class="tdText"><?php echo number_format($noProducts[0]['noProducts']); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td width="33%" class="tdText"><span class="tdText"><?php echo $lang['admin_common']['other_no_customers']; ?></span></td>
|
|
<td width="50%" class="tdText"><?php echo number_format($noCustomers[0]['noCustomers']); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td width="33%" class="tdText"><?php echo $lang['admin_common']['other_no_orders']; ?></td>
|
|
<td width="50%" class="tdText"><?php echo number_format($noOrders[0]['noOrders']); ?></td>
|
|
</tr>
|
|
</table>
|
|
|
|
</td>
|
|
</tr>
|
|
</table>
|