Beispiel #1
0
function output_cache_file($url)
{
    // no point streaming a local URI
    if (is_url_absolute($url) && get_opendb_config_var('http.stream_external_images', 'enable') !== FALSE && is_uri_domain_in_list($url, get_opendb_config_var('http.stream_external_images', 'domain_list'))) {
        $snoopy = new OpenDbSnoopy();
        $dataBuffer =& $snoopy->fetchURI($url, FALSE);
        if ($dataBuffer !== FALSE) {
            if (is_array($snoopy->headers)) {
                for ($i = 0; $i < count($snoopy->headers); $i++) {
                    header($snoopy->headers[$i]);
                }
            }
            echo $dataBuffer;
            flush();
        } else {
            opendb_redirect($url);
        }
        unset($snoopy);
    } else {
        if (($file = get_item_input_file_upload_url($url)) !== FALSE) {
            // file upload - that is not cached
            opendb_redirect($file);
        } else {
            opendb_redirect($url);
        }
    }
}
Beispiel #2
0
/**
	this script is included by include/begin.inc.php, so available
	to all user executable scripts.
*/
function redirect_login($PHP_SELF, $HTTP_VARS, $rememberMeLogin = FALSE)
{
    $redirect = basename($PHP_SELF);
    $url = get_url_string($HTTP_VARS);
    if (strlen($url) > 0) {
        $redirect .= '?' . $url;
    }
    opendb_redirect("login.php?op=login&rememberMeLogin="******"true" : "false") . "&redirect=" . urlencode($redirect));
}
Beispiel #3
0
             } else {
                 //user not found.
                 echo "<p class=\"error\">" . get_opendb_lang_var('user_not_found', 'user_id', $HTTP_VARS['user_id']) . "</p>";
             }
         }
         echo format_footer_links($footer_links_r);
         echo _theme_footer();
     } else {
         opendb_not_authorised_page(PERM_ADMIN_CHANGE_PASSWORD, $HTTP_VARS);
     }
 } else {
     if ($HTTP_VARS['op'] == 'change_user' && get_opendb_config_var('user_admin.change_user', 'enable') !== FALSE) {
         if (is_user_granted_permission(PERM_ADMIN_CHANGE_USER)) {
             if (strlen($HTTP_VARS['uid']) > 0 && is_user_active($HTTP_VARS['uid'])) {
                 perform_changeuser($HTTP_VARS);
                 opendb_redirect('welcome.php');
                 return;
             } else {
                 echo _theme_header(get_opendb_lang_var('change_user'));
                 show_changeuser_form();
             }
             echo format_footer_links($footer_links_r);
             echo _theme_footer();
         } else {
             opendb_not_authorised_page(PERM_ADMIN_CHANGE_USER, $HTTP_VARS);
         }
     } else {
         if ($HTTP_VARS['op'] == 'insert') {
             if (is_user_granted_permission(PERM_ADMIN_CREATE_USER)) {
                 echo _theme_header(get_opendb_lang_var('add_new_user'));
                 echo "<h2>" . get_opendb_lang_var('add_new_user') . "</h2>";
Beispiel #4
0
   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/
// This must be first - includes config.php
require_once "./include/begin.inc.php";
include_once "./lib/database.php";
include_once "./lib/auth.php";
include_once "./lib/logging.php";
include_once "./lib/widgets.php";
include_once "./lib/http.php";
include_once "./lib/importcache.php";
if (is_user_admin_changed_user()) {
    opendb_logger(OPENDB_LOG_INFO, __FILE__, __FUNCTION__, 'Administrator logging out change user');
    $user_r = fetch_user_r(get_opendb_session_var('admin_user_id'));
    register_opendb_session_var('user_id', get_opendb_session_var('admin_user_id'));
    unregister_opendb_session_var('admin_user_id');
    opendb_redirect('index.php');
} else {
    opendb_logger(OPENDB_LOG_INFO, __FILE__, __FUNCTION__, 'User logged out');
    if (strlen(get_opendb_session_var('user_id')) > 0) {
        import_cache_delete_for_user(get_opendb_session_var('user_id'));
    }
    @session_destroy();
    $params = session_get_cookie_params();
    setcookie(session_name(), '', 0, $params['path'], $params['domain'], $params['secure'], isset($params['httponly']));
    remove_opendb_remember_me();
    opendb_redirect('index.php');
}
// Cleanup after begin.inc.php
require_once "./include/end.inc.php";
Beispiel #5
0
         } else {
             opendb_logger(OPENDB_LOG_ERROR, __FILE__, __FUNCTION__, 'Usage log not cleared');
         }
         // return to log file without POST params so can do immediate refresh of log
         opendb_redirect(basename($PHP_SELF) . "?type={$ADMIN_TYPE}");
     } else {
         if ($HTTP_VARS['confirmed'] != 'false') {
             echo "<h3>" . get_opendb_lang_var('clear_usagelog') . "</h3>\n";
             // hack to get the redirect to work
             $HTTP_VARS['mode'] = 'job';
             echo get_op_confirm_form($PHP_SELF, get_opendb_lang_var('confirm_clear_log'), $HTTP_VARS);
         } else {
             // confirmation required.
             $HTTP_VARS['op'] = '';
             // return to log file without POST params so can do immediate refresh of log
             opendb_redirect(basename($PHP_SELF) . "?type={$ADMIN_TYPE}");
         }
     }
 } else {
     if ($HTTP_VARS['op'] == 'backup') {
         if (strlen($logging_config_r['backup_ext_date_format']) > 0) {
             $mask = get_localised_timestamp($logging_config_r['backup_ext_date_format']);
         } else {
             $mask = get_localised_timestamp('DDMMYY');
         }
         $filename = $logging_config_r['file'] . '.' . get_localised_timestamp($mask);
         $result = @copy($logging_config_r['file'], $filename);
         if ($result) {
             opendb_logger(OPENDB_LOG_INFO, __FILE__, __FUNCTION__, 'Usage log backed up', array($filename));
             $success[] = get_opendb_lang_var('backup_successful', 'filename', $filename);
         } else {