Пример #1
0
/**
 * Menghapus Semua Session
 *
 * @return  void
 */
function clearSession($key)
{
    if (is_array($key)) {
        foreach ($key as $k) {
            clearSession($k);
        }
    } else {
        if (isset($_SESSION[$key])) {
            unset($_SESSION[$key]);
        }
    }
}
Пример #2
0
 *  This software is freely distributed in accordance with                      *
 *  the GNU Lesser General Public (LGPL) license, version 3 or later            *
 *  as published by the Free Software Foundation.                               *
 *  For details see LGPL: http://www.fsf.org/licensing/licenses/lgpl.html       *
 *               and GPL: http://www.fsf.org/licensing/licenses/gpl-3.0.html    *
 *                                                                              *
 *  This software is provided by the copyright holders and contributors "as is" *
 *  and any express or implied warranties, including, but not limited to, the   *
 *  implied warranties of merchantability and fitness for a particular purpose  *
 *  are disclaimed. In no event shall the copyright owner or contributors be    *
 *  liable for any direct, indirect, incidental, special, exemplary, or         *
 *  consequential damages (including, but not limited to, procurement of        *
 *  substitute goods or services; loss of use, data, or profits; or business    *
 *  interruption) however caused and on any theory of liability, whether in     *
 *  contract, strict liability, or tort (including negligence or otherwise)     *
 *  arising in any way out of the use of this software, even if advised of the  *
 *  possibility of such damage.                                                 *
 *                                                                              *
 ********************************************************************************/
include_once "../../config.php";
$me = substr($_SERVER["PHP_SELF"], 1);
// remove initial '/'
if ($HUB_FLM->hasCustomVersion($me)) {
    $path = $HUB_FLM->getCodeDirPath($me);
    include_once $path;
    die;
}
// try to logout external in case they have logged in with Social SignOn
logoutExternal();
clearSession();
header('Location: ' . $CFG->homeAddress . 'index.php');
Пример #3
0
 public function signOut()
 {
     clearSession();
     return redirect()->route('signIn');
 }
Пример #4
0
function checkLoginFromAdmin($userid_from_zend)
{
    $front = Frontend::getInstance();
    if (isset($userid_from_zend) && $userid_from_zend != "" && $userid_from_zend != -2) {
        //echo "0*".$userid_from_zend."*";
        $user_id = (int) $userid_from_zend;
        if ($user_id == 0) {
            die("Admin session expired");
        }
        if ($front->isUserLoggedIn() && isset($_SESSION["userid"]) && $_SESSION["userid"] != 0 && $_SESSION["userid"] == $user_id) {
            // already logged nothing to do
        } else {
            if ($front->isUserLoggedIn() && isset($_SESSION["userid"]) && $_SESSION["userid"] != 0 && $_SESSION["userid"] != $user_id) {
                die("You are logged in Love application with another userid in this session. Please, logout from Love application!" . $_SESSION["userid"] . "**" . $user_id);
            } else {
                $sql = "SELECT " . USERS . ".*, " . COMPANY . ".name as company_name  " . "FROM " . USERS . ", " . COMPANY . " " . "WHERE " . USERS . ".id = " . mysql_real_escape_string($user_id) . " AND " . USERS . ".company_id = " . COMPANY . ".id";
                $row = doQuery($sql);
                $username = $row->username;
                $nickname = $row->nickname;
                //           $admin = $row->admin;
                $_SESSION["userid"] = $user_id;
                $_SESSION["username"] = $username;
                $_SESSION["nickname"] = $nickname;
                //         $_SESSION["admin"] = $admin;
                $_SESSION['running'] = "true";
                if (!$front->isUserLoggedIn()) {
                    $front = new Frontend();
                    if (!$front->isUserLoggedIn()) {
                        clearSession();
                        die("You are still not logged! Click on another tab, and come back back here it could work");
                    }
                }
                if (!isAdmin($user_id)) {
                    clearSession();
                    die("You should have admin right to get access to this page." . $admin . "**" . USERS);
                }
            }
        }
    }
    if (!$front->isUserLoggedIn()) {
        clearSession();
        $front->getUser()->askUserToAuthenticate();
    }
    if (!isAdmin($_SESSION["userid"])) {
        clearSession();
        die("You should have admin right to get access to this page.");
    }
}
function cjList()
{
    global $db, $flag, $p_collect_type, $listnum, $strListUrl, $p_pagetype, $p_collecorder, $p_listcodestart, $p_listcodeend, $p_listlinkstart, $p_listlinkend, $p_starringstart, $p_starringend, $p_titlestart, $p_titleend, $p_picstart, $p_picend, $p_starringtype, $p_titletype, $p_pictype, $p_coding, $p_showtype, $viewnum, $p_ids, $sb, $cg, $p_savefiles, $p_pagebatchid2, $p_pagebatchid1;
    global $p_playtype, $reCollExistMovie, $p_playspecialtype, $starringarr, $titlearr, $picarr, $strdstate, $action, $p_pagebatchurl, $p_colleclinkorder, $p_id;
    //	var_dump("ddd".$strListUrl);
    $strListCode = getPage($strListUrl, $p_coding);
    writetofile("crawel_auto_info.log", $p_id . '{=====}' . $strListUrl . "{=====}List===start");
    $listnum = $listnum + 1;
    $tempStep = 1;
    if ($p_playtype === 'baidu') {
        if (isN($_SESSION["strListCodeCut"])) {
            $_SESSION["strListCodeCut"] = $strListCode;
        } else {
            $strListCodeCut = $_SESSION["strListCodeCut"];
        }
        //			var_dump("sssss".$strListCode);
        $baiduList = BaiduParse::parseMovieListByContent($strListCode, $p_code, '');
        //			var_dump("sssss".$baiduList);
        //			var_dum
        if (isN($_SESSION["linkarrcode"])) {
            $linkarrcode = $baiduList['linkarr'];
            $linkarrcode = implode('{Array}', $linkarrcode);
        } else {
            $linkarrcode = $_SESSION["linkarrcode"];
        }
        if ($linkarrcode == false) {
            writetofile("crawel_auto_error.log", $p_id . '{=====}' . $strListUrl);
            return;
        }
        $linkarr = explode("{Array}", $linkarrcode);
        if ($p_starringtype == 1) {
            $starringarr = $baiduList['starringarr'];
        }
        if ($p_titletype == 1) {
            $titlearr = $baiduList['titlearr'];
        }
        if ($p_pictype == 1) {
            $picarr = $baiduList['picarr'];
        }
    } else {
        if (isN($_SESSION["strListCodeCut"])) {
            $strListCodeCut = getBody($strListCode, $p_listcodestart, $p_listcodeend);
            $_SESSION["strListCodeCut"] = $strListCodeCut;
        } else {
            $strListCodeCut = $_SESSION["strListCodeCut"];
        }
        if (isN($_SESSION["linkarrcode"])) {
            $linkarrcode = getArray($strListCodeCut, $p_listlinkstart, $p_listlinkend);
            $_SESSION["linkarrcode"] = $linkarrcode;
        } else {
            $linkarrcode = $_SESSION["linkarrcode"];
        }
        if ($p_starringtype == 1) {
            $starringarrcode = getArray($strListCodeCut, $p_starringstart, $p_starringend);
        }
        if ($p_titletype == 1) {
            $titlearrcode = getArray($strListCodeCut, $p_titlestart, $p_titleend);
        }
        if ($p_pictype == 1) {
            $picarrcode = getArray($strListCodeCut, $p_picstart, $p_picend);
        }
        if ($linkarrcode == false) {
            writetofile("crawel_auto_error.log", $p_id . '{=====}' . $strListUrl);
            return;
        }
        $linkarr = explode("{Array}", $linkarrcode);
        if ($p_starringtype == 1) {
            $starringarr = explode("{Array}", $starringarrcode);
        }
        if ($p_titletype == 1) {
            $titlearr = explode("{Array}", $titlearrcode);
        }
        if ($p_pictype == 1) {
            $picarr = explode("{Array}", $picarrcode);
        }
    }
    $viewcount = count($linkarr);
    if ($p_colleclinkorder == 1) {
        for ($i = $viewcount; $i >= 0; $i--) {
            $urlMo = getHrefFromLink($linkarr[$i]);
            if ($reCollExistMovie) {
                if ($p_playtype === 'baidu') {
                    cjBaiduView($urlMo, $i);
                } else {
                    cjView($urlMo, $i);
                }
            } else {
                $sql = "select m_id from {pre}cj_vod where m_urltest='" . $urlMo . "' order by m_id desc";
                $rowvod = $db->getRow($sql);
                if (!$rowvod) {
                    if ($p_playtype === 'baidu') {
                        cjBaiduView($urlMo, $i);
                    } else {
                        cjView($urlMo, $i);
                    }
                }
            }
        }
    } else {
        for ($i = 0; $i < count($linkarr); $i++) {
            //						cjView(getHrefFromLink($linkarr[$i]),$i);
            $urlMo = getHrefFromLink($linkarr[$i]);
            if ($reCollExistMovie) {
                if ($p_playtype === 'baidu') {
                    cjBaiduView($urlMo, $i);
                } else {
                    cjView($urlMo, $i);
                }
            } else {
                $sql = "select m_id from {pre}cj_vod where m_urltest='" . $urlMo . "' order by m_id desc";
                $rowvod = $db->getRow($sql);
                if (!$rowvod) {
                    if ($p_playtype === 'baidu') {
                        cjBaiduView($urlMo, $i);
                    } else {
                        cjView($urlMo, $i);
                    }
                }
            }
        }
    }
    clearSession();
}
function cjList()
{
    global $db, $p_collect_type, $strListUrl, $p_coding, $count;
    global $p_playtype, $p_id, $idarr, $starringarr, $linkarr, $titlearr, $picarr, $areaarr, $yeararr, $typearr, $finisharr, $introarr, $directorarr, $durationarr;
    $strListCode = getPage($strListUrl, $p_coding);
    writetofile("crawel_auto_info.log", $p_id . '{=====}' . $strListUrl . "{=====}List===start");
    if ($p_playtype === 'baidu') {
        if (isN($_SESSION["strListCodeCut"])) {
            $_SESSION["strListCodeCut"] = $strListCode;
        } else {
            $strListCodeCut = $_SESSION["strListCodeCut"];
        }
        $baiduList = NBaidu::parseListByContent($strListCode, $p_coding, '');
        $idarr = $baiduList['idarr'];
        $linkarr = $baiduList['linkarr'];
        $starringarr = $baiduList['starringarr'];
        $titlearr = $baiduList['titlearr'];
        $picarr = $baiduList['picarr'];
        $areaarr = $baiduList['areaarr'];
        $yeararr = $baiduList['yeararr'];
        $typearr = $baiduList['typearr'];
        $finisharr = $baiduList['finisharr'];
        $introarr = $baiduList['introarr'];
        $directorarr = $baiduList['directorarr'];
        $durationarr = $baiduList['durationarr'];
    }
    for ($i = 0; $i < count($idarr); $i++) {
        $idMo = $idarr[$i];
        if ($p_playtype === 'baidu') {
            $count++;
            cjBaiduView($idMo, $i);
        } else {
            cjView($idMo, $i);
        }
    }
    clearSession();
}
Пример #7
0
 * service HTTP GET/HEAD controller
 *
 */
require_once 'runtime.php';
// serve the favicon
if (basename($_filename) == 'favicon.ico') {
    $length = filesize($_SERVER["DOCUMENT_ROOT"] . '/favicon.ico');
    header('Accept-Ranges: bytes');
    header('Content-Length: ' . $length);
    header('Content-Type: image/x-icon');
    readfile($_SERVER["DOCUMENT_ROOT"] . '/favicon.ico');
    exit;
}
// logout
if (basename($_filename) == 'logout' || isset($_GET['logout'])) {
    isset($i_next) ? clearSession($i_next) : clearSession();
}
if (!in_array($_method, array('GET', 'HEAD')) && !isset($i_query)) {
    httpStatusExit(501, 'Not Implemented');
}
// on the fly output format conversions ?
if (!file_exists($_filename) && in_array($_filename_ext, array('turtle', 'n3', 'json', 'rdf', 'nt', 'jsonld'))) {
    $_filename = substr($_filename, 0, -strlen($_filename_ext) - 1);
    $_base = substr($_base, 0, -strlen($_filename_ext) - 1);
    if ($_filename_ext == 'turtle' || $_filename_ext == 'n3') {
        $_output = 'turtle';
        $_output_type = 'text/turtle';
    } elseif ($_filename_ext == 'json') {
        $_output = 'json';
        $_output_type = 'application/json';
    } elseif ($_filename_ext == 'rdf') {
Пример #8
0
 /**
  * Method untuk memulai aplikasi
  *
  * @param   string  $modDir  Module directori
  * @return  string
  */
 public function start($modDir = 'modules')
 {
     try {
         $uri = $this->get('uri');
         $module = $this->get('modules');
         foreach ($module->all() as $mod) {
             $init = ucfirst($mod) . '::initialize';
             if (is_callable($init)) {
                 call_user_func($init, $this);
             }
         }
         $routes = $this->get('routes');
         $path = $uri->path() ?: $this->conf('basemod');
         list($route) = explode('/', $path);
         if (isset($routes[$route])) {
             $path = str_replace($route, $routes[$route], $path);
         }
         $response = $module->call($path);
         if (is_array($response) or is_object($response)) {
             $response = json_encode($response);
         }
         echo $response;
         if (session('flash')) {
             session('flash', null);
             clearSession('flash');
         }
     } catch (Exception $e) {
         echo $this->show404($e->getMessage());
         exit;
     }
 }
Пример #9
0
function logoutUser()
{
    global $con;
    clearSession();
}
Пример #10
0
function cjList()
{
    global $db, $reCollExistMovie, $p_collect_type, $flag, $listnum, $strListUrl, $p_pagetype, $p_collecorder, $p_listcodestart, $p_listcodeend, $p_listlinkstart, $p_listlinkend, $p_starringstart, $p_starringend, $p_titlestart, $p_titleend, $p_picstart, $p_picend, $p_starringtype, $p_titletype, $p_pictype, $p_coding, $p_showtype, $viewnum, $p_ids, $sb, $cg, $p_savefiles, $p_pagebatchid2, $p_pagebatchid1;
    global $p_playtype, $p_playspecialtype, $starringarr, $titlearr, $picarr, $strdstate, $action, $p_pagebatchurl, $p_colleclinkorder, $p_id;
    if (isN($_SESSION["strListCode"])) {
        $strListCode = getPage($strListUrl, $p_coding);
        $_SESSION["strListCode"] = $strListCode;
    } else {
        $strListCode = $_SESSION["strListCode"];
    }
    if ($strListCode == false) {
        echo "<tr><td colspan=\"2\">在获取:" . $strListUrl . "网页源码时发生错误!</TD></TR>";
        writetofile("crawel_error.log", $p_id . '{=====}' . $strListUrl);
        exit;
    }
    writetofile("crawel_info.log", $p_id . '{=====}' . $strListUrl . "{=====}List===start");
    $listnum = $listnum + 1;
    $tempStep = 1;
    if ($p_playtype === 'tv_live') {
        if (isN($_SESSION["strListCodeCut"])) {
            $strListCodeCut = getBody($strListCode, $p_listcodestart, $p_listcodeend);
            $_SESSION["strListCodeCut"] = $strListCodeCut;
        } else {
            $strListCodeCut = $_SESSION["strListCodeCut"];
        }
        if (isN($_SESSION["linkarrcode"])) {
            $linkarrcode = getArray($strListCodeCut, $p_listlinkstart, $p_listlinkend);
            $_SESSION["linkarrcode"] = $linkarrcode;
        } else {
            $linkarrcode = $_SESSION["linkarrcode"];
        }
        if ($p_starringtype == 1) {
            $starringarrcode = getArray($strListCodeCut, $p_starringstart, $p_starringend);
        }
        if ($p_titletype == 1) {
            $titlearrcode = getArray($strListCodeCut, $p_titlestart, $p_titleend);
        }
        if ($p_pictype == 1) {
            $picarrcode = getArray($strListCodeCut, $p_picstart, $p_picend);
        }
        //			writetofile("tv.log",$starringarrcode);
        //			writetofile("tv.log",$titlearrcode);
        if ($p_starringtype == 1) {
            $starringarr = explode("{Array}", $starringarrcode);
        }
        if ($p_titletype == 1) {
            $titlearr = explode("{Array}", $titlearrcode);
        }
        if (is_array($titlearr)) {
            $count = count($titlearr);
            for ($i = 0; $i < $count; $i++) {
                writetofile("tv.log", 'name:' . $titlearr[$i] . '  code' . $starringarr[$i]);
                $db->query("insert into mac_tv(tv_name,tv_code,country,create_date) values('" . $titlearr[$i] . "','" . $starringarr[$i] . "','中国','" . date('Y-m-d H:i:s', time()) . "')");
            }
        }
        return;
    }
    switch ($p_pagetype) {
        case 3:
            $strViewCode = $strListCode;
            $j = 1;
            if ($p_collecorder == 1) {
                $startnum = $p_pagebatchid2;
                $endnum = $p_pagebatchid1;
            } else {
                $startnum = $p_pagebatchid1;
                $endnum = $p_pagebatchid2;
            }
            if (!strpos($p_pagebatchurl, "{ID}")) {
                $startnum = 0;
                $endnum = 0;
            }
            wtablehead();
            for ($i = $startnum; $i <= $endnum; $i++) {
                $UrlTest = replaceStr($p_pagebatchurl, "{ID}", $i);
                echo "<tr><td colspan=\"2\"></TD>正在采集列表:" . $UrlTest . "的数据 </TR>";
                cjView($UrlTest, $i);
                $j = $j + 1;
            }
            wtablefoot();
            if ($flag) {
                echo "<br> 此分页数据采集完毕 --- <script language=\"javascript\">setTimeout(\"makeNextPage();\",2000);function makeNextPage(){location.href='collect_vod_manage.php';}</script>";
            }
            break;
        default:
            if ($p_playtype === 'baidu') {
                if (isN($_SESSION["strListCodeCut"])) {
                    $_SESSION["strListCodeCut"] = $strListCodeCut;
                } else {
                    $strListCodeCut = $_SESSION["strListCodeCut"];
                }
                $baiduList = BaiduParse::parseMovieListByContent($strListCode, $p_code, '');
                if (isN($_SESSION["linkarrcode"])) {
                    $linkarrcode = $baiduList['linkarr'];
                    $linkarrcode = implode('{Array}', $linkarrcode);
                    $_SESSION["linkarrcode"] = $linkarrcode;
                } else {
                    $linkarrcode = $_SESSION["linkarrcode"];
                }
                if ($linkarrcode == false) {
                    echo "<tr><td colspan=\"2\"></TD>在获取链接列表时出错!'.{$strListUrl}.’</TR>";
                    $sb = $sb + 1;
                    writetofile("crawel_error.log", $p_id . '{=====}' . $strListUrl);
                    return;
                }
                wBreakpoint("../../upload/vodbreakpoint", getUrl());
                $linkarr = explode("{Array}", $linkarrcode);
                if ($p_starringtype == 1) {
                    $starringarr = $baiduList['starringarr'];
                }
                if ($p_titletype == 1) {
                    $titlearr = $baiduList['titlearr'];
                }
                if ($p_pictype == 1) {
                    $picarr = $baiduList['picarr'];
                }
            } else {
                if (isN($_SESSION["strListCodeCut"])) {
                    $strListCodeCut = getBody($strListCode, $p_listcodestart, $p_listcodeend);
                    $_SESSION["strListCodeCut"] = $strListCodeCut;
                } else {
                    $strListCodeCut = $_SESSION["strListCodeCut"];
                }
                if (isN($_SESSION["linkarrcode"])) {
                    $linkarrcode = getArray($strListCodeCut, $p_listlinkstart, $p_listlinkend);
                    $_SESSION["linkarrcode"] = $linkarrcode;
                } else {
                    $linkarrcode = $_SESSION["linkarrcode"];
                }
                if ($p_starringtype == 1) {
                    $starringarrcode = getArray($strListCodeCut, $p_starringstart, $p_starringend);
                }
                if ($p_titletype == 1) {
                    $titlearrcode = getArray($strListCodeCut, $p_titlestart, $p_titleend);
                }
                if ($p_pictype == 1) {
                    $picarrcode = getArray($strListCodeCut, $p_picstart, $p_picend);
                }
                if ($linkarrcode == false) {
                    echo "<tr><td colspan=\"2\"></TD>在获取链接列表时出错!'.{$strListUrl}.’</TR>";
                    $sb = $sb + 1;
                    writetofile("crawel_error.log", $p_id . '{=====}' . $strListUrl);
                    return;
                }
                wBreakpoint("../../upload/vodbreakpoint", getUrl());
                $linkarr = explode("{Array}", $linkarrcode);
                if ($p_starringtype == 1) {
                    $starringarr = explode("{Array}", $starringarrcode);
                }
                if ($p_titletype == 1) {
                    $titlearr = explode("{Array}", $titlearrcode);
                }
                if ($p_pictype == 1) {
                    $picarr = explode("{Array}", $picarrcode);
                }
            }
            $viewcount = count($linkarr);
            if ($p_showtype == 1) {
                if ($viewnum >= $viewcount) {
                    clearSession();
                    if ($flag) {
                        echo "<br> 此分页数据采集完毕 ---   暂停2秒后继续采集<script language=\"javascript\">setTimeout(\"makeNextPage();\",2000);function makeNextPage(){location.href='collect_vod_cj.php?p_id=" . $p_ids . "&listnum=" . $listnum . "&sb=" . $sb . "&cg=" . $cg . "&num=" . $num . "&action=" . $action . "';}</script>";
                    }
                } else {
                    if ($p_savefiles == 1) {
                        $strdstate = "false";
                    } else {
                        $strdstate = "true";
                    }
                    wtablehead();
                    if ($p_playtype === 'baidu') {
                        cjBaiduView(getHrefFromLink($linkarr[$viewnum]), $viewnum);
                    } else {
                        cjView(getHrefFromLink($linkarr[$viewnum]), $viewnum);
                    }
                    wtablefoot();
                    if ($flag) {
                        echo "数据采集完毕 --- 稍后继续采集<script language=\"javascript\">var dstate=" . $strdstate . ";setInterval(\"makeNextPage();\",500);function makeNextPage(){if(dstate){dstate=false;location.href='collect_vod_cj.php?p_id=" . $p_ids . "&listnum=" . ($listnum - 1) . "&sb=" . $sb . "&cg=" . $cg . "&num=" . $num . "&viewnum=" . ($viewnum + 1) . "&action=" . $action . "';}}</script>";
                    }
                    exit;
                }
            } else {
                if ($p_colleclinkorder == 1) {
                    for ($i = $viewcount; $i >= 0; $i--) {
                        wtablehead();
                        if ($i == $viewcount) {
                            echo "<tr><td colspan=\"2\"></TD>正在采集列表:" . $strListUrl . "的数据 </TR>";
                        }
                        $urlMo = getHrefFromLink($linkarr[$i]);
                        if ($reCollExistMovie) {
                            if ($p_playtype === 'baidu') {
                                cjBaiduView($urlMo, $i);
                            } else {
                                cjView($urlMo, $i);
                            }
                        } else {
                            $sql = "select m_id from {pre}cj_vod where m_urltest='" . $urlMo . "' order by m_id desc";
                            $rowvod = $db->getRow($sql);
                            if (!$rowvod) {
                                cjView($urlMo, $i);
                            }
                        }
                        wtablefoot();
                    }
                } else {
                    for ($i = 0; $i < count($linkarr); $i++) {
                        writetofile("crawel_infosss.log", $p_id . '{=====}' . $urlMo . "{=====}View===is collected.");
                        wtablehead();
                        if ($i == 0) {
                            echo "<tr><td colspan=\"2\"></TD>正在采集列表:" . $strListUrl . "的数据 </TR>";
                        }
                        $urlMo = getHrefFromLink($linkarr[$i]);
                        if ($reCollExistMovie) {
                            if ($p_playtype === 'baidu') {
                                cjBaiduView($urlMo, $i);
                            } else {
                                cjView($urlMo, $i);
                            }
                        } else {
                            $sql = "select m_id from {pre}cj_vod where m_urltest='" . $urlMo . "' order by m_id desc";
                            $rowvod = $db->getRow($sql);
                            if (!$rowvod) {
                                if ($p_playtype === 'baidu') {
                                    cjBaiduView($urlMo, $i);
                                } else {
                                    cjView($urlMo, $i);
                                }
                            } else {
                                writetofile("crawel_info.log", $p_id . '{=====}' . $urlMo . "{=====}View===is collected.");
                            }
                        }
                        wtablefoot();
                    }
                }
                clearSession();
                if ($flag) {
                    echo "<br> 此分页数据采集完毕 ---   暂停2秒后继续采集<script language=\"javascript\">setTimeout(\"makeNextPage();\",2000);function makeNextPage(){location.href='collect_vod_cj.php?p_id=" . $p_ids . "&listnum=" . $listnum . "&sb=" . $sb . "&cg=" . $cg . "&num=" . $num . "&action=" . $action . "';}</script>";
                }
            }
    }
}
Пример #11
0
function loginExternal($provider, &$errors)
{
    global $CFG, $LNG;
    clearSession();
    $hybridauth_config = $CFG->dirAddress . 'core/lib/hybridauth-2.4.1/hybridauth/config.php';
    require_once $CFG->dirAddress . 'core/lib/hybridauth-2.4.1/hybridauth/Hybrid/Auth.php';
    try {
        // create an instance for Hybridauth with the configuration file path as parameter
        $hybridauth = new Hybrid_Auth($hybridauth_config);
        // try to authenticate the selected $provider
        $adapter = $hybridauth->authenticate($provider);
        //echo print_r($adapter);
        // grab the user profile
        $user_profile = $adapter->getUserProfile();
        //echo print_r($user_profile);
        return $user_profile;
    } catch (Exception $e) {
        // Display the recived error
        switch ($e->getCode()) {
            case 0:
                $error = $LNG->LOGIN_EXTERNAL_ERROR_HYBRIDAUTH_0;
                break;
            case 1:
                $error = $LNG->LOGIN_EXTERNAL_ERROR_HYBRIDAUTH_1;
                break;
            case 2:
                $error = $LNG->LOGIN_EXTERNAL_ERROR_HYBRIDAUTH_2;
                break;
            case 3:
                $error = $LNG->LOGIN_EXTERNAL_ERROR_HYBRIDAUTH_3;
                break;
            case 4:
                $error = $LNG->LOGIN_EXTERNAL_ERROR_HYBRIDAUTH_4;
                break;
            case 5:
                $error = $LNG->LOGIN_EXTERNAL_ERROR_HYBRIDAUTH_5;
                break;
            case 6:
                $error = $LNG->LOGIN_EXTERNAL_ERROR_HYBRIDAUTH_6;
                $adapter->logout();
                break;
            case 7:
                $error = $LNG->LOGIN_EXTERNAL_ERROR_HYBRIDAUTH_7;
                $adapter->logout();
                break;
        }
        array_push($errors, $error);
        // well, basically you should not display this to the end user, just give him a hint and move on..
        //$error .= "<br /><br /><b>Original error message:</b> " . $e->getMessage();
        //$error .= "<hr /><pre>Trace:<br />" . $e->getTraceAsString() . "</pre>";
        return false;
    }
}
Пример #12
0
function logout($message, $timeout = false)
{
    //logIt("Logout called: $message / ".(int)$timeout, "DEBUG");
    global $loggedInUser, $websiteUrl;
    if (isUserLoggedIn()) {
        $loggedInUser->log_entry[] = "Logged out";
        $loggedInUser->updateUser();
        $loggedInUser = NULL;
    }
    clearSession();
    if (!empty($message)) {
        addSessionMessage($message);
    }
    if ($timeout == true) {
        setSessionRedirect($_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING']);
    }
    // Goto Login page but redirect back to original page after authentication
    $destination = $websiteUrl . "login.php";
    header("Location: {$destination}");
    exit;
}
function logout()
{
    // clear session for logout
    clearSession();
    echo "Logout Success!";
}
Пример #14
0
 public function logout()
 {
     session(['auth' => 0, 'id' => '', 'username' => '', 'level' => '']);
     clearSession(['auth', 'id', 'username', 'level']);
     redirect('');
 }