Esempio n. 1
0
function is_site_enabled()
{
    if (is_opendb_configured()) {
        // if an administrator is logged in, then the site is considered enabled, even if
        // configured to be disabled.
        if (get_opendb_config_var('site', 'enable') !== FALSE) {
            return TRUE;
        } else {
            if (is_user_granted_permission(PERM_ADMIN_LOGIN)) {
                return TRUE;
            } else {
                if (is_user_admin_changed_user()) {
                    return TRUE;
                }
            }
        }
    }
    //else
    return FALSE;
}
Esempio n. 2
0
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   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');