function Grid1_Load($va) { global $scDb; $cUserName = GetSession("cSession_UserName"); $cLv_Admin = scSys::GetConfig("sc_admin"); $cLv = GetSession("cSession_SCLevel"); $cLimit = $va['offset'] . "," . $va['limit']; //limit $vaOrder = array(); if (isset($va['sort'])) { unset($va['sort'][13]); unset($va['sort'][14]); foreach ($va['sort'] as $key => $vaValue) { $vaOrder[] = $vaValue['field'] . " " . $vaValue['direction']; } } $cOrder = implode(",", $vaOrder); if ($cOrder == "") { $cOrder = "status ASC"; } //init order grid $dTglAwal = scDate::Date2String($va['dTglAwal']); $dTglAkhir = scDate::Date2String($va['dTglAkhir']); $cWhere_opt = ""; if ($va['optStatusF'] !== "-") { $cWhere_opt = " AND status = '{$va['optStatusF']}' "; } $vaWhere = array(); if (isset($va['search'])) { unset($va['search'][13]); unset($va['search'][14]); foreach ($va['search'] as $key => $vaValue) { $vaWhere[] = $vaValue['field'] . " like '%" . $vaValue['value'] . "%'"; } } //init where grid $cWhere = "date >= '{$dTglAwal}' AND date <= '{$dTglAkhir}' " . $cWhere_opt . (!empty($vaWhere) ? " AND (" . implode(" OR ", $vaWhere) . ")" : ""); $vaReturn = array(); $dbData = $scDb->Browse("sppd", "*", $cWhere, "", "", $cOrder, $cLimit); $dbDataNL = $scDb->Browse("sppd", "*", $cWhere); while ($dbRow = $scDb->GetRow($dbData)) { $dbRow['recid'] = $dbRow['code']; $cStatus = $dbRow['status']; $dbRow['code'] = '<a class="a-click" onClick="OBJFORM_NEW.trsppd.Print(\'' . $dbRow['recid'] . '\')">' . $dbRow['recid'] . '</a>'; $dbRow['code'] = html_entity_decode($dbRow['code']); $dbRow['status'] = html_entity_decode(sppd::GetStatus($dbRow['status'], true)); $dbRow['date'] = scDate::String2Date($dbRow['date']); $dbRow['date_go'] = scDate::String2Date($dbRow['date_go']); $dbRow['date_back'] = scDate::String2Date($dbRow['date_back']); $dbRow['letter_date'] = scDate::String2Date($dbRow['letter_date']); $dbRow['nip_pejabat'] = scSys::GetKeteranganOne("nama", "nip = '{$dbRow['nip_pejabat']}'", "pegawai"); $dbRow['nip_leader'] = scSys::GetKeteranganOne("nama", "nip = '{$dbRow['nip_leader']}'", "pegawai"); $dbRow['username'] = scSys::GetKeteranganOne("FullName", "UserName = '******'username']}'", "username"); $vaReturn[] = $dbRow; } $vaReturn = array("total" => $scDb->Rows($dbDataNL), "records" => $vaReturn); echo json_encode($vaReturn); }
public static function GetTMP_File($cDir, $cFileLoc, $va) { unset($va['file']); $cTMP = self::GetTMP(); $cFile = $cTMP . $cDir . "/" . md5($cFileLoc) . "/"; self::CreateDir($cFile); $cFile .= md5(implode(",", $va) . date("Ym") . GetSession("cSession_UserName") . session_id()) . ".sctmp"; return $cFile; }
public static function GetData_Menu($cPath = "", $cSession = "", $cmenu_key_set = "", $cmodul_name = "") { $vaReturn = array(); $vaReturn_Menu = array(); $lEmpty = true; if ($cSession !== "") { $vaReturn = GetSession($cSession); if ($vaReturn !== "") { $lEmpty = false; $vaReturn = json_decode($vaReturn, true); } } if ($lEmpty) { if ($cPath == "") { $cFileLoc = self::$cFileLoc; } else { $cFileLoc = $cPath . "scmenu.menu.php"; } if (is_file($cFileLoc)) { $vaFile = file($cFileLoc); if (is_array($vaFile)) { $vaReturn_Menu = $nkey_pos = 0; $ckey_pos = 0; $vakey_pos = array(); $vaSet = array(); foreach ($vaFile as $ckeyfile => $cvalue) { $cIdentifier = strpos($cvalue, "#"); if ($cIdentifier === false && trim($cvalue) !== "" && strpos($cvalue, "<?php die('Sapeltu Inc.'); ?>") !== 0) { $nPos = strpos($cvalue, "["); $vaMenu = scArray::Menu2Array($cvalue, $cPath, $cmodul_name); if ($nPos == 0) { $vakey_pos = array(); } $cmenu_key = $vaMenu['cMd5']; $vakey_pos[$nPos] = $cmenu_key; self::SetArray_Tree($vaReturn, $vakey_pos, $nPos, $cmenu_key, $vaMenu); } } } if (is_array($vaReturn)) { SaveSession($cSession, json_encode($vaReturn)); $vaReturn_Menu = $vaReturn; } if ($cmenu_key_set !== "") { $vaReturn_Menu = self::GetData_Menu($cFileLoc, $cSession, $cmenu_key_set); } } } else { if ($cmenu_key_set == "") { $vaReturn_Menu = $vaReturn; } else { $vaReturn_Menu = self::GetData_Menuchildren($vaReturn, $cmenu_key_set); } } return $vaReturn_Menu; }
function Logout($va) { global $scDb; $cUserName = GetSession("cSession_UserName"); $vaArray = array("LastLogin" => "0000-00-00 00:00:00"); $scDb->Edit("username", $vaArray, "UserName = '******'", false); echo ' window.location = "./logout.php" ; '; }
/** * Process * Check if we are viewing statistics as another user or not so we can change the links created. * We will also display a warning about which user we are creating the tracking code for. * * @see TrackPoint_Functions::Process */ function Process() { $session =& GetSession(); $switched_user = $session->Get('SwitchUser'); if ($switched_user) { $switched_username = $session->Get('SwitchUserName'); $GLOBALS['TrackPointUserID'] = $switched_user; $GLOBALS['WarningMessage'] = sprintf(GetLang('ConversionCodeForUser'), $switched_username); } TrackPoint_Functions::Process(); }
/** * Process * Processes the creation of the payperclick campaign. * Uses an iframe to post the results when a particular action is set. * Makes it nice and easy to keep creating payperclicks and not worrying about retyping any of the information. * * @see Trackpoint_Functions::Process() * * @return void */ function Process() { $session =& GetSession(); $thisuser = $session->Get('UserDetails'); $userid = $thisuser->userid; $switched_user = $session->Get('SwitchUser'); if ($switched_user) { $userid = $switched_user; $switched_username = $session->Get('SwitchUserName'); $GLOBALS['WarningMessage'] = sprintf(GetLang('PPCCodeForUser'), $switched_username); } $action = isset($_GET['Action']) ? strtolower($_GET['Action']) : null; switch ($action) { case 'ppclink': if (isset($_GET['Process'])) { $querystring = ''; if ($userid != 1) { $querystring .= 'u=' . $userid . '&'; } if (isset($_POST['EncodeInfo'])) { $querystring .= 'e=' . stripslashes($_POST['ppcEngine']); $querystring .= '&n=' . stripslashes($_POST['ppcName']); if (is_numeric($_POST['ppcCost'])) { $querystring .= '&c=' . (double) $_POST['ppcCost']; } $querystring = 'ppce=' . urlencode(base64_encode($querystring)); } else { $querystring .= 'ppc=' . urlencode(stripslashes($_POST['ppcEngine'])); $querystring .= '&name=' . urlencode(stripslashes($_POST['ppcName'])); if (is_numeric($_POST['ppcCost'])) { $querystring .= '&cost=' . (double) $_POST['ppcCost']; } } $url = stripslashes($_POST['landingURL']) . '/?'; if (strpos($_POST['landingURL'], '?') !== false) { $url = stripslashes($_POST['landingURL']) . '&' . $querystring; } else { $landingurl = stripslashes($_POST['landingURL']); $urlparts = explode('/', $landingurl); $filename = array_pop($urlparts); if (strpos($filename, '.') !== false || substr($landingurl, -1) == '/') { $url = $landingurl . '?' . $querystring; } else { $url = $landingurl . '/?' . $querystring; } } echo '<span style="font-family: tahoma; font-size: 12px;">' . $url . '</span>'; } break; default: Trackpoint_Functions::Process(); } }
function Saving($va) { global $scDb; $cNip = $va['cNip']; $vaArray = array("nip" => $va['cNip'], "nama" => $va['cNama'], "alamat" => $va['cAlamat'], "tanggal_lahir" => scDate::Date2String($va['dTempat_Tgl']), "tempat_lahir" => $va['cTempat'], "golongan" => $va['cGolongan'], "golongan_tanggal" => scDate::Date2String($va['dGolongan_Tgl']), "jabatan" => $va['cJabatan'], "jabatan_tanggal" => scDate::Date2String($va['dJabatan_Tgl']), "kerja_tahun" => $va['nKerjaTahun'], "kerja_bulan" => $va['nKerjaBulan'], "latihan_jabatan" => $va['cJabatan_Lat'], "latihan_jabatan_tanggal" => scDate::Date2String($va['dJabatan_Lat_Tgl']), "latihan_jabatan_jam" => $va['nJabatan_Lat'], "pendidikan" => $va['cPendidikan'], "pendidikan_lulus" => $va['nThLulus'], "pendidikan_ijazah" => $va['cIjazah'], "catatan_mutasi" => $va['cCatatan_Mutasi'], "keterangan" => $va['cKeterangan'], "no_hp" => $va['cno_hp']); $vaInsert = array("username" => GetSession("cSession_UserName")); $vaUpdate = array("username_update" => GetSession("cSession_UserName")); $scDb->Update("pegawai", $vaArray, "nip = '{$cNip}'", true, $vaInsert, $vaUpdate); echo ' alert("Data sudah disimpan") ; OBJFORM_NEW.mstpegawai.Init() ; '; }
function LoadUser($va) { global $scDb; $cSearch = $va['cSearch']; $dbData = $scDb->Browse("username", "UserName,FullName", "(UserName like '%{$cSearch}%' or FullName like '%{$cSearch}%') ", "", "", "", "0,5"); $vaArray = array(); if (GetSession("cSession_Level") !== "9") { while ($dbRow = $scDb->GetRow($dbData)) { $vaArray[] = array("id" => $dbRow['UserName'], "text" => $dbRow['FullName']); } } $cArray = !empty($vaArray) ? json_encode($vaArray) : "[{id:0,text:\"Tidak ditemukan\"}]"; echo $cArray; }
/** * Process * Logs you out and redirects you back to the login page. * If you are automatically logged in, * this will also remove the cookie (sets the time back a year) * so you're not automatically logged in anymore. * * @see Login::Process * @see GetSession * @see Session::Set * * @return void */ function Process() { $session =& GetSession(); $sessionuser = $session->Get('UserDetails'); $userid = $sessionuser->userid; $user =& GetUser($userid); $user->settings = $sessionuser->settings; $user->SaveSettings(); unset($user); $session->Set('UserDetails', ''); if (isset($_COOKIE['TrackPointLogin'])) { $oneyear = time() - 3600 * 265 * 24; setcookie('TrackPointLogin', '', $oneyear, '/'); } $_SESSION = array(); session_destroy(); header('Location: ' . $_SERVER['PHP_SELF'] . '?Page=Login&Action=Logout'); }
function LoadSPPD_Pelaporan($va) { global $scDb; $cUserName = GetSession("cSession_UserName"); $cLv_Admin = scSys::GetConfig("sc_admin"); $cLv = GetSession("cSession_SCLevel"); $cNip = GetSession("cSession_UserName_Target"); $cSearch = $va['cSearch']; $vaArray = array(); $cWhere = strpos($cLv_Admin, $cLv) === false ? "code LIKE '%{$cSearch}%' AND (nip_leader = '{$cNip}')" : "code LIKE '%{$cSearch}%'"; $dbData = $scDb->Browse("sppd", "code,date", $cWhere); while ($dbRow = $scDb->GetRow($dbData)) { $vaArray[] = array("id" => $dbRow['code'], "text" => $dbRow['code'] . " pada tanggal " . scDate::String2Date($dbRow['date'])); } if (empty($vaArray)) { $vaArray[] = array("id" => "scnull", "text" => "Tidak ditemukan"); } echo json_encode($vaArray); }
function Saving($va) { scSys::SaveConfig("sc_front_url", $va['cUrl']); scSys::SaveConfig("sc_front_title", $va['cTitle']); scSys::SaveConfig("sc_admin", $va['sc_admin']); scSys::SaveConfig("sc_company", $va['sc_company']); scSys::SaveConfig("sc_kepala_dinas", $va['sc_kepala_dinas']); //foto $cFoto = GetSession("fileFoto1"); if (trim($cFoto) !== "") { unlink($cFoto); scSys::SaveConfig("sc_logo", GetSession("fileFoto1")); } $cFoto = GetSession("fileFoto2"); if (trim($cFoto) !== "") { unlink($cFoto); scSys::SaveConfig("sc_header", GetSession("fileFoto2")); } echo "alert('Data have been saved');"; }
function Saving($va) { global $scDb; $code = $va['code']; $cResult = scSys::GetKeteranganOne("result", "code = '{$code}'", "sppd"); $vaArray = array("result" => $va['result'], "status" => "2"); if ($cResult !== "") { $vaArray['result_username_update'] = GetSession("cSession_UserName"); } else { $vaArray["result_date"] = date("Y-m-d"); $vaArray['result_username'] = GetSession("cSession_UserName"); } $scDb->Update("sppd", $vaArray, "code = '{$va['code']}'"); $cButton = '<button type="button" class="btn btn-success" style="display:inline-block" id="cmdCetak" name="cmdCetak" onclick="OBJFORM_NEW.trsppd_laporan.Print("' . $va['code'] . '")">Cetak</button>'; echo ' OBJFORM_NEW.trsppd_laporan.Obj .find("#wrapPrint").html("' . scSys::CheckText($cButton) . '") ; '; }
public function HandleToDo($Do) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Orders') => 'index.php?ToDo=viewOrders'); switch (isc_strtolower($Do)) { case 'viewsales': default: if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Manage_Orders)) { if (isset($_GET['searchQuery'])) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Orders') => "index.php?ToDo=viewOrders", GetLang('SearchResults') => "index.php?ToDo=viewOrders"); } else { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Orders') => "index.php?ToDo=viewOrders"); } if (GetSession('ordersearch') > 0) { if (!isset($_GET['searchId'])) { $_GET['searchId'] = GetSession('ordersearch'); $_REQUEST['searchId'] = GetSession('ordersearch'); } if ($_GET['searchId'] > 0) { $GLOBALS['BreadcrumEntries'] = array_merge($GLOBALS['BreadcrumEntries'], array(GetLang('CustomView') => "index.php?ToDo=customOrderSearch")); } } if (!isset($_REQUEST['ajax'])) { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); } if (GetSession('ordersearch') > 0) { $this->CustomSearch(); } else { UnsetSession('ordersearch'); $this->ManageOrders(); } if (!isset($_REQUEST['ajax'])) { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); } } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } } }
function SavingFoto($va) { $cDim = GetSession("cSession_UserName"); $cReturn = null; $cDir = "./uploaded/profile/"; foreach ($va['file'] as $vaFile) { $vaInfo = pathinfo($vaFile['name']); $cDir = $cDir . $cDim . "." . $vaInfo['extension']; if (is_file($cDir)) { unlink($cDir . ".tmp"); unlink($cDir); } if (move_uploaded_file($vaFile['tmp_name'], $cDir . ".tmp")) { scImages::GenerateThumbnail($cDir . ".tmp", $cDir, 599, 399); unlink($cDir . ".tmp"); $cReturn = $cDir; } else { $cReturn = ""; } } SaveSession("g" . $cDim, $cReturn); echo 'oProfile.Saving() ; '; }
public function HandleToDo($Do) { switch (isc_strtolower($Do)) { case "deleteproductvariations": if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Manage_Variations)) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Products') => "index.php?ToDo=viewProducts", GetLang("ProductVariations") => "index.php?ToDo=viewProductVariations", GetLang('DeleteProductVariation') => "index.php?ToDo=deleteProductVariation"); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); $this->DeleteVariations(); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); die; } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "editproductvariation2": if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Manage_Variations)) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Products') => "index.php?ToDo=viewProducts", GetLang("ProductVariations") => "index.php?ToDo=viewProductVariations", GetLang('EditProductVariation') => "index.php?ToDo=editProductVariation"); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); $this->EditVariationStep2(); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); die; } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "editproductvariation": if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Manage_Variations)) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Products') => "index.php?ToDo=viewProducts", GetLang("ProductVariations") => "index.php?ToDo=viewProductVariations", GetLang('EditProductVariation') => "index.php?ToDo=editProductVariation"); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); $this->EditVariationStep1(); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); die; } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "addproductvariation2": if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Manage_Variations)) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Products') => "index.php?ToDo=viewProducts", GetLang("ProductVariations") => "index.php?ToDo=viewProductVariations", GetLang('AddProductVariation') => "index.php?ToDo=addProductVariation"); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); $this->AddVariationStep2(); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); die; } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "addproductvariationoption": if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Manage_Variations)) { $this->AddVariationOptionStep1(); die; } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "addproductvariation": if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Manage_Variations)) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Products') => "index.php?ToDo=viewProducts", GetLang("ProductVariations") => "index.php?ToDo=viewProductVariations", GetLang('AddProductVariation') => "index.php?ToDo=addProductVariation"); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); $this->AddVariationStep1(); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); die; } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "viewproductvariations": if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Manage_Variations)) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Products') => "index.php?ToDo=viewProducts", GetLang('ProductVariations') => "index.php?ToDo=viewProductVariations"); if (!isset($_REQUEST['ajax'])) { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); } $this->ViewVariations(); if (!isset($_REQUEST['ajax'])) { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); } die; } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "savebulkeditproducts": if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Edit_Products) && gzte11(ISC_LARGEPRINT)) { if (isset($_POST['addanother'])) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Products') => "index.php?ToDo=viewProducts", GetLang('EditProduct') => "index.php?ToDo=editProduct"); } else { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Products') => "index.php?ToDo=viewProducts"); if (GetSession('productsearch') > 0) { if (!isset($_GET['searchId'])) { $_GET['searchId'] = GetSession('productsearch'); $_REQUEST['searchId'] = GetSession('productsearch'); } if ($_GET['searchId'] > 0) { $GLOBALS['BreadcrumEntries'] = array_merge($GLOBALS['BreadcrumEntries'], array(GetLang('CustomView') => "index.php?ToDo=customProductSearch")); } } } $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); $this->BulkEditProductsStep2(); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); die; } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "bulkeditproducts": if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Edit_Products) && gzte11(ISC_LARGEPRINT)) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Products') => "index.php?ToDo=viewProducts", GetLang('BulkEditProducts1') => "index.php?ToDo=bulkEditProducts"); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); $this->BulkEditProductsStep1(); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); die; } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "createproductview": if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Manage_Products)) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Products') => "index.php?ToDo=viewProducts", GetLang('CreateProductView') => "index.php?ToDo=createProductView"); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); $this->CreateView(); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "importproducts": if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Import_Products)) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Products') => "index.php?ToDo=viewProducts", GetLang('ImportProducts') => "index.php?ToDo=importProducts"); $this->ImportProducts(); } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "editproduct2": if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Edit_Products)) { if (isset($_POST['addanother'])) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Products') => "index.php?ToDo=viewProducts", GetLang('EditProduct') => "index.php?ToDo=editProduct"); } else { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Products') => "index.php?ToDo=viewProducts"); if (GetSession('productsearch') > 0) { if (!isset($_GET['searchId'])) { $_GET['searchId'] = GetSession('productsearch'); $_REQUEST['searchId'] = GetSession('productsearch'); } if ($_GET['searchId'] > 0) { $GLOBALS['BreadcrumEntries'] = array_merge($GLOBALS['BreadcrumEntries'], array(GetLang('CustomView') => "index.php?ToDo=customProductSearch")); } } } $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); $this->EditProductStep2(); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); die; } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "editproduct": if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Edit_Products)) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Products') => "index.php?ToDo=viewProducts", GetLang('EditProduct') => "index.php?ToDo=editProduct"); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); $this->EditProductStep1(); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); die; } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "editproductvisibility": if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Edit_Products)) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Products') => "index.php?ToDo=viewProducts"); if (!isset($_REQUEST['ajax'])) { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); } $this->EditVisibility(); if (!isset($_REQUEST['ajax'])) { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); } die; } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "editproductfeatured": if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Edit_Products)) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Products') => "index.php?ToDo=viewProducts"); if (!isset($_REQUEST['ajax'])) { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); } $this->EditFeatured(); if (!isset($_REQUEST['ajax'])) { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); } die; } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "deleteproducts": if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Delete_Products)) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Products') => "index.php?ToDo=viewProducts"); if (GetSession('productsearch') > 0) { if (!isset($_GET['searchId'])) { $_GET['searchId'] = GetSession('productsearch'); $_REQUEST['searchId'] = GetSession('productsearch'); } if ($_GET['searchId'] > 0) { $GLOBALS['BreadcrumEntries'] = array_merge($GLOBALS['BreadcrumEntries'], array(GetLang('CustomView') => "index.php?ToDo=customProductSearch")); } } $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); $this->DeleteProducts(); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); die; } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "addproduct2": if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Create_Product)) { if (isset($_POST['addanother'])) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Products') => "index.php?ToDo=viewProducts", GetLang('AddProduct') => "index.php?ToDo=addProduct"); } else { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Products') => "index.php?ToDo=viewProducts"); if (GetSession('productsearch') > 0) { if (!isset($_GET['searchId'])) { $_GET['searchId'] = GetSession('productsearch'); $_REQUEST['searchId'] = GetSession('productsearch'); } if ($_GET['searchId'] > 0) { $GLOBALS['BreadcrumEntries'] = array_merge($GLOBALS['BreadcrumEntries'], array(GetLang('CustomView') => "index.php?ToDo=customProductSearch")); } } } $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); $this->AddProductStep2(); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); die; } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "addproduct": if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Create_Product)) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Products') => "index.php?ToDo=viewProducts", GetLang('AddProduct') => "index.php?ToDo=addProduct"); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); $this->AddProductStep1(); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); die; } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "deletecustomproductsearch": if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Manage_Products)) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Products') => "index.php?ToDo=viewProducts"); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); $this->DeleteCustomSearch(); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "customproductsearch": if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Manage_Products)) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Products') => "index.php?ToDo=viewProducts", GetLang('CustomView') => "index.php?ToDo=customProductSearch"); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); $this->CustomSearch(); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "searchproductsredirect": if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Manage_Products)) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Products') => "index.php?ToDo=viewProducts", GetLang('SearchResults') => "index.php?ToDo=searchProducts"); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); $this->SearchProductsRedirect(); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "searchproducts": if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Manage_Products)) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Products') => "index.php?ToDo=viewProducts", GetLang('SearchProducts') => "index.php?ToDo=searchProducts"); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); $this->SearchProducts(); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "popupproductselect": $this->PopupProductSelect(); break; case "deleteproductsearchresults": if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Delete_Products)) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Products') => "index.php?ToDo=viewProducts"); if (GetSession('productsearch') > 0) { if (!isset($_GET['searchId'])) { $_GET['searchId'] = GetSession('productsearch'); $_REQUEST['searchId'] = GetSession('productsearch'); } if ($_GET['searchId'] > 0) { $GLOBALS['BreadcrumEntries'] = array_merge($GLOBALS['BreadcrumEntries'], array(GetLang('CustomView') => "index.php?ToDo=customProductSearch")); } } $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); $this->DeleteSearchResults(); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); die; } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "copyproduct": if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Create_Product)) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Products') => "index.php?ToDo=viewProducts", GetLang('CopyProduct') => "index.php?ToDo=copyProduct"); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); $this->CopyProductStep1(); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); die; } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "copyproduct2": if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Create_Product)) { if (isset($_POST['addanother'])) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Products') => "index.php?ToDo=viewProducts", GetLang('CopyProduct') => "index.php?ToDo=addProduct"); } else { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Products') => "index.php?ToDo=viewProducts"); if (GetSession('productsearch') > 0) { if (!isset($_GET['searchId'])) { $_GET['searchId'] = GetSession('productsearch'); $_REQUEST['searchId'] = GetSession('productsearch'); } if ($_GET['searchId'] > 0) { $GLOBALS['BreadcrumEntries'] = array_merge($GLOBALS['BreadcrumEntries'], array(GetLang('CustomView') => "index.php?ToDo=customProductSearch")); } } } $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); $this->CopyProductStep2(); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); die; } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; default: if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Manage_Products)) { if (isset($_GET['searchQuery'])) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Products') => "index.php?ToDo=viewProducts", GetLang('SearchResults') => "index.php?ToDo=viewProducts"); } else { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Products') => "index.php?ToDo=viewProducts"); } if (GetSession('productsearch') > 0) { if (!isset($_GET['searchId'])) { $_GET['searchId'] = GetSession('productsearch'); $_REQUEST['searchId'] = GetSession('productsearch'); } if ($_GET['searchId'] > 0) { $GLOBALS['BreadcrumEntries'] = array_merge($GLOBALS['BreadcrumEntries'], array(GetLang('CustomView') => "index.php?ToDo=customProductSearch")); } } if (!isset($_REQUEST['ajax'])) { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); } if (GetSession('productsearch') > 0) { $this->CustomSearch(); } else { UnsetSession('productsearch'); $this->ManageProducts(); } if (!isset($_REQUEST['ajax'])) { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); } } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } } }
function CopyIn(&$a_vars, $b_overwrite_empty) { //$s_db = "Session CopyIn:\n"; $n_copied = 0; foreach ($this->_aAccessList as $s_var_name) { if (IsSetSession($s_var_name)) { if (!isset($a_vars[$s_var_name]) || $b_overwrite_empty && FieldManager::IsEmpty($a_vars[$s_var_name])) { $a_vars[$s_var_name] = GetSession($s_var_name); //$s_db .= "$s_var_name='".$a_vars[$s_var_name]."'\n"; $n_copied++; } } } //SendAlert($s_db); return $n_copied; }
/** * Process * Does all of the work. * Sets up the session, prints out the results, handles paging, changing dates and so on. * * @see Db * @see GetSession * @see Session::Get * @see GetSearchUser * @see GenerateXml * @see PrintHeader * @see ParseTemplate * @see User::SetSettings * @see GetPerPage * @see CalculateCalendarRestrictions * @see SetupCalendar * @see GetSortDetails * @see RememberCurrentPage * @see FormatNumber * @see SetupPagingHeader * @see PrintFooter * * @return void */ function Process() { $session =& GetSession(); $thisuser = $session->Get('UserDetails'); $this->GetSearchUser(); $action = isset($_GET['Action']) ? strtolower($_GET['Action']) : ''; if ($action == 'generatexml') { $this->GenerateXml(); exit; } $this->PrintHeader(); $this->ParseTemplate('Menu'); switch ($action) { case 'processpaging': if (!isset($_POST['PerPageDisplay'])) { break; } $perpage = $_POST['PerPageDisplay']; $display_settings = array('NumberToShow' => $perpage); $thisuser->SetSettings('DisplaySettings', $display_settings); break; case 'processdate': if (!isset($_POST['Calendar'])) { break; } $calendar_settings = $_POST['Calendar']; $thisuser->SetSettings('Calendar', $calendar_settings); break; } if (!isset($perpage)) { $perpage = $this->GetPerPage(); } $DisplayPage = isset($_GET['DisplayPage']) ? (int) $_GET['DisplayPage'] : 1; $this->CalculateCalendarRestrictions(); $this->SetupCalendar(); $this->GetSortDetails(); $ignoreips = $this->GetIgnoreDetails(); $this->RememberCurrentPage(true); list($sortby, $sortdirection, $direction, $second_sortby, $second_sortdirection) = $this->SortDetails; $formaction = 'Action=ProcessPaging&SortBy=' . $sortby . '&Sort=' . $sortdirection; $query = "SELECT COUNT(DISTINCT campaignsite) AS campaigncount FROM " . TRACKPOINT_TABLEPREFIX . "campaigns WHERE " . $this->SearchUserID . ($this->CalendarRestrictions ? ' AND ' . $this->CalendarRestrictions : ''); if ($ignoreips) { $query .= " AND " . $ignoreips; } $result = $this->Db->Query($query); $row = $this->Db->Fetch($result); $NumCampaigns = $row['campaigncount']; $this->SetupPagingHeader($NumCampaigns, $DisplayPage, $perpage, $formaction); $template = $this->ParseTemplate('Campaigns', true, false); $query = "SELECT campaignsite AS site, COUNT(campaignid) AS visits, SUM(hasconversion) AS conv, SUM(amount) AS revenue, (SUM(hasconversion) / (COUNT(campaignid)+0.0) * 100) AS percent FROM " . TRACKPOINT_TABLEPREFIX . "campaigns WHERE " . $this->SearchUserID . ($this->CalendarRestrictions ? ' AND ' . $this->CalendarRestrictions : ''); if ($ignoreips) { $query .= " AND " . $ignoreips; } $query .= " GROUP BY campaignsite"; $query .= " ORDER BY " . $sortby . " " . $direction; if ($second_sortby) { $query .= ", " . $second_sortby . " " . $second_sortdirection; } $query .= $this->Db->AddLimit($perpage * ($DisplayPage - 1), $perpage); $rowid = 1; $display = ''; $base_fetchlink = 'SortBy=' . urlencode($sortby) . '&Direction=' . urlencode($direction); $to_date = $this->CalculateCalendarRestrictions(false, true); $result = $this->Db->Query($query); while ($row = $this->Db->Fetch($result)) { $cost = 0; $roi = 0; $cost_query = "SELECT ((" . $to_date . " - startdate) / 86400) AS num_days, period, CASE WHEN period=0 THEN cost ELSE cost/period END AS cost_per_day FROM " . TRACKPOINT_TABLEPREFIX . "campaigns WHERE " . $this->SearchUserID . ($this->CalendarRestrictions ? ' AND ' . $this->CalendarRestrictions : '') . " AND campaignsite='" . addslashes($row['site']) . "'"; if ($ignoreips) { $cost_query .= " AND " . $ignoreips; } $cost_query .= " GROUP BY campaignname, startdate, period, cost"; $cost_result = $this->Db->Query($cost_query); while ($cost_row = $this->Db->Fetch($cost_result)) { // if there's no period it's a one off cost. Which means we just take it at face value. if ($cost_row['period'] == 0) { $cost += $cost_row['cost_per_day']; } else { $cost += $cost_row['num_days'] * $cost_row['cost_per_day']; } } $roi = $cost == 0 ? 0 : $row['revenue'] / $cost * 100; $GLOBALS['RowID'] = $rowid; $GLOBALS['FetchLink'] = $base_fetchlink . '&Site=' . urlencode($row['site']); $GLOBALS['CampaignSite'] = stripslashes($row['site']); $GLOBALS['Visits'] = $this->FormatNumber($row['visits']); $GLOBALS['Conversions'] = $this->FormatNumber($row['conv']); $GLOBALS['Revenue'] = $this->FormatNumber($row['revenue'], 2); $GLOBALS['Percent'] = $this->FormatNumber($row['percent'], 2); $GLOBALS['Cost'] = $this->FormatNumber($cost, 2); $GLOBALS['ROI'] = $this->FormatNumber($roi, 2); $display .= $this->ParseTemplate('CampaignsRows', true, false); $rowid++; } if ($rowid == 1) { // if there are no rows, we'll add a "blank" row. $display .= $this->ParseTemplate('CampaignsRows_Blank', true, false) . '<br/>'; } $template = str_replace('%%TPL_Paging%%', $GLOBALS['PagingTemplate'], $template); $template = str_replace('%%TPL_Paging_Bottom%%', $GLOBALS['PagingTemplate_Bottom'], $template); $template = str_replace('%%TPL_Calendar%%', $GLOBALS['Calendar'], $template); $template = str_replace('%%TPL_CampaignsRows%%', $display, $template); $query = "SELECT COUNT(campaignid) AS visits, SUM(hasconversion) AS conv, SUM(amount) AS revenue, (SUM(hasconversion) / (COUNT(campaignid)+0.0)*100) AS percent FROM " . TRACKPOINT_TABLEPREFIX . "campaigns WHERE " . $this->SearchUserID . ($this->CalendarRestrictions ? ' AND ' . $this->CalendarRestrictions : ''); if ($ignoreips) { $query .= " AND " . $ignoreips; } $result = $this->Db->Query($query); $row = $this->Db->Fetch($result); $total_cost = 0; $cost_query = "SELECT ((" . $to_date . " - startdate) / 86400) AS num_days, period, CASE WHEN sum(period)=0 THEN cost ELSE sum(cost)/sum(period) END AS cost_per_day FROM " . TRACKPOINT_TABLEPREFIX . "campaigns WHERE " . $this->SearchUserID . ($this->CalendarRestrictions ? ' AND ' . $this->CalendarRestrictions : ''); if ($ignoreips) { $cost_query .= " AND " . $ignoreips; } $cost_query .= " GROUP BY campaignname, campaignsite, startdate, period, cost"; $cost_result = $this->Db->Query($cost_query); while ($cost_row = $this->Db->Fetch($cost_result)) { if ($cost_row['period'] == 0) { $total_cost += $cost_row['cost_per_day']; } else { $total_cost += $cost_row['num_days'] * $cost_row['cost_per_day']; } } $roi = $total_cost == 0 ? 0 : $row['revenue'] / $total_cost * 100; $GLOBALS['TotalVisits'] = $this->FormatNumber($row['visits']); $GLOBALS['TotalConversions'] = $this->FormatNumber($row['conv']); $GLOBALS['TotalRevenue'] = $this->FormatNumber($row['revenue'], 2); $GLOBALS['TotalPercent'] = $this->FormatNumber($row['percent'], 2); $GLOBALS['TotalCost'] = $this->FormatNumber($total_cost, 2); $GLOBALS['TotalROI'] = $this->FormatNumber($roi, 2); if ($row['visits'] > 0) { $GLOBALS['ExportSection'] = $GLOBALS['PrintSection'] = '&Area=Campaign'; $GLOBALS['PrintExportFooter'] = $this->ParseTemplate('PrintExportFooter', true, false); } else { $GLOBALS['PrintExportFooter'] = $this->ParseTemplate('PrintExportFooter_Disabled', true, false); } $campaign_footer = $this->ParseTemplate('CampaignsFooter', true); $template = str_replace('%%TPL_CampaignsFooter%%', $campaign_footer, $template); echo $template; $this->PrintFooter(); }
/** * Process * Processes the creation of the campaign. * Uses an iframe to post the results when a particular action is set. * Makes it nice and easy to keep creating campaigns and not worrying about retyping any of the information. * * @see Trackpoint_Functions::Process() * * @return void */ function Process() { $today = date('d'); $thismonth = date('m'); $thisyear = date('y'); if (isset($_POST['StartDay'])) { $today = $_POST['StartDay']; } if (isset($_POST['StartMonth'])) { $thismonth = $_POST['StartMonth']; } if (isset($_POST['StartYear'])) { $thisyear = $_POST['StartYear']; } $days = ''; for ($i = 1; $i <= 31; $i++) { $days .= '<option value="' . sprintf('%02d', $i) . '"'; if ($i == $today) { $days .= ' SELECTED'; } $days .= '>' . sprintf('%02d', $i) . '</option>'; } $months = ''; for ($i = 1; $i <= 12; $i++) { $months .= '<option value="' . GetLang($this->Months[$i]) . '"'; if ($i == $thismonth) { $months .= ' SELECTED'; } $months .= '>' . GetLang($this->Months[$i]) . '</option>'; } $years = ''; for ($i = $thisyear - 1; $i <= $thisyear + 5; $i++) { $years .= '<option value="' . sprintf('%02d', $i) . '"'; if ($i == $thisyear) { $years .= ' SELECTED'; } $years .= '>' . sprintf('%02d', $i) . '</option>'; } $GLOBALS['StartDay'] = $days; $GLOBALS['StartMonth'] = $months; $GLOBALS['StartYear'] = $years; $session =& GetSession(); $thisuser = $session->Get('UserDetails'); $userid = $thisuser->userid; $switched_user = $session->Get('SwitchUser'); if ($switched_user) { $userid = $switched_user; $switched_username = $session->Get('SwitchUserName'); $GLOBALS['WarningMessage'] = sprintf(GetLang('CampaignCodeForUser'), $switched_username); } $action = isset($_GET['Action']) ? strtolower($_GET['Action']) : null; switch ($action) { case 'campaignlink': if (isset($_GET['Process'])) { $querystring = ''; if ($userid != 1) { $querystring .= 'u=' . $userid . '&'; } if (isset($_POST['EncodeInfo'])) { $querystring .= 'cp=' . stripslashes($_POST['CampaignName']); $querystring .= '&s=' . stripslashes($_POST['CampaignSite']); if (is_numeric($_POST['CampaignCost'])) { $querystring .= '&c=' . (double) $_POST['CampaignCost']; } if (isset($_POST['CampaignCostType'])) { if (is_numeric($_POST['PeriodDate'])) { $querystring .= '&p=' . (int) $_POST['PeriodDate']; } else { if ($_POST['PeriodDate'] == 'custom') { $querystring .= '&p=' . (int) $_POST['Days']; } } $GLOBALS['Period' . $_POST['PeriodDate'] . '_Selected'] = ' SELECTED'; $querystring .= '&d=' . $_POST['StartDay'] . $_POST['StartMonth'] . $_POST['StartYear']; } $querystring = 'cpe=' . urlencode(base64_encode($querystring)); } else { $querystring .= 'cp=' . urlencode(stripslashes($_POST['CampaignName'])); $querystring .= '&site=' . urlencode(stripslashes($_POST['CampaignSite'])); if (is_numeric($_POST['CampaignCost'])) { $querystring .= '&cost=' . (double) $_POST['CampaignCost']; } if (isset($_POST['CampaignCostType'])) { if (is_numeric($_POST['PeriodDate'])) { $querystring .= '&period=' . (int) $_POST['PeriodDate']; } else { if ($_POST['PeriodDate'] == 'custom') { $querystring .= '&period=' . (int) $_POST['days']; } } $querystring .= '&date=' . $_POST['StartDay'] . $_POST['StartMonth'] . $_POST['StartYear']; } } if (strpos($_POST['CampaignURL'], '?') !== false) { $url = stripslashes($_POST['CampaignURL']) . '&' . $querystring; } else { $campaignurl = stripslashes($_POST['CampaignURL']); $urlparts = explode('/', $campaignurl); $filename = array_pop($urlparts); if (strpos($filename, '.') !== false || substr($campaignurl, -1) == '/') { $url = $campaignurl . '?' . $querystring; } else { $url = $campaignurl . '/?' . $querystring; } } echo '<span style="font-family: tahoma; font-size: 12px;">' . $url . '</span>'; } break; default: Trackpoint_Functions::Process(); } }
public function AuthUser($login, $password, $session) { $DB = new DB('master'); // $html_temp ='<html><head><style> td, span, div, .std{ font-family: Tahoma; font-size: 11px; color: #666666; font-weight: normal; } .frlname11{ font-size: 11px; color: #666666; font-weight: bold; } img.pro{ background-color:none; width: 26px; height: 11px; border-width:0px; margin-right: 3px; } .freelancerU img.pro{ width: 26px; height: 11px; border-width:0px; } .cl9{ color: #909090; } .c_grey{ color: #909090; font-weight:bold; display:block; } .freelancerU_content a.blue { font-weight:bold; display:block; color:#003399; } .u_active{ font-size: 80%; color: #ff6b3d; margin-right:16px; } .u_inactive{ font-size: 80%; color: #477ad9; margin-right:16px; } .prj_bold { font-weight:bold; color: #000000; } .prj_a { color: #000000; text-decoration: none; font-family: Tahoma; font-size: 11px; color: #666666; font-weight: normal; } .user_blue { font-weight:bold; color:#003399; } </style></head><body>@</body></html>'; $message_temp = '<html><head><style> td, span, div, .std{ font-family: Tahoma; font-size: 11px; color: #666666; font-weight: normal; } .frlname11{ font-size: 11px; color: #666666; font-weight: bold; } img.pro{ background-color:none; width: 26px; height: 11px; border-width:0px; margin-right: 3px; } .freelancerU img.pro{ width: 26px; height: 11px; border-width:0px; } .cl9{ color: #909090; } .c_grey{ color: #909090; font-weight:bold; display:block; } .freelancerU_content a.blue { font-weight:bold; display:block; color:#003399; } .u_active{ font-size: 80%; color: #ff6b3d; margin-right:16px; } .u_inactive{ font-size: 80%; color: #477ad9; margin-right:16px; } .prj_bold { font-weight:bold; color: #000000; } .prj_a { color: #000000; text-decoration: none; font-family: Tahoma; font-size: 11px; color: #666666; font-weight: normal; } .user_blue { font-family: Tahoma; font-size: 10px; font-weight:bold; color:#003399; } </style></head><body><table border="0" cellpadding="0" cellspacing="0" ><tbody><tr><td><table border="0" cellpadding="0" cellspacing="0"><tbody><tr valign="top"><td align="center" width="70"><a href="' . $GLOBALS['host'] . '/users/@LOGIN@/" class="frlname11"> <img src="' . $GLOBALS['host'] . '/users/@LOGIN@/foto/@PIC@" alt="@LOGIN@" border="0" height="50" width="50"></a></td><td class="frlname11">@PRO@ @ONLINE@ <a href="' . $GLOBALS['host'] . '/users/@LOGIN@" class="frlname11">@UNAME@ @USURNAME@</a> [<a href="' . $GLOBALS['host'] . '/users/@LOGIN@" class="frlname11">@LOGIN@</a>]</td></tr></tbody></table><table border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr valign="top"><td align="center" width="20"> </td><td style="padding-right: 20px;"><a target="_blank" href="' . $GLOBALS['host'] . '/contacts/?from=@LOGIN@" class="c_grey">@TEXT@</a></td></tr></table><br></body></html>'; $project_temp = '<html><head><style> td, span, div, .std{ font-family: Tahoma; font-size: 11px; color: #666666; font-weight: normal; } .frlname11{ font-size: 11px; color: #666666; font-weight: bold; } img.pro{ background-color:none; width: 26px; height: 11px; border-width:0px; margin-right: 3px; } .freelancerU img.pro{ width: 26px; height: 11px; border-width:0px; } .cl9{ color: #909090; } .c_grey{ color: #909090; font-weight:bold; display:block; } .freelancerU_content a.blue { font-weight:bold; display:block; color:#003399; } .u_active{ font-size: 80%; color: #ff6b3d; margin-right:16px; } .u_inactive{ font-size: 80%; color: #477ad9; margin-right:16px; } .prj_bold { font-weight:bold; color: #000000; } .prj_a { color: #000000; text-decoration: none; font-family: Tahoma; font-size: 11px; color: #666666; font-weight: normal; } .user_blue { font-family: Tahoma; font-size: 10px; font-weight:bold; color:#003399; } </style></head><body><div class="prj_bold">@HEAD@</div><div class="prj_bold">@BUDGET@ @BUDGETB@</div> <a target="_blank" class="prj_a" href="' . $GLOBALS['host'] . '/blogs/view.php?tr=@THREAD@">@TEXT@</a><br><a target="_blank" class="user_blue" href="' . $GLOBALS['host'] . '/users/@LOGIN@/">@UNAME@ @USURNAME@ [@LOGIN@]</a><br></body></html>'; $log = fopen('sql.log', 'a'); if (!$login) { return array('result' => mb_convert_encoding('Нет логина', 'UTF-8', 'windows-1251'), 'cookie' => '', 'message_template' => '', 'project_template' => ''); } $login = trim($login); $login = mysql_real_escape_string($login); $password = trim(mb_convert_encoding($password, 'windows-1251', 'UTF-8')); $session = trim($session); $auth = 0; $update_sess = 0; // проверяем наличие других сессий $res = mysql_query("SELECT * FROM sessions WHERE is_tray=1 AND session_login='******'", DBMyConnect()); fwrite($log, "\n" . date('Y.m.d h:i:s') . ' ' . "SELECT * FROM sessions WHERE is_tray=1 AND session_login='******'"); $sess_rows = mysql_num_rows($res); // сессий больше чем одна выбиваем обоих if ($sess_rows > 1) { $res = mysql_query("DELETE FROM sessions WHERE is_tray=1 AND session_login='******'", DBMyConnect()); fwrite($log, "\n" . date('Y.m.d h:i:s') . ' ' . "DELETE FROM sessions WHERE is_tray=1 AND session_login='******'"); return array('result' => mb_convert_encoding('Две сессии. Возможно еще кто-то под Вашим именем в сети. Перелогиньтесь с введением логина и пароля', 'UTF-8', 'windows-1251'), 'cookie' => '', 'message_template' => '', 'project_template' => ''); } elseif (!$session) { // удаляем все предыдущие сессии $res = mysql_query("DELETE FROM sessions WHERE is_tray=1 AND session_login='******'", DBMyConnect()); fwrite($log, "\n" . date('Y.m.d h:i:s') . ' ' . "DELETE FROM sessions WHERE is_tray=1 AND session_login='******'"); // проверяем логин-пароль и все остальное $res_pass = $DB->query('SELECT uid, login, is_pro, is_banned, active FROM users WHERE lower(login)=? AND passwd=? LIMIT 1', strtolower($login), $password); fwrite($log, "\n" . date('Y.m.d h:i:s') . ' ' . "SELECT uid, login, is_pro, is_banned, active FROM users WHERE lower(login)='" . strtolower($login) . "' AND passwd='" . $password . "' LIMIT 1"); if (pg_numrows($res_pass)) { // ок $user_arr = pg_fetch_assoc($res_pass); if ($user_arr['is_pro'] == 'f') { return array('result' => mb_convert_encoding('Доступно только для PRO', 'UTF-8', 'windows-1251'), 'cookie' => '', 'message_template' => '', 'project_template' => ''); } if ($user_arr['active'] == 'f') { return array('result' => mb_convert_encoding('А активировать аккаунт Пушкин будет?', 'UTF-8', 'windows-1251'), 'cookie' => '', 'message_template' => '', 'project_template' => ''); } if ($user_arr['is_banned']) { return array('result' => mb_convert_encoding('Забанены вы нафих', 'UTF-8', 'windows-1251'), 'cookie' => '', 'message_template' => '', 'project_template' => ''); } $auth = 1; $uid = $user_arr['uid']; $login = $user_arr['login']; } else { return array('result' => mb_convert_encoding('Не правильный логин-пароль', 'UTF-8', 'windows-1251'), 'cookie' => '', 'message_template' => '', 'project_template' => ''); } } else { // если передана сессия - пытаемся по ней зарегится $res_sess = mysql_query("SELECT * FROM sessions WHERE is_tray=1 AND session_id='" . $session . "'", DBMyConnect()); fwrite($log, "\n" . date('Y.m.d h:i:s') . ' ' . "SELECT * FROM sessions WHERE is_tray=1 AND session_id='" . $session . "'"); if (@mysql_num_rows($res_sess)) { $sess_auth = mysql_fetch_assoc($res_sess); $res_pass = $DB->query('SELECT uid, login, is_pro, is_banned, active FROM users WHERE uid=? LIMIT 1', $sess_auth['session_uid']); fwrite($log, "\n" . date('Y.m.d h:i:s') . ' ' . "SELECT uid, login, is_pro, is_banned, active FROM users WHERE uid='" . $sess_auth['session_uid'] . "' LIMIT 1"); if (pg_numrows($res_pass)) { // ок $user_arr = pg_fetch_assoc($res_pass); if ($user_arr['is_pro'] == 'f') { return array('result' => mb_convert_encoding('Доступно только для PRO', 'UTF-8', 'windows-1251'), 'cookie' => '', 'message_template' => '', 'project_template' => ''); } if ($user_arr['active'] == 'f') { return array('result' => mb_convert_encoding('А активировать аккаунт Пушкин будет?', 'UTF-8', 'windows-1251'), 'cookie' => '', 'message_template' => '', 'project_template' => ''); } if ($user_arr['is_banned']) { return array('result' => mb_convert_encoding('Забанены вы нафих', 'UTF-8', 'windows-1251'), 'cookie' => '', 'message_template' => '', 'project_template' => ''); } $auth = 1; $uid = $user_arr['uid']; $login = $user_arr['login']; } else { return array('result' => mb_convert_encoding('Не могу вас найти', 'UTF-8', 'windows-1251'), 'cookie' => '', 'message_template' => '', 'project_template' => ''); } $update_sess = 1; } else { return array('result' => mb_convert_encoding('Ошибка авторизации по сессии. Перелогиньтесь с введением логина и пароля', 'UTF-8', 'windows-1251'), 'cookie' => '', 'message_template' => '', 'project_template' => ''); } } // все оки - логиним if ($auth) { if ($update_sess) { mysql_query("UPDATE sessions\n SET session_last_refresh = now(),\n session_uid = '" . $uid . "',\n session_login = '******',\n is_tray=1\n WHERE session_id = '" . $session . "'", DBMyConnect()); return array('result' => '', 'cookie' => $session, 'message_template' => $message_temp, 'project_template' => $project_temp); } else { //надо сессию сгенерить do { $session = GetSession(); $res = mysql_query("SELECT * FROM sessions WHERE session_id = '" . $session . "' LIMIT 1", DBMyConnect()); fwrite($log, "\n" . date('Y.m.d h:i:s') . ' ' . "SELECT * FROM sessions WHERE session_id = '" . $session . "' LIMIT 1"); } while (mysql_num_rows($res)); mysql_query("INSERT INTO sessions (\n session_id,\n session_uid,\n is_tray,\n session_login)\n VALUES(\n '" . $session . "',\n '" . $uid . "',\n 1,\n '" . $login . "'\n )", DBMyConnect()); return array('result' => '', 'cookie' => $session, 'message_template' => $message_temp, 'project_template' => $project_temp); } } }
public function HandleToDo($Do) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Orders') => 'index.php?ToDo=viewOrders'); switch (isc_strtolower($Do)) { case 'saveneworder': $this->SaveNewOrder(); break; case 'saveupdatedorder': $this->SaveUpdatedOrder(); break; case "addorder": $this->AddOrder(); break; case 'editorder': $this->EditOrder(); break; case "createorderview": if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Manage_Orders)) { $GLOBALS['BreadcrumEntries'][GetLang('CreateOrderView')] = "index.php?ToDo=createOrderView"; $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); $this->CreateView(); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "printmultiorderinvoices": if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Manage_Orders)) { $this->PrintMultiInvoices(); } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "deletecustomordersearch": if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Manage_Orders)) { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); $this->DeleteCustomSearch(); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "customordersearch": if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Manage_Orders)) { $GLOBALS['BreadcrumEntries'][GetLang('CustomView')] = "index.php?ToDo=customOrderSearch"; $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); $this->CustomSearch(); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "searchordersredirect": if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Manage_Orders)) { $GLOBALS['BreadcrumEntries'][GetLang('SearchResults')] = "index.php?ToDo=searchOrders"; $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); $this->SearchOrdersRedirect(); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "searchorders": if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Manage_Orders)) { $GLOBALS['BreadcrumEntries'][GetLang('SearchResults')] = "index.php?ToDo=searchOrders"; $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); $this->SearchOrders(); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "saveupdatedordermessage": if (!gzte11(ISC_LARGEPRINT)) { exit; } if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Order_Messages)) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Orders') => "index.php?ToDo=viewOrders", GetLang('ViewMessages') => "index.php?ToDo=saveUpdatedOrderMessage"); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); $this->SavedUpdatedOrderMessage(); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "editordermessage": if (!gzte11(ISC_LARGEPRINT)) { exit; } if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Order_Messages)) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Orders') => "index.php?ToDo=viewOrders", GetLang('ViewMessages') => "index.php?ToDo=viewOrderMessages&orderId=" . @(int) $_GET['orderId'], GetLang('EditMessage') => "index.php?ToDo=editOrderMessage"); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); $this->EditOrderMessage(); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "savenewordermessage": if (!gzte11(ISC_LARGEPRINT)) { exit; } if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Order_Messages)) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Orders') => "index.php?ToDo=viewOrders", GetLang('ViewMessages') => "index.php?ToDo=saveUpdatedOrderMessage"); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); $this->SaveNewOrderMessage(); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "createordermessage": if (!gzte11(ISC_LARGEPRINT)) { exit; } if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Order_Messages)) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Orders') => "index.php?ToDo=viewOrders", GetLang('ViewMessages') => "index.php?ToDo=viewOrderMessages&orderId=" . @(int) $_GET['orderId'], GetLang('CreateMessage') => "index.php?ToDo=createOrderMessage"); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); $this->CreateOrderMessage(); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "deleteordermessages": if (!gzte11(ISC_LARGEPRINT)) { exit; } if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Order_Messages)) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Orders') => "index.php?ToDo=viewOrders", GetLang('ViewMessages') => "index.php?ToDo=saveUpdatedOrderMessage"); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); $this->DeleteOrderMessages(); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "flagordermessage": if (!gzte11(ISC_LARGEPRINT)) { exit; } if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Order_Messages)) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Orders') => "index.php?ToDo=viewOrders", GetLang('ViewMessages') => "index.php?ToDo=viewOrderMessages"); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); $this->FlagOrderMessage(); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "updateordermessagestatus": if (!gzte11(ISC_LARGEPRINT)) { exit; } if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Order_Messages)) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Orders') => "index.php?ToDo=viewOrders", GetLang('ViewMessages') => "index.php?ToDo=viewOrderMessages"); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); $this->UpdateOrderMessageStatus(); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "viewordermessages": if (!gzte11(ISC_LARGEPRINT)) { exit; } if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Order_Messages)) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Orders') => "index.php?ToDo=viewOrders", GetLang('ViewMessages') => "index.php?ToDo=viewOrderMessages"); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); $this->ViewOrderMessages(); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "deleteorders": if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Delete_Orders)) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Orders') => "index.php?ToDo=viewOrders"); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); $this->DeleteOrders(); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "printorderinvoice": if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Manage_Orders)) { $this->PrintInvoice(); } else { echo "<script type=\"text/javascript\">window.close();</script>"; } break; case "importordertrackingnumbers": if (gzte11(ISC_MEDIUMPRINT)) { if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Import_Order_Tracking_Numbers)) { if (!gzte11(ISC_MEDIUMPRINT)) { exit; } $this->ImportTrackingNumbers(); } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } } break; case "viewsingleorder": if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Manage_Orders)) { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); $output = ISC_ADMIN_REMOTE::GetOrderQuickView(); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); echo $output; } break; case "updatemultiorderstatus": if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Manage_Orders)) { $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("pageheader.popup"); $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(); $this->updateOrderStatusBox(); $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("pagefooter.popup"); $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(); } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "refundorder": if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Manage_Orders)) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Orders') => "index.php?ToDo=viewOrders"); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); $this->RefundOrder(); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; /* Added for Save and Pay -- Baskaran */ /* Added for Save and Pay -- Baskaran */ case "payorder": if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Manage_Orders)) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Orders') => "index.php?ToDo=viewOrders", GetLang('PayOrder') => "index.php?ToDo=viewOrderMessages"); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); $this->payOrder(); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; case "paymentorder": if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Manage_Orders)) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Orders') => "index.php?ToDo=viewOrders", GetLang('PayOrder') => "index.php?ToDo=viewOrderMessages"); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); $this->PaymentOrder(); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; //Wirror_20110301: confirm the order //Wirror_20110301: confirm the order case "confirmorder": if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Manage_Orders)) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Orders') => "index.php?ToDo=viewOrders", GetLang('ConfirmOrder') => 'index.php?ToDo=confirmOrder'); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); $this->ConfirmOrder(); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } break; /* Baskaran */ /* Baskaran */ default: if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Manage_Orders)) { if (isset($_GET['searchQuery'])) { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Orders') => "index.php?ToDo=viewOrders", GetLang('SearchResults') => "index.php?ToDo=viewOrders"); } else { $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Orders') => "index.php?ToDo=viewOrders"); } if (GetSession('ordersearch') > 0) { if (!isset($_GET['searchId'])) { $_GET['searchId'] = GetSession('ordersearch'); $_REQUEST['searchId'] = GetSession('ordersearch'); } if ($_GET['searchId'] > 0) { $GLOBALS['BreadcrumEntries'] = array_merge($GLOBALS['BreadcrumEntries'], array(GetLang('CustomView') => "index.php?ToDo=customOrderSearch")); } } if (!isset($_REQUEST['ajax'])) { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader(); } if (GetSession('ordersearch') > 0) { $this->CustomSearch(); } else { UnsetSession('ordersearch'); $this->ManageOrders(); } if (!isset($_REQUEST['ajax'])) { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter(); } } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } } }
<label>Ingat Saya <input type="checkbox" name="ckRemember"> </label> --> </div> <button id="btnSubmit" class="btn btn-default btn-block">Login</button> </form> </div> </div> <div class="footer"> <?php echo scSys::GetConfig("sc_front_title"); ?> | <a href="./pages/log.php" target="_blank">Ver : <?php echo GetSession("SYS.ver"); ?> </a> </div> </div> </div> </div> <script type="text/javascript" src="./sapeltucore/sc_credits/jquery/jquery.js"></script> <script type="text/javascript" src="./sapeltucore/sc_credits/bootstrap/bootstrap.min.js"></script> <script type="text/javascript" src="./sapeltucore/sc_include/sc.core.js"></script> <script type="text/javascript"> $('document').ready(function(){ $('#login.panel .panel-body #btnSubmit').click(function(e){ e.preventDefault() ; cError = "";
function ScConnect($cLocDev = '') { global $scDb; $lFirst = false; if (defined("SYSCORE_LOC")) { $cLocDev = SYSCORE_LOC; } $cFileConnect = "./sapeltucore/sc.ini.php"; if ($cLocDev == "") { if (!is_file($cFileConnect)) { $cFileConnect = "./system/sc.ini.php"; } } else { $cFileConnect = $cLocDev . "system/sc.ini.php"; } if (!is_file($cFileConnect)) { $cFileConnect = $cLocDev . "sc.ini.php"; } if (!is_file($cFileConnect)) { die("File system not found"); } if (is_file($cFileConnect) && GetSession("SC_IP") == "") { SaveSession("SC_Port", "3306"); SaveSession("SC_Driver", "mysql"); $lFirst = true; $vaFile = file($cFileConnect); foreach ($vaFile as $cKey => $cValue) { if (strpos($cValue, "#") != 0 || strpos($cValue, "#") == false) { $vaValue = explode("=", trim($cValue)); $cVal = isset($vaValue[1]) ? trim($vaValue[1]) : ""; switch (trim($vaValue[0])) { case 'ip': SaveSession("SC_IP", $cVal); break; case 'user': SaveSession("SC_User", $cVal); break; case 'password': SaveSession("SC_Password", $cVal); break; case 'database': SaveSession("SC_Database", $cVal); break; case 'port': SaveSession("SC_Port", $cVal); break; case 'driver': SaveSession("SC_Driver", $cVal); break; default: SaveSession(trim($vaValue[0]), $cVal); break; } } } } $cIP = GetSession("SC_IP"); $cRoot = GetSession("SC_User"); $cDatabase = GetSession("SC_Database"); $cPassword = GetSession("SC_Password"); $scDb->Connect($cIP, $cRoot, $cPassword, $cDatabase, GetSession("SC_Driver"), GetSession("SC_Port")); if ($lFirst) { SaveSession("sc_main", "sapeltu"); //agar load page dapat digunakan SCDefine($cLocDev); } }
/** * Process * Does all of the work. Works out the referrers for the domain, gets all of the referrers from that domain, calculates revenue etc. * * @see PrintHeader * @see ParseTemplate * @see GetSession * @see Session::Get * @see GetDatabase * @see User::SetSettings * @see User::GetSettings * @see CalculateCalendarRestrictions * @see SetupCalendar * @see FormatNumber * @see SetupPagingHeader * @see _SubSearchLimit * @see PrintFooter * * @return void */ function Process() { $this->PrintHeader(); $this->ParseTemplate('Menu'); $session =& GetSession(); $thisuser = $session->Get('UserDetails'); $searchuserid = $this->GetSearchUser(); $ignoreips = $this->GetIgnoreDetails(); $action = isset($_GET['Action']) ? strtolower($_GET['Action']) : ''; switch ($action) { case 'processpaging': if (!isset($_POST['PerPageDisplay'])) { break; } $perpage = $_POST['PerPageDisplay']; $display_settings = array('NumberToShow' => $perpage); $thisuser->SetSettings('DisplaySettings', $display_settings); break; case 'processdate': if (!isset($_POST['Calendar'])) { break; } $calendar_settings = $_POST['Calendar']; $thisuser->SetSettings('Calendar', $calendar_settings); break; } if (!isset($perpage)) { $perpage = $this->GetPerPage(); } $DisplayPage = isset($_GET['DisplayPage']) ? (int) $_GET['DisplayPage'] : 1; $this->CalculateCalendarRestrictions(); $engine = isset($_GET['Engine']) ? stripslashes(urldecode($_GET['Engine'])) : false; $backlink = $this->GetBackPage(); $GLOBALS['BackLink'] = $backlink; $GLOBALS['Sort'] = 'Name'; $GLOBALS['Image'] = 'ppcicon.gif'; $GLOBALS['ViewAllTitle'] = sprintf(GetLang('PPC_Specific'), $engine); $GLOBALS['Help_Intro'] = GetLang('Help_PPC'); $searchdetails = ''; if ($engine !== false) { $searchdetails .= '&Engine=' . urlencode($engine); } $GLOBALS['SearchDetails'] = $searchdetails; $formaction = 'Action=ProcessDate'; if ($engine !== false) { $formaction .= '&Engine=' . urlencode($engine); } $this->SetupCalendar($formaction); $subqueries = array($this->SearchUserID); if ($this->CalendarRestrictions) { $subqueries[] = $this->CalendarRestrictions; } if ($ignoreips) { $subqueries[] = $ignoreips; } if ($engine !== false) { $subqueries[] = "searchenginename='" . addslashes($engine) . "'"; } $total_subquery = ' WHERE '; $total_subquery .= implode(' AND ', $subqueries); $query = "select COUNT(DISTINCT ppcname) AS count from " . TRACKPOINT_TABLEPREFIX . "payperclicks" . $total_subquery; $result = $this->Db->Query($query); $row = $this->Db->Fetch($result); $NumResults = $row['count']; $this->GetSortDetails(); list($sortby, $sortdirection, $direction, $second_sortby, $second_sortdirection) = $this->SortDetails; $sortdetails = '&SortBy=' . $sortby . '&Sort=' . $sortdirection; if ($engine !== false) { $sortdetails .= '&Engine=' . urlencode($engine); } $GLOBALS['SortDetails'] = $sortdetails; $formaction = 'Action=ProcessPaging&SortBy=' . $sortby . '&Sort=' . $sortdirection; if ($engine !== false) { $formaction .= '&Engine=' . urlencode($engine); } $this->SetupPagingHeader($NumResults, $DisplayPage, $perpage, $formaction); $GLOBALS['Title'] = GetLang('PPCName'); $template = $this->ParseTemplate('ViewAll_PPCs', true, false); $GLOBALS['Name'] = $engine; $query = "SELECT COUNT(ppcid) AS totalvisits, SUM(hasconversion) AS conv, SUM(amount) AS revenue, (SUM(hasconversion) / (COUNT(ppcid)+0.0)*100) AS percent, CASE WHEN SUM(cost) = 0 THEN 0 ELSE (SUM(amount) / SUM(cost)*100) END AS roi, SUM(cost) AS cost FROM " . TRACKPOINT_TABLEPREFIX . "payperclicks WHERE " . $this->SearchUserID . ($this->CalendarRestrictions ? ' AND ' . $this->CalendarRestrictions : ''); if ($ignoreips) { $query .= " AND " . $ignoreips; } $result = $this->Db->Query($query); $row = $this->Db->Fetch($result); $GLOBALS['TotalVisits'] = $this->FormatNumber($row['totalvisits']); $GLOBALS['TotalPercent'] = $this->FormatNumber($row['percent'], 2); $GLOBALS['TotalConversions'] = $this->FormatNumber($row['conv']); $GLOBALS['TotalRevenue'] = $this->FormatNumber($row['revenue'], 2); $GLOBALS['TotalCost'] = $this->FormatNumber($row['cost'], 2); $GLOBALS['TotalROI'] = $this->FormatNumber($row['roi'], 2); $query = "SELECT COUNT(ppcid) AS visits, SUM(hasconversion) AS conv, SUM(amount) AS revenue, (SUM(hasconversion) / (COUNT(ppcid)+0.0)*100) AS percent, CASE WHEN SUM(cost) = 0 THEN 0 ELSE SUM(amount) / SUM(cost) END AS roi, SUM(cost) AS cost FROM " . TRACKPOINT_TABLEPREFIX . "payperclicks " . $total_subquery . " GROUP BY searchenginename"; $result = $this->Db->Query($query); $row = $this->Db->Fetch($result); $GLOBALS['Visits'] = $this->FormatNumber($row['visits']); $GLOBALS['Conv'] = $this->FormatNumber($row['conv']); $GLOBALS['ConvPercent'] = $this->FormatNumber($row['percent'], 2); $GLOBALS['Revenue'] = $this->FormatNumber($row['revenue'], 2); $GLOBALS['Cost'] = $this->FormatNumber($row['cost'], 2); $GLOBALS['ROI'] = $this->FormatNumber($row['roi'], 2); $viewallrows_header = $this->ParseTemplate('ViewAllRows_PPCs_Header', true, false); $query = "SELECT ppcname AS name, COUNT(ppcid) AS visits, sum(hasconversion) AS conv, (SUM(hasconversion) / (COUNT(ppcid)+0.0)*100) AS percent, SUM(amount) AS revenue, CASE WHEN SUM(cost) = 0 THEN 0 ELSE (SUM(amount) / SUM(cost)*100) END AS roi, SUM(cost) AS cost FROM " . TRACKPOINT_TABLEPREFIX . "payperclicks " . $total_subquery . " GROUP BY ppcname"; $query .= " ORDER BY " . $sortby . " " . $direction; if ($second_sortby) { $query .= ", " . $second_sortby . " " . $second_sortdirection; } $query .= $this->Db->AddLimit($perpage * ($DisplayPage - 1), $perpage); $result = $this->Db->Query($query); if (!$result) { return false; } $rowid = 1; $display = ''; while ($row = $this->Db->Fetch($result)) { $GLOBALS['RowID'] = $rowid; $detail_rowid = 1; $name = $row['name']; $alttitle = $name; $name = $this->TruncateName($name); $GLOBALS['Name'] = $name; $GLOBALS['AltTitle'] = $alttitle; $GLOBALS['Visits'] = $this->FormatNumber($row['visits']); $GLOBALS['Conv'] = $this->FormatNumber($row['conv']); $GLOBALS['Cost'] = $this->FormatNumber($row['cost'], 2); $GLOBALS['Revenue'] = $this->FormatNumber($row['revenue'], 2); $GLOBALS['ConvPercent'] = $this->FormatNumber($row['percent'], 2); $GLOBALS['ROI'] = $this->FormatNumber($row['roi'], 2); $display .= $this->ParseTemplate('ViewAllRows_PPCs', true, false); $rowid++; } $GLOBALS['ExportSection'] = $GLOBALS['PrintSection'] = '&Area=PPC'; $GLOBALS['PrintExportFooter'] = $this->ParseTemplate('PrintExportFooter', true, false); $results_footer = $this->ParseTemplate('PPCFooter', true); $template = str_replace('%%TPL_ResultsFooter%%', $results_footer, $template); $template = str_replace('%%TPL_ViewAllRows_Header%%', $viewallrows_header, $template); $template = str_replace('%%TPL_ViewAllRows%%', $display, $template); $template = str_replace('%%TPL_Paging%%', $GLOBALS['PagingTemplate'], $template); $template = str_replace('%%TPL_Paging_Bottom%%', $GLOBALS['PagingTemplate_Bottom'], $template); $template = str_replace('%%TPL_Calendar%%', $GLOBALS['Calendar'], $template); echo $template; $this->PrintFooter(); }
<?php $cId = GetSession("cSession_UserName"); $dbRow = $scDb->GetRow($scDb->Browse("username", "*", "UserName = '******'")); ?> <style type="text/css"> canvas { position: relative; margin: 1px; margin-left: 0px; border: 1px solid #3a87ad; } </style> <section class="content-header"> <h1> System <small>User</small> </h1> <ol class="breadcrumb"> <li class="active">User</li> </ol> </section> <section class="content"> <div class="row"> <div class="col-sm-12"> <div class="box box-primary"> <div class="box-header"> <h3 class="box-title">My Profile</h3> </div>
function PrintStep2($error = false) { if (!$error) { $session =& GetSession(); $backupfile = $session->Get('BackupFilename'); $link = str_replace(TRACKPOINT_BASE_DIRECTORY, TRACKPOINT_APPLICATION_URL, TEMP_DIRECTORY . '/' . $backupfile); $msg = 'Your database has been backed up successfully. You can download it from here: <a href="' . $link . '" target="_blank">' . $link . '</a>'; $this->PrintUpgradeHeader('2', $msg); $this->StartUpgrade(); } else { $user =& GetUser(); $msg = 'Problem updating your database:<br/>' . urldecode($error) . '<br/>'; $msg .= 'Please post a support ticket through http://www.interspire.com/clientarea and include the error message above.<br/>'; $this->PrintUpgradeHeader('2', $msg); } $this->PrintUpgradeFooter(); }
/** * Process * Does all the work. * Prints out the menu, sets up the paging, sets up the calendar, sorts results and so on. * * @see PrintHeader * @see ParseTemplate * @see GetSession * @see Session::Get * @see GetDatabase * @see User::SetSettings * @see User::GetSettings * @see CalculateCalendarRestrictions * @see SetupCalendar * @see FormatNumber * @see SetupPagingHeader * @see _SubSearchLimit * @see PrintFooter * * @return void */ function Process() { $session =& GetSession(); $thisuser = $session->Get('UserDetails'); $this->GetSearchUser(); $action = isset($_GET['Action']) ? strtolower($_GET['Action']) : ''; $this->PrintHeader(); $this->ParseTemplate('Menu'); switch ($action) { case 'processpaging': $perpage = $_POST['PerPageDisplay']; $display_settings = array('NumberToShow' => $perpage); $thisuser->SetSettings('DisplaySettings', $display_settings); break; case 'processdate': $calendar_settings = $_POST['Calendar']; $thisuser->SetSettings('Calendar', $calendar_settings); break; } if (!isset($perpage)) { $perpage = $this->GetPerPage(); } $this->CalculateCalendarRestrictions(); $ignoreips = $this->GetIgnoreDetails(); $ignorereferrers = $this->GetIgnoreDetails('Referrers'); $ignorekeywords = $this->GetIgnoreDetails('Keywords'); $ignorereferrers_case = false; if ($ignorereferrers) { $ignorereferrers_case = " AND (CASE WHEN origintype='referrer' AND " . str_replace('NOT LIKE', 'LIKE', str_replace('domain', 'originfrom', $ignorereferrers)) . " THEN 1=0 ELSE 1=1 END)"; } $ignorekeywords_case = false; if ($ignorekeywords) { $ignorekeywords_case = " AND (CASE WHEN origintype='search' AND " . str_replace('NOT LIKE', 'LIKE', str_replace('keywords', 'origindetails', $ignorekeywords)) . " THEN 1=0 ELSE 1=1 END)"; } $query = "SELECT COUNT(conversionid) AS convcount FROM " . TRACKPOINT_TABLEPREFIX . "conversions WHERE " . $this->SearchUserID . ($this->CalendarRestrictions ? ' AND ' . $this->CalendarRestrictions : ''); if ($ignoreips) { $query .= " AND " . $ignoreips; } if ($ignorereferrers && $ignorereferrers_case) { $query .= $ignorereferrers_case; } if ($ignorekeywords && $ignorekeywords_case) { $query .= $ignorekeywords_case; } $result = $this->Db->Query($query); $NumConversions = $this->Db->FetchOne($result, 'convcount'); $DisplayPage = isset($_GET['DisplayPage']) ? (int) $_GET['DisplayPage'] : 1; $this->SetupCalendar(); $this->GetSortDetails(); list($sortby, $sortdirection, $direction, $second_sortby, $second_sortdirection) = $this->SortDetails; $sortdetails = '&SortBy=' . $sortby . '&Sort=' . $sortdirection; $GLOBALS['SortDetails'] = $sortdetails; $formaction = 'Action=ProcessPaging&SortBy=' . $sortby . '&Sort=' . $sortdirection; $this->SetupPagingHeader($NumConversions, $DisplayPage, $perpage, $formaction); $template = $this->ParseTemplate('View_Conversions', true, false); $query = "SELECT conversionid, name, amount AS revenue, currtime AS ordertime, origintype AS type, originfrom AS origin, origindetails, ip FROM " . TRACKPOINT_TABLEPREFIX . "conversions WHERE " . $this->SearchUserID . ($this->CalendarRestrictions ? ' AND ' . $this->CalendarRestrictions : ''); if ($ignoreips) { $query .= " AND " . $ignoreips; } if ($ignorereferrers) { $query .= $ignorereferrers_case; } if ($ignorekeywords) { $query .= $ignorekeywords_case; } $query .= " ORDER BY " . $sortby . " " . $direction; if ($second_sortby) { $query .= ", " . $second_sortby . " " . $second_sortdirection; } $query .= $this->Db->AddLimit($perpage * ($DisplayPage - 1), $perpage); $result = $this->Db->Query($query); if (!$result) { return false; } $rowid = 1; $display = ''; while ($row = $this->Db->Fetch($result)) { $GLOBALS['RowID'] = $rowid; $row['type'] = stripslashes($row['type']); $row['origin'] = stripslashes($row['origin']); $GLOBALS['Type'] = GetLang('ViewConversions_' . $row['type']); $GLOBALS['IPAddress'] = $row['ip']; switch ($row['type']) { case 'referrer': if ($row['origin'] == '') { $GLOBALS['Origin'] = GetLang('DirectVisit'); $row['origindetails'] = GetLang('NA'); } else { if (substr($row['origin'], 0, 4) == 'http') { $GLOBALS['Origin'] = '<a href="' . $row['origin'] . '" target="_blank">' . $this->TruncateName($row['origin'], 25) . '</a>'; } else { $GLOBALS['Origin'] = $this->TruncateName($row['origin'], 25); } } break; default: $GLOBALS['Origin'] = $this->TruncateName($row['origin'], 25); } $GLOBALS['OrderTime'] = date(GetLang('TimeFormat'), $this->AdjustTime($row['ordertime'])); $details = stripslashes($row['origindetails']); $GLOBALS['FullDetails'] = $details; if (substr($details, 0, 4) == 'http') { $GLOBALS['Details'] = '<a href="' . $details . '" target="_blank">' . $this->TruncateName($details, 40) . '</a>'; } else { $GLOBALS['Details'] = $this->TruncateName($details, 40); } $GLOBALS['FullName'] = stripslashes($row['name']); $GLOBALS['Name'] = $this->TruncateName(stripslashes($row['name'])); $GLOBALS['Revenue'] = $this->FormatNumber($row['revenue'], 2); $display .= $this->ParseTemplate('View_ConversionsRows', true, false); $rowid++; } if ($rowid == 1) { // if there are no rows, we'll add a "blank" row. $display .= $this->ParseTemplate('View_ConversionsRows_Blank', true, false) . '<br/>'; } $query = "SELECT COUNT(conversionid) AS convcount, SUM(amount) AS revenue FROM " . TRACKPOINT_TABLEPREFIX . "conversions WHERE " . $this->SearchUserID . ($this->CalendarRestrictions ? ' AND ' . $this->CalendarRestrictions : ''); if ($ignoreips) { $query .= " AND " . $ignoreips; } if ($ignorereferrers) { $query .= $ignorereferrers_case; } if ($ignorekeywords) { $query .= $ignorekeywords_case; } $result = $this->Db->Query($query); $row = $this->Db->Fetch($result); $GLOBALS['TotalConversions'] = $this->FormatNumber($row['convcount']); $GLOBALS['TotalRevenue'] = $this->FormatNumber($row['revenue'], 2); $conversion_footer = $this->ParseTemplate('View_Conversions_Footer', true, false); $template = str_replace('%%TPL_ConversionFooter%%', $conversion_footer, $template); $template = str_replace('%%TPL_Paging%%', $GLOBALS['PagingTemplate'], $template); $template = str_replace('%%TPL_Paging_Bottom%%', $GLOBALS['PagingTemplate_Bottom'], $template); $template = str_replace('%%TPL_Calendar%%', $GLOBALS['Calendar'], $template); $template = str_replace('%%TPL_ViewConversions_Rows%%', $display, $template); echo $template; $this->PrintFooter(); }
private function SaveLog($cTable, $cTipe, $cSql) { if ($this->cLog == "db_log") { $cSqla = htmlspecialchars($cSql); //str_replace("'"," ",$cSql) ; //agar dapat disave $vaData = array("tbl" => $cTable, "thistime" => date("Y-m-d H:i:s"), "crud" => $cTipe, "thisip" => @$_SERVER['REMOTE_ADDR'], "username" => GetSession('cSession_UserName'), "thissql" => $cSqla); $this->Insert(GetSession("SC_Database") . "_logs.log_sql_" . date("Ym"), $vaData, false); } else { if ($this->cLog == "db") { $cSqla = htmlspecialchars($cSql); //str_replace("'"," ",$cSql) ; //agar dapat disave $vaData = array("LogTable" => $cTable, "LogWaktu" => date("Y-m-d H:i:s"), "LogCrud" => $cTipe, "LogIp" => @$_SERVER['REMOTE_ADDR'], "LogUserName" => GetSession('cSession_UserName'), "LogSQL" => $cSqla); $this->Insert("sc_config_log", $vaData, false); } } }
function GetPrivileges($SessionId, &$RaidId, &$TeamId, &$UserId, &$Administrator, &$TeamUser, &$Moderator, &$OldMmb, &$RaidStage, &$TeamOutOfRange) { // Инициализируем переменные самым низким уровнем доступа $UserId = 0; $Administrator = 0; $TeamUser = 0; $Moderator = 0; $OldMmb = 0; $RaidStage = 0; $TeamOutOfRange = 0; $UserId = GetSession($SessionId); // Проверяем, не является ли пользователь администратором if ($UserId > 0) { $sql = "select user_admin from Users where user_hide = 0 and user_id = {$UserId}"; $Result = MySqlQuery($sql); if (!$Result) { return; } $Row = mysql_fetch_assoc($Result); $Administrator = $Row['user_admin']; mysql_free_result($Result); } // Контролируем, что команда есть в базе if ($TeamId > 0) { $sql = "select team_id, COALESCE(team_outofrange, 0) as team_outofrange from Teams where team_id = {$TeamId}"; $Result = MySqlQuery($sql); $Row = mysql_fetch_assoc($Result); if (mysql_num_rows($Result) == 0) { $TeamId = 0; } $TeamOutOfRange = $Row['team_outofrange']; mysql_free_result($Result); } // Если ($TeamId == 0) && ($RaidId != 0), то сделать $TeamId равным команде пользователя, если он участвует в RaidId // !! реализовать алгоритм !! // Проверяем, является ли пользователь членом команды if ($UserId > 0 && $TeamId > 0) { $sql = "select CASE WHEN count(*) > 0 THEN 1 ELSE 0 END as userinteam\n\t\t\t\tfrom TeamUsers tu\n\t\t\twhere teamuser_hide = 0 and team_id = {$TeamId} and user_id = {$UserId}"; $TeamUser = CSql::singleValue($sql, 'userinteam'); } // Если известна команда, то все дальнейшие действия проводим с тем ММБ, // в который записана команда if ($TeamId > 0) { $sql = "select raid_id from Distances d\n\t\t\t\tinner join Teams t on t.distance_id = d.distance_id\n\t\t\twhere t.team_id = {$TeamId}"; $RaidId = (int) CSql::singleValue($sql, 'raid_id'); } // Контролируем, что маршбросок существует в базе if ($RaidId > 0) { $sql = "select raid_id from Raids where raid_id = {$RaidId}"; if (CSql::rowCount($sql) == 0) { $RaidId = 0; } } // Если неизвестен маршбросок // то модератор и период маршброска считаются по умолчанию if ($RaidId <= 0) { return; } // Проверяем, является ли пользователь модератором марш-броска if ($UserId > 0) { $sql = "select CASE WHEN count(*) > 0 THEN 1 ELSE 0 END as user_moderator\n\t\t\tfrom RaidModerators\n\t\t\twhere raidmoderator_hide = 0 and raid_id = {$RaidId} and user_id = {$UserId}"; $Moderator = CSql::singleValue($sql, 'user_moderator'); } // 2015-10-24 Отключаем проверку на старые ммб - всё уже в базе // Определяем, проводился ли марш-бросок до 2012 года //$sql = "select CASE WHEN raid_registrationenddate is not null and YEAR(raid_registrationenddate) <= 2011 // THEN 1 // ELSE 0 // END as oldmmb // from Raids where raid_id = $RaidId"; // //$OldMmb = CSql::singleValue($sql, 'oldmmb'); // 20/03/2016 ДОбавил фильтрацию точек с нулеым или NULL мимнимальным и максимальным временем точки, так как для обычных // КП это время решили не вносить // 21/11/2013 Добавил RaidStage (финиш закрыт, но нельзя показывать результаты и сместил 6 на 7) // 30.10.2013 Для трёхдневного ММБ изменил INTERVAL 12 на INTERVAL 24 // RaidStage указывает на то, на какой временной стадии находится ммб // 0 - raid_registrationenddate IS NULL, марш-бросок не показывать // 1 - raid_registrationenddate еще не наступил // 2 - raid_registrationenddate наступил, но удалять участников еще можно // 3 - удалять участников уже нельзя, но первый этап не стартовал // 4 - первый этап стартовал, финиш еще не закрылся // 5 - финиш закрылся, но результаты нельзя показывать // 6 - результаты можно показывать, но raid_closedate не наступил или Is NULL // 7 - raid_closedate наступил $sql = "select\n\t\tCASE\n\t\t\tWHEN r.raid_registrationenddate IS NULL THEN 0\n\t\t\tWHEN r.raid_registrationenddate >= DATE(NOW()) THEN 1\n\t\t\tELSE 2\n\t\tEND as registration,\n\t\t(select count(*) from LevelPoints lp\n\t\t\tinner join Distances d on lp.distance_id = d.distance_id\n\t\t\twhere (d.raid_id = r.raid_id) and (NOW() >= DATE_SUB(lp.levelpoint_mindatetime, INTERVAL COALESCE(r.raid_readonlyhoursbeforestart, 8) HOUR))\n\t\t\t\tand COALESCE(lp.levelpoint_mindatetime, 0) > 0\t\t\t\n\t\t)\n\t\tas cantdelete,\n\t\t(select count(*) from LevelPoints lp\n\t\t\tinner join Distances d on lp.distance_id = d.distance_id\n\t\t\twhere (d.raid_id = r.raid_id) and (NOW() >= lp.levelpoint_mindatetime)\n\t\t\t\tand COALESCE(lp.levelpoint_mindatetime, 0) > 0\t\t\t\n\n\t\t)\n\t\tas started,\n\t\t(select count(*) from LevelPoints lp\n\t\t\tinner join Distances d on lp.distance_id = d.distance_id\n\t\t\twhere (d.raid_id = r.raid_id) and (NOW() < lp.levelpoint_maxdatetime)\n\t\t\t\tand COALESCE(lp.levelpoint_maxdatetime, 0) > 0\t\t\t\n\t\t)\n\t\tas notfinished,\n\t\tCASE\n\t\t\tWHEN (r.raid_closedate IS NULL) OR (r.raid_closedate >= DATE(NOW())) THEN 0\n\t\t\tELSE 1\n\t\tEND as closed,\n\t\tCOALESCE(r.raid_noshowresult, 0) as noshowresult\n\t\tfrom Raids r where r.raid_id={$RaidId}"; $Row = CSql::singleRow($sql); if ($Row['registration'] == 0) { $RaidStage = 0; } elseif ($Row['registration'] == 1) { $RaidStage = 1; } else { if ($Row['cantdelete'] == 0) { $RaidStage = 2; } elseif ($Row['started'] == 0) { $RaidStage = 3; } elseif ($Row['notfinished'] > 0) { $RaidStage = 4; } else { if ($Row['closed'] == 0) { if ($Row['noshowresult'] == 1) { $RaidStage = 5; } else { $RaidStage = 6; } } else { $RaidStage = 7; } } } // Если команда не определена, а регистрация закончена, то команда вне зачета if ($RaidStage >= 2 && empty($TeamId) && $TeamOutOfRange == 0) { $TeamOutOfRange = 1; } // Если команда не определена, и регистрация не закончена, то нужно проверить лимит if ($RaidStage < 2 && empty($TeamId) && $TeamOutOfRange == 0) { // Если достигнут лимит или есть команды в списке ожидания, то "вне зачета" if (IsOutOfRaidLimit($RaidId) == 1 or FindFirstTeamInWaitList($RaidId) > 0) { $TeamOutOfRange = 1; } } // Конец проверки на лимиты }
public function SetMenu() { //ambil dahulu nama file menunya $this->GetFileMenu(); //get session dahulu //$this->cSCMenu = unserialize(GetSession("cSession_SCMenu")) ; if (is_file($this->cNamaFileDef) && $this->cSCMenu == "") { $vaFile = file($this->cNamaFileDef); //load file menu menjadikan array if ($this->lWithCase) { $this->cSCMenu = '<ul class="sidebar-menu">'; } //awal dari navigation menu $nBertingkat = 0; foreach ($vaFile as $nKey => $cValue) { $cIdentifier = strpos($cValue, "#"); if ($cIdentifier === false && trim($cValue) !== "" && strpos($cValue, "<?php die('Sapeltu Inc.'); ?>") !== 0 && (strpos($vaFile[$nKey], "Dashboard") === false || strpos($vaFile[$nKey], "index.") === false) && (strpos($vaFile[$nKey], "Lv") === false || strpos($vaFile[$nKey], "index.") === false)) { //jika diawal value terisi # maka tidak dieksekusi //ambil posisi [ karna untuk menentukan sub sub menu $vaMenu = scArray::Menu2Array($cValue); $lValid = strpos($this->cLevel_md5, $vaMenu['cMd5']) > -1 ? true : ($this->cLevel == "0000" ? true : false); $nPos = strpos($cValue, "["); $lTop = $nPos == 0 ? true : false; //userlevel access //untuk menentukan sub menu / menutup sub menu maka harus dicek menu setelah menu ini $lParent = false; $lParentEnd = false; $lBertingkatEnd = false; $nNextKey = $this->CekSelanjutnya($nKey); if (isset($vaFile[$nNextKey])) { $nPosNext = strpos($vaFile[$nNextKey], "["); $lParent = $nPosNext > $nPos ? true : false; $lParentEnd = $nPosNext >= $nPos ? false : true; $lBertingkatEnd = $nPosNext == 0 ? true : false; } else { //$lParentEnd = true ; $lBertingkatEnd = true; } if ($lValid) { $cDash = GetSession("cSession_Dashboard"); if (trim($cDash) == "") { SaveSession("cSession_Dashboard", $vaMenu['cJs']); } $liClass = $lParent ? "class='treeview'" : ""; $this->cSCMenu .= '<li ' . $liClass . '>'; if ($lParent) { //jika jadi parent maka $this->cSCMenu .= $this->SetDetailMenu($vaMenu, $lTop, $lParent) . '<ul class="treeview-menu">'; $nBertingkat++; } else { $this->cSCMenu .= $this->SetDetailMenu($vaMenu) . "</li>"; } if ($lParentEnd) { //ditutup parent end //$nBertingkat-- ; //$this->cSCMenu .= "</ul></li>" ; while ($nBertingkat > $nPosNext) { $nBertingkat--; $this->cSCMenu .= "</ul></li>"; } } } if ($nBertingkat > 0 && $lBertingkatEnd) { while ($nBertingkat > 0) { $nBertingkat--; $this->cSCMenu .= "</ul></li>"; } } } } if ($this->lWithCase) { $this->cSCMenu .= '</ul>'; } //penutup dari navigation menu SaveSession("cSession_SCMenu", serialize($this->cSCMenu)); } echo $this->cSCMenu; }
/** * PrintEditForm * Prints the user editing form in full. Unlike 'ManageAccount', you can also set permissions here. * Also handles creating users. If there is no userid passed in, it makes sure you're an admin and assumes you're going to add a new user. * If you are not an admin, you get your own form to edit (same as ManageAccount). * * @param userid Userid to edit. If none is present, it will check your permissions and either display the 'New User' or the 'Edit Own User' form. * @param details In case an element was missing (eg name), this holds previous data so it can prefill the form for you. * * @see GetSession * @see Session::Get * @see GetDatabase * @see GetUser * @see User_API::Admin */ function PrintEditForm($userid = 0, $details = array()) { $session =& GetSession(); $thisuser = $session->Get('UserDetails'); if (!$thisuser->Admin()) { if ($userid != $thisuser->userid) { $GLOBALS['ErrorMessage'] = GetLang('NoAccess'); $this->ParseTemplate('AccessDenied'); return false; } } if (isset($_GET['Error'])) { $GLOBALS['Error'] = stripslashes(urldecode($_GET['Error'])); $GLOBALS['Message'] = $this->ParseTemplate('ErrorMsg'); } if (isset($_GET['StatsCleaned'])) { $report = ''; $stats_report = $session->Get('StatsDeletedReport'); if ($stats_report) { foreach ($stats_report as $type => $count) { if ($count == 1) { $report .= GetLang('RemovedRecord_' . strtolower($type)) . '<br/>'; } else { $report .= sprintf(GetLang('RemovedRecords_' . strtolower($type)), $this->FormatNumber($count)) . '<br/>'; } } $GLOBALS['Success'] = $report; $GLOBALS['Message'] = $this->ParseTemplate('SuccessMsg'); } $session->Remove('StatsClearedReport'); $session->Remove('StatsDeletedReport'); $session->Remove('StatsCleared'); } if ($userid > 0) { $user =& GetUser($userid); $GLOBALS['UserID'] = $user->userid; $GLOBALS['UserName'] = $user->username; $GLOBALS['FullName'] = $user->fullname; $GLOBALS['EmailAddress'] = $user->emailaddress; $GLOBALS['IgnoreSites'] = $user->ignoresites; $GLOBALS['IgnoreIPs'] = $user->ignoreips; $GLOBALS['IgnoreKeywords'] = $user->ignorekeywords; $timezone = $user->usertimezone; $GLOBALS['TimeZoneList'] = $this->TimeZoneList($timezone); $GLOBALS['FormAction'] = 'Action=Save&UserID=' . $user->userid; if (!$thisuser->Admin()) { $this->ParseTemplate('User_Edit_Own'); return true; } $GLOBALS['StatusChecked'] = $user->Status() ? ' CHECKED' : ''; $GLOBALS['AdminChecked'] = $user->Admin() ? ' CHECKED' : ''; $this->ParseTemplate('User_Edit'); } else { $GLOBALS['FormAction'] = 'Action=Create'; if (!empty($details)) { foreach ($details as $area => $val) { $GLOBALS[$area] = stripslashes($val); } } $timezone = isset($details['UserTimeZone']) ? $details['UserTimeZone'] : TRACKPOINT_SERVERTIMEZONE; $GLOBALS['TimeZoneList'] = $this->TimeZoneList($timezone); $this->ParseTemplate('User_Add'); } }