Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
hubzilla
core
Commits
f60309ef
Commit
f60309ef
authored
Mar 15, 2017
by
Zot
Committed by
Mario
Mar 29, 2017
Browse files
more widget migrations
parent
47f40079
Changes
5
Hide whitespace changes
Inline
Side-by-side
Zotlabs/Widget/Appcategories.php
0 → 100644
View file @
f60309ef
<?php
namespace
Zotlabs\Widget
;
class
Appcategories
{
function
widget
(
$arr
)
{
if
(
!
local_channel
())
return
''
;
$selected
=
((
x
(
$_REQUEST
,
'cat'
))
?
htmlspecialchars
(
$_REQUEST
[
'cat'
],
ENT_COMPAT
,
'UTF-8'
)
:
''
);
// @FIXME ??? $srchurl undefined here - commented out until is reviewed
//$srchurl = rtrim(preg_replace('/cat\=[^\&].*?(\&|$)/is','',$srchurl),'&');
//$srchurl = str_replace(array('?f=','&f='),array('',''),$srchurl);
// Leaving this line which negates the effect of the two invalid lines prior
$srchurl
=
z_root
()
.
'/apps'
;
$terms
=
array
();
$r
=
q
(
"select distinct(term.term)
from term join app on term.oid = app.id
where app_channel = %d
and term.uid = app_channel
and term.otype = %d
and term.term != 'nav_featured_app'
order by term.term asc"
,
intval
(
local_channel
()),
intval
(
TERM_OBJ_APP
)
);
if
(
$r
)
{
foreach
(
$r
as
$rr
)
$terms
[]
=
array
(
'name'
=>
$rr
[
'term'
],
'selected'
=>
((
$selected
==
$rr
[
'term'
])
?
'selected'
:
''
));
return
replace_macros
(
get_markup_template
(
'categories_widget.tpl'
),
array
(
'$title'
=>
t
(
'Categories'
),
'$desc'
=>
''
,
'$sel_all'
=>
((
$selected
==
''
)
?
'selected'
:
''
),
'$all'
=>
t
(
'Everything'
),
'$terms'
=>
$terms
,
'$base'
=>
$srchurl
,
));
}
}
}
Zotlabs/Widget/Appcloud.php
0 → 100644
View file @
f60309ef
<?php
namespace
Zotlabs\Widget
;
class
Appcloud
{
function
widget
(
$arr
)
{
if
(
!
local_channel
())
return
''
;
return
app_tagblock
(
z_root
()
.
'/apps'
);
}
}
Zotlabs/Widget/Categories.php
0 → 100644
View file @
f60309ef
<?php
namespace
Zotlabs\Widget
;
class
Categories
{
function
widget
(
$arr
)
{
if
((
!
\
App
::
$profile
[
'profile_uid'
])
||
(
!
perm_is_allowed
(
\
App
::
$profile
[
'profile_uid'
],
get_observer_hash
(),
'view_stream'
)))
{
return
''
;
}
$cat
=
((
x
(
$_REQUEST
,
'cat'
))
?
htmlspecialchars
(
$_REQUEST
[
'cat'
],
ENT_COMPAT
,
'UTF-8'
)
:
''
);
$srchurl
=
\
App
::
$query_string
;
$srchurl
=
rtrim
(
preg_replace
(
'/cat\=[^\&].*?(\&|$)/is'
,
''
,
$srchurl
),
'&'
);
$srchurl
=
str_replace
(
array
(
'?f='
,
'&f='
),
array
(
''
,
''
),
$srchurl
);
return
categories_widget
(
$srchurl
,
$cat
);
}
}
Zotlabs/Widget/Shortprofile.php
0 → 100644
View file @
f60309ef
<?php
namespace
Zotlabs\Widget
;
class
Shortprofile
{
function
widget
(
$arr
)
{
if
(
!
\
App
::
$profile
[
'profile_uid'
])
return
;
$block
=
observer_prohibited
();
return
profile_sidebar
(
\
App
::
$profile
,
$block
,
true
,
true
);
}
}
include/widgets.php
View file @
f60309ef
...
...
@@ -13,82 +13,9 @@ require_once('include/attach.php');
function
widget_shortprofile
(
$arr
)
{
if
(
!
App
::
$profile
[
'profile_uid'
])
return
;
$block
=
observer_prohibited
();
return
profile_sidebar
(
App
::
$profile
,
$block
,
true
,
true
);
}
function
widget_categories
(
$arr
)
{
if
(
App
::
$profile
[
'profile_uid'
]
&&
(
!
perm_is_allowed
(
App
::
$profile
[
'profile_uid'
],
get_observer_hash
(),
'view_stream'
)))
return
''
;
$cat
=
((
x
(
$_REQUEST
,
'cat'
))
?
htmlspecialchars
(
$_REQUEST
[
'cat'
],
ENT_COMPAT
,
'UTF-8'
)
:
''
);
$srchurl
=
App
::
$query_string
;
$srchurl
=
rtrim
(
preg_replace
(
'/cat\=[^\&].*?(\&|$)/is'
,
''
,
$srchurl
),
'&'
);
$srchurl
=
str_replace
(
array
(
'?f='
,
'&f='
),
array
(
''
,
''
),
$srchurl
);
return
categories_widget
(
$srchurl
,
$cat
);
}
function
widget_appcategories
(
$arr
)
{
if
(
!
local_channel
())
return
''
;
$selected
=
((
x
(
$_REQUEST
,
'cat'
))
?
htmlspecialchars
(
$_REQUEST
[
'cat'
],
ENT_COMPAT
,
'UTF-8'
)
:
''
);
$srchurl
=
rtrim
(
preg_replace
(
'/cat\=[^\&].*?(\&|$)/is'
,
''
,
$srchurl
),
'&'
);
$srchurl
=
str_replace
(
array
(
'?f='
,
'&f='
),
array
(
''
,
''
),
$srchurl
);
$srchurl
=
z_root
()
.
'/apps'
;
$terms
=
array
();
$r
=
q
(
"select distinct(term.term)
from term join app on term.oid = app.id
where app_channel = %d
and term.uid = app_channel
and term.otype = %d
and term.term != 'nav_featured_app'
order by term.term asc"
,
intval
(
local_channel
()),
intval
(
TERM_OBJ_APP
)
);
if
(
$r
)
{
foreach
(
$r
as
$rr
)
$terms
[]
=
array
(
'name'
=>
$rr
[
'term'
],
'selected'
=>
((
$selected
==
$rr
[
'term'
])
?
'selected'
:
''
));
return
replace_macros
(
get_markup_template
(
'categories_widget.tpl'
),
array
(
'$title'
=>
t
(
'Categories'
),
'$desc'
=>
''
,
'$sel_all'
=>
((
$selected
==
''
)
?
'selected'
:
''
),
'$all'
=>
t
(
'Everything'
),
'$terms'
=>
$terms
,
'$base'
=>
$srchurl
,
));
}
}
function
widget_appcloud
(
$arr
)
{
if
(
!
local_channel
())
return
''
;
return
app_tagblock
(
z_root
()
.
'/apps'
);
}
function
widget_tagcloud_wall
(
$arr
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment