예제 #1
0
파일: index.php 프로젝트: negram/flyspray
 function show($area = null)
 {
     global $page, $fs, $db, $proj, $user, $conf;
     $perpage = '20';
     if (isset($user->infos['tasks_perpage'])) {
         $perpage = $user->infos['tasks_perpage'];
     }
     $pagenum = max(1, Get::num('pagenum', 1));
     $offset = $perpage * ($pagenum - 1);
     // Get the visibility state of all columns
     $visible = explode(' ', trim($proj->id ? $proj->prefs['visible_columns'] : $fs->prefs['visible_columns']));
     if (!is_array($visible) || !count($visible) || !$visible[0]) {
         $visible = array('id');
     }
     list($tasks, $id_list) = Backend::get_task_list($_GET, $visible, $offset, $perpage);
     $page->assign('tasks', $tasks);
     $page->assign('offset', $offset);
     $page->assign('perpage', $perpage);
     $page->assign('pagenum', $pagenum);
     $page->assign('visible', $visible);
     // List of task IDs for next/previous links
     $_SESSION['tasklist'] = $id_list;
     $page->assign('total', count($id_list));
     // Javascript replacement
     if (Get::val('toggleadvanced')) {
         $advanced_search = intval(!Req::val('advancedsearch'));
         Flyspray::setCookie('advancedsearch', $advanced_search, time() + 60 * 60 * 24 * 30);
         $_COOKIE['advancedsearch'] = $advanced_search;
     }
     // Update check {{{
     if (Get::has('hideupdatemsg')) {
         unset($_SESSION['latest_version']);
     } else {
         if ($conf['general']['update_check'] && $user->perms('is_admin') && $fs->prefs['last_update_check'] < time() - 60 * 60 * 24 * 3) {
             if (!isset($_SESSION['latest_version'])) {
                 $latest = Flyspray::remote_request('http://flyspray.org/version.txt', GET_CONTENTS);
                 //if for some silly reason we get and empty response, we use the actual version
                 $_SESSION['latest_version'] = empty($latest) ? $fs->version : $latest;
                 $db->x->execParam('UPDATE {prefs} SET pref_value = ? WHERE pref_name = ?', array(time(), 'last_update_check'));
             }
         }
     }
     if (isset($_SESSION['latest_version']) && version_compare($fs->version, $_SESSION['latest_version'], '<')) {
         $page->assign('updatemsg', true);
     }
     // }}}
     $page->setTitle($fs->prefs['page_title'] . $proj->prefs['project_title'] . ': ' . L('tasklist'));
     $page->pushTpl('index.tpl');
 }
예제 #2
0
                 $cryptPass = md5(Post::val('oldpass'));
                 break;
             default:
                 $cryptPass = crypt(Post::val('oldpass'), $oldpass['user_pass']);
                 break;
         }
         if ($cryptPass != $oldpass['user_pass']) {
             Flyspray::show_error(L('oldpasswrong'));
             break;
         }
     }
     $new_hash = Flyspray::cryptPassword(Post::val('changepass'));
     $db->Query('UPDATE {users} SET user_pass = ? WHERE user_id = ?', array($new_hash, Post::val('user_id')));
     // If the user is changing their password, better update their cookie hash
     if ($user->id == Post::val('user_id')) {
         Flyspray::setCookie('flyspray_passhash', crypt($new_hash, $conf['general']['cookiesalt']), time() + 3600 * 24 * 30, null, null, null, true);
     }
 }
 $jabId = Post::val('jabber_id');
 if (!empty($jabId) && Post::val('old_jabber_id') != $jabId) {
     Notifications::JabberRequestAuth(Post::val('jabber_id'));
 }
 $db->Query('UPDATE {users}
        SET  real_name = ?, email_address = ?, notify_own = ?,
             jabber_id = ?, notify_type = ?,
             dateformat = ?, dateformat_extended = ?,
             tasks_perpage = ?, time_zone = ?, lang_code = ?,
             hide_my_email = ?, notify_online = ?
      WHERE  user_id = ?', array(Post::val('real_name'), Post::val('email_address'), Post::num('notify_own', 0), Post::val('jabber_id', ''), Post::num('notify_type'), Post::val('dateformat', 0), Post::val('dateformat_extended', 0), Post::num('tasks_perpage'), Post::num('time_zone'), Post::val('lang_code', 'en'), Post::num('hide_my_email', 0), Post::num('notify_online', 0), Post::num('user_id')));
 # 20150307 peterdd: Now we must reload translations, because the user maybe changed his language preferences!
 # first reload user info
예제 #3
0
파일: index.php 프로젝트: xcdam/flyspray
    header('Content-Disposition: attachment; filename=' . $outfile);
    header('Content-Transfer-Encoding: text');
    header('Expires: 0');
    header('Cache-Control: must-revalidate');
    header('Pragma: public');
    header('Content-Length: ' . strlen($result));
    ob_clean();
    flush();
    // finally send out our data
    printf("%s", $result);
}
// } }}
// Javascript replacement
if (Get::val('toggleadvanced')) {
    $advanced_search = intval(!Req::val('advancedsearch'));
    Flyspray::setCookie('advancedsearch', $advanced_search, time() + 60 * 60 * 24 * 30);
    $_COOKIE['advancedsearch'] = $advanced_search;
}
// Update check {{{
if (Get::has('hideupdatemsg')) {
    unset($_SESSION['latest_version']);
} else {
    if ($conf['general']['update_check'] && $user->perms('is_admin') && $fs->prefs['last_update_check'] < time() - 60 * 60 * 24 * 3) {
        if (!isset($_SESSION['latest_version'])) {
            $latest = Flyspray::remote_request('http://flyspray.org/version.txt', GET_CONTENTS);
            //if for some silly reason we get and empty response, we use the actual version
            $_SESSION['latest_version'] = empty($latest) ? $fs->version : $latest;
            $db->Query('UPDATE {prefs} SET pref_value = ? WHERE pref_name = ?', array(time(), 'last_update_check'));
        }
    }
}
예제 #4
0
 function setCookie()
 {
     Flyspray::setCookie('flyspray_project', $this->id);
 }
예제 #5
0
        Flyspray::show_error(27);
    }
    $success = false;
    if ($username) {
        $group_in = $fs->prefs['anon_group'];
        $name = $user_details->name ?: $username;
        $success = Backend::create_user($username, null, $name, '', $user_details->email, 0, 0, $group_in, 1, $uid, $provider);
    }
    // username taken or not provided, ask for it
    if (!$success) {
        $_SESSION['oauth_token'] = serialize($token);
        $_SESSION['oauth_provider'] = $provider;
        $page->assign('provider', ucfirst($provider));
        $page->assign('username', $username);
        $page->pushTpl('register.oauth.tpl');
        return;
    }
}
if (($user_id = Flyspray::checkLogin($user_details->email, null, 'oauth')) < 1) {
    Flyspray::show_error(23);
    // account disabled
}
$user = new User($user_id);
// Set a couple of cookies
$passweirded = crypt($user->infos['user_pass'], $conf['general']['cookiesalt']);
Flyspray::setCookie('flyspray_userid', $user->id, 0, null, null, null, true);
Flyspray::setCookie('flyspray_passhash', $passweirded, 0, null, null, null, true);
$_SESSION['SUCCESS'] = L('loginsuccessful');
$return_to = $_SESSION['return_to'];
unset($_SESSION['return_to']);
Flyspray::Redirect($return_to);
예제 #6
0
                Flyspray::show_error(7);
            }
        }
    } else {
        // Determine if the user should be remembered on this machine
        if (Req::has('remember_login')) {
            $cookie_time = time() + 60 * 60 * 24 * 30;
            // Set cookies for 30 days
        } else {
            $cookie_time = 0;
            // Set cookies to expire when session ends (browser closes)
        }
        $user = new User($user_id);
        // Set a couple of cookies
        $passweirded = crypt($user->infos['user_pass'], $conf['general']['cookiesalt']);
        Flyspray::setCookie('flyspray_userid', $user->id, $cookie_time, null, null, null, true);
        Flyspray::setCookie('flyspray_passhash', $passweirded, $cookie_time, null, null, null, true);
        // If the user had previously requested a password change, remove the magic url
        $remove_magic = $db->Query("UPDATE {users} SET magic_url = '' WHERE user_id = ?", array($user->id));
        // Save for displaying
        if ($user->infos['login_attempts'] > 0) {
            $_SESSION['login_attempts'] = $user->infos['login_attempts'];
        }
        $db->Query('UPDATE {users} SET login_attempts = 0 WHERE user_id = ?', array($user->id));
        $_SESSION['SUCCESS'] = L('loginsuccessful');
    }
} else {
    // If the user didn't provide both a username and a password, show this error:
    Flyspray::show_error(8);
}
Flyspray::Redirect(Req::val('return_to'));