[dev] [commit] r1035 - patches phplib templates/zepu

automailer at dexonline.ro automailer at dexonline.ro
Fri Nov 1 17:38:37 EET 2013


Author: cata
Date: Fri Nov  1 17:38:37 2013
New Revision: 1035

Log:
Quick hack to allow us to hide banners to donors.
No UI for setting the expiration time stamp -- need to set it from MySQL:

update User set noAdsUntil = unix_timestamp(curdate() + interval 1 year) where email = '...';

Added:
   patches/00104.sql
Modified:
   phplib/util.php
   templates/zepu/index.ihtml

Added: patches/00104.sql
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ patches/00104.sql	Fri Nov  1 17:38:37 2013	(r1035)
@@ -0,0 +1 @@
+alter table User add noAdsUntil int not null default 0;

Modified: phplib/util.php
==============================================================================
--- phplib/util.php	Fri Nov  1 17:03:05 2013	(r1034)
+++ phplib/util.php	Fri Nov  1 17:38:37 2013	(r1035)
@@ -438,7 +438,13 @@
 }
 
 function util_suggestNoBanner() {
-  return isset($_SERVER['REQUEST_URI']) ? preg_match('/(masturba|fute)/', $_SERVER['REQUEST_URI']) : 0;
+  if (isset($_SERVER['REQUEST_URI']) && preg_match('/(masturba|fute)/', $_SERVER['REQUEST_URI'])) {
+    return true; // No banners on certain obscene pages
+  }
+  if (session_getUser() && session_getUser()->noAdsUntil > time()) {
+    return true; // User is an active donor
+  }
+  return false;
 }
 
 function util_fetchUrl($url) {

Modified: templates/zepu/index.ihtml
==============================================================================
--- templates/zepu/index.ihtml	Fri Nov  1 17:03:05 2013	(r1034)
+++ templates/zepu/index.ihtml	Fri Nov  1 17:38:37 2013	(r1035)
@@ -5,7 +5,7 @@
   {include file="zepu/search.ihtml" advancedSearch=0}
 </div>
 
-{if $skinVariables.afterSearchBoxBanner}
+{if !$suggestNoBanner && $skinVariables.afterSearchBoxBanner}
   {include file="common/bits/banner.ihtml" id="mainPage" width="728" height="90"}
 {/if}
 


More information about the Dev mailing list