Permalink
Browse files

Fixed and improved user ads.

git-svn-id: file:///home/gallir/meneame/svn/src@4421 cbe1a1ec-7179-4919-8e32-4551e8279a00
  • Loading branch information...
1 parent d8205ca commit 3a088ba474687f585d2292386222168ba5a02099 @gallir committed Nov 18, 2014
@@ -2481,8 +2481,9 @@ background:url({{ globals.base_static }}img/common/icon_friend_bi_00.png) no-rep
.ads-interlinks {
height: 90px;
-padding: 0;
-margin: 8px 0 8px 95px;
+max-width: 728px;
+padding: 0 0 0 95px;;
+margin: 10px 0;
white-space:nowrap;
overflow:hidden;
}
@@ -47,7 +47,7 @@ class Link extends LCPBase {
var $clicks = 0;
// sql fields to build an object from mysql
- const SQL = " link_id as id, link_author as author, link_blog as blog, link_status as status, sub_statuses.status as sub_status, sub_statuses.id as sub_status_id, UNIX_TIMESTAMP(sub_statuses.date) as sub_date, link_votes as votes, link_negatives as negatives, link_anonymous as anonymous, link_votes_avg as votes_avg, link_votes + link_anonymous as total_votes, link_comments as comments, link_karma as karma, sub_statuses.karma as sub_karma, link_randkey as randkey, link_url as url, link_uri as uri, link_url_title as url_title, link_title as title, link_tags as tags, link_content as content, UNIX_TIMESTAMP(link_date) as date, UNIX_TIMESTAMP(link_sent_date) as sent_date, UNIX_TIMESTAMP(link_published_date) as published_date, UNIX_TIMESTAMP(link_modified) as modified, link_content_type as content_type, link_ip as ip, link_thumb_status as thumb_status, link_thumb_x as thumb_x, link_thumb_y as thumb_y, link_thumb as thumb, user_login as username, user_email as email, user_avatar as avatar, user_karma as user_karma, user_level as user_level, user_adcode, subs.name as sub_name, subs.id as sub_id, subs.server_name, subs.sub as is_sub, subs.owner as sub_owner, subs.base_url, subs.created_from, subs.allow_main_link, creation.status as sub_status_origen, UNIX_TIMESTAMP(creation.date) as sub_date_origen, subs.color1 as sub_color1, subs.color2 as sub_color2, favorite_link_id as favorite, clicks.counter as clicks, votes.vote_value as voted FROM links
+ const SQL = " link_id as id, link_author as author, link_blog as blog, link_status as status, sub_statuses.status as sub_status, sub_statuses.id as sub_status_id, UNIX_TIMESTAMP(sub_statuses.date) as sub_date, link_votes as votes, link_negatives as negatives, link_anonymous as anonymous, link_votes_avg as votes_avg, link_votes + link_anonymous as total_votes, link_comments as comments, link_karma as karma, sub_statuses.karma as sub_karma, link_randkey as randkey, link_url as url, link_uri as uri, link_url_title as url_title, link_title as title, link_tags as tags, link_content as content, UNIX_TIMESTAMP(link_date) as date, UNIX_TIMESTAMP(link_sent_date) as sent_date, UNIX_TIMESTAMP(link_published_date) as published_date, UNIX_TIMESTAMP(link_modified) as modified, link_content_type as content_type, link_ip as ip, link_thumb_status as thumb_status, link_thumb_x as thumb_x, link_thumb_y as thumb_y, link_thumb as thumb, user_login as username, user_email as email, user_avatar as avatar, user_karma as user_karma, user_level as user_level, user_adcode, user_adchannel, subs.name as sub_name, subs.id as sub_id, subs.server_name, subs.sub as is_sub, subs.owner as sub_owner, subs.base_url, subs.created_from, subs.allow_main_link, creation.status as sub_status_origen, UNIX_TIMESTAMP(creation.date) as sub_date_origen, subs.color1 as sub_color1, subs.color2 as sub_color2, favorite_link_id as favorite, clicks.counter as clicks, votes.vote_value as voted FROM links
INNER JOIN users on (user_id = link_author)
LEFT JOIN sub_statuses ON (@site_id > 0 and sub_statuses.id = @site_id and sub_statuses.link = links.link_id)
LEFT JOIN (sub_statuses as creation, subs) ON (creation.link=links.link_id and creation.id=creation.origen and creation.id=subs.id)
@@ -209,7 +209,7 @@ function save_profile() {
$_POST['adcode'] = trim($_POST['adcode']);
$_POST['adchannel'] = trim($_POST['adchannel']);
if (!empty($_POST['adcode']) && $user->adcode != $_POST['adcode']) {
- if ( !preg_match('/^pub-[0-9]{16}$/', $_POST['adcode'])) {
+ if ( !preg_match('/pub-[0-9]{16}$/', $_POST['adcode'])) {
array_push($messages, _('código AdSense incorrecto, no se ha grabado'));
$_POST['adcode'] = '';
$errors++;
@@ -204,7 +204,7 @@
if ($link->status == 'published' && $link->user_karma > 7 && !empty($link->user_adcode)) {
$globals['do_user_ad'] = $link->user_karma;
$globals['user_adcode'] = $link->user_adcode;
- $globals['user_adchannel'] = $user->adchannel;
+ $globals['user_adchannel'] = $link->user_adchannel;
}
if ($link->status != 'published')
@@ -306,6 +306,13 @@
$link->update_comments();
}
}
+
+ /* Force to show the last ad for anonymous users only */
+ if (! $current_user->user_id) {
+ $counter = $page_size = $globals['comments_page_size'];
+ Haanga::Safe_Load('private/ad-interlinks.html', compact('counter', 'page_size'));
+ }
+
do_comment_pages($link->comments, $current_page, $last_com_first);
if ($link->comments > 5) {
@@ -407,6 +414,8 @@
break;
}
+
+
echo '</div>';
$globals['tag_status'] = $globals['link']->status;
@@ -97,9 +97,9 @@
{% if globals.external_user_ads %}
<p><label for="adcode">{% trans _('codigo AdSense') %}:</label><br/>
- <span class="note">{% trans _('tu código de usuario de AdSense, del tipo pub-123456789') %}</span><br/>
- <input type="text" autocomplete="off" name="adcode" id="adcode" maxlength="20" value="{{ user.adcode }}" /><br />
- <span class="note">{% trans _('canal AdSense (opcional), del tipo 1234567890') %}</span><br/>
+ <span class="note">{% trans _('tu código de usuario de AdSense, del tipo ca-pub-123456789') %}</span><br/>
+ <input type="text" autocomplete="off" name="adcode" id="adcode" maxlength="24" value="{{ user.adcode }}" /><br />
+ <span class="note">{% trans _('ID del anuncio, del tipo 1234567890, de 468x60') %}</span><br/>
<input type="text" autocomplete="off" name="adchannel" id="adchannel" maxlength="12" value="{{ user.adchannel }}" />
</p>
{% endif %}

0 comments on commit 3a088ba

Please sign in to comment.