Пример #1
0
    if (isset($_FILES['attach']) && is_uploaded_file($_FILES['attach']['tmp_name']) && ($C->ATTACH_IMAGE_DISABLED == 0 || $C->ATTACH_FILE_DISABLED == 0)) {
        $file = (object) $_FILES['attach'];
        $is_image = FALSE;
        $info = @getimagesize($file->tmp_name);
        if ($info && is_array($info)) {
            if ($info[2] == IMAGETYPE_GIF || $info[2] == IMAGETYPE_JPEG || $info[2] == IMAGETYPE_PNG) {
                $is_image = TRUE;
            }
        }
        $attach_res = FALSE;
        if ($is_image && $C->ATTACH_IMAGE_DISABLED == 0) {
            $attach_res = $p->attach_image($file->tmp_name, $file->name);
        } elseif ($C->ATTACH_FILE_DISABLED == 0) {
            $attach_res = $p->attach_file($file->tmp_name, $file->name);
        }
        if (!$attach_res) {
            $D->error = TRUE;
            $D->errmsg = 'newpost_err_attach';
        }
    }
    if (!$D->error) {
        if (!$p->save()) {
            $D->error = TRUE;
            $D->errmsg = 'newpost_err_system';
        }
    }
    if (!$D->error) {
        $this->redirect('newpost/okmsg:' . ($to_user ? 'sent' : 'posted'));
    }
}
$this->load_template('mobile/newpost.php');
Пример #2
0
        $a['link'] = $tmp['link'];
        $p->set_attached($a);
    }
    if (isset($_POST['at_image']) && $_POST['at_image'] == "-1") {
        $a = $p->get_attached();
        $tmp = $post_temp->get_attached();
        $a['image'] = $tmp['image'];
        $p->set_attached($a);
    }
    if (isset($_POST['at_videoembed']) && $_POST['at_videoembed'] == "-1") {
        $a = $p->get_attached();
        $tmp = $post_temp->get_attached();
        $a['videoembed'] = $tmp['videoembed'];
        $p->set_attached($a);
    }
    if (isset($_POST['at_file']) && $_POST['at_file'] == "-1") {
        $a = $p->get_attached();
        $tmp = $post_temp->get_attached();
        $a['file'] = $tmp['file'];
        $p->set_attached($a);
    }
    $p->set_message($post_message);
    $res = $p->save();
    if (!$res) {
        echo '<result><status>ERROR</status><message>' . $this->lang('pf_msgerr_sys') . '</message></result>';
        exit;
    }
    $okmsg = isset($_POST['username']) && !empty($_POST['username']) ? 'pf_msgok_sent' : 'pf_msgok_posted';
    echo '<result><status>OK</status><message>' . $this->lang($okmsg) . '</message></result>';
    exit;
}
Пример #3
0
                $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');
            }
        }
    }
}
if ($new_rss_posts > 0) {
    echo 'New RSS posts: ' . $new_rss_posts . "\n";
}
Пример #4
0
 curl_setopt($http, CURLOPT_HEADER, FALSE);
 $twitter = curl_exec($http);
 curl_close($http);
 $twitter = json_decode($twitter, true);
 $posts_id = array();
 foreach ($twitter['results'] as $twit) {
     $posts_id[] = $twit['id_str'];
     if ($tmpu = $network->get_user_by_twitter_username($twit['from_user'])) {
         $p = null;
         $p = new newpost();
         $p->set_api_id(get_app_id('twitter'));
         $tmpu->info = $tmpu;
         $tmpu->is_logged = TRUE;
         $p->set_user_advanced($network, $tmpu);
         $p->set_message(preg_replace('/#' . $twitter_tag . '/iu', '', $twit['text']));
         $p->save();
     }
 }
 if (count($posts_id) > 0) {
     if (is_64bit()) {
         $max_post_id = max($posts_id);
     } else {
         $numb = new bigcompare();
         //$numb->try_new_candidate(1234);
         //$numb->try_new_candidate(1234);
         $numb->try_new_candidate_by_array($posts_id);
         $max_post_id = $numb->get_biggest();
     }
 } else {
     $max_post_id = 0;
 }
Пример #5
0
         if (!isset($_POST['suppress_response_codes'])) {
             header('HTTP/1.1 304 Not Modified');
         } else {
             echo generate_error($api_session->format, 'Provide a different message.', $_SERVER['REQUEST_URI'], $api_session->callback);
         }
         exit;
     }
 }
 $newpost = new newpost();
 $ok = $newpost->set_api_id($app_id);
 if ($ok) {
     $ok = $newpost->set_to_user($to_id);
 }
 if ($ok) {
     $newpost->set_message($_POST['text']);
     $ok = $newpost->save();
 }
 if (!$ok) {
     if (!isset($_POST['suppress_response_codes'])) {
         header('HTTP/1.1 500 Internal Server Error');
     } else {
         echo generate_error($api_session->format, 'Server error (Stage N2).', $_SERVER['REQUEST_URI'], $api_session->callback);
     }
     exit;
 } else {
     $p_id = explode("_", $ok);
     if (!($res = $this->db2->query('SELECT id AS pid, user_id, to_user, message, date FROM posts_pr WHERE id="' . intval($this->db2->e($p_id[0])) . '" LIMIT 1'))) {
         if (!isset($_POST['suppress_response_codes'])) {
             header('HTTP/1.1 500 Internal Server Error');
         } else {
             echo generate_error($api_session->format, 'Server error (Stage 22).', $_SERVER['REQUEST_URI'], $api_session->callback);
Пример #6
0
            $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) && !$obj->is_twitter) {
                $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 ($p->save()) {
                $new_rss_posts++;
                $posts++;
            }
        }
        if ($posts > 0) {
            $db2->query('UPDATE users_rssfeeds SET date_last_post="' . time() . '" WHERE id="' . $obj->id . '" LIMIT 1');
        }
    }
}
//---------------------
if ($new_rss_posts > 0) {
    echo 'New RSS posts: ' . $new_rss_posts . "\n";
}