Exemple #1
0
 *
 * @author Simon Atack
 * @version 1.0
 * @copyright Copyright (c) 2014 The University of Nottingham
 * @package
 */
require '../include/sysadmin_auth.inc';
require_once 'ims-lti/UoN_LTI.php';
$lti = new UoN_LTI();
$lti->init_lti0($mysqli);
if (isset($_POST['submit'])) {
    $ltiname = trim($_POST['ltiname']);
    $ltikey = trim($_POST['ltikey']);
    $ltisec = trim($_POST['ltisec']);
    $lticontext = trim($_POST['lticontext']);
    $insert_id = $lti->add_lti_key($ltiname, $ltikey, $ltisec, $lticontext);
    header("location: lti_keys_list.php");
    exit;
} else {
    ?>
<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta http-equiv="content-type" content="text/html;charset=<?php 
    echo $configObject->get('cfg_page_charset');
    ?>
"/>
  <title>Rog&#333;: <?php 
    echo $string['addltikeys'] . ' ' . $configObject->get('cfg_install_type');
    ?>
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
require_once "../../../config.php";
require "../user_library.php";
require "management_library.php";
if (is_user_admin()) {
    if (!isset($mysqli)) {
        $mysqli = new mysqli($xerte_toolkits_site->database_host, $xerte_toolkits_site->database_username, $xerte_toolkits_site->database_password, $xerte_toolkits_site->database_name);
        if ($mysqli->error) {
            try {
                throw new Exception("0MySQL error {$mysqli->error} <br> Query:<br> {$query}", $mysqli->errno);
            } catch (Exception $e) {
                echo "Error No: " . $e->getCode() . " - " . $e->getMessage() . "<br />";
                echo nl2br($e->getTraceAsString());
            }
        }
    }
    if (!isset($lti)) {
        require_once '../../../LTI/ims-lti/UoN_LTI.php';
        $lti = new UoN_LTI($mysqli);
    }
    $lti->add_lti_key($_REQUEST['lti_keys_name'], $_REQUEST['lti_keys_key'], $_REQUEST['lti_keys_secret'], $_REQUEST['lti_keys_context_id']);
    include 'site.php';
} else {
    management_fail();
}