/** * Constructor * @since Version 3.8.7 * @param string $type */ public function __construct($type = null) { parent::__construct(); $this->Module = new Module("glossary"); if ($type == null) { return $this; } $this->url = new Url(sprintf("%s?mode=type&type=%s", $this->Module->url, $type)); $this->id = $type; switch ($type) { case "code": case "acronym": case "station": $this->name = ucfirst($type . "s"); break; case "slang": case "general": $this->name = ucfirst($type); break; case "term": $this->name = "Terminology"; break; default: $this->name = "General"; break; } }
/** * Constructor * @since Version 3.8.7 * @param string $type */ public function __construct($type = false) { parent::__construct(); $this->Module = new Module("glossary"); if ($type) { $this->url = sprintf("%s?mode=type&type=%s", $this->Module->url, $type); $this->id = $type; switch ($type) { case "code": $this->name = "Codes"; break; case "term": $this->name = "Terminology"; break; case "acronym": $this->name = "Acronyms"; break; case "station": $this->name = "Stations"; break; case "slang": $this->name = "Slang"; break; } } }
/** * Constructor * @since Version 3.8.6 * @param int|string $id */ public function __construct($id = false) { parent::__construct(); if ($id) { $mckey = "railpage:fwlink=" . md5($id); if ($row = getMemcacheObject($mckey)) { $this->id = $row['id']; $this->url = $row['url']; $this->title = $row['title']; } else { if (filter_var($id, FILTER_VALIDATE_INT)) { $query = "SELECT * FROM fwlink WHERE id = ?"; } else { $query = "SELECT * FROM fwlink WHERE url = ?"; } if ($row = $this->db->fetchRow($query, $id)) { $this->id = $row['id']; $this->url = $row['url']; $this->title = $row['title']; setMemcacheObject($mckey, $row, strtotime("+1 month")); } } if (!empty($this->url)) { $this->url_canonical = sprintf("http://%s%s", RP_HOST, $this->url); $this->url_short = sprintf("http://%s/fwlink?id=%d", RP_HOST, $this->id); } } }
/** * Constructor * @since Version 3.9.1 * @param int $correction_id */ public function __construct($correction_id = false) { parent::__construct(); if ($this->id = filter_var($correction_id, FILTER_VALIDATE_INT)) { $this->populate(); } }
/** * Constructor * @since Version 3.8.7 * @param int $id */ public function __construct($id = false) { parent::__construct(); $this->Module = new Module("glossary"); if (filter_var($id, FILTER_VALIDATE_INT)) { $this->id = $id; $this->mckey = sprintf("%s.entry=%d", $this->Module->namespace, $this->id); deleteMemcacheObject($this->mckey); if ($row = getMemcacheObject($this->mckey)) { } else { $query = "SELECT type, short, full, example, date, author FROM glossary WHERE id = ?"; $row = $this->db->fetchRow($query, $this->id); setMemcacheObject($this->mckey, $row); } if (isset($row) && is_array($row)) { $this->name = $row['short']; $this->text = $row['full']; $this->example = $row['example']; $this->Type = new Type($row['type']); $this->url = sprintf("%s?mode=entry&id=%d", $this->Module->url, $this->id); if ($row['date'] == "0000-00-00 00:00:00") { $this->Date = new DateTime(); $this->commit(); } else { $this->Date = new DateTime($row['date']); } $this->Author = new User($row['author']); } } }
/** * Constructor * * @since Version 3.8.7 * * @param string $module */ public function __construct($module) { parent::__construct(); if (!is_string($module)) { return; } $this->Colours = new stdClass(); $this->Colours->primary = "#666"; $this->Colours->accent = "#ddd"; $this->Colours->inverse = "#333"; $module = self::getModuleAlternateName($module); $this->name = ucwords($module); $this->url = self::getModuleUrl($module); if (self::getModuleId($module)) { $this->id = self::getModuleId($module); } switch (strtolower($module)) { case "images.competitions": $this->name = "Photo competitions"; $this->namespace = "railpage.images.competitions"; break; case "locations": $this->Colours->primary = "#116416"; $this->Colours->accent = "#54A759"; $this->Colours->inverse = "#004304"; break; case "locos": $this->Colours->primary = "#3D0CE8"; $this->Colours->accent = "#576BFF"; $this->Colours->inverse = "#1B054E"; break; case "news": $this->Colours->primary = "#8A2E60"; $this->Colours->accent = "#CE8AAF"; $this->Colours->inverse = "#450026"; break; case "privatemessages": $this->name = "Private Messages"; break; } /** * Lazy populate the namespace */ if (empty($this->namespace) && !empty($this->name)) { $this->namespace = sprintf("railpage.%s", strtolower($this->name)); } /** * Lazy populate the URL */ if (empty($this->url) && !empty($this->name)) { $this->url = sprintf("modules.php?name=%s", $this->name); } /** * Create and populate the filesystem paths */ $this->Paths = new stdClass(); $this->Paths->module = sprintf("%s/modules/%s", RP_SITE_ROOT, $this->name); $this->Paths->html = sprintf("%s/modules/%s/html", RP_SITE_ROOT, $this->name); }
/** * Constructor * @since Version 3.9.1 * @param string $url */ public function __construct($url = false) { parent::__construct(); $this->GuzzleClient = new Client(); if ($url) { $this->addFeed($url); } }
/** * Constructor * @since Version 3.9 */ public function __construct() { parent::__construct(); $this->Module = new Module("timetables"); $this->url = new Url($this->Module->url); $this->url->import = sprintf("%s?mode=import", $this->url->url); $this->url->location = sprintf("%s?mode=location", $this->url->url); }
/** * Constructor */ public function __construct() { parent::__construct(); /** * Record this in the debug log */ debug_recordInstance(__CLASS__); }
/** * Constructor */ public function __construct() { parent::__construct(); /** * Record this in the debug log */ Debug::recordInstance(); }
/** * Constructor * @since Version 3.2 * @param string $dir The download directory to use. If null we'll use the preset one. */ public function __construct($dir = null) { parent::__construct(); $this->Module = new Module("Downloads"); if ($dir == null) { $dir = RP_DOWNLOAD_DIR; } $this->dir = $dir; }
/** * Constructor */ public function __construct() { parent::__construct(); Debug::RecordInstance(); /** * Load the Module object */ $this->Module = new Module("glossary"); }
/** * * Constructor * @param object $db * @param int $db * @since Version 3.0 * @version 3.0 * */ public function __construct() { parent::__construct(); foreach (func_get_args() as $arg) { if (filter_var($arg, FILTER_VALIDATE_INT)) { $this->id = $arg; } } }
/** * Constructor * @since Version 3.2 * @param string $dir The download directory to use. If null we'll use the preset one. */ public function __construct($dir = NULL) { parent::__construct(); if (is_null($dir)) { // Try to set the directory $this->dir = RP_DOWNLOAD_DIR; } else { $this->dir = $dir; } }
/** * Constructor * @since Version 3.3 * @param object $db */ public function __construct($db = false, $user = false) { parent::__construct(); $this->Module = new Module("privatemessages"); foreach (func_get_args() as $arg) { if ($arg instanceof User) { $this->setUser($arg); } } }
/** * Constructor * @since Version 3.9.1 * @param int $status_id * @return void */ public function __construct($id = false) { parent::__construct(); if ($id = filter_var($id, FILTER_VALIDATE_INT)) { $this->id = $id; $this->mckey = sprintf("railpage:locos.status=%d", $this->id); $this->populate(); } return; }
/** * Constructor */ public function construct() { parent::__construct(); /** * Record this in the debug log */ if (function_exists("debug_recordInstance")) { debug_recordInstance(__CLASS__); } }
/** * Constructor * @since Version 3.8.7 * @param string $target */ public function __construct($target = false) { parent::__construct(); if (function_exists("getRailpageConfig")) { $this->Config = getRailpageConfig(); } if ($target) { $this->target = $target; } $this->format = "json"; }
/** * Constructor * @since Version 3.9 * @param string $url */ public function __construct($url = false, $provider = "Railway Gazette") { parent::__construct(); $this->Module = new Module("news"); if (is_string($url)) { $this->feed = $url; } if (is_string($provider)) { $this->provider = $provider; } }
/** * Constructor */ public function __construct() { parent::__construct(); $this->Module = new Module("chronicle"); $this->url = new Url(sprintf("%s/chronicle", RP_WEB_ROOT)); $this->url->newest = sprintf("%s?mode=newest", $this->url->url); $this->url->year = sprintf("%s?mode=year", $this->url->url); $this->url->today = sprintf("%s?mode=today", $this->url->url); $this->url->thisweek = sprintf("%s?mode=thisweek", $this->url->url); $this->url->thismonth = sprintf("%s?mode=thismonth", $this->url->url); $this->SubQuery_AllAreas = "SELECT 'locos' AS module, CONCAT(l.loco_num, ': ', dt.loco_date_text) AS title, d.text AS text, timestamp AS `date` FROM loco_unit_date AS d LEFT JOIN loco_unit AS l ON l.loco_id = d.loco_unit_id LEFT JOIN loco_date_type AS dt ON dt.loco_date_id = d.loco_date_id \r\n UNION SELECT 'locations' AS module, dt.name AS title, d.text, d.date FROM location_date AS d LEFT JOIN location_datetypes AS dt ON d.type_id = dt.id \r\n UNION SELECT 'events' AS module, e.title, e.description AS text, ed.date FROM event_dates AS ed LEFT JOIN event AS e ON ed.event_id = e.id"; }
/** * Constructor * @since Version 3.9.1 * @param int|string $id */ public function __construct($id = null) { parent::__construct(); $this->namespace = "railpage.images.collection"; if (!filter_var($id, FILTER_VALIDATE_INT)) { $id = $this->getIdFromSlug($id); } if (filter_var($id, FILTER_VALIDATE_INT)) { $this->id = $id; $this->load(); } }
/** * Constructor * @since Version 3.9 * @param array $params */ public function __construct($params = false) { parent::__construct(); if (is_array($params) && isset($params['oauth_token']) && isset($params['oauth_secret']) && isset($params['api_key'])) { $this->oauthToken = $params['oauth_token']; $this->oauth_secret = $params['oauth_secret']; $this->flickrApiKey = $params['api_key']; $this->cn = new flickr_railpage($this->flickrApiKey); $this->cn->oauth_token = $this->oauthToken; $this->cn->oauth_secret = $this->oauth_secret; $this->cn->cache = false; } }
/** * Constructor */ public function __construct() { parent::__construct(); /** * Record this in the debug log */ if (function_exists("debug_recordInstance")) { debug_recordInstance(__CLASS__); } /** * Load the Module object */ $this->Module = new Module("glossary"); }
/** * Constructor * @since Version 3.8.7 * @param string $url */ public function __construct($url = false, $provider = "pageuppeople", Organisation $Organisation) { parent::__construct(); $this->Module = new Module("jobs"); if (is_string($url)) { $this->feed = $url; } if (is_string($provider)) { $this->provider = $provider; } if ($Organisation instanceof Organisation) { $this->Organisation = $Organisation; } }
/** * Constructor * @since Version 3.9.1 * @param int|string $id */ public function __construct($id = false) { $timer = Debug::getTimer(); parent::__construct(); $this->Module = new Module("locos"); if (filter_var($id, FILTER_VALIDATE_INT)) { $this->id = $id; } elseif (is_string($id) && !empty($id)) { $query = "SELECT gauge_id FROM loco_gauge WHERE slug = ?"; $this->id = $this->db->fetchOne($query, $id); } $this->populate(); Debug::logEvent(__METHOD__, $timer); }
/** * Constructor * @param float $lat * @param float $lon * @param float $radius */ public function __construct($lat = false, $lon = false, $radius = 0.1) { parent::__construct(); $timer = Debug::getTimer(); Debug::RecordInstance(); $this->GuzzleClient = new Client(); if (filter_var($lat, FILTER_VALIDATE_FLOAT) && filter_var($lon, FILTER_VALIDATE_FLOAT)) { $this->lat = $lat; $this->lon = $lon; $this->radius = $radius; $this->url = sprintf("/place?lat=%s&lon=%s", $this->lat, $this->lon); $this->load(); } Debug::logEvent(__METHOD__, $timer); }
/** * Constructor * @since Version 3.8.6 * @param int|string $id */ public function __construct($id = null) { parent::__construct(); if ($id !== null && !filter_var($id, FILTER_VALIDATE_INT)) { $query = "SELECT id FROM fwlink WHERE url = ?"; $newid = $this->db->fetchOne($query, $id); if (filter_var($newid, FILTER_VALIDATE_INT)) { $id = $newid; } } if (filter_var($id, FILTER_VALIDATE_INT)) { $this->id = $id; $this->load(); if (!empty($this->url)) { $this->makeURLs(); } } }
/** * Constructor * @since Version 3.8.7 * @param int $id * @return void */ public function __construct($id = false) { parent::__construct(); if (filter_var($id, FILTER_VALIDATE_INT)) { $this->id = $id; $query = "SELECT * FROM phpbb_warnings WHERE warn_id = ?"; if ($row = $this->db->fetchRow($query, $this->id)) { $this->level = $row['new_warning_level']; $this->adjustment = $row['new_warning_level'] - $row['old_warning_level']; $this->reason = $row['warn_reason']; $this->action = $row['actiontaken']; $this->comments = $row['mod_comments']; $this->Date = new DateTime("@" . $row['warn_date']); $this->Recipient = new User($row['user_id']); $this->Issuer = new User($row['warned_by']); } } }
/** * Constructor * @since Version 3.9 * @param int $id */ public function __construct($id = false) { parent::__construct(); if ($id && filter_var($id, FILTER_VALIDATE_INT)) { $this->id = $id; $query = "SELECT * FROM messages WHERE message_id = ?"; $row = $this->db->fetchRow($query, $this->id); $this->title = isset($row['message_title']) ? $row['message_title'] : ""; $this->text = $row['message_text']; $this->status = $row['message_active']; if ($row['date_start'] != "0000-00-00") { $this->Start = new DateTime($row['date_start']); } if ($row['date_end'] != "0000-00-00") { $this->End = new DateTime($row['date_end']); } $this->makeURLs(); } }
/** * Constructor * @since Version 3.8.7 * @param int|string $id */ public function __construct($id = null) { parent::__construct(); $this->Module = new Module("Gallery"); // Rewrite - some album titles can be all numbers (eg 639, 8203) if ($id != null) { // First, assume that the album ID is a string. Let's try to get the ID from that $query = "SELECT id FROM gallery_mig_album WHERE name = ?"; $this->id = $this->db->fetchOne($query, $id); // If the value returned from the database is false, there's no album // by that name so let's assume the name provided is actually an ID if (!$this->id) { $this->id = $id; } } if (filter_var($this->id, FILTER_VALIDATE_INT)) { $this->mckey = sprintf("railpage:gallery.album=%d", $this->id); if (!($data = $this->Memcached->fetch($this->mckey))) { $query = "SELECT * FROM gallery_mig_album WHERE id = ?"; $data = $this->db->fetchRow($query, $this->id); $this->Memcached->save($this->mckey, $data, strtotime("+1 year")); } $this->name = $data['title']; $this->meta = json_decode($data['meta'], true); $this->owner = $data['owner']; $this->slug = $data['name']; $this->featured_photo_id = $data['featured_photo']; $this->url = new Url(sprintf("%s?album=%s", $this->Module->url, $data['name'])); $this->url->edit = sprintf("%s?album=%s&mode=album.edit", $this->Module->url, $data['name']); $this->url->new = sprintf("%s?mode=album.edit&parent_id=%d", $this->Module->url, $this->id); $this->url->upload = sprintf("%s?album=%s&mode=album.upload", $this->Module->url, $data['name']); if (self::UPDATE_PHOTO) { $data['featured_photo'] = $this->updateFeaturedImage(); $this->Memcached->save($this->mckey, $data, strtotime("+1 year")); } if (isset($data['featured_photo']) && filter_var($data['featured_photo'], FILTER_VALIDATE_INT)) { $this->FeaturedImage = new Image($data['featured_photo']); } } if (!empty($this->id) && !preg_match("/([a-zA-Z]+)/", $this->id)) { $this->id = intval($this->id); } }