/** * Output user account tools based on current status & location. * @since 2.1.0 * @version 2.1.0 * @return void */ function user_account() { global $hc_cfg, $hc_lang_user; if (user_is_new()) { echo ' <p class="new_user_notice">' . $hc_lang_user['NewUserNotice'] . '</p>'; user_manage_account(); } else { $user_com = isset($_GET['sec']) ? cIn(strip_tags($_GET['sec'])) : ''; switch ($user_com) { case 'list': user_manage_events(); break; case 'edit': user_manage_account(); break; default: user_manage_welcome(); break; } } }
/** * Render the HTML on the page necessary for rendering a graph to the user. * * @param $graph = array( * 'graph_type' => $id, * 'width' => 8, * 'height' => 4, * 'page_order' => 0, * 'days' => $days, * 'id' => 0, * 'arg0_resolved' => $name, * 'delta' => $delta, * 'public' => true, * 'no_technicals' => true, * ); * @param $include_user_hash if true, include user_id and user_hash in the graph data, necessary for * graphs that require user authentication; default is false */ function render_graph_new($graph, $include_user_hash = false) { global $_rendered_graph_contents; if (!$_rendered_graph_contents) { // calculate the relevant text for outofdate indicators $title = ""; if (user_logged_in()) { $user = get_user(user_id()); $plural_hours = plural("hour", user_is_new($user) ? get_site_config('refresh_queue_hours_premium') : get_premium_value($user, "refresh_queue_hours")); if ($user['is_first_report_sent']) { $title = t("This graph will take up to :hours to be updated with recently added or removed accounts.", array(':hours' => $plural_hours)); } else { if ($user['has_added_account']) { $title = t("As a new user, it will take up to :hours for this graph to be populated with initial data.", array(':hours' => $plural_hours)); } else { $title = t("You need to add some account data for this graph to display."); } } } ?> <div id="graph_contents_template" style="display:none;"> <div class="graph_headings"> <h1 class="h1"></h1> <h2 class="h2"></h2> <h2 class="graph_title"> <a href=""></a> </h2> <span class="outofdate" style="display:none;" title="<?php echo htmlspecialchars($title); ?> "></span> <span class="subheading"></span> <span class="last-updated"></span> <ul class="graph_controls"> <li class="move_up"><a><?php echo ht("Move up"); ?> </a></li> <li class="move_down"><a><?php echo ht("Move down"); ?> </a></li> <li class="remove"><a><?php echo ht("Remove"); ?> </a></li> <li class="edit"><a><?php echo ht("Edit"); ?> </a></li> </ul> <div class="edit_target" style="display:none;"> <ul class="graph_edit_controls"> <li class="close"><a><?php echo ht("Close"); ?> </a></li> </ul> </div> </div> <div class="graph-target"><span class="status_loading"><?php echo ht("Loading..."); ?> </span></div> <div class="graph_extra extra" style="display:none;"><a href="#"></a></span></div> <div class="admin-stats-wrapper hide-admin"><span class="admin-stats render_time"></span></div> </div> <div id="graph_table_template" class="overflow_wrapper extra-text-container" style="display:none;"> <table class="standard graph_table"> </table> </div> <?php } if (user_logged_in()) { $user = get_user(user_id()); $graph['can_be_edited'] = !($user['graph_managed_type'] == 'auto' && isset($graph['is_managed']) && $graph['is_managed']); } if (isset($graph['page_id']) && isset($graph['id'])) { $graph['move_up_link'] = url_for('profile', array('page' => $graph['page_id'], 'move_up' => $graph['id'])); $graph['move_down_link'] = url_for('profile', array('page' => $graph['page_id'], 'move_down' => $graph['id'])); $graph['remove_link'] = url_for('profile', array('page' => $graph['page_id'], 'remove' => $graph['id'])); } if (isset($graph['id']) && $graph['id']) { $graph_id = "graph_" . $graph['id']; } else { $graph_id = "graph_" . rand(0, 0xffff); } $graph['target'] = $graph_id; $graph['graphWidth'] = get_site_config('default_graph_width') * $graph['width']; $graph['computedWidth'] = $graph['graphWidth']; $graph['graphHeight'] = get_site_config('default_graph_height') * $graph['height']; $graph['computedHeight'] = $graph['graphHeight'] + 30; // if we are logged in, also provide the user ID and computed user hash, to verify that we can // correctly access this graph (also means that we don't have to initialise sessions on the API) if ($include_user_hash && user_logged_in()) { $graph['user_id'] = user_id(); $graph['user_hash'] = compute_user_graph_hash(get_user(user_id())); } // enable demo if necessary if (require_get("demo", false)) { $graph['demo'] = true; } // we set the widths and heights initially here so that the page layout doesn't move around // a lot as the graphs are loaded via AJAX $inline_styles = "overflow: hidden; width: " . $graph['computedWidth'] . "px; height: " . $graph['computedHeight'] . "px;"; switch ($graph['graph_type']) { case "linebreak": case "heading": // don't render anything! this rendering is handled by profile.php return; case "calculator": // a special case for the Calculator widget; it doesn't seem a good idea to // have this as an API call that returns a mixture of HTML and Javascript ?> <div id="<?php echo htmlspecialchars($graph_id); ?> " class="graph graph_calculator" style="<?php echo $inline_styles; ?> "> <div class="graph_headings"> <h2 class="graph_title"><?php echo ht("Currency converter"); ?> </h2> </div> <div class="graph-target"> <?php require __DIR__ . "/../pages/_calculator.php"; ?> </div> </div> <script type="text/javascript"> $(document).ready(function() { Graphs.render(<?php echo json_encode($graph); ?> , true /* static graph */); initialise_calculator($("#<?php echo htmlspecialchars($graph_id); ?> ")) }); </script> <?php return; } // 'overflow: hidden;' is to fix a Chrome rendering bug ?> <div id="<?php echo htmlspecialchars($graph_id); ?> " class="graph" style="<?php echo $inline_styles; ?> "></div> <script type="text/javascript"> Graphs.render(<?php echo json_encode($graph); ?> ); </script> <?php }
global $add_type_names; return strcmp(strtolower($add_type_names[$a]), strtolower($add_type_names[$b])); } usort($add_types, '_sort_by_exchange_name'); $account_data = null; ?> <div class="page_accounts"> <?php if ($account_type['wizard'] != 'offsets') { ?> <p> <?php $extra_hours = (int) (get_site_config('new_user_premium_update_hours') - (time() - strtotime($user['created_at'])) / (60 * 60)); echo t("As a :user, your :titles should be updated at least once every :hours:extra.", array(':user' => $user['is_premium'] ? ht("premium user") : (user_is_new($user) ? ht("new user") : link_to(url_for('premium'), t("free user"))), ':titles' => $account_type['accounts'], ':hours' => plural("hour", user_is_new($user) ? get_site_config('refresh_queue_hours_premium') : get_premium_value($user, "refresh_queue_hours")), ':extra' => user_is_new($user) && !$user['is_premium'] ? " " . t("(for the next :hours)", array(':hours' => plural("hour", $extra_hours))) : "")); ?> </p> <?php } ?> <h2><?php echo t("Your :titles", array(':titles' => $account_type['titles'])); ?> </h2> <?php require __DIR__ . "/_sort_buttons.php"; ?>