function setErrorHandler($errno, $errstr, $errfile, $errline, $errcontext = null) { Doo::loadHelper('DooTextHelper'); //require if ($errno == 2 && strpos($errstr, 'require_once(') === 0 && strpos(str_replace('\\', '/', $errfile), str_replace('\\', '/', Doo::conf()->BASE_PATH) . 'Doo.php') === 0) { $dmsg = debug_backtrace(); foreach ($dmsg as $k => $a) { //if is user file, and must be a load method if (strpos(str_replace('\\', '/', $a['file']), str_replace('\\', '/', Doo::conf()->SITE_PATH)) === 0 && stripos($a['function'], 'load') === 0) { //print_r($a);exit; $errfile = $a['file']; $errline = $a['line']; break; } } } else { if ($errno == 2 && strpos(str_replace('\\', '/', $errfile), str_replace('\\', '/', Doo::conf()->BASE_PATH) . 'view/DooView.php') === 0) { $dmsg = debug_backtrace(); foreach ($dmsg as $k => $a) { if (strpos(str_replace('\\', '/', $a['file']), str_replace('\\', '/', Doo::conf()->SITE_PATH)) === 0 && stripos(str_replace('\\', '/', $a['file']), '/controller') !== false) { $errfile = $a['file']; $errline = $a['line']; if (strpos($errstr, 'file_get_contents') !== false) { $errstr = 'Template not found ' . str_replace('[<a href=\'function.file-get-contents\'>function.file-get-contents</a>]: failed to open stream: ', '', str_replace('file_get_contents', '', $errstr)); } break; } } } } if (strpos(str_replace('\\', '/', $errfile), str_replace('\\', '/', Doo::conf()->BASE_PATH)) === 0) { $dmsg = debug_backtrace(); $last = array_pop($dmsg); if (isset($last['file'])) { // $errfile = $last['file']; // $errline = $last['line']; } else { $errfile = $dmsg[0]['args'][2]; $errline = $dmsg[0]['args'][3]; } } $script = file_get_contents($errfile); $script = DooTextHelper::highlightPHP($script); $pre = ''; $Xpre = ''; if (!empty($script)) { //if template file addon the <pre> if (strpos(str_replace('\\', '/', $errfile), str_replace('\\', '/', Doo::conf()->SITE_PATH . Doo::conf()->PROTECTED_FOLDER) . 'view') === 0) { $pre = '<pre>'; $Xpre = '</pre>'; } $lines = explode('<br />', $script); $errLineContent = '<div class="errorbig" onclick="javascript:viewCode();">' . $pre . $lines[$errline - 1] . $Xpre . '</div>'; //highlight the error line $lines[$errline - 1] = '<div id="eerrline" class="errline" onclick="javascript:closeCode();" title="Click to close"><a id="' . $errline . '" name="' . $errline . '"></a>' . $lines[$errline - 1] . '</div>'; //remove the code tag from 1st and last line $lines[0] = str_replace('<code>', '', $lines[0]); $lines[sizeof($lines) - 1] = str_replace('</code>', '', $lines[sizeof($lines) - 1]); } $imgloader = Doo::conf()->SUBFOLDER . 'index.php?doodiagnostic_pic='; if (ob_get_level() !== 0) { ob_clean(); } $confData = traceVar(Doo::conf()); $getData = traceVar($_GET); $postData = traceVar($_POST); if (isset($_SESSION)) { $sessionData = traceVar($_SESSION); } if (isset($_COOKIE)) { $cookieData = traceVar($_COOKIE); } echo "<html><head><title>DooPHP 诊断 - {$errstr}</title>"; echo '<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />'; //css echo '<style> html{padding:0px;margin:0px;} body{ background-color:#62C4E1;padding:0px;margin:0px;font-family:"Consolas","Monaco","Bitstream Vera Sans Mono","Courier New",Courier,monospace; } #logo{ height:130px;width:260px;text-indent:-9999px; float:left;cursor:pointer; background:transparent url(' . $imgloader . 'logo-b2.png) no-repeat center left; } #header { min-height:130px; background:#142830 url(' . $imgloader . 'bg-footer.gif) repeat-x scroll 0 0; } #header h1, #content h2{margin:0px;letter-spacing:-1px;} #header h1{ letter-spacing:-2px;font-size:36px;color:#FFD000;padding:40px 0px 20px 10px; } #errorFile{font-family:Georgia,serif;font-weight:normal;padding:10px;} #errorLine{font-family:Georgia;font-size:18px;padding:0px;} #content{ padding:20px 20px 0px 20px; background:#62C4E1 url(' . $imgloader . 'bg-down.png) repeat-x scroll 0 0; } .errorbig, .errline{ background:#6CE26C; } .errorbig{background:#fff;border:1px solid #c0ff0e;padding:20px;margin:12px;cursor:pointer;} #eerrline{cursor:pointer;} .scriptcode{ display:none;padding:30px;border:1px solid #d9d9d9;margin:20px;padding-top:15px; background:transparent url(' . $imgloader . 'bgcode.png); } hr{color:#BDE6F2;} ol, pre{background:#fff;border:1px solid #c0ff0e;padding:20px 20px 20px 20px;margin:20px;} li{font-size:14px;line-height:20px;margin-left:30px;font-family:Georgia;} .error_backtrace{font-family:Georgia;font-size:18px;padding:0px;margin:0px;} .back{ background:#8FD5E9; color:#FFFFFF; font-size:1em; font-weight:bold; letter-spacing:2px; line-height:2; margin:0 0 20px; text-shadow:0 1px 0 #51A5C0; text-transform:uppercase; width:100%;height:30px; text-align:center; } .back a{ color:#fff;text-decoration:none; display:block; } .back a:hover{background:#4370A4;} .var a{color:#fff;text-decoration:none;display:inline;font-size:18px;} .var a:hover{background:#8FD5E9;} #panelConf,#panelGet,#panelPost,#panelSession,#panelCookie,#goVar{display:none;} </style>'; //script echo '<script> function viewCode(){ document.getElementById("scriptcode").style.display = "block"; window.location.hash = "' . $errline . '"; } function closeCode(){ window.location.hash = "#top" document.getElementById("scriptcode").style.display = "none"; } var lastcode=""; function code(n){ var arr = ["panelConf","panelGet","panelPost","panelSession","panelCookie"]; if(arr[n]==lastcode){ var onOrOff = (document.getElementById(arr[n]).style.display == "none")?"block":"none"; document.getElementById(arr[n]).style.display = onOrOff; document.getElementById("goVar").style.display = onOrOff; if(onOrOff=="none") document.getElementById("b"+arr[n]).style.backgroundColor = ""; return; }else{ document.getElementById(arr[n]).style.display = "block"; document.getElementById("goVar").style.display = "block"; document.getElementById("b"+arr[n]).style.backgroundColor = "#8FD5E9"; } if(lastcode!=""){ document.getElementById(lastcode).style.display = "none"; document.getElementById("b"+lastcode).style.backgroundColor = ""; } lastcode = arr[n]; } function goVisit(){ document.location.href="http://doophp.net/"; } </script>'; //headings echo "</head><body>"; echo '<div id="header">'; //echo "Unknown error type: [$errno] $errstr<br />\n"; echo "<span id=\"logo\" onclick=\"javascript:goVisit();\">DooPHP</span><h1>{$errstr}</h1>"; echo '</div><div id="content">'; echo "<h2 id=\"errorFile\">See file <a href=\"javascript:viewCode();\" title=\"Click to see code\">{$errfile}</a></h2><br/>"; echo "<h2 id=\"errorLine\"> + Error on line <a href=\"javascript:viewCode();\" title=\"Click to see code\">{$errline}</a></h2>"; if (isset($errLineContent)) { echo "<h3>" . $errLineContent . "</h3>"; } //error code script echo $pre . '<code id="scriptcode" class="scriptcode">'; if (isset($lines)) { echo implode('<br />', $lines); } echo '</code>' . $Xpre; echo '<br/><hr/><h2 style="background-color:#4370A4;color:#fff;width:320px;padding:5px;"> * Stack Trace...</h2>'; global $errTrace; if (!empty($errTrace)) { echo '<pre>'; echo $errTrace; echo '</pre>'; } else { errorBacktrace(); } echo '<br/><hr/><h2 class="var" style="background-color:#4370A4;color:#fff;width:760px;padding:5px;"> * Variables... <a id="bpanelConf" href="javascript:code(0);"> Conf </a> . <a id="bpanelGet" href="javascript:code(1);"> GET </a> . <a id="bpanelPost" href="javascript:code(2);"> POST </a> . <a id="bpanelSession" href="javascript:code(3);"> Session </a> . <a id="bpanelCookie" href="javascript:code(4);"> Cookie </a></h2>'; //config data echo '<pre id="goVar">'; $confData = str_replace(']=><br /> ', '] => ', DooTextHelper::highlightPHP($confData)); echo str_replace('<code>', '<code id="panelConf">', $confData); if (!empty($_GET)) { $getData = str_replace(']=><br /> ', '] => ', DooTextHelper::highlightPHP($getData)); echo str_replace('<code>', "<code id=\"panelGet\"><span style=\"color:#0000BB;\">\$_GET Variables</span>", $getData); } if (!empty($_POST)) { $postData = str_replace(']=><br /> ', '] => ', DooTextHelper::highlightPHP($postData)); echo str_replace('<code>', "<code id=\"panelPost\"><span style=\"color:#0000BB;\">\$_POST Variables</span>", $postData); } if (isset($sessionData)) { $sessionData = str_replace(']=><br /> ', '] => ', DooTextHelper::highlightPHP($sessionData)); echo str_replace('<code>', "<code id=\"panelSession\"><span style=\"color:#0000BB;\">\$_SESSION Variables</span>", $sessionData); } if (isset($_COOKIE)) { $cookieData = str_replace(']=><br /> ', '] => ', DooTextHelper::highlightPHP($cookieData)); echo str_replace('<code>', "<code id=\"panelCookie\"><span style=\"color:#0000BB;\">\$_COOKIE Variables</span>", $cookieData); } echo '</pre><br/>'; echo "</div><div class=\"back\"><a href=\"#top\">BACK TO TOP </a></div></body></html>"; exit; }
public function userList() { Doo::loadHelper('DooTextHelper'); $data = $this->conf_data; Doo::loadClass('UserSession'); $usession = new UserSession(); $username = $usession->uget('username'); if (isset($_POST['table_row'])) { $usession->uset('table_row_option', $_POST['table_row']); } $rows_data = $usession->uget('table_row_option'); if (!$username) { header('Location:' . DOO::conf()->SUBFOLDER . 'login'); } $dbapi = $this->dbapi; $data['limit'] = 20; if ($rows_data) { $data['limit'] = $rows_data; } $gpage = $_GET['page'] - 1; if ($_REQUEST['print'] == 'excel') { set_time_limit(0); ini_set('memory_limit', '512M'); $data['limit'] = 99999999; unset($gpage); } $gord = $_GET['ord']; $gsearch = addslashes($_POST['search']); $gdtform = addslashes($_GET['dtform']); $gdtto = addslashes($_GET['dtto']); if (!$gdtform) { $gdtform = date("m/d/Y", strtotime("-1 month")); } if (!$gdtto) { $gdtto = date("m/d/Y"); } $data['gdtto'] = $gdtto; $data['gdtform'] = $gdtform; $start = 0; $ord = ''; $qsearch = ''; $qutype = ''; $qfilter = ''; $qSpeedyReginal = $qSubregional = ''; $ordby = "ASC"; if ($username == 'dcs_timur') { $_GET['userProvider'] = 1; if (!$_REQUEST['speedyRegional']) { $_REQUEST['speedyRegional'] = "14;15;16;17"; } } if ($username == 'dcs_barat') { $_GET['userProvider'] = 1; if (!$_REQUEST['speedyRegional']) { $_REQUEST['speedyRegional'] = "11;12;13"; } } if ($username == 'telkomsel') { $_GET['userProvider'] = 2; } if ($_REQUEST['speedyRegional']) { $tempSpeedyReg = explode(';', $_REQUEST['speedyRegional']); $impSpeedyReg = implode("','", $tempSpeedyReg); $qSpeedyReginal = " AND left( ota.bill_account,2) in ('{$impSpeedyReg}') "; if ($_REQUEST['speedySubRegional']) { $qSpeedyReginal = " AND left( ota.bill_account,5) in ('{$_REQUEST['speedySubRegional']}') "; } } if ($_GET['ascd'] == '0') { $ordby = "DESC"; } switch ($gord) { case 'name': $ord = 'subscriber_name '; break; case 'email': $ord = 'user_id '; break; case 'created': $ord = 'create_time '; break; case 'status': $ord = 'status '; break; default: $ord = 'create_time '; $ordby = "DESC"; break; } if ($ord) { $ord .= $ordby; } if ($_GET['userProvider']) { $qutype = " AND type = '" . (int) $_GET['userProvider'] . "'"; } if (isset($gpage) && $gpage >= 0) { $start = $gpage * $data['limit']; } if ($gsearch) { $qsearch = " AND ( subscriber_name LIKE '%{$gsearch}%' OR user_id LIKE '%{$gsearch}%' or email like '%{$gsearch}%') "; } if ($gdtform && $gdtto) { $start_date = $gdtform = date("Y-m-d H:i:s", strtotime($gdtform)); $end_date = $gdtto = date("Y-m-d", strtotime($gdtto)) . " 23:59:59"; $qfilter = " AND create_time >= '{$gdtform}' AND create_time <= '{$gdtto}' "; if ($gdtform == $gdtto) { $qfilter = " AND create_time like '" . date("Y-m-d", strtotime($gdtto)) . "%' "; } } else { $qfilter = " AND create_time > '2012-08-31' "; } $qwhere = "1=1 {$qsearch} {$qfilter} {$qutype} {$qSpeedyReginal}"; if ($qSpeedyReginal) { $dbapi->join_table = "LEFT JOIN ott_business_account ota ON (ics.id=ota.subscriber_id)"; } $data['content_data'] = $dbapi->get_user('ics.id, customer_id, user_id, type, create_time,update_time,subscriber_name, ics.bill_account_type, ics.bill_account, ics.home_phone, email', $qwhere, $start, $data['limit'], $ord); $data['total'] = $dbapi->get_total_from_query(); if ($_REQUEST['print'] == 'excel') { DooTextHelper::download_send_headers('users_' . date("Ymd") . ".csv"); echo DooTextHelper::array2csv($data['content_data']); exit; } if (!$start_date) { $start_date = date("Y-m-d", strtotime("-1 month")); } if (!$end_date) { $end_date = date("Y-m-d"); } $data['graph'] = $dbapi->get_graph_register($_GET['userProvider'], $_REQUEST['speedyRegional'], $_REQUEST['speedySubRegional'], $start_date, $end_date); $data['username'] = $username; $data['dbapi'] = $this->dbapi; $data['subregion'] = $this->subregion; $data['filter_action'] = 'user/list'; $data['content_view'] = 'content/list_user.php'; $data['table_row_option'] = array(20, 100, 500, 1000, 10000); $this->view()->renderc(Doo::conf()->language . '/t3', $data); }
function shorten($str, $limit = 120) { Doo::loadHelper('DooTextHelper'); return DooTextHelper::limitWord($str, $limit); }
public function spincard() { $dbapi = $this->dbapi; $data = $this->conf_data; $data['limit'] = $this->limit; $start = $this->start; $start_date = $this->start_date; $end_date = $this->end_date; $gsearch = $this->gsearch; $data['gdtto'] = $this->gdtto; $data['gdtform'] = $this->gdtform; $qfilter = " AND unix_timestamp(created) >= " . strtotime($start_date) . " AND unix_timestamp(created) <= " . strtotime($end_date); if ($gsearch) { $qsearch = " AND ((username LIKE '%{$gsearch}%' OR username LIKE '{$gsearch}%' OR username LIKE '%{$gsearch}')or (spincard like '%{$gsearch}%' OR spincard like '{$gsearch}%' OR spincard like '%{$gsearch}') )"; $qfilter = ""; } $qwhere = "1=1 {$qsearch} {$qfilter}"; $data['content_data'] = $dbapi->get_spincard('username, spincard, created', $qwhere, $start, $data['limit']); $data['total'] = $dbapi->get_total_from_query_aaa2(); if ($_REQUEST['print'] == 'excel') { DooTextHelper::download_send_headers('spincard_' . date("Ymd") . ".csv"); echo DooTextHelper::array2csv($data['content_data']); exit; } $data['graph'] = $dbapi->get_graph_spincard($start_date, $end_date); $data['filter_tipe'] = false; $data['filter_action'] = 'user/spincard'; $data['content_view'] = 'content/spincard.php'; $data['table_row_option'] = array(20, 100, 500, 1000, 10000); $data['label'] = 'Spincard'; $this->view()->renderc(Doo::conf()->language . '/t3', $data); }
public function indexKoreanpackage() { Doo::loadHelper('DooPager'); Doo::loadClass('Movie'); $mv = new Movie(); $data = $this->conf_data; $data['title'] = 'UseeTV - Korean Packet'; $data['content_view'] = 'content/new_svod.php'; if (!$this->start) { $this->start = 0; } $data['limit'] = $this->limit; $data['gdtto'] = $this->gdtto; $data['gdtform'] = $this->gdtform; $data['content_data'] = $mv->get_korean_register($_GET['userProvider'], $_REQUEST['speedyRegional'], $_REQUEST['speedySubRegional'], $this->start_date, $this->end_date, $this->start, $data['limit'], $this->ord, $this->gsearch); if ($_REQUEST['print'] == 'excel') { DooTextHelper::download_send_headers('koreanpackage_' . date("Ymd") . ".csv"); echo DooTextHelper::array2csv($data['content_data']); exit; } $data['total'] = $mv->get_total_from_query(); $data['graph'] = $mv->get_graph_korean_register($_GET['userProvider'], $_REQUEST['speedyRegional'], $_REQUEST['speedySubRegional'], $this->start_date, $this->end_date); $data['filter_action'] = 'koreanpackage'; $data['table_row_option'] = array(20, 100, 500, 1000, 10000); $data['label'] = 'KOREAN PACKAGE'; $this->view()->renderc(Doo::conf()->language . '/t3', $data); }