Skip to content

Commit

Permalink
AContent Live Content Link
Browse files Browse the repository at this point in the history
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
Show file tree
Hide file tree
Showing 20 changed files with 2,963 additions and 296 deletions.
Empty file modified mods/_standard/tile_search/TILE.css
100644 → 100755
Empty file.
190 changes: 103 additions & 87 deletions mods/_standard/tile_search/admin/module_setup.php
100644 → 100755
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" />&nbsp;<?php echo _AT('seconds'); ?><br />
<small>&middot; <?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'); ?>
Loading

0 comments on commit 0ccf204

Please sign in to comment.