/* if survey has been selected ... */
if(!empty($_GET['sid'])) {
$sid = intval($_GET['sid']);
$srealm = auth_get_survey_realm($sid);
/* check ACL to see if user is allowed to copy
* _this_ survey */
if($_SESSION['acl']['superuser'] != 'Y' &&
!auth_is_owner($sid, $_SESSION['acl']['username']) &&
!in_array($srealm, array_intersect(
$_SESSION['acl']['pdesign'],
$_SESSION['acl']['pall'])) &&
!auth_no_access(_('to access this survey'))) {
return;
}
/* copy the survey */
if(!survey_copy($sid)) {
echo(mkerror(_('Error copying survey.') ." (". ErrorMsg() .")") . "
\n");
echo("" . _('Go back to Management Interface') . "\n");
return;
}
?>
" . _('Go back to Management Interface') . "\n");
return;
}
/* load names and titles of all surveys available to
* _this_ user */
if($_SESSION['acl']['superuser'] == 'Y') {
$sql = 'SELECT id,name,title,status,owner,realm FROM '.$GLOBALS['ESPCONFIG']['survey_table'].' ORDER BY id DESC';
} else {
$realms = array_to_insql(
array_intersect(
$_SESSION['acl']['pall'],
$_SESSION['acl']['pdesign']));
$sql = "SELECT id,name,title,status,owner,realm
FROM ".$GLOBALS['ESPCONFIG']['survey_table']." WHERE NOT (status & ". STATUS_DELETED .") AND (owner = ".
_addslashes($_SESSION['acl']['username']) ." || realm $realms) ORDER BY id DESC";
}
$result = execute_sql($sql);
$bg = '';
?>
| "> |