예제 #1
0
 public function limitQuery2($sql, $start, $count, $orderby, $sorder, $dieOnError = false, $msg = '')
 {
     //      $now=microtime(true);
     $newSQL = $sql;
     $orderby = $orderby . " " . $sorder;
     if ($start < 0) {
         $start = 0;
     }
     $matches = array();
     if (javaStrPos($sql, "WHERE") > -1) {
         preg_match("/^(.*SELECT )(.*?FROM.*WHERE.*)\$/isU", $sql, $matches);
     } else {
         preg_match("/^(.*SELECT )(.*?FROM.*)\$/isU", $sql, $matches);
     }
     if ($start == 0) {
         $newSQL = $matches[1] . " TOP {$count} " . $matches[2];
         if ($orderby != "") {
             $newSQL .= " order by " . $orderby;
         }
     } else {
         if (!empty($orderby)) {
             //if there is a distinct clause, form query with rownumber after distinct
             $startnum = $start + 1;
             $endnum = $start + $count;
             $newSQL = "SELECT * FROM\n\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t" . $matches[1] . " ROW_NUMBER()\n\t\t\t\t\t\t\t\tOVER (ORDER BY {$orderby}) AS row_number,\n\t\t\t\t\t\t\t\t" . $matches[2] . "\n\t\t\t\t\t\t\t) AS a\n\t\t\t\t\t\t\tWHERE row_number between {$startnum} and {$endnum}";
         } else {
             $startnum = $start + 1;
             $endnum = $start + $count;
             $newSQL = "SELECT  * FROM\n\t\t\t\t\t\t\t\t   (\n\t\t\t\t\t\t  " . $matches[1] . " ROW_NUMBER() OVER (ORDER BY modifiedtime) AS row_number, " . $matches[2] . "\n\t\t\t\t\t\t\t\t   )\n\t\t\t\t\t\t\t\t   AS a\n\t\t\t\t\t\t\t\t   WHERE row_number between {$startnum} and {$endnum}";
         }
     }
     //$nowend=microtime(true);
     //echo $nowend-$now;
     global $log;
     $log->info("query being executed:" . $newSQL);
     $result = $this->Execute($newSQL);
     //$this->dump_slow_queries($newSQL);
     return $result;
 }
예제 #2
0
 function isMssql()
 {
     if (javaStrPos($this->dbType, 'mssql') > -1) {
         return true;
     } else {
         return false;
     }
 }
예제 #3
0
파일: index.php 프로젝트: honj51/taobaocrm
    } else {
        $log->debug("The current user does not have a session.  Going to the login page");
        $action = "Login";
        $module = "Users";
        $_SESSION['not_login_query_string'] = $_SERVER["QUERY_STRING"];
        echo "<script>parent.location.href='Login.php';</script>";
    }
}
$skipHeaders = false;
$skipFooters = false;
$viewAttachment = false;
$skipSecurityCheck = false;
if (!empty($action) && !empty($module)) {
    $log->info("About to take action " . $action);
    foreach ($skipActions as $skipAction) {
        $isSkip = javaStrPos($action, $skipAction);
        if ($isSkip > -1) {
            $skipHeaders = true;
            $skipFooters = true;
            break;
        }
    }
    if ($action == 'Save') {
        header("Expires: Mon, 20 Dec 1998 01:00:00 GMT");
        header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
        header("Cache-Control: no-cache, must-revalidate");
        header("Pragma: no-cache");
    }
    if ($module == 'Users' || $module == 'Home' || $module == 'uploads') {
        $skipSecurityCheck = true;
    }
예제 #4
0
파일: index.php 프로젝트: Pengzw/c3crm
    /*
    if(isset($_REQUEST['record']) && $_REQUEST['record']!='' && $_REQUEST["module"] != "Webmails") 
    {
    	track_view($current_user->id,$currentModule,$_REQUEST['record']);
    }
    */
}
//skip headers for popups, deleting, saving, importing and other actions
if (!$skipHeaders) {
    if ($use_current_login) {
        include $root_directory . 'themes/' . $theme . '/header.php';
    }
}
if (!$skipSecurityCheck) {
    require_once $root_directory . 'include/utils/UserInfoUtil.php';
    $isSkip = javaStrPos($action, 'Ajax');
    if ($isSkip > -1) {
        $now_action = $_REQUEST['file'];
    } else {
        $now_action = $action;
    }
    if (isset($_REQUEST['record']) && $_REQUEST['record'] != '') {
        $display = isPermitted($module, $now_action, $_REQUEST['record']);
    } else {
        if ($now_action == "EditView") {
            $now_action = "Create";
        }
        $display = isPermitted($module, $now_action);
    }
}
if ($display == "no") {