<?php

/* ADMIN SYSTEM MODULE
----------------------------------*/

if (!defined('PARENT') || !isset($mswUser)) {
  include(PATH . 'control/modules/header/403.php');
}

include(MSW_ADM_LANG . basename(__file__));

$fjs[] = 'textarea';
$fjs[] = 'priceformat';
$fjs[] = 'datepicker';
$fjs[] = 'jq-ui';
$mswPick = array(
  'lang' => $DT->jslang($msw_cal),
  'time' => 'false'
);
$pagePrefix = $msw_adm_nav24;

if (isset($_GET['id'])) {
  $ID = (int) $_GET['id'];
  $Q  = $DB->db_query("SELECT * FROM `" . DB_PREFIX . "affiliates_commissions` WHERE `id` = '{$ID}'");
  $ED = $DB->db_object($Q);
  if (!isset($ED->id)) {
    include(PATH . 'control/modules/header/403.php');
  }
  $Q2 = $DB->db_query("SELECT * FROM `" . DB_PREFIX . "affiliates` WHERE `id` = '{$ED->affid}'");
  $AF = $DB->db_object($Q2);
  if (!isset($AF->id)) {
    include(PATH . 'control/modules/header/403.php');
  }
  if ($ED->ts > 0) {
    $airCFG = array(
      'y' => date('Y', $ED->ts),
      'm' => date('m', $ED->ts),
      'd' => date('d', $ED->ts)
    );
  }
  $pagePrefix = $msw_adm_commissions_add9 . ' (' . $AF->fname . ' ' . $AF->lname . ')';
}

if (isset($_GET['aid'])) {
  $ID = (int) $_GET['aid'];
  $Q  = $DB->db_query("SELECT * FROM `" . DB_PREFIX . "affiliates` WHERE `id` = '{$ID}'");
  $AFL = $DB->db_object($Q);
  if (!isset($AFL->id)) {
    include(PATH . 'control/modules/header/403.php');
  }
  $pagePrefix = $msw_adm_commissions_add9 . ' (' . $AFL->fname . ' ' . $AFL->lname . ')';
}

include(PATH . 'content/_header.php');
include(PATH . 'content/' . basename(__file__));
include(PATH . 'content/_footer.php');

?>