Пример #1
0
 /**
  * Sends all pingbacks
  *
  * @return integer The number of pings sent
  */
 function send_all_pingbacks()
 {
     global $bbdb;
     $posts = $bbdb->get_results("SELECT\n\t\t\t\t{$bbdb->posts}.post_id,\n\t\t\t\t{$bbdb->posts}.topic_id,\n\t\t\t\t{$bbdb->posts}.post_text\n\t\t\tFROM {$bbdb->posts}, {$bbdb->meta}\n\t\t\tWHERE {$bbdb->posts}.post_id = {$bbdb->meta}.object_id\n\t\t\t\tAND {$bbdb->meta}.object_type = 'bb_post'\n\t\t\t\tAND {$bbdb->meta}.meta_key = 'pingback_queued';");
     $pings = 0;
     foreach ($posts as $post) {
         if ($sent = BB_Pingbacks::send_pingback($post->topic_id, $post->post_text)) {
             $pings += $sent;
             bb_delete_postmeta($post->post_id, 'pingback_queued');
         }
     }
     return $pings;
 }
Пример #2
0
function thanks_admin_page_process()
{
    global $_POST;
    if (isset($_POST['thanks_option_submit'])) {
        bb_update_option('thanks_voting', $_POST['thanks_voting']);
        bb_update_option('thanks_output_none', $_POST['thanks_output_none']);
        bb_update_option('thanks_output_one', $_POST['thanks_output_one']);
        bb_update_option('thanks_output_many', $_POST['thanks_output_many']);
        bb_update_option('thanks_position', $_POST['thanks_position']);
        bb_update_option('thanks_voters', $_POST['thanks_voters']);
        bb_update_option('thanks_voters_prefix', $_POST['thanks_voters_prefix']);
        bb_update_option('thanks_voters_suffix', $_POST['thanks_voters_suffix']);
    }
    if (isset($_POST['thanks_option_reset'])) {
        bb_delete_option('thanks_voting');
        bb_delete_option('thanks_output_none');
        bb_delete_option('thanks_output_one');
        bb_delete_option('thanks_output_many');
        bb_delete_option('thanks_success');
        bb_delete_option('thanks_position');
        bb_delete_option('thanks_voters');
        bb_delete_option('thanks_voters_prefix');
        bb_delete_option('thanks_voters_suffix');
    }
    if (isset($_POST['thanks_remove_all'])) {
        $opt = bb_get_option("thanks_posts");
        for ($i = 0; $i < count($opt); $i++) {
            $post_id = $opt[$i];
            bb_delete_postmeta($post_id, "thanks");
        }
        bb_delete_option("thanks_posts");
        bb_delete_option('thanks_voting');
        bb_delete_option('thanks_output_none');
        bb_delete_option('thanks_output_one');
        bb_delete_option('thanks_output_many');
        bb_delete_option('thanks_success');
        bb_delete_option('thanks_position');
        bb_delete_option('thanks_voters');
        bb_delete_option('thanks_voters_prefix');
        bb_delete_option('thanks_voters_suffix');
    }
}