function count_mask() { return LegalManager::count(); }
/** * Checks whether we already approved the last version term and condition * @param int user id * @return bool true if we pass false otherwise */ function api_check_term_condition($user_id) { if (api_get_setting('registration.allow_terms_conditions') == 'true') { //check if exists terms and conditions if (LegalManager::count() == 0) { return true; } $extraFieldValue = new ExtraFieldValue('user'); $data = $extraFieldValue->get_values_by_handler_and_field_variable($user_id, 'legal_accept'); if (!empty($data) && isset($data['value'])) { $rowv = $data['value']; $user_conditions = explode(':', $rowv); $version = $user_conditions[0]; $lang_id = $user_conditions[1]; $real_version = LegalManager::get_last_version($lang_id); return $version >= $real_version; } return false; } return false; }
/** * Checks whether we already approved the last version term and condition * @param int user id * @return bool true if we pass false otherwise */ function api_check_term_condition($user_id) { if (api_get_setting('allow_terms_conditions') == 'true') { $t_uf = Database::get_main_table(TABLE_MAIN_USER_FIELD); $t_ufv = Database::get_main_table(TABLE_MAIN_USER_FIELD_VALUES); //check if exists terms and conditions if (LegalManager::count() == 0) { return true; } // Check the last user version_id passed $sql = "SELECT field_value FROM {$t_ufv} ufv inner join {$t_uf} uf on ufv.field_id= uf.id\n WHERE field_value <> '' AND field_variable = 'legal_accept' AND user_id = " . intval($user_id); $res = Database::query($sql); if (Database::num_rows($res) > 0) { $rowv = Database::fetch_row($res); $rowv = $rowv[0]; $user_conditions = explode(':', $rowv); $version = $user_conditions[0]; $lang_id = $user_conditions[1]; $real_version = LegalManager::get_last_version($lang_id); return $version >= $real_version; } return false; } return false; }