require_once("mod/item.php");
require_once("include/items.php");
+use Friendica\Core\PConfig;
+
function ifttt_install() {
register_hook('connector_settings', 'addon/ifttt/ifttt.php', 'ifttt_settings');
register_hook('connector_settings_post','addon/ifttt/ifttt.php', 'ifttt_settings_post');
if(! local_user())
return;
- $key = get_pconfig(local_user(),'ifttt','key');
+ $key = PConfig::get(local_user(),'ifttt','key');
if (!$key) {
$key = substr(random_string(),0,20);
- set_pconfig(local_user(),'ifttt','key', $key);
+ PConfig::set(local_user(),'ifttt','key', $key);
}
$s .= '<span id="settings_ifttt_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_ifttt_expanded\'); openClose(\'settings_ifttt_inflated\');">';
if(x($_POST,'ifttt-submit'))
if (isset($_POST['ifttt-rekey']))
- del_pconfig(local_user(), 'ifttt', 'key');
+ PConfig::delete(local_user(), 'ifttt', 'key');
}
function ifttt_post(&$a) {
$key = $_REQUEST["key"];
// Check the key
- if ($key != get_pconfig($uid,'ifttt','key')) {
+ if ($key != PConfig::get($uid,'ifttt','key')) {
logger("Invalid key for user ".$uid, LOGGER_DEBUG);
return;
}
if (isset($_REQUEST["url"]))
$item["url"] = trim($_REQUEST["url"]);
- if ((substr($item["msg"], 0, 3) == "<<<") AND (substr($item["msg"], -3, 3) == ">>>"))
+ if ((substr($item["msg"], 0, 3) == "<<<") && (substr($item["msg"], -3, 3) == ">>>"))
$item["msg"] = substr($item["msg"], 3, -3);
ifttt_message($uid, $item);
if ($item["type"] == "link") {
$data = query_page_info($item["link"]);
- if (isset($item["title"]) AND (trim($item["title"]) != ""))
+ if (isset($item["title"]) && (trim($item["title"]) != ""))
$data["title"] = $item["title"];
- if (isset($item["description"]) AND (trim($item["description"]) != ""))
+ if (isset($item["description"]) && (trim($item["description"]) != ""))
$data["text"] = $item["description"];
$_REQUEST["body"] .= add_page_info_data($data);
- } elseif (($item["type"] == "photo") AND ($item["image"] != ""))
+ } elseif (($item["type"] == "photo") && ($item["image"] != ""))
$_REQUEST["body"] .= "\n\n[img]".$item["image"]."[/img]\n";
//print_r($_REQUEST);
item_post($a);
}
-?>