aboutsummaryrefslogtreecommitdiffstats
path: root/include/import.php
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2018-07-25 10:19:19 +0200
committerMario Vavti <mario@mariovavti.com>2018-07-25 10:19:19 +0200
commit1b1d11dcf1091158232e98abad966d4900e2ccc9 (patch)
tree380d5e04c73391089bf3d658ea4b27eecffa4916 /include/import.php
parentb655d04b3474893ee3dea99b77f2e7dd764729a0 (diff)
parent35200e5f1b10cdd18af8f0ea646996e438b97011 (diff)
downloadvolse-hubzilla-1b1d11dcf1091158232e98abad966d4900e2ccc9.tar.gz
volse-hubzilla-1b1d11dcf1091158232e98abad966d4900e2ccc9.tar.bz2
volse-hubzilla-1b1d11dcf1091158232e98abad966d4900e2ccc9.zip
Merge branch '3.6RC'
Diffstat (limited to 'include/import.php')
-rw-r--r--include/import.php20
1 files changed, 14 insertions, 6 deletions
diff --git a/include/import.php b/include/import.php
index fb7826101..4953834c9 100644
--- a/include/import.php
+++ b/include/import.php
@@ -14,7 +14,7 @@ require_once('include/perm_upgrade.php');
* @param int $seize
* @return boolean|array
*/
-function import_channel($channel, $account_id, $seize) {
+function import_channel($channel, $account_id, $seize, $newname = '') {
if(! array_key_exists('channel_system',$channel)) {
$channel['channel_system'] = (($channel['channel_pageflags'] & 0x1000) ? 1 : 0);
@@ -30,6 +30,11 @@ function import_channel($channel, $account_id, $seize) {
$channel['channel_hash'] = make_xchan_hash($channel['channel_guid'],$channel['channel_guid_sig']);
+ if($newname) {
+ $channel['channel_address'] = $newname;
+ }
+
+
// Check for duplicate channels
$r = q("select * from channel where (channel_guid = '%s' or channel_hash = '%s' or channel_address = '%s' ) limit 1",
@@ -1322,20 +1327,23 @@ function sync_files($channel, $files) {
);
if($exists) {
- if(! dbesc_array($p))
- continue;
$str = '';
foreach($p as $k => $v) {
+ $matches = false;
+ if(preg_match('/([^a-zA-Z0-9\-\_\.])/',$k,$matches)) {
+ continue;
+ }
+
if($str)
$str .= ",";
-
- $str .= " " . TQUOT . $k . TQUOT . " = '" . $v . "' ";
+
+ $str .= " " . TQUOT . $k . TQUOT . " = '" . (($k === 'content') ? dbescbin($v) : dbesc($v)) . "' ";
}
$r = dbq("update photo set " . $str . " where id = " . intval($exists[0]['id']) );
}
else {
- create_table_from_array('photo',$p);
+ create_table_from_array('photo',$p, [ 'content' ] );
}
}
}