From d1efb59fcdd3d5e78f3071c7a7a959c285782931 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 30 May 2016 16:12:48 +0200 Subject: render code bbcode inline if there are no linebreaks in the text. --- include/bbcode.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/bbcode.php b/include/bbcode.php index f47dc6f2e..42741b392 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -477,9 +477,12 @@ function bb_observer($Text) { return $Text; } - - - +function bb_code($match) { + if(strpos($match[0], "
")) + return '' . trim($match[1]) . ''; + else + return '' . trim($match[1]) . ''; +} @@ -785,12 +788,9 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false) $Text = preg_replace("/\[font=(.*?)\](.*?)\[\/font\]/sm", "$2", $Text); } - // Declare the format for [code] layout - $CodeLayout = '$1'; - // Check for [code] text if (strpos($Text,'[code]') !== false) { - $Text = preg_replace("/\[code\](.*?)\[\/code\]/ism", "$CodeLayout", $Text); + $Text = preg_replace_callback("/\[code\](.*?)\[\/code\]/ism", 'bb_code', $Text); } // Check for [spoiler] text -- cgit v1.2.3 From f35609d26cd9e6fb2c177ca1e422d0f0729f4f2e Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 30 May 2016 13:25:58 -0700 Subject: redundant dev line from an earlier modification causes issue #404 --- include/crypto.php | 18 ++---------------- include/zot.php | 8 ++++---- 2 files changed, 6 insertions(+), 20 deletions(-) (limited to 'include') diff --git a/include/crypto.php b/include/crypto.php index 42aa45b72..bc798d919 100644 --- a/include/crypto.php +++ b/include/crypto.php @@ -49,26 +49,12 @@ function AES256CBC_encrypt($data,$key,$iv) { return openssl_encrypt($data,'aes-256-cbc',str_pad($key,32,"\0"),OPENSSL_RAW_DATA,str_pad($iv,16,"\0")); -/* deprecated in php 7.1 - return mcrypt_encrypt( - MCRYPT_RIJNDAEL_128, - str_pad($key,32,"\0"), - pkcs5_pad($data,16), - MCRYPT_MODE_CBC, - str_pad($iv,16,"\0")); -*/ } function AES256CBC_decrypt($data,$key,$iv) { + return openssl_decrypt($data,'aes-256-cbc',str_pad($key,32,"\0"),OPENSSL_RAW_DATA,str_pad($iv,16,"\0")); -/* deprecated in php 7.1 - return pkcs5_unpad(mcrypt_decrypt( - MCRYPT_RIJNDAEL_128, - str_pad($key,32,"\0"), - $data, - MCRYPT_MODE_CBC, - str_pad($iv,16,"\0"))); -*/ + } function crypto_encapsulate($data,$pubkey,$alg='aes256cbc') { diff --git a/include/zot.php b/include/zot.php index ecfbfa128..0f48fb0ba 100644 --- a/include/zot.php +++ b/include/zot.php @@ -352,8 +352,6 @@ function zot_refresh($them, $channel = null, $force = false) { } - $token = random_string(); - $rhs = '/.well-known/zot-info'; $result = z_post_url($url . $rhs,$postvars); @@ -1048,8 +1046,9 @@ function zot_process_response($hub, $arr, $outq) { /** * @brief * - * We received a notification packet (in mod/post.php) that a message is waiting for us, and we've verified the sender. - * Now send back a pickup message, using our message tracking ID ($arr['secret']), which we will sign with our site private key. + * We received a notification packet (in mod_post) that a message is waiting for us, and we've verified the sender. + * Now send back a pickup message, using our message tracking ID ($arr['secret']), which we will sign with our site + * private key. * The entire pickup message is encrypted with the remote site's public key. * If everything checks out on the remote end, we will receive back a packet containing one or more messages, * which will be processed and delivered before this function ultimately returns. @@ -1123,6 +1122,7 @@ function zot_fetch($arr) { * * [1] => \e string $delivery_status * * [2] => \e string $address */ + function zot_import($arr, $sender_url) { $data = json_decode($arr['body'], true); -- cgit v1.2.3 From 490ab9e2c593275c0cf3d705a4ae52c6a22db4d9 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 30 May 2016 16:42:29 -0700 Subject: begin moving config to zotlabs. Leave procedural stubs for backward comaptibility --- include/config.php | 161 ++++++----------------------------------------------- 1 file changed, 17 insertions(+), 144 deletions(-) (limited to 'include') diff --git a/include/config.php b/include/config.php index 3017c3865..fe7cbead6 100644 --- a/include/config.php +++ b/include/config.php @@ -1,17 +1,13 @@ config is used for hub specific configurations. It overrides the * configurations from .htconfig file. The storage is of size TEXT. * - pconfig is used for channel specific configurations and takes a @@ -34,163 +30,39 @@ * */ -/** - * @brief Loads the hub's configuration from database to a cached storage. - * - * Retrieve a category ($family) of config variables from database to a cached - * storage in the global App::$config[$family]. - * - * @param string $family - * The category of the configuration value - */ -function load_config($family) { - if(! array_key_exists($family, App::$config)) - App::$config[$family] = array(); +use Zotlabs\Lib as Zlib; - if(! array_key_exists('config_loaded', App::$config[$family])) { - $r = q("SELECT * FROM config WHERE cat = '%s'", dbesc($family)); - if($r !== false) { - if($r) { - foreach($r as $rr) { - $k = $rr['k']; - App::$config[$family][$k] = $rr['v']; - } - } - App::$config[$family]['config_loaded'] = true; - } - } -} -/** - * @brief Get a particular config variable given the category name ($family) - * and a key. - * - * Get a particular config variable from the given category ($family) and the - * $key from a cached storage in App::$config[$family]. If a key is found in the - * DB but does not exist in local config cache, pull it into the cache so we - * do not have to hit the DB again for this item. - * - * Returns false if not set. - * - * @param string $family - * The category of the configuration value - * @param string $key - * The configuration key to query - * @return mixed Return value or false on error or if not set - */ -function get_config($family, $key) { - if((! array_key_exists($family, App::$config)) || (! array_key_exists('config_loaded', App::$config[$family]))) - load_config($family); +function load_config($family) { + + Zlib\Config::Load($family); - if(array_key_exists('config_loaded', App::$config[$family])) { - if(! array_key_exists($key, App::$config[$family])) { - return false; - } - return ((! is_array(App::$config[$family][$key])) && (preg_match('|^a:[0-9]+:{.*}$|s', App::$config[$family][$key])) - ? unserialize(App::$config[$family][$key]) - : App::$config[$family][$key] - ); - } - return false; } -/** - * @brief Returns a value directly from the database configuration storage. - * - * This function queries directly the database and bypasses the chached storage - * from get_config($family, $key). - * - * @param string $family - * The category of the configuration value - * @param string $key - * The configuration key to query - * @return mixed - */ +function get_config($family, $key) { + + return Zlib\Config::Get($family,$key); -function get_config_from_storage($family, $key) { - $ret = q("SELECT * FROM config WHERE cat = '%s' AND k = '%s' LIMIT 1", - dbesc($family), - dbesc($key) - ); - return $ret; } -/** - * @brief Sets a configuration value for the hub. - * - * Stores a config value ($value) in the category ($family) under the key ($key). - * - * @note Please do not store booleans - convert to 0/1 integer values! - * - * @param string $family - * The category of the configuration value - * @param string $key - * The configuration key to set - * @param mixed $value - * The value to store in the configuration - * @return mixed - * Return the set value, or false if the database update failed - */ function set_config($family, $key, $value) { - // manage array value - $dbvalue = ((is_array($value)) ? serialize($value) : $value); - $dbvalue = ((is_bool($dbvalue)) ? intval($dbvalue) : $dbvalue); - - if(get_config($family, $key) === false || (! get_config_from_storage($family, $key))) { - $ret = q("INSERT INTO config ( cat, k, v ) VALUES ( '%s', '%s', '%s' ) ", - dbesc($family), - dbesc($key), - dbesc($dbvalue) - ); - if($ret) { - App::$config[$family][$key] = $value; - $ret = $value; - } - return $ret; - } + return Zlib\Config::Set($family,$key,$value); - $ret = q("UPDATE config SET v = '%s' WHERE cat = '%s' AND k = '%s'", - dbesc($dbvalue), - dbesc($family), - dbesc($key) - ); - - if($ret) { - App::$config[$family][$key] = $value; - $ret = $value; - } - return $ret; } -/** - * @brief Deletes the given key from the hub's configuration database. - * - * Removes the configured value from the stored cache in App::$config[$family] - * and removes it from the database. - * - * @param string $family - * The category of the configuration value - * @param string $key - * The configuration key to delete - * @return mixed - */ function del_config($family, $key) { - $ret = false; + return Zlib\Config::Delete($family,$key); - if(array_key_exists($family, App::$config) && array_key_exists($key, App::$config[$family])) - unset(App::$config[$family][$key]); - $ret = q("DELETE FROM config WHERE cat = '%s' AND k = '%s'", - dbesc($family), - dbesc($key) - ); - return $ret; } + + + /** * @brief Loads all configuration values of a channel into a cached storage. * @@ -201,6 +73,7 @@ function del_config($family, $key) { * The channel_id * @return void|false Nothing or false if $uid is false */ + function load_pconfig($uid) { if($uid === false) -- cgit v1.2.3 From 6602ff83dd54d0e17c985a5f527654fc2ed83eea Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 30 May 2016 19:44:30 -0700 Subject: start removing reserved words from database column names (this run: addon and hook) --- include/language.php | 4 ++-- include/network.php | 2 +- include/plugin.php | 22 +++++++++++----------- include/widgets.php | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) (limited to 'include') diff --git a/include/language.php b/include/language.php index 238c23028..96d3e48a9 100644 --- a/include/language.php +++ b/include/language.php @@ -132,10 +132,10 @@ function load_translation_table($lang, $install = false) { } if(! $install) { - $plugins = q("SELECT name FROM addon WHERE installed=1;"); + $plugins = q("SELECT aname FROM addon WHERE installed=1;"); if ($plugins !== false) { foreach($plugins as $p) { - $name = $p['name']; + $name = $p['aname']; if(file_exists("addon/$name/lang/$lang/hstrings.php")) { include("addon/$name/lang/$lang/hstrings.php"); } diff --git a/include/network.php b/include/network.php index dd266f5d1..0dd10e29b 100644 --- a/include/network.php +++ b/include/network.php @@ -1967,7 +1967,7 @@ function get_site_info() { $r = q("select * from addon where hidden = 0"); if(count($r)) foreach($r as $rr) - $visible_plugins[] = $rr['name']; + $visible_plugins[] = $rr['aname']; } sort($visible_plugins); diff --git a/include/plugin.php b/include/plugin.php index 6c108fcc5..5dbfc218a 100755 --- a/include/plugin.php +++ b/include/plugin.php @@ -41,7 +41,7 @@ function uninstall_plugin($plugin) { $func(); } - q("DELETE FROM `addon` WHERE `name` = '%s' ", + q("DELETE FROM `addon` WHERE `aname` = '%s' ", dbesc($plugin) ); } @@ -66,7 +66,7 @@ function install_plugin($plugin) { $plugin_admin = (function_exists($plugin . '_plugin_admin') ? 1 : 0); - q("INSERT INTO `addon` (`name`, `installed`, `timestamp`, `plugin_admin`) VALUES ( '%s', 1, %d , %d ) ", + q("INSERT INTO `addon` (`aname`, `installed`, `tstamp`, `plugin_admin`) VALUES ( '%s', 1, %d , %d ) ", dbesc($plugin), intval($t), $plugin_admin @@ -111,7 +111,7 @@ function load_plugin($plugin) { } function plugin_is_installed($name) { - $r = q("select name from addon where name = '%s' and installed = 1 limit 1", + $r = q("select aname from addon where aname = '%s' and installed = 1 limit 1", dbesc($name) ); if($r) @@ -143,8 +143,8 @@ function reload_plugins() { if(file_exists($fname)) { $t = @filemtime($fname); foreach($installed as $i) { - if(($i['name'] == $pl) && ($i['timestamp'] != $t)) { - logger('Reloading plugin: ' . $i['name']); + if(($i['aname'] == $pl) && ($i['tstamp'] != $t)) { + logger('Reloading plugin: ' . $i['aname']); @include_once($fname); if(function_exists($pl . '_unload')) { @@ -155,7 +155,7 @@ function reload_plugins() { $func = $pl . '_load'; $func(); } - q("UPDATE `addon` SET `timestamp` = %d WHERE `id` = %d", + q("UPDATE `addon` SET `tstamp` = %d WHERE `id` = %d", intval($t), intval($i['id']) ); @@ -178,7 +178,7 @@ function reload_plugins() { * @return mixed|bool */ function register_hook($hook, $file, $function, $priority = 0) { - $r = q("SELECT * FROM `hook` WHERE `hook` = '%s' AND `file` = '%s' AND `function` = '%s' LIMIT 1", + $r = q("SELECT * FROM `hook` WHERE `hook` = '%s' AND `file` = '%s' AND `fn` = '%s' LIMIT 1", dbesc($hook), dbesc($file), dbesc($function) @@ -186,7 +186,7 @@ function register_hook($hook, $file, $function, $priority = 0) { if($r) return true; - $r = q("INSERT INTO `hook` (`hook`, `file`, `function`, `priority`) VALUES ( '%s', '%s', '%s', '%s' )", + $r = q("INSERT INTO `hook` (`hook`, `file`, `fn`, `priority`) VALUES ( '%s', '%s', '%s', '%s' )", dbesc($hook), dbesc($file), dbesc($function), @@ -206,7 +206,7 @@ function register_hook($hook, $file, $function, $priority = 0) { * @return array */ function unregister_hook($hook, $file, $function) { - $r = q("DELETE FROM hook WHERE hook = '%s' AND `file` = '%s' AND `function` = '%s'", + $r = q("DELETE FROM hook WHERE hook = '%s' AND `file` = '%s' AND `fn` = '%s'", dbesc($hook), dbesc($file), dbesc($function) @@ -233,7 +233,7 @@ function load_hooks() { if(! array_key_exists($rr['hook'],App::$hooks)) App::$hooks[$rr['hook']] = array(); - App::$hooks[$rr['hook']][] = array($rr['file'],$rr['function'],$rr['priority'],$rr['hook_version']); + App::$hooks[$rr['hook']][] = array($rr['file'],$rr['fn'],$rr['priority'],$rr['hook_version']); } } //logger('hooks: ' . print_r(App::$hooks,true)); @@ -301,7 +301,7 @@ function call_hooks($name, &$data = null) { else $func($a, $data); } else { - q("DELETE FROM hook WHERE hook = '%s' AND file = '%s' AND function = '%s'", + q("DELETE FROM hook WHERE hook = '%s' AND file = '%s' AND fn = '%s'", dbesc($name), dbesc($hook[0]), dbesc($origfn) diff --git a/include/widgets.php b/include/widgets.php index c4b80afd0..b9cb8e50d 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -1397,7 +1397,7 @@ function widget_admin($arr) { $plugins = array(); if($r) { foreach ($r as $h){ - $plugin = $h['name']; + $plugin = $h['aname']; $plugins[] = array(z_root() . '/admin/plugins/' . $plugin, $plugin, 'plugin'); // temp plugins with admin App::$plugins_admin[] = $plugin; -- cgit v1.2.3 From 44d3dadb03406a811c30340c814b3f95483a6a6d Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 30 May 2016 20:59:46 -0700 Subject: don't update hubloc_connected any more often than 15 minutes. We don't require that level of granularity and the frequent writes are causing issues with the stability of that table. --- include/zot.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/zot.php b/include/zot.php index 0f48fb0ba..45c9238b2 100644 --- a/include/zot.php +++ b/include/zot.php @@ -2402,11 +2402,14 @@ function sync_locations($sender, $arr, $absolute = false) { $current_site = false; + $t = datetime_convert('UTC','UTC','now - 15 minutes'); + if(array_key_exists('site',$arr) && $location['url'] == $arr['site']['url']) { - q("update hubloc set hubloc_connected = '%s', hubloc_updated = '%s' where hubloc_id = %d", + q("update hubloc set hubloc_connected = '%s', hubloc_updated = '%s' where hubloc_id = %d and hubloc_connected < '%s'", dbesc(datetime_convert()), dbesc(datetime_convert()), - intval($r[0]['hubloc_id']) + intval($r[0]['hubloc_id']), + dbesc($t) ); $current_site = true; } @@ -4125,7 +4128,7 @@ function update_hub_connected($hub,$sitekey = '') { $sitekey = $hub['sitekey']; } - // $sender['sitekey'] is a new addition to the protcol to distinguish + // $sender['sitekey'] is a new addition to the protocol to distinguish // hublocs coming from re-installed sites. Older sites will not provide // this field and we have to still mark them valid, since we can't tell // if this hubloc has the same sitekey as the packet we received. @@ -4134,10 +4137,13 @@ function update_hub_connected($hub,$sitekey = '') { // Update our DB to show when we last communicated successfully with this hub // This will allow us to prune dead hubs from using up resources - $r = q("update hubloc set hubloc_connected = '%s' where hubloc_id = %d and hubloc_sitekey = '%s' ", + $t = datetime_convert('UTC','UTC','now - 15 minutes'); + + $r = q("update hubloc set hubloc_connected = '%s' where hubloc_id = %d and hubloc_sitekey = '%s' and hubloc_connected < '%s' ", dbesc(datetime_convert()), intval($hub['hubloc_id']), - dbesc($sitekey) + dbesc($sitekey), + dbesc($t) ); // a dead hub came back to life - reset any tombstones we might have -- cgit v1.2.3 From 701acf59e2b2264f7afec9fdfab4d554193fd0b3 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 31 May 2016 13:22:47 -0700 Subject: don't remove missing hooks while update_r1169 is happpening - temp fix --- include/plugin.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/plugin.php b/include/plugin.php index 5dbfc218a..96ae0e543 100755 --- a/include/plugin.php +++ b/include/plugin.php @@ -301,11 +301,14 @@ function call_hooks($name, &$data = null) { else $func($a, $data); } else { - q("DELETE FROM hook WHERE hook = '%s' AND file = '%s' AND fn = '%s'", - dbesc($name), - dbesc($hook[0]), - dbesc($origfn) - ); + // The hook should be removed so we don't process it. + // But not until everybody gets through a timing issue + // related to git pull and update_r1169 + // q("DELETE FROM hook WHERE hook = '%s' AND file = '%s' AND fn = '%s'", + // dbesc($name), + // dbesc($hook[0]), + // dbesc($origfn) + // ); } } } -- cgit v1.2.3 From 00b4843425371e4ff55c82be577a279e248c29fc Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 31 May 2016 16:16:54 -0700 Subject: provide a sort of mutex lock around db logging so it can't possibly recurse. Previous attempts to do something similar using other methods haven't worked out satisfactorily. --- include/dba/dba_driver.php | 7 ++++++- include/plugin.php | 21 ++++++++++++--------- 2 files changed, 18 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/include/dba/dba_driver.php b/include/dba/dba_driver.php index 0ab5830ed..df072ed76 100755 --- a/include/dba/dba_driver.php +++ b/include/dba/dba_driver.php @@ -12,7 +12,7 @@ class DBA { static public $dba = null; static public $dbtype = null; - + static public $logging = false; /** * @brief Returns the database driver object. @@ -421,8 +421,13 @@ function db_getfunc($f) { function db_logger($s,$level = LOGGER_NORMAL,$syslog = LOG_INFO) { + if(\DBA::$logging) + return; + $saved = \DBA::$dba->debug; \DBA::$dba->debug = false; + \DBA::$logging = true; logger($s,$level,$syslog); + \DBA::$logging = false; \DBA::$dba->debug = $saved; } \ No newline at end of file diff --git a/include/plugin.php b/include/plugin.php index 96ae0e543..be4e92f03 100755 --- a/include/plugin.php +++ b/include/plugin.php @@ -300,15 +300,18 @@ function call_hooks($name, &$data = null) { $func($data); else $func($a, $data); - } else { - // The hook should be removed so we don't process it. - // But not until everybody gets through a timing issue - // related to git pull and update_r1169 - // q("DELETE FROM hook WHERE hook = '%s' AND file = '%s' AND fn = '%s'", - // dbesc($name), - // dbesc($hook[0]), - // dbesc($origfn) - // ); + } + else { + + // Don't do any DB write calls if we're currently logging a possibly failed DB call. + if(! DBA::$logging) { + // The hook should be removed so we don't process it. + q("DELETE FROM hook WHERE hook = '%s' AND file = '%s' AND fn = '%s'", + dbesc($name), + dbesc($hook[0]), + dbesc($origfn) + ); + } } } } -- cgit v1.2.3 From dfb6255f59980835d364402b372dd39f2b41ee7c Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 31 May 2016 17:50:47 -0700 Subject: more removal of reserved words from DB schemas --- include/account.php | 6 +++--- include/api.php | 2 +- include/oauth.php | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/include/account.php b/include/account.php index a442f3073..caf12878e 100644 --- a/include/account.php +++ b/include/account.php @@ -229,7 +229,7 @@ function verify_email_address($arr) { $hash = random_string(); - $r = q("INSERT INTO register ( hash, created, uid, password, language ) VALUES ( '%s', '%s', %d, '%s', '%s' ) ", + $r = q("INSERT INTO register ( hash, created, uid, password, lang ) VALUES ( '%s', '%s', %d, '%s', '%s' ) ", dbesc($hash), dbesc(datetime_convert()), intval($arr['account']['account_id']), @@ -283,7 +283,7 @@ function send_reg_approval_email($arr) { $hash = random_string(); - $r = q("INSERT INTO register ( hash, created, uid, password, language ) VALUES ( '%s', '%s', %d, '%s', '%s' ) ", + $r = q("INSERT INTO register ( hash, created, uid, password, lang ) VALUES ( '%s', '%s', %d, '%s', '%s' ) ", dbesc($hash), dbesc(datetime_convert()), intval($arr['account']['account_id']), @@ -387,7 +387,7 @@ function account_allow($hash) { intval($register[0]['uid']) ); - push_lang($register[0]['language']); + push_lang($register[0]['lang']); $email_tpl = get_intltext_template("register_open_eml.tpl"); $email_tpl = replace_macros($email_tpl, array( diff --git a/include/api.php b/include/api.php index af5a22a74..0833ae7b9 100644 --- a/include/api.php +++ b/include/api.php @@ -368,7 +368,7 @@ require_once('include/api_auth.php'); else $redirect = trim($_REQUEST['redirect_uris']); $icon = trim($_REQUEST['logo_uri']); - $r = q("INSERT INTO clients (client_id, pw, name, redirect_uri, icon, uid) + $r = q("INSERT INTO clients (client_id, pw, clname, redirect_uri, icon, uid) VALUES ('%s','%s','%s','%s','%s',%d)", dbesc($key), dbesc($secret), diff --git a/include/oauth.php b/include/oauth.php index ec41a5dd2..984e0e6c6 100644 --- a/include/oauth.php +++ b/include/oauth.php @@ -37,7 +37,7 @@ class ZotOAuth1DataStore extends OAuth1DataStore { logger(__function__.":".$consumer.", ". $token_type.", ".$token, LOGGER_DEBUG); - $r = q("SELECT id, secret, scope, expires, uid FROM tokens WHERE client_id = '%s' AND scope = '%s' AND id = '%s'", + $r = q("SELECT id, secret, auth_scope, expires, uid FROM tokens WHERE client_id = '%s' AND auth_scope = '%s' AND id = '%s'", dbesc($consumer->key), dbesc($token_type), dbesc($token) @@ -45,7 +45,7 @@ class ZotOAuth1DataStore extends OAuth1DataStore { if (count($r)){ $ot=new OAuth1Token($r[0]['id'],$r[0]['secret']); - $ot->scope=$r[0]['scope']; + $ot->scope=$r[0]['auth_scope']; $ot->expires = $r[0]['expires']; $ot->uid = $r[0]['uid']; return $ot; @@ -79,7 +79,7 @@ class ZotOAuth1DataStore extends OAuth1DataStore { $k = $consumer; } - $r = q("INSERT INTO tokens (id, secret, client_id, scope, expires) VALUES ('%s','%s','%s','%s', %d)", + $r = q("INSERT INTO tokens (id, secret, client_id, auth_scope, expires) VALUES ('%s','%s','%s','%s', %d)", dbesc($key), dbesc($sec), dbesc($k), @@ -110,7 +110,7 @@ class ZotOAuth1DataStore extends OAuth1DataStore { $key = $this->gen_token(); $sec = $this->gen_token(); - $r = q("INSERT INTO tokens (id, secret, client_id, scope, expires, uid) VALUES ('%s','%s','%s','%s', %d, %d)", + $r = q("INSERT INTO tokens (id, secret, client_id, auth_scope, expires, uid) VALUES ('%s','%s','%s','%s', %d, %d)", dbesc($key), dbesc($sec), dbesc($consumer->key), @@ -249,7 +249,7 @@ class FKOAuth2 extends OAuth2 { protected function getAuthCode($code) { - $r = q("SELECT id, client_id, redirect_uri, expires, scope FROM auth_codes WHERE id = '%s'", + $r = q("SELECT id, client_id, redirect_uri, expires, auth_scope FROM auth_codes WHERE id = '%s'", dbesc($code)); if (count($r)) @@ -259,7 +259,7 @@ class FKOAuth2 extends OAuth2 { protected function setAuthCode($code, $client_id, $redirect_uri, $expires, $scope = NULL) { $r = q("INSERT INTO auth_codes - (id, client_id, redirect_uri, expires, scope) VALUES + (id, client_id, redirect_uri, expires, auth_scope) VALUES ('%s', '%s', '%s', %d, '%s')", dbesc($code), dbesc($client_id), -- cgit v1.2.3 From b1259876bf398880e7b0c1b44d90f94983243e72 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 31 May 2016 21:45:33 -0700 Subject: more db column renames --- include/acl_selectors.php | 4 ++-- include/channel.php | 20 ++++++++--------- include/contact_widgets.php | 4 ++-- include/event.php | 4 ++-- include/feedutils.php | 2 +- include/group.php | 20 ++++++++--------- include/import.php | 12 +++++++--- include/items.php | 54 +++++++++++++++++++++++---------------------- include/taxonomy.php | 18 +++++++-------- include/text.php | 2 +- include/widgets.php | 10 ++++----- include/zot.php | 25 ++++++++++++++------- 12 files changed, 96 insertions(+), 79 deletions(-) (limited to 'include') diff --git a/include/acl_selectors.php b/include/acl_selectors.php index 54ea0304b..89d054e3b 100644 --- a/include/acl_selectors.php +++ b/include/acl_selectors.php @@ -15,7 +15,7 @@ function group_select($selname,$selclass,$preselected = false,$size = 4) { $o .= "