Example #1
0
function do_get_new_updates()
{
    include_once MCWD . '/include/login.php';
    do_login();
    $out = array('pm_notices' => get_pm_unread(), 'sub_notices' => get_sub_thread_updates());
    vB_User::processLogout();
    return $out;
}
Example #2
0
function do_get_new_updates()
{
    global $vbulletin;
    require_once DIR . '/includes/functions_login.php';
    $vbulletin->input->clean_array_gpc('r', array('username' => TYPE_STR, 'password' => TYPE_STR, 'md5_password' => TYPE_STR, 'fr_username' => TYPE_STR, 'fr_b' => TYPE_BOOL));
    if (!$vbulletin->GPC['username'] || !$vbulletin->GPC['password'] && !$vbulletin->GPC['md5_password']) {
        json_error(ERR_NO_PERMISSION);
    }
    $vbulletin->GPC['username'] = prepare_remote_utf8_string($vbulletin->GPC['username']);
    $vbulletin->GPC['password'] = prepare_remote_utf8_string($vbulletin->GPC['password']);
    if (!verify_authentication($vbulletin->GPC['username'], $vbulletin->GPC['password'], $vbulletin->GPC['md5_password'], $vbulletin->GPC['md5_password'], $vbulletin->GPC['cookieuser'], true)) {
        json_error(ERR_NO_PERMISSION);
    }
    // Don't save the session, we just want pm & marked thread info
    process_new_login('', false, '');
    // Since we are not saving the session, fetch our userinfo
    $vbulletin->userinfo =& fetch_userinfo($vbulletin->userinfo['userid']);
    cache_permissions($vbulletin->userinfo, true);
    $sub_notices = get_sub_thread_updates();
    fr_update_push_user($vbulletin->GPC['fr_username'], $vbulletin->GPC['fr_b']);
    return array('pm_notices' => $vbulletin->userinfo['pmunread'], 'sub_notices' => $sub_notices);
}
Example #3
0
 function forumrunner_request($default)
 {
     define('MCWD', DIR . '/packages/forumrunner');
     define('IN_FRNR', true);
     header('Content-type: application/json');
     if (isset($_REQUEST['d'])) {
         error_reporting(E_ALL);
     } else {
         error_reporting(0);
     }
     require_once MCWD . '/version.php';
     require_once MCWD . '/support/utils.php';
     require_once MCWD . '/support/JSON.php';
     require_once MCWD . '/include/general_vb.php';
     if (file_exists(MCWD . '/branded.php')) {
         require_once MCWD . '/branded.php';
     }
     $processed = process_input(array('cmd' => STRING, 'frv' => STRING, 'frp' => STRING));
     if (!$processed['cmd']) {
         return json_error(ERR_NO_PERMISSION);
     }
     $frcl_version = '1.3.3';
     $frcl_platform = 'ip';
     if (isset($processed['frv'])) {
         $frcl_version = $processed['frv'];
     }
     if (isset($processed['frp'])) {
         $frcl_platform = $processed['frp'];
     }
     require_once MCWD . '/support/common_methods.php';
     require_once MCWD . '/support/vbulletin_methods.php';
     if (file_exists(MCWD . '/support/other_methods.php')) {
         require_once MCWD . '/support/other_methods.php';
     }
     $json = new Services_JSON();
     if (!isset($methods[$processed['cmd']])) {
         return json_error(ERR_NO_PERMISSION);
     }
     if ($methods[$processed['cmd']]['include']) {
         require_once MCWD . '/include/' . $methods[$processed['cmd']]['include'];
     }
     if (isset($_REQUEST['d'])) {
         error_reporting(E_ALL);
     }
     $out = call_user_func($methods[$processed['cmd']]['function']);
     if (is_string($out)) {
         return $out;
     } else {
         if (is_array($out)) {
             $data = $out;
         } else {
             if (is_bool($out) && $out) {
                 $data = array('success' => true);
             } else {
                 return json_error(ERR_NO_PERMISSION);
             }
         }
     }
     // If we're here, we have success!
     $json_out = array();
     $json_out['success'] = true;
     $json_out['data'] = $data;
     $json_out['ads'] = fr_show_ad();
     $userinfo = vB_Api::instance('user')->fetchUserInfo();
     // Return Unread PM/Subscribed Threads count
     if ($userinfo['userid'] > 0 && $processed['cmd'] != 'get_new_updates' && $processed['cmd'] != 'logout' && $processed['cmd'] != 'login') {
         if ($userinfo['userid'] > 0) {
             $json_out['pm_notices'] = get_pm_unread();
             $json_out['sub_notices'] = get_sub_thread_updates();
         }
     }
     vB5_Cookie::set('lastvisit', vB::getRequest()->getTimeNow(), 365, true);
     return $json->encode($json_out);
 }
Example #4
0
}
if (isset($processed['frp'])) {
    $frcl_platform = $processed['frp'];
}
require_once MCWD . '/support/common_methods.php';
require_once MCWD . '/support/vbulletin_methods.php';
if (file_exists(MCWD . '/support/other_methods.php')) {
    require_once MCWD . '/support/other_methods.php';
}
if (!isset($methods[$processed['cmd']])) {
    json_error(ERR_NO_PERMISSION);
}
if ($methods[$processed['cmd']]['include']) {
    require_once MCWD . '/include/' . $methods[$processed['cmd']]['include'];
}
if (isset($_REQUEST['d'])) {
    error_reporting(E_ALL);
}
$out = call_user_func($methods[$processed['cmd']]['function']);
fr_exec_shut_down(false);
$json_out = array('success' => true, 'data' => $out, 'ads' => fr_show_ad());
// Return Unread PM/Subscribed Threads count
if ($vbulletin->userinfo['userid'] > 0 && $processed['cmd'] != 'get_new_updates' && $processed['cmd'] != 'login') {
    if ($vbulletin->userinfo['userid'] > 0) {
        $json_out['pm_notices'] = get_pm_unread();
        $json_out['sub_notices'] = get_sub_thread_updates();
    }
}
fr_exec_shut_down(true);
$json = new Services_JSON();
print $json->encode($json_out);