Commit 8165a584 authored by changi67's avatar changi67
parent 2df3ae4b
......@@ -14,12 +14,12 @@ if ($prefs['feed_forum'] != 'y') {
require_once ('tiki-rss_error.php');
}
if(!isset($_REQUEST["forumId"])) {
if (!isset($_REQUEST["forumId"])) {
$errmsg=tra("No forumId specified");
require_once ('tiki-rss_error.php');
}
$tikilib->get_perm_object( $_REQUEST['forumId'], 'forum' );
$tikilib->get_perm_object($_REQUEST['forumId'], 'forum');
if ($tiki_p_forum_read != 'y') {
$smarty->assign('errortype', 401);
......
......@@ -41,11 +41,11 @@ $smarty->assign('find', $find);
$smarty->assign_by_ref('sort_mode', $sort_mode);
$channels = $commentslib->list_forums($offset, $maxRecords, $sort_mode, $find);
Perms::bulk( array( 'type' => 'forum' ), 'object', $channels['data'], 'forumId' );
Perms::bulk(array( 'type' => 'forum' ), 'object', $channels['data'], 'forumId');
$temp_max = count($channels["data"]);
for ($i = 0; $i < $temp_max; $i++) {
$forumperms = Perms::get( array( 'type' => 'forum', 'object' => $channels['data'][$i]['forumId'] ) );
$forumperms = Perms::get(array( 'type' => 'forum', 'object' => $channels['data'][$i]['forumId'] ));
$channels["data"][$i]["individual_tiki_p_forum_read"] = $forumperms->forum_read ? 'y' : 'n';
$channels["data"][$i]["individual_tiki_p_forum_post"] = $forumperms->forum_post ? 'y' : 'n';
$channels["data"][$i]["individual_tiki_p_forum_post_topic"] = $forumperms->forum_post_topic ? 'y' : 'n';
......@@ -54,7 +54,7 @@ for ($i = 0; $i < $temp_max; $i++) {
}
$smarty->assign_by_ref('channels', $channels["data"]);
$smarty->assign('cant',$channels["cant"]);
$smarty->assign('cant', $channels["cant"]);
include_once ('tiki-section_options.php');
ask_ticket('forums');
......
......@@ -17,8 +17,8 @@ if ($prefs['feed_forums'] != 'y') {
}
$res=$access->authorize_rss(array('tiki_p_admin_forum','tiki_p_forum_read'));
if($res) {
if($res['header'] == 'y') {
if ($res) {
if ($res['header'] == 'y') {
header('WWW-Authenticate: Basic realm="'.$tikidomain.'"');
header('HTTP/1.0 401 Unauthorized');
}
......
......@@ -13,7 +13,7 @@ $access->check_feature('feature_freetags', 'freetags_feature_3d');
$map = array ("getSubGraph" => array( "function" => "getSubGraph" ) );
$server = new XML_RPC_Server( $map );
$server = new XML_RPC_Server($map);
function getSubGraph($params) {
global $freetaglib, $dbTiki, $base_url, $prefs;
......
......@@ -9,9 +9,9 @@ require_once ('tiki-setup.php');
$access->check_feature(array('feature_freetags','freetags_multilingual','feature_multilingual'));
$access->check_permission('tiki_p_freetags_tag');
if( !isset($_REQUEST['type']))
if ( !isset($_REQUEST['type']))
$_REQUEST['type'] = 'wiki page';
if( !isset($_REQUEST['objId']))
if ( !isset($_REQUEST['objId']))
$_REQUEST['objId'] = '';
$cat_type = $_REQUEST['type'];
......@@ -19,7 +19,6 @@ $cat_objId = $_REQUEST['objId'];
if ($cat_type != 'wiki page' && $cat_type != 'article') {
$smarty->assign('msg', tra("Not supported yet."));
$smarty->display("error.tpl");
die;
}
......@@ -33,57 +32,49 @@ if ( $cat_objId ) {
// Global tag edit only available to admins
$smarty->assign('errortype', 401);
$smarty->assign('msg', tra("You do not have permission to use this feature"));
$smarty->display("error.tpl");
die;
}
$smarty->assign( 'type', $cat_type );
$smarty->assign( 'objId', $cat_objId );
$smarty->assign('type', $cat_type );
$smarty->assign('objId', $cat_objId );
$smarty->assign( 'data', $info );
$smarty->assign('data', $info );
if( isset( $_REQUEST['save'] ) )
{
if ( isset($_REQUEST['save']) ) {
// Process save
if( isset( $_REQUEST['setlang'] )
&& is_array( $_REQUEST['setlang'] ) )
{
foreach( $_REQUEST['setlang'] as $tagId => $lang )
if( !empty( $lang ) )
if ( isset($_REQUEST['setlang']) && is_array($_REQUEST['setlang']) ) {
foreach ( $_REQUEST['setlang'] as $tagId => $lang )
if ( !empty($lang) )
$freetaglib->set_tag_language( $tagId, $lang );
}
if( isset( $_REQUEST['newtag'] )
&& isset( $_REQUEST['rootlang'] )
&& is_array( $_REQUEST['newtag'] )
&& is_array( $_REQUEST['rootlang'] ) )
if ( isset($_REQUEST['newtag'])
&& isset($_REQUEST['rootlang'])
&& is_array($_REQUEST['newtag'])
&& is_array($_REQUEST['rootlang']) )
{
foreach( $_REQUEST['newtag'] as $tagGroup => $list )
if( is_array( $list ) && array_key_exists( $tagGroup, $_REQUEST['rootlang'] ) )
foreach( $list as $lang => $tag )
{
foreach ( $_REQUEST['newtag'] as $tagGroup => $list )
if ( is_array($list) && array_key_exists($tagGroup, $_REQUEST['rootlang']) )
foreach ( $list as $lang => $tag ) {
$root = $_REQUEST['rootlang'][$tagGroup];
if( !array_key_exists( $lang, $root ) )
if ( !array_key_exists($lang, $root) )
continue;
$freetaglib->translate_tag( $root[$lang], $tagGroup, $lang, $tag );
$freetaglib->translate_tag($root[$lang], $tagGroup, $lang, $tag);
}
}
if( isset( $_REQUEST['clear'] ) && is_array( $_REQUEST['clear'] ) )
{
foreach( $_REQUEST['clear'] as $tag )
$freetaglib->clear_tag_language_from_id( $tag );
if ( isset( $_REQUEST['clear'] ) && is_array( $_REQUEST['clear'] ) ) {
foreach ( $_REQUEST['clear'] as $tag )
$freetaglib->clear_tag_language_from_id($tag);
}
}
else
{
} else {
// Form reload
if( isset( $_REQUEST['newtag'] ) )
$smarty->assign( 'newtags', $_REQUEST['newtag'] );
if( isset( $_REQUEST['setlang'] ) )
$smarty->assign( 'setlang', $_REQUEST['setlang'] );
if ( isset($_REQUEST['newtag']) )
$smarty->assign('newtags', $_REQUEST['newtag']);
if ( isset($_REQUEST['setlang']) )
$smarty->assign('setlang', $_REQUEST['setlang']);
}
$freetags_per_page = $prefs['maxRecords'];
......@@ -98,11 +89,11 @@ $languages = $multilinguallib->preferredLangs();
$used_languages = array();
foreach ($languages as $l)
$used_languages[$l] = true;
if( array_key_exists( 'additional_languages', $_REQUEST )
&& is_array( $_REQUEST['additional_languages'] ) )
foreach( $_REQUEST['additional_languages'] as $lang )
if ( array_key_exists('additional_languages', $_REQUEST)
&& is_array($_REQUEST['additional_languages']) )
foreach ( $_REQUEST['additional_languages'] as $lang )
$used_languages[$lang] = true;
$used_languages = array_keys( $used_languages );
$used_languages = array_keys($used_languages);
$allLanguages = $tikilib->list_languages();
// select roughly readable languages
......@@ -117,14 +108,13 @@ foreach ($allLanguages as $al) {
}
$used_languages = $t_used_languages;
$tagList = $freetaglib->get_object_tags_multilingual( $cat_type, $cat_objId, $used_languages, $offset, $freetags_per_page );
$tagList = $freetaglib->get_object_tags_multilingual($cat_type, $cat_objId, $used_languages, $offset, $freetags_per_page);
$rootlangs = array();
foreach( $tagList as $tagGroup ) {
foreach( $tagGroup as $k => $tag )
{
foreach ( $tagList as $tagGroup ) {
foreach ( $tagGroup as $k => $tag ) {
array_merge($used_languages, array($k));
if( $tag['tagset'] == $tag['tagId'] )
if ( $tag['tagset'] == $tag['tagId'] )
$rootlangs[$tag['tagset']] = $tag['lang'];
}
}
......@@ -135,20 +125,20 @@ $baseArgs = array(
'additional_languages' => $used_languages,
);
$prev = http_build_query( array_merge( $baseArgs, array( 'offset' => $offset - $freetags_per_page ) ), '', '&' );
$next = http_build_query( array_merge( $baseArgs, array( 'offset' => $offset + $freetags_per_page ) ), '', '&' );
$prev = http_build_query(array_merge($baseArgs, array( 'offset' => $offset - $freetags_per_page )), '', '&');
$next = http_build_query(array_merge($baseArgs, array( 'offset' => $offset + $freetags_per_page )), '', '&');
$smarty->assign( 'next', 'tiki-freetag_translate.php?' . $next );
if( $offset ) {
$smarty->assign( 'previous', 'tiki-freetag_translate.php?' . $prev );
$smarty->assign('next', 'tiki-freetag_translate.php?' . $next);
if ( $offset ) {
$smarty->assign('previous', 'tiki-freetag_translate.php?' . $prev);
} else {
$smarty->assign( 'previous', '' );
$smarty->assign('previous', '');
}
$smarty->assign( 'tagList', $tagList );
$smarty->assign( 'languageList', $used_languages );
$smarty->assign( 'fullLanguageList', $allLanguages );
$smarty->assign( 'rootlang', $rootlangs );
$smarty->assign('tagList', $tagList);
$smarty->assign('languageList', $used_languages);
$smarty->assign('fullLanguageList', $allLanguages);
$smarty->assign('rootlang', $rootlangs);
// Display the template
$smarty->assign('mid', 'tiki-freetag-translate.tpl');
......
......@@ -15,35 +15,34 @@ $access->check_feature('feature_friends');
if (isset($_REQUEST['request_friendship'])) {
$friend = $_REQUEST['request_friendship'];
if ($userlib->user_exists($friend)) {
if (!$tikilib->verify_friendship($friend,$user)) {
$userlib->request_friendship($user,$friend);
$lg = $tikilib->get_user_preference($friend, "language", $prefs['site_language']);
$smarty->assign('msg',sprintf(tra("Friendship request sent to %s"), $friend));
$foo = parse_url($_SERVER["REQUEST_URI"]);
$machine = $tikilib->httpPrefix( true ). $foo["path"];
$smarty->assign('server_name',$machine);
$messulib->post_message($friend, $user, $friend, '',
$smarty->fetchLang($lg,'mail/new_friend_invitation_subject.tpl'),
$smarty->fetchLang($lg,'mail/new_friend_invitation.tpl'),
3);
if ($userlib->user_exists($friend)) {
if (!$tikilib->verify_friendship($friend, $user)) {
$userlib->request_friendship($user, $f riend);
$lg = $tikilib->get_user_preference($friend, "language", $prefs['site_language']);
$smarty->assign('msg', sprintf(tra("Friendship request sent to %s"), $friend));
$foo = parse_url($_SERVER["REQUEST_URI"]);
$machine = $tikilib->httpPrefix(true). $foo["path"];
$smarty->assign('server_name', $machine);
$messulib->post_message($friend, $user, $friend, '',
$smarty->fetchLang($lg, 'mail/new_friend_invitation_subject.tpl'),
$smarty->fetchLang($lg, 'mail/new_friend_invitation.tpl'),
3);
} else {
$smarty->assign('msg', sprintf(tra("You're already friend of %s"), $_REQUEST['request_friendship']));
$smarty->display("error.tpl");
die;
}
} else {
$smarty->assign('msg',sprintf(tra("You're already friend of %s"), $_REQUEST['request_friendship']));
$smarty->display("error.tpl");
die;
$smarty->assign('msg', tra("Invalid username"));
$smarty->display("error.tpl");
die;
}
} else {
$smarty->assign('msg',tra("Invalid username"));
$smarty->display("error.tpl");
die;
}
} elseif (isset($_REQUEST['accept'])) {
$friend = $_REQUEST['accept'];
$userlib->accept_friendship($user,$friend);
$userlib->accept_friendship($user, $friend);
$lg = $tikilib->get_user_preference($friend, "language", $prefs['site_language']);
$smarty->assign('msg', sprintf(tra('Accepted friendship request from %s'),$friend));
$smarty->assign('msg', sprintf(tra('Accepted friendship request from %s'), $friend));
$messulib->post_message($friend, $user, $friend, '',
tra("I have accepted your friendship request!", $lg),
......@@ -55,7 +54,7 @@ if (isset($_REQUEST['request_friendship'])) {
$friend = $_REQUEST['refuse'];
$userlib->refuse_friendship($user, $friend);
$lg = $tikilib->get_user_preference($friend, "language", $prefs['site_language']);
$smarty->assign('msg', sprintf(tra('Refused friendship request from %s'),$friend));
$smarty->assign('msg', sprintf(tra('Refused friendship request from %s'), $friend));
// Should we send a message, or that would intimidate refusing friendships?
// TODO: make it optional
......@@ -68,7 +67,7 @@ if (isset($_REQUEST['request_friendship'])) {
$friend = $_REQUEST['cancel_waiting_friendship'];
$userlib->refuse_friendship($friend, $user);
$lg = $tikilib->get_user_preference($friend, "language", $prefs['site_language']);
$smarty->assign('msg', sprintf(tra('Canceled friendship request with %s'),$friend));
$smarty->assign('msg', sprintf(tra('Canceled friendship request with %s'), $friend));
// Should we send a message, or that would intimidate refusing friendships?
// TODO: make it optional
......@@ -81,7 +80,7 @@ if (isset($_REQUEST['request_friendship'])) {
$friend = $_REQUEST['break'];
$userlib->break_friendship($user, $friend);
$lg = $tikilib->get_user_preference($friend, "language", $prefs['site_language']);
$smarty->assign('msg', sprintf(tra('Broke friendship with %s'),$friend));
$smarty->assign('msg', sprintf(tra('Broke friendship with %s'), $friend));
// Should we send a message, or that would intimidate user?
// TODO: make it optional
......@@ -92,42 +91,42 @@ if (isset($_REQUEST['request_friendship'])) {
}
if(!isset($_REQUEST["sort_mode"])) {
if (!isset($_REQUEST["sort_mode"])) {
$sort_mode = $prefs['user_list_order'];
} else {
$sort_mode = $_REQUEST["sort_mode"];
}
$smarty->assign_by_ref('sort_mode',$sort_mode);
$smarty->assign_by_ref('sort_mode', $sort_mode);
// If offset is set use it if not then use offset =0
// use the maxRecords php variable to set the limit
// if sortMode is not set then use lastModif_desc
if(!isset($_REQUEST["offset"])) {
if (!isset($_REQUEST["offset"])) {
$offset = 0;
} else {
$offset = $_REQUEST["offset"];
}
$smarty->assign_by_ref('offset',$offset);
$smarty->assign_by_ref('offset', $offset);
if(isset($_REQUEST["find"])) {
if (isset($_REQUEST["find"])) {
$find = $_REQUEST["find"];
} else {
$find = '';
}
$smarty->assign('find',$find);
$smarty->assign('find', $find);
$smarty->assign('pending_requests',$userlib->list_pending_friendship_requests($user));
$smarty->assign('waiting_requests',$userlib->list_waiting_friendship_requests($user));
$smarty->assign('pending_requests', $userlib->list_pending_friendship_requests($user));
$smarty->assign('waiting_requests', $userlib->list_waiting_friendship_requests($user));
$listpages = $tikilib->list_user_friends($user,$offset,$maxRecords,$sort_mode,$find);
$listpages = $tikilib->list_user_friends($user, $offset, $maxRecords, $sort_mode, $find);
$smarty->assign_by_ref('cant_pages', $listpages["cant"]);
$smarty->assign_by_ref('listpages',$listpages["data"]);
$smarty->assign_by_ref('listpages', $listpages["data"]);
$section='friends';
include_once('tiki-section_options.php');
$smarty->assign('mid','tiki-friends.tpl');
$smarty->assign('mid', 'tiki-friends.tpl');
$smarty->display("tiki.tpl");
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment