Merge remote-tracking branch 'friendika/master' into newui
This commit is contained in:
commit
0283cbfcd3
46 changed files with 3080 additions and 1365 deletions
|
@ -344,7 +344,7 @@ function admin_page_site(&$a) {
|
|||
* Users admin page
|
||||
*/
|
||||
function admin_page_users_post(&$a){
|
||||
$pending = ( x(£_POST, 'pending') ? $_POST['pending'] : Array() );
|
||||
$pending = ( x($_POST, 'pending') ? $_POST['pending'] : Array() );
|
||||
$users = ( x($_POST, 'user') ? $_POST['user'] : Array() );
|
||||
|
||||
if (x($_POST,'page_users_block')){
|
||||
|
@ -632,7 +632,7 @@ function admin_page_logs(&$a){
|
|||
|
||||
$f = get_config('system','logfile');
|
||||
$size = filesize($f);
|
||||
if($size > 5000000)
|
||||
if($size > 5000000 || $size < 0)
|
||||
$size = 5000000;
|
||||
|
||||
$data = '';
|
||||
|
|
|
@ -18,15 +18,16 @@ function crepair_post(&$a) {
|
|||
|
||||
$contact = $r[0];
|
||||
|
||||
$nick = ((x($_POST,'nick')) ? $_POST['nick'] : null);
|
||||
$url = ((x($_POST,'url')) ? $_POST['url'] : null);
|
||||
$request = ((x($_POST,'request')) ? $_POST['request'] : null);
|
||||
$confirm = ((x($_POST,'confirm')) ? $_POST['confirm'] : null);
|
||||
$notify = ((x($_POST,'notify')) ? $_POST['notify'] : null);
|
||||
$poll = ((x($_POST,'poll')) ? $_POST['poll'] : null);
|
||||
$nick = ((x($_POST,'nick')) ? $_POST['nick'] : '');
|
||||
$url = ((x($_POST,'url')) ? $_POST['url'] : '');
|
||||
$request = ((x($_POST,'request')) ? $_POST['request'] : '');
|
||||
$confirm = ((x($_POST,'confirm')) ? $_POST['confirm'] : '');
|
||||
$notify = ((x($_POST,'notify')) ? $_POST['notify'] : '');
|
||||
$poll = ((x($_POST,'poll')) ? $_POST['poll'] : '');
|
||||
$attag = ((x($_POST,'attag')) ? $_POST['attag'] : '');
|
||||
|
||||
|
||||
$r = q("UPDATE `contact` SET `nick` = '%s', `url` = '%s', `request` = '%s', `confirm` = '%s', `notify` = '%s', `poll` = '%s'
|
||||
$r = q("UPDATE `contact` SET `nick` = '%s', `url` = '%s', `request` = '%s', `confirm` = '%s', `notify` = '%s', `poll` = '%s', `attag` = '%s'
|
||||
WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
dbesc($nick),
|
||||
dbesc($url),
|
||||
|
@ -34,6 +35,7 @@ function crepair_post(&$a) {
|
|||
dbesc($confirm),
|
||||
dbesc($notify),
|
||||
dbesc($poll),
|
||||
dbesc($attag),
|
||||
intval($contact['id']),
|
||||
local_user()
|
||||
);
|
||||
|
@ -84,6 +86,7 @@ function crepair_content(&$a) {
|
|||
$o .= replace_macros($tpl, array(
|
||||
'$label_name' => t('Name'),
|
||||
'$label_nick' => t('Account Nickname'),
|
||||
'$label_attag' => t('@Tagname - overrides Name/Nickname'),
|
||||
'$label_url' => t('Account URL'),
|
||||
'$label_request' => t('Friend Request URL'),
|
||||
'$label_confirm' => t('Friend Confirm URL'),
|
||||
|
@ -97,6 +100,7 @@ function crepair_content(&$a) {
|
|||
'$confirm' => $contact['confirm'],
|
||||
'$notify' => $contact['notify'],
|
||||
'$poll' => $contact['poll'],
|
||||
'$contact_attag' => $contact['attag'],
|
||||
'$lbl_submit' => t('Submit')
|
||||
));
|
||||
|
||||
|
|
22
mod/item.php
22
mod/item.php
|
@ -332,6 +332,15 @@ function item_post(&$a) {
|
|||
}
|
||||
}
|
||||
|
||||
// embedded bookmark in post? convert to regular url and set bookmark flag
|
||||
|
||||
$bookmark = 0;
|
||||
if(preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/m",$body,$match)) {
|
||||
$bookmark = 1;
|
||||
$body = preg_replace("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/m",'[url=$1]$2[/url]',$body);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fold multi-line [code] sequences
|
||||
*/
|
||||
|
@ -353,7 +362,7 @@ function item_post(&$a) {
|
|||
* and we are replying, and there isn't one already
|
||||
*/
|
||||
|
||||
if(($parent_contact) && ($parent_contact['network'] === 'stat')
|
||||
if(($parent_contact) && ($parent_contact['network'] === NETWORK_OSTATUS)
|
||||
&& ($parent_contact['nick']) && (! in_array('@' . $parent_contact['nick'],$tags))) {
|
||||
$body = '@' . $parent_contact['nick'] . ' ' . $body;
|
||||
$tags[] = '@' . $parent_contact['nick'];
|
||||
|
@ -404,7 +413,8 @@ function item_post(&$a) {
|
|||
);
|
||||
}
|
||||
else {
|
||||
$r = q("SELECT * FROM `contact` WHERE `nick` = '%s' AND `uid` = %d LIMIT 1",
|
||||
$r = q("SELECT * FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1",
|
||||
dbesc($name),
|
||||
dbesc($name),
|
||||
intval($profile_uid)
|
||||
);
|
||||
|
@ -508,6 +518,7 @@ function item_post(&$a) {
|
|||
$datarray['private'] = $private;
|
||||
$datarray['pubmail'] = $pubmail_enable;
|
||||
$datarray['attach'] = $attachments;
|
||||
$datarray['bookmark'] = intval($bookmark);
|
||||
$datarray['thr-parent'] = $thr_parent;
|
||||
|
||||
/**
|
||||
|
@ -550,8 +561,8 @@ function item_post(&$a) {
|
|||
|
||||
$r = q("INSERT INTO `item` (`guid`, `uid`,`type`,`wall`,`gravity`,`contact-id`,`owner-name`,`owner-link`,`owner-avatar`,
|
||||
`author-name`, `author-link`, `author-avatar`, `created`, `edited`, `received`, `changed`, `uri`, `thr-parent`, `title`, `body`, `app`, `location`, `coord`,
|
||||
`tag`, `inform`, `verb`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`, `pubmail`, `attach` )
|
||||
VALUES( '%s', %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s' )",
|
||||
`tag`, `inform`, `verb`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`, `pubmail`, `attach`, `bookmark` )
|
||||
VALUES( '%s', %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d )",
|
||||
dbesc($datarray['guid']),
|
||||
intval($datarray['uid']),
|
||||
dbesc($datarray['type']),
|
||||
|
@ -584,7 +595,8 @@ function item_post(&$a) {
|
|||
dbesc($datarray['deny_gid']),
|
||||
intval($datarray['private']),
|
||||
intval($datarray['pubmail']),
|
||||
dbesc($datarray['attach'])
|
||||
dbesc($datarray['attach']),
|
||||
intval($datarray['bookmark'])
|
||||
);
|
||||
|
||||
$r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' LIMIT 1",
|
||||
|
|
44
mod/localtime.php
Normal file
44
mod/localtime.php
Normal file
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
require_once('include/datetime.php');
|
||||
|
||||
|
||||
function localtime_post(&$a) {
|
||||
|
||||
$t = $_REQUEST['time'];
|
||||
if(! $t)
|
||||
$t = 'now';
|
||||
|
||||
$bd_format = t('l F d, Y \@ g:i A') ; // Friday January 18, 2011 @ 8 AM
|
||||
|
||||
if($_POST['timezone'])
|
||||
$a->data['mod-localtime'] = datetime_convert('UTC',$_POST['timezone'],$t,$bd_format);
|
||||
|
||||
}
|
||||
|
||||
function localtime_content(&$a) {
|
||||
$t = $_REQUEST['time'];
|
||||
if(! $t)
|
||||
$t = 'now';
|
||||
|
||||
$o .= '<h3>' . t('Time Conversion') . '</h3>';
|
||||
|
||||
$o .= '<p>' . t('Friendika provides this service for sharing events with other networks and friends in unknown timezones.') . '</p>';
|
||||
|
||||
|
||||
if(x($a->data,'mod-localtime'))
|
||||
$o .= '<p>' . sprintf( t('Converted localtime: %s'),$a->data['mod-localtime']) . '</p>';
|
||||
|
||||
$o .= '<p>' . sprintf( t('UTC time: %s'), $t) . '</p>';
|
||||
|
||||
$o .= '<form action ="' . $a->get_baseurl() . '/localtime?f=&time=' . $t . '" method="post" >';
|
||||
|
||||
$o .= '<p>' . t('Please select your timezone:') . '</p>';
|
||||
|
||||
$o .= select_timezone();
|
||||
|
||||
$o .= '<input type="submit" name="submit" value="' . t('Submit') . '" /></form>';
|
||||
|
||||
return $o;
|
||||
|
||||
}
|
|
@ -14,10 +14,31 @@ function network_init(&$a) {
|
|||
$a->page['aside'] = '';
|
||||
|
||||
$search = ((x($_GET,'search')) ? escape_tags($_GET['search']) : '');
|
||||
$srchurl = '/network' . ((x($_GET,'cid')) ? '?cid=' . $_GET['cid'] : '') . ((x($_GET,'star')) ? '?star=' . $_GET['star'] : '');
|
||||
$srchurl = '/network'
|
||||
. ((x($_GET,'cid')) ? '?cid=' . $_GET['cid'] : '')
|
||||
. ((x($_GET,'star')) ? '?star=' . $_GET['star'] : '')
|
||||
. ((x($_GET,'bmark')) ? '?bmark=' . $_GET['bmark'] : '');
|
||||
|
||||
if(x($_GET,'save')) {
|
||||
$r = q("select * from `search` where `uid` = %d and `term` = '%s' limit 1",
|
||||
intval(local_user()),
|
||||
dbesc($search)
|
||||
);
|
||||
if(! count($r)) {
|
||||
q("insert into `search` ( `uid`,`term` ) values ( %d, '%s') ",
|
||||
intval(local_user()),
|
||||
dbesc($search)
|
||||
);
|
||||
}
|
||||
}
|
||||
if(x($_GET,'remove')) {
|
||||
q("delete from `search` where `uid` = %d and `term` = '%s' limit 1",
|
||||
intval(local_user()),
|
||||
dbesc($search)
|
||||
);
|
||||
}
|
||||
|
||||
$a->page['aside'] .= search($search,'netsearch-box',$srchurl);
|
||||
$a->page['aside'] .= search($search,'netsearch-box',$srchurl,true);
|
||||
|
||||
$a->page['aside'] .= '<div id="network-new-link">';
|
||||
|
||||
|
@ -49,8 +70,34 @@ function network_init(&$a) {
|
|||
$a->page['aside'] .= '</div>';
|
||||
|
||||
$a->page['aside'] .= group_side('network','network',true,$group_id);
|
||||
|
||||
$a->page['aside'] .= saved_searches();
|
||||
|
||||
}
|
||||
|
||||
function saved_searches() {
|
||||
|
||||
$o = '';
|
||||
|
||||
$r = q("select `term` from `search` WHERE `uid` = %d",
|
||||
intval(local_user())
|
||||
);
|
||||
|
||||
if(count($r)) {
|
||||
$o .= '<h3>' . t('Saved Searches') . '</h3>' . "\r\n";
|
||||
$o .= '<div id="saved-search-list"><ul id="saved-search-ul">' . "\r\n";
|
||||
foreach($r as $rr) {
|
||||
$o .= '<li class="saved-search-li clear"><a href="network/?f=&remove=1&search=' . $rr['term'] . '" class="icon drophide savedsearchdrop" title="' . t('Remove term') . '" onclick="return confirmDelete();" onmouseover="imgbright(this);" onmouseout="imgdull(this);" ></a> <a href="network/?f&search=' . $rr['term'] . '" class="savedsearchterm" >' . $rr['term'] . '</a></li>' . "\r\n";
|
||||
}
|
||||
$o .= '</ul></div>' . "\r\n";
|
||||
}
|
||||
|
||||
return $o;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function network_content(&$a, $update = 0) {
|
||||
|
||||
|
@ -70,6 +117,7 @@ function network_content(&$a, $update = 0) {
|
|||
|
||||
$cid = ((x($_GET['cid'])) ? intval($_GET['cid']) : 0);
|
||||
$star = ((x($_GET['star'])) ? intval($_GET['star']) : 0);
|
||||
$bmark = ((x($_GET['bmark'])) ? intval($_GET['bmark']) : 0);
|
||||
|
||||
if(($a->argc > 2) && $a->argv[2] === 'new')
|
||||
$nouveau = true;
|
||||
|
@ -130,6 +178,7 @@ function network_content(&$a, $update = 0) {
|
|||
. ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '')
|
||||
. ((x($_GET,'search')) ? '&search=' . $_GET['search'] : '')
|
||||
. ((x($_GET,'star')) ? '&star=' . $_GET['star'] : '')
|
||||
. ((x($_GET,'bmark')) ? '&bmark=' . $_GET['bmark'] : '')
|
||||
. "'; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
|
||||
|
||||
}
|
||||
|
@ -151,6 +200,9 @@ function network_content(&$a, $update = 0) {
|
|||
|
||||
$star_sql = (($star) ? " AND `starred` = 1 " : '');
|
||||
|
||||
if($bmark)
|
||||
$star_sql .= " AND `bookmark` = 1 ";
|
||||
|
||||
$sql_extra = " AND `item`.`parent` IN ( SELECT `parent` FROM `item` WHERE `id` = `parent` $star_sql ) ";
|
||||
|
||||
if($group) {
|
||||
|
|
|
@ -13,7 +13,7 @@ function parse_url_content(&$a) {
|
|||
|
||||
$text = null;
|
||||
|
||||
$template = "<br /><a href=\"%s\" >%s</a>%s<br />";
|
||||
$template = "<br /><a class=\"bookmark\" href=\"%s\" >%s</a>%s<br />";
|
||||
|
||||
|
||||
$arr = array('url' => $url, 'text' => '');
|
||||
|
@ -119,6 +119,12 @@ function parse_url_content(&$a) {
|
|||
$text = '<br /><br /><blockquote>' . $text . '</blockquote><br />';
|
||||
}
|
||||
|
||||
echo sprintf($template,$url,($title) ? $title : $url,$text);
|
||||
$title = str_replace("\n",'',$title);
|
||||
|
||||
$result = sprintf($template,$url,($title) ? $title : $url,$text);
|
||||
|
||||
logger('parse_url: returns: ' . $result);
|
||||
|
||||
echo $result;
|
||||
killme();
|
||||
}
|
||||
|
|
|
@ -414,7 +414,8 @@ function photos_post(&$a) {
|
|||
);
|
||||
}
|
||||
else {
|
||||
$r = q("SELECT * FROM `contact` WHERE `nick` = '%s' AND `uid` = %d LIMIT 1",
|
||||
$r = q("SELECT * FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1",
|
||||
dbesc($name),
|
||||
dbesc($name),
|
||||
intval($page_owner_uid)
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue