<?php session_start(); require_once __DIR__ . '/../core/core.php'; /* return a login URL */ function getLoginUrl($fb) { $helper = $fb->getRedirectLoginHelper(); // test server $loginUrl = $helper->getLoginUrl('http://localhost/sico/si-server/login/fb-callback.php'); return htmlspecialchars($loginUrl); } echo json_encode(array("url" => getLoginUrl($fb))); exit;
require_once $CFG->dirroot . '/lib/lms_lib.php'; require_once 'tp_messages.php'; use Tsugi\Util\LTI; use Tsugi\Util\Net; session_start(); header('Content-Type: text/html; charset=utf-8'); if (!isset($_SESSION['lti2post'])) { die_with_error_log("Missing LTI 2.0 post data"); } error_log("Session in lti2 " . session_id()); if (!isset($_SESSION['id'])) { if (isset($_REQUEST['login_done'])) { die_with_error_log("LTI 2 login failed."); } $_SESSION['login_return'] = addSession(getCurrentFileUrl(__FILE__) . "?login_done=true"); header("Location: " . getLoginUrl()); return; } // See if this person is allowed to register a tool $row = $PDOX->rowDie("SELECT request_id, user_id, admin, state, lti\n FROM {$CFG->dbprefix}key_request\n WHERE user_id = :UID LIMIT 1", array(":UID" => $_SESSION['id'])); if ($row === false) { $_SESSION['error'] = 'You have not requested a key for this service.'; header('Location: ' . $CFG->wwwroot); return; } if ($row['state'] == 0) { $_SESSION['error'] = 'Your key has not yet been approved. ' . $row['admin']; header('Location: ' . $CFG->wwwroot); return; } if ($row['state'] != 1) {
foreach ($results_top_pages->getRows() as $key) { $data = $key; } } $views_country = $service->data_ga->get('ga:82033170', date('Y-m-d', strtotime('-31 days')), date('Y-m-d', strtotime('-1 day')), 'ga:pageviews', array('dimensions' => 'ga:country', 'sort' => '-ga:pageviews', 'max-results' => 7)); //echo '<pre>'; //var_dump($views_country); if (is_array($views_country->getRows())) { $data_country = $views_country->getRows(); /*foreach ($views_country->getRows() as $key1) { $data_country = $key1; }*/ } echo date('Y-m-d', strtotime('-31 days')) . '-----' . date('Y-m-d', strtotime('-1 day')); } else { $url = getLoginUrl($client); echo '<div class="col-md-12"><a class="btn btn-sm btn-primary" href="' . $url . '">Plaese Login To Analytics</a></div>'; } if (isset($_GET['code'])) { $code = $_GET['code']; login($code, $client); \Yii::$app->response->redirect('http://localhost/cms/administrator')->send(); } ?> <div class="col-md-12" style="margin-top:15px;"> <div class="row"> <div class="col-md-3"> <a class="btn btn-sm btn-primary" style="width:100%;" href="<?php echo Url::toRoute(['json/get_landing_section']);