Subversion Repositories qbpwcf-lib(archive)

Rev

Rev 891 | Rev 911 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php

/*

        QBPWCF, Quick Build PHP website Component base on Fedora Linux.
    Copyright (C) 2015~2024 Min-Jhin,Chen

    This file is part of QBPWCF.

    QBPWCF is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    QBPWCF is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with QBPWCF.  If not, see <http://www.gnu.org/licenses/>.

*/
namespace qbpwcf;

/*
類別說明:
Line相關應用的類別.
備註:
無.
*/
class line{

        /*
        #函式說明:
        #當前類別被呼叫的靜態方法不存在時,將會執行該函數,回報該方法不存在.
        #回傳結果:
        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
        #$reuslt["error"],執行不正常結束的錯訊息陣列.
        #$result["function"],當前執行的函式名稱.
        #必填參數:
        #$method,物件,為物件實體或類別名稱,會自動置入該參數.
        #$arguments,陣列,為呼叫方法時所用的參數.
        #參考資料:
        #__call=>http://php.net/manual/en/language.oop5.overloading.php#object.callstatic
        */
        public function __call($method,$arguments){
                
                #取得當前執行的函式
                $result["function"]=__FUNCTION__;
                
                #設置執行不正常
                $result["status"]="false";
                
                #設置執行錯誤
                $result["error"][]=__NAMESPACE__ ."/".$method."() 不存在!";
                
                #設置所丟入的參數
                $result["error"][]=$arguments;
                
                #回傳結果
                return $result;
                
                }#function __call end
                
        /*
        #函式說明:
        #當前類別被呼叫的靜態方法不存在時,將會執行該函數,回報該方法不存在.
        #回傳結果:
        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
        #$reuslt["error"],執行不正常結束的錯訊息陣列.
        #$result["function"],當前執行的函式名稱.
        #必填參數:
        #$method,物件,為物件實體或類別名稱,會自動置入該參數.
        #$arguments,陣列,為呼叫方法時所用的參數.
        #參考資料:
        #__call=>http://php.net/manual/en/language.oop5.overloading.php#object.callstatic
        */
        public static function __callStatic($method,$arguments){
                
                #取得當前執行的函式
                $result["function"]=__FUNCTION__;
                
                #設置執行不正常
                $result["status"]="false";
                
                #設置執行錯誤
                $result["error"][]="欲呼叫的". __NAMESPACE__ ."/".$method."() 不存在!";
                
                #設置所丟入的參數
                $result["error"][]=$arguments;
                
                #回傳結果
                return $result;
                
                }#function __callStatic end
        
        /*
        #函式說明:
        #post message to line timeline
        #回傳結果:
        #$result["status"],執行正常與否,"true"代表正常,"false"代表不正常.
        #$result["error"],錯誤訊息陣列.
        #$resutl["function"],當前執行的涵式名稱.
        #$result["content"],語法.
        #必填參數:
        #無.
        #可省略參數:
        #$conf["url"],字串,要分享的url,預設為當前頁面.
        #$conf["url"]="";
        #參考資料來源:
        #https://github.com/kom3/LineTimeline
        #備註:
        #無.
        */
        public static function p2tl($conf){

                #初始化要回傳的結果
                $result=array();

                #取得當前執行的函數名稱
                $result["function"]=__FUNCTION__;

                #取得參數
                $result["argu"]=$conf;

                #如果 $conf 不為陣列
                if(gettype($conf)!="array"){

                        #設置執行失敗
                        $result["status"]="false";

                        #設置執行錯誤訊息
                        $result["error"][]="\$conf變數須為陣列形態";

                        #如果傳入的參數為 null
                        if($conf==null){

                                #設置執行錯誤訊息
                                $result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";

                                }#if end

                        #回傳結果
                        return $result;

                        }#if end

                #取得當前網址
                #函式說明:
                #取得用戶端的資訊,並依據需要寫入到資料表裡面
                #回傳結果:
                #$result["status"],執行是否正常,"true"代表執行成功,"false"代表執行失敗.
                #$result["error"],錯誤訊息.
                #$result["function"],檔前執行的函數名稱.
                #$result["mode"],當前的模式是"cmd"還是"web".
                #$result["userBrowserType"],爲使用者的瀏覽器資訊
                #$result["userIp"],爲使用者的IP
                #$result["serverIp"],為伺服器的IP
                #$result["scheme"],通訊協定
                #$result["serverPort"],伺服器給對外下載網頁的port
                #$result["requestUri"],爲使用者要求的網址
                #$result["clientRequestIP"],用戶端要求的ip與port
                #$result["username"],爲使用者目前的帳戶,若爲""則表示尚未登入成功
                #$result["phpUser"],運行該php的使用者帳戶.
                #必填參數:
                $conf["csInformation::getConnectionInfo"]["getAccount"]="false";#是否要取得帳號
                #可省略參數:
                #$conf["accountVar"]=$_SESSION["username"];#帳號儲存在哪個變數裏面,預設爲$_SESSION["username"]
                #$conf["saveToDb"]="true";#是否要除儲存到資料庫,"true"為要儲存",預設為不儲存
                #$conf["dbAddress"]=$dbAddress;;#爲mysql-Server的位置,若#$conf["saveToDb"]設為"true",則該參數為必填。
                #$conf["dbAccount"]=$dbAccount;#爲用於連入mysql-Server時要使用的帳號,若#$conf["saveToDb"]設為"true",則該參數為必填。
                #$conf["dbName"]=$dbName;#要選取的資料庫名稱,若#$conf["saveToDb"]設為"true",則該參數為必填。
                #$conf["tableName"]="visitorInfo";#爲要插入資料的資料表名稱,若#$conf["saveToDb"]設為"true",則該參數為必填。
                #$conf["columnName"]=array("username","userWebBrowser","userIp","requestUri","systemDateAndTime");#爲資料表的項目名稱,
                        #例如:$conf["columnName"]=array("columnName1","columnName2","columnName3",...);
                        #寫入的資料依序為,使用者帳戶、瀏覽器資訊、使用者IP、觀看的網址、當時的時間
                        #$conf["saveToDb"]設為"true",則該參數為必填。
                #$conf["dbPassword"]=$dbPassword;#爲連線到mysql-Server時要使用的密碼,可省略,若省略則代表不使用密碼
                #參考資料:
                #$_SERVER=>http://php.net/manual/zh/reserved.variables.server.php
                #取得伺服器名稱與IP=>http://php.net/manual/en/function.gethostname.php
                $getConnectionInfo=csInformation::getConnectionInfo($conf["csInformation::getConnectionInfo"]);
                unset($conf["csInformation::getConnectionInfo"]);

                #如果運行失敗
                if($getConnectionInfo["status"]==="false"){

                        #設置執行失敗
                        $result["status"]="false";

                        #設置錯誤訊息
                        $result["error"]=$getConnectionInfo;

                        #回傳結果
                        return $result;

                        }#if end

                #函式說明:
                #檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                #$reuslt["error"],執行不正常結束的錯訊息陣列.
                #$result["function"],當前執行的函式名稱.
                #$result["argu"],設置給予的參數.
                #$result["passed"],識別要檢查的全體變數是否存在以及型態是否正確的變數,"true"代表檢查全部通過;"false"代表檢查不通過
                #$result[$shouldBeCheckedVarName]["varExist"],所檢查的變數是否存在,"false"代表不存在;"true"代表存在
                #$result[$shouldBeCheckedVarName]["varType"],所檢查的變數型態是否正確,"false"代表錯誤;"true"代表正確
                #$result[$shouldBeCheckedVarName]["error"],每個參數設定的錯誤訊息
                #$result["shouldNotBeEmpty"],不應該為空字串或控陣列的變數.
                #$result["argu"],字串陣列,目前輸入的參數名稱陣列.
                #$result["legalVarName"],字串陣列,合法可用的參數名稱陣列.
                #$result["notNeedVar"],字串陣列,多餘的參數名稱.
                #必填寫的參數:
                #$conf["varInput"],陣列變數,要檢查的陣列變數,請在要檢查的參數前面加上&,這樣變動的結果才能被套用。
                $conf["variableCheck::checkArguments"]["varInput"]=&$conf;
                #$conf["referenceVarKey"],字串,$conf參數後面的key值,用於移除不要的參考陣列.
                $conf["variableCheck::checkArguments"]["referenceVarKey"]="variableCheck::checkArguments";
                #可以省略的參數:
                #$conf["mustBeFilledVariableName"],爲必填參數的變數名稱陣列,形態爲陣列變數,元素數量需要跟"mustBeFilledVariableType"參數的元素數量一致,例如: $conf["mustBeFilledVariableName"] = array("id","account","password");
                #$conf["mustBeFilledVariableName"]=array();
                #$conf["mustBeFilledVariableType"],爲必填參數的變數陣列應該爲何種變數形態,形態爲陣列,元素數量需要跟"mustBeFilledVariableName"參數的元素數量一致,例如: $conf["mustBeFilledVariableType"] = array("string",integer,"double","resource","object"); , null代表不指定變數形態.
                #$conf["mustBeFilledVariableType"]=array();
                #$conf["canBeEmptyString"],字串,必填變數內容如果是空字串就不能算是有設置的話,請設為"false",預設爲"true",可以為空字串.
                #$conf["canBeEmptyString"]="false";
                #$conf["canNotBeEmpty"],字串陣列,哪些必填參數的內容不得為空字串或空陣列,僅當$conf["canBeEmptyString"]為"true"時會生效.
                #$conf["canNotBeEmpty"]=array();
                #$conf["canBeEmpty"],字串陣列,哪些必填參數的內容可為空字串或空陣列,僅當$conf["canBeEmptyString"]為"false"時會生效.
                #$conf["canBeEmpty"]=array();
                #$conf["skipableVariableCanNotBeEmpty"],字串陣列,哪些可省略參數不可以為空字串或空陣列.
                #$conf["skipableVariableCanNotBeEmpty"]=array();
                #$conf["skipableVariableName"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
                $conf["variableCheck::checkArguments"]["skipableVariableName"]=array("url");
                #$conf["skipableVariableType"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double");
                $conf["variableCheck::checkArguments"]["skipableVariableType"]=array("url");
                #$conf["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,null與代表不指定,若預設值是參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
                $conf["variableCheck::checkArguments"]["skipableVarDefaultValue"]=array($getConnectionInfo["scheme"]."://".$getConnectionInfo["server_name"].$getConnectionInfo["requestUri"]);
                #$conf["disallowAllSkipableVarIsEmpty"],字串,是否允許每個可省略參數都為空字串,預設為"true"允許,反之為"false".
                #$conf["disallowAllSkipableVarIsEmpty"]="";
                #$conf["disallowAllSkipableVarIsEmptyArray"],字串,是否允許每個可省略參數都為空陣列,預設為"true"允許,反之為"false".
                #$conf["disallowAllSkipableVarIsEmptyArray"]="requestUri";
                #$conf["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
                #$conf["arrayCountEqualCheck"][]=array();
                #參考資料來源:
                #array_keys=>http://php.net/manual/en/function.array-keys.php
                $checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
                unset($conf["variableCheck::checkArguments"]);

                #如果運行失敗
                if($checkArguments["status"]==="false"){

                        #設置執行失敗
                        $result["status"]="false";

                        #設置錯誤訊息
                        $result["error"]=$checkArguments;

                        #回傳結果
                        return $result;

                        }#if end

                #反之檢查不通過
                if($checkArguments["passed"]==="false"){

                        #設置執行失敗
                        $result["status"]="false";

                        #設置錯誤訊息
                        $result["error"]=$checkArguments;

                        #回傳結果
                        return $result;

                        }#if end

                #設置建立 line 分享的語法
                $result["content"]="<div class=\"line-it-button\" style=\"display: none;\" data-lang=\"en\" data-type=\"share-a\" data-ver=\"2\" data-url=\"".$conf["url"]."\"></div>
 <script src=\"https://d.line-scdn.net/r/web/social-plugin/js/thirdparty/loader.min.js\" async=\"async\" defer=\"defer\"></script>";

                #函式說明:
                #將要執行的script語法透過該函式執行(會在程式外層用<script></script>包起來).
                #回傳結果:
                #$result["status"],執行是否正常,"true"為正常,"false"為不正常.
                #$result["error"],錯誤訊息陣列
                #$result["function"],當前執行的函數名稱
                #$result["content"],要執行的javaScript語法
                #必填參數:
                #$conf["script"],字串,要執行的javaScript語法.
                $conf["javaScript::toScript"]["script"]=
                "
                //設置1秒後才運行的函式
                setTimeout(function(){

                        //取得 line frame
                        //lb=document.getElementsByClassName('line-it-button');

                        //取得分享界面的url
                        //sharePanelUrl=lb[0].src;

                        //re set url
                        sharePanelUrl='https://timeline.line.me/';

                        //移除既有的line iframe button
                        //lb[0].remove();

                        //如果沒有既有的windows.p2tl變數
                        if(window.p2tl===undefined){

                                //初始化 window.p2tl
                                window.p2tl=[];

                                }//if end

                        //set index before append
                        indexBeforeAppend=window.p2tl.length;

                        //設置要開啟的line panel url與對應的函式
                        window.p2tl[indexBeforeAppend]={

                                //set line timeline url
                                sharePanelUrl:sharePanelUrl,

                                //function request permission
                                requestPermission:function(){

                                        //function requestPermission
                                        function requestPermissions(){

                                                //permission list
                                                permissionsToRequest = {

                                                        permissions: ['activeTab'],

                                                        origins: [sharePanelUrl]

                                                        }

                                                //function onResponse
                                                function onResponse(response){

                                                        //當使用者有回應是否允許權限時
                                                        if(response){

                                                                //debug
                                                                console.log('Permission was granted');

                                                                }//if end

                                                        //當使用者沒有
                                                        else{

                                                                //debug
                                                                console.log('Permission was refused');

                                                                }//else end

                                                        //回傳取得的權限狀態
                                                        return browser.permissions.getAll();

                                                        }//function onResponse end

                                                //如果權限變數不存在
                                                if(window.browser === undefined){

                                                        //debug
                                                        console.log('variable browser not existed!');

                                                        //回傳 false
                                                        return false;

                                                        }//if end

                                                //要求取得權限
                                                browser.permissions.request(permissionsToRequest)
                                                .then(onResponse)
                                                .then((currentPermissions) => {

                                                        console.log(`Current permissions:`, currentPermissions);

                                                        });

                                                }//function request permission

                                        //執行取得權限
                                        requestPermissions();

                                        }//function request permission end
                                        ,

                                //open function
                                open:function(){

                                        //get line share panel url
                                        sharePanelUrl=window.p2tl[indexBeforeAppend].sharePanelUrl;

                                        //set currnet window name
                                        //window,name='current';

                                        //set origin
                                        //window.origin='https://social-plugins.line.me';

                                        //open url in tab
                                        lineTab=window.open(sharePanelUrl,'lineTab');

                                        }//funtion open end

                                }//設置要開啟的line panel url與對應的函式

                        //unset indexBeforeBeforeAppend
                        indexBeforeBeforeAppend=undefined;

                        //set indexBeforeAfterAppend
                        indexBeforeAfterAppend=window.p2tl.length;

                        //取得 activeTab 權限
                        window.p2tl[indexBeforeAfterAppend-1].requestPermission.call(this);

                        //open function
                        window.p2tl[indexBeforeAfterAppend-1].open.call(this);

                        //setTimeout end, wait for 1 sec.
                        },1000);
                ";
                #可省略參數:
                #$conf["onReady"],字串,是否要在網頁完全載入後再執行,"false"為不等載入完就先執行,預設為"true"要等載入完再執行.
                #$conf["onReady"]="true";
                #$conf["globalJs"],字串陣列,為要放入<script>標籤的js全域變數.
                #$conf["globalJs"]=array();
                #$conf["jsFunciton"],字串陣列,為要放入<script>標籤的js函數.
                #$conf["jsFunciton"]=array();
                #參考資料:
                #http://stackoverflow.com/questions/9899372/pure-javascript-equivalent-to-jquerys-ready-how-to-call-a-function-when-the
                $toScript=javaScript::toScript($conf["javaScript::toScript"]);
                unset($conf["javaScript::toScript"]);

                #如果建立 script 失敗
                if($toScript["status"]==="false"){

                        #設置執行失敗
                        $result["status"]="false";

                        #設置錯誤訊息
                        $result["error"]=$toScript;

                        #回傳結果
                        return $result;

                        }#if end

                #串接內容
                $result["content"]=$result["content"].$toScript["content"];

                #設置執行正常
                $result["status"]="true";

                #回傳結果
                return $result;

                }#function p2tl end
                
        /*
        #函式說明:
        #提供Line Login的服務.
        #回傳結果:
        #$result["status"],執行正常與否,"true"代表正常,"false"代表不正常.
        #$result["error"],錯誤訊息陣列.
        #$resutl["function"],當前執行的涵式名稱.
        #$result["content"],code.
        #必填參數:
        #$conf["url"],字串,auth後要轉到的url,亦即當前頁面的網址.
        $conf["url"]="";
        #$conf["channelId"],字串,channelID.
        $conf["channelId"]="";
        #$conf["fileArgu"],字串,變數__FILE__的內容.
        $conf["fileArgu"]=__FILE__;
        #可省略參數:
        #無.
        #參考資料來源:
        #https://developers.line.biz/zh-hant/docs/line-login/integrate-line-login/#making-an-authorization-request
        #備註:
        #無.
        */
        public static function login(&$conf){
        
                #初始化要回傳的結果
                $result=array();

                #取得當前執行的函數名稱
                $result["function"]=__FUNCTION__;

                #取得參數
                $result["argu"]=$conf;

                #如果 $conf 不為陣列
                if(gettype($conf)!="array"){

                        #設置執行失敗
                        $result["status"]="false";

                        #設置執行錯誤訊息
                        $result["error"][]="\$conf變數須為陣列形態";

                        #如果傳入的參數為 null
                        if($conf==null){

                                #設置執行錯誤訊息
                                $result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";

                                }#if end

                        #回傳結果
                        return $result;

                        }#if end
                        
                #函式說明:
                #檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                #$reuslt["error"],執行不正常結束的錯訊息陣列.
                #$result["function"],當前執行的函式名稱.
                #$result["argu"],設置給予的參數.
                #$result["passed"],識別要檢查的全體變數是否存在以及型態是否正確的變數,"true"代表檢查全部通過;"false"代表檢查不通過
                #$result[$shouldBeCheckedVarName]["varExist"],所檢查的變數是否存在,"false"代表不存在;"true"代表存在
                #$result[$shouldBeCheckedVarName]["varType"],所檢查的變數型態是否正確,"false"代表錯誤;"true"代表正確
                #$result[$shouldBeCheckedVarName]["error"],每個參數設定的錯誤訊息
                #$result["shouldNotBeEmpty"],不應該為空字串或控陣列的變數.
                #$result["argu"],字串陣列,目前輸入的參數名稱陣列.
                #$result["legalVarName"],字串陣列,合法可用的參數名稱陣列.
                #$result["notNeedVar"],字串陣列,多餘的參數名稱.
                #必填寫的參數:
                #$conf["varInput"],陣列變數,要檢查的陣列變數,請在要檢查的參數前面加上&,這樣變動的結果才能被套用。
                $conf["variableCheck::checkArguments"]["varInput"]=&$conf;
                #$conf["referenceVarKey"],字串,$conf參數後面的key值,用於移除不要的參考陣列.
                $conf["variableCheck::checkArguments"]["referenceVarKey"]="variableCheck::checkArguments";
                #可以省略的參數:
                #$conf["mustBeFilledVariableName"],爲必填參數的變數名稱陣列,形態爲陣列變數,元素數量需要跟"mustBeFilledVariableType"參數的元素數量一致,例如: $conf["mustBeFilledVariableName"] = array("id","account","password");
                $conf["variableCheck::checkArguments"]["mustBeFilledVariableName"]=array("url","channelId","fileArgu");
                #$conf["mustBeFilledVariableType"],爲必填參數的變數陣列應該爲何種變數形態,形態爲陣列,元素數量需要跟"mustBeFilledVariableName"參數的元素數量一致,例如: $conf["mustBeFilledVariableType"] = array("string",integer,"double","resource","object"); , null代表不指定變數形態.
                $conf["variableCheck::checkArguments"]["mustBeFilledVariableType"]=array("string","string","string");
                #$conf["canBeEmptyString"],字串,必填變數內容如果是空字串就不能算是有設置的話,請設為"false",預設爲"true",可以為空字串.
                #$conf["canBeEmptyString"]="false";
                #$conf["canNotBeEmpty"],字串陣列,哪些必填參數的內容不得為空字串或空陣列,僅當$conf["canBeEmptyString"]為"true"時會生效.
                #$conf["canNotBeEmpty"]=array();
                #$conf["canBeEmpty"],字串陣列,哪些必填參數的內容可為空字串或空陣列,僅當$conf["canBeEmptyString"]為"false"時會生效.
                #$conf["canBeEmpty"]=array();
                #$conf["skipableVariableCanNotBeEmpty"],字串陣列,哪些可省略參數不可以為空字串或空陣列.
                #$conf["skipableVariableCanNotBeEmpty"]=array();
                #$conf["skipableVariableName"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
                #$conf["variableCheck::checkArguments"]["skipableVariableName"]=array("url");
                #$conf["skipableVariableType"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double");
                #$conf["variableCheck::checkArguments"]["skipableVariableType"]=array("url");
                #$conf["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,null與代表不指定,若預設值是參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
                #$conf["variableCheck::checkArguments"]["skipableVarDefaultValue"]=array($getConnectionInfo["scheme"]."://".$getConnectionInfo["server_name"].$getConnectionInfo["requestUri"]);
                #$conf["disallowAllSkipableVarIsEmpty"],字串,是否允許每個可省略參數都為空字串,預設為"true"允許,反之為"false".
                #$conf["disallowAllSkipableVarIsEmpty"]="";
                #$conf["disallowAllSkipableVarIsEmptyArray"],字串,是否允許每個可省略參數都為空陣列,預設為"true"允許,反之為"false".
                #$conf["disallowAllSkipableVarIsEmptyArray"]="requestUri";
                #$conf["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
                #$conf["arrayCountEqualCheck"][]=array();
                #參考資料來源:
                #array_keys=>http://php.net/manual/en/function.array-keys.php
                $checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
                unset($conf["variableCheck::checkArguments"]);

                #如果運行失敗
                if($checkArguments["status"]==="false"){

                        #設置執行失敗
                        $result["status"]="false";

                        #設置錯誤訊息
                        $result["error"]=$checkArguments;

                        #回傳結果
                        return $result;

                        }#if end

                #反之檢查不通過
                if($checkArguments["passed"]==="false"){

                        #設置執行失敗
                        $result["status"]="false";

                        #設置錯誤訊息
                        $result["error"]=$checkArguments;

                        #回傳結果
                        return $result;

                        }#if end
        
                #函式說明:
                #可以處理多個透過GET、POST而來的資訊,儲存成變數,同時限定傳送的方法、來源,來增加安全性,檢查有沒有皆收到必須要接收到的變數,沒有接收到的變數可以指定從session變數中取得.
                #回傳結果:
                #$result["status"],執行正常與否,"true"代表正常,"false"代表不正常.
                #$result["error"],錯誤訊息陣列.
                #$resutl["function"],當前執行的涵式名稱.
                #$result["warning"],警告訊息陣列.
                #$result["passed"],是否有皆收到全部該接收到的變數,若有設定$conf["checkedVarName"]的話,執行正常後會回傳該結果。
                #$result["lostVarName"],沒有皆收到的變數名稱陣列
                #$result["inputDataContent"],所接收的參數陣列.
                #$result["inputDataContent"]["變數名稱"],所接收變數的內容.
                #$result["inputDataCount"],從表單總共接收到幾個元素.
                #$result["HTTP_REFERER"],前一頁的網址,null代表不存在.
                #必填的參數:
                #$conf["method"],字串,傳送過來的資料是用"post/POST"還是"get/GET"?
                $conf["form::responseMultiInputDataSecurityEnhance"]["method"]="GET";
                #可省略參數:
                #$conf["allowGet"],字串,是否要允許 get 傳值,"true",代表允許;"false" ,代表不允許,預設爲不允許.
                $conf["form::responseMultiInputDataSecurityEnhance"]["allowGet"]="true";
                #$conf["limitPrePage"],字串陣列,是否要限定前一頁的網址為哪些,才能接收內容,不符合則轉址.
                #$conf["limitPrePage"]=array("");
                #$conf["transferLocation"],字串,遇到get傳值,或前一個頁面不符合要求時要轉址到的頁面,預設爲資安素養網"https://isafe.moe.edu.tw/"
                #$conf["transferLocation"]="";
                #$conf["ignore"]=字串陣列,如果要接收的變數名稱與該陣列其一元素一樣,則不放進要回傳的變數裏面.
                #$conf["ignore"]=array();
                #$conf["correctCharacter"]=,字串,如果爲"false",則不處理可能導致網頁出問題的字串,預設爲要進行處理.
                $conf["form::responseMultiInputDataSecurityEnhance"]["correctCharacter"]="false";
                #$conf["checkedVarName"],字串陣列,為檢查是否有接收到哪些變數.
                $conf["form::responseMultiInputDataSecurityEnhance"]["checkedVarName"]=array("code","state");
                #$conf["canBeEmptyString"],字串,用$conf["checkedVarName"]指定接收的變數名稱陣列,若接收到的內容為空字串是否算有接收到內容,預設為"false","true"代表接收到的內容可以為空字串,"false"代表接收到的內容不可以為空字串.
                $conf["form::responseMultiInputDataSecurityEnhance"]["canBeEmptyString"]="false";
                #$conf["sessionNameArray"],陣列,若存在則代表若沒有從表單取得變數,則從session變數中取得內容,每個元素代表每個表單變數對應的session名稱,若不是要改用session方式取得變數內容的變數,請輸入null,數量請跟$conf["checkedVarName"]參數一致.
                #$conf["sessionNameArray"]=array();
                #$conf["unsetSessionArray"],陣列,與$conf["sessionNameArray"]對應的元素,是否要接收到變數後就卸除,"true"代表要卸除,"false"代表不要卸除.
                #$conf["unsetSessionArray"]=array();
                #$conf["recaptcha_url"],字串,有內容代表要檢查有無透過recaptcha於特定頁面網址認證過.
                #$conf["recaptcha_url"]="";
                #參考資料來源:
                #foreach 的用法 -> http://php.net/manual/en/control-structures.foreach.php
                #伺服器端的變數 -> http://php.net/manual/en/reserved.variables.server.php
                #備註:
                #表單變數的名稱若含有「.」,則會變成「-」。
                $responseMultiInputDataSecurityEnhance=form::responseMultiInputDataSecurityEnhance($conf["form::responseMultiInputDataSecurityEnhance"]);
                unset($conf["form::responseMultiInputDataSecurityEnhance"]);
        
                #如果執行失敗
                if($responseMultiInputDataSecurityEnhance["status"]==="false"){
                
                        #設置執行不正常
                        $result["status"]="false";

                        #設置執行錯誤
                        $result["error"]=$responseMultiInputDataSecurityEnhance;

                        #回傳結果
                        return $result;
                        
                        }#if end
                        
                #如果表單變數不合法
                if($responseMultiInputDataSecurityEnhance["passed"]==="false"){
                
                        #建立 $meetingID
                        #函式說明:
                        #呼叫shell執行系統命令,並取得回傳的內容.
                        #回傳的結果:
                        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                        #$result["error"],錯誤訊息陣列.
                        #$result["function"],當前執行的函數名稱.
                        #$result["argu"],使用的參數.
                        #$result["cmd"],執行的指令內容.
                        #$result["fullCmd"],如果參數 $conf["inBackGround"] 為 "true" 則會回傳該值.
                        #$result["output"],爲執行完二元碼後的輸出陣列,若 $conf["inBackGround"] 為 "true",則為當下的輸出.
                        #$result["tmpFileOutput"],儲存輸出的暫存檔案名稱,若 $conf["inBackGround"] 為 "true" 則會回傳該值.
                        #$result["running"],是否還在執行.
                        #$result["pid"],pid.
                        #$result["statusCode"],執行結束後的代碼.
                        #必填的參數
                        #$conf["command"],字串,要執行的指令與.
                        $conf["external::callShell"]["command"]="uuid";
                        #$conf["fileArgu"],字串,變數__FILE__的內容.
                        $conf["external::callShell"]["fileArgu"]=$conf["fileArgu"];
                        #可省略參數:
                        #$conf["argu"],陣列字串,指令搭配的參數,預設為空陣列.
                        #$conf["argu"]=array("");
                        #$conf["arguIsAddr"],陣列字串,指令搭配的哪些參數為路徑,為路徑的參數會進行轉換以便符合呼叫當前函數的位置,預設不指定,若有3個參數,其中第3個參數為路徑,則表示為array("false","false","true").
                        #$conf["arguIsAddr"]=array();
                        #$conf["pre"],陣列,要在本指令前執行的每個指令與參數.
                        #$conf["pre"][$i]["cmd"],字串,要在本指令前執行的第$i+1個指令.
                        #$conf["pre"][$i]["param"],陣列字串,要在本指令前執行的第$i+1個指令的參數.
                        #$conf["enablePrintDescription"],字串,是否要印出$conf["printDescription"]的內容,"true"代表要,"false"代表不要,預設為"false".
                        #$conf["enablePrintDescription"]="true";
                        #$conf["printDescription"],字串,執行該外部程式前要印出來的的文字,預設為$conf["command"]的內容加上使用的$conf["argu"]參數.
                        #$conf["printDescription"]="";
                        #$conf["escapeshellarg"],字串,是否要啟用過濾參數,用了比較安全,但可能會出錯,"true"為啟用,"false"為不啟用,預設為"false".
                        $conf["external::callShell"]["escapeshellarg"]="true";
                        #$conf["username"],字串,要用什麼使用者來執行,預設為執行php的使用者,該參數不適用於apache環境.
                        #$conf["username"]="";
                        #$conf["password"],字串,root的使用者密碼,預設不使用密碼,該參數不適用於apache環境.
                        #$conf["password"]="";
                        #$conf["useScript"],字串,是否要啟用Linux的script指令來記錄輸出,"true"代表要,Fedora的selinux會擋住該操作;"false"代表不要,預設為"false".
                        #$conf["useScript"]="";
                        #$conf["logFilePath"],字串,當 $conf["useScript"] 為 "true" 時,輸出的內容要暫存到哪裡,預設為 "/tmp/.qbpwcf_tmp/external/callShell/".
                        #$conf["logFilePath"]=".qbpwcf_tmp/external/callShell/";
                        #$conf["inBackGround"],字串,是否要在背景執行,且不會等待程式執行結束再執行下一個指令,"true"代表是,"false"代表不要,預設為"false",如果$conf["command"]有用「;」區隔的多個指令將會出錯.
                        #$conf["inBackGround"]="";
                        #$conf["getErr"],字串,"true"代表將錯誤輸出變成標準輸出,反之"false"為不變動.
                        #$conf["getErr"]="false";
                        #備註:
                        #不是所有指令都能用apache的身份執行,目前已知java,javac指令無法執行,使用root身份可能會被selinux阻擋.
                        #參考資料:
                        #exec=>http://php.net/manual/en/function.exec.php
                        #escapeshellcmd=>http://php.net/manual/en/function.escapeshellcmd.php
                        #escapeshellarg=>http://php.net/manual/en/function.escapeshellarg.php
                        $callShell=external::callShell($conf["external::callShell"]);
                        unset($conf["external::callShell"]);            
                        
                        #如果執行失敗
                        if($callShell["status"]==="false"){
                        
                                #設置執行不正常
                                $result["status"]="false";

                                #設置執行錯誤
                                $result["error"]=$callShell;

                                #回傳結果
                                return $result;
                        
                                }#if end

                        #取得 state 字串
                        $uuid=$callShell["output"][0];
                
                        #認證的頁面
                        $authUrl="https://access.line.me/oauth2/v2.1/authorize?response_type=code&client_id=".$conf["channelId"]."&redirect_uri=https%3A%2F%2F".$conf["url"]."&state=".$uuid."&scope=profile%20openid";
                
                        #函式說明:
                        #設定session變數後,立即轉址.
                        #回傳的結果:
                        #$result["status"],執行是否成功,"true"代表成功,"false"代表不成功.
                        #$result["function"],當前執行的函數名稱.
                        #$result["error"],錯誤訊息陣列.
                        #必填的參數:
                        #$conf["headerLocation"],為要轉址到的地方,若爲 $_SERVER["PHP_SELF"],則爲回到目前頁面,全民資安素養網爲 https://isafe.moe.edu.tw/.
                        $conf["header::redirectionNow"]["headerLocation"]=$authUrl;
                        #可省略參數:
                        #$conf["sessionName"],字串陣列,可以指派session變數的名稱.
                        $conf["header::redirectionNow"]["sessionName"]=array("qbpwcf.line.login.state");
                        #$conf["sessionValue"]字串陣列,可以指派session變數的內容.
                        $conf["header::redirectionNow"]["sessionValue"]=array($uuid);
                        #參靠資料來源:
                        #http://php.net/manual/en/reserved.variables.server.php
                        header::redirectionNow($conf["header::redirectionNow"]);
                        unset($conf["header::redirectionNow"]);
                        
                        }#if end
        
                #反之印出內容
                else{
                        #debug
                        #var_dump($responseMultiInputDataSecurityEnhance);
                
                        #如果沒有取得 code 
                        if(!isset($responseMultiInputDataSecurityEnhance["inputDataContent"]["code"])){
                        
                                #設置執行不正常
                                $result["status"]="false";

                                #設置執行錯誤
                                $result["error"]=$responseMultiInputDataSecurityEnhance;

                                #回傳結果
                                return $result;
                        
                                }#if end
                                
                        #另存 code
                        $code=$responseMultiInputDataSecurityEnhance["inputDataContent"]["code"];
                        
                        #設置執行正常
                        $result["status"]="true";
                        
                        #取得code
                        $result["content"]=$code;
                        
                        #回傳結果
                        return $result;
                                
                        }#else end
        
                }#functino lineLogin end
                
        /*
        #函式說明:
        #用從Line Login拿到的code來取得id token
        #回傳結果:
        #$result["status"],執行正常與否,"true"代表正常,"false"代表不正常.
        #$result["error"],錯誤訊息陣列.
        #$resutl["function"],當前執行的涵式名稱.
        #$result["content"],id_token.
        #必填參數:
        #$conf["url"],字串,auth後要轉到的url,亦即當前頁面的網址.
        $conf["url"]="";
        #$conf["channelId"],字串,channelID.
        $conf["channelId"]="";
        #$conf["secret"],字串channelID對應的secret.
        $conf["secret"]="";
        #$conf["code"],字串透過Line Login取得的code
        $conf["code"]="";
        #$conf["fileArgu"],字串,變數__FILE__的內容.
        $conf["fileArgu"]=__FILE__;
        #可省略參數:
        #無.
        #參考資料來源:
        #https://developers.line.biz/zh-hant/docs/line-login/integrate-line-login/#making-an-authorization-request
        #備註:
        #無.
        */
        public static function getToken($conf){
        
                #初始化要回傳的結果
                $result=array();

                #取得當前執行的函數名稱
                $result["function"]=__FUNCTION__;

                #取得參數
                $result["argu"]=$conf;

                #如果 $conf 不為陣列
                if(gettype($conf)!="array"){

                        #設置執行失敗
                        $result["status"]="false";

                        #設置執行錯誤訊息
                        $result["error"][]="\$conf變數須為陣列形態";

                        #如果傳入的參數為 null
                        if($conf==null){

                                #設置執行錯誤訊息
                                $result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";

                                }#if end

                        #回傳結果
                        return $result;

                        }#if end
                        
                #函式說明:
                #檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                #$reuslt["error"],執行不正常結束的錯訊息陣列.
                #$result["function"],當前執行的函式名稱.
                #$result["argu"],設置給予的參數.
                #$result["passed"],識別要檢查的全體變數是否存在以及型態是否正確的變數,"true"代表檢查全部通過;"false"代表檢查不通過
                #$result[$shouldBeCheckedVarName]["varExist"],所檢查的變數是否存在,"false"代表不存在;"true"代表存在
                #$result[$shouldBeCheckedVarName]["varType"],所檢查的變數型態是否正確,"false"代表錯誤;"true"代表正確
                #$result[$shouldBeCheckedVarName]["error"],每個參數設定的錯誤訊息
                #$result["shouldNotBeEmpty"],不應該為空字串或控陣列的變數.
                #$result["argu"],字串陣列,目前輸入的參數名稱陣列.
                #$result["legalVarName"],字串陣列,合法可用的參數名稱陣列.
                #$result["notNeedVar"],字串陣列,多餘的參數名稱.
                #必填寫的參數:
                #$conf["varInput"],陣列變數,要檢查的陣列變數,請在要檢查的參數前面加上&,這樣變動的結果才能被套用。
                $conf["variableCheck::checkArguments"]["varInput"]=&$conf;
                #$conf["referenceVarKey"],字串,$conf參數後面的key值,用於移除不要的參考陣列.
                $conf["variableCheck::checkArguments"]["referenceVarKey"]="variableCheck::checkArguments";
                #可以省略的參數:
                #$conf["mustBeFilledVariableName"],爲必填參數的變數名稱陣列,形態爲陣列變數,元素數量需要跟"mustBeFilledVariableType"參數的元素數量一致,例如: $conf["mustBeFilledVariableName"] = array("id","account","password");
                $conf["variableCheck::checkArguments"]["mustBeFilledVariableName"]=array("url","channelId","fileArgu","secret","code");
                #$conf["mustBeFilledVariableType"],爲必填參數的變數陣列應該爲何種變數形態,形態爲陣列,元素數量需要跟"mustBeFilledVariableName"參數的元素數量一致,例如: $conf["mustBeFilledVariableType"] = array("string",integer,"double","resource","object"); , null代表不指定變數形態.
                $conf["variableCheck::checkArguments"]["mustBeFilledVariableType"]=array("string","string","string","string","string");
                #$conf["canBeEmptyString"],字串,必填變數內容如果是空字串就不能算是有設置的話,請設為"false",預設爲"true",可以為空字串.
                #$conf["canBeEmptyString"]="false";
                #$conf["canNotBeEmpty"],字串陣列,哪些必填參數的內容不得為空字串或空陣列,僅當$conf["canBeEmptyString"]為"true"時會生效.
                #$conf["canNotBeEmpty"]=array();
                #$conf["canBeEmpty"],字串陣列,哪些必填參數的內容可為空字串或空陣列,僅當$conf["canBeEmptyString"]為"false"時會生效.
                #$conf["canBeEmpty"]=array();
                #$conf["skipableVariableCanNotBeEmpty"],字串陣列,哪些可省略參數不可以為空字串或空陣列.
                #$conf["skipableVariableCanNotBeEmpty"]=array();
                #$conf["skipableVariableName"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
                #$conf["variableCheck::checkArguments"]["skipableVariableName"]=array("url");
                #$conf["skipableVariableType"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double");
                #$conf["variableCheck::checkArguments"]["skipableVariableType"]=array("url");
                #$conf["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,null與代表不指定,若預設值是參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
                #$conf["variableCheck::checkArguments"]["skipableVarDefaultValue"]=array($getConnectionInfo["scheme"]."://".$getConnectionInfo["server_name"].$getConnectionInfo["requestUri"]);
                #$conf["disallowAllSkipableVarIsEmpty"],字串,是否允許每個可省略參數都為空字串,預設為"true"允許,反之為"false".
                #$conf["disallowAllSkipableVarIsEmpty"]="";
                #$conf["disallowAllSkipableVarIsEmptyArray"],字串,是否允許每個可省略參數都為空陣列,預設為"true"允許,反之為"false".
                #$conf["disallowAllSkipableVarIsEmptyArray"]="requestUri";
                #$conf["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
                #$conf["arrayCountEqualCheck"][]=array();
                #參考資料來源:
                #array_keys=>http://php.net/manual/en/function.array-keys.php
                $checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
                unset($conf["variableCheck::checkArguments"]);

                #如果運行失敗
                if($checkArguments["status"]==="false"){

                        #設置執行失敗
                        $result["status"]="false";

                        #設置錯誤訊息
                        $result["error"]=$checkArguments;

                        #回傳結果
                        return $result;

                        }#if end

                #反之檢查不通過
                if($checkArguments["passed"]==="false"){

                        #設置執行失敗
                        $result["status"]="false";

                        #設置錯誤訊息
                        $result["error"]=$checkArguments;

                        #回傳結果
                        return $result;

                        }#if end
        
                #取得 access token
                #函式說明:
                #運行curl cmd
                #回傳結果:
                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                #$result["error"],錯誤訊息陣列.
                #$result["function"],當前執行的函式名稱.
                #$result["content"],取得的回應內容.
                #$result["cookie"],cookie檔案的位置與名稱.
                #$result["cmd"],執行的command.
                #$result["argu],使用的參數.
                #必填參數:
                #$conf["url"],字串,目標url.
                $conf["catchWebContent::curlCmd"]["url"]="https://api.line.me/oauth2/v2.1/token";
                #$conf["fileArgu"],字串,變數__FILE__的內容.
                $conf["catchWebContent::curlCmd"]["fileArgu"]=$conf["fileArgu"];
                #可省略參數:
                #$conf["header"],字串陣列,要傳送的header.
                $conf["catchWebContent::curlCmd"]["header"]=array("Content-Type"=>"application/x-www-form-urlencoded");
                #$conf["allowAnySSLcertificate"],字串,是否允許不可信任的SSL憑證,預設為"true".
                #$conf["allowAnySSLcertificate"]="";
                #$conf["postVar"],字串陣列,每個要傳送的post變數名稱(陣列的key值)與數值.
                $conf["catchWebContent::curlCmd"]["postVar"]=array("grant_type"=>"authorization_code","code"=>$conf["code"],"client_id"=>$conf["channelId"],"client_secret"=>$conf["secret"],"redirect_uri"=>"https%3A%2F%2F".$conf["url"]);
                #$conf["rawPost"]="字串",要傳送的raw post內容.
                #$conf["rawPost"]="";
                #$conf["urlEncode"],字串,post的內容是否要url_encode,"true"代表要,預設為"false"代表不要.
                #$conf["urlEncode"]="false";
                #$conf["agent"],字串,user agent的名稱.
                #$conf["agent"]="";
                #$conf["cookie"],字串,cookie位置與檔案位置.
                #$conf["cookie"]="";
                #$conf["forceNewCookie"],字串,是否要重置cookie,"true"代表要,"false"代表不要,預設為"false".
                #$conf["forceNewCookie"]="";
                #備註:
                #無.
                $curlCmd=catchWebContent::curlCmd($conf["catchWebContent::curlCmd"]);
                unset($conf["catchWebContent::curlCmd"]);
        
                #如果執行失敗
                if($curlCmd["status"]==="false"){
                
                        #設置執行不正常
                        $result["status"]="false";

                        #設置執行錯誤
                        $result["error"]=$curlCmd;

                        #回傳結果
                        return $result;
                
                        }#if end
                
                #取得回應
                $res=(array)(json_decode($curlCmd["content"][0]));
                        
                #設置內容
                $result["content"]=$res["id_token"];
        
                #設置執行正常
                $resutl["status"]="true";
                
                #回傳結果
                return $result;
        
                }#function getToken end
                
        /*
        #函式說明:
        #透過getToken取得的id token來取得profile
        #回傳結果:
        #$result["status"],執行正常與否,"true"代表正常,"false"代表不正常.
        #$result["error"],錯誤訊息陣列.
        #$resutl["function"],當前執行的涵式名稱.
        #$result["content"],語法.
        #必填參數:
        #$conf["channelId"],字串,channelID.
        $conf["channelId"]="";
        #$conf["token"],字串透過getToken取得的id token.
        $conf["token"]="";
        #$conf["fileArgu"],字串,變數__FILE__的內容.
        $conf["fileArgu"]=__FILE__;
        #可省略參數:
        #無.
        #參考資料來源:
        #https://developers.line.biz/zh-hant/docs/line-login/integrate-line-login/#making-an-authorization-request
        #備註:
        #目前支援取得姓名與圖片.
        */
        public static function getProfile(&$conf){
        
                #初始化要回傳的結果
                $result=array();

                #取得當前執行的函數名稱
                $result["function"]=__FUNCTION__;

                #取得參數
                $result["argu"]=$conf;

                #如果 $conf 不為陣列
                if(gettype($conf)!="array"){

                        #設置執行失敗
                        $result["status"]="false";

                        #設置執行錯誤訊息
                        $result["error"][]="\$conf變數須為陣列形態";

                        #如果傳入的參數為 null
                        if($conf==null){

                                #設置執行錯誤訊息
                                $result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";

                                }#if end

                        #回傳結果
                        return $result;

                        }#if end
                        
                #函式說明:
                #檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                #$reuslt["error"],執行不正常結束的錯訊息陣列.
                #$result["function"],當前執行的函式名稱.
                #$result["argu"],設置給予的參數.
                #$result["passed"],識別要檢查的全體變數是否存在以及型態是否正確的變數,"true"代表檢查全部通過;"false"代表檢查不通過
                #$result[$shouldBeCheckedVarName]["varExist"],所檢查的變數是否存在,"false"代表不存在;"true"代表存在
                #$result[$shouldBeCheckedVarName]["varType"],所檢查的變數型態是否正確,"false"代表錯誤;"true"代表正確
                #$result[$shouldBeCheckedVarName]["error"],每個參數設定的錯誤訊息
                #$result["shouldNotBeEmpty"],不應該為空字串或控陣列的變數.
                #$result["argu"],字串陣列,目前輸入的參數名稱陣列.
                #$result["legalVarName"],字串陣列,合法可用的參數名稱陣列.
                #$result["notNeedVar"],字串陣列,多餘的參數名稱.
                #必填寫的參數:
                #$conf["varInput"],陣列變數,要檢查的陣列變數,請在要檢查的參數前面加上&,這樣變動的結果才能被套用。
                $conf["variableCheck::checkArguments"]["varInput"]=&$conf;
                #$conf["referenceVarKey"],字串,$conf參數後面的key值,用於移除不要的參考陣列.
                $conf["variableCheck::checkArguments"]["referenceVarKey"]="variableCheck::checkArguments";
                #可以省略的參數:
                #$conf["mustBeFilledVariableName"],爲必填參數的變數名稱陣列,形態爲陣列變數,元素數量需要跟"mustBeFilledVariableType"參數的元素數量一致,例如: $conf["mustBeFilledVariableName"] = array("id","account","password");
                $conf["variableCheck::checkArguments"]["mustBeFilledVariableName"]=array("token","channelId","fileArgu");
                #$conf["mustBeFilledVariableType"],爲必填參數的變數陣列應該爲何種變數形態,形態爲陣列,元素數量需要跟"mustBeFilledVariableName"參數的元素數量一致,例如: $conf["mustBeFilledVariableType"] = array("string",integer,"double","resource","object"); , null代表不指定變數形態.
                $conf["variableCheck::checkArguments"]["mustBeFilledVariableType"]=array("string","string","string");
                #$conf["canBeEmptyString"],字串,必填變數內容如果是空字串就不能算是有設置的話,請設為"false",預設爲"true",可以為空字串.
                #$conf["canBeEmptyString"]="false";
                #$conf["canNotBeEmpty"],字串陣列,哪些必填參數的內容不得為空字串或空陣列,僅當$conf["canBeEmptyString"]為"true"時會生效.
                #$conf["canNotBeEmpty"]=array();
                #$conf["canBeEmpty"],字串陣列,哪些必填參數的內容可為空字串或空陣列,僅當$conf["canBeEmptyString"]為"false"時會生效.
                #$conf["canBeEmpty"]=array();
                #$conf["skipableVariableCanNotBeEmpty"],字串陣列,哪些可省略參數不可以為空字串或空陣列.
                #$conf["skipableVariableCanNotBeEmpty"]=array();
                #$conf["skipableVariableName"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
                #$conf["variableCheck::checkArguments"]["skipableVariableName"]=array("url");
                #$conf["skipableVariableType"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double");
                #$conf["variableCheck::checkArguments"]["skipableVariableType"]=array("url");
                #$conf["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,null與代表不指定,若預設值是參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
                #$conf["variableCheck::checkArguments"]["skipableVarDefaultValue"]=array($getConnectionInfo["scheme"]."://".$getConnectionInfo["server_name"].$getConnectionInfo["requestUri"]);
                #$conf["disallowAllSkipableVarIsEmpty"],字串,是否允許每個可省略參數都為空字串,預設為"true"允許,反之為"false".
                #$conf["disallowAllSkipableVarIsEmpty"]="";
                #$conf["disallowAllSkipableVarIsEmptyArray"],字串,是否允許每個可省略參數都為空陣列,預設為"true"允許,反之為"false".
                #$conf["disallowAllSkipableVarIsEmptyArray"]="requestUri";
                #$conf["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
                #$conf["arrayCountEqualCheck"][]=array();
                #參考資料來源:
                #array_keys=>http://php.net/manual/en/function.array-keys.php
                $checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
                unset($conf["variableCheck::checkArguments"]);

                #如果運行失敗
                if($checkArguments["status"]==="false"){

                        #設置執行失敗
                        $result["status"]="false";

                        #設置錯誤訊息
                        $result["error"]=$checkArguments;

                        #回傳結果
                        return $result;

                        }#if end

                #反之檢查不通過
                if($checkArguments["passed"]==="false"){

                        #設置執行失敗
                        $result["status"]="false";

                        #設置錯誤訊息
                        $result["error"]=$checkArguments;

                        #回傳結果
                        return $result;

                        }#if end
        
                #取得 get profile
                #函式說明:
                #運行curl cmd
                #回傳結果:
                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                #$result["error"],錯誤訊息陣列.
                #$result["function"],當前執行的函式名稱.
                #$result["content"],取得的回應內容.
                #$result["cookie"],cookie檔案的位置與名稱.
                #$result["cmd"],執行的command.
                #$result["argu],使用的參數.
                #必填參數:
                #$conf["url"],字串,目標url.
                $conf["catchWebContent::curlCmd"]["url"]="https://api.line.me/oauth2/v2.1/verify";
                #$conf["fileArgu"],字串,變數__FILE__的內容.
                $conf["catchWebContent::curlCmd"]["fileArgu"]=$conf["fileArgu"];
                #可省略參數:
                #$conf["header"],字串陣列,要傳送的header.
                #$conf["catchWebContent::curlCmd"]["header"]=array("Content-Type"=>"application/x-www-form-urlencoded");
                #$conf["allowAnySSLcertificate"],字串,是否允許不可信任的SSL憑證,預設為"true".
                #$conf["allowAnySSLcertificate"]="";
                #$conf["postVar"],字串陣列,每個要傳送的post變數名稱(陣列的key值)與數值.
                $conf["catchWebContent::curlCmd"]["postVar"]=array("id_token"=>$conf["token"]."&client_id=".$conf["channelId"]);
                #$conf["rawPost"]="字串",要傳送的raw post內容.
                #$conf["rawPost"]="";
                #$conf["urlEncode"],字串,post的內容是否要url_encode,"true"代表要,預設為"false"代表不要.
                #$conf["urlEncode"]="false";
                #$conf["agent"],字串,user agent的名稱.
                #$conf["agent"]="";
                #$conf["cookie"],字串,cookie位置與檔案位置.
                #$conf["cookie"]="";
                #$conf["forceNewCookie"],字串,是否要重置cookie,"true"代表要,"false"代表不要,預設為"false".
                #$conf["forceNewCookie"]="";
                #備註:
                #無.
                $curlCmd=catchWebContent::curlCmd($conf["catchWebContent::curlCmd"]);
                unset($conf["catchWebContent::curlCmd"]);
        
                #如果執行失敗
                if($curlCmd["status"]==="false"){
                
                        #設置執行不正常
                        $result["status"]="false";

                        #設置執行錯誤
                        $result["error"]=$curlCmd;

                        #回傳結果
                        return $result;
                
                        }#if end
                
                #取得回應
                $res=(array)(json_decode($curlCmd["content"][0]));
                
                #取得姓名
                $result["content"]["Name"]=$res["name"];
                
                #取得姓名
                $result["content"]["Pic"]=$res["picture"];
                
                #設置原始內容
                $result["content"]["ori"]=$res;

                #設置執行正常
                $resutl["status"]="true";
                
                #回傳結果
                return $result;
        
                }#function getProfile end

        }#class line end

?>