} if (!isset($period_range)) { if (isset($Session['prefs']['stats-global-client.php']['period_range'])) { $period_range = $Session['prefs']['stats-global-client.php']['period_range']; } else { $period_range = array('start_day' => 0, 'start_month' => 0, 'start_year' => 0, 'end_day' => 0, 'end_month' => 0, 'end_year' => 0); } } /*********************************************************/ /* Main code */ /*********************************************************/ // Get clients & campaign and build the tree if (phpAds_isUser(phpAds_Admin)) { $res_clients = phpAds_dbQuery("\n\t\tSELECT \n\t\t\t*\n\t\tFROM \n\t\t\t" . $phpAds_config['tbl_clients'] . "\n\t\t" . phpAds_getListOrder($listorder, $orderdirection) . "\n\t\t") or phpAds_sqlDie(); } else { $res_clients = phpAds_dbQuery("\n\t\tSELECT \n\t\t\t*\n\t\tFROM \n\t\t\t" . $phpAds_config['tbl_clients'] . "\n\t\tWHERE\n\t\t\tclientid = " . phpAds_getUserID() . " OR\n\t\t\tparent = " . phpAds_getUserID() . "\n\t\t" . phpAds_getListOrder($listorder, $orderdirection) . "\n\t\t") or phpAds_sqlDie(); } while ($row_clients = phpAds_dbFetchArray($res_clients)) { if ($row_clients['parent'] == 0) { $clients[$row_clients['clientid']] = $row_clients; $clients[$row_clients['clientid']]['expand'] = 0; $clients[$row_clients['clientid']]['count'] = 0; $clients[$row_clients['clientid']]['hideinactive'] = 0; } else { $campaigns[$row_clients['clientid']] = $row_clients; $campaigns[$row_clients['clientid']]['expand'] = 0; $campaigns[$row_clients['clientid']]['count'] = 0; } } // Check period range if ($period_range['start_month'] == 0 || $period_range['start_day'] == 0 || $period_range['start_year'] == 0) {
/*********************************************************/ /* HTML framework */ /*********************************************************/ if ($campaignid != "") { if (isset($Session['prefs']['client-campaigns.php'][$clientid]['listorder'])) { $navorder = $Session['prefs']['client-campaigns.php'][$clientid]['listorder']; } else { $navorder = ''; } if (isset($Session['prefs']['client-campaigns.php'][$clientid]['orderdirection'])) { $navdirection = $Session['prefs']['client-campaigns.php'][$clientid]['orderdirection']; } else { $navdirection = ''; } // Get other campaigns $res = phpAds_dbQuery("\n\t\tSELECT\n\t\t\t*\n\t\tFROM\n\t\t\t" . $phpAds_config['tbl_clients'] . "\n\t\tWHERE\n\t\t\tparent = " . $clientid . "\n\t\t" . phpAds_getListOrder($navorder, $navdirection) . "\n\t"); while ($row = phpAds_dbFetchArray($res)) { phpAds_PageContext(phpAds_buildClientName($row['clientid'], $row['clientname']), "campaign-edit.php?clientid=" . $clientid . "&campaignid=" . $row['clientid'], $campaignid == $row['clientid']); } phpAds_PageShortcut($strClientProperties, 'client-edit.php?clientid=' . $clientid, 'images/icon-client.gif'); phpAds_PageShortcut($strCampaignHistory, 'stats-campaign-history.php?clientid=' . $clientid . '&campaignid=' . $campaignid, 'images/icon-statistics.gif'); $extra = "<form action='campaign-modify.php'>"; $extra .= "<input type='hidden' name='campaignid' value='{$campaignid}'>"; $extra .= "<input type='hidden' name='clientid' value='{$clientid}'>"; $extra .= "<input type='hidden' name='returnurl' value='campaign-edit.php'>"; $extra .= "<br><br>"; $extra .= "<b>{$strModifyCampaign}</b><br>"; $extra .= "<img src='images/break.gif' height='1' width='160' vspace='4'><br>"; $extra .= "<img src='images/icon-move-campaign.gif' align='absmiddle'> {$strMoveTo}<br>"; $extra .= "<img src='images/spacer.gif' height='1' width='160' vspace='2'><br>"; $extra .= " ";
if (isset($Session['prefs']['client-campaigns.php'][$clientid]['orderdirection'])) { $orderdirection = $Session['prefs']['client-campaigns.php'][$clientid]['orderdirection']; } else { $orderdirection = ''; } } if (isset($Session['prefs']['client-campaigns.php'][$clientid]['nodes'])) { $node_array = explode(",", $Session['prefs']['client-campaigns.php'][$clientid]['nodes']); } else { $node_array = array(); } /*********************************************************/ /* Main code */ /*********************************************************/ // Get clients & campaign and build the tree $res_clients = phpAds_dbQuery("\n\tSELECT \n\t\t*,\n\t\tDATE_FORMAT(expire, '{$date_format}') AS expire_f,\n\t\tDATE_FORMAT(activate, '{$date_format}') AS activate_f\n\tFROM \n\t\t" . $phpAds_config['tbl_clients'] . "\n\tWHERE\n\t\tparent = " . $clientid . "\n\t" . phpAds_getListOrder($listorder, $orderdirection) . "\n") or phpAds_sqlDie(); while ($row_clients = phpAds_dbFetchArray($res_clients)) { $campaigns[$row_clients['clientid']] = $row_clients; $campaigns[$row_clients['clientid']]['expand'] = 0; $campaigns[$row_clients['clientid']]['count'] = 0; } // Get the banners for each campaign $res_banners = phpAds_dbQuery("\n\tSELECT \n\t\tbannerid,\n\t\tclientid,\n\t\talt,\n\t\tdescription,\n\t\tactive,\n\t\tstoragetype\n\tFROM \n\t\t" . $phpAds_config['tbl_banners'] . "\n\t\t" . phpAds_getBannerListOrder($listorder, $orderdirection) . "\n\t") or phpAds_sqlDie(); while ($row_banners = phpAds_dbFetchArray($res_banners)) { if (isset($campaigns[$row_banners['clientid']])) { $banners[$row_banners['bannerid']] = $row_banners; $campaigns[$row_banners['clientid']]['count']++; } } // Add ID found in expand to expanded nodes if (isset($expand) && $expand != '') {