$p = null; $p = new newpost(); $p->set_api_id(2); $tmpu = $network->get_user_by_id($obj->user_id); $tmpu->info = $tmpu; $tmpu->is_logged = TRUE; $p->set_user_advanced($network, $tmpu); $p->set_message($message); if (!empty($item->source_url)) { $p->attach_link($item->source_url); } if (!empty($item->source_image)) { $p->attach_image($item->source_image); } if (!empty($item->source_video)) { $p->attach_videoembed($item->source_video); } if (!empty($item->source_description) && $item->source_description != $message) { $p->attach_richtext($item->source_description); } if ($pid = $p->save()) { $pid = intval(str_replace(array('_private', '_public'), '', $pid)); $db2->query('INSERT INTO users_rssfeeds_posts SET rssfeed_id="' . $obj->id . '", post_id="' . $pid . '" '); $new_rss_posts++; $posts++; } } if ($posts > 0) { $db2->query('UPDATE users_rssfeeds SET date_last_post="' . time() . '" WHERE id="' . $obj->id . '" LIMIT 1'); } }
private function item_validate_attachments($item) { if (!empty($item->source_image)) { $p = new newpost(); if (!($a = $p->attach_image($item->source_image))) { $item->source_image = ''; } elseif ($a->size_original[0] < 100 || $a->size_original[1] < 100) { $item->source_image = ''; } } if (!empty($item->source_video)) { $p = new newpost(); if (!($a = $p->attach_videoembed($item->source_video))) { $item->source_video = ''; } } return $item; }
} exit; } } if (isset($_POST['link']) && is_valid_url(urldecode($_POST['link']))) { if (!$newpost->attach_link(urldecode($_POST['link']))) { if (!isset($_POST['suppress_response_codes'])) { header('HTTP/1.1 403 Forbidden'); } else { echo generate_error($api_session->format, 'Invalid link.', $_SERVER['REQUEST_URI'], $api_session->callback); } exit; } } if (isset($_POST['video']) && !empty($_POST['video'])) { if (!$newpost->attach_videoembed(urldecode($_REQUEST['video']))) { if (!isset($_POST['suppress_response_codes'])) { header('HTTP/1.1 403 Forbidden'); } else { echo generate_error($api_session->format, 'Invalid video link.', $_SERVER['REQUEST_URI'], $api_session->callback); } exit; } } if (isset($_POST['file']) && !empty($_POST['file']) && isset($_POST['file_type']) && !empty($_POST['file_type'])) { $tmp = $C->TMP_DIR . 'tmp_' . md5(time() . rand(0, 9999)); $fl = file_put_contents($tmp, base64_decode($_POST['file'])); if (!$newpost->attach_file($tmp, $fl . '.' . $_POST['file_type'])) { if (!isset($_POST['suppress_response_codes'])) { header('HTTP/1.1 403 Forbidden'); } else {