Compare commits
11 Commits
425a114596
...
e28db58c66
Author | SHA1 | Date | |
---|---|---|---|
|
e28db58c66 | ||
|
bbb4b1eb60 | ||
|
022eec92f1 | ||
|
45371fb4d5 | ||
|
be7029942d | ||
|
fcbf2c0c2b | ||
|
a17210516a | ||
|
a4005b8fa5 | ||
|
7d07dd9861 | ||
|
7f41ca5729 | ||
|
e61c4e9a76 |
|
@ -131,7 +131,7 @@ class QvitterPlugin extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function onCheckSchema()
|
function onCheckSchema(): bool
|
||||||
{
|
{
|
||||||
$schema = Schema::get();
|
$schema = Schema::get();
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ class QvitterPlugin extends Plugin {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onBeforePluginCheckSchema()
|
public function onBeforePluginCheckSchema(): bool
|
||||||
{
|
{
|
||||||
QvitterNotification::beforeSchemaUpdate();
|
QvitterNotification::beforeSchemaUpdate();
|
||||||
return true;
|
return true;
|
||||||
|
@ -485,7 +485,7 @@ class QvitterPlugin extends Plugin {
|
||||||
* @return boolean hook return
|
* @return boolean hook return
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onEndAccountSettingsNav($action)
|
function onEndAccountSettingsNav($action): bool
|
||||||
{
|
{
|
||||||
$action_name = $action->trimmed('action');
|
$action_name = $action->trimmed('action');
|
||||||
|
|
||||||
|
@ -507,7 +507,7 @@ class QvitterPlugin extends Plugin {
|
||||||
* @return boolean hook return
|
* @return boolean hook return
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onEndAdminPanelNav($action)
|
function onEndAdminPanelNav($action): bool
|
||||||
{
|
{
|
||||||
|
|
||||||
$action_name = $action->trimmed('action');
|
$action_name = $action->trimmed('action');
|
||||||
|
@ -568,7 +568,7 @@ class QvitterPlugin extends Plugin {
|
||||||
$enclosure_o = $attachment->getEnclosure();
|
$enclosure_o = $attachment->getEnclosure();
|
||||||
|
|
||||||
// Oembed
|
// Oembed
|
||||||
if(array_key_exists('Oembed', StatusNet::getActivePlugins())) {
|
if(array_key_exists('Oembed', GNUsocial::getActiveModules())) {
|
||||||
$oembed = File_oembed::getKV('file_id',$attachment->id);
|
$oembed = File_oembed::getKV('file_id',$attachment->id);
|
||||||
if($oembed instanceof File_oembed) {
|
if($oembed instanceof File_oembed) {
|
||||||
$oembed_html = str_replace('<!--//-->','',$oembed->html); // trash left of wordpress' javascript after htmLawed removed the tags
|
$oembed_html = str_replace('<!--//-->','',$oembed->html); // trash left of wordpress' javascript after htmLawed removed the tags
|
||||||
|
@ -675,8 +675,8 @@ class QvitterPlugin extends Plugin {
|
||||||
|
|
||||||
// if this attachment has an url this might be a notice url
|
// if this attachment has an url this might be a notice url
|
||||||
if (isset($attachment['url'])) {
|
if (isset($attachment['url'])) {
|
||||||
$noticeurl = common_path('notice/', StatusNet::isHTTPS());
|
$noticeurl = common_path('notice/', GNUsocial::isHTTPS());
|
||||||
$instanceurl = common_path('', StatusNet::isHTTPS());
|
$instanceurl = common_path('', GNUsocial::isHTTPS());
|
||||||
|
|
||||||
// remove protocol for the comparison below
|
// remove protocol for the comparison below
|
||||||
$noticeurl_wo_protocol = preg_replace('(^https?://)', '', $noticeurl);
|
$noticeurl_wo_protocol = preg_replace('(^https?://)', '', $noticeurl);
|
||||||
|
@ -829,7 +829,7 @@ class QvitterPlugin extends Plugin {
|
||||||
* @return boolean hook return
|
* @return boolean hook return
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onTwitterUserArray($profile, &$twitter_user, $scoped)
|
function onTwitterUserArray($profile, &$twitter_user, $scoped): bool
|
||||||
{
|
{
|
||||||
|
|
||||||
$twitter_user['cover_photo'] = Profile_prefs::getConfigData($profile, 'qvitter', 'cover_photo');
|
$twitter_user['cover_photo'] = Profile_prefs::getConfigData($profile, 'qvitter', 'cover_photo');
|
||||||
|
@ -964,7 +964,7 @@ class QvitterPlugin extends Plugin {
|
||||||
/**
|
/**
|
||||||
* Remove likes in notification table on dislike
|
* Remove likes in notification table on dislike
|
||||||
*/
|
*/
|
||||||
public function onEndDisfavorNotice($profile, $notice)
|
public function onEndDisfavorNotice($profile, $notice): bool
|
||||||
{
|
{
|
||||||
$notif = new QvitterNotification();
|
$notif = new QvitterNotification();
|
||||||
$notif->from_profile_id = $profile->id;
|
$notif->from_profile_id = $profile->id;
|
||||||
|
@ -981,7 +981,7 @@ class QvitterPlugin extends Plugin {
|
||||||
*
|
*
|
||||||
* @return boolean hook flag
|
* @return boolean hook flag
|
||||||
*/
|
*/
|
||||||
function onStartNoticeDistribute($notice) {
|
function onStartNoticeDistribute($notice): bool {
|
||||||
|
|
||||||
assert($notice->id > 0); // since we removed tests below
|
assert($notice->id > 0); // since we removed tests below
|
||||||
|
|
||||||
|
@ -1061,7 +1061,7 @@ class QvitterPlugin extends Plugin {
|
||||||
*
|
*
|
||||||
* @return boolean hook flag
|
* @return boolean hook flag
|
||||||
*/
|
*/
|
||||||
public function onNoticeDeleteRelated($notice)
|
public function onNoticeDeleteRelated($notice): bool
|
||||||
{
|
{
|
||||||
|
|
||||||
$notif = new QvitterNotification();
|
$notif = new QvitterNotification();
|
||||||
|
@ -1093,7 +1093,7 @@ class QvitterPlugin extends Plugin {
|
||||||
$user_is_deleted = true;
|
$user_is_deleted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$user_is_deleted && class_exists('StatusNet') && !array_key_exists('ActivityModeration', StatusNet::getActivePlugins())) {
|
if(!$user_is_deleted && class_exists('GNUsocial') && !array_key_exists('ActivityModeration', GNUsocial::getActiveModules())) {
|
||||||
$rendered = sprintf(_m('<a href="%1$s">%2$s</a> deleted notice <a href="%3$s">{{%4$s}}</a>.'),
|
$rendered = sprintf(_m('<a href="%1$s">%2$s</a> deleted notice <a href="%3$s">{{%4$s}}</a>.'),
|
||||||
htmlspecialchars($profile->getUrl()),
|
htmlspecialchars($profile->getUrl()),
|
||||||
htmlspecialchars($profile->getBestName()),
|
htmlspecialchars($profile->getBestName()),
|
||||||
|
@ -1129,9 +1129,9 @@ class QvitterPlugin extends Plugin {
|
||||||
* @return boolean hook flag
|
* @return boolean hook flag
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function onEndHandleFeedEntry($activity) {
|
public function onEndHandleFeedEntry($activity): bool {
|
||||||
|
|
||||||
if($activity->verb == 'qvitter-delete-notice' && class_exists('StatusNet') && !array_key_exists('ActivityModeration', StatusNet::getActivePlugins())) {
|
if($activity->verb == 'qvitter-delete-notice' && class_exists('GNUsocial') && !array_key_exists('ActivityModeration', GNUsocial::getActiveModules())) {
|
||||||
|
|
||||||
$deleter_profile_uri = $activity->actor->id;
|
$deleter_profile_uri = $activity->actor->id;
|
||||||
$deleted_notice_uri = $activity->objects[0]->objects[0]->content;
|
$deleted_notice_uri = $activity->objects[0]->objects[0]->content;
|
||||||
|
@ -1170,7 +1170,7 @@ class QvitterPlugin extends Plugin {
|
||||||
*
|
*
|
||||||
* @return boolean hook flag
|
* @return boolean hook flag
|
||||||
*/
|
*/
|
||||||
public function onEndSubscribe($subscriber, $other)
|
public function onEndSubscribe($subscriber, $other): bool
|
||||||
{
|
{
|
||||||
if(Subscription::exists($subscriber, $other)) {
|
if(Subscription::exists($subscriber, $other)) {
|
||||||
$this->insertNotification($other->id, $subscriber->id, 'follow', 1);
|
$this->insertNotification($other->id, $subscriber->id, 'follow', 1);
|
||||||
|
@ -1178,7 +1178,7 @@ class QvitterPlugin extends Plugin {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
public function onEndUnsubscribe($subscriber, $other)
|
public function onEndUnsubscribe($subscriber, $other): bool
|
||||||
{
|
{
|
||||||
if(!Subscription::exists($subscriber, $other)) {
|
if(!Subscription::exists($subscriber, $other)) {
|
||||||
$notif = new QvitterNotification();
|
$notif = new QvitterNotification();
|
||||||
|
@ -1196,7 +1196,7 @@ class QvitterPlugin extends Plugin {
|
||||||
*
|
*
|
||||||
* @return boolean hook flag
|
* @return boolean hook flag
|
||||||
*/
|
*/
|
||||||
public function onEndLoadDoc($title, &$output)
|
public function onEndLoadDoc($title, &$output): bool
|
||||||
{
|
{
|
||||||
|
|
||||||
if($title == 'faq') {
|
if($title == 'faq') {
|
||||||
|
@ -1221,7 +1221,7 @@ class QvitterPlugin extends Plugin {
|
||||||
*
|
*
|
||||||
* @return boolean hook flag
|
* @return boolean hook flag
|
||||||
*/
|
*/
|
||||||
public function onStartPrimaryNav($action)
|
public function onStartPrimaryNav($action): bool
|
||||||
{
|
{
|
||||||
|
|
||||||
$action->menuItem(common_local_url('doc', array('title' => 'faq')),
|
$action->menuItem(common_local_url('doc', array('title' => 'faq')),
|
||||||
|
@ -1241,7 +1241,7 @@ class QvitterPlugin extends Plugin {
|
||||||
*
|
*
|
||||||
* @return boolean hook flag
|
* @return boolean hook flag
|
||||||
*/
|
*/
|
||||||
public function onStartUserRegister($profile)
|
public function onStartUserRegister($profile): bool
|
||||||
{
|
{
|
||||||
|
|
||||||
if(is_array(self::settings("blocked_ips"))) {
|
if(is_array(self::settings("blocked_ips"))) {
|
||||||
|
@ -1260,7 +1260,7 @@ class QvitterPlugin extends Plugin {
|
||||||
*
|
*
|
||||||
* @return boolean hook flag
|
* @return boolean hook flag
|
||||||
*/
|
*/
|
||||||
public function onEndFindMentions($sender, $text, &$mentions) {
|
public function onEndFindMentions($sender, $text, &$mentions): bool {
|
||||||
|
|
||||||
// get the correct group profiles
|
// get the correct group profiles
|
||||||
if(isset($_POST['post_to_groups'])) {
|
if(isset($_POST['post_to_groups'])) {
|
||||||
|
@ -1298,7 +1298,7 @@ class QvitterPlugin extends Plugin {
|
||||||
*
|
*
|
||||||
* @return boolean hook flag
|
* @return boolean hook flag
|
||||||
*/
|
*/
|
||||||
public function onEndSetApiUser($user) {
|
public function onEndSetApiUser($user): bool {
|
||||||
|
|
||||||
// cleanup sessions, to allow for simultaneous http-requests,
|
// cleanup sessions, to allow for simultaneous http-requests,
|
||||||
// e.g. if posting a notice takes a very long time
|
// e.g. if posting a notice takes a very long time
|
||||||
|
@ -1369,7 +1369,7 @@ class QvitterPlugin extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function onPluginVersion(array &$versions)
|
function onPluginVersion(array &$versions): bool
|
||||||
{
|
{
|
||||||
$versions[] = array('name' => 'Qvitter',
|
$versions[] = array('name' => 'Qvitter',
|
||||||
'version' => '5-alpha',
|
'version' => '5-alpha',
|
||||||
|
@ -1417,7 +1417,7 @@ class QvitterPlugin extends Plugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($largest_avatar['size']>0) {
|
if($largest_avatar['size']>0) {
|
||||||
$origurl = common_path('', StatusNet::isHTTPS()).$largest_avatar['name'];
|
$origurl = common_path('', GNUsocial::isHTTPS()).$largest_avatar['name'];
|
||||||
} else {
|
} else {
|
||||||
$origurl = $twitter_user['profile_image_url_profile_size'];
|
$origurl = $twitter_user['profile_image_url_profile_size'];
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
· ·
|
· ·
|
||||||
· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · */
|
· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · */
|
||||||
|
|
||||||
|
require_once INSTALLDIR . '/lib/util/tempfile.php';
|
||||||
|
|
||||||
if (!defined('GNUSOCIAL')) {
|
if (!defined('GNUSOCIAL')) {
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -93,12 +94,13 @@ class ApiAccountUpdateProfileBannerAction extends ApiAuthAction
|
||||||
$this->img = str_replace(' ', '+', $this->img);
|
$this->img = str_replace(' ', '+', $this->img);
|
||||||
$this->img = base64_decode($this->img, true);
|
$this->img = base64_decode($this->img, true);
|
||||||
|
|
||||||
$fh = tmpfile();
|
$fh = new TemporaryFile('gs-mediaupload');
|
||||||
fwrite($fh, $this->img);
|
fwrite($fh->getResource(), $this->img);
|
||||||
unset($this->img);
|
unset($this->img);
|
||||||
fseek($fh, 0);
|
|
||||||
|
|
||||||
$mediafile = MediaFile::fromFilehandle($fh, $this->scoped);
|
fflush($fh->getResouce());
|
||||||
|
$mediafile = MediaFile::fromFileInfo($fh, $this->scoped);
|
||||||
|
unset($fh);
|
||||||
}
|
}
|
||||||
|
|
||||||
// maybe resize
|
// maybe resize
|
||||||
|
|
|
@ -74,8 +74,8 @@ class ApiQvitterOembedNoticeAction extends ApiAction
|
||||||
{
|
{
|
||||||
parent::handle();
|
parent::handle();
|
||||||
|
|
||||||
$noticeurl = common_path('notice/', StatusNet::isHTTPS());
|
$noticeurl = common_path('notice/', GNUsocial::isHTTPS());
|
||||||
$instanceurl = common_path('', StatusNet::isHTTPS());
|
$instanceurl = common_path('', GNUsocial::isHTTPS());
|
||||||
|
|
||||||
// remove protocol for the comparison below
|
// remove protocol for the comparison below
|
||||||
$noticeurl_wo_protocol = preg_replace('(^https?://)', '', $noticeurl);
|
$noticeurl_wo_protocol = preg_replace('(^https?://)', '', $noticeurl);
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
· ·
|
· ·
|
||||||
· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · */
|
· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · */
|
||||||
|
|
||||||
|
require_once INSTALLDIR . '/lib/util/tempfile.php';
|
||||||
|
|
||||||
if (!defined('GNUSOCIAL')) {
|
if (!defined('GNUSOCIAL')) {
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -90,15 +91,14 @@ class ApiUpdateAvatarAction extends ApiAuthAction
|
||||||
|
|
||||||
$imagefile = null;
|
$imagefile = null;
|
||||||
// write the image to a temporary file
|
// write the image to a temporary file
|
||||||
$fh = tmpfile();
|
$fh = new TemporaryFile('gs-mediaupload');
|
||||||
fwrite($fh, $this->img);
|
fwrite($fh->getResource(), $this->img);
|
||||||
unset($this->img); // no need to keep it in memory
|
unset($this->img); // no need to keep it in memory
|
||||||
// seek back to position 0, so we don't read EOF directly
|
|
||||||
fseek($fh, 0);
|
|
||||||
// read the temporary file as an uploaded image, will store File object
|
// read the temporary file as an uploaded image, will store File object
|
||||||
$mediafile = MediaFile::fromFilehandle($fh, $this->scoped);
|
fflush($fh->getResource());
|
||||||
// Deletes the temporary file, if it was needed we stored it in fromFilehandle
|
$mediafile = MediaFile::fromFileInfo($fh, $this->scoped);
|
||||||
fclose($fh);
|
// Deletes the temporary file, if it was needed we stored it in fromFileInfo
|
||||||
|
unset($fh);
|
||||||
|
|
||||||
// Now try to get it as an ImageFile since it has some handy functions
|
// Now try to get it as an ImageFile since it has some handy functions
|
||||||
$imagefile = ImageFile::fromFileObject($mediafile->fileRecord);
|
$imagefile = ImageFile::fromFileObject($mediafile->fileRecord);
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
· ·
|
· ·
|
||||||
· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · */
|
· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · */
|
||||||
|
|
||||||
|
require_once INSTALLDIR . '/lib/util/tempfile.php';
|
||||||
|
|
||||||
if (!defined('GNUSOCIAL')) {
|
if (!defined('GNUSOCIAL')) {
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -91,15 +92,15 @@ class ApiUpdateBackgroundImageAction extends ApiAuthAction
|
||||||
$imagefile = null;
|
$imagefile = null;
|
||||||
|
|
||||||
// put the image data in a temporary file
|
// put the image data in a temporary file
|
||||||
$fh = tmpfile();
|
$fh = new TemporaryFile('gs-mediaupload')
|
||||||
fwrite($fh, $this->img);
|
fwrite($fh->getResource(), $this->img);
|
||||||
unset($this->img);
|
unset($this->img);
|
||||||
fseek($fh, 0); // go to beginning just to be sure the content is read properly
|
|
||||||
|
|
||||||
// We get a MediaFile with a File object using the filehandle
|
// We get a MediaFile with a File object using the filehandle
|
||||||
$mediafile = MediaFile::fromFilehandle($fh, $this->scoped);
|
fflush($fh->getResource());
|
||||||
|
$mediafile = MediaFile::fromFileInfo($fh, $this->scoped);
|
||||||
// and can dispose of the temporary filehandle since we're certain we have a File on disk now
|
// and can dispose of the temporary filehandle since we're certain we have a File on disk now
|
||||||
fclose($fh);
|
unset($fh);
|
||||||
|
|
||||||
$imagefile = ImageFile::fromFileObject($mediafile->fileRecord);
|
$imagefile = ImageFile::fromFileObject($mediafile->fileRecord);
|
||||||
unset($mediafile); // No need to keep the MediaFile around anymore, everything we need is in ImageFile
|
unset($mediafile); // No need to keep the MediaFile around anymore, everything we need is in ImageFile
|
||||||
|
|
|
@ -97,20 +97,20 @@ class QvitterAction extends ApiAction
|
||||||
$sitetitle = common_config('site','name');
|
$sitetitle = common_config('site','name');
|
||||||
$siterootdomain = common_config('site','server');
|
$siterootdomain = common_config('site','server');
|
||||||
$qvitterpath = Plugin::staticPath('Qvitter', '');
|
$qvitterpath = Plugin::staticPath('Qvitter', '');
|
||||||
$apiroot = common_path('api/', StatusNet::isHTTPS());
|
$apiroot = common_path('api/', GNUsocial::isHTTPS());
|
||||||
$instanceurl = common_path('', StatusNet::isHTTPS());
|
$instanceurl = common_path('', GNUsocial::isHTTPS());
|
||||||
$favicon_path = QvitterPlugin::settings("favicon_path");
|
$favicon_path = QvitterPlugin::settings("favicon_path");
|
||||||
$attachmentconfig=common_config('attachments');
|
$attachmentconfig=common_config('attachments');
|
||||||
if(StatusNet::isHTTPS() && $attachmentconfig['sslserver']){
|
if(GNUsocial::isHTTPS() && $attachmentconfig['sslserver']){
|
||||||
$attachmentroot ='https://'.$attachmentconfig['sslserver'].$attachmentconfig['path'];
|
$attachmentroot ='https://'.$attachmentconfig['sslserver'].$attachmentconfig['path'];
|
||||||
} elseif(!StatusNet::isHTTPS() && $attachmentconfig['server']) {
|
} elseif(!GNUsocial::isHTTPS() && $attachmentconfig['server']) {
|
||||||
$attachmentroot ='http://'.$attachmentconfig['server'].$attachmentconfig['path'];
|
$attachmentroot ='http://'.$attachmentconfig['server'].$attachmentconfig['path'];
|
||||||
} else {
|
} else {
|
||||||
$attachmentroot = $instanceurl.$attachmentconfig['path'];
|
$attachmentroot = $instanceurl.$attachmentconfig['path'];
|
||||||
}
|
}
|
||||||
$avatarconfig=common_config('avatar');
|
$avatarconfig=common_config('avatar');
|
||||||
if($avatarconfig['server']) {
|
if($avatarconfig['server']) {
|
||||||
if(StatusNet::isHTTPS() ){
|
if(GNUsocial::isHTTPS() ){
|
||||||
$avatarroot ='https://'.$avatarconfig['server'].$avatarconfig['path'];
|
$avatarroot ='https://'.$avatarconfig['server'].$avatarconfig['path'];
|
||||||
} else {
|
} else {
|
||||||
$avatarroot ='http://'.$avatarconfig['server'].$avatarconfig['path'];
|
$avatarroot ='http://'.$avatarconfig['server'].$avatarconfig['path'];
|
||||||
|
@ -206,7 +206,7 @@ class QvitterAction extends ApiAction
|
||||||
}
|
}
|
||||||
|
|
||||||
// maybe openid
|
// maybe openid
|
||||||
if (array_key_exists('OpenID', StatusNet::getActivePlugins())) {
|
if (array_key_exists('OpenID', GNUsocial::getActiveModules())) {
|
||||||
print ' <link rel="openid2.provider" href="'.common_local_url('openidserver').'"/>'."\n";
|
print ' <link rel="openid2.provider" href="'.common_local_url('openidserver').'"/>'."\n";
|
||||||
print ' <link rel="openid2.local_id" href="'.$user->getProfile()->profileurl.'"/>'."\n";
|
print ' <link rel="openid2.local_id" href="'.$user->getProfile()->profileurl.'"/>'."\n";
|
||||||
print ' <link rel="openid2.server" href="'.common_local_url('openidserver').'"/>'."\n";
|
print ' <link rel="openid2.server" href="'.common_local_url('openidserver').'"/>'."\n";
|
||||||
|
@ -246,7 +246,7 @@ class QvitterAction extends ApiAction
|
||||||
// oembed discovery for local notices, and twitter cards
|
// oembed discovery for local notices, and twitter cards
|
||||||
if(substr($_SERVER['REQUEST_URI'],0,8) == '/notice/'
|
if(substr($_SERVER['REQUEST_URI'],0,8) == '/notice/'
|
||||||
&& $this->arg('notice')
|
&& $this->arg('notice')
|
||||||
&& array_key_exists('Oembed', StatusNet::getActivePlugins())) {
|
&& array_key_exists('Oembed', GNUsocial::getActiveModules())) {
|
||||||
$notice = Notice::getKV('id', $this->arg('notice'));
|
$notice = Notice::getKV('id', $this->arg('notice'));
|
||||||
|
|
||||||
if($notice instanceof Notice) {
|
if($notice instanceof Notice) {
|
||||||
|
@ -371,7 +371,7 @@ class QvitterAction extends ApiAction
|
||||||
window.timeBetweenPolling = <?php print QvitterPlugin::settings("timebetweenpolling"); ?>;
|
window.timeBetweenPolling = <?php print QvitterPlugin::settings("timebetweenpolling"); ?>;
|
||||||
window.apiRoot = <?php
|
window.apiRoot = <?php
|
||||||
|
|
||||||
$api_root = common_path("api/", StatusNet::isHTTPS());
|
$api_root = common_path("api/", GNUsocial::isHTTPS());
|
||||||
if($this_site_thinks_it_is_http_but_is_actually_https) {
|
if($this_site_thinks_it_is_http_but_is_actually_https) {
|
||||||
$api_root = str_replace('http://','https://',$api_root);
|
$api_root = str_replace('http://','https://',$api_root);
|
||||||
}
|
}
|
||||||
|
@ -430,6 +430,9 @@ class QvitterAction extends ApiAction
|
||||||
if($disable_keyboard_shortcuts == '1' || $disable_keyboard_shortcuts == 1) {
|
if($disable_keyboard_shortcuts == '1' || $disable_keyboard_shortcuts == 1) {
|
||||||
$disable_keyboard_shortcuts = true;
|
$disable_keyboard_shortcuts = true;
|
||||||
}
|
}
|
||||||
|
if (is_null($disable_keyboard_shortcuts)) {
|
||||||
|
$disable_keyboard_shortcuts = false;
|
||||||
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
@ -645,7 +648,7 @@ class QvitterAction extends ApiAction
|
||||||
<input type="hidden" id="token" name="token" value="<?php print common_session_token(); ?>">
|
<input type="hidden" id="token" name="token" value="<?php print common_session_token(); ?>">
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (array_key_exists('OpenID', StatusNet::getActivePlugins())) {
|
if (array_key_exists('OpenID', GNUsocial::getActiveModules())) {
|
||||||
print '<a href="'.$instanceurl.'main/openid" id="openid-login" title="OpenID" donthijack>OpenID</a>';
|
print '<a href="'.$instanceurl.'main/openid" id="openid-login" title="OpenID" donthijack>OpenID</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2615,6 +2615,11 @@ function buildAttachmentHTML(attachments){
|
||||||
noCoverClass=' no-cover';
|
noCoverClass=' no-cover';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// After uploading media, until creating thumbnail, thumbnail url is null.
|
||||||
|
if (!this.url) {
|
||||||
|
this.url = '';
|
||||||
|
}
|
||||||
|
|
||||||
// play button for videos and animated gifs
|
// play button for videos and animated gifs
|
||||||
var playButtonClass = '';
|
var playButtonClass = '';
|
||||||
if(typeof this.animated != 'undefined' && this.animated === true
|
if(typeof this.animated != 'undefined' && this.animated === true
|
||||||
|
|
151
js/qvitter.js
151
js/qvitter.js
|
@ -3213,6 +3213,10 @@ $('body').on('keyup paste input', 'div.queet-box-syntax', function() {
|
||||||
currentVal = currentVal.replace(/<br>$/, '').replace(/ $/, '').replace(/ $/, ''); // fix
|
currentVal = currentVal.replace(/<br>$/, '').replace(/ $/, '').replace(/ $/, ''); // fix
|
||||||
$(this).siblings('.syntax-two').html(currentVal);
|
$(this).siblings('.syntax-two').html(currentVal);
|
||||||
|
|
||||||
|
// If user click post area before load finished (top gnu logo), this is undefined.
|
||||||
|
if (!window.syntaxHighlightingRegexps) {
|
||||||
|
window.syntaxHighlightingRegexps = Object();
|
||||||
|
}
|
||||||
|
|
||||||
// loop through the regexps and highlight
|
// loop through the regexps and highlight
|
||||||
$.each(window.syntaxHighlightingRegexps,function(k,v){
|
$.each(window.syntaxHighlightingRegexps,function(k,v){
|
||||||
|
@ -3377,121 +3381,66 @@ $('body').on('keyup', 'div.queet-box-syntax', function(e) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// check for user mentions
|
|
||||||
window.lastMention = new Object();
|
window.lastMention = new Object();
|
||||||
$('body').on('keyup', 'div.queet-box-syntax', function(e) {
|
// check for user mentions
|
||||||
|
$('body').on('keyup', 'div.queet-box-syntax', function(e) { checkMentions(e, true);});
|
||||||
var queetBox = $(this);
|
|
||||||
var cursorPosArray = getSelectionInElement(queetBox[0]);
|
|
||||||
var cursorPos = cursorPosArray[0];
|
|
||||||
|
|
||||||
// add space before linebreaks (to separate mentions in beginning of new lines when .text():ing later)
|
|
||||||
if(e.keyCode == '13') {
|
|
||||||
e.preventDefault();
|
|
||||||
var range = createRangeFromCharacterIndices(queetBox[0], cursorPos, cursorPos);
|
|
||||||
range.insertNode(document.createTextNode(" \n"));
|
|
||||||
}
|
|
||||||
else if(e.keyCode != '40' && e.keyCode != '38' && e.keyCode != '13' && e.keyCode != '9') {
|
|
||||||
var contents = queetBox.text().substring(0,cursorPos);
|
|
||||||
var mentionPos = contents.lastIndexOf('@');
|
|
||||||
var check_contents = contents.substring(mentionPos - 1, cursorPos);
|
|
||||||
var regex = /(^|\s|\.|\n)(@)[a-zA-Z0-9]+/;
|
|
||||||
var match = check_contents.match(regex);
|
|
||||||
if (contents.indexOf('@') >= 0 && match) {
|
|
||||||
|
|
||||||
if(contents.lastIndexOf('@') > 1) {
|
|
||||||
match[0] = match[0].substring(1,match[0].length);
|
|
||||||
}
|
|
||||||
if((contents.lastIndexOf('@')+match[0].length) == cursorPos) {
|
|
||||||
|
|
||||||
queetBox.siblings('.mentions-suggestions').children('.user-suggestion').remove();
|
|
||||||
queetBox.siblings('.mentions-suggestions').css('top',(queetBox.height()+20) + 'px');
|
|
||||||
var term = match[0].substring(match[0].lastIndexOf('@')+1, match[0].length).toLowerCase();
|
|
||||||
window.lastMention.mentionPos = mentionPos;
|
|
||||||
window.lastMention.cursorPos = cursorPos;
|
|
||||||
|
|
||||||
|
|
||||||
// see if anyone we're following matches
|
|
||||||
var suggestionsToShow = [];
|
|
||||||
var suggestionsUsernameCount = {};
|
|
||||||
suggestionsUsernameCount[window.loggedIn.screen_name] = 1; // any suggestions with the same screen name as mine will get their server url added
|
|
||||||
$.each(window.following,function(){
|
|
||||||
var userregex = new RegExp(term);
|
|
||||||
if(this.username.toLowerCase().match(userregex) || this.name.toLowerCase().match(userregex)) {
|
|
||||||
suggestionsToShow.push({avatar:this.avatar, name:this.name, username:this.username,url:this.url});
|
|
||||||
|
|
||||||
// count the usernames to see if we need to show the server for any of them
|
|
||||||
if(typeof suggestionsUsernameCount[this.username] != 'undefined') {
|
|
||||||
suggestionsUsernameCount[this.username] = suggestionsUsernameCount[this.username] + 1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
suggestionsUsernameCount[this.username] = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// show matches
|
|
||||||
$.each(suggestionsToShow,function(){
|
|
||||||
var serverHtml = '';
|
|
||||||
if(suggestionsUsernameCount[this.username]>1 && this.url !== false) {
|
|
||||||
serverHtml = '@' + this.url;
|
|
||||||
}
|
|
||||||
queetBox.siblings('.mentions-suggestions').append('<div class="user-suggestion" title="@' + this.username + serverHtml + '"><img height="24" width="24" src="' + this.avatar + '" /><strong>' + this.name + '</strong> @<span>' + this.username + serverHtml + '</span></div>')
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
queetBox.siblings('.mentions-suggestions').children('.user-suggestion').remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
queetBox.siblings('.mentions-suggestions').children('.user-suggestion').remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
// check for group mentions
|
// check for group mentions
|
||||||
$('body').on('keyup', 'div.queet-box-syntax', function(e) {
|
$('body').on('keyup', 'div.queet-box-syntax', function(e) { checkMentions(e, false);});
|
||||||
|
|
||||||
var queetBox = $(this);
|
/**
|
||||||
|
* check for user/group mentions
|
||||||
|
*
|
||||||
|
* @param {Object} e: Event object
|
||||||
|
* @param {boolean} isUser
|
||||||
|
*/
|
||||||
|
function checkMentions(e, isUser) {
|
||||||
|
var mark = '!';
|
||||||
|
var prefix = 'group';
|
||||||
|
if (isUser) {
|
||||||
|
mark = '@';
|
||||||
|
prefix = 'user';
|
||||||
|
}
|
||||||
|
|
||||||
|
// var queetBox = $(this);
|
||||||
|
var queetBox = $('body div.queet-box-syntax');
|
||||||
var cursorPosArray = getSelectionInElement(queetBox[0]);
|
var cursorPosArray = getSelectionInElement(queetBox[0]);
|
||||||
var cursorPos = cursorPosArray[0];
|
var cursorPos = cursorPosArray[0];
|
||||||
|
|
||||||
// add space before linebreaks (to separate mentions in beginning of new lines when .text():ing later)
|
if(e.keyCode != '40' && e.keyCode != '38' && e.keyCode != '13' && e.keyCode != '9') {
|
||||||
if(e.keyCode == '13') {
|
|
||||||
e.preventDefault();
|
|
||||||
var range = createRangeFromCharacterIndices(queetBox[0], cursorPos, cursorPos);
|
|
||||||
range.insertNode(document.createTextNode(" \n"));
|
|
||||||
}
|
|
||||||
else if(e.keyCode != '40' && e.keyCode != '38' && e.keyCode != '13' && e.keyCode != '9') {
|
|
||||||
var contents = queetBox.text().substring(0,cursorPos);
|
var contents = queetBox.text().substring(0,cursorPos);
|
||||||
var mentionPos = contents.lastIndexOf('!');
|
var mentionPos = contents.lastIndexOf(mark);
|
||||||
var check_contents = contents.substring(mentionPos - 1, cursorPos);
|
var check_contents = contents.substring(mentionPos - 1, cursorPos);
|
||||||
var regex = /(^|\s|\.|\n)(!)[a-zA-Z0-9]+/;
|
var regex = new RegExp('(^|\s|\.|\n)(' + mark + ')[a-zA-Z0-9]+');
|
||||||
var match = check_contents.match(regex);
|
var match = check_contents.match(regex);
|
||||||
if (contents.indexOf('!') >= 0 && match) {
|
if (contents.indexOf(mark) >= 0 && match) {
|
||||||
|
|
||||||
if(contents.lastIndexOf('!') > 1) {
|
if(contents.lastIndexOf(mark) > 1) {
|
||||||
match[0] = match[0].substring(1,match[0].length);
|
match[0] = match[0].substring(1,match[0].length);
|
||||||
}
|
}
|
||||||
if((contents.lastIndexOf('!')+match[0].length) == cursorPos) {
|
if((contents.lastIndexOf(mark)+match[0].length) == cursorPos) {
|
||||||
|
|
||||||
queetBox.siblings('.mentions-suggestions').children('.group-suggestion').remove();
|
queetBox.siblings('.mentions-suggestions').children('.' + prefix + '-suggestion').remove();
|
||||||
queetBox.siblings('.mentions-suggestions').css('top',(queetBox.height()+20) + 'px');
|
queetBox.siblings('.mentions-suggestions').css('top',(queetBox.height()+20) + 'px');
|
||||||
var term = match[0].substring(match[0].lastIndexOf('!')+1, match[0].length).toLowerCase();
|
var term = match[0].substring(match[0].lastIndexOf(mark)+1, match[0].length).toLowerCase();
|
||||||
window.lastMention.mentionPos = mentionPos;
|
window.lastMention.mentionPos = mentionPos;
|
||||||
window.lastMention.cursorPos = cursorPos;
|
window.lastMention.cursorPos = cursorPos;
|
||||||
|
|
||||||
|
|
||||||
// see if any group we're member of matches
|
// see if any user/group we're following matches
|
||||||
var suggestionsToShow = [];
|
var suggestionsToShow = [];
|
||||||
var suggestionsUsernameCount = {};
|
var suggestionsUsernameCount = {};
|
||||||
$.each(window.groupMemberships,function(){
|
if (isUser) {
|
||||||
|
suggestionsUsernameCount[window.loggedIn.screen_name] = 1; // any suggestions with the same screen name as mine will get their server url added
|
||||||
|
}
|
||||||
|
var targets = isUser ? (window.following) : (window.groupMemberships);
|
||||||
|
$.each(targets, function(){
|
||||||
var userregex = new RegExp(term);
|
var userregex = new RegExp(term);
|
||||||
if(this.username.toLowerCase().match(userregex) || this.name.toLowerCase().match(userregex)) {
|
if(this.username.toLowerCase().match(userregex) || this.name.toLowerCase().match(userregex)) {
|
||||||
suggestionsToShow.push({id:this.id, avatar:this.avatar, name:this.name, username:this.username,url:this.url});
|
var suggestion = {avatar:this.avatar, name:this.name, username:this.username,url:this.url};
|
||||||
|
if (!isUser) {
|
||||||
|
suggestion.id = this.id;
|
||||||
|
}
|
||||||
|
suggestionsToShow.push(suggestion);
|
||||||
|
|
||||||
// count the usernames to see if we need to show the server for any of them
|
// count the usernames to see if we need to show the server for any of them
|
||||||
if(typeof suggestionsUsernameCount[this.username] != 'undefined') {
|
if(typeof suggestionsUsernameCount[this.username] != 'undefined') {
|
||||||
|
@ -3507,23 +3456,27 @@ $('body').on('keyup', 'div.queet-box-syntax', function(e) {
|
||||||
$.each(suggestionsToShow,function(){
|
$.each(suggestionsToShow,function(){
|
||||||
var serverHtml = '';
|
var serverHtml = '';
|
||||||
if(suggestionsUsernameCount[this.username]>1 && this.url !== false) {
|
if(suggestionsUsernameCount[this.username]>1 && this.url !== false) {
|
||||||
serverHtml = this.url + '/group/';
|
serverHtml = isUser ? ('@' + this.url) : (this.url + '/group/');
|
||||||
|
}
|
||||||
|
if (isUser) {
|
||||||
|
queetBox.siblings('.mentions-suggestions').append('<div class="user-suggestion" title="@' + this.username + serverHtml + '"><img height="24" width="24" src="' + this.avatar + '" /><strong>' + this.name + '</strong> @<span>' + this.username + serverHtml + '</span></div>')
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
queetBox.siblings('.mentions-suggestions').append('<div class="group-suggestion" title="' + serverHtml + this.username + '" data-group-id="' + this.id + '"><img height="24" width="24" src="' + this.avatar + '" /><strong>' + this.name + '</strong> !<span>' + this.username + '</span></div>')
|
||||||
}
|
}
|
||||||
queetBox.siblings('.mentions-suggestions').append('<div class="group-suggestion" title="' + serverHtml + this.username + '" data-group-id="' + this.id + '"><img height="24" width="24" src="' + this.avatar + '" /><strong>' + this.name + '</strong> !<span>' + this.username + '</span></div>')
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
queetBox.siblings('.mentions-suggestions').children('.group-suggestion').remove();
|
queetBox.siblings('.mentions-suggestions').children('.' + prefix + '-suggestion').remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
queetBox.siblings('.mentions-suggestions').children('.group-suggestion').remove();
|
queetBox.siblings('.mentions-suggestions').children('.' + prefix + '-suggestion').remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ·
|
/* ·
|
||||||
·
|
·
|
||||||
|
|
|
@ -198,8 +198,8 @@
|
||||||
"profileAndSettings":"Perfil i ajustos",
|
"profileAndSettings":"Perfil i ajustos",
|
||||||
"profileSettings":"Ajustos del perfil",
|
"profileSettings":"Ajustos del perfil",
|
||||||
"thisIsABookmark":"Això és un marcador va crear en l'interfície Clàssic",
|
"thisIsABookmark":"Això és un marcador va crear en l'interfície Clàssic",
|
||||||
"thisIsARemoteUser":"<strong>Attention!</strong> This is a remote user. This page is only a cached copy of their profile, and includes only data known to this GNU social instance. Go to the <a href=\"{remote-profile-url}\" donthijack>user's profile on their server</a> to view their full profile.",
|
"thisIsARemoteUser":"<strong>Atenció!</strong>Est és un usuari remot. Aquesta pàgina és només una còpia en caché del seu perfil, i inclou només dades conegudes per aquesta instància social de GNU.Aneu a la <a href=\"{remote-profile-url}\" donthijack>perfil de l'usuari en el seu servidor</a> per veure el seu perfil complet.",
|
||||||
"findSomeone":"Find someone",
|
"findSomeone":"Troba a algú",
|
||||||
"findSomeoneTooltip":"Input a username or a profile url, e.g. @localuser or https://remote.instance/nickname",
|
"findSomeoneTooltip":"Introdueixi un nom d'usuari o una adreça URL de perfil, per exemple @localuser o https://remote.instance/nickname",
|
||||||
"tooltipAttachFile":"Attach a file"
|
"tooltipAttachFile":"Adjuntar un arxiu"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user