* 
 * 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->update_lti_key($_REQUEST['lti_keys_id'], $_REQUEST['lti_keys_name'], $_REQUEST['lti_keys_key'], $_REQUEST['lti_keys_secret'], $_REQUEST['lti_keys_context_id']);
    include 'site.php';
} else {
    management_fail();
}
Beispiel #2
0
if (!$lti->lti_key_exists($LTIkeysid)) {
    $msg = sprintf($string['furtherassistance'], $configObject->get('support_email'), $configObject->get('support_email'));
    $notice->display_notice_and_exit($mysqli, $string['pagenotfound'], $msg, $string['pagenotfound'], '../artwork/page_not_found.png', '#C00000', true, true);
}
$result = $mysqli->prepare("SELECT id, oauth_consumer_key, secret, name, context_id FROM lti_keys WHERE id = ?");
$result->bind_param('i', $LTIkeysid);
$result->execute();
$result->bind_result($ltis['id'], $ltis['oauth_consumer_key'], $ltis['secret'], $ltis['name'], $ltis['context_id']);
$result->fetch();
$result->close();
if (isset($_POST['submit'])) {
    $ltiname = trim($_POST['ltiname']);
    $ltikey = trim($_POST['ltikey']);
    $ltisec = trim($_POST['ltisec']);
    $lticontext = trim($_POST['lticontext']);
    $insert_id = $lti->update_lti_key($LTIkeysid, $ltiname, $ltikey, $ltisec, $lticontext);
    // Log changes
    $logger = new Logger($mysqli);
    if ($ltis['name'] != $ltiname) {
        $logger->track_change('LTI Key', $LTIkeysid, $userObject->get_user_ID(), $ltis['name'], $ltiname, 'name');
    }
    if ($ltis['oauth_consumer_key'] != $ltikey) {
        $logger->track_change('LTI Key', $LTIkeysid, $userObject->get_user_ID(), $ltis['name'], $ltikey, 'key');
    }
    if ($ltis['secret'] != $ltisec) {
        $logger->track_change('LTI Key', $LTIkeysid, $userObject->get_user_ID(), $ltis['secret'], $ltisec, 'secret');
    }
    if ($ltis['context_id'] != $lticontext) {
        $logger->track_change('LTI Key', $LTIkeysid, $userObject->get_user_ID(), $ltis['context_id'], $lticontext, 'context');
    }
    header("location: lti_keys_list.php");