/** * Constructor * @param array $val Array of key/value pairs */ public function __construct($val) { $this->id = $val["id"]; $this->post_id = $val["post_id"]; $this->author_user_id = $val["author_user_id"]; $this->author_username = $val["author_username"]; $this->author_fullname = $val["author_fullname"]; $this->author_avatar = $val["author_avatar"]; $this->post_text = $val["post_text"]; $this->source = $val["source"]; $this->location = $val["location"]; $this->place = $val["place"]; $this->geo = $val["geo"]; $this->pub_date = $val["pub_date"]; $this->adj_pub_date = $val["adj_pub_date"]; $this->in_reply_to_user_id = $val["in_reply_to_user_id"]; $this->in_reply_to_post_id = $val["in_reply_to_post_id"]; $this->reply_count_cache = $val["reply_count_cache"]; $this->in_retweet_of_post_id = $val["in_retweet_of_post_id"]; $this->retweet_count_cache = $val["retweet_count_cache"]; $this->reply_retweet_distance = $val["reply_retweet_distance"]; $this->is_geo_encoded = $val["is_geo_encoded"]; $this->network = $val["network"]; $this->is_reply_by_friend = PDODAO::convertDBToBool($val["is_reply_by_friend"]); $this->is_retweet_by_friend = PDODAO::convertDBToBool($val["is_retweet_by_friend"]); }
public function __construct($val = false) { parent::__construct($val); $this->id = $val['id']; $this->post_key = $val['post_key']; $this->filter = $val['filter']; $this->standard_resolution_url = $val['standard_resolution_url']; $this->low_resolution_url = $val['low_resolution_url']; $this->thumbnail_url = $val['thumbnail_url']; $this->is_short_video = PDODAO::convertDBToBool($val['is_short_video']); }
/** * Constructor * @param array $val Key/value pairs to construct Owner * @return Owner */ public function __construct($val = false) { if ($val) { $this->id = $val["id"]; $this->full_name = $val["full_name"]; $this->email = $val['email']; $this->last_login = $val['last_login']; $this->is_admin = PDODAO::convertDBToBool($val["is_admin"]); $this->is_activated = PDODAO::convertDBToBool($val["is_activated"]); } }
public function __construct($val = false) { if ($val) { if (isset($val['id'])) { $this->id = $val['id']; } $this->group_id = $val['group_id']; $this->network = $val['network']; $this->group_name = $val['group_name']; $this->is_active = PDODAO::convertDBToBool($val['is_active']); $this->first_seen = $val['first_seen']; $this->last_seen = $val['last_seen']; } }
public function __construct($cfg_vals = null) { try { /* * If the database that the user is trying to install to does not * exist, the parent constructor will throw an exception. If it * does exist, installation will continue. This is so that users * who are trying to install to an already existing database won't * get caught by the CREATE TABLE IF NOT EXISTS statement in the * createInstallDatabase() function (even if the database exists, * the function will return false if you do not have the correct * privileges). */ parent::__construct($cfg_vals); } catch (Exception $e) { //if the database does not exist, create it then continue. if ($this->createInstallDatabase($cfg_vals) === false) { //if something fails in creating the database, throw exception throw new InstallerException($e->getMessage()); } //call the parent constructor to continue the installation. parent::__construct($cfg_vals); } }
public function testGetConnectString() { $this->removeConfigFile(); Config::destroyInstance(); $cfg_values = array("db_host"=>"localhost"); $config = Config::getInstance($cfg_values); $this->assertEqual(PDODAO::getConnectString($config), "mysql:dbname=;host=localhost"); $this->removeConfigFile(); Config::destroyInstance(); $cfg_values = array("db_type" => "mysql", "db_host"=>"localhost", "db_name" => "thinkup"); $config = Config::getInstance($cfg_values); $this->assertEqual(PDODAO::getConnectString($config), "mysql:dbname=thinkup;host=localhost"); $this->removeConfigFile(); Config::destroyInstance(); $cfg_values = array("db_host"=>"localhost", "db_name" => "thinkup", "db_port" => "3306"); $config = Config::getInstance($cfg_values); $this->assertEqual(PDODAO::getConnectString($config), "mysql:dbname=thinkup;host=localhost;port=3306"); $this->removeConfigFile(); Config::destroyInstance(); $cfg_values = array("db_host"=>"localhost", "db_name" => "thinkup", "db_socket" => "/var/mysql"); $config = Config::getInstance($cfg_values); $this->assertEqual(PDODAO::getConnectString($config), "mysql:dbname=thinkup;host=localhost;unix_socket=/var/mysql"); $this->restoreConfigFile(); }
/** * Construct for when no value is passed, i.e. during slipstreaming */ private function constructNoVal() { if (isset($this->other['author_user_id'])) { $this->other['id'] = $this->id; $this->other['post_id'] = $this->post_id; $this->other['network'] = $this->network; $this->container_post = new Post($this->other); } $this->is_image = PDODAO::convertDBToBool($this->is_image); }
public function __construct($row = false) { if ($row) { $this->id = $row['id']; $this->network_user_id = $row['network_user_id']; $this->network_viewer_id = $row['network_viewer_id']; $this->network_username = $row['network_username']; $this->last_post_id = $row['last_post_id']; $this->crawler_last_run = $row['crawler_last_run']; $this->total_posts_by_owner = $row['total_posts_by_owner']; $this->total_posts_in_system = $row['total_posts_in_system']; $this->total_replies_in_system = $row['total_replies_in_system']; $this->total_follows_in_system = $row['total_follows_in_system']; $this->posts_per_day = $row['posts_per_day']; $this->posts_per_week = $row['posts_per_week']; $this->percentage_replies = $row['percentage_replies']; $this->percentage_links = $row['percentage_links']; $this->earliest_post_in_system = $row['earliest_post_in_system']; $this->earliest_reply_in_system = $row['earliest_reply_in_system']; $this->is_archive_loaded_replies = PDODAO::convertDBToBool($row['is_archive_loaded_replies']); $this->is_archive_loaded_follows = PDODAO::convertDBToBool($row['is_archive_loaded_follows']); $this->is_public = PDODAO::convertDBToBool($row['is_public']); $this->is_active = PDODAO::convertDBToBool($row['is_active']); $this->network = $row['network']; $this->favorites_profile = $row['favorites_profile']; $this->owner_favs_in_system = $row['owner_favs_in_system']; } }
/** * Constructor * @param array $val Array of key/value pairs * @return Post */ public function __construct($val) { $this->id = $val["id"]; // a fix for getPost() where the join of the links table column links.id overides the posts.id if (!isset($this->id) && isset($val["post_key"])) { $this->id = $val["post_key"]; } $this->post_id = $val["post_id"]; $this->author_user_id = $val["author_user_id"]; $this->author_username = $val["author_username"]; $this->author_fullname = $val["author_fullname"]; $this->author_avatar = $val["author_avatar"]; $this->post_text = $val["post_text"]; $this->is_protected = PDODAO::convertDBToBool($val["is_protected"]); $this->source = $val["source"]; $this->location = $val["location"]; $this->place = $val["place"]; $this->place_id = $val["place_id"]; $this->geo = $val["geo"]; $this->pub_date = $val["pub_date"]; $this->adj_pub_date = $val["adj_pub_date"]; $this->in_reply_to_user_id = $val["in_reply_to_user_id"]; $this->in_reply_to_post_id = $val["in_reply_to_post_id"]; $this->reply_count_cache = $val["reply_count_cache"]; $this->in_retweet_of_post_id = $val["in_retweet_of_post_id"]; $this->in_rt_of_user_id = $val["in_rt_of_user_id"]; $this->retweet_count_cache = $val["retweet_count_cache"]; $this->retweet_count_api = $val["retweet_count_api"]; $this->old_retweet_count_cache = $val["old_retweet_count_cache"]; $this->reply_retweet_distance = $val["reply_retweet_distance"]; $this->is_geo_encoded = $val["is_geo_encoded"]; $this->network = $val["network"]; $this->is_reply_by_friend = PDODAO::convertDBToBool($val["is_reply_by_friend"]); $this->is_retweet_by_friend = PDODAO::convertDBToBool($val["is_retweet_by_friend"]); $this->favlike_count_cache = $val["favlike_count_cache"]; // favorited is non-persistent. Will be set from xml, but not from database retrieval. if (isset($val["favorited"])) { $this->favorited = $val["favorited"]; } // For the retweet count display, we will use the larger of retweet_count_cache and retweet_count_api, // and add it to old_retweet_count_cache. $largest_native_RT_count = $val['retweet_count_cache']; $this->rt_threshold = 0; // if twitter's reported count is larger, use that if ($val['retweet_count_api'] > $val['retweet_count_cache']) { $largest_native_RT_count = $val['retweet_count_api']; if ($largest_native_RT_count >= self::TWITTER_RT_THRESHOLD) { // if the new RT count, obtained from twitter, has maxed out, set a non-persistent flag field // to indicate this. The templates will make use of this info to add a '+' after the sum if the // flag is set. $this->rt_threshold = 1; } } // non-persistent, used for UI information display $this->all_retweets = $val['old_retweet_count_cache'] + $largest_native_RT_count; }
/** * Disconnector * Caution! This will disconnect for ALL DAOs */ protected final function disconnect() { self::$PDO = null; }
public function __construct($row = false) { if ($row) { $this->id = $row['id']; $this->full_name = $row['full_name']; $this->email = $row['email']; $this->joined = $row['joined']; $this->is_activated = PDODAO::convertDBToBool($row['is_activated']); $this->is_admin = PDODAO::convertDBToBool($row['is_admin']); $this->last_login = $row['last_login']; $this->failed_logins = $row['failed_logins']; $this->account_status = $row['account_status']; $this->api_key = $row['api_key']; $this->api_key_private = $row['api_key_private']; $this->email_notification_frequency = $row['email_notification_frequency']; } }
/** * Constructor * @param array $val Array of key/value pairs * @return Post */ public function __construct($val) { $this->id = $val["id"]; $this->post_id = $val["post_id"]; $this->author_user_id = $val["author_user_id"]; $this->author_username = $val["author_username"]; $this->author_fullname = $val["author_fullname"]; $this->author_avatar = $val["author_avatar"]; $this->post_text = $val["post_text"]; $this->is_protected = PDODAO::convertDBToBool($val["is_protected"]); $this->source = $val["source"]; $this->location = $val["location"]; $this->place = $val["place"]; $this->geo = $val["geo"]; $this->pub_date = $val["pub_date"]; $this->adj_pub_date = $val["adj_pub_date"]; $this->in_reply_to_user_id = $val["in_reply_to_user_id"]; $this->in_reply_to_post_id = $val["in_reply_to_post_id"]; $this->reply_count_cache = $val["reply_count_cache"]; $this->in_retweet_of_post_id = $val["in_retweet_of_post_id"]; $this->in_rt_of_user_id = $val["in_rt_of_user_id"]; $this->retweet_count_cache = $val["retweet_count_cache"]; $this->old_retweet_count_cache = $val["old_retweet_count_cache"]; $this->reply_retweet_distance = $val["reply_retweet_distance"]; $this->is_geo_encoded = $val["is_geo_encoded"]; $this->network = $val["network"]; $this->is_reply_by_friend = PDODAO::convertDBToBool($val["is_reply_by_friend"]); $this->is_retweet_by_friend = PDODAO::convertDBToBool($val["is_retweet_by_friend"]); if (isset($val['is_protected'])) { $this->is_protected = PDODAO::convertDBToBool($val["is_protected"]); } // favorited is non-persistent. Will be set from xml, but not from database retrieval. if (isset($val["favorited"])) { $this->favorited = $val["favorited"]; } // non-persistent, sum of two persistent values, used for UI information display $this->all_retweets = $val['old_retweet_count_cache'] + $val['retweet_count_cache']; if ($val['retweet_count_cache'] >= self::TWITTER_RT_THRESHOLD) { // if the new RT count, obtained from twitter, has maxed out, set a non-persistent flag field // to indicate this. The templates will make use of this info to add a '+' after the sum if the // flag is set. $this->rt_threshold = 1; } else { $this->rt_threshold = 0; } }
/** * Constructor * @param array $val Array of key/value pairs * @return Post */ public function __construct($val) { $this->id = $val["id"]; $this->post_id = $val["post_id"]; $this->author_user_id = $val["author_user_id"]; $this->author_username = $val["author_username"]; $this->author_fullname = $val["author_fullname"]; $this->author_avatar = $val["author_avatar"]; $this->post_text = $val["post_text"]; $this->is_protected = PDODAO::convertDBToBool($val["is_protected"]); $this->source = $val["source"]; $this->location = $val["location"]; $this->place = $val["place"]; $this->geo = $val["geo"]; $this->pub_date = $val["pub_date"]; $this->adj_pub_date = $val["adj_pub_date"]; $this->in_reply_to_user_id = $val["in_reply_to_user_id"]; $this->in_reply_to_post_id = $val["in_reply_to_post_id"]; $this->reply_count_cache = $val["reply_count_cache"]; $this->in_retweet_of_post_id = $val["in_retweet_of_post_id"]; $this->in_rt_of_user_id = $val["in_rt_of_user_id"]; $this->retweet_count_cache = $val["retweet_count_cache"]; $this->old_retweet_count_cache = $val["old_retweet_count_cache"]; $this->reply_retweet_distance = $val["reply_retweet_distance"]; $this->is_geo_encoded = $val["is_geo_encoded"]; $this->network = $val["network"]; $this->is_reply_by_friend = PDODAO::convertDBToBool($val["is_reply_by_friend"]); $this->is_retweet_by_friend = PDODAO::convertDBToBool($val["is_retweet_by_friend"]); if (isset($val['is_protected'])) { $this->is_protected = PDODAO::convertDBToBool($val["is_protected"]); } // favorited is non-persistent. Will be set from xml, but not from database retrieval. if (isset($val["favorited"])) { $this->favorited = $val["favorited"]; } // non-persistent, sum of two persistent values, used for UI information display $this->all_retweets = $val['old_retweet_count_cache'] + $val['retweet_count_cache']; }
public function __construct() { parent::__construct(); $this->stream_conditionals_order = "AND i.filename != 'dashboard' ORDER BY date DESC, emphasis DESC, " . "filename, time_updated DESC, i.id DESC LIMIT :start_on_record, :limit;"; }