Browse Source

Merge branch 'master', remote-tracking branch 'remotes/upstream/master'

* remotes/upstream/master:
  remove "smilie" expansion for Diaspora logo
  prevent duplicate likes
  quattro: theme settings (a bit hackish)
  add img
  fixes in diabook
  finalise spam storage model, begin driver changes.
  fixes
  template proc: add variable filters

* master:
pull/95/head
Simon L'nu 10 years ago
parent
commit
d647dbc6af
  1. BIN
      images/bug-x.gif
  2. 25
      include/items.php
  3. 4
      include/text.php
  4. 34
      library/spam/b8/storage/storage_frndc.php
  5. BIN
      view/theme/diabook/icons/bug-x.gif
  6. BIN
      view/theme/diabook/icons/community.png
  7. BIN
      view/theme/diabook/icons/dislike.png
  8. BIN
      view/theme/diabook/icons/globe.png
  9. BIN
      view/theme/diabook/icons/language.png
  10. BIN
      view/theme/diabook/icons/like.png
  11. 29
      view/theme/diabook/nav.tpl
  12. 22
      view/theme/diabook/style.css
  13. 46
      view/theme/quattro/theme.php
  14. 11
      view/theme/quattro/theme_settings.tpl

BIN
images/bug-x.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 B

25
include/items.php

@ -1595,6 +1595,14 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
if((activity_match($datarray['verb'],ACTIVITY_LIKE)) || (activity_match($datarray['verb'],ACTIVITY_DISLIKE))) {
$datarray['type'] = 'activity';
$datarray['gravity'] = GRAVITY_LIKE;
// only one like or dislike per person
$r = q("select id from item where uid = %d and `contact-id` = %d and verb ='%s' and deleted = 0 limit 1",
intval($datarray['uid']),
intval($datarray['contact-id']),
dbesc($datarray['verb'])
);
if($r && count($r))
continue;
}
if(($datarray['verb'] === ACTIVITY_TAG) && ($datarray['object-type'] === ACTIVITY_OBJ_TAGTERM)) {
@ -2148,6 +2156,14 @@ function local_delivery($importer,$data) {
$datarray['type'] = 'activity';
$datarray['gravity'] = GRAVITY_LIKE;
$datarray['last-child'] = 0;
// only one like or dislike per person
$r = q("select id from item where uid = %d and `contact-id` = %d and verb ='%s' and deleted = 0 limit 1",
intval($datarray['uid']),
intval($datarray['contact-id']),
dbesc($datarray['verb'])
);
if($r && count($r))
continue;
}
if(($datarray['verb'] === ACTIVITY_TAG) && ($datarray['object-type'] === ACTIVITY_OBJ_TAGTERM)) {
@ -2297,6 +2313,15 @@ function local_delivery($importer,$data) {
if(($datarray['verb'] == ACTIVITY_LIKE) || ($datarray['verb'] == ACTIVITY_DISLIKE)) {
$datarray['type'] = 'activity';
$datarray['gravity'] = GRAVITY_LIKE;
// only one like or dislike per person
$r = q("select id from item where uid = %d and `contact-id` = %d and verb ='%s' and deleted = 0 limit 1",
intval($datarray['uid']),
intval($datarray['contact-id']),
dbesc($datarray['verb'])
);
if($r && count($r))
continue;
}
if(($datarray['verb'] === ACTIVITY_TAG) && ($datarray['object-type'] === ACTIVITY_OBJ_TAGTERM)) {

4
include/text.php

@ -737,7 +737,7 @@ function smilies($s, $sample = false) {
':headdesk',
'~friendika',
'~friendica',
'Diaspora*'
// 'Diaspora*'
);
$icons = array(
@ -778,7 +778,7 @@ function smilies($s, $sample = false) {
'<img src="' . $a->get_baseurl() . '/images/smiley-bangheaddesk.gif" alt=":headdesk" />',
'<a href="http://project.friendika.com">~friendika <img src="' . $a->get_baseurl() . '/images/friendika-16.png" alt="~friendika" /></a>',
'<a href="http://friendica.com">~friendica <img src="' . $a->get_baseurl() . '/images/friendica-16.png" alt="~friendica" /></a>',
'<a href="http://diasporafoundation.org">Diaspora<img src="' . $a->get_baseurl() . '/images/diaspora.png" alt="Diaspora*" /></a>',
// '<a href="http://diasporafoundation.org">Diaspora<img src="' . $a->get_baseurl() . '/images/diaspora.png" alt="Diaspora*" /></a>',
);

34
library/spam/b8/storage/storage_frndc.php

@ -174,20 +174,44 @@ class b8_storage_frndc extends b8_storage_base
array_push($where, $token);
}
$where = 'token IN ("' . implode('", "', $where) . '")';
$where = 'term IN ("' . implode('", "', $where) . '")';
}
else {
$token = dbesc($token);
$where = 'token = "' . $token . '"';
$where = 'term = "' . $token . '"';
}
# ... and fetch the data
$result = q('
SELECT *
FROM ' . $this->config['table_name'] . '
WHERE ' . $where . ' AND uid = ' . $uid );
SELECT * FROM spam WHERE ' . $where . ' AND uid = ' . $uid );
$returned_tokens = array();
if(count($result)) {
foreach($result as $rr)
$returned_tokens[] = $rr['term'];
}
$to_create = array();
if(count($tokens) > 0) {
foreach($tokens as $token)
if(! in_array($token,$returned_tokens))
$to_create[] = str_tolower($token);
}
if(count($to_create)) {
$sql = '';
foreach($to_create as $term) {
if(strlen($sql))
$sql .= ',';
$sql .= sprintf("(term,datetime,uid) values('%s','%s',%d)",
dbesc(str_tolower($term))
dbesc(datetime_convert()),
intval($uid)
);
q("insert into spam " . $sql);
}
return $result;

BIN
view/theme/diabook/icons/bug-x.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 B

BIN
view/theme/diabook/icons/community.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 475 B

BIN
view/theme/diabook/icons/dislike.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 385 B

After

Width:  |  Height:  |  Size: 386 B

BIN
view/theme/diabook/icons/globe.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 875 B

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
view/theme/diabook/icons/language.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 849 B

BIN
view/theme/diabook/icons/like.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 393 B

After

Width:  |  Height:  |  Size: 388 B

29
view/theme/diabook/nav.tpl

@ -1,6 +1,7 @@
<header>
{# $langselector version 0.01#}
<div id="site-location">$sitelocation</div>
<div id="banner">$banner</div>
</header>
@ -53,7 +54,15 @@
<li class="empty">$emptynotifications</li>
</ul>
</li>
{{ endif }}
{{ endif }}
{{ if $nav.search}}
<li id="search-box">
<form method="get" action="$nav.search.0">
<input id="search-text" class="nav-menu-search" type="text" value="" name="search">
</form>
</li>
{{ endif }}
<li id="nav-site-linkmenu" class="nav-menu-icon"><a href="#" rel="#nav-site-menu"><span class="icon s22 gear">Site</span></a>
<ul id="nav-site-menu" class="menu-popup">
@ -61,7 +70,13 @@
{{ if $nav.help }} <li><a class="$nav.help.2" target="friendika-help" href="$nav.help.0" title="$nav.help.3" >$nav.help.1</a></li>{{ endif }}
<li><a class="$nav.search.2" href="$nav.search.0" title="$nav.search.3" >$nav.search.1</a></li>
<li ><a class="$nav.community.2" href="$nav.community.0" title="$nav.community.3" >$nav.community.1</a></li>
<li><a class="$nav.search.2" href="$nav.search.0" title="$nav.search.3" >$nav.search.1</a></li>
<li><a class="$nav.search.2" href="friendica" title="About" >About</a></li>
{{ if $nav.settings }}<li><a class="menu-sep $nav.settings.2" href="$nav.settings.0" title="$nav.settings.3">$nav.settings.1</a></li>{{ endif }}
{{ if $nav.admin }}<li><a class="$nav.admin.2" href="$nav.admin.0" title="$nav.admin.3" >$nav.admin.1</a></li>{{ endif }}
@ -123,6 +138,12 @@
</nav>
<div style="position: fixed; bottom: 5px; left: 25px;">$langselector</div>
<div style="position: fixed; bottom: 7px; left: 5px;"><a href="http://pad.toktan.org/p/diabook" target="blank" ><img src="images/bug-x.gif" title="Fehlerreport für das Theme diaBook erstellen"></a></div>
<a class="$nav.login.2" href="$nav.login.0" title="$nav.login.3" >$nav.login.1</a>
<ul id="nav-notifications-template" style="display:none;" rel="template">

22
view/theme/diabook/style.css

@ -91,6 +91,8 @@
background-image: url("../../../view/theme/diabook/icons/notify.png");}
.icon.messages {
background-image: url("../../../view/theme/diabook/icons/messages.png");}
.icon.community {
background-image: url("../../../view/theme/diabook/icons/community.png");}
.icon.drop { background-image: url("../../../view/theme/diabook/icons/drop.png");}
.icon.drophide { background-image: url("../../../view/theme/diabook/icons/drop.png");}
@ -106,6 +108,7 @@
.icon.lock { background-image: url("../../../view/theme/diabook/icons/lock.png");}
.icon.unlock { background-image: url("../../../view/theme/diabook/icons/unlock.png");}
.icon.isstar { background-image: url("../../../view/theme/diabook/icons/isstar.png");}
.icon.language { background-image: url("../../../view/theme/diabook/icons/language.png");}
.camera { background-image: url("../../../view/theme/diabook/icons/camera.png");
@ -170,7 +173,7 @@
.youtube { background-position: -130px -40px;}
/*.attach { background-position: -190px -40px;}*/
.language { background-position: -210px -40px;}
/*.language { background-position: -210px -40px;}*/
.icon.on { background-image: url("../../../view/theme/diabook/icons/toogle_on.png"); background-repeat: no-repeat;}
@ -526,7 +529,7 @@ header #banner a:hover {
color: #ffffff;
text-decoration: none;
outline: none;
vertical-align: bottom;
vertical-align: middle;
}
header #banner #logo-img {
height: 25px;
@ -610,12 +613,19 @@ nav #logo-text {
margin-top: 3px;
margin-right: 15px;
}
nav .nav-menu-search {
position: relative;
margin: 3px 17px;
margin-right: 0px;
height: 17px;
}
nav .nav-menu-icon {
position: relative;
height: 22px;
padding: 5px;
margin: 0px 12px;
margin: 0px 7px;
-moz-border-radius: 5px 5px 0 0;
-webkit-border-radius: 5px 5px 0 0;
border-radius: 5px 5px 0 0;
@ -1181,6 +1191,7 @@ section {
color: #999999;
border: 1px solid #DDD;
padding: 0.3em;
font-size: 14px;
}
.wall-item-comment-wrapper .comment-edit-text-full {
font-size: 14px;
@ -1329,9 +1340,9 @@ section {
margin: 0px 2em 20px 0px;
}
#profile-jot-form #profile-jot-text {
height: 3.0em;
height: 2.0em;
width: 99%;
font-size: 10px;
font-size: 15px;
color: #999999;
border: 1px solid #DDD;
padding: 0.3em;
@ -1528,6 +1539,7 @@ section {
float: right;
margin-left: 10px;
margin-top: 2px;
font-size: 10px;
}
#profile-jot-perms{
float: right;

46
view/theme/quattro/theme.php

@ -0,0 +1,46 @@
<?php
$a->hooks[] = array('plugin_settings', 'view/theme/quattro/theme.php', 'quattro_settings');
$a->hooks[] = array('plugin_settings_post', 'view/theme/quattro/theme.php', 'quattro_settings_post');
function quattro_settings(&$a, &$o){
if(!local_user())
return;
$align = get_pconfig(local_user(), 'quattro', 'align' );
$t = file_get_contents( dirname(__file__). "/theme_settings.tpl" );
$o .= replace_macros($t, array(
'$submit' => t('Submit'),
'$baseurl' => $a->get_baseurl(),
'$title' => t("Theme settings"),
'$align' => array('quattro_align', t('Alignment'), $align, '', array('left'=>t('Left'), 'center'=>t('Center'))),
));
}
function quattro_settings_post(&$a){
if(! local_user())
return;
if (isset($_POST['quattro-settings-submit'])){
set_pconfig(local_user(), 'quattro', 'align', $_POST['quattro_align']);
}
goaway($a->get_baseurl()."/settings/addon");
}
$quattro_align = get_pconfig(local_user(), 'quattro', 'align' );
if(local_user() && $quattro_align=="center"){
$a->page['htmlhead'].="
<style>
html { width: 100%; margin:0px; padding:0px; }
body {
margin: 50px auto;
width: 900px;
}
</style>
";
}

11
view/theme/quattro/theme_settings.tpl

@ -0,0 +1,11 @@
<div class="settings-block">
<h3 class="settings-heading">$title</h3>
{{inc field_select.tpl with $field=$align}}{{endinc}}
<div class="settings-submit-wrapper">
<input type="submit" value="$submit" class="settings-submit" name="quattro-settings-submit" />
</div>
</div>
Loading…
Cancel
Save