| @@ 18-29 (lines=12) @@ | ||
| 15 | /** |
|
| 16 | * {@inheritDoc} |
|
| 17 | */ |
|
| 18 | public function effectively_installed() |
|
| 19 | { |
|
| 20 | $sql = 'SELECT module_id |
|
| 21 | FROM ' . $this->table_prefix . "modules |
|
| 22 | WHERE module_class = 'acp' |
|
| 23 | AND module_langname = 'ACP_PHPBB_ADS_TITLE'"; |
|
| 24 | $result = $this->db->sql_query($sql); |
|
| 25 | $module_id = (int) $this->db->sql_fetchfield('module_id'); |
|
| 26 | $this->db->sql_freeresult($result); |
|
| 27 | ||
| 28 | return $module_id; |
|
| 29 | } |
|
| 30 | ||
| 31 | /** |
|
| 32 | * {@inheritDoc} |
|
| @@ 120-129 (lines=10) @@ | ||
| 117 | * |
|
| 118 | * @return array List of all ads |
|
| 119 | */ |
|
| 120 | public function get_all_ads() |
|
| 121 | { |
|
| 122 | $sql = 'SELECT ad_id, ad_priority, ad_name, ad_enabled, ad_start_date, ad_end_date, ad_views, ad_clicks, ad_views_limit, ad_clicks_limit |
|
| 123 | FROM ' . $this->ads_table; |
|
| 124 | $result = $this->db->sql_query($sql); |
|
| 125 | $data = $this->db->sql_fetchrowset($result); |
|
| 126 | $this->db->sql_freeresult($result); |
|
| 127 | ||
| 128 | return $data; |
|
| 129 | } |
|
| 130 | ||
| 131 | /** |
|
| 132 | * Get all owner's ads |
|
| @@ 137-147 (lines=11) @@ | ||
| 134 | * @param int $user_id Ad owner |
|
| 135 | * @return array List of owner's ads |
|
| 136 | */ |
|
| 137 | public function get_ads_by_owner($user_id) |
|
| 138 | { |
|
| 139 | $sql = 'SELECT ad_id, ad_name, ad_enabled, ad_start_date, ad_end_date, ad_views, ad_views_limit, ad_clicks, ad_clicks_limit |
|
| 140 | FROM ' . $this->ads_table . ' |
|
| 141 | WHERE ad_owner = ' . (int) $user_id; |
|
| 142 | $result = $this->db->sql_query($sql); |
|
| 143 | $data = $this->db->sql_fetchrowset($result); |
|
| 144 | $this->db->sql_freeresult($result); |
|
| 145 | ||
| 146 | return $data; |
|
| 147 | } |
|
| 148 | ||
| 149 | /** |
|
| 150 | * Increment views for specified ads |
|