예제 #1
0
function failRequest($message)
{
    errorLog("There was an error in the edit group request: " . $message);
    $response = array("success" => FALSE, "message" => $message);
    echo json_encode($response);
    exit;
}
예제 #2
0
function newWorksheetForGroup($staff, $setid, $worksheetid, $duedate, $level, $type)
{
    global $userid, $userval;
    $postData = array("type" => "NEW", "userid" => $userid, "userval" => $userval);
    if (isset($staff[0])) {
        $postData["staff"] = $staff[0];
    }
    if (isset($staff[1])) {
        $postData["addstaff1"] = $staff[1];
    }
    if (isset($staff[2])) {
        $postData["addstaff2"] = $staff[2];
    }
    if (isset($setid)) {
        $postData["set"] = $setid;
    }
    if (isset($worksheetid)) {
        $postData["worksheet"] = $worksheetid;
    }
    if (isset($duedate)) {
        $postData["datedue"] = $duedate;
    }
    $response = sendCURLRequest("/requests/setGroupWorksheet.php", $postData);
    $respArray = json_decode($response[1], TRUE);
    if ($respArray["result"]) {
        $gwid = $respArray["gwid"];
        // Go to page to enter the results
        header("Location: ../editSetResults.php?gwid={$gwid}");
        exit;
    } else {
        // Failure
        errorLog("Adding the new worksheet failed with error: " . $response[1]);
        returnToPageError("Something went wrong creating the new set of results.", $level, $type, $setid, $staff[0]);
    }
}
예제 #3
0
function returnToPageError($ex, $message)
{
    errorLog("There was an error in the get students request: " . $ex->getMessage());
    $response = array("success" => FALSE, "message" => $message . ": " . $ex->getMessage());
    echo json_encode($response);
    exit;
}
예제 #4
0
function failRequest($message)
{
    errorLog("There was an error in the get markbook request: " . $message);
    $response = array("success" => FALSE);
    echo json_encode($response);
    exit;
}
예제 #5
0
function failWithMessageAndException($gwid, $message, $ex)
{
    $type = 'ERROR';
    $_SESSION['message'] = new Message($type, $message);
    $exMsg = $ex != null ? $ex->getMessage() : "";
    errorLog($message . " With exception: " . $exMsg);
    header("Location: ../editSetResults.php?gwid={$gwid}");
    exit;
}
예제 #6
0
파일: View.php 프로젝트: akitech/hooks-src
 private function includeMVCView()
 {
     $controller = strtolower(Globals::getItem("controller"));
     $method = strtolower(Globals::getItem("method"));
     $filePath = BASE_DIR . "/Views/" . $controller . "/" . $method . ".php";
     $filePath = str_replace("\\", DIRECTORY_SEPARATOR, $filePath);
     if (!FileSystem::exists($filePath)) {
         errorLog("View not found for " . $controller . "/" . $method, 2);
     }
     self::includeRequestedView($filePath);
 }
예제 #7
0
function autoSavePostData($id, $tableName, $fieldNameList)
{
    $sql = '';
    $sql = getPostSql($id, $tableName, $fieldNameList);
    //检测SQL
    if (checkSql($sql) == false) {
        errorLog('出错提示:<hr>sql=' . $sql . '<br>');
        return '';
    }
    //conn.execute(sql)			'checksql这一步就已经执行了不需要再执行了20160410
}
예제 #8
0
function returnToPageError($message)
{
    $type = 'ERROR';
    if (isset($_SESSION['user'])) {
        $user = $_SESSION['user'];
        $userid = $user->getUserId();
        $msg = "User {$userid} was unable to switch users as the id was not correctly set.";
        errorLog($msg);
    }
    $_SESSION['message'] = new Message($type, $message);
    header("Location: ../switchUser.php");
    exit;
}
예제 #9
0
파일: Curl.php 프로젝트: akitech/hooks-src
 public function execute()
 {
     if (!function_exists("curl_init")) {
         errorLog("CURL is required. Please install.", 3);
     }
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $this->url);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_HEADER, $this->headers);
     $output = curl_exec($ch);
     curl_close($ch);
     return $output;
 }
예제 #10
0
파일: cli.php 프로젝트: dezvell/skeleton
function errorDisplay()
{
    $e = error_get_last();
    if (!is_array($e) || !in_array($e['type'], array(E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR))) {
        return;
    }
    echo "Application Error\n";
    if (getenv('BLUZ_DEBUG')) {
        echo $e['message'] . "\n";
        echo $e['file'] . "#" . $e['line'] . "\n";
    }
    // try to write log
    errorLog($e['message'], $e['file'] . "#" . $e['line']);
    exit(1);
}
예제 #11
0
파일: Etc.php 프로젝트: akitech/hooks-src
 public static function parseFields(array $fields, $required = true, $implode = true)
 {
     $data = [];
     foreach ($fields as $field) {
         if ($required && !Request::isItemSet($field)) {
             errorLog("Invalid request for parse field : " . $field, 1);
         }
         $item = Request::getItem($field);
         if (is_array($item)) {
             $item = implode(",", $item);
         }
         $data[$field] = $item;
     }
     return $data;
 }
예제 #12
0
function handle_error($errno, $errstr, $errfile, $errline, $errcontext)
{
    // timestamp for the error entry
    $dt = date("Y-m-d H:i:s");
    // Make log entries
    $errortype = array(E_ERROR => 'Error', E_WARNING => 'Warning', E_PARSE => 'Parsing Error', E_NOTICE => 'Notice', E_CORE_ERROR => 'Core Error', E_CORE_WARNING => 'Core Warning', E_COMPILE_ERROR => 'Compile Error', E_COMPILE_WARNING => 'Compile Warning', E_USER_ERROR => 'User Error', E_USER_WARNING => 'User Warning', E_USER_NOTICE => 'User Notice', E_STRICT => 'Runtime Notice', E_RECOVERABLE_ERROR => 'Catchable Fatal Error');
    $error_msg = array("DT" => $dt, "E_NO" => $errno, "T" => $errortype, "E" => $errstr, "F" => $errfile, "L" => $errline);
    //$error_msg = "[$dt] $errortype[$errno] $errstr in $errfile at $errline";
    errorLog("{$error_msg}\n");
    //Critical errors
    $critical_errors = array(E_ERROR, E_PARSE, E_CORE_ERROR, E_USER_ERROR);
    if (in_array($errno, $critical_errors)) {
        error_log($error_msg, 1, "*****@*****.**");
        terminate($error_msg);
    }
}
예제 #13
0
파일: index.php 프로젝트: dezvell/skeleton
function errorDisplay()
{
    if (!($e = error_get_last())) {
        return;
    }
    if (!is_array($e) || !in_array($e['type'], array(E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR))) {
        return;
    }
    // clean all buffers
    while (ob_get_level()) {
        ob_end_clean();
    }
    // try to write log
    errorLog($e['message'], $e['file'] . "#" . $e['line']);
    // display error page
    require_once 'error.php';
}
예제 #14
0
 function connect()
 {
     static $dbh;
     global $addon;
     $db_params = $addon->callHook('db_params');
     $dbh = mysql_connect($db_params['db_read_host'], $db_params['db_read_user'], $db_params['db_read_pass']);
     if (!$dbh) {
         errorLog("Failed attempt to connect to server - aborting.");
         exitTo("/error.php?errNo=101301", "error: 101301 - data server can not be found");
     }
     $database = $db_params['db_read_name'];
     if (isset($database)) {
         if (!mysql_select_db($database)) {
             errorLog("Failed attempt to open database: {$database} - aborting \n\t" . mysql_error());
             exitTo("/error.php?errNo=101303", "error: 101303 - unknown database name");
         }
     }
     return $dbh;
 }
예제 #15
0
function returnToPageError($message)
{
    $type = 'ERROR';
    errorLog($message);
    $_SESSION['message'] = new Message($type, $message);
    $_SESSION['formValues'] = $GLOBALS["informationArray"];
    header("Location: ../addNewWorksheet.php");
    exit;
}
예제 #16
0
파일: Image.php 프로젝트: akitech/hooks-src
 private function prepareFromImageType()
 {
     if (!function_exists("imagecreatefromjpeg") || !function_exists("imagecreatefromgif") || !function_exists("imagecreatefrompng")) {
         errorLog("GD Image Library (imagecreatefrom...) is required. Please install.", 3);
     }
     switch ($this->imageType) {
         case "image/jpeg":
             $this->thumb = imagecreatefromjpeg($this->path);
             //jpeg file
             break;
         case "image/gif":
             $this->thumb = imagecreatefromgif($this->path);
             //gif file
             break;
         case "image/png":
             $this->thumb = imagecreatefrompng($this->path);
             //png file
             break;
         default:
             die("Only jpeg, png and gif is supported");
             break;
     }
 }
function sendAWeber($mailSubscribe)
{
    if (defined('AW_AUTHCODE') && defined('AW_LISTNAME')) {
        $token = 'api_aweber/' . substr(AW_AUTHCODE, 0, 10);
        if (!file_exists($token)) {
            try {
                $auth = AWeberAPI::getDataFromAweberID(AW_AUTHCODE);
                file_put_contents($token, json_encode($auth));
            } catch (AWeberAPIException $exc) {
                errorLog("AWeber", "[" . $exc->type . "] " . $exc->message . " Docs: " . $exc->documentation_url);
                throw new Exception("Authorization error", 5);
            }
        }
        if (file_exists($token)) {
            $key = file_get_contents($token);
        }
        list($consumerKey, $consumerSecret, $accessToken, $accessSecret) = json_decode($key);
        $aweber = new AWeberAPI($consumerKey, $consumerSecret);
        try {
            $account = $aweber->getAccount($accessToken, $accessSecret);
            $foundLists = $account->lists->find(array('name' => AW_LISTNAME));
            $lists = $foundLists[0];
            $params = array('email' => $mailSubscribe, 'name' => getName($mailSubscribe));
            if (isset($lists)) {
                $lists->subscribers->create($params);
            } else {
                errorLog("AWeber", "List is not found");
                throw new Exception("Error found Lists", 4);
            }
        } catch (AWeberAPIException $exc) {
            if ($exc->status == 400) {
                throw new Exception("Email exist", 2);
            } else {
                errorLog("AWeber", "[" . $exc->type . "] " . $exc->message . " Docs: " . $exc->documentation_url);
            }
        }
    }
}
    if (!is_dir($errorDir)) {
        exit('不能建立目录!');
    }
}
$wishProductApi = new WishProductApi('geshan0728', 1);
$num = 0;
foreach ($files as $fileKey => $fileVal) {
    $spuInfo = explode('.', $fileVal);
    $spuSn = $spuInfo[0];
    if (!empty($spuArr)) {
        if (!in_array($spuSn, $spuArr)) {
            echo $spuSn, ':没有料号信息', PHP_EOL;
            continue;
        }
    }
    errorLog('开始上传,' . $spuSn, 'tip');
    $sql = 'select spuSn from `ws_wait_publish` where spuSn = "' . $spuSn . '"';
    $query = $dbConn->query($sql);
    $ret = $dbConn->fetch_array_all($query);
    if (!empty($ret)) {
        //已经上传过此商品
        echo $spuSn, ', 此料号已经记录到数据库中,不需要再记录', PHP_EOL;
        //rename($logPath.$fileVal, $errorDir.$spuSn.'.log');
        continue;
    }
    $price = spuPrice($spuSn);
    $productInfo = readProductInfo($spuSn);
    if (empty($productInfo)) {
        echo '没有数据', PHP_EOL;
        rename($logPath . $fileVal, $errorDir . $spuSn . '.log');
        continue;
예제 #19
0
$conn = mysql_connect($SQLHOST, $SQLUSER, $SQLPASS);
if (!$conn) {
    errorLog('Could not connect: ' . mysql_error(), true);
}
$db_selected = mysql_select_db($SQLDB, $conn);
if (!$db_selected) {
    errorLog('Can\'t use ' . $SQLDB . ' : ' . mysql_error(), true);
}
// Separando detail traps
$traps_array = explode('*', $trap_ret['detail']);
$string = print_r($traps_array, 1);
errorLog($string);
if ($traps_array[1] != 'DISP') {
    $insert_sql = "INSERT INTO `{$SQLTBL}` (`id_traps`, `FECHA_HORA`, `ENCABEZADO`, `RUT`, `NODO`, `CUADRANTE`, `HOST`, `GROUP`, `OID`, `TIPO`, `VALORESPERADO`, `VALOROBTENIDO`, `LOGIN`) VALUES ";
    $values_sql = "(NULL,NOW(),'{$traps_array['0']}','{$traps_array['1']}','{$traps_array['2']}','{$traps_array['3']}','{$traps_array['5']}','{$traps_array['6']}','{$traps_array['7']}','{$traps_array['8']}','{$traps_array['9']}','{$traps_array['10']}','{$traps_array['11']}');";
    $result = mysql_query($insert_sql . $values_sql);
    if (!$result) {
        errorLog('Invalid query: ' . mysql_error(), true);
    }
} else {
    $traps_dips_array1 = explode('_', $traps_array[2]);
    $string = print_r($traps_dips_array1, 1);
    errorLog($string);
    $insert_sql = "INSERT INTO `{$SQLTBL}` (`FECHA_HORA`, `ENCABEZADO`, `TRAPCRIT`, `RDB`, `RUT`, `NODO`, `CUADRANTE`, `COMUNA` , `HOST`, `DNS`, `GROUP`, `PLAN`, `OID`, `TIPO`, `VALORESPERADO`, `VALOROBTENIDO`, `LOGIN`) VALUES ";
    $values_sql = printf("(NOW(),%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)", $traps_array[0], $traps_dips_array1[0], $traps_dips_array1[1], $traps_dips_array1[2], $traps_dips_array1[3], $traps_dips_array1[4], $traps_dips_array1[5], '', $traps_dips_array1[6], '', $traps_dips_array1[7], $trap_ret['key'], $traps_array[1], '1', '0', $traps_array[3]);
    $result = mysql_query($insert_sql . $values_sql);
    if (!$result) {
        errorLog('Invalid query: ' . mysql_error(), true);
    }
}
mysql_close($conn);
예제 #20
0
function XY_AP_GeneralList($action, $tableName, $addSql)
{
    $title = '';
    $topNumb = '';
    $nTop = '';
    $isB = '';
    $sql = '';
    $columnName = '';
    $columnEnName = '';
    $aboutcontent = '';
    $bodyContent = '';
    $showTitle = '';
    $bannerImage = '';
    $smallImage = '';
    $bigImage = '';
    $id = '';
    $defaultStr = '';
    $i = '';
    $j = '';
    $s = '';
    $c = '';
    $startStr = '';
    $endStr = '';
    $url = '';
    $noFollow = '';
    //不追踪 20141222
    $defaultStr = getDefaultValue($action);
    //获得默认内容
    $modI = '';
    //余循环20150112
    $noFollow = aspTrim(lCase(RParam($action, 'noFollow')));
    //不追踪
    $lableTitle = '';
    //标题标题
    $target = '';
    //a链接打开目标方式
    $adddatetime = '';
    //添加时间
    $isFocus = '';
    $fieldNameList = '';
    //字段列表
    $abcolorStr = '';
    //A加粗和颜色
    $atargetStr = '';
    //A链接打开方式
    $atitleStr = '';
    //A链接的title20160407
    $anofollowStr = '';
    //A链接的nofollow
    $splFieldName = '';
    $fieldName = '';
    $replaceStr = '';
    $k = '';
    $idPage = '';
    $tableName = lCase($tableName);
    //转小写
    $fieldNameList = getHandleFieldList($GLOBALS['db_PREFIX'] . $tableName, '字段列表');
    $splFieldName = aspSplit($fieldNameList, ',');
    $topNumb = RParam($action, 'topNumb');
    $nTop = $topNumb;
    if ($nTop != '') {
        $nTop = CInt($nTop);
    } else {
        $nTop = 999;
    }
    if ($sql == '') {
        if ($topNumb != '') {
            $topNumb = ' top ' . $topNumb . ' ';
        }
        $sql = 'Select ' . $topNumb . '* From ' . $GLOBALS['db_PREFIX'] . $tableName;
    }
    //追加sql
    if ($addSql != '') {
        $sql = getWhereAnd($sql, $addSql);
    }
    $sql = replaceGlobleVariable($sql);
    //替换全局变量
    //检测SQL
    if (checkSql($sql) == false) {
        errorLog('出错提示:<br>action=' . $action . '<hr>sql=' . $sql . '<br>');
        return '';
    }
    $rsObj = $GLOBALS['conn']->query($sql);
    for ($i = 1; $i <= @mysql_num_rows($rsObj); $i++) {
        $rs = mysql_fetch_array($rsObj);
        $startStr = '';
        $endStr = '';
        //call echo(sql,i & "," & nTop)
        if ($i > $nTop) {
            break;
        }
        //#【PHP】$rs=mysql_fetch_array($rsObj);                                            //给PHP用,因为在 asptophp转换不完善
        $isFocus = false;
        //交点为假
        $id = $rs['id'];
        //【导航】
        if ($tableName == 'webcolumn') {
            if ($GLOBALS['isMakeHtml'] == true) {
                $url = getRsUrl($rs['filename'], $rs['customaurl'], '/nav' . $rs['id']);
            } else {
                $url = handleWebUrl('?act=nav&columnName=' . $rs['columnname']);
                //会追加gl等参数
                if ($rs['customaurl'] != '') {
                    $url = $rs['customaurl'];
                    $url = replaceGlobleVariable($url);
                }
            }
            //全局栏目名称为空则为自动定位首页 追加(20160128)
            if ($GLOBALS['glb_columnName'] == '' && $rs['columntype'] == '首页') {
                $GLOBALS['glb_columnName'] = $rs['columnname'];
            }
            if ($rs['columnname'] == $GLOBALS['glb_columnName']) {
                $isFocus = true;
            }
            //【文章】
        } else {
            if ($tableName == 'articledetail') {
                if ($GLOBALS['isMakeHtml'] == true) {
                    $url = getRsUrl($rs['filename'], $rs['customaurl'], 'detail/detail' . $rs['id']);
                } else {
                    $url = handleWebUrl('?act=detail&id=' . $rs['id']);
                    //会追加gl等参数
                    if ($rs['customaurl'] != '') {
                        $url = $rs['customaurl'];
                    }
                }
                //评论
            } else {
                if ($tableName == 'tablecomment') {
                }
            }
        }
        //A链接添加颜色
        $abcolorStr = '';
        if (inStr($fieldNameList, ',titlecolor,') > 0) {
            //A链接颜色
            if ($rs['titlecolor'] != '') {
                $abcolorStr = 'color:' . $rs['titlecolor'] . ';';
            }
        }
        if (inStr($fieldNameList, ',flags,') > 0) {
            //A链接加粗
            if (inStr($rs['flags'], '|b|') > 0) {
                $abcolorStr = $abcolorStr . 'font-weight:bold;';
            }
        }
        if ($abcolorStr != '') {
            $abcolorStr = ' style="' . $abcolorStr . '"';
        }
        //打开方式2016
        if (inStr($fieldNameList, ',target,') > 0) {
            $atargetStr = IIF($rs['target'] != '', ' target="' . $rs['target'] . '"', '');
        }
        //A的title
        if (inStr($fieldNameList, ',title,') > 0) {
            $atitleStr = IIF($rs['title'] != '', ' title="' . $rs['title'] . '"', '');
        }
        //A的nofollow
        if (inStr($fieldNameList, ',nofollow,') > 0) {
            $anofollowStr = IIF($rs['nofollow'] != 0, ' rel="nofollow"', '');
        }
        //交点判断(给栏目导航用的)
        if ($isFocus == true) {
            $startStr = '[list-focus]';
            $endStr = '[/list-focus]';
        } else {
            $startStr = '[list-' . $i . ']';
            $endStr = '[/list-' . $i . ']';
        }
        //在最后时排序当前交点20160202
        if ($i == $topNumb && $isFocus == false) {
            $startStr = '[list-end]';
            $endStr = '[/list-end]';
        }
        //例[list-mod2]  [/list-mod2]    20150112
        for ($modI = 6; $modI >= 2; $modI--) {
            if (inStr($defaultStr, $startStr) == false && $i % $modI == 0) {
                $startStr = '[list-mod' . $modI . ']';
                $endStr = '[/list-mod' . $modI . ']';
                if (inStr($defaultStr, $startStr) > 0) {
                    break;
                }
            }
        }
        //没有则用默认
        if (inStr($defaultStr, $startStr) == false) {
            $startStr = '[list]';
            $endStr = '[/list]';
        }
        if (inStr($defaultStr, $startStr) > 0 && inStr($defaultStr, $endStr) > 0) {
            $s = StrCut($defaultStr, $startStr, $endStr, 2);
            $s = replaceValueParam($s, 'i', $i);
            //循环编号
            $s = replaceValueParam($s, '编号', $i);
            //循环编号
            $s = replaceValueParam($s, 'id', $rs['id']);
            //id编号 因为获得字段他不获得id
            $s = replaceValueParam($s, 'url', $url);
            //网址
            $s = replaceValueParam($s, 'aurl', 'href="' . $url . '"');
            //网址
            $s = replaceValueParam($s, 'abcolor', $abcolorStr);
            //A链接加颜色与加粗
            $s = replaceValueParam($s, 'atitle', $atitleStr);
            //A链接title
            $s = replaceValueParam($s, 'anofollow', $anofollowStr);
            //A链接nofollow
            $s = replaceValueParam($s, 'atarget', $atargetStr);
            //A链接打开方式
            for ($k = 0; $k <= uBound($splFieldName); $k++) {
                if ($splFieldName[$k] != '') {
                    $fieldName = $splFieldName[$k];
                    $replaceStr = $rs[$fieldName] . '';
                    $s = replaceValueParam($s, $fieldName, $replaceStr);
                }
            }
            //开始位置加Dialog内容
            $startStr = '[list-' . $i . ' startdialog]';
            $endStr = '[/list-' . $i . ' startdialog]';
            if (inStr($defaultStr, $startStr) > 0 && inStr($defaultStr, $endStr) > 0) {
                $s = StrCut($defaultStr, $startStr, $endStr, 2) . $s;
            }
            //结束位置加Dialog内容
            $startStr = '[list-' . $i . ' enddialog]';
            $endStr = '[/list-' . $i . ' enddialog]';
            if (inStr($defaultStr, $startStr) > 0 && inStr($defaultStr, $endStr) > 0) {
                $s = $s . StrCut($defaultStr, $startStr, $endStr, 2);
            }
            //加控制
            //【导航】
            if ($tableName == 'webcolumn') {
                $url = WEB_ADMINURL . '?act=addEditHandle&actionType=WebColumn&lableTitle=网站栏目&nPageSize=10&page=&id=' . $rs['id'] . '&n=' . getRnd(11);
                //【评论】
            } else {
                if ($tableName == 'tablecomment') {
                    $idPage = getThisIdPage($GLOBALS['db_PREFIX'] . $tableName, $rs['id'], 10);
                    $url = WEB_ADMINURL . '?act=addEditHandle&actionType=TableComment&lableTitle=评论&nPageSize=10&parentid=&searchfield=bodycontent&keyword=&addsql=&page=' . $idPage . '&id=' . $rs['id'] . '&n=' . getRnd(11);
                    //【文章】
                } else {
                    if ($tableName == 'articledetail') {
                        $idPage = getThisIdPage($GLOBALS['db_PREFIX'] . $tableName, $rs['id'], 10);
                        $url = WEB_ADMINURL . '?act=addEditHandle&actionType=ArticleDetail&lableTitle=分类信息&nPageSize=10&page=' . $idPage . '&parentid=' . $rs['parentid'] . '&id=' . $rs['id'] . '&n=' . getRnd(11);
                        $s = replaceValueParam($s, 'columnurl', getColumnUrl($rs['parentid'], ''));
                        //文章对应栏目URL 20160304
                        $s = replaceValueParam($s, 'columnname', getColumnName($rs['parentid']));
                        //文章对应栏目名称 20160304
                    }
                }
            }
            $s = handleDisplayOnlineEditDialog($url, $s, '', 'div|li|span');
            //处理是否添加在线修改管理器
            $c = $c . $s;
        }
    }
    //开始内容加Dialog内容
    $startStr = '[dialog start]';
    $endStr = '[/dialog start]';
    if (inStr($defaultStr, $startStr) > 0 && inStr($defaultStr, $endStr) > 0) {
        $c = StrCut($defaultStr, $startStr, $endStr, 2) . $c;
    }
    //结束内容加Dialog内容
    $startStr = '[dialog end]';
    $endStr = '[/dialog end]';
    if (inStr($defaultStr, $startStr) > 0 && inStr($defaultStr, $endStr) > 0) {
        $c = $c . StrCut($defaultStr, $startStr, $endStr, 2);
    }
    $XY_AP_GeneralList = $c;
    return @$XY_AP_GeneralList;
}
예제 #21
0
function failRequestWithException($message, $ex)
{
    errorLog("There was an error requesting the report: " . $ex->getMessage());
    failRequest($message . ": " . $ex->getMessage());
}
예제 #22
0
function failWithMessage($msg, $ex)
{
    $_SESSION['message'] = new Message("ERROR", $msg);
    errorLog($msg . ' - ' . $ex->getMessage());
}
예제 #23
0
function getDetailList($action, $content, $actionName, $lableTitle, $fieldNameList, $nPageSize, $nPage, $addSql)
{
    $GLOBALS['conn='] = OpenConn();
    $defaultStr = '';
    $i = '';
    $s = '';
    $c = '';
    $tableName = '';
    $j = '';
    $splxx = '';
    $sql = '';
    $x = '';
    $url = '';
    $nCount = '';
    $pageInfo = '';
    $modI = '';
    $startStr = '';
    $endStr = '';
    $fieldName = '';
    //字段名称
    $splFieldName = '';
    //分割字段
    $replaceStr = '';
    //替换字符
    $tableName = lCase($actionName);
    //表名称
    $listFileName = '';
    //列表文件名称
    $listFileName = RParam($action, 'listFileName');
    $abcolorStr = '';
    //A加粗和颜色
    $atargetStr = '';
    //A链接打开方式
    $atitleStr = '';
    //A链接的title20160407
    $anofollowStr = '';
    //A链接的nofollow
    $id = '';
    $idPage = '';
    $id = rq('id');
    checkIDSQL(@$_REQUEST['id']);
    if ($fieldNameList == '*') {
        $fieldNameList = getHandleFieldList($GLOBALS['db_PREFIX'] . $tableName, '字段列表');
    }
    $fieldNameList = specialStrReplace($fieldNameList);
    //特殊字符处理
    $splFieldName = aspSplit($fieldNameList, ',');
    //字段分割成数组
    $defaultStr = getStrCut($content, '<!--#body start#-->', '<!--#body end#-->', 2);
    $pageInfo = getStrCut($content, '[page]', '[/page]', 1);
    if ($pageInfo != '') {
        $content = replace($content, $pageInfo, '');
    }
    //call eerr("pageInfo",pageInfo)
    $sql = 'select * from ' . $GLOBALS['db_PREFIX'] . $tableName . ' ' . $addSql;
    //检测SQL
    if (checkSql($sql) == false) {
        errorLog('出错提示:<br>sql=' . $sql . '<br>');
        return '';
    }
    $rsObj = $GLOBALS['conn']->query($sql);
    $rs = mysql_fetch_array($rsObj);
    $nCount = @mysql_num_rows($rsObj);
    //为动态翻页网址
    if ($GLOBALS['isMakeHtml'] == true) {
        $url = '';
        if (len($listFileName) > 5) {
            $url = mid($listFileName, 1, len($listFileName) - 5) . '[id].html';
            $url = urlAddHttpUrl($GLOBALS['cfg_webSiteUrl'], $url);
        }
    } else {
        $url = getUrlAddToParam(getUrl(), '?page=[id]', 'replace');
    }
    $content = replace($content, '[$pageInfo$]', webPageControl($nCount, $nPageSize, $nPage, $url, $pageInfo));
    if (EDITORTYPE == 'asp') {
        $x = getRsPageNumber($rs, $nCount, $nPageSize, $nPage);
        //获得Rs页数                                                  '记录总数
    } else {
        if ($nPage != '') {
            $nPage = $nPage - 1;
        }
        $sql = 'select * from ' . $GLOBALS['db_PREFIX'] . '' . $tableName . ' ' . $addSql . ' limit ' . $nPageSize * $nPage . ',' . $nPageSize;
        $rsObj = $GLOBALS['conn']->query($sql);
        $rs = mysql_fetch_array($rsObj);
        $x = @mysql_num_rows($rsObj);
    }
    //call echo("sql",sql)
    for ($i = 1; $i <= $x; $i++) {
        $rs = mysql_fetch_array($rsObj);
        //给PHP用,因为在 asptophp转换不完善
        $startStr = '[list-' . $i . ']';
        $endStr = '[/list-' . $i . ']';
        //在最后时排序当前交点20160202
        if ($i == $x) {
            $startStr = '[list-end]';
            $endStr = '[/list-end]';
        }
        //例[list-mod2]  [/list-mod2]    20150112
        for ($modI = 6; $modI >= 2; $modI--) {
            if (inStr($defaultStr, $startStr) == false && $i % $modI == 0) {
                $startStr = '[list-mod' . $modI . ']';
                $endStr = '[/list-mod' . $modI . ']';
                if (inStr($defaultStr, $startStr) > 0) {
                    break;
                }
            }
        }
        //没有则用默认
        if (inStr($defaultStr, $startStr) == false || $startStr == '') {
            $startStr = '[list]';
            $endStr = '[/list]';
        }
        if (inStr($defaultStr, $startStr) > 0 && inStr($defaultStr, $endStr) > 0) {
            $s = StrCut($defaultStr, $startStr, $endStr, 2);
            //s = defaultStr
            $s = replace($s, '[$id$]', $rs['id']);
            for ($j = 0; $j <= uBound($splFieldName); $j++) {
                if ($splFieldName[$j] != '') {
                    $splxx = aspSplit($splFieldName[$j] . '|||', '|');
                    $fieldName = $splxx[0];
                    $replaceStr = $rs[$fieldName] . '';
                    $s = replaceValueParam($s, $fieldName, $replaceStr);
                }
                if ($GLOBALS['isMakeHtml'] == true) {
                    $url = getHandleRsUrl($rs['filename'], $rs['customaurl'], '/detail/detail' . $rs['id']);
                } else {
                    $url = handleWebUrl('?act=detail&id=' . $rs['id']);
                    if ($rs['customaurl'] != '') {
                        $url = $rs['customaurl'];
                    }
                }
                //A链接添加颜色
                $abcolorStr = '';
                if (inStr($fieldNameList, ',titlecolor,') > 0) {
                    //A链接颜色
                    if ($rs['titlecolor'] != '') {
                        $abcolorStr = 'color:' . $rs['titlecolor'] . ';';
                    }
                }
                if (inStr($fieldNameList, ',flags,') > 0) {
                    //A链接加粗
                    if (inStr($rs['flags'], '|b|') > 0) {
                        $abcolorStr = $abcolorStr . 'font-weight:bold;';
                    }
                }
                if ($abcolorStr != '') {
                    $abcolorStr = ' style="' . $abcolorStr . '"';
                }
                //打开方式2016
                if (inStr($fieldNameList, ',target,') > 0) {
                    $atargetStr = IIF($rs['target'] != '', ' target="' . $rs['target'] . '"', '');
                }
                //A的title
                if (inStr($fieldNameList, ',title,') > 0) {
                    $atitleStr = IIF($rs['title'] != '', ' title="' . $rs['title'] . '"', '');
                }
                //A的nofollow
                if (inStr($fieldNameList, ',nofollow,') > 0) {
                    $anofollowStr = IIF($rs['nofollow'] != 0, ' rel="nofollow"', '');
                }
                $s = replaceValueParam($s, 'url', $url);
                $s = replaceValueParam($s, 'abcolor', $abcolorStr);
                //A链接加颜色与加粗
                $s = replaceValueParam($s, 'atitle', $atitleStr);
                //A链接title
                $s = replaceValueParam($s, 'anofollow', $anofollowStr);
                //A链接nofollow
                $s = replaceValueParam($s, 'atarget', $atargetStr);
                //A链接打开方式
            }
        }
        //call echo("tableName",tableName)
        $idPage = getThisIdPage($GLOBALS['db_PREFIX'] . $tableName, $rs['id'], 10);
        //【留言】
        if ($tableName == 'guestbook') {
            $url = WEB_ADMINURL . '?act=addEditHandle&actionType=GuestBook&lableTitle=留言&nPageSize=10&parentid=&searchfield=bodycontent&keyword=&addsql=&page=' . $idPage . '&id=' . $rs['id'] . '&n=' . getRnd(11);
            //【默认显示文章】
        } else {
            $url = WEB_ADMINURL . '?act=addEditHandle&actionType=ArticleDetail&lableTitle=分类信息&nPageSize=10&page=' . $idPage . '&parentid=' . $rs['parentid'] . '&id=' . $rs['id'] . '&n=' . getRnd(11);
        }
        $s = handleDisplayOnlineEditDialog($url, $s, '', 'div|li|span');
        $c = $c . $s;
    }
    $content = replace($content, '<!--#body start#-->' . $defaultStr . '<!--#body end#-->', $c);
    if ($GLOBALS['isMakeHtml'] == true) {
        $url = '';
        if (len($listFileName) > 5) {
            $url = mid($listFileName, 1, len($listFileName) - 5) . '[id].html';
            $url = urlAddHttpUrl($GLOBALS['cfg_webSiteUrl'], $url);
        }
    } else {
        $url = getUrlAddToParam(getUrl(), '?page=[id]', 'replace');
    }
    $getDetailList = $content;
    return @$getDetailList;
}
function handleError($_errno, $_errstr, $_errfile, $_errline)
{
    if (error_reporting() != 0) {
        errorLog(date("d.m.y H:i") . " ERR# " . $_errno . " " . $_errstr . " " . $_errfile . " IN LINE " . $_errline . "\r");
    }
}
예제 #25
0
<?php

/**
 * Created by PhpStorm.
 * User: tammo
 * Date: 12-4-2016
 * Time: 16:26
 */
// alleen naam van bestand, dus zonder extentie
function leesTxt($textbestand)
{
    $file = fopen("content\\{$textbestand}.txt", "r");
    $text = fread($file, filesize("content\\text.txt"));
    fclose($file);
    return $text;
}
echo leesTxt("text");
function errorLog()
{
    ini_set('display_errors', 1);
    ini_set('log_errors', 1);
    ini_set('error_log', dirname(__FILE__) . '/logs/log.txt');
    error_reporting(E_ALL);
}
errorLog();
require 'asd.php';
예제 #26
0
    $message = $_SESSION['message'];
}
clearAllTemporaryVariables();
$level = getInput("GET", "level", "INT");
//$type = getInput("GET", "type", "INT");
$type = 1;
$groupid = getInput("GET", "groupid", "INT");
$staffid = getInput("GET", "staffid", "INT");
$vid = getInput("GET", "vid", "INT");
$query1 = "SELECT S.`Initials` Initials, S.`User ID` ID FROM TSTAFF S ORDER BY S.`Initials`;";
$query2 = "SELECT * FROM TGROUPS G JOIN TUSERGROUPS UG ON G.`Group ID` = UG.`Group ID` WHERE UG.`User ID` = 2 AND `Type ID` = 3 ORDER BY `Name`";
try {
    $staff = db_select_exception($query1);
    $groups = db_select_exception($query2);
} catch (Exception $ex) {
    errorLog($ex->getMessage());
}
function getInput($method, $name, $type)
{
    if ($method === "GET") {
        $method = INPUT_GET;
    } else {
        if ($method === "POST") {
            $method = INPUT_POST;
        } else {
            return 0;
        }
    }
    if ($type === "STRING") {
        $type = FILTER_SANITIZE_STRING;
    } else {
 /**
  * 功能:上传并保存待刊登的料号
  */
 public function saveWaitProduct()
 {
     set_time_limit(0);
     //print_r($_REQUEST);
     if (empty($_REQUEST['account'])) {
         self::$errCode = '1507';
         self::$errMsg = '请填写需要刊登的账号...';
         return false;
     }
     $tags = explode(',', $_REQUEST['tags']);
     if (count($tags) < 10) {
         self::$errCode = '1508';
         self::$errMsg = '商品关键字的数据少于10个, 请重新输入!!!';
         return false;
     }
     $accountAbbr = C('ACCOUNTABBR')[$_REQUEST['account']];
     $spu = str_ireplace($accountAbbr, '', $_REQUEST['spu']);
     $spu = str_ireplace('#', '', $spu);
     $productInfo = self::getProductBySpu($spu, $_REQUEST['account']);
     if (!empty($productInfo)) {
         self::updateWaitData($spu, $_REQUEST['account']);
         //将上传状态更改已上传
         self::$errCode = '1509';
         self::$errMsg = '此料号已经刊登,请不要重复刊登!';
         return false;
     }
     $wishProductApi = new WishProductApi($_REQUEST['account'], 1);
     //$wishProductApi->setSandbox();		//设置从沙盒刊登
     $productAct = new WishProductAct();
     $extraImage = $productAct->imageReplace($_REQUEST['extra_images']);
     $spuImage = isset($_REQUEST['skuImg']) ? current($_REQUEST['skuImg']) : $_REQUEST['main_image'];
     $mainImage = $productAct->imageReplace($spuImage);
     $spuData = array('name' => $_REQUEST['title'], 'description' => $_REQUEST['description'], 'tags' => $_REQUEST['tags'], 'sku' => $_REQUEST['sku'][0], 'color' => $_REQUEST['color'][0], 'size' => $_REQUEST['size'][0], 'inventory' => $_REQUEST['inventory'][0], 'price' => $_REQUEST['price'][0], 'shipping' => $_REQUEST['shipping'][0], 'msrp' => $_REQUEST['msrp'][0], 'shipping_time' => $_REQUEST['shipping_time'][0], 'main_image' => end($mainImage), 'parent_sku' => count($_REQUEST['sku']) > 1 ? $_REQUEST['spu'] : $_REQUEST['sku'][0], 'extra_images' => implode('|', $extraImage));
     $skuData = array();
     if (count($_REQUEST['sku']) > 1) {
         foreach ($_REQUEST['sku'] as $skuKey => $skuVal) {
             if ($skuKey === 0) {
                 continue;
             }
             $mainImage = $productAct->imageReplace($_REQUEST['skuImg'][$skuKey]);
             $skuData[] = array('parent_sku' => $_REQUEST['spu'], 'sku' => $_REQUEST['sku'][$skuKey], 'color' => $_REQUEST['color'][$skuKey], 'size' => $_REQUEST['size'][$skuKey], 'inventory' => $_REQUEST['inventory'][$skuKey], 'price' => $_REQUEST['price'][$skuKey], 'shipping' => $_REQUEST['shipping'][$skuKey], 'msrp' => $_REQUEST['msrp'][$skuKey], 'shipping_time' => $_REQUEST['shipping_time'][$skuKey], 'main_image' => end($mainImage));
         }
     }
     //		print_r($spuData);
     //		print_r($skuData);exit;
     $spuStatus = $wishProductApi->createProductSpu($spuData);
     errorLog($_REQUEST['spu'] . ':' . json_encode($spuStatus), 'uploadStatus', 'uploadProduct');
     if (!empty($spuStatus)) {
         //上传成功,已经返回了数据
         self::updateWaitData($_REQUEST['spu'], $_REQUEST['account']);
     }
     if (!empty($skuData)) {
         foreach ($skuData as $skuKey => $skuVal) {
             $skuStatus = $wishProductApi->createProductSku($skuVal);
             errorLog($_REQUEST['spu'] . ':' . json_encode($skuStatus), 'uploadStatus', 'uploadProduct');
         }
     }
     return $spuStatus;
 }
예제 #28
0
function executeSQL()
{
    $sqlvalue = '';
    $sqlvalue = 'delete from ' . $GLOBALS['db_PREFIX'] . 'WebSiteStat';
    if (@$_REQUEST['sqlvalue'] != '') {
        $sqlvalue = @$_REQUEST['sqlvalue'];
        $GLOBALS['conn='] = OpenConn();
        //检测SQL
        if (checkSql($sqlvalue) == false) {
            errorLog('出错提示:<br>sql=' . $sqlvalue . '<br>');
            return '';
        }
        aspEcho('执行SQL语句成功', $sqlvalue);
    }
    if (@$_SESSION['adminusername'] == 'ASPPHPCMS') {
        Rw('<form id="form1" name="form1" method="post" action="?act=executeSQL"  onSubmit="if(confirm(\'你确定要操作吗?\\n操作后将不可恢复\')){return true}else{return false}">SQL<input name="sqlvalue" type="text" id="sqlvalue" value="' . $sqlvalue . '" size="80%" /><input type="submit" name="button" id="button" value="执行" /></form>');
    } else {
        Rw('你没有权限执行SQL语句');
    }
}
function invokeGetFeedSubmissionResult(MarketplaceWebService_Interface $service, $request)
{
    try {
        $response = $service->getFeedSubmissionResult($request);
        $response = $service->getFeedSubmissionResult($request);
        //file_put_contents('d:/amazon_result.txt',$response);
        //echo ("Service Response\n");
        //echo ("=============================================================================\n");
        //echo("        GetFeedSubmissionResultResponse\n");
        if ($response->isSetGetFeedSubmissionResultResult()) {
            $getFeedSubmissionResultResult = $response->getGetFeedSubmissionResultResult();
            //file_put_contents($path.'fffff.txt',$getFeedSubmissionResultResult);
            //echo ("            GetFeedSubmissionResult");
            if ($getFeedSubmissionResultResult->isSetContentMd5()) {
                //echo ("                ContentMd5");
                //echo ("                " . $getFeedSubmissionResultResult->getContentMd5() . "\n");
            }
        }
        if ($response->isSetResponseMetadata()) {
            //echo("            ResponseMetadata\n");
            $responseMetadata = $response->getResponseMetadata();
            if ($responseMetadata->isSetRequestId()) {
                //echo("                RequestId\n");
                //echo("                    " . $responseMetadata->getRequestId() . "\n");
            }
        }
        //echo("            ResponseHeaderMetadata: " . $response->getResponseHeaderMetadata() . "\n");
    } catch (MarketplaceWebService_Exception $ex) {
        $str = "Caught Exception: " . $ex->getMessage() . "\r\n" . "Response Status Code: " . $ex->getStatusCode() . "\r\n" . "Error Code: " . $ex->getErrorCode() . "\r\n" . "Error Type: " . $ex->getErrorType() . "\r\n" . "Request ID: " . $ex->getRequestId() . "\r\n" . "XML: " . $ex->getXML() . "\r\n" . "ResponseHeaderMetadata: " . $ex->getResponseHeaderMetadata() . "\r\n";
        errorLog($str, 'N');
        /*
        		echo("Caught Exception: " . $ex->getMessage() . "\n");
        		echo("Response Status Code: " . $ex->getStatusCode() . "\n");
        		echo("Error Code: " . $ex->getErrorCode() . "\n");
        		echo("Error Type: " . $ex->getErrorType() . "\n");
        		echo("Request ID: " . $ex->getRequestId() . "\n");
        		echo("XML: " . $ex->getXML() . "\n");
        		echo("ResponseHeaderMetadata: " . $ex->getResponseHeaderMetadata() . "\n");*/
    }
}
예제 #30
0
파일: DB.php 프로젝트: akitech/hooks-src
 public function commit()
 {
     if ($this->getInstance()->inTransaction()) {
         if (!$this->getInstance()->commit()) {
             $this->rollback();
             errorLog("DB Transaction Failed. Event Rolled Back.", 2);
         }
     }
     return true;
 }