hits_max < 0) return true; $next_total = count($media_ids); $graph = new Graph(); $end_date = time(); $start_date = $end_date - ($this->hits_days * 86400); $current_total = $graph->get_total_hits($this->user_id, $start_date, $end_date); $next_total += $current_total; debug_event('stream_control_bandwidth', 'Next stream hits will be ' . $next_total . ' / ' . $this->hits_max, 3); return ($next_total <= $this->hits_max); } /** * load * This loads up the data we need into this object, this stuff comes * from the preferences. */ public function load($user) { $user->set_preferences(); $data = $user->prefs; $this->user_id = $user->id; if (intval($data['stream_control_hits_max'])) { $this->hits_max = intval($data['stream_control_hits_max']); } else { $this->hits_max = -1; } if (intval($data['stream_control_hits_days']) > 0) { $this->hits_days = intval($data['stream_control_hits_days']); } else { $this->hits_days = 30; } return true; } // load }