clr_str($_GET["t"]) : 'video');
}
/* check if user is affiliate */
public static function userCheck()
{
global $class_database, $cfg;
$usr_id = (int) $_SESSION["USER_ID"];
if ($usr_id > 0) {
$is_affiliate = $class_database->singleFieldValue('db_accountuser', 'usr_affiliate', 'usr_id', $usr_id);
if ($is_affiliate != 1) {
header("Location: " . $cfg["main_url"] . '/' . VHref::getKey("account"));
exit;
}
} else {
header("Location: " . $cfg["main_url"] . '/' . VHref::getKey("signin"));
exit;
}
}
/* generate this week date range */
private static function getThisWeekDates()
{
$date = date("m/d/Y");
// parse about any English textual datetime description into a Unix timestamp
$ts = strtotime($date);
// find the year (ISO-8601 year number) and the current week
$year = date('o', $ts);
$week = date('W', $ts);
$thisWeek = array();
// print week for the current date
for ($i = 1; $i <= 7; $i++) {
// timestamp from ISO week date format
$ts = strtotime($year . 'W' . $week . $i);
$thisWeek[] = date("Y-m-d", $ts);
}
return $thisWeek;
}
/* generate last week date range */
private static function getLastWeekDates()
{
$lastWeek = array();
$prevMon = abs(strtotime("last week monday"));
$currentDate = abs(strtotime("last week sunday"));
$seconds = 86400; //86400 seconds in a day
$dayDiff = ceil(($currentDate - $prevMon) / $seconds);
if ($dayDiff < 6) {
$dayDiff += 1; //if it's monday the difference will be 0, thus add 1 to it
$prevMon = strtotime("previous monday", strtotime("-$dayDiff day"));
}
$prevMon = date("Y-m-d", $prevMon);
// create the dates from Monday to Sunday
for ($i = 0; $i < 7; $i++) {
$d = date("Y-m-d", strtotime($prevMon . " + $i day"));
$lastWeek[] = $d;
}
return $lastWeek;
}
/* generate month date range */
private static function getMonth($year, $month)
{
// this calculates the last day of the given month
$year = $month == 0 ? $year - 1 : $year;
$month = $month == 0 ? 12 : $month;
$last = cal_days_in_month(CAL_GREGORIAN, $month, $year);
$date = new DateTime();
$res = array();
$i = 0;
// iterates through days
for ($day = 1; $day <= $last; $day++) {
$date->setDate($year, $month, $day);
$res[$i] = $date->format("Y-m-d");
$i += 1;
}
return $res;
}
/* save affiliate settings */
public static function affiliateProfile($sub_panel = false)
{
global $cfg, $db, $class_filter, $language;
$error_message = false;
$user_id = (int) $_SESSION["USER_ID"];
$r = false;
if ($_POST) {
// if (!$sub_panel) {
$af_badge = $class_filter->clr_str($_POST[($sub_panel ? "user_partner_badge" : "user_affiliate_badge")]);
$db->execute(sprintf("UPDATE `db_accountuser` SET `affiliate_badge`='%s' WHERE `usr_id`='%s' LIMIT 1;", $af_badge, $user_id));
if ($db->Affected_Rows() > 0) {
$r = true;
$_SESSION["USER_BADGE"] = $af_badge;
}
// }
$af_api_key = !$sub_panel ? $class_filter->clr_str($_POST["user_affiliate_maps_key"]) : false;
if ($af_api_key) {
$db->execute(sprintf("UPDATE `db_accountuser` SET `affiliate_maps_key`='%s' WHERE `usr_id`='%s' LIMIT 1;", $af_api_key, $user_id));
if ($db->Affected_Rows() > 0) {
$r = true;
}
}
$af_mail = !$sub_panel ? $class_filter->clr_str($_POST["user_affiliate_paypal"]) : $class_filter->clr_str($_POST["user_partner_paypal"]);
if ($af_mail != '') {
$ec = new VValidation;
$error_message = !$ec->checkEmailAddress($af_mail) ? $language["frontend.signup.email.invalid"] : $error_message;
if (!$error_message) {
$field = !$sub_panel ? 'affiliate_email' : 'usr_sub_email';
$em = $db->execute(sprintf("SELECT `%s` FROM `db_accountuser` WHERE `usr_id`!='%s' AND `%s`='%s' LIMIT 1;", $field, $user_id, $field, $af_mail));
$error_message = $db->Affected_Rows() > 0 ? $language["notif.error.existing.email"] : $error_message;
if (!$error_message) {
$db->execute(sprintf("UPDATE `db_accountuser` SET `%s`='%s' WHERE `usr_id`='%s' LIMIT 1;", $field, $af_mail, $user_id));
if ($db->Affected_Rows() > 0) {
$r = true;
}
}
}
}
if ($error_message) {
return VGenerate::noticeTpl('', $error_message, '');
} elseif ($r) {
return VGenerate::noticeTpl('', '', $language["notif.success.request"]);
}
}
}
/* affiliate user dashboard/stats */
public static function accountStats($user_key = '')
{
global $smarty, $language, $db, $cfg, $class_database;
$user_key = !$user_key ? $_SESSION["USER_KEY"] : $user_key;
$user_id = (int) $_SESSION["USER_ID"];
$mod_arr = array("video" => "video", "live" => "live", "image" => "image", "audio" => "audio", "doc" => "document", "blog" => "blog");
$my = $db->execute(sprintf("SELECT `affiliate_email`, `affiliate_badge`, `affiliate_date`, `affiliate_maps_key` FROM `db_accountuser` WHERE `usr_id`='%s' LIMIT 1;", $user_id));
$html = '
' . $language["account.entry.act.affiliate"] . '
';
foreach ($mod_arr as $db_tbl => $module) {
if ($cfg[$module . "_module"] == 1) {
$sql = sprintf("SELECT SUM(`p_amount_shared`) AS `total_balance` FROM `db_%spayouts` WHERE `usr_key`='%s' AND `p_paid`='0' AND `p_active`='1';", $db_tbl, $user_key);
$rt = $db->execute($sql);
$t1 = round($rt->fields["total_balance"], 2);
$sql = sprintf("SELECT SUM(`p_amount_shared`) AS `total_revenue`, COUNT(`file_key`) AS `total_payments` FROM `db_%spayouts` WHERE `usr_key`='%s' AND `p_paid`='1' AND `p_active`='1';", $db_tbl, $user_key);
$rt = $db->execute($sql);
$t2 = round($rt->fields["total_revenue"], 2);
$t3 = $rt->fields["total_payments"];
$html .= '
- ' . str_replace('##TYPE##', $language["frontend.global." . $module[0] . ".c"], $language["account.entry.payout.stats.bal"]) . '
- ' . $t1 . ' ' . $cfg["affiliate_payout_currency"] . '
- ' . str_replace('##TYPE##', $language["frontend.global." . $module[0] . ".c"], $language["account.entry.payout.stats.rev"]) . '
- ' . $t2 . ' ' . $cfg["affiliate_payout_currency"] . '
- ' . str_replace('##TYPE##', $language["frontend.global." . $module[0] . ".c"], $language["account.entry.payout.stats.pay"]) . '
- ' . $t3 . '
';
}
}
$html .= '
';
$af_badge = $my->fields["affiliate_badge"];
$af_email = $my->fields["affiliate_email"];
$af_date = $my->fields["affiliate_date"];
$af_maps = $my->fields["affiliate_maps_key"];
$af_date = date('F j, o, H:i A', strtotime($af_date));
$badges = array('icon-check', 'icon-user', 'icon-coin', 'icon-thumbs-up', 'icon-paypal');
$badge_ht = '';
$smarty->assign('affiliate_date', $af_date);
$smarty->assign('affiliate_email', $af_email);
$smarty->assign('affiliate_badge', $af_badge);
$smarty->assign('affiliate_maps_key', $af_maps);
$smarty->assign('badge_ht', $badge_ht);
// $smarty->assign('user_account_stats', VUseraccount::channelCountStats());
$smarty->assign('html', $html);
}
/* generate payout reports */
public static function payoutReports($type = 'video')
{
global $db, $class_database;
$cfg = $class_database->getConfigurations('affiliate_module,affiliate_token_script,affiliate_view_id,affiliate_payout_figure,affiliate_payout_units,affiliate_payout_share');
if ($cfg["affiliate_module"] == 0) {
return;
}
//$cmd = sprintf("/usr/local/bin/python %s", $cfg["affiliate_token_script"]);
$cmd = sprintf("python %s", $cfg["affiliate_token_script"]);
exec($cmd . ' 2>&1', $output);
$tk = $output[0];
$w = self::getMonth(date("Y"), (date("m") - 1));
$t = count($w) - 1;
$sd = $w[0];
$ed = $w[$t];
$price = $cfg["affiliate_payout_figure"];
$unit = $cfg["affiliate_payout_units"];
$min = $unit;
$minstr = '%3Bga%3AuniquePageviews%3E%3D' . $min;
$apiurl = 'https://www.googleapis.com/analytics/v3/data/ga?ids=ga%3A' . $cfg["affiliate_view_id"] . '&start-date=2018-01-01&end-date=' . $ed . '&metrics=ga%3AuniquePageviews&dimensions=ga%3ApageTitle%2Cga%3Adimension1%2Cga%3Adimension3&filters=ga%3Adimension2%3D%3D' . $type . $minstr . '&access_token=' . $tk;
$res = VServer::curl_tt($apiurl);
$json = json_decode($res);
$entries = is_array($json->rows) ? $json->rows : false;
if ($entries) {
foreach ($entries as $entry) {
$views = $entry[3];
$amt = round((($views * $price) / $unit), 2);
$q = $db->execute(sprintf("SELECT `p_id`, `p_startdate`, `p_enddate`, `p_custom` FROM `db_%spayouts` WHERE `file_key`='%s' ORDER BY `p_id` DESC LIMIT 1;", $type, $entry[2]));
if (!$q->fields["p_id"]) {
$ui = $db->execute(sprintf("SELECT `usr_id` FROM `db_accountuser` WHERE `usr_key`='%s' AND `usr_affiliate`='1' AND `usr_status`='1' LIMIT 1;", $entry[1]));
$uf = $db->execute(sprintf("SELECT `db_id` FROM `db_%sfiles` WHERE `file_key`='%s' LIMIT 1;", $type, $entry[2]));
if ($ui->fields["usr_id"] and $uf->fields["db_id"]) {
$ins = array(
'usr_id' => $ui->fields["usr_id"],
'usr_key' => $entry[1],
'file_key' => $entry[2],
'p_startdate' => $sd,
'p_enddate' => $ed,
'p_views' => $views,
'p_amount' => $amt,
'p_amount_shared' => round((($cfg["affiliate_payout_share"] * $amt) / 100), 2),
'p_state' => 0,
);
$ins = $class_database->doInsert('db_' . $type . 'payouts', $ins);
}
} elseif ($q->fields["p_custom"] == '0') {
$q = $db->execute(sprintf("SELECT SUM(`p_views`) AS `vtotal` FROM `db_%spayouts` WHERE `file_key`='%s'", $type, $entry[2]));
$vt = $q->fields["vtotal"];
if (($views - $vt) >= $unit) {
$views = ($views - $vt);
$amt = round((($views * $price) / $unit), 2);
$ui = $db->execute(sprintf("SELECT `usr_id` FROM `db_accountuser` WHERE `usr_key`='%s' AND `usr_affiliate`='1' AND `usr_status`='1' LIMIT 1;", $entry[1]));
$uf = $db->execute(sprintf("SELECT `db_id` FROM `db_%sfiles` WHERE `file_key`='%s' LIMIT 1;", $type, $entry[2]));
if ($ui->fields["usr_id"] and $uf->fields["db_id"]) {
$ins = array(
'usr_id' => $ui->fields["usr_id"],
'usr_key' => $entry[1],
'file_key' => $entry[2],
'p_startdate' => $sd,
'p_enddate' => $ed,
'p_views' => $views,
'p_amount' => $amt,
'p_amount_shared' => round((($cfg["affiliate_payout_share"] * $amt) / 100), 2),
'p_state' => 0,
);
$ins = $class_database->doInsert('db_' . $type . 'payouts', $ins);
}
}
}
}
}
}
/* generate custom payout reports */
public static function payoutReports_custom($type = 'video')
{
global $db, $class_database;
$cfg = $class_database->getConfigurations('affiliate_module,affiliate_token_script,affiliate_view_id,affiliate_payout_figure,affiliate_payout_units,affiliate_payout_share');
if ($cfg["affiliate_module"] == 0) {
return false;
}
//$cmd = sprintf("/usr/local/bin/python %s", $cfg["affiliate_token_script"]);
$cmd = sprintf("python %s", $cfg["affiliate_token_script"]);
exec($cmd . ' 2>&1', $output);
$tk = $output[0];
$w = self::getMonth(date("Y"), (date("m") - 1));
$t = count($w) - 1;
$sd = $w[0];
$ed = $w[$t];
$rs = $db->execute(sprintf("SELECT `usr_id`, `usr_user`, `usr_key`, `affiliate_pay_custom`, `affiliate_custom` FROM `db_accountuser` WHERE `usr_affiliate`='1' AND `affiliate_custom`!='' AND `usr_status`='1';"));
if ($rs->fields["usr_id"]) {
while (!$rs->EOF) {
$usr_key = $rs->fields["usr_key"];
$af_custom = ($rs->fields["usr_id"] and $rs->fields["affiliate_pay_custom"] == 1) ? unserialize($rs->fields["affiliate_custom"]) : false;
if ($af_custom["share"] != '' and $af_custom["units"] != '' and $af_custom["figure"] != '' and $af_custom["currency"] != '') {
$cfg["affiliate_payout_figure"] = $af_custom["figure"];
$cfg["affiliate_payout_units"] = $af_custom["units"];
$cfg["affiliate_payout_share"] = $af_custom["share"];
$price = $cfg["affiliate_payout_figure"];
$unit = $cfg["affiliate_payout_units"];
$min = $unit;
$minstr = '%3Bga%3AuniquePageviews%3E%3D' . $min;
$usrstr = '%3Bga%3Adimension1%3D%3D' . $usr_key;
$apiurl = 'https://www.googleapis.com/analytics/v3/data/ga?ids=ga%3A' . $cfg["affiliate_view_id"] . '&start-date=2018-01-01&end-date=' . $ed . '&metrics=ga%3AuniquePageviews&dimensions=ga%3ApageTitle%2Cga%3Adimension1%2Cga%3Adimension3&filters=ga%3Adimension2%3D%3D' . $type . $usrstr . $minstr . '&access_token=' . $tk;
$res = VServer::curl_tt($apiurl);
$json = json_decode($res);
$entries = is_array($json->rows) ? $json->rows : false;
if ($entries) {
foreach ($entries as $entry) {
$views = $entry[3];
$amt = round((($views * $price) / $unit), 2);
$q = $db->execute(sprintf("SELECT `p_id`, `p_startdate`, `p_enddate` FROM `db_%spayouts` WHERE `file_key`='%s' AND `p_custom`='1' ORDER BY `p_id` DESC LIMIT 1;", $type, $entry[2]));
if (!$q->fields["p_id"]) {
$uf = $db->execute(sprintf("SELECT `db_id` FROM `db_%sfiles` WHERE `file_key`='%s' LIMIT 1;", $type, $entry[2]));
if ($uf->fields["db_id"]) {
$ins = array(
'usr_id' => $class_database->singleFieldValue('db_accountuser', 'usr_id', 'usr_key', $entry[1]),
'usr_key' => $entry[1],
'file_key' => $entry[2],
'p_startdate' => $sd,
'p_enddate' => $ed,
'p_views' => $views,
'p_amount' => $amt,
'p_amount_shared' => round((($cfg["affiliate_payout_share"] * $amt) / 100), 2),
'p_custom' => 1,
'p_state' => 0,
);
$ins = $class_database->doInsert('db_' . $type . 'payouts', $ins);
}
} else {
$q = $db->execute(sprintf("SELECT SUM(`p_views`) AS `vtotal` FROM `db_%spayouts` WHERE `file_key`='%s' AND `p_custom`='1'", $type, $entry[2]));
$vt = $q->fields["vtotal"];
if (($views - $vt) >= $unit) {
$views = ($views - $vt);
$amt = round((($views * $price) / $unit), 2);
$uf = $db->execute(sprintf("SELECT `db_id` FROM `db_%sfiles` WHERE `file_key`='%s' LIMIT 1;", $type, $entry[2]));
if ($uf->fields["db_id"]) {
$ins = array(
'usr_id' => $class_database->singleFieldValue('db_accountuser', 'usr_id', 'usr_key', $entry[1]),
'usr_key' => $entry[1],
'file_key' => $entry[2],
'p_startdate' => $sd,
'p_enddate' => $ed,
'p_views' => $views,
'p_amount' => $amt,
'p_amount_shared' => round((($cfg["affiliate_payout_share"] * $amt) / 100), 2),
'p_custom' => 1,
'p_state' => 0,
);
$ins = $class_database->doInsert('db_' . $type . 'payouts', $ins);
}
}
}
}
}
}
$rs->MoveNext();
}
}
return true;
}
/* request/cancel affiliate modal */
public static function affiliateRequest()
{
global $smarty, $class_filter, $cfg, $language;
$_do = isset($_GET["do"]) ? $class_filter->clr_str($_GET["do"]) : false;
if (!$_do) {
return;
}
switch ($_do) {
case "make-partner":
$el = array('icon-user', $language["account.entry.btn.submit.prt"], $language["account.overview.request.cancel2a"]);
break;
case "make-affiliate":
$el = array('icon-user', $language["account.entry.btn.submit"], $language["account.overview.request.cancel2"]);
break;
case "clear-partner":
$el = array('icon-user', $language["account.entry.btn.terminate.prt"], $language["account.overview.request.cancel1a"]);
break;
case "clear-affiliate":
$el = array('icon-user', $language["account.entry.btn.terminate"], $language["account.overview.request.cancel1"]);
break;
}
$html = '
';
$html .= '
';
return $html;
}
/* affiliate request emails */
public static function affiliateRequestEmail()
{
global $cfg, $language, $smarty, $class_filter, $db, $class_database, $class_language;
include_once $class_language->setLanguageFile('frontend', 'language.email.notif');
$_do = $class_filter->clr_str($_GET["do"]);
switch ($_do) {
case "make-affiliate-email":
$s1 = $language["affiliate.subject.new"];
$s2 = 'affiliate_approve_request';
break;
case "make-partner-email":
$s1 = $language["partner.subject.new"];
$s2 = 'partner_approve_request';
break;
case "clear-affiliate-email":
$s1 = $language["affiliate.subject.cancel"];
$s2 = 'affiliate_cancel_request';
break;
case "clear-partner-email":
$s1 = $language["partner.subject.cancel"];
$s2 = 'affiliate_cancel_request';
break;
}
if ($_POST) {
include 'f_core/config.backend.php';
$p = sprintf("`usr_id` IN (%s) LIMIT 1;", (int) $_SESSION["USER_ID"]);
$rs = $db->execute(sprintf("SELECT `usr_id`, `usr_email` FROM `db_accountuser` WHERE %s", $p));
if ($rs->fields["usr_id"]) {
while (!$rs->EOF) {
$user_id = $rs->fields["usr_id"];
$user_data = VUserinfo::getUserInfo($user_id);
$mailto = $rs->fields["usr_email"];
$notifier = new VNotify;
$website_logo = $smarty->fetch($cfg["templates_dir"] . '/tpl_frontend/tpl_header/tpl_headerlogo_mail.tpl');
$cfg = $class_database->getConfigurations('backend_email,backend_username,affiliate_payout_currency');
$notifier->msg_subj = $s1;
$_replace = array(
'##TITLE##' => $s1,
'##LOGO##' => $website_logo,
'##USER##' => '' . $_SESSION["USER_NAME"] . '',
'##H2##' => $language["recovery.forgot.password.h2"] . $cfg["backend_username"] . ',',
'##YEAR##' => date('Y'),
);
$notifier->dst_mail = $cfg["backend_email"];
$notifier->dst_name = $cfg["backend_username"];
$notifier->Mail('frontend', $_do, $_replace);
$_output[] = $cfg["backend_username"] . ' -> ' . $s2 . ' -> ' . $notifier->dst_mail . ' -> ' . date("Y-m-d H:i:s");
$log_mail = '.mailer.log';
VServer::logToFile($log_mail, implode("\n", $_output));
$rs->MoveNext();
}
return VGenerate::noticeTpl('', '', $language["notif.success.request"]);
}
}
}
/* generate analytics data */
public static function viewAnalytics()
{
global $smarty, $class_filter, $class_database, $cfg;
if ($cfg["affiliate_module"] == 0) {
return;
}
$type = self::getType();
$f = isset($_GET["f"]) ? $class_filter->clr_str($_GET["f"]) : false;
//$cmd = sprintf("/usr/local/bin/python %s", $cfg["affiliate_token_script"]);
$cmd = sprintf("python %s", $cfg["affiliate_token_script"]);
exec($cmd . ' 2>&1', $output);
$tk = $output[0];
$month = date("m");
$year = date("Y");
$day = date("d");
$views_min = isset($_SESSION["views_min"]) ? $_SESSION["views_min"] : 0;
$views_max = isset($_SESSION["views_max"]) ? $_SESSION["views_max"] : 0;
if (isset($_POST["view_limit_min"]) or isset($_POST["view_limit_max"])) {
$_SESSION["views_min"] = (int) $_POST["view_limit_min"];
$_SESSION["views_max"] = (int) $_POST["view_limit_max"];
$views_min = $_SESSION["views_min"];
$views_max = $_SESSION["views_max"];
}
if ($views_min > 0) {
$smarty->assign('views_min', ';ga:uniquePageviews>=' . $views_min);
}
if ($views_max > 0) {
$smarty->assign('views_max', ';ga:uniquePageviews<=' . $views_max);
}
switch ($f) {
default:
if ($_POST and isset($_POST["custom_date"]) and $_POST["custom_date"] != '') {
if (isset($_GET["a"])) {
$sd = $class_filter->clr_str($_POST["custom_date"]);
$_a = explode("-", $sd);
$sd = $class_filter->clr_str($_POST["custom_date"]);
$ed = $sd;
} elseif (isset($_GET["g"])) {
$sd = $class_filter->clr_str($_POST["custom_date"]);
$ed = $sd;
}
} elseif ($_POST and isset($_POST["custom_date_start"]) and $_POST["custom_date_start"] != '') {
$sd = $class_filter->clr_str($_POST["custom_date_start"]);
$ed = $class_filter->clr_str($_POST["custom_date_end"]);
$sd = $sd == '' ? $year . '-' . $month . '-' . $day : $sd;
$ed = $ed == '' ? $year . '-' . $month . '-' . $day : $ed;
} else {
$sd = $year . '-' . $month . '-' . $day;
$ed = $sd;
}
break;
case "":
case "today":
if (isset($_GET["rp"])) {
$w = self::getMonth(date("Y"), (date("m") - 1));
$t = count($w) - 1;
$sd = $w[0];
$ed = $w[$t];
} else {
$sd = 'today';
$ed = 'today';
}
break;
case "yesterday":
$sd = 'yesterday';
$ed = 'yesterday';
break;
case "thisweek":
$w = self::getThisWeekDates();
$sd = $w[0];
$ed = $w[6];
break;
case "lastweek":
$w = self::getLastWeekDates();
$sd = $w[0];
$ed = $w[6];
break;
case "thismonth":
$w = self::getMonth(date("Y"), date("m"));
$t = count($w) - 1;
$sd = $w[0];
$ed = $w[$t];
break;
case "lastmonth":
$w = self::getMonth(date("Y"), (date("m") - 1));
$t = count($w) - 1;
$sd = $w[0];
$ed = $w[$t];
break;
case "thisyear":
$sd = sprintf("%s-01-01", date("Y"));
$ed = sprintf("%s-12-31", date("Y"));
break;
case "lastyear":
$sd = sprintf("%s-01-01", (date("Y") - 1));
$ed = sprintf("%s-12-31", (date("Y") - 1));
break;
case "last3months":
case "last6months":
$start_date = $day . "-" . $month . "-" . $year;
$start_time = strtotime($start_date);
$end_time = strtotime("-" . ($f == 'last3months' ? 3 : 6) . " month", $start_time);
$lw = array();
for ($i = $end_time; $i < $start_time; $i += 86400) {
$lw[] = date("Y-m-d", $i);
}
$t = count($lw);
$sd = $lw[0];
$ed = $year . '-' . $month . '-' . $day;
break;
}
if (isset($_GET["o"])) {
$w = self::getThisWeekDates();
$smarty->assign('twsd', $w[0]);
$smarty->assign('twed', $w[6]);
$w = self::getLastWeekDates();
$smarty->assign('lwsd', $w[0]);
$smarty->assign('lwed', $w[6]);
}
if (isset($_GET["a"]) or isset($_GET["o"])) {
$html = self::tpl_filter();
} elseif (isset($_GET["g"])) {
$html = self::tpl_filter();
$smarty->assign('tpl_continent_filters', self::tpl_continents());
if ($cfg["is_be"] == 0) {
$smarty->assign('affiliate_maps_api_key', $class_database->singleFieldValue('db_accountuser', 'affiliate_maps_key', 'usr_id', (int) $_SESSION["USER_ID"]));
}
} elseif (isset($_GET["rp"])) {
$html = self::tpl_filter();
$html .= self::html_payouts($sd, $ed);
}
if ($cfg["is_be"] == 1) {
$uk = isset($_GET["uk"]) ? $class_filter->clr_str($_GET["uk"]) : '1';
$smarty->assign('user_filter', $uk);
}
$smarty->assign('file_type', $type);
$smarty->assign('file_filter', $f);
$smarty->assign('sd', $sd);
$smarty->assign('ed', $ed);
$smarty->assign('tpl_token', $tk);
$smarty->assign('tpl_html', $html);
}
/* generate html payout reports */
private static function html_payouts($sd, $ed)
{
include 'f_core/config.backend.php';
global $language, $class_database, $class_filter, $class_language, $db, $cfg, $smarty;
$type = self::getType();
$usr_key = ($cfg["is_be"] == 1 and isset($_GET["uk"])) ? $class_filter->clr_str($_GET["uk"]) : ((!$cfg["is_be"]) ? $_SESSION["USER_KEY"] : false);
$f = isset($_GET["f"]) ? $class_filter->clr_str($_GET["f"]) : 'lastmonth';
if ($f) {
switch ($f) {
default:
if ($_POST and isset($_POST["custom_date_start"]) and $_POST["custom_date_start"] != '') {
$sdf = $class_filter->clr_str($_POST["custom_date_start"]);
$edf = $class_filter->clr_str($_POST["custom_date_end"]);
}
break;
case "":
case "lastmonth":
$w = self::getMonth(date("Y"), (date("m") - 1));
$t = count($w) - 1;
$sdf = $w[0];
$edf = $w[$t];
break;
case "last3months":
$w = self::getMonth(date('Y', strtotime("-3 month")), date('m', strtotime("-3 month")));
$t = count($w) - 1;
$sdf = $w[0];
$w = self::getMonth(date('Y', strtotime("-1 month")), date('m', strtotime("-1 month")));
$t = count($w) - 1;
$edf = $w[$t];
break;
case "last6months":
$w = self::getMonth(date('Y', strtotime("-6 month")), date('m', strtotime("-6 month")));
$t = count($w) - 1;
$sdf = $w[0];
$w = self::getMonth(date('Y', strtotime("-1 month")), date('m', strtotime("-1 month")));
$t = count($w) - 1;
$edf = $w[$t];
break;
case "thisyear":
$sdf = sprintf("%s-01-01", date("Y"));
$edf = sprintf("%s-12-31", date("Y"));
break;
case "lastyear":
$sdf = sprintf("%s-01-01", (date("Y") - 1));
$edf = sprintf("%s-12-31", (date("Y") - 1));
break;
case "lastyear":
break;
}
}
$views_min = isset($_SESSION["views_min"]) ? $_SESSION["views_min"] : 0;
$views_max = isset($_SESSION["views_max"]) ? $_SESSION["views_max"] : 0;
$uk = ($cfg["is_be"] == 1 and isset($_GET["uk"])) ? $class_filter->clr_str($_GET["uk"]) : ((!$cfg["is_be"]) ? $_SESSION["USER_KEY"] : false);
$fk = isset($_GET["fk"]) ? $class_filter->clr_str($_GET["fk"]) : false;
$tab = isset($_GET["tab"]) ? $class_filter->clr_str($_GET["tab"]) : false;
$rt = $db->execute(sprintf("SELECT A.`p_id`, COUNT(A.`file_key`) AS `total_count`, SUM(A.`p_views`) AS `total_views`, SUM(A.`p_amount_shared`) AS `total_balance`,
B.`usr_id`,
C.`file_key`
FROM
`db_%spayouts` A, `db_accountuser` B, `db_%sfiles` C
WHERE
A.`usr_key`=B.`usr_key` AND
B.`usr_id`=C.`usr_id` AND
A.`file_key`=C.`file_key` AND
A.`p_startdate`>='%s' AND
A.`p_enddate`<='%s' AND
%s %s %s %s %s
A.`p_active`='1'
ORDER BY C.`file_title` ASC;",
$type, $type, $sdf, $edf,
($fk ? "A.`file_key`='" . $fk . "' AND " : null),
($uk ? "A.`usr_key`='" . $uk . "' AND " : null),
($views_min > 0 ? "A.`p_views`>='" . $views_min . "' AND " : null),
($views_max > 0 ? "A.`p_views`<='" . $views_max . "' AND " : null),
($tab == 'section-all' ? null : (($tab == 'section-paid') ? "A.`p_paid`='1' AND " : "A.`p_paid`='0' AND "))
)
);
$res = $db->execute(sprintf("SELECT A.`p_id`, A.`file_key`, A.`usr_key`, A.`p_views`, A.`p_amount`, A.`p_amount_shared`, A.`p_startdate`, A.`p_enddate`, A.`p_paid`, A.`p_paydate`,
B.`usr_user`, B.`usr_affiliate`, B.`affiliate_email`, B.`affiliate_pay_custom`, B.`affiliate_custom`, B.`usr_dname`,
C.`file_title`
FROM
`db_%spayouts` A, `db_accountuser` B, `db_%sfiles` C
WHERE
A.`usr_key`=B.`usr_key` AND
B.`usr_id`=C.`usr_id` AND
A.`file_key`=C.`file_key` AND
A.`p_startdate`>='%s' AND
A.`p_enddate`<='%s' AND
%s %s %s %s %s
A.`p_active`='1'
ORDER BY C.`file_title` ASC;",
$type, $type, $sdf, $edf,
($fk ? "A.`file_key`='" . $fk . "' AND " : null),
($uk ? "A.`usr_key`='" . $uk . "' AND " : null),
($views_min > 0 ? "A.`p_views`>='" . $views_min . "' AND " : null),
($views_max > 0 ? "A.`p_views`<='" . $views_max . "' AND " : null),
($tab == 'section-all' ? null : (($tab == 'section-paid') ? "A.`p_paid`='1' AND " : "A.`p_paid`='0' AND "))
)
);
$html = '';
$html .= '
';
$html .= $smarty->fetch("tpl_backend/tpl_settings/ct-save-open-close.tpl");
$html .= '
';
$html .= '
';
$html .= '
' . str_replace(array('##PNR##', '##VNR##', '##TNR##', '##TCR##'), array($rt->fields("total_count"), (int) $rt->fields("total_views"), round($rt->fields("total_balance"), 2), $cfg["affiliate_payout_currency"]), $language["account.entry.payout.found"]) . '
';
$html .= '
';
$html .= '
';
$html .= '
';
$html .= '';
$html .= self::tpl_payout_accordion($res, $sdf, $edf, $views_min, $views_max);
$html .= '';
$html .= '';
$html .= '';
$html .= '
'; //end content-wrap
$html .= '
'; //end v-tabs
$html .= '
';
$price = $cfg["affiliate_payout_figure"];
$unit = $cfg["affiliate_payout_units"];
$html .= '';
$html .= VGenerate::declareJS('$("#lb-wrapper ul.responsive-accordion").mouseover(function(){$(this).find(".responsive-accordion-head").addClass("h-msover");$(this).find(".responsive-accordion-panel").addClass("p-msover");}).mouseout(function(){$(this).find(".responsive-accordion-head").removeClass("h-msover");$(this).find(".responsive-accordion-panel").removeClass("p-msover");});');
return $html;
}
/* generate affiliate badge */
public static function affiliateBadge($usr_affiliate, $af_badge)
{
global $language;
// if (($usr_affiliate == 1 and $af_badge != '') or (isset($_SESSION["USER_AFFILIATE"]) and (int) $_SESSION["USER_AFFILIATE"] == 1 and $af_badge != '') or (isset($_SESSION["USER_PARTNER"]) and (int) $_SESSION["USER_PARTNER"] == 1 and $af_badge != '')) {
if ($usr_affiliate == 1 and $af_badge != '') {
return ' ';
}
}
/* check if user is allowed to submit affiliate or partner requests */
public static function allowRequest($for = 'affiliate')
{
global $cfg, $db;
$usr_id = (int) $_SESSION["USER_ID"];
$min = $cfg[$for . "_requirements_min"];
$type = $cfg[$for . "_requirements_type"];
$sn = $for == 'partner' ? 'USER_PARTNER_REQUEST' : 'USER_AFFILIATE_REQUEST';
if (($for == 'affiliate' and $_SESSION["USER_AFFILIATE"] == 1) or ($for == 'partner' and $_SESSION["USER_PARTNER"] == 1)) {
return;
}
switch ($type) {
case '1': //min N videos views
default:
$sql = sprintf("SELECT SUM(`file_views`) AS `total` FROM `db_videofiles` WHERE `usr_id`='%s'", $usr_id);
$rs = $db->execute($sql);
$total = $rs->fields["total"];
break;
case '2': //min N channel views
$sql = sprintf("SELECT `ch_views` AS `total` FROM `db_accountuser` WHERE `usr_id`='%s' LIMIT 1;", $usr_id);
$rs = $db->execute($sql);
$total = $rs->fields["total"];
break;
case '3': //min N subscribers
$sql = sprintf("SELECT COUNT(`sub_id`) AS `total` FROM `db_subscribers` WHERE `usr_id`='%s' LIMIT 1;", $usr_id);
$rs = $db->execute($sql);
$total = $rs->fields["total"];
break;
case '4': //min N followers
$sql = sprintf("SELECT COUNT(`sub_id`) AS `total` FROM `db_followers` WHERE `usr_id`='%s' LIMIT 1;", $usr_id);
$rs = $db->execute($sql);
$total = $rs->fields["total"];
break;
}
if ($total >= $min) {
$_SESSION[$sn] = true;
return true;
}
$_SESSION[$sn] = false;
return false;
}
/* generate affiliate badge */
public static function getAffiliateBadge($usr_key)
{
global $db, $class_filter, $language;
$usr_key = $class_filter->clr_str($usr_key);
$q = $db->execute(sprintf("SELECT `affiliate_badge` FROM `db_accountuser` WHERE `usr_key`='%s' AND `usr_affiliate`='1' LIMIT 1;", $usr_key));
$b = $q->fields["affiliate_badge"];
if ($b != '') {
return ' ';
}
}
/* generate payout accordions */
private static function tpl_payout_accordion($res, $sdf, $edf, $views_min, $views_max)
{
include 'f_core/config.backend.php';
global $language, $class_database, $class_filter, $class_language, $db, $cfg, $smarty;
$type = self::getType();
$f = isset($_GET["f"]) ? $class_filter->clr_str($_GET["f"]) : false;
$rp = isset($_GET["rp"]) ? $class_filter->clr_str($_GET["rp"]) : false;
switch ($f) {
case "":
case "today":
$_f = !$rp ? self::tpl_filter_text($language["account.entry.f.today"], 'f', true) : $language["account.entry.f.lastmonth"];
break;
case "yesterday":
case "thisweek":
case "lastweek":
case "thismonth":
case "lastmonth":
case "thisyear":
case "lastyear":
case "last3months":
case "last6months":
$_f = $language["account.entry.f." . $f];
break;
case "date":
$_f = isset($_POST["custom_date"]) ? $class_filter->clr_str($_POST["custom_date"]) : $language["account.entry.f.date"];
break;
case "range":
$_f = (isset($_POST["custom_date_start"]) and isset($_POST["custom_date_end"])) ? $class_filter->clr_str($_POST["custom_date_start"]) . ' -- ' . $class_filter->clr_str($_POST["custom_date_end"]) : $language["account.entry.f.range"];
$_f = (isset($_POST["custom_date_start"]) and isset($_POST["custom_date_end"])) ? date('M j', strtotime($class_filter->clr_str($_POST["custom_date_start"]))) . ' -- ' . date('M j, o', strtotime($class_filter->clr_str($_POST["custom_date_end"]))) : $language["account.entry.f.range"];
break;
}
$html .= '';
if ($res->fields["file_key"]) {
while (!$res->EOF) {
$db_id = $res->fields["p_id"];
$usr_user = $res->fields["usr_user"];
$usr_key = $res->fields["usr_key"];
$file_key = $res->fields["file_key"];
$usr_dname = $res->fields["usr_dname"];
$p_amount = $res->fields["p_amount"];
$p_amount_sh = $res->fields["p_amount_shared"];
$p_views = $res->fields["p_views"];
$p_start = $res->fields["p_startdate"];
$p_end = $res->fields["p_enddate"];
$title = $res->fields["file_title"];
$af_mail = $res->fields["affiliate_email"];
$is_af = $res->fields["usr_affiliate"];
//$af_custom = ($res->fields["affiliate_pay_custom"] == 1 and $res->fields["affiliate_custom"] != '') ? unserialize($res->fields["affiliate_custom"]) : false;
$af_custom = $res->fields["affiliate_custom"] != '' ? unserialize($res->fields["affiliate_custom"]) : false;
if ($res->fields["affiliate_pay_custom"] == 1 and $af_custom["share"] != '' and $af_custom["units"] != '' and $af_custom["figure"] != '' and $af_custom["currency"] != '') {
$cfg["affiliate_payout_currency"] = $af_custom["currency"];
$cfg["affiliate_payout_share"] = $af_custom["share"];
$cfg["affiliate_payout_figure"] = $af_custom["figure"];
$p_amount = round((($p_views * $cfg["affiliate_payout_figure"]) / $af_custom["units"]), 2);
$p_amount_sh = round((($cfg["affiliate_payout_share"] * $p_amount) / 100), 2);
}
$p_notify = urlencode($cfg["main_url"] . '/' . VHref::getKey('affiliate') . '?do=ipn');
$p_cancel = urlencode($cfg["main_url"] . '/' . $backend_access_url . '/' . VHref::getKey('be_affiliate') . '?rp=1&ppcancel');
$p_return = urlencode($cfg["main_url"] . '/' . $backend_access_url . '/' . VHref::getKey('be_affiliate') . '?rp=1');
$pp_base = $cfg['paypal_test'] == 1 ? 'https://www.sandbox.paypal.com' : 'https://www.paypal.com';
$usr_link = sprintf("
%s", $cfg["main_url"], $backend_access_url, VHref::getKey('be_members'), $usr_key, ($usr_dname != '' ? $usr_dname . ' / ' . $usr_user : $usr_user));
$pp_link_full = sprintf("%s/cgi-bin/webscr?cmd=_xclick&business=%s&return=%s&cancel_return=%s¬ify_url=%s&tax=0¤cy=%s&item_name=%s&item_number=%s&quantity=1&amount=%s", $pp_base, $af_mail, $p_return, $p_cancel, $p_notify, $cfg["affiliate_payout_currency"], urlencode($title . ' [' . date('M j', strtotime($p_start)) . ' - ' . date('M j, o', strtotime($p_end)) . ']'), urlencode($type[0] . '|' . $db_id), $p_amount);
$pp_link_shared = sprintf("%s/cgi-bin/webscr?cmd=_xclick&business=%s&return=%s&cancel_return=%s¬ify_url=%s&tax=0¤cy=%s&item_name=%s&item_number=%s&quantity=1&amount=%s", $pp_base, $af_mail, $p_return, $p_cancel, $p_notify, $cfg["affiliate_payout_currency"], urlencode($title . ' [' . date('M j', strtotime($p_start)) . ' - ' . date('M j, o', strtotime($p_end)) . ']'), urlencode($type[0] . '|' . $db_id), $p_amount_sh);
$a_href = '
 . ')
';
$title = sprintf("%s
[%s - %s]", $title, date('M j', strtotime($p_start)), date('M j, o', strtotime($p_end)));
$title .= sprintf("%s views$%s", $p_views, ($cfg["is_be"] == 1 ? $p_amount : $p_amount_sh));
$html .= '
';
$html .= '- ';
$html .= '
';
$html .= '
' . $title . '
';
$html .= '
';
$html .= '';
$html .= '
';
$html .= '';
$html .= '
';
$html .= '
';
$html .= '- ' . $a_href . '
';
$html .= '
';
$html .= '
';
$html .= $cfg["is_be"] == 1 ? '- ' . $language["frontend.global.account"] . ': ' . $usr_link . '
' : null;
$html .= '- ' . $language["account.entry.payout.amount"] . ': ' . $p_amount_sh . ' ' . $cfg["affiliate_payout_currency"] . (($res->fields["affiliate_pay_custom"] == 1 and $cfg["is_be"] == 1) ? ' ' : null) . '
';
$html .= '- ' . $language["frontend.global.views.stat"] . ': ' . $p_views . '
';
$html .= '- ' . $language["account.entry.payout.sd"] . ': ' . date('M j, o', strtotime($p_start)) . '
';
$html .= '- ' . $language["account.entry.payout.ed"] . ': ' . date('M j, o', strtotime($p_end)) . '
';
$html .= '- ' . $language["account.entry.payout.paid"] . ': ' . ($res->fields["p_paid"] == 1 ? $language["frontend.global.yes"] : $language["frontend.global.no"]) . '
';
$html .= '
';
$html .= '
';
$html .= '
';
$html .= '';
$html .= '
';
$html .= '
';
$html .= $cfg["is_be"] == 1 ? '- ' . ($af_mail == '' ? 'affiliate email not available' : (($res->fields["p_paid"] == 0) ? '' . $language["account.entry.payout.pay"] . '' : $language["account.entry.payout.paydate"] . ': ' . date('M j, o, H:i:s A', strtotime($res->fields["p_paydate"])))) . '
' : null;
$html .= (!$cfg["is_be"] and $res->fields["p_paid"] == 1) ? '- ' . ($res->fields["p_paid"] == 1 ? $language["account.entry.payout.paydate"] . ': ' . date('M j, o, H:i:s A', strtotime($res->fields["p_paydate"])) : null) . '
' : null;
$html .= '- ' . $language["account.entry.act.views"] . ' ' . $_f . '
';
$html .= '- ' . $language["account.entry.act.views"] . ' ' . date('M j', strtotime($p_start)) . ' -- ' . date('M j, o', strtotime($p_end)) . '
';
if (!$cfg["is_be"] and isset($af_custom["maps"]) and $af_custom["maps"] == 1) {
$html .= '- ' . $language["account.entry.act.maps"] . ' ' . $_f . '
';
$html .= '- ' . $language["account.entry.act.maps"] . ' ' . date('M j', strtotime($p_start)) . ' -- ' . date('M j, o', strtotime($p_end)) . '
';
}
$html .= '- ' . $language["account.entry.act.comp"] . '
';
$html .= '
';
$html .= '
';
$html .= '
';
$html .= '
';
$html .= ' ';
$html .= '
';
@$res->MoveNext();
}
} else {
$html .= '
Sorry, no results were found.
';
}
$html .= '
';
return $html;
}
/* generate continents arrays */
private static function tpl_arrays($key)
{
$a = array();
$a['africa'] = array(
'002' => 'c1.1',
'015' => 'c1.2',
'011' => 'c1.3',
'017' => 'c1.4',
'014' => 'c1.5',
'018' => 'c1.6',
);
$a['america'] = array(
'019' => 'c2.1',
'021' => 'c2.2',
'013' => 'c2.3',
'005' => 'c2.4',
'029' => 'c2.5',
);
$a['asia'] = array(
'142' => 'c3.1',
'143' => 'c3.2',
'030' => 'c3.3',
'034' => 'c3.4',
'035' => 'c3.5',
'145' => 'c3.6',
);
$a['europe'] = array(
'150' => 'c4.1',
'154' => 'c4.2',
'155' => 'c4.3',
'151' => 'c4.4',
'039' => 'c4.5',
);
$a['oceania'] = array(
'009' => 'c5.1',
'053' => 'c5.2',
'054' => 'c5.3',
'057' => 'c5.4',
'061' => 'c5.5',
);
return $a[$key];
}
/* generate continents list */
private static function tpl_continents()
{
global $language, $cfg, $class_filter;
$africa = self::tpl_arrays('africa');
$america = self::tpl_arrays('america');
$asia = self::tpl_arrays('asia');
$europe = self::tpl_arrays('europe');
$oceania = self::tpl_arrays('oceania');
$found = false;
$r = isset($_GET["r"]) ? $class_filter->clr_str($_GET["r"]) : false;
if ($r) {
$s = array($africa, $america, $asia, $europe, $oceania);
foreach ($s as $continent) {
if (isset($continent[$r])) {
$found = $language["account.entry.filter." . $continent[$r]];
}
}
}
$html = '
';
return $html;
}
/* generate continent submenu */
private static function tpl_continents_submenu($array)
{
global $language;
$html = '';
return $html;
}
/* generate filter text */
private static function tpl_filter_text($lang, $param, $remove = false)
{
global $language;
return '' . $lang . ' ' . (!$remove ? '' : '') . '';
}
/* generate sorting section */
private static function tpl_filter()
{
global $language, $cfg, $class_filter, $smarty;
$type = self::getType();
$f = isset($_GET["f"]) ? $class_filter->clr_str($_GET["f"]) : false;
$r = isset($_GET["r"]) ? $class_filter->clr_str($_GET["r"]) : false;
$c = isset($_GET["c"]) ? $class_filter->clr_str($_GET["c"]) : false;
$a = isset($_GET["a"]) ? $class_filter->clr_str($_GET["a"]) : false;
$o = isset($_GET["o"]) ? $class_filter->clr_str($_GET["o"]) : false;
$rp = isset($_GET["rp"]) ? $class_filter->clr_str($_GET["rp"]) : false;
$_s = array();
switch ($f) {
case "":
case "today":
$_s[] = !$rp ? self::tpl_filter_text($language["account.entry.f.today"], 'f', true) : self::tpl_filter_text($language["account.entry.f.lastmonth"], 'f', true);
break;
case "yesterday":
case "thisweek":
case "lastweek":
case "thismonth":
case "lastmonth":
case "thisyear":
case "lastyear":
case "last3months":
case "last6months":
$_s[] = self::tpl_filter_text($language["account.entry.f." . $f], 'f', (($rp and $f == 'lastmonth') ? true : false));
break;
case "date":
$_v = isset($_POST["custom_date"]) ? $class_filter->clr_str($_POST["custom_date"]) : $language["account.entry.f.date"];
$_s[] = self::tpl_filter_text($_v, 'f');
break;
case "range":
$_v = (isset($_POST["custom_date_start"]) and isset($_POST["custom_date_end"])) ? $class_filter->clr_str($_POST["custom_date_start"]) . ' --- ' . $class_filter->clr_str($_POST["custom_date_end"]) : $language["account.entry.f.range"];
$_s[] = self::tpl_filter_text($_v, 'f');
break;
}
if (!$c or $c == 'xx') {
switch ($r) {
case "":
case "world":
if (!$a and !$rp) {
$_s[] = self::tpl_filter_text($language["account.entry.filter.global"], 'r', true);
}
break;
default:
$africa = self::tpl_arrays('africa');
$america = self::tpl_arrays('america');
$asia = self::tpl_arrays('asia');
$europe = self::tpl_arrays('europe');
$oceania = self::tpl_arrays('oceania');
$found = false;
$s = array($africa, $america, $asia, $europe, $oceania);
foreach ($s as $continent) {
if (isset($continent[$r]) and !$found) {
$found = $language["account.entry.filter." . $continent[$r]];
$_s[] = self::tpl_filter_text($found, 'r');
}
}
break;
}
} elseif ($c and $c != 'xx') {
$_s[] = self::tpl_filter_text(strtoupper($c), 'c');
}
if ($o) {
$_s = array();
}
if (isset($_GET["fk"]) and $_GET["fk"] != '') {
$_s[] = self::tpl_filter_text($language["account.entry.search.res"], 'fk');
}
if (isset($_GET["uk"]) and $_GET["uk"] != '') {
$_s[] = self::tpl_filter_text($language["account.entry.search.res"], 'uk');
}
$views_min = isset($_SESSION["views_min"]) ? $_SESSION["views_min"] : 0;
$views_max = isset($_SESSION["views_max"]) ? $_SESSION["views_max"] : 0;
$_i_fe = '
';
$_i_be = '';
$_i = $cfg["is_be"] == 1 ? $_i_be : $_i_fe;
// $_i = $_i_be;
$html = '
' . (isset($_GET["g"]) ? $language["account.entry.act.maps"] : ((isset($_GET["o"])) ? $language["account.entry.act.comp"] : ((isset($_GET["rp"])) ? $language["account.entry.payout.rep"] : $language["account.entry.act.views"]))) . $_i . '
' . ($cfg["is_be"] == 1 ? $smarty->fetch('tpl_backend/tpl_affiliate/tpl_search_inner.tpl') : $smarty->fetch('tpl_frontend/tpl_affiliate/tpl_search_inner.tpl')) . '
' . ($cfg['is_be'] == 1 ? '
' . $smarty->fetch('tpl_backend/tpl_affiliate/tpl_search_user.tpl') . '
' : null) . '
' . ($cfg["video_module"] == 1 ? '' : null) . '
' . ($cfg["live_module"] == 1 ? '' : null) . '
' . ($cfg["image_module"] == 1 ? '' : null) . '
' . ($cfg["audio_module"] == 1 ? '' : null) . '
' . ($cfg["document_module"] == 1 ? '' : null) . '
' . ($cfg["blog_module"] == 1 ? '' : null) . '
' . (!$o ? '
' : null) . '
' . ($_s[0] != '' ? ' ' . $language["files.menu.active.filters"] . ' ' . implode('', $_s) . '' : null) . '
' . ($_s[0] != '' ? '
' : null) . '
' . ((!$o) ? '
' . $language["account.entry.filter.results"] . '
' . (($cfg[(($type == 'doc') ? 'document' : $type) . "_module"] == 1 and !$o) ? self::tpl_filters($type) : null) . '
' : null) . '
';
return $html;
}
/* generated filter html section */
private static function tpl_filters($type, $hidden = false)
{
global $class_filter, $language;
$f = isset($_GET["f"]) ? $class_filter->clr_str($_GET["f"]) : false;
$rp = isset($_GET["rp"]) ? (int) $_GET["rp"] : false;
$html = '
';
return $html;
}
}