forked from atutor/ATutor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AContent Live Content Link for LTI 1.1 - tile_search module
- Loading branch information
Mauro Donadio
committed
Aug 3, 2012
1 parent
c19e261
commit 0ccf204
Showing
20 changed files
with
2,963 additions
and
296 deletions.
There are no files selected for viewing
Empty file.
190 changes: 103 additions & 87 deletions
190
mods/_standard/tile_search/admin/module_setup.php
100644 → 100755
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,87 +1,103 @@ | ||
<?php | ||
/****************************************************************/ | ||
/* ATutor */ | ||
/****************************************************************/ | ||
/* Copyright (c) 2002-2010 */ | ||
/* Inclusive Design Institute */ | ||
/* http://atutor.ca */ | ||
/* */ | ||
/* This program 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. */ | ||
/****************************************************************/ | ||
|
||
define('AT_INCLUDE_PATH', '../../../../include/'); | ||
require(AT_INCLUDE_PATH.'vitals.inc.php'); | ||
admin_authenticate(AT_ADMIN_PRIV_ADMIN); | ||
|
||
function getValidURI($uri) | ||
{ | ||
if (substr($uri, 0, 7) != 'http://' && substr($uri, 0, 8) != 'https://') { | ||
return false; | ||
} | ||
// add ending slash if uri does not contain | ||
if (substr($uri, -1) != '/') { | ||
$uri .= '/'; | ||
} | ||
|
||
$connection = @file_get_contents($uri.'index.php'); | ||
if (!$connection) { | ||
return false; | ||
} | ||
else { | ||
return $uri; | ||
} | ||
} | ||
|
||
if($_POST['submit']){ | ||
$_POST['transformable_uri'] = trim($_POST['transformable_uri']); | ||
$_POST['transformable_web_service_id'] = trim($_POST['transformable_web_service_id']); | ||
$_POST['transformable_oauth_expire'] = intval($_POST['transformable_oauth_expire']); | ||
|
||
if ($_POST['transformable_uri'] == ''){ | ||
$msg->addError('TRANSFORMABLE_URI_EMPTY'); | ||
} | ||
|
||
$_POST['transformable_uri'] = getValidURI($_POST['transformable_uri']); | ||
|
||
if (!$_POST['transformable_uri']){ | ||
$msg->addError('TRANSFORMABLE_URI_INVALID'); | ||
} | ||
|
||
if (!$_POST['transformable_web_service_id']){ | ||
$msg->addError('TRANSFORMABLE_ID_EMPTY'); | ||
} | ||
|
||
if (!$msg->containsErrors()) { | ||
$_POST['transformable_uri'] = $addslashes($_POST['transformable_uri']); | ||
$sql = "REPLACE INTO ".TABLE_PREFIX."config VALUES ('transformable_uri', '".$_POST['transformable_uri']."')"; | ||
mysql_query($sql, $db); | ||
|
||
$_POST['transformable_web_service_id'] = $addslashes($_POST['transformable_web_service_id']); | ||
$sql = "REPLACE INTO ".TABLE_PREFIX."config VALUES ('transformable_web_service_id', '".$_POST['transformable_web_service_id']."')"; | ||
mysql_query($sql, $db); | ||
|
||
$sql = "REPLACE INTO ".TABLE_PREFIX."config VALUES ('transformable_oauth_expire', '".$_POST['transformable_oauth_expire']."')"; | ||
mysql_query($sql, $db); | ||
|
||
$msg->addFeedback('TRANSFORMABLE_CONFIG_SAVED'); | ||
|
||
header('Location: '.$_SERVER['PHP_SELF']); | ||
exit; | ||
} | ||
} | ||
|
||
$onload = "document.form.transformable_uri.focus();"; | ||
require (AT_INCLUDE_PATH.'header.inc.php'); | ||
?> | ||
<div class="input-form"> | ||
<div class="row"> | ||
<p><?php echo _AT('tile_setup_txt'); ?></p> | ||
</div> | ||
</div> | ||
|
||
|
||
<?php | ||
$savant->display('admin/system_preferences/module_setup.tmpl.php'); | ||
require(AT_INCLUDE_PATH.'footer.inc.php'); ?> | ||
<?php | ||
/****************************************************************/ | ||
/* ATutor */ | ||
/****************************************************************/ | ||
/* Copyright (c) 2002-2010 */ | ||
/* Inclusive Design Institute */ | ||
/* http://atutor.ca */ | ||
/* */ | ||
/* This program 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. */ | ||
/****************************************************************/ | ||
|
||
define('AT_INCLUDE_PATH', '../../../../include/'); | ||
require(AT_INCLUDE_PATH.'vitals.inc.php'); | ||
admin_authenticate(AT_ADMIN_PRIV_ADMIN); | ||
|
||
function getValidURI($uri) | ||
{ | ||
if (substr($uri, 0, 7) != 'http://' && substr($uri, 0, 8) != 'https://') { | ||
return false; | ||
} | ||
// add ending slash if uri does not contain | ||
if (substr($uri, -1) != '/') { | ||
$uri .= '/'; | ||
} | ||
|
||
$connection = @file_get_contents($uri.'index.php'); | ||
if (!$connection) { | ||
return false; | ||
} | ||
else { | ||
return $uri; | ||
} | ||
} | ||
|
||
if($_POST['submit']){ | ||
$_POST['transformable_uri'] = trim($_POST['transformable_uri']); | ||
$_POST['transformable_web_service_id'] = trim($_POST['transformable_web_service_id']); | ||
$_POST['transformable_oauth_expire'] = intval($_POST['transformable_oauth_expire']); | ||
|
||
if ($_POST['transformable_uri'] == ''){ | ||
$msg->addError('TRANSFORMABLE_URI_EMPTY'); | ||
} | ||
|
||
$_POST['transformable_uri'] = getValidURI($_POST['transformable_uri']); | ||
|
||
if (!$_POST['transformable_uri']){ | ||
$msg->addError('TRANSFORMABLE_URI_INVALID'); | ||
} | ||
|
||
if (!$_POST['transformable_web_service_id']){ | ||
$msg->addError('TRANSFORMABLE_ID_EMPTY'); | ||
} | ||
|
||
if (!$msg->containsErrors()) { | ||
$_POST['transformable_uri'] = $addslashes($_POST['transformable_uri']); | ||
$sql = "REPLACE INTO ".TABLE_PREFIX."config VALUES ('transformable_uri', '".$_POST['transformable_uri']."')"; | ||
mysql_query($sql, $db); | ||
|
||
$_POST['transformable_web_service_id'] = $addslashes($_POST['transformable_web_service_id']); | ||
$sql = "REPLACE INTO ".TABLE_PREFIX."config VALUES ('transformable_web_service_id', '".$_POST['transformable_web_service_id']."')"; | ||
mysql_query($sql, $db); | ||
|
||
$sql = "REPLACE INTO ".TABLE_PREFIX."config VALUES ('transformable_oauth_expire', '".$_POST['transformable_oauth_expire']."')"; | ||
mysql_query($sql, $db); | ||
|
||
$msg->addFeedback('TRANSFORMABLE_CONFIG_SAVED'); | ||
|
||
header('Location: '.$_SERVER['PHP_SELF']); | ||
exit; | ||
} | ||
} | ||
|
||
$onload = "document.form.transformable_uri.focus();"; | ||
require (AT_INCLUDE_PATH.'header.inc.php'); | ||
?> | ||
<div class="input-form"> | ||
<div class="row"> | ||
<p><?php echo _AT('tile_setup_txt'); ?></p> | ||
</div> | ||
</div> | ||
<form action="<?php $_SERVER['PHP_SELF']; ?>" method="post" name="form"> | ||
<div class="input-form"> | ||
<div class="row"> | ||
<p><label for="uri"><?php echo _AT('transformable_uri'); ?></label></p> | ||
<input type="text" name="transformable_uri" value="<?php echo $_config['transformable_uri']; ?>" id="uri" size="80" style="min-width: 95%;" /> | ||
|
||
<p><label for="key"><?php echo _AT('web_service_id'); ?></label></p> | ||
<input type="text" name="transformable_web_service_id" value="<?php echo $_config['transformable_web_service_id']; ?>" id="key" size="80" style="min-width: 95%;" /> | ||
|
||
<p><label for="key"><?php echo _AT('oauth_expire'); ?></label></p> | ||
<input type="text" name="transformable_oauth_expire" value="<?php echo $_config['transformable_oauth_expire']; ?>" id="key" size="20" /> <?php echo _AT('seconds'); ?><br /> | ||
<small>· <?php echo _AT('oauth_expire_note'); ?><br /> | ||
</div> | ||
|
||
<div class="row buttons"> | ||
<input type="submit" name="submit" value="<?php echo _AT('save'); ?>" /> | ||
</div> | ||
</div> | ||
</form> | ||
|
||
<?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?> |
Oops, something went wrong.