mirror of
https://github.com/friendica/friendica
synced 2024-10-11 22:14:34 +02:00
Merge commit 'upstream/master'
This commit is contained in:
commit
9243c9fc14
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -13,6 +13,9 @@ addon
|
|||
#ignore documentation, it should be newly built
|
||||
doc/api
|
||||
|
||||
#ignore reports, should be generted with every build
|
||||
report/
|
||||
|
||||
#ignore config files from eclipse, we don't want IDE files in our repository
|
||||
.project
|
||||
.buildpath
|
||||
|
|
|
@ -5,6 +5,9 @@ AddType audio/ogg .oga
|
|||
<FilesMatch "\.(out|log)$">
|
||||
Deny from all
|
||||
</FilesMatch>
|
||||
<Files "(include|library)">
|
||||
Deny from all
|
||||
</Files>
|
||||
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine on
|
||||
|
|
45
boot.php
45
boot.php
|
@ -9,8 +9,8 @@ require_once('include/nav.php');
|
|||
require_once('include/cache.php');
|
||||
|
||||
define ( 'FRIENDICA_PLATFORM', 'Friendica');
|
||||
define ( 'FRIENDICA_VERSION', '2.3.1277' );
|
||||
define ( 'DFRN_PROTOCOL_VERSION', '2.22' );
|
||||
define ( 'FRIENDICA_VERSION', '2.3.1281' );
|
||||
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
|
||||
define ( 'DB_UPDATE_VERSION', 1131 );
|
||||
|
||||
define ( 'EOL', "<br />\r\n" );
|
||||
|
@ -379,11 +379,22 @@ class App {
|
|||
|
||||
$scheme = $this->scheme;
|
||||
|
||||
if(x($this->config,'ssl_policy')) {
|
||||
if(($ssl) || ($this->config['ssl_policy'] == SSL_POLICY_FULL))
|
||||
$scheme = 'https';
|
||||
if(($this->config['ssl_policy'] == SSL_POLICY_SELFSIGN) && (local_user() || x($_POST,'auth-params')))
|
||||
if((x($this->config,'system')) && (x($this->config['system'],'ssl_policy'))) {
|
||||
if($this->config['system']['ssl_policy'] == SSL_POLICY_FULL)
|
||||
$scheme = 'https';
|
||||
|
||||
// We need to populate the $ssl flag across the entire program before turning this on.
|
||||
// Basically, we'll have $ssl = true on any links which can only be seen by a logged in user
|
||||
// (and also the login link). Anything seen by an outsider will have it turned off.
|
||||
// At present, setting SSL_POLICY_SELFSIGN will only force remote contacts to update their
|
||||
// contact links to this site with "http:" if they are currently using "https:"
|
||||
|
||||
// if($this->config['system']['ssl_policy'] == SSL_POLICY_SELFSIGN) {
|
||||
// if($ssl)
|
||||
// $scheme = 'https';
|
||||
// else
|
||||
// $scheme = 'http';
|
||||
// }
|
||||
}
|
||||
|
||||
$this->baseurl = $scheme . "://" . $this->hostname . ((isset($this->path) && strlen($this->path)) ? '/' . $this->path : '' );
|
||||
|
@ -685,6 +696,7 @@ function get_guid($size=16) {
|
|||
|
||||
if(! function_exists('login')) {
|
||||
function login($register = false, $hiddens=false) {
|
||||
$a = get_app();
|
||||
$o = "";
|
||||
$reg = false;
|
||||
if ($register) {
|
||||
|
@ -704,23 +716,26 @@ function login($register = false, $hiddens=false) {
|
|||
|
||||
}
|
||||
|
||||
$dest_url = $a->get_baseurl(true) . '/' . $a->query_string;
|
||||
|
||||
$o .= replace_macros($tpl,array(
|
||||
'$logout' => t('Logout'),
|
||||
'$login' => t('Login'),
|
||||
|
||||
'$dest_url' => $dest_url,
|
||||
'$logout' => t('Logout'),
|
||||
'$login' => t('Login'),
|
||||
|
||||
'$lname' => array('username', t('Nickname or Email address: ') , '', ''),
|
||||
'$lpassword' => array('password', t('Password: '), '', ''),
|
||||
|
||||
'$openid' => !$noid,
|
||||
'$lopenid' => array('openid_url', t('Or login using OpenID: '),'',''),
|
||||
'$lopenid' => array('openid_url', t('Or login using OpenID: '),'',''),
|
||||
|
||||
'$hiddens' => $hiddens,
|
||||
'$hiddens' => $hiddens,
|
||||
|
||||
'$register' => $reg,
|
||||
'$register' => $reg,
|
||||
|
||||
'$lostpass' => t('Forgot your password?'),
|
||||
'$lostlink' => t('Password Reset'),
|
||||
'$lostpass' => t('Forgot your password?'),
|
||||
'$lostlink' => t('Password Reset'),
|
||||
));
|
||||
|
||||
call_hooks('login_hook',$o);
|
||||
|
@ -1209,7 +1224,7 @@ function current_theme(){
|
|||
$a = get_app();
|
||||
|
||||
$system_theme = ((isset($a->config['system']['theme'])) ? $a->config['system']['theme'] : '');
|
||||
$theme_name = ((is_array($_SESSION) && x($_SESSION,'theme')) ? $_SESSION['theme'] : $system_theme);
|
||||
$theme_name = ((isset($_SESSION) && x($_SESSION,'theme')) ? $_SESSION['theme'] : $system_theme);
|
||||
|
||||
if($theme_name && file_exists('view/theme/' . $theme_name . '/style.css'))
|
||||
return($theme_name);
|
||||
|
@ -1335,7 +1350,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){
|
|||
array(
|
||||
'label' => t('Profile'),
|
||||
'url' => $url.'/?tab=profile',
|
||||
'sel' => (($tab=='profile')?'active':''),
|
||||
'sel' => ((isset($tab) && $tab=='profile')?'active':''),
|
||||
),
|
||||
array(
|
||||
'label' => t('Photos'),
|
||||
|
|
46
build.xml
46
build.xml
|
@ -1,14 +1,49 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<project name="friendica" default="test">
|
||||
|
||||
<!-- ====================================================== -->
|
||||
<!-- Target: clean-test -->
|
||||
<!-- deletes directories with old test reports -->
|
||||
<!-- ====================================================== -->
|
||||
<target name="clean-test">
|
||||
<delete dir="report" />
|
||||
</target>
|
||||
|
||||
<!-- ====================================================== -->
|
||||
<!-- Target: prepare-test -->
|
||||
<!-- creates directories for test reports -->
|
||||
<!-- ====================================================== -->
|
||||
<target name="prepare-test" depends="clean-test">
|
||||
<mkdir dir="report" />
|
||||
</target>
|
||||
|
||||
<!-- =================================== -->
|
||||
<!-- Target: test -->
|
||||
<!-- this target runs all test files -->
|
||||
<!-- =================================== -->
|
||||
|
||||
<target name="test">
|
||||
<!-- there are no tests by now, so, nothing to do -->
|
||||
<target name="test" depends="prepare-test">
|
||||
<!-- coverage-setup database="./report/coverage-database">
|
||||
<fileset dir=".">
|
||||
<include name="**/*.php" />
|
||||
<exclude name="*test.php"/>
|
||||
<exclude name="index.php"/>
|
||||
<exclude name="library/**"/>
|
||||
<exclude name="doc/**"/>
|
||||
<exclude name=".."/>
|
||||
</fileset>
|
||||
</coverage-setup -->
|
||||
<phpunit printsummary="true">
|
||||
<batchtest>
|
||||
<fileset dir="tests">
|
||||
<include name="*test.php" />
|
||||
</fileset>
|
||||
</batchtest>
|
||||
<formatter type="xml" todir="report" outfile="testlog.xml" />
|
||||
</phpunit>
|
||||
<phpunitreport infile="report/testlog.xml" todir="report" />
|
||||
<!-- coverage-report outfile="report/coverage-database">
|
||||
<report todir="report" styledir="/home/phing/etc" />
|
||||
</coverage-report -->
|
||||
</target>
|
||||
|
||||
<!-- ===================================================== -->
|
||||
|
@ -31,6 +66,9 @@
|
|||
<docblox title="Friendica API" destdir="./doc/api">
|
||||
<fileset dir=".">
|
||||
<include name="**/*.php" />
|
||||
<include name="README"/>
|
||||
<include name="INSTALL.txt"/>
|
||||
<include name="LICENSE"/>
|
||||
</fileset>
|
||||
</docblox>
|
||||
</target>
|
||||
|
|
|
@ -75,4 +75,33 @@ function networks_widget($baseurl,$selected = '') {
|
|||
));
|
||||
}
|
||||
|
||||
function fileas_widget($baseurl,$selected = '') {
|
||||
$a = get_app();
|
||||
if(! local_user())
|
||||
return '';
|
||||
|
||||
$saved = get_pconfig(local_user(),'system','filetags');
|
||||
if(! strlen($saved))
|
||||
return;
|
||||
|
||||
$matches = false;
|
||||
$terms = array();
|
||||
$cnt = preg_match_all('/\[(.*?)\]/',$saved,$matches,PREG_SET_ORDER);
|
||||
if($cnt) {
|
||||
foreach($matches as $mtch) {
|
||||
$unescaped = file_tag_decode($mtch[1]);
|
||||
$terms[] = array('name' => $unescaped,'selected' => (($selected == $unescaped) ? 'selected' : ''));
|
||||
}
|
||||
}
|
||||
|
||||
return replace_macros(get_markup_template('fileas_widget.tpl'),array(
|
||||
'$title' => t('File Selections'),
|
||||
'$desc' => '',
|
||||
'$sel_all' => (($selected == '') ? 'selected' : ''),
|
||||
'$all' => t('Everything'),
|
||||
'$terms' => $terms,
|
||||
'$base' => $baseurl,
|
||||
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -186,6 +186,8 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
|
|||
|
||||
require_once('bbcode.php');
|
||||
|
||||
$ssl_state = ((local_user()) ? true : false);
|
||||
|
||||
$profile_owner = 0;
|
||||
$page_writeable = false;
|
||||
|
||||
|
@ -345,7 +347,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
|
|||
'like' => '',
|
||||
'dislike' => '',
|
||||
'comment' => '',
|
||||
'conv' => (($preview) ? '' : array('href'=> $a->get_baseurl() . '/display/' . $nickname . '/' . $item['id'], 'title'=> t('View in context'))),
|
||||
'conv' => (($preview) ? '' : array('href'=> $a->get_baseurl($ssl_state) . '/display/' . $nickname . '/' . $item['id'], 'title'=> t('View in context'))),
|
||||
'previewing' => $previewing,
|
||||
'wait' => t('Please wait'),
|
||||
);
|
||||
|
@ -375,7 +377,8 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
|
|||
$comments[$item['parent']] = 1;
|
||||
else
|
||||
$comments[$item['parent']] += 1;
|
||||
}
|
||||
} elseif(! x($comments,$item['parent']))
|
||||
$comments[$item['parent']] = 0; // avoid notices later on
|
||||
}
|
||||
|
||||
// map all the like/dislike activities for each parent item
|
||||
|
@ -460,7 +463,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
|
|||
$comment_lastcollapsed = true;
|
||||
}
|
||||
|
||||
$redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ;
|
||||
$redirect_url = $a->get_baseurl($ssl_state) . '/redir/' . $item['cid'] ;
|
||||
|
||||
$lock = ((($item['private']) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid'])
|
||||
|| strlen($item['deny_cid']) || strlen($item['deny_gid']))))
|
||||
|
@ -542,7 +545,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
|
|||
}
|
||||
|
||||
$edpost = (((($profile_owner == local_user()) && ($toplevelpost) && (intval($item['wall']) == 1)) || ($mode === 'notes'))
|
||||
? array($a->get_baseurl()."/editpost/".$item['id'], t("Edit"))
|
||||
? array($a->get_baseurl($ssl_state)."/editpost/".$item['id'], t("Edit"))
|
||||
: False);
|
||||
|
||||
|
||||
|
@ -559,24 +562,28 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
|
|||
);
|
||||
|
||||
$star = false;
|
||||
$filer = false;
|
||||
|
||||
$isstarred = "unstarred";
|
||||
if ($profile_owner == local_user() && $toplevelpost) {
|
||||
$isstarred = (($item['starred']) ? "starred" : "unstarred");
|
||||
if ($profile_owner == local_user()) {
|
||||
if($toplevelpost) {
|
||||
$isstarred = (($item['starred']) ? "starred" : "unstarred");
|
||||
|
||||
$star = array(
|
||||
'do' => t("add star"),
|
||||
'undo' => t("remove star"),
|
||||
'toggle' => t("toggle star status"),
|
||||
'classdo' => (($item['starred']) ? "hidden" : ""),
|
||||
'classundo' => (($item['starred']) ? "" : "hidden"),
|
||||
'starred' => t('starred'),
|
||||
'tagger' => t("add tag"),
|
||||
'classtagger' => "",
|
||||
);
|
||||
$star = array(
|
||||
'do' => t("add star"),
|
||||
'undo' => t("remove star"),
|
||||
'toggle' => t("toggle star status"),
|
||||
'classdo' => (($item['starred']) ? "hidden" : ""),
|
||||
'classundo' => (($item['starred']) ? "" : "hidden"),
|
||||
'starred' => t('starred'),
|
||||
'tagger' => t("add tag"),
|
||||
'classtagger' => "",
|
||||
);
|
||||
}
|
||||
$filer = t("file as");
|
||||
}
|
||||
|
||||
|
||||
|
||||
$photo = $item['photo'];
|
||||
$thumb = $item['thumb'];
|
||||
|
||||
|
@ -670,6 +677,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
|
|||
'edpost' => $edpost,
|
||||
'isstarred' => $isstarred,
|
||||
'star' => $star,
|
||||
'filer' => $filer,
|
||||
'drop' => $drop,
|
||||
'vote' => $likebuttons,
|
||||
'like' => $like,
|
||||
|
@ -691,7 +699,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
|
|||
|
||||
$page_template = get_markup_template("conversation.tpl");
|
||||
$o .= replace_macros($page_template, array(
|
||||
'$baseurl' => $a->get_baseurl(),
|
||||
'$baseurl' => $a->get_baseurl($ssl_state),
|
||||
'$mode' => $mode,
|
||||
'$user' => $a->user,
|
||||
'$threads' => $threads,
|
||||
|
@ -701,7 +709,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
|
|||
return $o;
|
||||
}}
|
||||
|
||||
function best_link_url($item,&$sparkle) {
|
||||
function best_link_url($item,&$sparkle,$ssl_state = false) {
|
||||
|
||||
$a = get_app();
|
||||
|
||||
|
@ -713,7 +721,7 @@ function best_link_url($item,&$sparkle) {
|
|||
if((local_user()) && (local_user() == $item['uid'])) {
|
||||
if(isset($a->contacts) && x($a->contacts,$clean_url)) {
|
||||
if($a->contacts[$clean_url]['network'] === NETWORK_DFRN) {
|
||||
$best_url = $a->get_baseurl() . '/redir/' . $a->contacts[$clean_url]['id'];
|
||||
$best_url = $a->get_baseurl($ssl_state) . '/redir/' . $a->contacts[$clean_url]['id'];
|
||||
$sparkle = true;
|
||||
}
|
||||
else
|
||||
|
@ -734,10 +742,14 @@ function best_link_url($item,&$sparkle) {
|
|||
if(! function_exists('item_photo_menu')){
|
||||
function item_photo_menu($item){
|
||||
$a = get_app();
|
||||
|
||||
if (local_user() && (! count($a->contacts)))
|
||||
load_contact_links(local_user());
|
||||
|
||||
$ssl_state = false;
|
||||
|
||||
if(local_user()) {
|
||||
$ssl_state = true;
|
||||
if(! count($a->contacts))
|
||||
load_contact_links(local_user());
|
||||
}
|
||||
$contact_url="";
|
||||
$pm_url="";
|
||||
$status_link="";
|
||||
|
@ -745,7 +757,7 @@ function item_photo_menu($item){
|
|||
$posts_link="";
|
||||
|
||||
$sparkle = false;
|
||||
$profile_link = best_link_url($item,$sparkle);
|
||||
$profile_link = best_link_url($item,$sparkle,$ssl_state);
|
||||
if($profile_link === 'mailbox')
|
||||
$profile_link = '';
|
||||
|
||||
|
@ -754,7 +766,7 @@ function item_photo_menu($item){
|
|||
$status_link = $profile_link . "?url=status";
|
||||
$photos_link = $profile_link . "?url=photos";
|
||||
$profile_link = $profile_link . "?url=profile";
|
||||
$pm_url = $a->get_baseurl() . '/message/new/' . $cid;
|
||||
$pm_url = $a->get_baseurl($ssl_state) . '/message/new/' . $cid;
|
||||
}
|
||||
else {
|
||||
if(local_user() && local_user() == $item['uid'] && link_compare($item['url'],$item['author-link'])) {
|
||||
|
@ -765,8 +777,8 @@ function item_photo_menu($item){
|
|||
}
|
||||
}
|
||||
if(($cid) && (! $item['self'])) {
|
||||
$contact_url = $a->get_baseurl() . '/contacts/' . $cid;
|
||||
$posts_link = $a->get_baseurl() . '/network/?cid=' . $cid;
|
||||
$contact_url = $a->get_baseurl($ssl_state) . '/contacts/' . $cid;
|
||||
$posts_link = $a->get_baseurl($ssl_state) . '/network/?cid=' . $cid;
|
||||
}
|
||||
|
||||
$menu = Array(
|
||||
|
@ -802,7 +814,7 @@ function like_puller($a,$item,&$arr,$mode) {
|
|||
if((activity_match($item['verb'],$verb)) && ($item['id'] != $item['parent'])) {
|
||||
$url = $item['author-link'];
|
||||
if((local_user()) && (local_user() == $item['uid']) && ($item['network'] === 'dfrn') && (! $item['self']) && (link_compare($item['author-link'],$item['url']))) {
|
||||
$url = $a->get_baseurl() . '/redir/' . $item['contact-id'];
|
||||
$url = $a->get_baseurl(true) . '/redir/' . $item['contact-id'];
|
||||
$sparkle = ' class="sparkle" ';
|
||||
}
|
||||
if(! ((isset($arr[$item['parent'] . '-l'])) && (is_array($arr[$item['parent'] . '-l']))))
|
||||
|
@ -864,7 +876,7 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
|
|||
|
||||
$a->page['htmlhead'] .= replace_macros($tpl, array(
|
||||
'$newpost' => 'true',
|
||||
'$baseurl' => $a->get_baseurl(),
|
||||
'$baseurl' => $a->get_baseurl(true),
|
||||
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
|
||||
'$geotag' => $geotag,
|
||||
'$nickname' => $x['nickname'],
|
||||
|
@ -873,6 +885,7 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
|
|||
'$vidurl' => t("Please enter a video link/URL:"),
|
||||
'$audurl' => t("Please enter an audio link/URL:"),
|
||||
'$term' => t('Tag term:'),
|
||||
'$fileas' => t('File as:'),
|
||||
'$whereareu' => t('Where are you right now?'),
|
||||
'$title' => t('Enter a title for this item')
|
||||
));
|
||||
|
@ -914,8 +927,8 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
|
|||
|
||||
$o .= replace_macros($tpl,array(
|
||||
'$return_path' => $a->cmd,
|
||||
'$action' => $a->get_baseurl().'/item',
|
||||
'$share' => (($x['button']) ? $x['button'] : t('Share')),
|
||||
'$action' => $a->get_baseurl(true) . '/item',
|
||||
'$share' => (x($x,'button') ? $x['button'] : t('Share')),
|
||||
'$upload' => t('Upload photo'),
|
||||
'$shortupload' => t('upload photo'),
|
||||
'$attach' => t('Attach file'),
|
||||
|
@ -938,7 +951,7 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
|
|||
'$ptyp' => (($notes_cid) ? 'note' : 'wall'),
|
||||
'$content' => '',
|
||||
'$post_id' => '',
|
||||
'$baseurl' => $a->get_baseurl(),
|
||||
'$baseurl' => $a->get_baseurl(true),
|
||||
'$defloc' => $x['default_location'],
|
||||
'$visitor' => $x['visitor'],
|
||||
'$pvisit' => (($notes_cid) ? 'none' : $x['visitor']),
|
||||
|
@ -980,8 +993,8 @@ function conv_sort($arr,$order) {
|
|||
usort($parents,'sort_thr_commented');
|
||||
|
||||
if(count($parents))
|
||||
foreach($parents as $x)
|
||||
$x['children'] = array();
|
||||
foreach($parents as $i=>$_x)
|
||||
$parents[$i]['children'] = array();
|
||||
|
||||
foreach($arr as $x) {
|
||||
if($x['id'] != $x['parent']) {
|
||||
|
|
|
@ -163,7 +163,7 @@ function bbtoevent($s) {
|
|||
if(preg_match("/\[event\-adjust\](.*?)\[\/event\-adjust\]/is",$s,$match))
|
||||
$ev['adjust'] = $match[1];
|
||||
$match = '';
|
||||
$ev['nofinish'] = (($ev['start'] && (!x($ev, 'finish') || !$ev['finish'])) ? 1 : 0);
|
||||
$ev['nofinish'] = (((x($ev, 'start') && $ev['start']) && (!x($ev, 'finish') || !$ev['finish'])) ? 1 : 0);
|
||||
return $ev;
|
||||
|
||||
}
|
||||
|
|
|
@ -682,7 +682,7 @@ function item_store($arr,$force_parent = false) {
|
|||
unset($arr['dsprsig']);
|
||||
}
|
||||
|
||||
if($arr['gravity'])
|
||||
if(x($arr, 'gravity'))
|
||||
$arr['gravity'] = intval($arr['gravity']);
|
||||
elseif($arr['parent-uri'] === $arr['uri'])
|
||||
$arr['gravity'] = 0;
|
||||
|
@ -742,6 +742,7 @@ function item_store($arr,$force_parent = false) {
|
|||
|
||||
if($arr['parent-uri'] === $arr['uri']) {
|
||||
$parent_id = 0;
|
||||
$parent_deleted = 0;
|
||||
$allow_cid = $arr['allow_cid'];
|
||||
$allow_gid = $arr['allow_gid'];
|
||||
$deny_cid = $arr['deny_cid'];
|
||||
|
@ -800,6 +801,8 @@ function item_store($arr,$force_parent = false) {
|
|||
logger('item_store: item parent was not found - ignoring item');
|
||||
return 0;
|
||||
}
|
||||
|
||||
$parent_deleted = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1043,6 +1046,21 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
|
|||
if(! $rino_enable)
|
||||
$rino = 0;
|
||||
|
||||
$ssl_val = intval(get_config('system','ssl_policy'));
|
||||
$ssl_policy = '';
|
||||
switch($ssl_val){
|
||||
case SSL_POLICY_FULL:
|
||||
$ssl_policy = 'full';
|
||||
break;
|
||||
case SSL_POLICY_SELFSIGN:
|
||||
$ssl_policy = 'self';
|
||||
break;
|
||||
case SSL_POLICY_NONE:
|
||||
default:
|
||||
$ssl_policy = 'none';
|
||||
break;
|
||||
}
|
||||
|
||||
$url = $contact['notify'] . '&dfrn_id=' . $idtosend . '&dfrn_version=' . DFRN_PROTOCOL_VERSION . (($rino) ? '&rino=1' : '');
|
||||
|
||||
logger('dfrn_deliver: ' . $url);
|
||||
|
@ -1115,6 +1133,8 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
|
|||
$postvars['perm'] = 'r';
|
||||
}
|
||||
|
||||
$postvars['ssl_policy'] = $ssl_policy;
|
||||
|
||||
if($rino && $rino_allowed && (! $dissolve)) {
|
||||
$key = substr(random_string(),0,16);
|
||||
$data = bin2hex(aes_encrypt($postvars['data'],$key));
|
||||
|
|
|
@ -8,6 +8,8 @@ function nav(&$a) {
|
|||
*
|
||||
*/
|
||||
|
||||
$ssl_state = ((local_user()) ? true : false);
|
||||
|
||||
if(!(x($a->page,'nav')))
|
||||
$a->page['nav'] = '';
|
||||
|
||||
|
@ -27,7 +29,7 @@ function nav(&$a) {
|
|||
|
||||
$myident = ((is_array($a->user) && isset($a->user['nickname'])) ? $a->user['nickname'] . '@' : '');
|
||||
|
||||
$sitelocation = $myident . substr($a->get_baseurl(),strpos($a->get_baseurl(),'//') + 2 );
|
||||
$sitelocation = $myident . substr($a->get_baseurl($ssl_state),strpos($a->get_baseurl($ssl_state),'//') + 2 );
|
||||
|
||||
|
||||
// nav links: array of array('href', 'text', 'extra css classes', 'title')
|
||||
|
@ -53,7 +55,7 @@ function nav(&$a) {
|
|||
// user info
|
||||
$r = q("SELECT micro FROM contact WHERE uid=%d AND self=1", intval($a->user['uid']));
|
||||
$userinfo = array(
|
||||
'icon' => (count($r) ? $r[0]['micro']: $a->get_baseurl()."/images/default-profile-mm.jpg"),
|
||||
'icon' => (count($r) ? $r[0]['micro']: $a->get_baseurl($ssl_state)."/images/default-profile-mm.jpg"),
|
||||
'name' => $a->user['username'],
|
||||
);
|
||||
|
||||
|
@ -76,7 +78,7 @@ function nav(&$a) {
|
|||
if(($a->config['register_policy'] == REGISTER_OPEN) && (! local_user()) && (! remote_user()))
|
||||
$nav['register'] = array('register',t('Register'), "", t('Create an account'));
|
||||
|
||||
$help_url = $a->get_baseurl() . '/help';
|
||||
$help_url = $a->get_baseurl($ssl_state) . '/help';
|
||||
|
||||
if(! get_config('system','hide_help'))
|
||||
$nav['help'] = array($help_url, t('Help'), "", t('Help and documentation'));
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
function oembed_replacecb($matches){
|
||||
logger('oembedcb');
|
||||
// logger('oembedcb');
|
||||
$embedurl=$matches[1];
|
||||
$j = oembed_fetch_url($embedurl);
|
||||
$s = oembed_format_object($j);
|
||||
|
@ -14,6 +14,9 @@ function oembed_fetch_url($embedurl){
|
|||
|
||||
$txt = Cache::get($embedurl);
|
||||
|
||||
// These media files should now be caught in bbcode.php
|
||||
// left here as a fallback in case this is called from another source
|
||||
|
||||
$noexts = array("mp3","mp4","ogg","ogv","oga","ogm","webm");
|
||||
$ext = pathinfo(strtolower($embedurl),PATHINFO_EXTENSION);
|
||||
|
||||
|
@ -62,7 +65,7 @@ function oembed_fetch_url($embedurl){
|
|||
|
||||
function oembed_format_object($j){
|
||||
$embedurl = $j->embedurl;
|
||||
$jhtml = oembed_iframe($j->embedurl,$j->width,$j->height );
|
||||
$jhtml = oembed_iframe($j->embedurl,(isset($j->width) ? $j->width : null), (isset($j->height) ? $j->height : null) );
|
||||
$ret="<span class='oembed ".$j->type."'>";
|
||||
switch ($j->type) {
|
||||
case "video": {
|
||||
|
|
|
@ -288,3 +288,49 @@ function item_permissions_sql($owner_id,$remote_verified = false,$groups = null)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* Functions used to protect against Cross-Site Request Forgery
|
||||
* The security token has to base on at least one value that an attacker can't know - here it's the session ID and the private key.
|
||||
* In this implementation, a security token is reusable (if the user submits a form, goes back and resubmits the form, maybe with small changes;
|
||||
* or if the security token is used for ajax-calls that happen several times), but only valid for a certain amout of time (3hours).
|
||||
* The "typename" seperates the security tokens of different types of forms. This could be relevant in the following case:
|
||||
* A security token is used to protekt a link from CSRF (e.g. the "delete this profile"-link).
|
||||
* If the new page contains by any chance external elements, then the used security token is exposed by the referrer.
|
||||
* Actually, important actions should not be triggered by Links / GET-Requests at all, but somethimes they still are,
|
||||
* so this mechanism brings in some damage control (the attacker would be able to forge a request to a form of this type, but not to forms of other types).
|
||||
*/
|
||||
function get_form_security_token($typename = "") {
|
||||
$a = get_app();
|
||||
|
||||
$timestamp = time();
|
||||
$sec_hash = hash('whirlpool', $a->user["guid"] . $a->user["prvkey"] . session_id() . $timestamp . $typename);
|
||||
|
||||
return $timestamp . "." . $sec_hash;
|
||||
}
|
||||
|
||||
function check_form_security_token($typename = "", $formname = 'form_security_token') {
|
||||
if (!x($_REQUEST, $formname)) return false;
|
||||
$hash = $_REQUEST[$formname];
|
||||
|
||||
$max_livetime = 10800; // 3 hours
|
||||
|
||||
$a = get_app();
|
||||
|
||||
$x = explode(".", $hash);
|
||||
if (time() > (IntVal($x[0]) + $max_livetime)) return false;
|
||||
|
||||
$sec_hash = hash('whirlpool', $a->user["guid"] . $a->user["prvkey"] . session_id() . $x[0] . $typename);
|
||||
|
||||
return ($sec_hash == $x[1]);
|
||||
}
|
||||
|
||||
function check_form_security_std_err_msg() {
|
||||
return t('The form security token was not correct. This probably happened because the form has been opened for too long (>3 hours) before subitting it.') . EOL;
|
||||
}
|
||||
function check_form_security_token_redirectOnErr($err_redirect, $typename = "", $formname = 'form_security_token') {
|
||||
if (!check_form_security_token($typename, $formname)) {
|
||||
$a = get_app();
|
||||
notice( check_form_security_std_err_msg() );
|
||||
goaway($a->get_baseurl() . $err_redirect );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,8 +80,13 @@
|
|||
*/
|
||||
private function _replcb_for($args){
|
||||
$m = array_map('trim', explode(" as ", $args[2]));
|
||||
list($keyname, $varname) = explode("=>",$m[1]);
|
||||
if (is_null($varname)) { $varname=$keyname; $keyname=""; }
|
||||
$x = explode("=>",$m[1]);
|
||||
if (count($x) == 1) {
|
||||
$varname = $x[0];
|
||||
$keyname = "";
|
||||
} else {
|
||||
list($keyname, $varname) = $x;
|
||||
}
|
||||
if ($m[0]=="" || $varname=="" || is_null($varname)) die("template error: 'for ".$m[0]." as ".$varname."'") ;
|
||||
//$vals = $this->r[$m[0]];
|
||||
$vals = $this->_get_var($m[0]);
|
||||
|
|
101
include/text.php
101
include/text.php
|
@ -874,6 +874,7 @@ function link_compare($a,$b) {
|
|||
if(! function_exists('prepare_body')) {
|
||||
function prepare_body($item,$attach = false) {
|
||||
|
||||
$a = get_app();
|
||||
call_hooks('prepare_body_init', $item);
|
||||
|
||||
$cache = get_config('system','itemcache');
|
||||
|
@ -926,6 +927,33 @@ function prepare_body($item,$attach = false) {
|
|||
}
|
||||
$s .= '<div class="clear"></div></div>';
|
||||
}
|
||||
$matches = false;
|
||||
$cnt = preg_match_all('/<(.*?)>/',$item['file'],$matches,PREG_SET_ORDER);
|
||||
if($cnt) {
|
||||
// logger('prepare_text: categories: ' . print_r($matches,true), LOGGER_DEBUG);
|
||||
foreach($matches as $mtch) {
|
||||
if(strlen($x))
|
||||
$x .= ',';
|
||||
$x .= file_tag_decode($mtch[1]);
|
||||
}
|
||||
if(strlen($x))
|
||||
$s .= '<div class="categorytags"><span>' . t('Categories:') . ' </span>' . $x . '</div>';
|
||||
|
||||
|
||||
}
|
||||
$matches = false;
|
||||
$x = '';
|
||||
$cnt = preg_match_all('/\[(.*?)\]/',$item['file'],$matches,PREG_SET_ORDER);
|
||||
if($cnt) {
|
||||
// logger('prepare_text: filed_under: ' . print_r($matches,true), LOGGER_DEBUG);
|
||||
foreach($matches as $mtch) {
|
||||
if(strlen($x))
|
||||
$x .= ' ';
|
||||
$x .= file_tag_decode($mtch[1]). ' <a href="' . $a->get_baseurl() . '/filerm/' . $item['id'] . '?f=&term=' . file_tag_decode($mtch[1]) . '" title="' . t('remove') . '" >' . t('[remove]') . '</a>';
|
||||
}
|
||||
if(strlen($x) && (local_user() == $item['uid']))
|
||||
$s .= '<div class="filesavetags"><span>' . t('Filed under:') . ' </span>' . $x . '</div>';
|
||||
}
|
||||
|
||||
$prep_arr = array('item' => $item, 'html' => $s);
|
||||
call_hooks('prepare_body_final', $prep_arr);
|
||||
|
@ -1248,4 +1276,77 @@ function item_post_type($item) {
|
|||
return t('post');
|
||||
}
|
||||
|
||||
// post categories and "save to file" use the same item.file table for storage.
|
||||
// We will differentiate the different uses by wrapping categories in angle brackets
|
||||
// and save to file categories in square brackets.
|
||||
// To do this we need to escape these characters if they appear in our tag.
|
||||
|
||||
function file_tag_encode($s) {
|
||||
return str_replace(array('<','>','[',']'),array('%3c','%3e','%5b','%5d'),$s);
|
||||
}
|
||||
|
||||
function file_tag_decode($s) {
|
||||
return str_replace(array('%3c','%3e','%5b','%5d'),array('<','>','[',']'),$s);
|
||||
}
|
||||
|
||||
function file_tag_file_query($table,$s,$type = 'file') {
|
||||
if($type == 'file')
|
||||
$str = preg_quote( '[' . file_tag_encode($s) . ']' );
|
||||
else
|
||||
$str = preg_quote( '<' . file_tag_encode($s) . '>' );
|
||||
return " AND " . (($table) ? dbesc($table) . '.' : '') . "file regexp '" . dbesc($str) . "' ";
|
||||
}
|
||||
|
||||
function file_tag_save_file($uid,$item,$file) {
|
||||
$result = false;
|
||||
if(! intval($uid))
|
||||
return false;
|
||||
$r = q("select file from item where id = %d and uid = %d limit 1",
|
||||
intval($item),
|
||||
intval($uid)
|
||||
);
|
||||
if(count($r)) {
|
||||
if(! stristr($r[0]['file'],'[' . file_tag_encode($file) . ']'))
|
||||
q("update item set file = '%s' where id = %d and uid = %d limit 1",
|
||||
dbesc($r[0]['file'] . '[' . file_tag_encode($file) . ']'),
|
||||
intval($item),
|
||||
intval($uid)
|
||||
);
|
||||
$saved = get_pconfig($uid,'system','filetags');
|
||||
if((! strlen($saved)) || (! stristr($saved,'[' . file_tag_encode($file) . ']')))
|
||||
set_pconfig($uid,'system','filetags',$saved . '[' . file_tag_encode($file) . ']');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function file_tag_unsave_file($uid,$item,$file) {
|
||||
$result = false;
|
||||
if(! intval($uid))
|
||||
return false;
|
||||
|
||||
$pattern = '[' . file_tag_encode($file) . ']' ;
|
||||
|
||||
$r = q("select file from item where id = %d and uid = %d limit 1",
|
||||
intval($item),
|
||||
intval($uid)
|
||||
);
|
||||
if(! count($r))
|
||||
return false;
|
||||
|
||||
q("update item set file = '%s' where id = %d and uid = %d limit 1",
|
||||
dbesc(str_replace($pattern,'',$r[0]['file'])),
|
||||
intval($item),
|
||||
intval($uid)
|
||||
);
|
||||
|
||||
$r = q("select file from item where uid = %d " . file_tag_file_query('item',$file),
|
||||
intval($uid)
|
||||
);
|
||||
|
||||
if(! count($r)) {
|
||||
$saved = get_pconfig($uid,'system','filetags');
|
||||
set_pconfig($uid,'system','filetags',str_replace($pattern,'',$saved));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,61 +44,79 @@
|
|||
_dfrn_html2bbcode : function(s) {
|
||||
s = tinymce.trim(s);
|
||||
|
||||
function rep(re, str) {
|
||||
|
||||
//modify code to keep stuff intact within [code][/code] blocks
|
||||
//Waitman Gobble NO WARRANTY
|
||||
|
||||
|
||||
var o = new Array();
|
||||
var x = s.split("[code]");
|
||||
var i = 0;
|
||||
|
||||
var si = "";
|
||||
si = x.shift();
|
||||
si = si.replace(re,str);
|
||||
o.push(si);
|
||||
|
||||
for (i = 0; i < x.length; i++) {
|
||||
var no = new Array();
|
||||
var j = x.shift();
|
||||
var g = j.split("[/code]");
|
||||
no.push(g.shift());
|
||||
si = g.shift();
|
||||
si = si.replace(re,str);
|
||||
no.push(si);
|
||||
o.push(no.join("[/code]"));
|
||||
}
|
||||
|
||||
s = o.join("[code]");
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/* oembed */
|
||||
function _h2b_cb(match) {
|
||||
function s_h2b(data) {
|
||||
match = data;
|
||||
function rep(re, str) {
|
||||
|
||||
//modify code to keep stuff intact within [code][/code] blocks
|
||||
//Waitman Gobble NO WARRANTY
|
||||
|
||||
|
||||
var o = new Array();
|
||||
var x = s.split("[code]");
|
||||
var i = 0;
|
||||
|
||||
var si = "";
|
||||
si = x.shift();
|
||||
si = si.replace(re,str);
|
||||
o.push(si);
|
||||
|
||||
for (i = 0; i < x.length; i++) {
|
||||
var no = new Array();
|
||||
var j = x.shift();
|
||||
var g = j.split("[/code]");
|
||||
no.push(g.shift());
|
||||
si = g.shift();
|
||||
si = si.replace(re,str);
|
||||
no.push(si);
|
||||
o.push(no.join("[/code]"));
|
||||
}
|
||||
|
||||
s = o.join("[code]");
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/* oembed */
|
||||
function _h2b_cb(match) {
|
||||
/*
|
||||
function s_h2b(data) {
|
||||
match = data;
|
||||
}
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
type:"POST",
|
||||
url: 'oembed/h2b',
|
||||
data: {text: match},
|
||||
async: false,
|
||||
success: s_h2b,
|
||||
dataType: 'html'
|
||||
});
|
||||
return match;
|
||||
}
|
||||
data: {text: match},
|
||||
async: false,
|
||||
success: s_h2b,
|
||||
dataType: 'html'
|
||||
});
|
||||
*/
|
||||
|
||||
var f, g, tof = [], tor = [];
|
||||
var find_spanc = /<span [^>]*class *= *[\"'](?:[^\"']* )*oembed(?: [^\"']*)*[\"'][^>]*>(.*?(?:<span[^>]*>(.*?)<\/span *>)*.*?)<\/span *>/ig;
|
||||
while (f = find_spanc.exec(match)) {
|
||||
var find_a = /<a([^>]* rel=[\"']oembed[\"'][^>]*)>.*?<\/a *>/ig;
|
||||
if (g = find_a.exec(f[1])) {
|
||||
var find_href = /href=[\"']([^\"']*)[\"']/ig;
|
||||
var m2 = find_href.exec(g[1]);
|
||||
if (m2[1]) {
|
||||
tof.push(f[0]);
|
||||
tor.push("[EMBED]" + m2[1] + "[/EMBED]");
|
||||
}
|
||||
}
|
||||
}
|
||||
for (var i = 0; i < tof.length; i++) match = match.replace(tof[i], tor[i]);
|
||||
|
||||
return match;
|
||||
}
|
||||
if (s.indexOf('class="oembed')>=0){
|
||||
//alert("request oembed html2bbcode");
|
||||
s = _h2b_cb(s);
|
||||
}
|
||||
|
||||
/* /oembed */
|
||||
|
||||
|
||||
/* /oembed */
|
||||
|
||||
|
||||
// example: <strong> to [b]
|
||||
rep(/<a class=\"bookmark\" href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[bookmark=$1]$2[/bookmark]");
|
||||
|
@ -111,16 +129,16 @@
|
|||
rep(/<img.*?src=\"(.*?)\".*?height=\"(.*?)\".*?width=\"(.*?)\".*?\/>/gi,"[img=$3x$2]$1[/img]");
|
||||
rep(/<img.*?src=\"(.*?)\".*?width=\"(.*?)\".*?height=\"(.*?)\".*?\/>/gi,"[img=$2x$3]$1[/img]");
|
||||
rep(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]");
|
||||
|
||||
rep(/<ul class=\"listbullet\" style=\"list-style-type\: circle\;\">(.*?)<\/ul>/gi,"[list]$1[/list]");
|
||||
rep(/<ul class=\"listnone\" style=\"list-style-type\: none\;\">(.*?)<\/ul>/gi,"[list=]$1[/list]");
|
||||
rep(/<ul class=\"listdecimal\" style=\"list-style-type\: decimal\;\">(.*?)<\/ul>/gi,"[list=1]$1[/list]");
|
||||
rep(/<ul class=\"listlowerroman\" style=\"list-style-type\: lower-roman\;\">(.*?)<\/ul>/gi,"[list=i]$1[/list]");
|
||||
rep(/<ul class=\"listupperroman\" style=\"list-style-type\: upper-roman\;\">(.*?)<\/ul>/gi,"[list=I]$1[/list]");
|
||||
rep(/<ul class=\"listloweralpha\" style=\"list-style-type\: lower-alpha\;\">(.*?)<\/ul>/gi,"[list=a]$1[/list]");
|
||||
rep(/<ul class=\"listupperalpha\" style=\"list-style-type\: upper-alpha\;\">(.*?)<\/ul>/gi,"[list=A]$1[/list]");
|
||||
rep(/<li>(.*?)<\/li>/gi,'[li]$1[/li]');
|
||||
|
||||
|
||||
rep(/<ul class=\"listbullet\" style=\"list-style-type\: circle\;\">(.*?)<\/ul>/gi,"[list]$1[/list]");
|
||||
rep(/<ul class=\"listnone\" style=\"list-style-type\: none\;\">(.*?)<\/ul>/gi,"[list=]$1[/list]");
|
||||
rep(/<ul class=\"listdecimal\" style=\"list-style-type\: decimal\;\">(.*?)<\/ul>/gi,"[list=1]$1[/list]");
|
||||
rep(/<ul class=\"listlowerroman\" style=\"list-style-type\: lower-roman\;\">(.*?)<\/ul>/gi,"[list=i]$1[/list]");
|
||||
rep(/<ul class=\"listupperroman\" style=\"list-style-type\: upper-roman\;\">(.*?)<\/ul>/gi,"[list=I]$1[/list]");
|
||||
rep(/<ul class=\"listloweralpha\" style=\"list-style-type\: lower-alpha\;\">(.*?)<\/ul>/gi,"[list=a]$1[/list]");
|
||||
rep(/<ul class=\"listupperalpha\" style=\"list-style-type\: upper-alpha\;\">(.*?)<\/ul>/gi,"[list=A]$1[/list]");
|
||||
rep(/<li>(.*?)<\/li>/gi,'[li]$1[/li]');
|
||||
|
||||
rep(/<code>(.*?)<\/code>/gi,"[code]$1[/code]");
|
||||
rep(/<\/(strong|b)>/gi,"[/b]");
|
||||
rep(/<(strong|b)>/gi,"[b]");
|
||||
|
@ -149,42 +167,42 @@
|
|||
// BBCode -> HTML from DFRN dialect
|
||||
_dfrn_bbcode2html : function(s) {
|
||||
s = tinymce.trim(s);
|
||||
|
||||
|
||||
function rep(re, str) {
|
||||
|
||||
//modify code to keep stuff intact within [code][/code] blocks
|
||||
//Waitman Gobble NO WARRANTY
|
||||
|
||||
|
||||
var o = new Array();
|
||||
var x = s.split("[code]");
|
||||
var i = 0;
|
||||
|
||||
var si = "";
|
||||
si = x.shift();
|
||||
si = si.replace(re,str);
|
||||
o.push(si);
|
||||
|
||||
for (i = 0; i < x.length; i++) {
|
||||
var no = new Array();
|
||||
var j = x.shift();
|
||||
var g = j.split("[/code]");
|
||||
no.push(g.shift());
|
||||
si = g.shift();
|
||||
si = si.replace(re,str);
|
||||
no.push(si);
|
||||
o.push(no.join("[/code]"));
|
||||
}
|
||||
|
||||
s = o.join("[code]");
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function rep(re, str) {
|
||||
|
||||
//modify code to keep stuff intact within [code][/code] blocks
|
||||
//Waitman Gobble NO WARRANTY
|
||||
|
||||
|
||||
var o = new Array();
|
||||
var x = s.split("[code]");
|
||||
var i = 0;
|
||||
|
||||
var si = "";
|
||||
si = x.shift();
|
||||
si = si.replace(re,str);
|
||||
o.push(si);
|
||||
|
||||
for (i = 0; i < x.length; i++) {
|
||||
var no = new Array();
|
||||
var j = x.shift();
|
||||
var g = j.split("[/code]");
|
||||
no.push(g.shift());
|
||||
si = g.shift();
|
||||
si = si.replace(re,str);
|
||||
no.push(si);
|
||||
o.push(no.join("[/code]"));
|
||||
}
|
||||
|
||||
s = o.join("[code]");
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// example: [b] to <strong>
|
||||
rep(/\n/gi,"<br />");
|
||||
rep(/\[b\]/gi,"<strong>");
|
||||
|
@ -193,43 +211,43 @@
|
|||
rep(/\[\/i\]/gi,"</em>");
|
||||
rep(/\[u\]/gi,"<u>");
|
||||
rep(/\[\/u\]/gi,"</u>");
|
||||
rep(/\[hr\]/gi,"<hr />");
|
||||
rep(/\[hr\]/gi,"<hr />");
|
||||
rep(/\[bookmark=([^\]]+)\](.*?)\[\/bookmark\]/gi,"<a class=\"bookmark\" href=\"$1\">$2</a>");
|
||||
rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,"<a href=\"$1\">$2</a>");
|
||||
rep(/\[url\](.*?)\[\/url\]/gi,"<a href=\"$1\">$1</a>");
|
||||
rep(/\[img=(.*?)x(.*?)\](.*?)\[\/img\]/gi,"<img width=\"$1\" height=\"$2\" src=\"$3\" />");
|
||||
rep(/\[img\](.*?)\[\/img\]/gi,"<img src=\"$1\" />");
|
||||
|
||||
rep(/\[list\](.*?)\[\/list\]/gi, '<ul class="listbullet" style="list-style-type: circle;">$1</ul>');
|
||||
rep(/\[list=\](.*?)\[\/list\]/gi, '<ul class="listnone" style="list-style-type: none;">$1</ul>');
|
||||
rep(/\[list=1\](.*?)\[\/list\]/gi, '<ul class="listdecimal" style="list-style-type: decimal;">$1</ul>');
|
||||
rep(/\[list=i\](.*?)\[\/list\]/gi,'<ul class="listlowerroman" style="list-style-type: lower-roman;">$1</ul>');
|
||||
rep(/\[list=I\](.*?)\[\/list\]/gi, '<ul class="listupperroman" style="list-style-type: upper-roman;">$1</ul>');
|
||||
rep(/\[list=a\](.*?)\[\/list\]/gi, '<ul class="listloweralpha" style="list-style-type: lower-alpha;">$1</ul>');
|
||||
rep(/\[list=A\](.*?)\[\/list\]/gi, '<ul class="listupperalpha" style="list-style-type: upper-alpha;">$1</ul>');
|
||||
rep(/\[li\](.*?)\[\/li\]/gi, '<li>$1</li>');
|
||||
|
||||
rep(/\[list\](.*?)\[\/list\]/gi, '<ul class="listbullet" style="list-style-type: circle;">$1</ul>');
|
||||
rep(/\[list=\](.*?)\[\/list\]/gi, '<ul class="listnone" style="list-style-type: none;">$1</ul>');
|
||||
rep(/\[list=1\](.*?)\[\/list\]/gi, '<ul class="listdecimal" style="list-style-type: decimal;">$1</ul>');
|
||||
rep(/\[list=i\](.*?)\[\/list\]/gi,'<ul class="listlowerroman" style="list-style-type: lower-roman;">$1</ul>');
|
||||
rep(/\[list=I\](.*?)\[\/list\]/gi, '<ul class="listupperroman" style="list-style-type: upper-roman;">$1</ul>');
|
||||
rep(/\[list=a\](.*?)\[\/list\]/gi, '<ul class="listloweralpha" style="list-style-type: lower-alpha;">$1</ul>');
|
||||
rep(/\[list=A\](.*?)\[\/list\]/gi, '<ul class="listupperalpha" style="list-style-type: upper-alpha;">$1</ul>');
|
||||
rep(/\[li\](.*?)\[\/li\]/gi, '<li>$1</li>');
|
||||
rep(/\[color=(.*?)\](.*?)\[\/color\]/gi,"<span style=\"color: $1;\">$2</span>");
|
||||
rep(/\[size=(.*?)\](.*?)\[\/size\]/gi,"<span style=\"font-size: $1;\">$2</span>");
|
||||
rep(/\[code\](.*?)\[\/code\]/gi,"<code>$1</code>");
|
||||
rep(/\[quote.*?\](.*?)\[\/quote\]/gi,"<blockquote>$1</blockquote>");
|
||||
|
||||
/* oembed */
|
||||
function _b2h_cb(match, url) {
|
||||
url = bin2hex(url);
|
||||
function s_b2h(data) {
|
||||
match = data;
|
||||
}
|
||||
$.ajax({
|
||||
url: 'oembed/b2h?url=' + url,
|
||||
async: false,
|
||||
success: s_b2h,
|
||||
dataType: 'html'
|
||||
});
|
||||
return match;
|
||||
}
|
||||
s = s.replace(/\[embed\](.*?)\[\/embed\]/gi, _b2h_cb);
|
||||
|
||||
/* /oembed */
|
||||
|
||||
/* oembed */
|
||||
function _b2h_cb(match, url) {
|
||||
url = bin2hex(url);
|
||||
function s_b2h(data) {
|
||||
match = data;
|
||||
}
|
||||
$.ajax({
|
||||
url: 'oembed/b2h?url=' + url,
|
||||
async: false,
|
||||
success: s_b2h,
|
||||
dataType: 'html'
|
||||
});
|
||||
return match;
|
||||
}
|
||||
s = s.replace(/\[embed\](.*?)\[\/embed\]/gi, _b2h_cb);
|
||||
|
||||
/* /oembed */
|
||||
|
||||
return s;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ function admin_post(&$a){
|
|||
$func($a);
|
||||
}
|
||||
}
|
||||
goaway($a->get_baseurl() . '/admin/plugins/' . $a->argv[2] );
|
||||
goaway($a->get_baseurl(true) . '/admin/plugins/' . $a->argv[2] );
|
||||
return; // NOTREACHED
|
||||
break;
|
||||
case 'logs':
|
||||
|
@ -49,7 +49,7 @@ function admin_post(&$a){
|
|||
}
|
||||
}
|
||||
|
||||
goaway($a->get_baseurl() . '/admin' );
|
||||
goaway($a->get_baseurl(true) . '/admin' );
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -68,11 +68,11 @@ function admin_content(&$a) {
|
|||
|
||||
// array( url, name, extra css classes )
|
||||
$aside = Array(
|
||||
'site' => Array($a->get_baseurl()."/admin/site/", t("Site") , "site"),
|
||||
'users' => Array($a->get_baseurl()."/admin/users/", t("Users") , "users"),
|
||||
'plugins'=> Array($a->get_baseurl()."/admin/plugins/", t("Plugins") , "plugins"),
|
||||
'themes' => Array($a->get_baseurl()."/admin/themes/", t("Themes") , "themes"),
|
||||
'update' => Array($a->get_baseurl()."/admin/update/", t("Update") , "update")
|
||||
'site' => Array($a->get_baseurl(true)."/admin/site/", t("Site") , "site"),
|
||||
'users' => Array($a->get_baseurl(true)."/admin/users/", t("Users") , "users"),
|
||||
'plugins'=> Array($a->get_baseurl(true)."/admin/plugins/", t("Plugins") , "plugins"),
|
||||
'themes' => Array($a->get_baseurl(true)."/admin/themes/", t("Themes") , "themes"),
|
||||
'update' => Array($a->get_baseurl(true)."/admin/update/", t("Update") , "update")
|
||||
);
|
||||
|
||||
/* get plugins admin page */
|
||||
|
@ -81,18 +81,18 @@ function admin_content(&$a) {
|
|||
$aside['plugins_admin']=Array();
|
||||
foreach ($r as $h){
|
||||
$plugin =$h['name'];
|
||||
$aside['plugins_admin'][] = Array($a->get_baseurl()."/admin/plugins/".$plugin, $plugin, "plugin");
|
||||
$aside['plugins_admin'][] = Array($a->get_baseurl(true)."/admin/plugins/".$plugin, $plugin, "plugin");
|
||||
// temp plugins with admin
|
||||
$a->plugins_admin[] = $plugin;
|
||||
}
|
||||
|
||||
$aside['logs'] = Array($a->get_baseurl()."/admin/logs/", t("Logs"), "logs");
|
||||
$aside['logs'] = Array($a->get_baseurl(true)."/admin/logs/", t("Logs"), "logs");
|
||||
|
||||
$t = get_markup_template("admin_aside.tpl");
|
||||
$a->page['aside'] = replace_macros( $t, array(
|
||||
'$admin' => $aside,
|
||||
'$h_pending' => t('User registrations waiting for confirmation'),
|
||||
'$admurl'=> $a->get_baseurl()."/admin/"
|
||||
'$admurl'=> $a->get_baseurl(true)."/admin/"
|
||||
));
|
||||
|
||||
|
||||
|
@ -151,11 +151,7 @@ function admin_page_summary(&$a) {
|
|||
|
||||
$r = q("SELECT COUNT(id) as `count` FROM `register`");
|
||||
$pending = $r[0]['count'];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$t = get_markup_template("admin_summary.tpl");
|
||||
return replace_macros($t, array(
|
||||
'$title' => t('Administration'),
|
||||
|
@ -210,7 +206,7 @@ function admin_page_site_post(&$a){
|
|||
$dfrn_only = ((x($_POST,'dfrn_only')) ? True : False);
|
||||
$ostatus_disabled = !((x($_POST,'ostatus_disabled')) ? True : False);
|
||||
$diaspora_enabled = ((x($_POST,'diaspora_enabled')) ? True : False);
|
||||
|
||||
$ssl_policy = ((x($_POST,'ssl_policy')) ? intval($_POST['ssl_policy']) : 0);
|
||||
|
||||
set_config('config','sitename',$sitename);
|
||||
if ($banner==""){
|
||||
|
@ -222,6 +218,7 @@ function admin_page_site_post(&$a){
|
|||
} else {
|
||||
set_config('system','banner', $banner);
|
||||
}
|
||||
set_config('system','ssl_policy',$ssl_policy);
|
||||
set_config('system','language', $language);
|
||||
set_config('system','theme', $theme);
|
||||
set_config('system','maximagesize', $maximagesize);
|
||||
|
@ -258,7 +255,7 @@ function admin_page_site_post(&$a){
|
|||
set_config('system','diaspora_enabled', $diaspora_enabled);
|
||||
|
||||
info( t('Site settings updated.') . EOL);
|
||||
goaway($a->get_baseurl() . '/admin/site' );
|
||||
goaway($a->get_baseurl(true) . '/admin/site' );
|
||||
return; // NOTREACHED
|
||||
|
||||
}
|
||||
|
@ -305,6 +302,12 @@ function admin_page_site(&$a) {
|
|||
REGISTER_APPROVE => t("Requires approval"),
|
||||
REGISTER_OPEN => t("Open")
|
||||
);
|
||||
|
||||
$ssl_choices = array(
|
||||
SSL_POLICY_NONE => t("No SSL policy, links will track page SSL state"),
|
||||
SSL_POLICY_FULL => t("Force all links to use SSL"),
|
||||
SSL_POLICY_SELFSIGN => t("Self-signed certificate, use SSL for local links only (discouraged)")
|
||||
);
|
||||
|
||||
$t = get_markup_template("admin_site.tpl");
|
||||
return replace_macros($t, array(
|
||||
|
@ -316,13 +319,13 @@ function admin_page_site(&$a) {
|
|||
'$corporate' => t('Policies'),
|
||||
'$advanced' => t('Advanced'),
|
||||
|
||||
'$baseurl' => $a->get_baseurl(),
|
||||
'$baseurl' => $a->get_baseurl(true),
|
||||
// name, label, value, help string, extra data...
|
||||
'$sitename' => array('sitename', t("Site name"), htmlentities($a->config['sitename'], ENT_QUOTES), ""),
|
||||
'$banner' => array('banner', t("Banner/Logo"), $banner, ""),
|
||||
'$language' => array('language', t("System language"), get_config('system','language'), "", $lang_choices),
|
||||
'$theme' => array('theme', t("System theme"), get_config('system','theme'), t("Default system theme - may be over-ridden by user profiles"), $theme_choices),
|
||||
|
||||
'$ssl_policy' => array('ssl_policy', t("SSL link policy"), get_config('system','ssl_policy'), t("Determines whether generated links should be forced to use SSL"), $ssl_choices),
|
||||
'$maximagesize' => array('maximagesize', t("Maximum image size"), get_config('system','maximagesize'), t("Maximum size in bytes of uploaded images. Default is 0, which means no limits.")),
|
||||
|
||||
'$register_policy' => array('register_policy', t("Register policy"), $a->config['register_policy'], "", $register_choices),
|
||||
|
@ -389,7 +392,7 @@ function admin_page_users_post(&$a){
|
|||
user_deny($hash);
|
||||
}
|
||||
}
|
||||
goaway($a->get_baseurl() . '/admin/users' );
|
||||
goaway($a->get_baseurl(true) . '/admin/users' );
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -399,7 +402,7 @@ function admin_page_users(&$a){
|
|||
$user = q("SELECT * FROM `user` WHERE `uid`=%d", intval($uid));
|
||||
if (count($user)==0){
|
||||
notice( 'User not found' . EOL);
|
||||
goaway($a->get_baseurl() . '/admin/users' );
|
||||
goaway($a->get_baseurl(true) . '/admin/users' );
|
||||
return; // NOTREACHED
|
||||
}
|
||||
switch($a->argv[2]){
|
||||
|
@ -418,7 +421,7 @@ function admin_page_users(&$a){
|
|||