Redo some changes
This commit is contained in:
parent
bd62d548db
commit
bc2694bf7f
|
@ -1,60 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Friendica\Module;
|
|
||||||
|
|
||||||
use Friendica\BaseModule;
|
|
||||||
use Friendica\Model\Item;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Toggle pinned items
|
|
||||||
*/
|
|
||||||
class Pinned extends BaseModule
|
|
||||||
{
|
|
||||||
public static function rawContent($parameters)
|
|
||||||
{
|
|
||||||
$a = self::getApp();
|
|
||||||
$pinned = 0;
|
|
||||||
$itemId = null;
|
|
||||||
|
|
||||||
if (!local_user()) {
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
// @TODO: Replace with parameter from router
|
|
||||||
if ($a->argc > 1) {
|
|
||||||
$itemId = intval($a->argv[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$itemId) {
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
$item = Item::selectFirstForUser(local_user(), ['pinned'], ['uid' => local_user(), 'id' => $itemId]);
|
|
||||||
if (empty($item)) {
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!intval($item['pinned'])) {
|
|
||||||
$pinned = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Item::update(['pinned' => $pinned], ['id' => $itemId]);
|
|
||||||
|
|
||||||
// See if we've been passed a return path to redirect to
|
|
||||||
$returnPath = $_REQUEST['return'] ?? '';
|
|
||||||
if ($returnPath) {
|
|
||||||
$rand = '_=' . time();
|
|
||||||
if (strpos($returnPath, '?')) {
|
|
||||||
$rand = "&$rand";
|
|
||||||
} else {
|
|
||||||
$rand = "?$rand";
|
|
||||||
}
|
|
||||||
|
|
||||||
$a->internalRedirect($returnPath . $rand);
|
|
||||||
}
|
|
||||||
|
|
||||||
// the json doesn't really matter, it will either be 0 or 1
|
|
||||||
echo json_encode($pinned);
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -34,7 +34,7 @@
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
|
|
||||||
if (!defined('DB_UPDATE_VERSION')) {
|
if (!defined('DB_UPDATE_VERSION')) {
|
||||||
define('DB_UPDATE_VERSION', 1324);
|
define('DB_UPDATE_VERSION', 1323);
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
@ -1384,8 +1384,7 @@ return [
|
||||||
"iid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "relation" => ["item" => "id"], "comment" => "Item id"],
|
"iid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "relation" => ["item" => "id"], "comment" => "Item id"],
|
||||||
"uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "primary" => "1", "relation" => ["user" => "uid"], "comment" => "User id"],
|
"uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "primary" => "1", "relation" => ["user" => "uid"], "comment" => "User id"],
|
||||||
"hidden" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Marker to hide an item from the user"],
|
"hidden" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Marker to hide an item from the user"],
|
||||||
"ignored" => ["type" => "boolean", "comment" => "Ignore this thread if set"],
|
"ignored" => ["type" => "boolean", "comment" => "Ignore this thread if set"]
|
||||||
"pinned" => ["type" => "boolean", "comment" => "The item is pinned on the profile page"]
|
|
||||||
],
|
],
|
||||||
"indexes" => [
|
"indexes" => [
|
||||||
"PRIMARY" => ["uid", "iid"]
|
"PRIMARY" => ["uid", "iid"]
|
||||||
|
|
|
@ -179,9 +179,8 @@ return [
|
||||||
'/{type}/{customize}/{name}' => [Module\Photo::class, [R::GET]],
|
'/{type}/{customize}/{name}' => [Module\Photo::class, [R::GET]],
|
||||||
],
|
],
|
||||||
|
|
||||||
'/pinned/{item:\d+}' => [Module\Pinned::class, [R::GET]],
|
'/pretheme' => [Module\ThemeDetails::class, [R::GET]],
|
||||||
'/pretheme' => [Module\ThemeDetails::class, [R::GET]],
|
'/probe' => [Module\Debug\Probe::class, [R::GET]],
|
||||||
'/probe' => [Module\Debug\Probe::class, [R::GET]],
|
|
||||||
|
|
||||||
'/profile' => [
|
'/profile' => [
|
||||||
'/{nickname}' => [Module\Profile::class, [R::GET]],
|
'/{nickname}' => [Module\Profile::class, [R::GET]],
|
||||||
|
|
Loading…
Reference in New Issue
Block a user