CSR changes, split dbclean in separate processes if worker is active
This commit is contained in:
parent
31409e2ca1
commit
b429b85680
10 changed files with 592 additions and 589 deletions
|
@ -126,8 +126,15 @@ function cron_run(&$argv, &$argc){
|
||||||
|
|
||||||
proc_run(PRIORITY_LOW,'include/expire.php');
|
proc_run(PRIORITY_LOW,'include/expire.php');
|
||||||
|
|
||||||
|
if (get_config("system", "worker")) {
|
||||||
|
proc_run(PRIORITY_LOW,'include/dbclean.php', 1);
|
||||||
|
proc_run(PRIORITY_LOW,'include/dbclean.php', 2);
|
||||||
|
proc_run(PRIORITY_LOW,'include/dbclean.php', 3);
|
||||||
|
proc_run(PRIORITY_LOW,'include/dbclean.php', 4);
|
||||||
|
} else {
|
||||||
proc_run(PRIORITY_LOW,'include/dbclean.php');
|
proc_run(PRIORITY_LOW,'include/dbclean.php');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Clear cache entries
|
// Clear cache entries
|
||||||
cron_clear_cache($a);
|
cron_clear_cache($a);
|
||||||
|
|
|
@ -66,10 +66,10 @@ class dba {
|
||||||
if (! mysqli_connect_errno()) {
|
if (! mysqli_connect_errno()) {
|
||||||
$this->connected = true;
|
$this->connected = true;
|
||||||
}
|
}
|
||||||
if (isset($a->config["system"]["db_charset"]))
|
if (isset($a->config["system"]["db_charset"])) {
|
||||||
$this->db->set_charset($a->config["system"]["db_charset"]);
|
$this->db->set_charset($a->config["system"]["db_charset"]);
|
||||||
}
|
}
|
||||||
else {
|
} else {
|
||||||
$this->mysqli = false;
|
$this->mysqli = false;
|
||||||
$this->db = mysql_connect($server,$user,$pass);
|
$this->db = mysql_connect($server,$user,$pass);
|
||||||
if ($this->db && mysql_select_db($db,$this->db)) {
|
if ($this->db && mysql_select_db($db,$this->db)) {
|
||||||
|
@ -111,7 +111,7 @@ class dba {
|
||||||
/**
|
/**
|
||||||
* @brief Returns the number of rows
|
* @brief Returns the number of rows
|
||||||
*
|
*
|
||||||
* @return string
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function num_rows() {
|
public function num_rows() {
|
||||||
if (!$this->result)
|
if (!$this->result)
|
||||||
|
@ -134,11 +134,11 @@ class dba {
|
||||||
$this->error = '';
|
$this->error = '';
|
||||||
|
|
||||||
// Check the connection (This can reconnect the connection - if configured)
|
// Check the connection (This can reconnect the connection - if configured)
|
||||||
if ($this->mysqli)
|
if ($this->mysqli) {
|
||||||
$connected = $this->db->ping();
|
$connected = $this->db->ping();
|
||||||
else
|
} else {
|
||||||
$connected = mysql_ping($this->db);
|
$connected = mysql_ping($this->db);
|
||||||
|
}
|
||||||
$connstr = ($connected ? "Connected": "Disonnected");
|
$connstr = ($connected ? "Connected": "Disonnected");
|
||||||
|
|
||||||
$stamp1 = microtime(true);
|
$stamp1 = microtime(true);
|
||||||
|
@ -149,11 +149,11 @@ class dba {
|
||||||
$sql = "/*".$a->callstack()." */ ".$sql;
|
$sql = "/*".$a->callstack()." */ ".$sql;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->mysqli)
|
if ($this->mysqli) {
|
||||||
$result = @$this->db->query($sql);
|
$result = @$this->db->query($sql);
|
||||||
else
|
} else {
|
||||||
$result = @mysql_query($sql,$this->db);
|
$result = @mysql_query($sql,$this->db);
|
||||||
|
}
|
||||||
$stamp2 = microtime(true);
|
$stamp2 = microtime(true);
|
||||||
$duration = (float)($stamp2-$stamp1);
|
$duration = (float)($stamp2-$stamp1);
|
||||||
|
|
||||||
|
@ -191,16 +191,17 @@ class dba {
|
||||||
|
|
||||||
$mesg = '';
|
$mesg = '';
|
||||||
|
|
||||||
if($result === false)
|
if ($result === false) {
|
||||||
$mesg = 'false';
|
$mesg = 'false';
|
||||||
elseif($result === true)
|
} elseif ($result === true) {
|
||||||
$mesg = 'true';
|
$mesg = 'true';
|
||||||
else {
|
} else {
|
||||||
if($this->mysqli)
|
if ($this->mysqli) {
|
||||||
$mesg = $result->num_rows . ' results' . EOL;
|
$mesg = $result->num_rows . ' results' . EOL;
|
||||||
else
|
} else {
|
||||||
$mesg = mysql_num_rows($result) . ' results' . EOL;
|
$mesg = mysql_num_rows($result) . ' results' . EOL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$str = 'SQL = ' . printable($sql) . EOL . 'SQL returned ' . $mesg
|
$str = 'SQL = ' . printable($sql) . EOL . 'SQL returned ' . $mesg
|
||||||
. (($this->error) ? ' error: ' . $this->error : '')
|
. (($this->error) ? ' error: ' . $this->error : '')
|
||||||
|
@ -236,8 +237,7 @@ class dba {
|
||||||
$r[] = $x;
|
$r[] = $x;
|
||||||
$result->free_result();
|
$result->free_result();
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (mysql_num_rows($result)) {
|
if (mysql_num_rows($result)) {
|
||||||
while($x = mysql_fetch_array($result, MYSQL_ASSOC))
|
while($x = mysql_fetch_array($result, MYSQL_ASSOC))
|
||||||
$r[] = $x;
|
$r[] = $x;
|
||||||
|
@ -282,29 +282,32 @@ class dba {
|
||||||
|
|
||||||
public function escape($str) {
|
public function escape($str) {
|
||||||
if ($this->db && $this->connected) {
|
if ($this->db && $this->connected) {
|
||||||
if($this->mysqli)
|
if ($this->mysqli) {
|
||||||
return @$this->db->real_escape_string($str);
|
return @$this->db->real_escape_string($str);
|
||||||
else
|
} else {
|
||||||
return @mysql_real_escape_string($str,$this->db);
|
return @mysql_real_escape_string($str,$this->db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function connected() {
|
function connected() {
|
||||||
if ($this->mysqli)
|
if ($this->mysqli) {
|
||||||
$connected = $this->db->ping();
|
$connected = $this->db->ping();
|
||||||
else
|
} else {
|
||||||
$connected = mysql_ping($this->db);
|
$connected = mysql_ping($this->db);
|
||||||
|
}
|
||||||
return $connected;
|
return $connected;
|
||||||
}
|
}
|
||||||
|
|
||||||
function __destruct() {
|
function __destruct() {
|
||||||
if ($this->db)
|
if ($this->db) {
|
||||||
if($this->mysqli)
|
if ($this->mysqli) {
|
||||||
$this->db->close();
|
$this->db->close();
|
||||||
else
|
} else {
|
||||||
mysql_close($this->db);
|
mysql_close($this->db);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
|
|
||||||
if (! function_exists('printable')) {
|
if (! function_exists('printable')) {
|
||||||
|
@ -327,10 +330,11 @@ function dbg($state) {
|
||||||
if (! function_exists('dbesc')) {
|
if (! function_exists('dbesc')) {
|
||||||
function dbesc($str) {
|
function dbesc($str) {
|
||||||
global $db;
|
global $db;
|
||||||
if($db && $db->connected)
|
if ($db && $db->connected) {
|
||||||
return($db->escape($str));
|
return($db->escape($str));
|
||||||
else
|
} else {
|
||||||
return(str_replace("'","\\'",$str));
|
return(str_replace("'","\\'",$str));
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
|
||||||
|
@ -412,10 +416,11 @@ if(! function_exists('dbq')) {
|
||||||
function dbq($sql) {
|
function dbq($sql) {
|
||||||
|
|
||||||
global $db;
|
global $db;
|
||||||
if($db && $db->connected)
|
if ($db && $db->connected) {
|
||||||
$ret = $db->q($sql);
|
$ret = $db->q($sql);
|
||||||
else
|
} else {
|
||||||
$ret = false;
|
$ret = false;
|
||||||
|
}
|
||||||
return $ret;
|
return $ret;
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
|
|
@ -21,51 +21,68 @@ function dbclean_run(&$argv, &$argc) {
|
||||||
load_config('config');
|
load_config('config');
|
||||||
load_config('system');
|
load_config('system');
|
||||||
|
|
||||||
remove_orphans();
|
if ($argc == 2) {
|
||||||
|
$stage = intval($argv[1]);
|
||||||
|
} else {
|
||||||
|
$stage = 0;
|
||||||
|
}
|
||||||
|
remove_orphans($stage);
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Remove orphaned database entries
|
* @brief Remove orphaned database entries
|
||||||
*/
|
*/
|
||||||
function remove_orphans() {
|
function remove_orphans($stage = 0) {
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
|
if (($stage == 1) OR ($stage == 0)) {
|
||||||
logger("Deleting orphaned data from thread table");
|
logger("Deleting orphaned data from thread table");
|
||||||
if ($db->q("SELECT `iid` FROM `thread` WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`parent` = `thread`.`iid`)", true)) {
|
if ($db->q("SELECT `iid` FROM `thread` WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`parent` = `thread`.`iid`)", true)) {
|
||||||
logger("found thread orphans: ".$db->num_rows());
|
logger("found thread orphans: ".$db->num_rows());
|
||||||
while ($orphan = $db->qfetch())
|
while ($orphan = $db->qfetch()) {
|
||||||
q("DELETE FROM `thread` WHERE `iid` = %d", intval($orphan["iid"]));
|
q("DELETE FROM `thread` WHERE `iid` = %d", intval($orphan["iid"]));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$db->qclose();
|
$db->qclose();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($stage == 2) OR ($stage == 0)) {
|
||||||
logger("Deleting orphaned data from notify table");
|
logger("Deleting orphaned data from notify table");
|
||||||
if ($db->q("SELECT `iid` FROM `notify` WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`id` = `notify`.`iid`)", true)) {
|
if ($db->q("SELECT `iid` FROM `notify` WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`id` = `notify`.`iid`)", true)) {
|
||||||
logger("found notify orphans: ".$db->num_rows());
|
logger("found notify orphans: ".$db->num_rows());
|
||||||
while ($orphan = $db->qfetch())
|
while ($orphan = $db->qfetch()) {
|
||||||
q("DELETE FROM `notify` WHERE `iid` = %d", intval($orphan["iid"]));
|
q("DELETE FROM `notify` WHERE `iid` = %d", intval($orphan["iid"]));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$db->qclose();
|
$db->qclose();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (($stage == 3) OR ($stage == 0)) {
|
||||||
logger("Deleting orphaned data from sign table");
|
logger("Deleting orphaned data from sign table");
|
||||||
if ($db->q("SELECT `iid` FROM `sign` WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`id` = `sign`.`iid`)", true)) {
|
if ($db->q("SELECT `iid` FROM `sign` WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`id` = `sign`.`iid`)", true)) {
|
||||||
logger("found sign orphans: ".$db->num_rows());
|
logger("found sign orphans: ".$db->num_rows());
|
||||||
while ($orphan = $db->qfetch())
|
while ($orphan = $db->qfetch()) {
|
||||||
q("DELETE FROM `sign` WHERE `iid` = %d", intval($orphan["iid"]));
|
q("DELETE FROM `sign` WHERE `iid` = %d", intval($orphan["iid"]));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$db->qclose();
|
$db->qclose();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (($stage == 4) OR ($stage == 0)) {
|
||||||
logger("Deleting orphaned data from term table");
|
logger("Deleting orphaned data from term table");
|
||||||
if ($db->q("SELECT `oid` FROM `term` WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`id` = `term`.`oid`)", true)) {
|
if ($db->q("SELECT `oid` FROM `term` WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`id` = `term`.`oid`)", true)) {
|
||||||
logger("found term orphans: ".$db->num_rows());
|
logger("found term orphans: ".$db->num_rows());
|
||||||
while ($orphan = $db->qfetch())
|
while ($orphan = $db->qfetch()) {
|
||||||
q("DELETE FROM `term` WHERE `oid` = %d", intval($orphan["oid"]));
|
q("DELETE FROM `term` WHERE `oid` = %d", intval($orphan["oid"]));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$db->qclose();
|
$db->qclose();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @todo Based on the following query we should remove some more data
|
||||||
// SELECT `id`, `received`, `created`, `guid` FROM `item` WHERE `uid` = 0 AND NOT EXISTS (SELECT `guid` FROM `item` AS `i` WHERE `item`.`guid` = `i`.`guid` AND `i`.`uid` != 0) LIMIT 1;
|
// SELECT `id`, `received`, `created`, `guid` FROM `item` WHERE `uid` = 0 AND NOT EXISTS (SELECT `guid` FROM `item` AS `i` WHERE `item`.`guid` = `i`.`guid` AND `i`.`uid` != 0) LIMIT 1;
|
||||||
|
|
||||||
logger("Done deleting orphaned data from tables");
|
logger("Done deleting orphaned data from tables");
|
||||||
|
|
|
@ -44,9 +44,9 @@ class dbm {
|
||||||
*/
|
*/
|
||||||
public static function is_result($array) {
|
public static function is_result($array) {
|
||||||
// It could be a return value from an update statement
|
// It could be a return value from an update statement
|
||||||
if (is_bool($array))
|
if (is_bool($array)) {
|
||||||
return $array;
|
return $array;
|
||||||
|
}
|
||||||
return (is_array($array) && count($array) > 0);
|
return (is_array($array) && count($array) > 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,15 +69,13 @@ function limit_body_size($body) {
|
||||||
$new_body = $new_body . substr($orig_body, 0, $maxlen - $textlen);
|
$new_body = $new_body . substr($orig_body, 0, $maxlen - $textlen);
|
||||||
$textlen = $maxlen;
|
$textlen = $maxlen;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$new_body = $new_body . substr($orig_body, 0, $img_start);
|
$new_body = $new_body . substr($orig_body, 0, $img_start);
|
||||||
$textlen += $img_start;
|
$textlen += $img_start;
|
||||||
}
|
}
|
||||||
|
|
||||||
$new_body = $new_body . substr($orig_body, $img_start, $img_end - $img_start);
|
$new_body = $new_body . substr($orig_body, $img_start, $img_end - $img_start);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
|
|
||||||
if ( ($textlen + $img_end) > $maxlen ) {
|
if ( ($textlen + $img_end) > $maxlen ) {
|
||||||
if ($textlen < $maxlen) {
|
if ($textlen < $maxlen) {
|
||||||
|
@ -85,8 +83,7 @@ function limit_body_size($body) {
|
||||||
$new_body = $new_body . substr($orig_body, 0, $maxlen - $textlen);
|
$new_body = $new_body . substr($orig_body, 0, $maxlen - $textlen);
|
||||||
$textlen = $maxlen;
|
$textlen = $maxlen;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$new_body = $new_body . substr($orig_body, 0, $img_end);
|
$new_body = $new_body . substr($orig_body, 0, $img_end);
|
||||||
$textlen += $img_end;
|
$textlen += $img_end;
|
||||||
}
|
}
|
||||||
|
@ -107,16 +104,14 @@ function limit_body_size($body) {
|
||||||
$new_body = $new_body . substr($orig_body, 0, $maxlen - $textlen);
|
$new_body = $new_body . substr($orig_body, 0, $maxlen - $textlen);
|
||||||
$textlen = $maxlen;
|
$textlen = $maxlen;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
logger('limit_body_size: the text size with embedded images extracted did not violate the limit', LOGGER_DEBUG);
|
logger('limit_body_size: the text size with embedded images extracted did not violate the limit', LOGGER_DEBUG);
|
||||||
$new_body = $new_body . $orig_body;
|
$new_body = $new_body . $orig_body;
|
||||||
$textlen += strlen($orig_body);
|
$textlen += strlen($orig_body);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $new_body;
|
return $new_body;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
return $body;
|
return $body;
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
@ -319,9 +314,7 @@ function item_add_language_opt(&$arr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$postopts = $arr['postopts'];
|
$postopts = $arr['postopts'];
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$postopts = "";
|
$postopts = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -614,8 +607,7 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
|
||||||
$deny_cid = $arr['deny_cid'];
|
$deny_cid = $arr['deny_cid'];
|
||||||
$deny_gid = $arr['deny_gid'];
|
$deny_gid = $arr['deny_gid'];
|
||||||
$notify_type = 'wall-new';
|
$notify_type = 'wall-new';
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
|
|
||||||
// find the parent and snarf the item id and ACLs
|
// find the parent and snarf the item id and ACLs
|
||||||
// and anything else we need to inherit
|
// and anything else we need to inherit
|
||||||
|
@ -689,8 +681,7 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
|
||||||
$parent_id = 0;
|
$parent_id = 0;
|
||||||
$arr['parent-uri'] = $arr['uri'];
|
$arr['parent-uri'] = $arr['uri'];
|
||||||
$arr['gravity'] = 0;
|
$arr['gravity'] = 0;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
logger('item_store: item parent '.$arr['parent-uri'].' for '.$arr['uid'].' was not found - ignoring item');
|
logger('item_store: item parent '.$arr['parent-uri'].' for '.$arr['uid'].' was not found - ignoring item');
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -931,17 +922,18 @@ function item_set_last_item($arr) {
|
||||||
if (!$update AND ($arr["network"] == NETWORK_DFRN) AND ($arr["parent-uri"] === $arr["uri"])) {
|
if (!$update AND ($arr["network"] == NETWORK_DFRN) AND ($arr["parent-uri"] === $arr["uri"])) {
|
||||||
$isforum = q("SELECT `forum` FROM `contact` WHERE `id` = %d AND `forum`",
|
$isforum = q("SELECT `forum` FROM `contact` WHERE `id` = %d AND `forum`",
|
||||||
intval($arr['contact-id']));
|
intval($arr['contact-id']));
|
||||||
if ($isforum)
|
if ($isforum) {
|
||||||
$update = true;
|
$update = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($update)
|
if ($update) {
|
||||||
q("UPDATE `contact` SET `success_update` = '%s', `last-item` = '%s' WHERE `id` = %d",
|
q("UPDATE `contact` SET `success_update` = '%s', `last-item` = '%s' WHERE `id` = %d",
|
||||||
dbesc($arr['received']),
|
dbesc($arr['received']),
|
||||||
dbesc($arr['received']),
|
dbesc($arr['received']),
|
||||||
intval($arr['contact-id'])
|
intval($arr['contact-id'])
|
||||||
);
|
);
|
||||||
|
}
|
||||||
// Now do the same for the system wide contacts with uid=0
|
// Now do the same for the system wide contacts with uid=0
|
||||||
if (!$arr['private']) {
|
if (!$arr['private']) {
|
||||||
q("UPDATE `contact` SET `success_update` = '%s', `last-item` = '%s' WHERE `id` = %d",
|
q("UPDATE `contact` SET `success_update` = '%s', `last-item` = '%s' WHERE `id` = %d",
|
||||||
|
@ -950,7 +942,7 @@ function item_set_last_item($arr) {
|
||||||
intval($arr['owner-id'])
|
intval($arr['owner-id'])
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($arr['owner-id'] != $arr['author-id'])
|
if ($arr['owner-id'] != $arr['author-id']) {
|
||||||
q("UPDATE `contact` SET `success_update` = '%s', `last-item` = '%s' WHERE `id` = %d",
|
q("UPDATE `contact` SET `success_update` = '%s', `last-item` = '%s' WHERE `id` = %d",
|
||||||
dbesc($arr['received']),
|
dbesc($arr['received']),
|
||||||
dbesc($arr['received']),
|
dbesc($arr['received']),
|
||||||
|
@ -958,6 +950,7 @@ function item_set_last_item($arr) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function item_body_set_hashtags(&$item) {
|
function item_body_set_hashtags(&$item) {
|
||||||
|
|
||||||
|
@ -1506,8 +1499,7 @@ function lose_follower($importer,$contact,$datarray = array(),$item = "") {
|
||||||
intval(CONTACT_IS_SHARING),
|
intval(CONTACT_IS_SHARING),
|
||||||
intval($contact['id'])
|
intval($contact['id'])
|
||||||
);
|
);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
contact_remove($contact['id']);
|
contact_remove($contact['id']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1519,8 +1511,7 @@ function lose_sharer($importer,$contact,$datarray = array(),$item = "") {
|
||||||
intval(CONTACT_IS_FOLLOWER),
|
intval(CONTACT_IS_FOLLOWER),
|
||||||
intval($contact['id'])
|
intval($contact['id'])
|
||||||
);
|
);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
contact_remove($contact['id']);
|
contact_remove($contact['id']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1622,8 +1613,7 @@ function fix_private_photos($s, $uid, $item = null, $cid = 0) {
|
||||||
if (in_array($cid, $recips)) {
|
if (in_array($cid, $recips)) {
|
||||||
$replace = true;
|
$replace = true;
|
||||||
}
|
}
|
||||||
}
|
} elseif ($item) {
|
||||||
elseif($item) {
|
|
||||||
if (compare_permissions($item,$r[0]))
|
if (compare_permissions($item,$r[0]))
|
||||||
$replace = true;
|
$replace = true;
|
||||||
}
|
}
|
||||||
|
@ -2011,8 +2001,7 @@ function drop_item($id,$interactive = true) {
|
||||||
create_files_from_itemuri($item['parent-uri'], $item['uid']);
|
create_files_from_itemuri($item['parent-uri'], $item['uid']);
|
||||||
delete_thread_uri($item['parent-uri'], $item['uid']);
|
delete_thread_uri($item['parent-uri'], $item['uid']);
|
||||||
// ignore the result
|
// ignore the result
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// ensure that last-child is set in case the comment that had it just got wiped.
|
// ensure that last-child is set in case the comment that had it just got wiped.
|
||||||
q("UPDATE `item` SET `last-child` = 0, `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d ",
|
q("UPDATE `item` SET `last-child` = 0, `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d ",
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
|
@ -2041,8 +2030,7 @@ function drop_item($id,$interactive = true) {
|
||||||
return $owner;
|
return $owner;
|
||||||
goaway($a->get_baseurl() . '/' . $_SESSION['return_url']);
|
goaway($a->get_baseurl() . '/' . $_SESSION['return_url']);
|
||||||
//NOTREACHED
|
//NOTREACHED
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (! $interactive)
|
if (! $interactive)
|
||||||
return 0;
|
return 0;
|
||||||
notice( t('Permission denied.') . EOL);
|
notice( t('Permission denied.') . EOL);
|
||||||
|
|
|
@ -8,18 +8,19 @@
|
||||||
*/
|
*/
|
||||||
function post_update() {
|
function post_update() {
|
||||||
|
|
||||||
if (!post_update_1192())
|
if (!post_update_1192()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
if (!post_update_1194())
|
if (!post_update_1194()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
if (!post_update_1198())
|
if (!post_update_1198()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
if (!post_update_1206())
|
if (!post_update_1206()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief set the gcontact-id in all item entries
|
* @brief set the gcontact-id in all item entries
|
||||||
|
@ -242,15 +243,16 @@ function post_update_1206() {
|
||||||
FROM `user`
|
FROM `user`
|
||||||
INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self`");
|
INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self`");
|
||||||
|
|
||||||
if (!dbm::is_result($r))
|
if (!dbm::is_result($r)) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
foreach ($r AS $user) {
|
foreach ($r AS $user) {
|
||||||
if (!empty($user["lastitem_date"]) AND ($user["lastitem_date"] > $user["last-item"]))
|
if (!empty($user["lastitem_date"]) AND ($user["lastitem_date"] > $user["last-item"])) {
|
||||||
q("UPDATE `contact` SET `last-item` = '%s' WHERE `id` = %d",
|
q("UPDATE `contact` SET `last-item` = '%s' WHERE `id` = %d",
|
||||||
dbesc($user["lastitem_date"]),
|
dbesc($user["lastitem_date"]),
|
||||||
intval($user["id"]));
|
intval($user["id"]));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
set_config("system", "post_update_version", 1206);
|
set_config("system", "post_update_version", 1206);
|
||||||
logger("Done", LOGGER_DEBUG);
|
logger("Done", LOGGER_DEBUG);
|
||||||
|
|
106
mod/display.php
106
mod/display.php
|
@ -19,7 +19,7 @@ function display_init(&$a) {
|
||||||
$r = qu("SELECT `id`, `parent`, `author-name`, `author-link`, `author-avatar`, `network`, `body`, `uid`, `owner-link` FROM `item`
|
$r = qu("SELECT `id`, `parent`, `author-name`, `author-link`, `author-avatar`, `network`, `body`, `uid`, `owner-link` FROM `item`
|
||||||
WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
|
WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
|
||||||
AND `guid` = '%s' AND `uid` = %d", dbesc($a->argv[1]), local_user());
|
AND `guid` = '%s' AND `uid` = %d", dbesc($a->argv[1]), local_user());
|
||||||
if (count($r)) {
|
if (dbm::isresult($r)) {
|
||||||
$nick = $a->user["nickname"];
|
$nick = $a->user["nickname"];
|
||||||
$itemuid = local_user();
|
$itemuid = local_user();
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ function display_init(&$a) {
|
||||||
AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = ''
|
AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = ''
|
||||||
AND NOT `item`.`private` AND NOT `user`.`hidewall`
|
AND NOT `item`.`private` AND NOT `user`.`hidewall`
|
||||||
AND `item`.`guid` = '%s'", dbesc($a->argv[1]));
|
AND `item`.`guid` = '%s'", dbesc($a->argv[1]));
|
||||||
if (count($r)) {
|
if (dbm::isresult($r)) {
|
||||||
$nick = $r[0]["nickname"];
|
$nick = $r[0]["nickname"];
|
||||||
$itemuid = $r[0]["uid"];
|
$itemuid = $r[0]["uid"];
|
||||||
}
|
}
|
||||||
|
@ -51,12 +51,12 @@ function display_init(&$a) {
|
||||||
AND NOT `item`.`private` AND `item`.`uid` = 0
|
AND NOT `item`.`private` AND `item`.`uid` = 0
|
||||||
AND `item`.`guid` = '%s'", dbesc($a->argv[1]));
|
AND `item`.`guid` = '%s'", dbesc($a->argv[1]));
|
||||||
}
|
}
|
||||||
if (count($r)) {
|
if (dbm::isresult($r)) {
|
||||||
if ($r[0]["id"] != $r[0]["parent"])
|
if ($r[0]["id"] != $r[0]["parent"]) {
|
||||||
$r = qu("SELECT `id`, `author-name`, `author-link`, `author-avatar`, `network`, `body`, `uid`, `owner-link` FROM `item`
|
$r = qu("SELECT `id`, `author-name`, `author-link`, `author-avatar`, `network`, `body`, `uid`, `owner-link` FROM `item`
|
||||||
WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
|
WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
|
||||||
AND `id` = %d", $r[0]["parent"]);
|
AND `id` = %d", $r[0]["parent"]);
|
||||||
|
}
|
||||||
if (($itemuid != local_user()) AND local_user()) {
|
if (($itemuid != local_user()) AND local_user()) {
|
||||||
// Do we know this contact but we haven't got this item?
|
// Do we know this contact but we haven't got this item?
|
||||||
// Copy the wohle thread to our local storage so that we can interact.
|
// Copy the wohle thread to our local storage so that we can interact.
|
||||||
|
@ -66,9 +66,9 @@ function display_init(&$a) {
|
||||||
$items = qu("SELECT * FROM `item` WHERE `parent` = %d ORDER BY `id`", intval($r[0]["id"]));
|
$items = qu("SELECT * FROM `item` WHERE `parent` = %d ORDER BY `id`", intval($r[0]["id"]));
|
||||||
foreach ($items AS $item) {
|
foreach ($items AS $item) {
|
||||||
$itemcontactid = get_contact($item['owner-link'], local_user());
|
$itemcontactid = get_contact($item['owner-link'], local_user());
|
||||||
if (!$itemcontactid)
|
if (!$itemcontactid) {
|
||||||
$itemcontactid = $contactid;
|
$itemcontactid = $contactid;
|
||||||
|
}
|
||||||
unset($item['id']);
|
unset($item['id']);
|
||||||
$item['uid'] = local_user();
|
$item['uid'] = local_user();
|
||||||
$item['origin'] = 0;
|
$item['origin'] = 0;
|
||||||
|
@ -90,13 +90,14 @@ function display_init(&$a) {
|
||||||
WHERE `user`.`nickname` = '%s' AND `profile`.`is-default` AND `contact`.`self` LIMIT 1",
|
WHERE `user`.`nickname` = '%s' AND `profile`.`is-default` AND `contact`.`self` LIMIT 1",
|
||||||
dbesc($nickname)
|
dbesc($nickname)
|
||||||
);
|
);
|
||||||
if (count($r))
|
if (dbm::isresult($r)) {
|
||||||
$profiledata = $r[0];
|
$profiledata = $r[0];
|
||||||
|
}
|
||||||
$profiledata["network"] = NETWORK_DFRN;
|
$profiledata["network"] = NETWORK_DFRN;
|
||||||
} else
|
} else {
|
||||||
$profiledata = array();
|
$profiledata = array();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$a->error = 404;
|
$a->error = 404;
|
||||||
notice(t('Item not found.') . EOL);
|
notice(t('Item not found.') . EOL);
|
||||||
|
@ -127,48 +128,49 @@ function display_fetchauthor($a, $item) {
|
||||||
|
|
||||||
// Skip if it isn't a pure repeated messages
|
// Skip if it isn't a pure repeated messages
|
||||||
// Does it start with a share?
|
// Does it start with a share?
|
||||||
if (!$skip AND strpos($body, "[share") > 0)
|
if (!$skip AND strpos($body, "[share") > 0) }
|
||||||
$skip = true;
|
$skip = true;
|
||||||
|
}
|
||||||
// Does it end with a share?
|
// Does it end with a share?
|
||||||
if (!$skip AND (strlen($body) > (strrpos($body, "[/share]") + 8)))
|
if (!$skip AND (strlen($body) > (strrpos($body, "[/share]") + 8))) {
|
||||||
$skip = true;
|
$skip = true;
|
||||||
|
}
|
||||||
if (!$skip) {
|
if (!$skip) {
|
||||||
$attributes = preg_replace("/\[share(.*?)\]\s?(.*?)\s?\[\/share\]\s?/ism","$1",$body);
|
$attributes = preg_replace("/\[share(.*?)\]\s?(.*?)\s?\[\/share\]\s?/ism","$1",$body);
|
||||||
// Skip if there is no shared message in there
|
// Skip if there is no shared message in there
|
||||||
if ($body == $attributes)
|
if ($body == $attributes) {
|
||||||
$skip = true;
|
$skip = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!$skip) {
|
if (!$skip) {
|
||||||
$author = "";
|
$author = "";
|
||||||
preg_match("/author='(.*?)'/ism", $attributes, $matches);
|
preg_match("/author='(.*?)'/ism", $attributes, $matches);
|
||||||
if ($matches[1] != "")
|
if ($matches[1] != "") {
|
||||||
$profiledata["name"] = html_entity_decode($matches[1],ENT_QUOTES,'UTF-8');
|
$profiledata["name"] = html_entity_decode($matches[1],ENT_QUOTES,'UTF-8');
|
||||||
|
}
|
||||||
preg_match('/author="(.*?)"/ism', $attributes, $matches);
|
preg_match('/author="(.*?)"/ism', $attributes, $matches);
|
||||||
if ($matches[1] != "")
|
if ($matches[1] != "") {
|
||||||
$profiledata["name"] = html_entity_decode($matches[1],ENT_QUOTES,'UTF-8');
|
$profiledata["name"] = html_entity_decode($matches[1],ENT_QUOTES,'UTF-8');
|
||||||
|
}
|
||||||
$profile = "";
|
$profile = "";
|
||||||
preg_match("/profile='(.*?)'/ism", $attributes, $matches);
|
preg_match("/profile='(.*?)'/ism", $attributes, $matches);
|
||||||
if ($matches[1] != "")
|
if ($matches[1] != "") {
|
||||||
$profiledata["url"] = $matches[1];
|
$profiledata["url"] = $matches[1];
|
||||||
|
}
|
||||||
preg_match('/profile="(.*?)"/ism', $attributes, $matches);
|
preg_match('/profile="(.*?)"/ism', $attributes, $matches);
|
||||||
if ($matches[1] != "")
|
if ($matches[1] != "") {
|
||||||
$profiledata["url"] = $matches[1];
|
$profiledata["url"] = $matches[1];
|
||||||
|
}
|
||||||
$avatar = "";
|
$avatar = "";
|
||||||
preg_match("/avatar='(.*?)'/ism", $attributes, $matches);
|
preg_match("/avatar='(.*?)'/ism", $attributes, $matches);
|
||||||
if ($matches[1] != "")
|
if ($matches[1] != "") {
|
||||||
$profiledata["photo"] = $matches[1];
|
$profiledata["photo"] = $matches[1];
|
||||||
|
}
|
||||||
preg_match('/avatar="(.*?)"/ism', $attributes, $matches);
|
preg_match('/avatar="(.*?)"/ism', $attributes, $matches);
|
||||||
if ($matches[1] != "")
|
if ($matches[1] != "") {
|
||||||
$profiledata["photo"] = $matches[1];
|
$profiledata["photo"] = $matches[1];
|
||||||
|
}
|
||||||
$profiledata["nickname"] = $profiledata["name"];
|
$profiledata["nickname"] = $profiledata["name"];
|
||||||
$profiledata["network"] = GetProfileUsername($profiledata["url"], "", false, true);
|
$profiledata["network"] = GetProfileUsername($profiledata["url"], "", false, true);
|
||||||
|
|
||||||
|
@ -181,8 +183,9 @@ function display_fetchauthor($a, $item) {
|
||||||
$profiledata["photo"] = App::remove_baseurl($profiledata["photo"]);
|
$profiledata["photo"] = App::remove_baseurl($profiledata["photo"]);
|
||||||
|
|
||||||
if (local_user()) {
|
if (local_user()) {
|
||||||
if (in_array($profiledata["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS)))
|
if (in_array($profiledata["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS))) {
|
||||||
$profiledata["remoteconnect"] = $a->get_baseurl()."/follow?url=".urlencode($profiledata["url"]);
|
$profiledata["remoteconnect"] = $a->get_baseurl()."/follow?url=".urlencode($profiledata["url"]);
|
||||||
|
}
|
||||||
} elseif ($profiledata["network"] == NETWORK_DFRN) {
|
} elseif ($profiledata["network"] == NETWORK_DFRN) {
|
||||||
$connect = str_replace("/profile/", "/dfrn_request/", $profiledata["url"]);
|
$connect = str_replace("/profile/", "/dfrn_request/", $profiledata["url"]);
|
||||||
$profiledata["remoteconnect"] = $connect;
|
$profiledata["remoteconnect"] = $connect;
|
||||||
|
@ -210,16 +213,14 @@ function display_content(&$a, $update = 0) {
|
||||||
|
|
||||||
if ($update) {
|
if ($update) {
|
||||||
$nick = $_REQUEST['nick'];
|
$nick = $_REQUEST['nick'];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$nick = (($a->argc > 1) ? $a->argv[1] : '');
|
$nick = (($a->argc > 1) ? $a->argv[1] : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($update) {
|
if ($update) {
|
||||||
$item_id = $_REQUEST['item_id'];
|
$item_id = $_REQUEST['item_id'];
|
||||||
$a->profile = array('uid' => intval($update), 'profile_uid' => intval($update));
|
$a->profile = array('uid' => intval($update), 'profile_uid' => intval($update));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$item_id = (($a->argc > 2) ? $a->argv[2] : 0);
|
$item_id = (($a->argc > 2) ? $a->argv[2] : 0);
|
||||||
|
|
||||||
if ($a->argc == 2) {
|
if ($a->argc == 2) {
|
||||||
|
@ -229,7 +230,7 @@ function display_content(&$a, $update = 0) {
|
||||||
$r = qu("SELECT `id` FROM `item`
|
$r = qu("SELECT `id` FROM `item`
|
||||||
WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
|
WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
|
||||||
AND `guid` = '%s' AND `uid` = %d", dbesc($a->argv[1]), local_user());
|
AND `guid` = '%s' AND `uid` = %d", dbesc($a->argv[1]), local_user());
|
||||||
if (count($r)) {
|
if (dbm::isresult($r)) {
|
||||||
$item_id = $r[0]["id"];
|
$item_id = $r[0]["id"];
|
||||||
$nick = $a->user["nickname"];
|
$nick = $a->user["nickname"];
|
||||||
}
|
}
|
||||||
|
@ -243,7 +244,7 @@ function display_content(&$a, $update = 0) {
|
||||||
AND NOT `item`.`private` AND NOT `user`.`hidewall`
|
AND NOT `item`.`private` AND NOT `user`.`hidewall`
|
||||||
AND `item`.`guid` = '%s'", dbesc($a->argv[1]));
|
AND `item`.`guid` = '%s'", dbesc($a->argv[1]));
|
||||||
// AND NOT `item`.`private` AND `item`.`wall`
|
// AND NOT `item`.`private` AND `item`.`wall`
|
||||||
if (count($r)) {
|
if (dbm::isresult($r)) {
|
||||||
$item_id = $r[0]["id"];
|
$item_id = $r[0]["id"];
|
||||||
$nick = $r[0]["nickname"];
|
$nick = $r[0]["nickname"];
|
||||||
}
|
}
|
||||||
|
@ -256,7 +257,7 @@ function display_content(&$a, $update = 0) {
|
||||||
AND NOT `item`.`private` AND `item`.`uid` = 0
|
AND NOT `item`.`private` AND `item`.`uid` = 0
|
||||||
AND `item`.`guid` = '%s'", dbesc($a->argv[1]));
|
AND `item`.`guid` = '%s'", dbesc($a->argv[1]));
|
||||||
// AND NOT `item`.`private` AND `item`.`wall`
|
// AND NOT `item`.`private` AND `item`.`wall`
|
||||||
if (count($r)) {
|
if (dbm::isresult($r)) {
|
||||||
$item_id = $r[0]["id"];
|
$item_id = $r[0]["id"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -266,11 +267,12 @@ function display_content(&$a, $update = 0) {
|
||||||
if ($item_id AND !is_numeric($item_id)) {
|
if ($item_id AND !is_numeric($item_id)) {
|
||||||
$r = qu("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
$r = qu("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||||
dbesc($item_id), intval($a->profile['uid']));
|
dbesc($item_id), intval($a->profile['uid']));
|
||||||
if ($r)
|
if (dbm::is_result($r)) {
|
||||||
$item_id = $r[0]["id"];
|
$item_id = $r[0]["id"];
|
||||||
else
|
} else {
|
||||||
$item_id = false;
|
$item_id = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!$item_id) {
|
if (!$item_id) {
|
||||||
$a->error = 404;
|
$a->error = 404;
|
||||||
|
@ -301,7 +303,7 @@ function display_content(&$a, $update = 0) {
|
||||||
intval($contact_id),
|
intval($contact_id),
|
||||||
intval($a->profile['uid'])
|
intval($a->profile['uid'])
|
||||||
);
|
);
|
||||||
if(count($r)) {
|
if (dbm::isresult($r)) {
|
||||||
$contact = $r[0];
|
$contact = $r[0];
|
||||||
$remote_contact = true;
|
$remote_contact = true;
|
||||||
}
|
}
|
||||||
|
@ -317,9 +319,9 @@ function display_content(&$a, $update = 0) {
|
||||||
$r = qu("SELECT * FROM `contact` WHERE `uid` = %d AND `self` LIMIT 1",
|
$r = qu("SELECT * FROM `contact` WHERE `uid` = %d AND `self` LIMIT 1",
|
||||||
intval($a->profile['uid'])
|
intval($a->profile['uid'])
|
||||||
);
|
);
|
||||||
if(count($r))
|
if (dbm::isresult($r)) {
|
||||||
$a->page_contact = $r[0];
|
$a->page_contact = $r[0];
|
||||||
|
}
|
||||||
$is_owner = ((local_user()) && (local_user() == $a->profile['profile_uid']) ? true : false);
|
$is_owner = ((local_user()) && (local_user() == $a->profile['profile_uid']) ? true : false);
|
||||||
|
|
||||||
if ($a->profile['hidewall'] && (! $is_owner) && (! $remote_contact)) {
|
if ($a->profile['hidewall'] && (! $is_owner) && (! $remote_contact)) {
|
||||||
|
@ -356,9 +358,10 @@ function display_content(&$a, $update = 0) {
|
||||||
intval($item_id)
|
intval($item_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
if(!$r)
|
if (!$r) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$r = qu(item_query()." AND `item`.`uid` = %d
|
$r = qu(item_query()." AND `item`.`uid` = %d
|
||||||
AND `item`.`parent` = (SELECT `parent` FROM `item` WHERE `id` = %d)
|
AND `item`.`parent` = (SELECT `parent` FROM `item` WHERE `id` = %d)
|
||||||
|
@ -377,7 +380,7 @@ function display_content(&$a, $update = 0) {
|
||||||
intval($item_id),
|
intval($item_id),
|
||||||
dbesc($item_id)
|
dbesc($item_id)
|
||||||
);
|
);
|
||||||
if($r) {
|
if (dbm::is_result($r)) {
|
||||||
$item_uri = $r[0]['uri'];
|
$item_uri = $r[0]['uri'];
|
||||||
|
|
||||||
$r = qu(item_query()." AND `item`.`uid` = %d
|
$r = qu(item_query()." AND `item`.`uid` = %d
|
||||||
|
@ -396,17 +399,18 @@ function display_content(&$a, $update = 0) {
|
||||||
$unseen = q("SELECT `id` FROM `item` WHERE `unseen` AND `parent` = %d",
|
$unseen = q("SELECT `id` FROM `item` WHERE `unseen` AND `parent` = %d",
|
||||||
intval($r[0]['parent']));
|
intval($r[0]['parent']));
|
||||||
|
|
||||||
if ($unseen)
|
if ($unseen) {
|
||||||
q("UPDATE `item` SET `unseen` = 0
|
q("UPDATE `item` SET `unseen` = 0 WHERE `parent` = %d AND `unseen`",
|
||||||
WHERE `parent` = %d AND `unseen`",
|
|
||||||
intval($r[0]['parent'])
|
intval($r[0]['parent'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$items = conv_sort($r,"`commented`");
|
$items = conv_sort($r,"`commented`");
|
||||||
|
|
||||||
if(!$update)
|
if (!$update) {
|
||||||
$o .= "<script> var netargs = '?f=&nick=" . $nick . "&item_id=" . $item_id . "'; </script>";
|
$o .= "<script> var netargs = '?f=&nick=" . $nick . "&item_id=" . $item_id . "'; </script>";
|
||||||
|
}
|
||||||
$o .= conversation($a,$items,'display', $update);
|
$o .= conversation($a,$items,'display', $update);
|
||||||
|
|
||||||
// Preparing the meta header
|
// Preparing the meta header
|
||||||
|
@ -418,9 +422,9 @@ function display_content(&$a, $update = 0) {
|
||||||
|
|
||||||
$image = $a->remove_baseurl($r[0]["thumb"]);
|
$image = $a->remove_baseurl($r[0]["thumb"]);
|
||||||
|
|
||||||
if ($title == "")
|
if ($title == "") {
|
||||||
$title = $author_name;
|
$title = $author_name;
|
||||||
|
}
|
||||||
$description = htmlspecialchars($description, ENT_COMPAT, 'UTF-8', true); // allow double encoding here
|
$description = htmlspecialchars($description, ENT_COMPAT, 'UTF-8', true); // allow double encoding here
|
||||||
$title = htmlspecialchars($title, ENT_COMPAT, 'UTF-8', true); // allow double encoding here
|
$title = htmlspecialchars($title, ENT_COMPAT, 'UTF-8', true); // allow double encoding here
|
||||||
$author_name = htmlspecialchars($author_name, ENT_COMPAT, 'UTF-8', true); // allow double encoding here
|
$author_name = htmlspecialchars($author_name, ENT_COMPAT, 'UTF-8', true); // allow double encoding here
|
||||||
|
@ -467,12 +471,10 @@ function display_content(&$a, $update = 0) {
|
||||||
if ($r) {
|
if ($r) {
|
||||||
if ($r[0]['deleted']) {
|
if ($r[0]['deleted']) {
|
||||||
notice(t('Item has been removed.') . EOL );
|
notice(t('Item has been removed.') . EOL );
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
notice(t('Permission denied.') . EOL );
|
notice(t('Permission denied.') . EOL );
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
notice(t('Item not found.') . EOL );
|
notice(t('Item not found.') . EOL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -217,7 +217,6 @@ function nodeinfo_cron() {
|
||||||
set_config('nodeinfo','active_users_monthly', $active_users_monthly);
|
set_config('nodeinfo','active_users_monthly', $active_users_monthly);
|
||||||
}
|
}
|
||||||
|
|
||||||
//$posts = qu("SELECT COUNT(*) AS local_posts FROM `item` WHERE `wall` AND `uid` != 0 AND `id` = `parent` AND left(body, 6) != '[share'");
|
|
||||||
$posts = qu("SELECT COUNT(*) AS `local_posts` FROM `item`
|
$posts = qu("SELECT COUNT(*) AS `local_posts` FROM `item`
|
||||||
INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
||||||
WHERE `contact`.`self` and `item`.`id` = `item`.`parent` AND left(body, 6) != '[share' AND `item`.`network` IN ('%s', '%s', '%s')",
|
WHERE `contact`.`self` and `item`.`id` = `item`.`parent` AND left(body, 6) != '[share' AND `item`.`network` IN ('%s', '%s', '%s')",
|
||||||
|
|
|
@ -53,7 +53,7 @@ function photos_init(&$a) {
|
||||||
|
|
||||||
$sql_extra = permissions_sql($a->data['user']['uid']);
|
$sql_extra = permissions_sql($a->data['user']['uid']);
|
||||||
|
|
||||||
$albums = q("SELECT count(distinct `resource-id`) AS `total`, `album` FROM `photo` USE INDEX (`uid_album_created`) WHERE `uid` = %d AND `album` != '%s' AND `album` != '%s'
|
$albums = qu("SELECT count(distinct `resource-id`) AS `total`, `album` FROM `photo` USE INDEX (`uid_album_created`) WHERE `uid` = %d AND `album` != '%s' AND `album` != '%s'
|
||||||
$sql_extra GROUP BY `album` ORDER BY `created` DESC",
|
$sql_extra GROUP BY `album` ORDER BY `created` DESC",
|
||||||
intval($a->data['user']['uid']),
|
intval($a->data['user']['uid']),
|
||||||
dbesc('Contact Photos'),
|
dbesc('Contact Photos'),
|
||||||
|
@ -157,7 +157,7 @@ function photos_post(&$a) {
|
||||||
intval($cid),
|
intval($cid),
|
||||||
intval($page_owner_uid)
|
intval($page_owner_uid)
|
||||||
);
|
);
|
||||||
if(count($r)) {
|
if (dbm::is_result($r)) {
|
||||||
$can_post = true;
|
$can_post = true;
|
||||||
$visitor = $cid;
|
$visitor = $cid;
|
||||||
}
|
}
|
||||||
|
@ -258,19 +258,17 @@ function photos_post(&$a) {
|
||||||
intval($page_owner_uid),
|
intval($page_owner_uid),
|
||||||
dbesc($album)
|
dbesc($album)
|
||||||
);
|
);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$r = q("SELECT distinct(`resource-id`) as `rid` FROM `photo` WHERE `uid` = %d AND `album` = '%s'",
|
$r = q("SELECT distinct(`resource-id`) as `rid` FROM `photo` WHERE `uid` = %d AND `album` = '%s'",
|
||||||
intval(local_user()),
|
intval(local_user()),
|
||||||
dbesc($album)
|
dbesc($album)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if(count($r)) {
|
if (dbm::is_result($r)) {
|
||||||
foreach ($r as $rr) {
|
foreach ($r as $rr) {
|
||||||
$res[] = "'" . dbesc($rr['rid']) . "'" ;
|
$res[] = "'" . dbesc($rr['rid']) . "'" ;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
goaway($_SESSION['photo_return']);
|
goaway($_SESSION['photo_return']);
|
||||||
return; // NOTREACHED
|
return; // NOTREACHED
|
||||||
}
|
}
|
||||||
|
@ -288,7 +286,7 @@ function photos_post(&$a) {
|
||||||
$r = q("SELECT `parent-uri` FROM `item` WHERE `resource-id` IN ( $str_res ) AND `uid` = %d",
|
$r = q("SELECT `parent-uri` FROM `item` WHERE `resource-id` IN ( $str_res ) AND `uid` = %d",
|
||||||
intval($page_owner_uid)
|
intval($page_owner_uid)
|
||||||
);
|
);
|
||||||
if(count($r)) {
|
if (dbm::is_result($r)) {
|
||||||
foreach ($r as $rr) {
|
foreach ($r as $rr) {
|
||||||
q("UPDATE `item` SET `deleted` = 1, `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d",
|
q("UPDATE `item` SET `deleted` = 1, `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d",
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
|
@ -343,14 +341,13 @@ function photos_post(&$a) {
|
||||||
intval($page_owner_uid),
|
intval($page_owner_uid),
|
||||||
dbesc($a->argv[2])
|
dbesc($a->argv[2])
|
||||||
);
|
);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$r = q("SELECT `id`, `resource-id` FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s' LIMIT 1",
|
$r = q("SELECT `id`, `resource-id` FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s' LIMIT 1",
|
||||||
intval(local_user()),
|
intval(local_user()),
|
||||||
dbesc($a->argv[2])
|
dbesc($a->argv[2])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if(count($r)) {
|
if (dbm::is_result($r)) {
|
||||||
q("DELETE FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s'",
|
q("DELETE FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s'",
|
||||||
intval($page_owner_uid),
|
intval($page_owner_uid),
|
||||||
dbesc($r[0]['resource-id'])
|
dbesc($r[0]['resource-id'])
|
||||||
|
@ -406,7 +403,7 @@ function photos_post(&$a) {
|
||||||
dbesc($resource_id),
|
dbesc($resource_id),
|
||||||
intval($page_owner_uid)
|
intval($page_owner_uid)
|
||||||
);
|
);
|
||||||
if(count($r)) {
|
if (dbm::is_result($r)) {
|
||||||
$ph = new Photo($r[0]['data'], $r[0]['type']);
|
$ph = new Photo($r[0]['data'], $r[0]['type']);
|
||||||
if ($ph->is_valid()) {
|
if ($ph->is_valid()) {
|
||||||
$rotate_deg = ( (intval($_POST['rotate']) == 1) ? 270 : 90 );
|
$rotate_deg = ( (intval($_POST['rotate']) == 1) ? 270 : 90 );
|
||||||
|
@ -523,7 +520,7 @@ function photos_post(&$a) {
|
||||||
intval($page_owner_uid)
|
intval($page_owner_uid)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if(count($r)) {
|
if (dbm::is_result($r)) {
|
||||||
$old_tag = $r[0]['tag'];
|
$old_tag = $r[0]['tag'];
|
||||||
$old_inform = $r[0]['inform'];
|
$old_inform = $r[0]['inform'];
|
||||||
}
|
}
|
||||||
|
@ -564,8 +561,7 @@ function photos_post(&$a) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$taginfo[] = array($newname,$profile,$salmon);
|
$taginfo[] = array($newname,$profile,$salmon);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$newname = $name;
|
$newname = $name;
|
||||||
$alias = '';
|
$alias = '';
|
||||||
$tagcid = 0;
|
$tagcid = 0;
|
||||||
|
@ -577,8 +573,7 @@ function photos_post(&$a) {
|
||||||
intval($tagcid),
|
intval($tagcid),
|
||||||
intval($profile_uid)
|
intval($profile_uid)
|
||||||
);
|
);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$newname = str_replace('_',' ',$name);
|
$newname = str_replace('_',' ',$name);
|
||||||
|
|
||||||
//select someone from this user's contacts by name
|
//select someone from this user's contacts by name
|
||||||
|
@ -602,15 +597,14 @@ function photos_post(&$a) {
|
||||||
dbesc($newname),
|
dbesc($newname),
|
||||||
intval($page_owner_uid)
|
intval($page_owner_uid)
|
||||||
);
|
);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$r = q("SELECT * FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1",
|
$r = q("SELECT * FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1",
|
||||||
dbesc($name),
|
dbesc($name),
|
||||||
dbesc($name),
|
dbesc($name),
|
||||||
intval($page_owner_uid)
|
intval($page_owner_uid)
|
||||||
);
|
);
|
||||||
}*/
|
}*/
|
||||||
if(count($r)) {
|
if (dbm::is_result($r)) {
|
||||||
$newname = $r[0]['name'];
|
$newname = $r[0]['name'];
|
||||||
$profile = $r[0]['url'];
|
$profile = $r[0]['url'];
|
||||||
$notify = 'cid:' . $r[0]['id'];
|
$notify = 'cid:' . $r[0]['id'];
|
||||||
|
@ -786,8 +780,7 @@ function photos_post(&$a) {
|
||||||
$filename = $ret['filename'];
|
$filename = $ret['filename'];
|
||||||
$filesize = $ret['filesize'];
|
$filesize = $ret['filesize'];
|
||||||
$type = $ret['type'];
|
$type = $ret['type'];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$src = $_FILES['userfile']['tmp_name'];
|
$src = $_FILES['userfile']['tmp_name'];
|
||||||
$filename = basename($_FILES['userfile']['name']);
|
$filename = basename($_FILES['userfile']['name']);
|
||||||
$filesize = intval($_FILES['userfile']['size']);
|
$filesize = intval($_FILES['userfile']['size']);
|
||||||
|
@ -983,8 +976,7 @@ function photos_content(&$a) {
|
||||||
if ($a->argc > 3) {
|
if ($a->argc > 3) {
|
||||||
$datatype = $a->argv[2];
|
$datatype = $a->argv[2];
|
||||||
$datum = $a->argv[3];
|
$datum = $a->argv[3];
|
||||||
}
|
} elseif (($a->argc > 2) && ($a->argv[2] === 'upload'))
|
||||||
elseif(($a->argc > 2) && ($a->argv[2] === 'upload'))
|
|
||||||
$datatype = 'upload';
|
$datatype = 'upload';
|
||||||
else
|
else
|
||||||
$datatype = 'summary';
|
$datatype = 'summary';
|
||||||
|
@ -1026,7 +1018,7 @@ function photos_content(&$a) {
|
||||||
intval($contact_id),
|
intval($contact_id),
|
||||||
intval($owner_uid)
|
intval($owner_uid)
|
||||||
);
|
);
|
||||||
if(count($r)) {
|
if (dbm::is_result($r)) {
|
||||||
$can_post = true;
|
$can_post = true;
|
||||||
$contact = $r[0];
|
$contact = $r[0];
|
||||||
$remote_contact = true;
|
$remote_contact = true;
|
||||||
|
@ -1054,7 +1046,7 @@ function photos_content(&$a) {
|
||||||
intval($contact_id),
|
intval($contact_id),
|
||||||
intval($owner_uid)
|
intval($owner_uid)
|
||||||
);
|
);
|
||||||
if(count($r)) {
|
if (dbm::is_result($r)) {
|
||||||
$contact = $r[0];
|
$contact = $r[0];
|
||||||
$remote_contact = true;
|
$remote_contact = true;
|
||||||
}
|
}
|
||||||
|
@ -1157,8 +1149,7 @@ function photos_content(&$a) {
|
||||||
if ($a->theme['template_engine'] === 'internal') {
|
if ($a->theme['template_engine'] === 'internal') {
|
||||||
$albumselect_e = template_escape($albumselect);
|
$albumselect_e = template_escape($albumselect);
|
||||||
$aclselect_e = (($visitor) ? '' : template_escape(populate_acl($a->user)));
|
$aclselect_e = (($visitor) ? '' : template_escape(populate_acl($a->user)));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$albumselect_e = $albumselect;
|
$albumselect_e = $albumselect;
|
||||||
$aclselect_e = (($visitor) ? '' : populate_acl($a->user));
|
$aclselect_e = (($visitor) ? '' : populate_acl($a->user));
|
||||||
}
|
}
|
||||||
|
@ -1207,7 +1198,7 @@ function photos_content(&$a) {
|
||||||
intval($owner_uid),
|
intval($owner_uid),
|
||||||
dbesc($album)
|
dbesc($album)
|
||||||
);
|
);
|
||||||
if(count($r)) {
|
if (dbm::is_result($r)) {
|
||||||
$a->set_pager_total(count($r));
|
$a->set_pager_total(count($r));
|
||||||
$a->set_pager_itemspage(20);
|
$a->set_pager_itemspage(20);
|
||||||
}
|
}
|
||||||
|
@ -1233,8 +1224,7 @@ function photos_content(&$a) {
|
||||||
|
|
||||||
if ($a->theme['template_engine'] === 'internal') {
|
if ($a->theme['template_engine'] === 'internal') {
|
||||||
$album_e = template_escape($album);
|
$album_e = template_escape($album);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$album_e = $album;
|
$album_e = $album;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1248,8 +1238,7 @@ function photos_content(&$a) {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (($album !== t('Profile Photos')) && ($album !== 'Contact Photos') && ($album !== t('Contact Photos'))) {
|
if (($album !== t('Profile Photos')) && ($album !== 'Contact Photos') && ($album !== t('Contact Photos'))) {
|
||||||
if ($can_post) {
|
if ($can_post) {
|
||||||
$edit = array(t('Edit Album'), 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '/edit');
|
$edit = array(t('Edit Album'), 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '/edit');
|
||||||
|
@ -1264,7 +1253,7 @@ function photos_content(&$a) {
|
||||||
|
|
||||||
$photos = array();
|
$photos = array();
|
||||||
|
|
||||||
if(count($r))
|
if (dbm::is_result($r))
|
||||||
$twist = 'rotright';
|
$twist = 'rotright';
|
||||||
foreach ($r as $rr) {
|
foreach ($r as $rr) {
|
||||||
if ($twist == 'rotright')
|
if ($twist == 'rotright')
|
||||||
|
@ -1277,8 +1266,7 @@ function photos_content(&$a) {
|
||||||
if ($a->theme['template_engine'] === 'internal') {
|
if ($a->theme['template_engine'] === 'internal') {
|
||||||
$imgalt_e = template_escape($rr['filename']);
|
$imgalt_e = template_escape($rr['filename']);
|
||||||
$desc_e = template_escape($rr['desc']);
|
$desc_e = template_escape($rr['desc']);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$imgalt_e = $rr['filename'];
|
$imgalt_e = $rr['filename'];
|
||||||
$desc_e = $rr['desc'];
|
$desc_e = $rr['desc'];
|
||||||
}
|
}
|
||||||
|
@ -1379,8 +1367,7 @@ function photos_content(&$a) {
|
||||||
if ($ph[1]['scale'] == 2) {
|
if ($ph[1]['scale'] == 2) {
|
||||||
// original is 640 or less, we can display it directly
|
// original is 640 or less, we can display it directly
|
||||||
$hires = $lores = $ph[0];
|
$hires = $lores = $ph[0];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$hires = $ph[0];
|
$hires = $ph[0];
|
||||||
$lores = $ph[1];
|
$lores = $ph[1];
|
||||||
}
|
}
|
||||||
|
@ -1458,7 +1445,7 @@ function photos_content(&$a) {
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if(count($r))
|
if (dbm::is_result($r))
|
||||||
$a->set_pager_total($r[0]['total']);
|
$a->set_pager_total($r[0]['total']);
|
||||||
|
|
||||||
|
|
||||||
|
@ -1538,8 +1525,7 @@ function photos_content(&$a) {
|
||||||
$album_e = template_escape($ph[0]['album']);
|
$album_e = template_escape($ph[0]['album']);
|
||||||
$caption_e = template_escape($ph[0]['desc']);
|
$caption_e = template_escape($ph[0]['desc']);
|
||||||
$aclselect_e = template_escape(populate_acl($ph[0]));
|
$aclselect_e = template_escape(populate_acl($ph[0]));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$album_e = $ph[0]['album'];
|
$album_e = $ph[0]['album'];
|
||||||
$caption_e = $ph[0]['desc'];
|
$caption_e = $ph[0]['desc'];
|
||||||
$aclselect_e = populate_acl($ph[0]);
|
$aclselect_e = populate_acl($ph[0]);
|
||||||
|
@ -1635,7 +1621,7 @@ function photos_content(&$a) {
|
||||||
|
|
||||||
|
|
||||||
// display comments
|
// display comments
|
||||||
if(count($r)) {
|
if (dbm::is_result($r)) {
|
||||||
|
|
||||||
foreach ($r as $item) {
|
foreach ($r as $item) {
|
||||||
builtin_activity_puller($item, $conv_responses);
|
builtin_activity_puller($item, $conv_responses);
|
||||||
|
@ -1684,8 +1670,7 @@ function photos_content(&$a) {
|
||||||
&& ($item['network'] == NETWORK_DFRN) && (! $item['self'] )) {
|
&& ($item['network'] == NETWORK_DFRN) && (! $item['self'] )) {
|
||||||
$profile_url = $redirect_url;
|
$profile_url = $redirect_url;
|
||||||
$sparkle = ' sparkle';
|
$sparkle = ' sparkle';
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$profile_url = $item['url'];
|
$profile_url = $item['url'];
|
||||||
$sparkle = '';
|
$sparkle = '';
|
||||||
}
|
}
|
||||||
|
@ -1712,8 +1697,7 @@ function photos_content(&$a) {
|
||||||
$name_e = template_escape($profile_name);
|
$name_e = template_escape($profile_name);
|
||||||
$title_e = template_escape($item['title']);
|
$title_e = template_escape($item['title']);
|
||||||
$body_e = template_escape(bbcode($item['body']));
|
$body_e = template_escape(bbcode($item['body']));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$name_e = $profile_name;
|
$name_e = $profile_name;
|
||||||
$title_e = $item['title'];
|
$title_e = $item['title'];
|
||||||
$body_e = bbcode($item['body']);
|
$body_e = bbcode($item['body']);
|
||||||
|
@ -1774,8 +1758,7 @@ function photos_content(&$a) {
|
||||||
$tags_e = template_escape($tags);
|
$tags_e = template_escape($tags);
|
||||||
$like_e = template_escape($like);
|
$like_e = template_escape($like);
|
||||||
$dislike_e = template_escape($dislike);
|
$dislike_e = template_escape($dislike);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$album_e = array($album_link,$ph[0]['album']);
|
$album_e = array($album_link,$ph[0]['album']);
|
||||||
$tags_e = $tags;
|
$tags_e = $tags;
|
||||||
$like_e = $like;
|
$like_e = $like;
|
||||||
|
@ -1821,7 +1804,7 @@ function photos_content(&$a) {
|
||||||
dbesc('Contact Photos'),
|
dbesc('Contact Photos'),
|
||||||
dbesc( t('Contact Photos'))
|
dbesc( t('Contact Photos'))
|
||||||
);
|
);
|
||||||
if(count($r)) {
|
if (dbm::is_result($r)) {
|
||||||
$a->set_pager_total(count($r));
|
$a->set_pager_total(count($r));
|
||||||
$a->set_pager_itemspage(20);
|
$a->set_pager_itemspage(20);
|
||||||
}
|
}
|
||||||
|
@ -1839,7 +1822,7 @@ function photos_content(&$a) {
|
||||||
|
|
||||||
|
|
||||||
$photos = array();
|
$photos = array();
|
||||||
if(count($r)) {
|
if (dbm::is_result($r)) {
|
||||||
$twist = 'rotright';
|
$twist = 'rotright';
|
||||||
foreach ($r as $rr) {
|
foreach ($r as $rr) {
|
||||||
//hide profile photos to others
|
//hide profile photos to others
|
||||||
|
@ -1850,13 +1833,13 @@ function photos_content(&$a) {
|
||||||
$twist = 'rotleft';
|
$twist = 'rotleft';
|
||||||
else
|
else
|
||||||
$twist = 'rotright';
|
$twist = 'rotright';
|
||||||
|
|
||||||
$ext = $phototypes[$rr['type']];
|
$ext = $phototypes[$rr['type']];
|
||||||
|
|
||||||
if ($a->theme['template_engine'] === 'internal') {
|
if ($a->theme['template_engine'] === 'internal') {
|
||||||
$alt_e = template_escape($rr['filename']);
|
$alt_e = template_escape($rr['filename']);
|
||||||
$name_e = template_escape($rr['album']);
|
$name_e = template_escape($rr['album']);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$alt_e = $rr['filename'];
|
$alt_e = $rr['filename'];
|
||||||
$name_e = $rr['album'];
|
$name_e = $rr['album'];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue