Merge remote-tracking branch 'upstream/develop' into 1610-performance

This commit is contained in:
Michael Vogel 2016-10-24 08:12:13 +00:00
commit 3463a442ba
7 changed files with 379 additions and 279 deletions

View file

@ -159,7 +159,7 @@ function mark_for_death($contact) {
}
else {
/// @todo
/// @todo
/// We really should send a notification to the owner after 2-3 weeks
/// so they won't be surprised when the contact vanishes and can take
/// remedial action if this was a serious mistake or glitch
@ -288,84 +288,88 @@ function get_contact_details_by_url($url, $uid = -1, $default = array()) {
return($profile);
}
if(! function_exists('contact_photo_menu')){
function contact_photo_menu($contact, $uid = 0) {
if (! function_exists('contact_photo_menu')) {
function contact_photo_menu($contact, $uid = 0)
{
$a = get_app();
$contact_url="";
$pm_url="";
$status_link="";
$photos_link="";
$posts_link="";
$contact_drop_link = "";
$poke_link="";
$contact_url = '';
$pm_url = '';
$status_link = '';
$photos_link = '';
$posts_link = '';
$contact_drop_link = '';
$poke_link = '';
if ($uid == 0)
if ($uid == 0) {
$uid = local_user();
}
if ($contact["uid"] != $uid) {
if ($contact['uid'] != $uid) {
if ($uid == 0) {
$profile_link = zrl($contact['url']);
$menu = Array('profile' => array(t("View Profile"), $profile_link, true));
$menu = Array('profile' => array(t('View Profile'), $profile_link, true));
return $menu;
}
$r = q("SELECT * FROM `contact` WHERE `nurl` = '%s' AND `network` = '%s' AND `uid` = %d",
dbesc($contact["nurl"]), dbesc($contact["network"]), intval($uid));
if ($r)
dbesc($contact['nurl']), dbesc($contact['network']), intval($uid));
if ($r) {
return contact_photo_menu($r[0], $uid);
else {
} else {
$profile_link = zrl($contact['url']);
$connlnk = 'follow/?url='.$contact['url'];
$menu = Array(
'profile' => array(t("View Profile"), $profile_link, true),
'follow' => array(t("Connect/Follow"), $connlnk, true)
);
$menu = array(
'profile' => array(t('View Profile'), $profile_link, true),
'follow' => array(t('Connect/Follow'), $connlnk, true)
);
return $menu;
}
}
$sparkle = false;
if($contact['network'] === NETWORK_DFRN) {
if ($contact['network'] === NETWORK_DFRN) {
$sparkle = true;
$profile_link = $a->get_baseurl() . '/redir/' . $contact['id'];
}
else
} else {
$profile_link = $contact['url'];
if($profile_link === 'mailbox')
$profile_link = '';
if($sparkle) {
$status_link = $profile_link . "?url=status";
$photos_link = $profile_link . "?url=photos";
$profile_link = $profile_link . "?url=profile";
}
if (in_array($contact["network"], array(NETWORK_DFRN, NETWORK_DIASPORA)))
$pm_url = $a->get_baseurl() . '/message/new/' . $contact['id'];
if ($profile_link === 'mailbox') {
$profile_link = '';
}
if ($contact["network"] == NETWORK_DFRN)
if ($sparkle) {
$status_link = $profile_link . '?url=status';
$photos_link = $profile_link . '?url=photos';
$profile_link = $profile_link . '?url=profile';
}
if (in_array($contact['network'], array(NETWORK_DFRN, NETWORK_DIASPORA))) {
$pm_url = $a->get_baseurl() . '/message/new/' . $contact['id'];
}
if ($contact['network'] == NETWORK_DFRN) {
$poke_link = $a->get_baseurl() . '/poke/?f=&c=' . $contact['id'];
}
$contact_url = $a->get_baseurl() . '/contacts/' . $contact['id'];
$posts_link = $a->get_baseurl() . "/contacts/" . $contact['id'] . '/posts';
$contact_drop_link = $a->get_baseurl() . "/contacts/" . $contact['id'] . '/drop?confirm=1';
$posts_link = $a->get_baseurl() . '/contacts/' . $contact['id'] . '/posts';
$contact_drop_link = $a->get_baseurl() . '/contacts/' . $contact['id'] . '/drop?confirm=1';
/**
* menu array:
* "name" => [ "Label", "link", (bool)Should the link opened in a new tab? ]
*/
$menu = Array(
$menu = array(
'status' => array(t("View Status"), $status_link, true),
'profile' => array(t("View Profile"), $profile_link, true),
'photos' => array(t("View Photos"), $photos_link,true),
'network' => array(t("Network Posts"), $posts_link,false),
'edit' => array(t("Edit Contact"), $contact_url, false),
'photos' => array(t("View Photos"), $photos_link, true),
'network' => array(t("Network Posts"), $posts_link, false),
'edit' => array(t("View Contact"), $contact_url, false),
'drop' => array(t("Drop Contact"), $contact_drop_link, false),
'pm' => array(t("Send PM"), $pm_url, false),
'poke' => array(t("Poke"), $poke_link, false),
@ -378,9 +382,11 @@ function contact_photo_menu($contact, $uid = 0) {
$menucondensed = array();
foreach ($menu AS $menuname=>$menuitem)
if ($menuitem[1] != "")
foreach ($menu AS $menuname => $menuitem) {
if ($menuitem[1] != '') {
$menucondensed[$menuname] = $menuitem;
}
}
return $menucondensed;
}}

View file

@ -903,79 +903,86 @@ function best_link_url($item,&$sparkle,$ssl_state = false) {
}
if(! function_exists('item_photo_menu')){
function item_photo_menu($item){
if (! function_exists('item_photo_menu')) {
function item_photo_menu($item)
{
$ssl_state = false;
if(local_user())
if(local_user()) {
$ssl_state = true;
}
$sub_link="";
$poke_link="";
$contact_url="";
$pm_url="";
$status_link="";
$photos_link="";
$posts_link="";
$network = "";
$sub_link = '';
$poke_link = '';
$contact_url = '';
$pm_url = '';
$status_link = '';
$photos_link = '';
$posts_link = '';
$network = '';
if((local_user()) && local_user() == $item['uid'] && $item['parent'] == $item['id'] && (! $item['self'])) {
if ((local_user()) && local_user() == $item['uid'] && $item['parent'] == $item['id'] && (! $item['self'])) {
$sub_link = 'javascript:dosubthread(' . $item['id'] . '); return false;';
}
$sparkle = false;
$profile_link = best_link_url($item,$sparkle,$ssl_state);
if($profile_link === 'mailbox')
$profile_link = best_link_url($item, $sparkle, $ssl_state);
if ($profile_link === 'mailbox') {
$profile_link = '';
}
$cid = 0;
$network = "";
$network = '';
$rel = 0;
$r = q("SELECT `id`, `network`, `rel` FROM `contact` WHERE `uid` = %d AND `nurl` = '%s' LIMIT 1",
intval(local_user()), dbesc(normalise_link($item['author-link'])));
if ($r) {
$cid = $r[0]["id"];
$network = $r[0]["network"];
$rel = $r[0]["rel"];
$cid = $r[0]['id'];
$network = $r[0]['network'];
$rel = $r[0]['rel'];
}
if($sparkle) {
$status_link = $profile_link."?url=status";
$photos_link = $profile_link."?url=photos";
$profile_link = $profile_link."?url=profile";
$status_link = $profile_link . '?url=status';
$photos_link = $profile_link . '?url=photos';
$profile_link = $profile_link . '?url=profile';
$zurl = '';
} else
} else {
$profile_link = zrl($profile_link);
}
if($cid && !$item['self']) {
$poke_link = 'poke/?f=&c='.$cid;
$contact_url = 'contacts/'.$cid;
$posts_link = 'contacts/'.$cid.'/posts';
if ($cid && !$item['self']) {
$poke_link = 'poke/?f=&c=' . $cid;
$contact_url = 'contacts/' . $cid;
$posts_link = 'contacts/' . $cid . '/posts';
if (in_array($network, array(NETWORK_DFRN, NETWORK_DIASPORA)))
$pm_url = 'message/new/'.$cid;
if (in_array($network, array(NETWORK_DFRN, NETWORK_DIASPORA))) {
$pm_url = 'message/new/' . $cid;
}
}
if (local_user()) {
$menu = Array(
t("Follow Thread") => $sub_link,
t("View Status") => $status_link,
t("View Profile") => $profile_link,
t("View Photos") => $photos_link,
t("Network Posts") => $posts_link,
t("Edit Contact") => $contact_url,
t("Send PM") => $pm_url
t('Follow Thread') => $sub_link,
t('View Status') => $status_link,
t('View Profile') => $profile_link,
t('View Photos') => $photos_link,
t('Network Posts') => $posts_link,
t('View Contact') => $contact_url,
t('Send PM') => $pm_url
);
if ($network == NETWORK_DFRN)
if ($network == NETWORK_DFRN) {
$menu[t("Poke")] = $poke_link;
}
if ((($cid == 0) OR ($rel == CONTACT_IS_FOLLOWER)) AND
in_array($item['network'], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA)))
$menu[t("Connect/Follow")] = "follow?url=".urlencode($item['author-link']);
} else
$menu = array(t("View Profile") => $item['author-link']);
in_array($item['network'], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA))) {
$menu[t('Connect/Follow')] = 'follow?url=' . urlencode($item['author-link']);
}
} else {
$menu = array(t('View Profile') => $item['author-link']);
}
$args = array('item' => $item, 'menu' => $menu);
@ -983,13 +990,14 @@ function item_photo_menu($item){
$menu = $args['menu'];
$o = "";
foreach($menu as $k=>$v){
if(strpos($v,'javascript:') === 0) {
$v = substr($v,11);
$o .= "<li role=\"menuitem\"><a onclick=\"$v\">$k</a></li>\n";
$o = '';
foreach ($menu as $k => $v) {
if (strpos($v, 'javascript:') === 0) {
$v = substr($v, 11);
$o .= '<li role="menuitem"><a onclick="' . $v . '">' . $k . '</a></li>' . PHP_EOL;
} elseif ($v!='') {
$o .= '<li role="menuitem"><a href="' . $v . '">' . $k . '</a></li>' . PHP_EOL;
}
elseif ($v!="") $o .= "<li role=\"menuitem\"><a href=\"$v\">$k</a></li>\n";
}
return $o;
}}

View file

@ -43,181 +43,165 @@ function nav(&$a) {
call_hooks('page_header', $a->page['nav']);
}
function nav_info(&$a) {
/**
* @brief Prepares a list of navigation links
*
* @param App $a
* @return array
*/
function nav_info(App $a)
{
$ssl_state = ((local_user()) ? true : false);
/*
*
* Our network is distributed, and as you visit friends some of the
* sites look exactly the same - it isn't always easy to know where you are.
* Display the current site location as a navigation aid.
*
*/
$myident = ((is_array($a->user) && isset($a->user['nickname'])) ? $a->user['nickname'] . '@' : '');
$sitelocation = $myident . substr($a->get_baseurl($ssl_state),strpos($a->get_baseurl($ssl_state),'//') + 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')
$nav = Array();
$nav = array();
/*
* Display login or logout
*/
$nav['usermenu']=array();
// Display login or logout
$nav['usermenu'] = array();
$userinfo = null;
if(local_user()) {
$nav['logout'] = Array('logout',t('Logout'), "", t('End this session'));
if (local_user()) {
$nav['logout'] = array('logout', t('Logout'), '', t('End this session'));
// user menu
$nav['usermenu'][] = Array('profile/' . $a->user['nickname'], t('Status'), "", t('Your posts and conversations'));
$nav['usermenu'][] = Array('profile/' . $a->user['nickname']. '?tab=profile', t('Profile'), "", t('Your profile page'));
$nav['usermenu'][] = Array('photos/' . $a->user['nickname'], t('Photos'), "", t('Your photos'));
$nav['usermenu'][] = Array('videos/' . $a->user['nickname'], t('Videos'), "", t('Your videos'));
$nav['usermenu'][] = Array('events/', t('Events'), "", t('Your events'));
$nav['usermenu'][] = Array('notes/', t('Personal notes'), "", t('Your personal notes'));
$nav['usermenu'][] = array('profile/' . $a->user['nickname'], t('Status'), '', t('Your posts and conversations'));
$nav['usermenu'][] = array('profile/' . $a->user['nickname'] . '?tab=profile', t('Profile'), '', t('Your profile page'));
$nav['usermenu'][] = array('photos/' . $a->user['nickname'], t('Photos'), '', t('Your photos'));
$nav['usermenu'][] = array('videos/' . $a->user['nickname'], t('Videos'), '', t('Your videos'));
$nav['usermenu'][] = array('events/', t('Events'), '', t('Your events'));
$nav['usermenu'][] = array('notes/', t('Personal notes'), '', t('Your personal notes'));
// user info
$r = q("SELECT micro FROM contact WHERE uid=%d AND self=1", intval($a->user['uid']));
$r = q("SELECT `micro` FROM `contact` WHERE `uid` = %d AND `self` = 1", intval($a->user['uid']));
$userinfo = array(
'icon' => (count($r) ? $a->remove_baseurl($r[0]['micro']) : "images/person-48.jpg"),
'icon' => (count($r) ? $a->remove_baseurl($r[0]['micro']) : 'images/person-48.jpg'),
'name' => $a->user['username'],
);
}
else {
$nav['login'] = Array('login',t('Login'), ($a->module == 'login'?'selected':''), t('Sign in'));
} else {
$nav['login'] = array('login', t('Login'), ($a->module == 'login' ? 'selected' : ''), t('Sign in'));
}
/*
* "Home" should also take you home from an authenticated remote profile connection
*/
// "Home" should also take you home from an authenticated remote profile connection
$homelink = get_my_url();
if(! $homelink)
if (! $homelink) {
$homelink = ((x($_SESSION,'visitor_home')) ? $_SESSION['visitor_home'] : '');
}
if(($a->module != 'home') && (! (local_user())))
$nav['home'] = array($homelink, t('Home'), "", t('Home Page'));
if (($a->module != 'home') && (! (local_user()))) {
$nav['home'] = array($homelink, t('Home'), '', t('Home Page'));
}
if(($a->config['register_policy'] == REGISTER_OPEN) && (! local_user()) && (! remote_user()))
$nav['register'] = array('register',t('Register'), "", t('Create an account'));
if (($a->config['register_policy'] == REGISTER_OPEN) && (! local_user()) && (! remote_user())) {
$nav['register'] = array('register', t('Register'), '', t('Create an account'));
}
$help_url = 'help';
if(! get_config('system','hide_help'))
$nav['help'] = array($help_url, t('Help'), "", t('Help and documentation'));
if (! get_config('system', 'hide_help')) {
$nav['help'] = array($help_url, t('Help'), '', t('Help and documentation'));
}
if(count($a->apps)>0)
$nav['apps'] = array('apps', t('Apps'), "", t('Addon applications, utilities, games'));
if (count($a->apps) > 0) {
$nav['apps'] = array('apps', t('Apps'), '', t('Addon applications, utilities, games'));
}
if (local_user() OR !get_config('system','local_search')) {
$nav['search'] = array('search', t('Search'), "", t('Search site content'));
if (local_user() OR !get_config('system', 'local_search')) {
$nav['search'] = array('search', t('Search'), '', t('Search site content'));
$nav['searchoption'] = array(
t("Full Text"),
t("Tags"),
t("Contacts"));
t('Full Text'),
t('Tags'),
t('Contacts'));
if (get_config('system','poco_local_search'))
$nav['searchoption'][] = t("Forums");
if (get_config('system', 'poco_local_search')) {
$nav['searchoption'][] = t('Forums');
}
}
$gdirpath = 'directory';
if(strlen(get_config('system','singleuser'))) {
$gdir = get_config('system','directory');
if(strlen($gdir))
$gdirpath = $gdir;
if (strlen(get_config('system', 'singleuser'))) {
$gdir = get_config('system', 'directory');
if(strlen($gdir)) {
$gdirpath = zrl($gdir, true);
}
} elseif (get_config('system', 'community_page_style') == CP_USERS_ON_SERVER) {
$nav['community'] = array('community', t('Community'), '', t('Conversations on this site'));
} elseif (get_config('system', 'community_page_style') == CP_GLOBAL_COMMUNITY) {
$nav['community'] = array('community', t('Community'), '', t('Conversations on the network'));
}
elseif(get_config('system','community_page_style') == CP_USERS_ON_SERVER)
$nav['community'] = array('community', t('Community'), "", t('Conversations on this site'));
elseif(get_config('system','community_page_style') == CP_GLOBAL_COMMUNITY)
$nav['community'] = array('community', t('Community'), "", t('Conversations on the network'));
if(local_user())
$nav['events'] = Array('events', t('Events'), "", t('Events and Calendar'));
if (local_user()) {
$nav['events'] = array('events', t('Events'), '', t('Events and Calendar'));
}
$nav['directory'] = array($gdirpath, t('Directory'), "", t('People directory'));
$nav['directory'] = array($gdirpath, t('Directory'), '', t('People directory'));
$nav['about'] = Array('friendica', t('Information'), "", t('Information about this friendica instance'));
$nav['about'] = array('friendica', t('Information'), '', t('Information about this friendica instance'));
/*
*
* The following nav links are only show to logged in users
*
*/
// The following nav links are only show to logged in users
if (local_user()) {
$nav['network'] = array('network', t('Network'), '', t('Conversations from your friends'));
$nav['net_reset'] = array('network/0?f=&order=comment&nets=all', t('Network Reset'), '', t('Load Network page with no filters'));
if(local_user()) {
$nav['home'] = array('profile/' . $a->user['nickname'], t('Home'), '', t('Your posts and conversations'));
$nav['network'] = array('network', t('Network'), "", t('Conversations from your friends'));
$nav['net_reset'] = array('network/0?f=&order=comment&nets=all', t('Network Reset'), "", t('Load Network page with no filters'));
$nav['home'] = array('profile/' . $a->user['nickname'], t('Home'), "", t('Your posts and conversations'));
if(in_array($_SESSION['page_flags'], array(PAGE_NORMAL, PAGE_SOAPBOX, PAGE_FREELOVE, PAGE_PRVGROUP))) {
/* only show friend requests for normal pages. Other page types have automatic friendship. */
if(in_array($_SESSION['page_flags'], array(PAGE_NORMAL, PAGE_SOAPBOX, PAGE_PRVGROUP)))
$nav['introductions'] = array('notifications/intros', t('Introductions'), "", t('Friend Requests'));
if(in_array($_SESSION['page_flags'], array(PAGE_NORMAL, PAGE_SOAPBOX, PAGE_FREELOVE))) {
$nav['notifications'] = array('notifications', t('Notifications'), "", t('Notifications'));
$nav['notifications']['all']=array('notifications/system', t('See all notifications'), "", "");
$nav['notifications']['mark'] = array('', t('Mark as seen'), '',t('Mark all system notifications seen'));
if (in_array($_SESSION['page_flags'], array(PAGE_NORMAL, PAGE_SOAPBOX, PAGE_FREELOVE, PAGE_PRVGROUP))) {
// only show friend requests for normal pages. Other page types have automatic friendship.
if (in_array($_SESSION['page_flags'], array(PAGE_NORMAL, PAGE_SOAPBOX, PAGE_PRVGROUP))) {
$nav['introductions'] = array('notifications/intros', t('Introductions'), '', t('Friend Requests'));
}
if (in_array($_SESSION['page_flags'], array(PAGE_NORMAL, PAGE_SOAPBOX, PAGE_FREELOVE))) {
$nav['notifications'] = array('notifications', t('Notifications'), '', t('Notifications'));
$nav['notifications']['all'] = array('notifications/system', t('See all notifications'), '', '');
$nav['notifications']['mark'] = array('', t('Mark as seen'), '', t('Mark all system notifications seen'));
}
}
$nav['messages'] = array('message', t('Messages'), "", t('Private mail'));
$nav['messages']['inbox'] = array('message', t('Inbox'), "", t('Inbox'));
$nav['messages']['outbox']= array('message/sent', t('Outbox'), "", t('Outbox'));
$nav['messages']['new'] = array('message/new', t('New Message'), "", t('New Message'));
$nav['messages'] = array('message', t('Messages'), '', t('Private mail'));
$nav['messages']['inbox'] = array('message', t('Inbox'), '', t('Inbox'));
$nav['messages']['outbox'] = array('message/sent', t('Outbox'), '', t('Outbox'));
$nav['messages']['new'] = array('message/new', t('New Message'), '', t('New Message'));
if(is_array($a->identities) && count($a->identities) > 1) {
$nav['manage'] = array('manage', t('Manage'), "", t('Manage other pages'));
if (is_array($a->identities) && count($a->identities) > 1) {
$nav['manage'] = array('manage', t('Manage'), '', t('Manage other pages'));
}
$nav['delegations'] = Array('delegate', t('Delegations'), "", t('Delegate Page Management'));
$nav['delegations'] = array('delegate', t('Delegations'), '', t('Delegate Page Management'));
$nav['settings'] = array('settings', t('Settings'),"", t('Account settings'));
$nav['settings'] = array('settings', t('Settings'), '', t('Account settings'));
if(feature_enabled(local_user(),'multi_profiles'))
$nav['profiles'] = array('profiles', t('Profiles'),"", t('Manage/Edit Profiles'));
if (feature_enabled(local_user(), 'multi_profiles')) {
$nav['profiles'] = array('profiles', t('Profiles'), '', t('Manage/Edit Profiles'));
}
$nav['contacts'] = array('contacts', t('Contacts'),"", t('Manage/edit friends and contacts'));
$nav['contacts'] = array('contacts', t('Contacts'), '', t('Manage/edit friends and contacts'));
}
/*
* Admin page
*/
if (is_site_admin()){
$nav['admin'] = array('admin/', t('Admin'), "", t('Site setup and configuration'));
}
if (is_site_admin()) {
$nav['admin'] = array('admin/', t('Admin'), '', t('Site setup and configuration'));
}
$nav['navigation'] = array('navigation/', t('Navigation'), '', t('Site map'));
$nav['navigation'] = array('navigation/', t('Navigation'), "", t('Site map'));
/*
*
* Provide a banner/logo/whatever
*
*/
$banner = get_config('system','banner');
if($banner === false)
$banner .= '<a href="http://friendica.com"><img id="logo-img" src="images/friendica-32.png" alt="logo" /></a><span id="logo-text"><a href="http://friendica.com">Friendica</a></span>';
// Provide a banner/logo/whatever
$banner = get_config('system', 'banner');
if ($banner === false) {
$banner = '<a href="http://friendica.com"><img id="logo-img" src="images/friendica-32.png" alt="logo" /></a><span id="logo-text"><a href="http://friendica.com">Friendica</a></span>';
}
call_hooks('nav_info', $nav);
return array(
'sitelocation' => $sitelocation,
'nav' => $nav,

View file

@ -130,7 +130,7 @@ function item_post(&$a) {
intval($parent_item['contact-id']),
intval($uid)
);
if(count($r))
if (dbm::is_result($r))
$parent_contact = $r[0];
// If the contact id doesn't fit with the contact, then set the contact to null
@ -175,6 +175,19 @@ function item_post(&$a) {
$app = ((x($_REQUEST,'source')) ? strip_tags($_REQUEST['source']) : '');
$extid = ((x($_REQUEST,'extid')) ? strip_tags($_REQUEST['extid']) : '');
// Check for multiple posts with the same message id (when the post was created via API)
if (($message_id != '') AND ($profile_uid != 0)) {
$r = q("SELECT * FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
dbesc($message_id),
intval($profile_uid)
);
if (dbm::is_result($r)) {
logger("Message with URI ".$message_id." already exists for user ".$profile_uid, LOGGER_DEBUG);
return;
}
}
$allow_moderated = false;
// here is where we are going to check for permission to post a moderated comment.
@ -220,7 +233,7 @@ function item_post(&$a) {
$r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
intval($profile_uid)
);
if(count($r))
if (dbm::is_result($r))
$user = $r[0];
if($orig_post) {
@ -385,7 +398,7 @@ function item_post(&$a) {
}
}
if(count($r)) {
if (dbm::is_result($r)) {
$author = $r[0];
$contact_id = $author['id'];
}
@ -399,7 +412,7 @@ function item_post(&$a) {
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1",
intval($profile_uid)
);
if(count($r))
if (dbm::is_result($r))
$contact_record = $r[0];
}
@ -482,7 +495,7 @@ function item_post(&$a) {
intval($profile_uid),
intval($attach)
);
if(count($r)) {
if (dbm::is_result($r)) {
$r = q("UPDATE `attach` SET `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s'
WHERE `uid` = %d AND `id` = %d",
dbesc($str_contact_allow),
@ -623,7 +636,7 @@ function item_post(&$a) {
intval($profile_uid),
intval($mtch)
);
if(count($r)) {
if (dbm::is_result($r)) {
if(strlen($attachments))
$attachments .= ',';
$attachments .= '[attach]href="' . $a->get_baseurl() . '/attach/' . $r[0]['id'] . '" length="' . $r[0]['filesize'] . '" type="' . $r[0]['filetype'] . '" title="' . (($r[0]['filename']) ? $r[0]['filename'] : '') . '"[/attach]';
@ -1002,16 +1015,35 @@ function item_post(&$a) {
// Insert an item entry for UID=0 for global entries
// We have to remove or change some data before that,
// so that the post appear like a regular received post.
unset($datarray['self']);
unset($datarray['wall']);
unset($datarray['origin']);
// Additionally there is some data that isn't a database field.
$arr = $datarray;
if (in_array($datarray['type'], array("net-comment", "wall-comment")))
$datarray['type'] = 'remote-comment';
elseif ($datarray['type'] == 'wall')
$datarray['type'] = 'remote';
$arr['app'] = $arr['source'];
unset($arr['source']);
add_shadow_entry($datarray);
unset($arr['self']);
unset($arr['wall']);
unset($arr['origin']);
unset($arr['api_source']);
unset($arr['message_id']);
unset($arr['profile_uid']);
unset($arr['post_id']);
unset($arr['dropitems']);
unset($arr['commenter']);
unset($arr['return']);
unset($arr['preview']);
unset($arr['post_id_random']);
unset($arr['emailcc']);
unset($arr['pubmail_enable']);
unset($arr['category']);
unset($arr['jsreload']);
if (in_array($arr['type'], array("net-comment", "wall-comment"))) {
$arr['type'] = 'remote-comment';
} elseif ($arr['type'] == 'wall') {
$arr['type'] = 'remote';
}
add_shadow_entry($arr);
}
// This is a real juggling act on shared hosting services which kill your processes

View file

@ -11,7 +11,7 @@
function(data){
$.colorbox({html:data});
}
);
);
}
function doEventPreview() {
@ -30,28 +30,69 @@
$('#id_finish_text').prop("disabled", false);
}
$(document).ready(function() {
$('#events-calendar').fullCalendar({
firstDay: {{$i18n.firstDay}},
monthNames: ['{{$i18n.January}}','{{$i18n.February}}','{{$i18n.March}}','{{$i18n.April}}','{{$i18n.May}}','{{$i18n.June}}','{{$i18n.July}}','{{$i18n.August}}','{{$i18n.September}}','{{$i18n.October}}','{{$i18n.November}}','{{$i18n.December}}'],
monthNamesShort: ['{{$i18n.Jan}}','{{$i18n.Feb}}','{{$i18n.Mar}}','{{$i18n.Apr}}','{{$i18n.May}}','{{$i18n.Jun}}','{{$i18n.Jul}}','{{$i18n.Aug}}','{{$i18n.Sep}}','{{$i18n.Oct}}','{{$i18n.Nov}}','{{$i18n.Dec}}'],
dayNames: ['{{$i18n.Sunday}}','{{$i18n.Monday}}','{{$i18n.Tuesday}}','{{$i18n.Wednesday}}','{{$i18n.Thursday}}','{{$i18n.Friday}}','{{$i18n.Saturday}}'],
dayNamesShort: ['{{$i18n.Sun}}','{{$i18n.Mon}}','{{$i18n.Tue}}','{{$i18n.Wed}}','{{$i18n.Thu}}','{{$i18n.Fri}}','{{$i18n.Sat}}'],
allDayText: '{{$i18n.allday}}',
noEventsMessage: '{{$i18n.noevent}}',
firstDay: '{{$i18n.firstDay|escape:'quotes'}}',
monthNames: [
'{{$i18n.January|escape:'quotes'}}',
'{{$i18n.February|escape:'quotes'}}',
'{{$i18n.March|escape:'quotes'}}',
'{{$i18n.April|escape:'quotes'}}',
'{{$i18n.May|escape:'quotes'}}',
'{{$i18n.June|escape:'quotes'}}',
'{{$i18n.July|escape:'quotes'}}',
'{{$i18n.August|escape:'quotes'}}',
'{{$i18n.September|escape:'quotes'}}',
'{{$i18n.October|escape:'quotes'}}',
'{{$i18n.November|escape:'quotes'}}',
'{{$i18n.December|escape:'quotes'}}'
],
monthNamesShort: [
'{{$i18n.Jan|escape:'quotes'}}',
'{{$i18n.Feb|escape:'quotes'}}',
'{{$i18n.Mar|escape:'quotes'}}',
'{{$i18n.Apr|escape:'quotes'}}',
'{{$i18n.May|escape:'quotes'}}',
'{{$i18n.Jun|escape:'quotes'}}',
'{{$i18n.Jul|escape:'quotes'}}',
'{{$i18n.Aug|escape:'quotes'}}',
'{{$i18n.Sep|escape:'quotes'}}',
'{{$i18n.Oct|escape:'quotes'}}',
'{{$i18n.Nov|escape:'quotes'}}',
'{{$i18n.Dec|escape:'quotes'}}'
],
dayNames: [
'{{$i18n.Sunday|escape:'quotes'}}',
'{{$i18n.Monday|escape:'quotes'}}',
'{{$i18n.Tuesday|escape:'quotes'}}',
'{{$i18n.Wednesday|escape:'quotes'}}',
'{{$i18n.Thursday|escape:'quotes'}}',
'{{$i18n.Friday|escape:'quotes'}}',
'{{$i18n.Saturday|escape:'quotes'}}'
],
dayNamesShort: [
'{{$i18n.Sun|escape:'quotes'}}',
'{{$i18n.Mon|escape:'quotes'}}',
'{{$i18n.Tue|escape:'quotes'}}',
'{{$i18n.Wed|escape:'quotes'}}',
'{{$i18n.Thu|escape:'quotes'}}',
'{{$i18n.Fri|escape:'quotes'}}',
'{{$i18n.Sat|escape:'quotes'}}'
],
allDayText: '{{$i18n.allday|escape:'quotes'}}',
noEventsMessage: '{{$i18n.noevent|escape:'quotes'}}',
buttonText: {
today: '{{$i18n.today}}',
month: '{{$i18n.month}}',
week: '{{$i18n.week}}',
day: '{{$i18n.day}}'
today: '{{$i18n.today|escape:'quotes'}}',
month: '{{$i18n.month|escape:'quotes'}}',
week: '{{$i18n.week|escape:'quotes'}}',
day: '{{$i18n.day|escape:'quotes'}}'
},
events: '{{$baseurl}}{{$module_url}}/json/',
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
},
timeFormat: 'H(:mm)',
eventClick: function(calEvent, jsEvent, view) {
showEvent(calEvent.id);
@ -61,9 +102,8 @@
$('td.fc-day').dblclick(function() { window.location.href='/events/new?start='+$(this).data('date'); });
}
},
eventRender: function(event, element, view) {
//console.log(view.name);
if (event.item['author-name']==null) return;
switch(view.name){
case "month":
@ -94,35 +134,33 @@
break;
}
}
})
// center on date
var args=location.href.replace(baseurl,"").split("/");
{{if $modparams == 2}}
{{if $modparams == 2}}
if (args.length>=5) {
$("#events-calendar").fullCalendar('gotoDate',args[3] , args[4]-1);
}
{{else}}
{{else}}
if (args.length>=4) {
$("#events-calendar").fullCalendar('gotoDate',args[2] , args[3]-1);
}
{{/if}}
{{/if}}
// show event popup
var hash = location.hash.split("-")
if (hash.length==2 && hash[0]=="#link") showEvent(hash[1]);
});
</script>
{{if $editselect != 'none'}}
<script language="javascript" type="text/javascript"
src="{{$baseurl}}/library/tinymce/jscripts/tiny_mce/tiny_mce_src.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
theme : "advanced",
mode : "textareas",
@ -139,8 +177,6 @@
entity_encoding : "raw",
add_unload_trigger : false,
remove_linebreaks : false,
//force_p_newlines : false,
//force_br_newlines : true,
forced_root_block : 'div',
content_css: "{{$baseurl}}/view/custom_tinymce.css",
theme_advanced_path : false,
@ -152,22 +188,21 @@
});
$(document).ready(function() {
$(document).ready(function() {
$('.comment-edit-bb').hide();
});
{{else}}
{{else}}
<script language="javascript" type="text/javascript">
{{/if}}
{{/if}}
$(document).ready(function() {
{{if $editselect = 'none'}}
$(document).ready(function() {
{{if $editselect = 'none'}}
$("#comment-edit-text-desc").bbco_autocomplete('bbcode');
{{/if}}
{{/if}}
$('#id_share').change(function() {
if ($('#id_share').is(':checked')) {
if ($('#id_share').is(':checked')) {
$('#acl-wrapper').show();
}
else {
@ -175,7 +210,6 @@
}
}).trigger('change');
$('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() {
var selstr;
$('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() {

View file

@ -5,7 +5,7 @@
<div class="event-wrapper">
<div class="event">
<div class="media">
<div class="event-owner pull-left">
<div class="event-owner media-left">
{{if $event.item.author_name}}
<a href="{{$event.item.author_link}}" ><img src="{{$event.item.author_avatar}}" /></a>
<a href="{{$event.item.author_link}}" >{{$event.item.author_name}}</a>

View file

@ -6,27 +6,67 @@
<script type="text/javascript" src="{{$baseurl}}/library/fullcalendar/fullcalendar.min.js"></script>
<script type="text/javascript" src="view/theme/frio/js/mod_events.js"></script>
<script language="javascript" type="text/javascript">
// pass php translation strings to js variables/arrays so we can make use of it in js files
aStr.monthNames = ['{{$i18n.January}}','{{$i18n.February}}','{{$i18n.March}}','{{$i18n.April}}','{{$i18n.May}}','{{$i18n.June}}','{{$i18n.July}}','{{$i18n.August}}','{{$i18n.September}}','{{$i18n.October}}','{{$i18n.November}}','{{$i18n.December}}'];
aStr.monthNamesShort = ['{{$i18n.Jan}}','{{$i18n.Feb}}','{{$i18n.Mar}}','{{$i18n.Apr}}','{{$i18n.May}}','{{$i18n.Jun}}','{{$i18n.Jul}}','{{$i18n.Aug}}','{{$i18n.Sep}}','{{$i18n.Oct}}','{{$i18n.Nov}}','{{$i18n.Dec}}'];
aStr.monthNamesShort = ['{{$i18n.Jan}}','{{$i18n.Feb}}','{{$i18n.Mar}}','{{$i18n.Apr}}','{{$i18n.May}}','{{$i18n.Jun}}','{{$i18n.Jul}}','{{$i18n.Aug}}','{{$i18n.Sep}}','{{$i18n.Oct}}','{{$i18n.Nov}}','{{$i18n.Dec}}'];
aStr.dayNames = ['{{$i18n.Sunday}}','{{$i18n.Monday}}','{{$i18n.Tuesday}}','{{$i18n.Wednesday}}','{{$i18n.Thursday}}','{{$i18n.Friday}}','{{$i18n.Saturday}}'];
aStr.dayNamesShort = ['{{$i18n.Sun}}','{{$i18n.Mon}}','{{$i18n.Tue}}','{{$i18n.Wed}}','{{$i18n.Thu}}','{{$i18n.Fri}}','{{$i18n.Sat}}'];
aStr.monthNames = [
'{{$i18n.January|escape:'quotes'}}',
'{{$i18n.February|escape:'quotes'}}',
'{{$i18n.March|escape:'quotes'}}',
'{{$i18n.April|escape:'quotes'}}',
'{{$i18n.May|escape:'quotes'}}',
'{{$i18n.June|escape:'quotes'}}',
'{{$i18n.July|escape:'quotes'}}',
'{{$i18n.August|escape:'quotes'}}',
'{{$i18n.September|escape:'quotes'}}',
'{{$i18n.October|escape:'quotes'}}',
'{{$i18n.November|escape:'quotes'}}',
'{{$i18n.December|escape:'quotes'}}'
];
aStr.monthNamesShort = [
'{{$i18n.Jan|escape:'quotes'}}',
'{{$i18n.Feb|escape:'quotes'}}',
'{{$i18n.Mar|escape:'quotes'}}',
'{{$i18n.Apr|escape:'quotes'}}',
'{{$i18n.May|escape:'quotes'}}',
'{{$i18n.Jun|escape:'quotes'}}',
'{{$i18n.Jul|escape:'quotes'}}',
'{{$i18n.Aug|escape:'quotes'}}',
'{{$i18n.Sep|escape:'quotes'}}',
'{{$i18n.Oct|escape:'quotes'}}',
'{{$i18n.Nov|escape:'quotes'}}',
'{{$i18n.Dec|escape:'quotes'}}'
];
aStr.dayNames = [
'{{$i18n.Sunday|escape:'quotes'}}',
'{{$i18n.Monday|escape:'quotes'}}',
'{{$i18n.Tuesday|escape:'quotes'}}',
'{{$i18n.Wednesday|escape:'quotes'}}',
'{{$i18n.Thursday|escape:'quotes'}}',
'{{$i18n.Friday|escape:'quotes'}}',
'{{$i18n.Saturday|escape:'quotes'}}'
];
aStr.dayNamesShort = [
'{{$i18n.Sun|escape:'quotes'}}',
'{{$i18n.Mon|escape:'quotes'}}',
'{{$i18n.Tue|escape:'quotes'}}',
'{{$i18n.Wed|escape:'quotes'}}',
'{{$i18n.Thu|escape:'quotes'}}',
'{{$i18n.Fri|escape:'quotes'}}',
'{{$i18n.Sat|escape:'quotes'}}'
];
aStr.firstDay = '{{$i18n.firstDay}}';
aStr.today = '{{$i18n.today}}';
aStr.month = '{{$i18n.month}}';
aStr.week = '{{$i18n.week}}';
aStr.day = '{{$i18n.day}}';
aStr.firstDay = '{{$i18n.firstDay|escape:'quotes'}}';
aStr.today = '{{$i18n.today|escape:'quotes'}}';
aStr.month = '{{$i18n.month|escape:'quotes'}}';
aStr.week = '{{$i18n.week|escape:'quotes'}}';
aStr.day = '{{$i18n.day|escape:'quotes'}}';
aStr.allday = '{{$i18n.allday}}';
aStr.noevent = '{{$i18n.noevent}}';
aStr.allday = '{{$i18n.allday|escape:'quotes'}}';
aStr.noevent = '{{$i18n.noevent|escape:'quotes'}}';
aStr.dtstartLabel = '{{$i18n.dtstart_label}}';
aStr.dtendLabel = '{{$i18n.dtend_label}}';
aStr.locationLabel = '{{$i18n.location_label}}';
aStr.dtstartLabel = '{{$i18n.dtstart_label|escape:'quotes'}}';
aStr.dtendLabel = '{{$i18n.dtend_label|escape:'quotes'}}';
aStr.locationLabel = '{{$i18n.location_label|escape:'quotes'}}';
var moduleUrl = '{{$module_url}}';
var modparams = {{$modparams}}
@ -38,7 +78,6 @@
src="{{$baseurl}}/library/tinymce/jscripts/tiny_mce/tiny_mce_src.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
theme : "advanced",
mode : "textareas",
@ -55,8 +94,6 @@
entity_encoding : "raw",
add_unload_trigger : false,
remove_linebreaks : false,
//force_p_newlines : false,
//force_br_newlines : true,
forced_root_block : 'div',
content_css: "{{$baseurl}}/view/custom_tinymce.css",
theme_advanced_path : false,
@ -68,18 +105,17 @@
});
$(document).ready(function() {
$(document).ready(function() {
$('.comment-edit-bb').hide();
});
{{else}}
{{else}}
<script language="javascript" type="text/javascript">
{{/if}}
{{/if}}
$(document).ready(function() {
{{if $editselect = 'none'}}
$(document).ready(function() {
{{if $editselect = 'none'}}
$("#comment-edit-text-desc").bbco_autocomplete('bbcode');
{{/if}}
{{/if}}
});