From d70109427a14adcb4920a96951482863288f8fa4 Mon Sep 17 00:00:00 2001 From: rusefi Date: Wed, 6 May 2020 16:27:01 -0400 Subject: [PATCH] 5 bytes of progress --- phpbb/rusefi/web/config/services.yml | 1 + phpbb/rusefi/web/event/listener.php | 15 ++++++++++++++- phpbb/rusefi/web/rusEFI_car.png | Bin 0 -> 1230 bytes phpbb/rusefi/web/service/utils.php | 10 ++++++++++ ...ewtopic_body_postrow_custom_fields_after.html | 4 +++- 5 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 phpbb/rusefi/web/rusEFI_car.png diff --git a/phpbb/rusefi/web/config/services.yml b/phpbb/rusefi/web/config/services.yml index 0eda66c..6c2fc1d 100644 --- a/phpbb/rusefi/web/config/services.yml +++ b/phpbb/rusefi/web/config/services.yml @@ -8,6 +8,7 @@ services: - @request - @template - @user + - '@rusefi.web.utils' tags: - { name: event.listener } rusefi.web.utils: diff --git a/phpbb/rusefi/web/event/listener.php b/phpbb/rusefi/web/event/listener.php index 7fccd10..c3c6659 100644 --- a/phpbb/rusefi/web/event/listener.php +++ b/phpbb/rusefi/web/event/listener.php @@ -29,16 +29,22 @@ class listener implements EventSubscriberInterface /** @var \phpbb\user */ protected $user; + /** @var \rusefi\web\service\utils */ + protected $utils; + public function __construct( \phpbb\config\config $config, \phpbb\request\request $request, \phpbb\template\template $template, - \phpbb\user $user) + \phpbb\user $user, + \rusefi\web\service\utils $utils + ) { $this->config = $config; $this->request = $request; $this->template = $template; $this->user = $user; + $this->utils = $utils; } /** @@ -112,6 +118,13 @@ class listener implements EventSubscriberInterface */ public function viewtopic_modify_post_row($event) { + $user_id = $event['poster_id']; + + $count_vehicles = $this->utils->count_vehicles($user_id); + + $event['post_row'] = array_merge($event['post_row'],array( + 'U_COUNT' => $count_vehicles, + )); } public function profile_vehicles_list($event) diff --git a/phpbb/rusefi/web/rusEFI_car.png b/phpbb/rusefi/web/rusEFI_car.png new file mode 100644 index 0000000000000000000000000000000000000000..6363344e315a3a14b90175a92f50ad50cd1cef2c GIT binary patch literal 1230 zcmV;<1Tp)GP)e zSad^gZEa<4bO1wgWnpw>WFU8GbZ8()Nlj2!fese{00cHkL_t(Y$90v>j}%oD#eer! z^~ZGg3qM%+1lFjD2f0O5hPMn1Q5V+z}+b} zVLv=89xu+_9dpOb$SudsiB&ZO9xm?fLBIgVm16}oSCXXdmUP< zc-}=zb=Z3dFE=o=2mTRN6fk#CLE1^jRl>#YW-h&L?8+C|)(SH5DEY=kqJ9L6%RYoB6+De}DsNF^pKS21(a+{uaHkyE%gv8x}F4SGd+ zhDt2NAwhgNfR6+NJ1h9+cjQyY=u;(GTOqr-glw*pZ`>qnZIEk>&oAOz7w|jR0>MJk zLpkG)bdtoiXs|dRz}i)8^;^94GyZRkME~N|azKv-`WD!vIiBU{o(6acnRx|iK8Ni; zPG-ZqaHNxTJkp5%AD5`z_!#rMNK`cL$~Ht1gCwK9vBSR8hv{6p36&C!$tvFKqeo{$ z^BITY1CrE{IHERD!aT#;T@b-7MN%L#td)QY zo^+9ZOy1Avb~EZ_A$Di~0YxVV+-P@*Gp$l;zK;L%B}=!u_*#lNR1P;de4vJR1|W*e zPa>Hhvr|~o3uS3GNZJ{{{d$+#O!&P5i$@xideEsXP^pxO-JQ0z?#s+P{Tl1CkNJs-08p;ik>_7x zaPf1jyM!5JbI;Iu>l5-k50aA5k`QLTn`3U2mM_!(=3UBNrJKUw$rnkQ2Wd`D2AQ^6 zEf1ccY_F}bcHt|CVx~`?VgArjD&_J+XTQ6Xr303K`Wm^lM0Dg7m4i<(H#ZxMC(n_c zogE+gftk_m^)NH)wHlR5<$f>l2OSI`>2^tyggnccp57CN-whnx?8@l!z3; z3nv>J1G_W2XPJf-<+I$v9Sp~G(K sN>Itr_J;wT|26$^>0`kQ(>F8z1IuUC*!eawnE(I)07*qoM6N<$g5mHt^8f$< literal 0 HcmV?d00001 diff --git a/phpbb/rusefi/web/service/utils.php b/phpbb/rusefi/web/service/utils.php index 126c41a..263f22e 100644 --- a/phpbb/rusefi/web/service/utils.php +++ b/phpbb/rusefi/web/service/utils.php @@ -62,6 +62,16 @@ class utils setcookie('rusefi_token', $uid, time() + 365 * 24 * 60 * 60, '/', '.rusefi.com', true); } + public function count_vehicles($user_id) { + $sql = 'SELECT count(*) as count + FROM ' . 'msqur_engines' . ' ' . 'WHERE user_id = ' . (int) $user_id; + + $result = $this->db->sql_query($sql); + $data = $this->db->sql_fetchrow(); + $this->db->sql_freeresult($result); + + return $data['count']; + } public function get_token($user_id) { diff --git a/phpbb/rusefi/web/styles/prosilver/template/event/viewtopic_body_postrow_custom_fields_after.html b/phpbb/rusefi/web/styles/prosilver/template/event/viewtopic_body_postrow_custom_fields_after.html index eefc9ef..7642a01 100644 --- a/phpbb/rusefi/web/styles/prosilver/template/event/viewtopic_body_postrow_custom_fields_after.html +++ b/phpbb/rusefi/web/styles/prosilver/template/event/viewtopic_body_postrow_custom_fields_after.html @@ -1 +1,3 @@ -.2 \ No newline at end of file +{% if postrow.U_COUNT %} + +{% endif %} \ No newline at end of file