"bower-asset/base64": "^1.0",
"bower-asset/Chart-js": "^2.7",
"bower-asset/perfect-scrollbar": "^0.6",
+ "bower-asset/vue": "^2.5",
"npm-asset/jquery": "^2.0",
"npm-asset/jquery-colorbox": "^1.6",
"npm-asset/jquery-datetimepicker": "^2.4.0",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
- "content-hash": "12b8df66213734281765cb6e2c5a786e",
+ "content-hash": "96062c2020a40f14b52e5e91c79995a7",
"packages": [
{
"name": "asika/simple-console",
"description": "Minimalistic but perfect custom scrollbar plugin",
"time": "2017-01-10T01:04:09+00:00"
},
+ {
+ "name": "bower-asset/vue",
+ "version": "v2.5.16",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/vuejs/vue.git",
+ "reference": "25342194016dc3bcc81cb3e8e229b0fb7ba1d1d6"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/vuejs/vue/zipball/25342194016dc3bcc81cb3e8e229b0fb7ba1d1d6",
+ "reference": "25342194016dc3bcc81cb3e8e229b0fb7ba1d1d6",
+ "shasum": ""
+ },
+ "type": "bower-asset-library"
+ },
{
"name": "divineomega/password_exposed",
"version": "v2.5.1",
$profile_name = $item['author-link'];
}
- $tags = [];
- $hashtags = [];
- $mentions = [];
-
- $searchpath = System::baseUrl()."/search?tag=";
-
- $taglist = dba::select('term', ['type', 'term', 'url'],
- ["`otype` = ? AND `oid` = ? AND `type` IN (?, ?)", TERM_OBJ_POST, $item['id'], TERM_HASHTAG, TERM_MENTION],
- ['order' => ['tid']]);
-
- while ($tag = dba::fetch($taglist)) {
- if ($tag["url"] == "") {
- $tag["url"] = $searchpath . strtolower($tag["term"]);
- }
-
- $tag["url"] = best_link_url($item, $sp, $tag["url"]);
-
- if ($tag["type"] == TERM_HASHTAG) {
- $hashtags[] = "#<a href=\"" . $tag["url"] . "\" target=\"_blank\">" . $tag["term"] . "</a>";
- $prefix = "#";
- } elseif ($tag["type"] == TERM_MENTION) {
- $mentions[] = "@<a href=\"" . $tag["url"] . "\" target=\"_blank\">" . $tag["term"] . "</a>";
- $prefix = "@";
- }
- $tags[] = $prefix."<a href=\"" . $tag["url"] . "\" target=\"_blank\">" . $tag["term"] . "</a>";
- }
- dba::close($taglist);
+ $tags = \Friendica\Model\Term::populateTagsFromItem($item);
$sp = false;
$profile_link = best_link_url($item, $sp);
}
$body_e = $body;
- $tags_e = $tags;
- $hashtags_e = $hashtags;
- $mentions_e = $mentions;
+ $tags_e = $tags['tags'];
+ $hashtags_e = $tags['hashtags'];
+ $mentions_e = $tags['mentions'];
$location_e = $location;
$owner_name_e = $owner_name;
function check_form_security_token($typename = '', $formname = 'form_security_token')
{
- if (!x($_REQUEST, $formname)) {
- return false;
+ $hash = null;
+
+ if (!empty($_REQUEST[$formname])) {
+ /// @TODO Careful, not secured!
+ $hash = $_REQUEST[$formname];
+ }
+
+ if (!empty($_SERVER['HTTP_X_CSRF_TOKEN'])) {
+ /// @TODO Careful, not secured!
+ $hash = $_SERVER['HTTP_X_CSRF_TOKEN'];
}
- /// @TODO Careful, not secured!
- $hash = $_REQUEST[$formname];
+ if (empty($hash)) {
+ return false;
+ }
$max_livetime = 10800; // 3 hours
$a = get_app();
Addon::callHooks('prepare_body_init', $item);
- $searchpath = System::baseUrl() . "/search?tag=";
-
- $tags = [];
- $hashtags = [];
- $mentions = [];
-
// In order to provide theme developers more possibilities, event items
// are treated differently.
if ($item['object-type'] === ACTIVITY_OBJ_EVENT && isset($item['event-id'])) {
return $ev;
}
- $taglist = dba::p("SELECT `type`, `term`, `url` FROM `term` WHERE `otype` = ? AND `oid` = ? AND `type` IN (?, ?) ORDER BY `tid`",
- intval(TERM_OBJ_POST), intval($item['id']), intval(TERM_HASHTAG), intval(TERM_MENTION));
-
- while ($tag = dba::fetch($taglist)) {
- if ($tag["url"] == "") {
- $tag["url"] = $searchpath . strtolower($tag["term"]);
- }
-
- $orig_tag = $tag["url"];
-
- $tag["url"] = best_link_url($item, $sp, $tag["url"]);
-
- if ($tag["type"] == TERM_HASHTAG) {
- if ($orig_tag != $tag["url"]) {
- $item['body'] = str_replace($orig_tag, $tag["url"], $item['body']);
- }
-
- $hashtags[] = "#<a href=\"" . $tag["url"] . "\" target=\"_blank\">" . $tag["term"] . "</a>";
- $prefix = "#";
- } elseif ($tag["type"] == TERM_MENTION) {
- $mentions[] = "@<a href=\"" . $tag["url"] . "\" target=\"_blank\">" . $tag["term"] . "</a>";
- $prefix = "@";
- }
-
- $tags[] = $prefix . "<a href=\"" . $tag["url"] . "\" target=\"_blank\">" . $tag["term"] . "</a>";
- }
- dba::close($taglist);
+ $tags = \Friendica\Model\Term::populateTagsFromItem($item);
- $item['tags'] = $tags;
- $item['hashtags'] = $hashtags;
- $item['mentions'] = $mentions;
+ $item['tags'] = $tags['tags'];
+ $item['hashtags'] = $tags['hashtags'];
+ $item['mentions'] = $tags['mentions'];
// Compile eventual content filter reasons
$filter_reasons = [];
{
// We store with the hostname as key to avoid problems with other applications
return $this->memcached->set(
- self::getApp()->get_hostname() . ":" . $key,
+ self::getApp()->get_hostname() . ':' . $key,
$value,
time() + $duration
);
public function delete($key)
{
- return $this->memcached->delete($key);
+ $return = $this->memcached->delete(self::getApp()->get_hostname() . ':' . $key);
+
+ return $return;
}
public function clear()
public function read($session_id)
{
- if (!x($session_id)) {
+ if (empty($session_id)) {
return '';
}
return true;
}
- Cache::set('session:' . $session_id, $session_data, Session::$expire);
+ $return = Cache::set('session:' . $session_id, $session_data, Session::$expire);
- return true;
+ return $return;
}
public function close()
public function destroy($id)
{
- Cache::delete('session:' . $id);
- return true;
+ $return = Cache::delete('session:' . $id);
+
+ return $return;
}
public function gc($maxlifetime)
]
];
+ \Friendica\Core\Addon::callHooks('dbstructure_definition', $database);
+
return $database;
}
}
use dba;
require_once 'boot.php';
+require_once 'include/conversation.php';
require_once 'include/dba.php';
class Term
}
}
}
+
+ /**
+ * Sorts an item's tags into mentions, hashtags and other tags. Generate personalized URLs by user and modify the
+ * provided item's body with them.
+ *
+ * @param array $item
+ * @return array
+ */
+ public static function populateTagsFromItem(&$item)
+ {
+ $return = [
+ 'tags' => [],
+ 'hashtags' => [],
+ 'mentions' => [],
+ ];
+
+ $searchpath = System::baseUrl() . "/search?tag=";
+
+ $taglist = dba::select(
+ 'term',
+ ['type', 'term', 'url'],
+ ["`otype` = ? AND `oid` = ? AND `type` IN (?, ?)", TERM_OBJ_POST, $item['id'], TERM_HASHTAG, TERM_MENTION],
+ ['order' => ['tid']]
+ );
+
+ while ($tag = dba::fetch($taglist)) {
+ if ($tag["url"] == "") {
+ $tag["url"] = $searchpath . strtolower($tag["term"]);
+ }
+
+ $orig_tag = $tag["url"];
+
+ $tag["url"] = best_link_url($item, $sp, $tag["url"]);
+
+ if ($tag["type"] == TERM_HASHTAG) {
+ if ($orig_tag != $tag["url"]) {
+ $item['body'] = str_replace($orig_tag, $tag["url"], $item['body']);
+ }
+
+ $return['hashtags'][] = "#<a href=\"" . $tag["url"] . "\" target=\"_blank\">" . $tag["term"] . "</a>";
+ $prefix = "#";
+ } elseif ($tag["type"] == TERM_MENTION) {
+ $return['mentions'][] = "@<a href=\"" . $tag["url"] . "\" target=\"_blank\">" . $tag["term"] . "</a>";
+ $prefix = "@";
+ }
+
+ $return['tags'][] = $prefix . "<a href=\"" . $tag["url"] . "\" target=\"_blank\">" . $tag["term"] . "</a>";
+ }
+ dba::close($taglist);
+
+ return $return;
+ }
}