Esempio n. 1
0
function setup_module($column, $module, $obj)
{
    $user = get_login_user();
    switch ($module) {
        case 'EventCalendarModule':
            $obj->assoc_type = 'user';
            $obj->assoc_id = (int) $_SESSION['user']['id'];
            $obj->may_edit = true;
            // user may edit own events, right? ;)
            $obj->assoc_title = $user->login_name;
            break;
    }
    $obj->mode = PUB;
}
$page = new PageRenderer("setup_module", PAGE_CALENDAR, "Calendar - PeopleAggregator", "container_one_column.tpl", "header_user.tpl", NULL, PRI, $network_info);
$theme_details = get_user_theme($login_uid);
if (is_array($theme_details['css_files'])) {
    foreach ($theme_details['css_files'] as $key => $value) {
        $page->add_header_css($value);
    }
}
$css_path = $current_theme_path . '/calendar.css';
$page->add_header_css($css_path);
$page->add_header_html(js_includes('calendar.js'));
if (!empty($msg)) {
    $msg_tpl =& new Template(CURRENT_THEME_FSPATH . "/display_message.tpl");
    $msg_tpl->set('message', $msg);
    $page->add_module("middle", "top", $msg_tpl->fetch());
}
$page->add_header_html($parameter);
// uihelper_get_group_style($gid);
function uihelper_set_user_heading($page, $do_theme = TRUE, $userid = NULL)
{
    global $uid;
    $uid = !empty($userid) ? $userid : $uid;
    // Changing ... if we give User id than it will display the information of that user
    // .. if we not give the id than it displayed (Page users id or login user id )
    if (!empty($userid)) {
        $user = new User();
        $user->load((int) $userid);
    } else {
        $user = get_login_user();
        if (!PA::$login_uid) {
            $user = get_page_user();
        }
    }
    if (empty($user)) {
        return;
    }
    if ($do_theme) {
        // put links all theme CSS files in the header
        $theme_details = get_user_theme($uid);
        if (is_array($theme_details['css_files'])) {
            foreach ($theme_details['css_files'] as $key => $value) {
                $page->add_header_css($value);
            }
        }
        $page->header->set('theme_details', $theme_details);
        // see if we have user defined CSS
        // Here we have to load the user
        $usr = new User();
        $usr->user_id = $uid;
        $newcss = $usr->get_profile_field("ui", "newcss");
        if (!empty($newcss)) {
            $usercss = "<style>" . $newcss . "</style>";
            $page->add_header_html($usercss);
        }
    }
    // get selected general user data, so we can set captions, etc.
    $user_data_general = $user->get_profile_fields(GENERAL, array('user_caption', 'sub_caption', 'user_caption_image', 'desktop_image_action', 'desktop_image_display'));
    // set caption value
    if (!empty($user_data_general['user_caption'])) {
        $caption1 = chop_string($user_data_general['user_caption'], 20);
    } else {
        $caption1 = chop_string($user->first_name . " " . $user->last_name, 20);
    }
    $page->header->set('caption1', $caption1);
    $page->header->set('caption2', chop_string(@$user_data_general['sub_caption'], 40));
    $page->header->set('caption_image', $user_data_general['user_caption_image']);
    $page->header->set('desktop_image_action', $user_data_general['desktop_image_action']);
    $page->header->set('display_image', @$user_data_general['desktop_image_display']);
}
Esempio n. 3
0
function print_init_params($link)
{
    print "<init-params>";
    if ($_SESSION["stored-params"]) {
        foreach (array_keys($_SESSION["stored-params"]) as $key) {
            if ($key) {
                $value = htmlspecialchars($_SESSION["stored-params"][$key]);
                print "<param key=\"{$key}\" value=\"{$value}\"/>";
            }
        }
    }
    print "<param key=\"theme\" value=\"" . get_user_theme($link) . "\"/>";
    print "<param key=\"theme_options\" value=\"" . get_user_theme_options($link) . "\"/>";
    print "<param key=\"daemon_enabled\" value=\"" . ENABLE_UPDATE_DAEMON . "\"/>";
    print "<param key=\"feeds_frame_refresh\" value=\"" . FEEDS_FRAME_REFRESH . "\"/>";
    print "<param key=\"daemon_refresh_only\" value=\"true\"/>";
    print "<param key=\"sign_progress\" value=\"" . theme_image($link, "images/indicator_white.gif") . "\"/>";
    print "<param key=\"sign_progress_tiny\" value=\"" . theme_image($link, "images/indicator_tiny.gif") . "\"/>";
    print "<param key=\"sign_excl\" value=\"" . theme_image($link, "images/sign_excl.png") . "\"/>";
    print "<param key=\"sign_info\" value=\"" . theme_image($link, "images/sign_info.png") . "\"/>";
    print "<param key=\"on_catchup_show_next_feed\" value=\"" . get_pref($link, "ON_CATCHUP_SHOW_NEXT_FEED") . "\"/>";
    print "<param key=\"hide_read_feeds\" value=\"" . (int) get_pref($link, "HIDE_READ_FEEDS") . "\"/>";
    print "<param key=\"enable_feed_cats\" value=\"" . (int) get_pref($link, "ENABLE_FEED_CATS") . "\"/>";
    print "<param key=\"feeds_sort_by_unread\" value=\"" . (int) get_pref($link, "FEEDS_SORT_BY_UNREAD") . "\"/>";
    print "<param key=\"confirm_feed_catchup\" value=\"" . (int) get_pref($link, "CONFIRM_FEED_CATCHUP") . "\"/>";
    print "<param key=\"cdm_auto_catchup\" value=\"" . (int) get_pref($link, "CDM_AUTO_CATCHUP") . "\"/>";
    print "<param key=\"icons_url\" value=\"" . ICONS_URL . "\"/>";
    print "<param key=\"cookie_lifetime\" value=\"" . SESSION_COOKIE_LIFETIME . "\"/>";
    print "<param key=\"default_view_mode\" value=\"" . get_pref($link, "_DEFAULT_VIEW_MODE") . "\"/>";
    print "<param key=\"default_view_limit\" value=\"" . (int) get_pref($link, "_DEFAULT_VIEW_LIMIT") . "\"/>";
    print "<param key=\"default_view_order_by\" value=\"" . get_pref($link, "_DEFAULT_VIEW_ORDER_BY") . "\"/>";
    print "<param key=\"prefs_active_tab\" value=\"" . get_pref($link, "_PREFS_ACTIVE_TAB") . "\"/>";
    print "<param key=\"infobox_disable_overlay\" value=\"" . get_pref($link, "_INFOBOX_DISABLE_OVERLAY") . "\"/>";
    print "<param key=\"icons_location\" value=\"" . ICONS_URL . "\"/>";
    print "<param key=\"hide_read_shows_special\" value=\"" . (int) get_pref($link, "HIDE_READ_SHOWS_SPECIAL") . "\"/>";
    print "<param key=\"hide_feedlist\" value=\"" . (int) get_pref($link, "HIDE_FEEDLIST") . "\"/>";
    print "<param key=\"bw_limit\" value=\"" . (int) $_SESSION["bw_limit"] . "\"/>";
    //		print "<param key=\"sync_counters\" value=\"" .
    //			(int) get_pref($link, "SYNC_COUNTERS") . "\"/>";
    print "<param key=\"sync_counters\" value=\"1\"/>";
    print "<param key=\"offline_enabled\" value=\"" . (int) get_pref($link, "ENABLE_OFFLINE_READING") . "\"/>";
    $result = db_query($link, "SELECT COUNT(*) AS cf FROM\n\t\t\tttrss_feeds WHERE owner_uid = " . $_SESSION["uid"]);
    $num_feeds = db_fetch_result($result, 0, "cf");
    print "<param key=\"num_feeds\" value=\"" . (int) $num_feeds . "\"/>";
    print "<param key=\"collapsed_feedlist\" value=\"" . (int) get_pref($link, "_COLLAPSED_FEEDLIST") . "\"/>";
    print "</init-params>";
}
Esempio n. 4
0
         //print json_encode(array("error" => "Function not implemented."));
     }
     break;
 case "prefs-save":
     //print json_encode(array("error" => "Function not implemented."));
     $realname = db_escape_string($_REQUEST["realname"]);
     $quit_message = db_escape_string($_REQUEST["quit_message"]);
     $new_password = db_escape_string($_REQUEST["new_password"]);
     $confirm_password = db_escape_string($_REQUEST["confirm_password"]);
     $nick = db_escape_string($_REQUEST["nick"]);
     $email = db_escape_string($_REQUEST["email"]);
     $theme = db_escape_string($_REQUEST["theme"]);
     $highlight_on = db_escape_string($_REQUEST["highlight_on"]);
     $theme_changed = false;
     $_SESSION["prefs_cache"] = false;
     if (get_user_theme($link) != $theme) {
         set_pref($link, "USER_THEME", $theme);
         $theme_changed = true;
     }
     set_pref($link, "HIGHLIGHT_ON", $highlight_on);
     db_query($link, "UPDATE ttirc_users SET realname = '{$realname}',\n\t\t\tquit_message = '{$quit_message}', \n\t\t\temail = '{$email}',\n\t\t\tnick = '{$nick}' WHERE id = " . $_SESSION["uid"]);
     if ($new_password != $confirm_password) {
         print json_encode(array("error" => "Passwords do not match."));
     }
     if ($confirm_password == $new_password && $new_password) {
         $pwd_hash = encrypt_password($new_password, $_SESSION["name"]);
         db_query($link, "UPDATE ttirc_users SET pwd_hash = '{$pwd_hash}'\n\t\t\t\tWHERE id = " . $_SESSION["uid"]);
     }
     if ($theme_changed) {
         print json_encode(array("message" => "THEME_CHANGED"));
     }
Esempio n. 5
0
            }
    }
}
//check if user is checking out only his content
if ($uid != $login_uid) {
    throw new PAException(OPERATION_NOT_PERMITTED, "You cant access other user's messages.");
}
$page = new PageRenderer("setup_module", PAGE_MESSAGE, sprintf(__("%s - Private Messages - %s"), $login_user->get_name(), $network_info->name), "container_one_column.tpl", 'header_user.tpl', PRI, HOMEPAGE, $network_info);
/*$css_path = $current_theme_path.'/layout.css';
$page->add_header_css($css_path);
$css_path = $current_theme_path.'/network_skin.css';
$page->add_header_css($css_path);
$css_path = $current_theme_path.'/edit_skin.css';
$page->add_header_css($css_path);*/
// Currently using the CSS from the live site, due to some problem in merging local and server CSS.
$theme_details = get_user_theme($uid);
if (is_array($theme_details['css_files'])) {
    foreach ($theme_details['css_files'] as $key => $value) {
        $page->add_header_css($value);
    }
}
if (!empty($_GET['msg'])) {
    $message = MessagesHandler::get_message($_GET['msg']);
}
if (!empty($message)) {
    $msg_tpl =& new Template(CURRENT_THEME_FSPATH . "/display_message.tpl");
    $msg_tpl->set('message', $message);
    $page->add_module("middle", "top", $msg_tpl->fetch());
}
// see if we have a user defined CSS
$user_data_ui = sanitize_user_data(User::load_user_profile($uid, $uid, 'ui'));
Esempio n. 6
0
function make_init_params($link)
{
    $params = array();
    $params["theme"] = get_user_theme($link);
    $params["theme_options"] = get_user_theme_options($link);
    $params["sign_progress"] = theme_image($link, "images/indicator_white.gif");
    $params["sign_progress_tiny"] = theme_image($link, "images/indicator_tiny.gif");
    $params["sign_excl"] = theme_image($link, "images/sign_excl.png");
    $params["sign_info"] = theme_image($link, "images/sign_info.png");
    foreach (array("ON_CATCHUP_SHOW_NEXT_FEED", "HIDE_READ_FEEDS", "ENABLE_FEED_CATS", "FEEDS_SORT_BY_UNREAD", "CONFIRM_FEED_CATCHUP", "CDM_AUTO_CATCHUP", "FRESH_ARTICLE_MAX_AGE", "DEFAULT_ARTICLE_LIMIT", "HIDE_READ_SHOWS_SPECIAL", "COMBINED_DISPLAY_MODE") as $param) {
        $params[strtolower($param)] = (int) get_pref($link, $param);
    }
    $params["icons_url"] = ICONS_URL;
    $params["cookie_lifetime"] = SESSION_COOKIE_LIFETIME;
    $params["default_view_mode"] = get_pref($link, "_DEFAULT_VIEW_MODE");
    $params["default_view_limit"] = (int) get_pref($link, "_DEFAULT_VIEW_LIMIT");
    $params["default_view_order_by"] = get_pref($link, "_DEFAULT_VIEW_ORDER_BY");
    $params["bw_limit"] = (int) $_SESSION["bw_limit"];
    $result = db_query($link, "SELECT MAX(id) AS mid, COUNT(*) AS nf FROM\n\t\t\tttrss_feeds WHERE owner_uid = " . $_SESSION["uid"]);
    $max_feed_id = db_fetch_result($result, 0, "mid");
    $num_feeds = db_fetch_result($result, 0, "nf");
    $params["max_feed_id"] = (int) $max_feed_id;
    $params["num_feeds"] = (int) $num_feeds;
    $params["collapsed_feedlist"] = (int) get_pref($link, "_COLLAPSED_FEEDLIST");
    $params["csrf_token"] = $_SESSION["csrf_token"];
    return $params;
}