Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…912cdd6b-5c7d-d5a7-a2ba-d0f0cdb91641
  • Loading branch information
pgogy committed Apr 20, 2012
1 parent d2fea93 commit 81a4998
Show file tree
Hide file tree
Showing 6 changed files with 460 additions and 153 deletions.
16 changes: 3 additions & 13 deletions modules/xerte/edit.php
Expand Up @@ -95,21 +95,11 @@ function hideunload(){

function bunload(){

path = "<?PHP
path = "<?PHP echo $row_edit['template_id'] . "-" . $row_username['username'] . "-" . $row_edit['template_name'] . "/";?>";

if($version_control){
template = "<?PHP echo $row_edit['template_id']; ?>";

echo $row_edit['template_id'] . "-" . $row_username['username'] . "-" . $row_edit['template_name'] . "/";
}else{
echo $row_edit['template_id'] . "-" . $row_username['username'] . "-" . $row_edit['template_name'] . "/";
}
?>";

window_reference.edit_window_close(path);
window_reference.edit_window_close(path,template);

}

Expand Down
25 changes: 18 additions & 7 deletions preview.php
Expand Up @@ -21,6 +21,7 @@
* Check the ID is numeric
*/
if(isset($_SESSION['toolkits_logon_id'])) {

if(is_numeric($_GET['template_id'])) {

$safe_template_id = (int) $_GET['template_id'];
Expand All @@ -34,11 +35,12 @@

$query_for_preview_content = str_replace("TEMPLATE_ID_TO_REPLACE", $safe_template_id, $query_for_preview_content_strip);

// get their username from the db which matches their login_id from the $_SESSION
$row_username = db_query_one("select username from {$xerte_toolkits_site->database_table_prefix}logindetails where login_id=?", array($_SESSION['toolkits_logon_id']));

$row = db_query_one($query_for_preview_content);
$row = db_query_one($query_for_preview_content);

// get their username from the db which matches their login_id from the $_SESSION
$row_username = db_query_one("select username from {$xerte_toolkits_site->database_table_prefix}logindetails where login_id=?", array($row['user_id']));


// is there a matching template?
if(!empty($row)) {
// if they're an admin or have rights to see the template, then show it.
Expand All @@ -47,8 +49,17 @@
show_preview_code($row, $row_username);
exit(0);
}

}
}
}

}else{

echo PREVIEW_RESOURCE_FAIL;

}

}else{

echo PREVIEW_RESOURCE_FAIL;
echo PREVIEW_RESOURCE_FAIL;

}

0 comments on commit 81a4998

Please sign in to comment.