当前位置: 首页>>代码示例>>PHP>>正文


PHP get_post_data函数代码示例

本文整理汇总了PHP中get_post_data函数的典型用法代码示例。如果您正苦于以下问题:PHP get_post_data函数的具体用法?PHP get_post_data怎么用?PHP get_post_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_post_data函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: stripe_webhook_handler

/**
 * Handle Stripe webhooks
 */
function stripe_webhook_handler($environment)
{
    $body = get_post_data();
    $event_json = json_decode($body);
    $event_id = $event_json->id;
    $gateway = new StripeClient($environment);
    $event = $gateway->getEvent($event_id);
    if (!$event) {
        return array('success' => false, 'message' => 'Stripe Event for this webhook was not found');
    }
    $ia = elgg_set_ignore_access(true);
    $ha = access_get_show_hidden_status();
    access_show_hidden_entities(true);
    $result = elgg_trigger_plugin_hook_handler($event->type, 'stripe.events', array('environment' => $environment, 'event' => $event), array('success' => true));
    access_show_hidden_entities($ha);
    elgg_set_ignore_access($ia);
    return $result;
}
开发者ID:Daltonmedia,项目名称:stripe,代码行数:21,代码来源:start.php

示例2: search_products

function search_products(ProductCategory $category, $page)
{
    $post_data = array();
    $post_data["ApiKey"] = API_KEY;
    $post_data["SearchRequest"] = array();
    $post_data["SearchRequest"]["Keyword"] = $category->get_name();
    $post_data["SearchRequest"]["Pagination"] = array();
    $post_data["SearchRequest"]["Pagination"]["ItemsPerPage"] = 10;
    $post_data["SearchRequest"]["Pagination"]["PageNumber"] = $page;
    $post_data["SearchRequest"]["Filters"] = array();
    $post_data["SearchRequest"]["Filters"]["Price"] = array();
    $post_data["SearchRequest"]["Filters"]["Price"]["Min"] = 0;
    $post_data["SearchRequest"]["Filters"]["Price"]["Max"] = 0;
    $post_data["SearchRequest"]["Filters"]["Navigation"] = "all";
    $post_data["SearchRequest"]["Filters"]["IncludeMarketPlace"] = false;
    $post_data["SearchRequest"]["Filters"]["Brands"] = array();
    $file = get_post_data(API_SEARCH, json_encode($post_data));
    return json_decode($file, true);
}
开发者ID:Monpoke,项目名称:nuitinfo,代码行数:19,代码来源:cdiscount.php

示例3: block_content

 public function block_content($context, array $blocks = array())
 {
     // line 4
     echo "<h4>Alasan laporan</h4>\n";
     // line 5
     echo get_flashdata("laporkan");
     echo "\n\n<p>Mengapa anda melaporkan komentar tersebut?</p>\n\n";
     // line 9
     echo form_open("materi/detail/" . $this->getAttribute(isset($context["materi"]) ? $context["materi"] : null, "id") . "/laporkan/" . $this->getAttribute(isset($context["komentar"]) ? $context["komentar"] : null, "id"));
     echo "\n";
     // line 10
     echo form_error("alasan");
     echo "\n<label class=\"radio\">\n  <input type=\"radio\" ";
     // line 12
     echo twig_escape_filter($this->env, set_radio("alasan", "SARA"), "html", null, true);
     echo " class=\"hide-lain\" name=\"alasan\" value=\"SARA\"> SARA\n</label>\n<label class=\"radio\">\n  <input type=\"radio\" ";
     // line 15
     echo twig_escape_filter($this->env, set_radio("alasan", "Pornografi"), "html", null, true);
     echo " class=\"hide-lain\" name=\"alasan\" value=\"Pornografi\"> Pornografi\n</label>\n<label class=\"radio\">\n  <input type=\"radio\" ";
     // line 18
     echo twig_escape_filter($this->env, set_radio("alasan", "Profokasi/Intimidasi"), "html", null, true);
     echo " class=\"hide-lain\" name=\"alasan\" value=\"Profokasi/Intimidasi\"> Profokasi/Intimidasi\n</label>\n<label class=\"radio\">\n  <input type=\"radio\" ";
     // line 21
     echo twig_escape_filter($this->env, set_radio("alasan", "tulis"), "html", null, true);
     echo " class=\"show-lain\" name=\"alasan\" value=\"tulis\"> Tulis alasan\n</label>\n<div class=\"form-lain ";
     // line 23
     echo twig_test_empty(get_post_data("alasan")) || get_post_data("alasan") != "tulis" ? "hide" : "";
     echo "\">\n    <textarea class=\"span12\" name=\"alasan_lain\" placeholder=\"Tulis alasan anda\">";
     // line 24
     echo twig_escape_filter($this->env, set_value("alasan_lain"), "html", null, true);
     echo "</textarea>\n    ";
     // line 25
     echo form_error("alasan_lain");
     echo "\n</div>\n<p><button type=\"submit\" class=\"btn btn-primary\">Submit</button></p>\n";
     // line 28
     echo form_close();
     echo "\n";
 }
开发者ID:Raniratna,项目名称:new_elearning,代码行数:38,代码来源:9e099557ff2888af408b3d56eb271e09d9d40394fc59564ba8d488d23000.php

示例4: block_content


//.........这里部分代码省略.........
     // line 43
     echo twig_escape_filter($this->env, $this->getAttribute(isset($context["pengajar"]) ? $context["pengajar"] : null, "link_profil"), "html", null, true);
     echo "\">";
     echo twig_escape_filter($this->env, $this->getAttribute(isset($context["pengajar"]) ? $context["pengajar"] : null, "nama"), "html", null, true);
     echo "</a></td>\n                                            <td>";
     // line 44
     echo twig_escape_filter($this->env, $this->getAttribute(isset($context["mapel"]) ? $context["mapel"] : null, "nama"), "html", null, true);
     echo "</td>\n                                            <td>";
     // line 45
     echo twig_escape_filter($this->env, get_indo_hari($this->getAttribute(isset($context["mapel_ajar"]) ? $context["mapel_ajar"] : null, "hari_id")), "html", null, true);
     echo "</td>\n                                            <td>";
     // line 46
     echo twig_escape_filter($this->env, twig_date_format_filter($this->env, $this->getAttribute(isset($context["mapel_ajar"]) ? $context["mapel_ajar"] : null, "jam_mulai"), "H:i"), "html", null, true);
     echo " - ";
     echo twig_escape_filter($this->env, twig_date_format_filter($this->env, $this->getAttribute(isset($context["mapel_ajar"]) ? $context["mapel_ajar"] : null, "jam_selesai"), "H:i"), "html", null, true);
     echo "</td>\n                                            <td>";
     // line 47
     echo twig_escape_filter($this->env, $this->getAttribute(isset($context["kelas"]) ? $context["kelas"] : null, "nama"), "html", null, true);
     echo " <span class=\"badge badge-info\">";
     echo twig_escape_filter($this->env, $this->getAttribute(isset($context["kelas"]) ? $context["kelas"] : null, "jumlah_siswa"), "html", null, true);
     echo " siswa</span></td>\n                                        </tr>\n                                    </tbody>\n                                </table>\n                                </div>\n                            </div>\n                        </th>\n                    </tr>\n                </thead>\n                <tbody>\n                    <tr class=\"info\">\n                        <td>\n                            <ul class=\"unstyled inline\" style=\"margin-left: -5px;\">\n                                ";
     // line 60
     $context['_parent'] = (array) $context;
     $context['_seq'] = twig_ensure_traversable($this->getAttribute(isset($context["retrieve_all_pertanyaan"]) ? $context["retrieve_all_pertanyaan"] : null, "results"));
     foreach ($context['_seq'] as $context["s_key"] => $context["s"]) {
         // line 61
         echo "                                <li>\n                                    ";
         // line 62
         if (!twig_test_empty($this->getAttribute(isset($context["s"]) ? $context["s"] : null, "kunci_index"))) {
             // line 63
             echo "                                        ";
             $context["kunci_index"] = get_abjad($this->getAttribute(isset($context["s"]) ? $context["s"] : null, "kunci_index"));
             // line 64
             echo "                                    ";
         } else {
             // line 65
             echo "                                        ";
             $context["kunci_index"] = "";
             // line 66
             echo "                                    ";
         }
         // line 67
         echo "                                    ";
         echo anchor("admin/tugas/edit_question/" . $this->getAttribute(isset($context["mapel_ajar"]) ? $context["mapel_ajar"] : null, "id") . "/" . $this->getAttribute(isset($context["tugas"]) ? $context["tugas"] : null, "id") . "/" . $this->getAttribute(isset($context["s"]) ? $context["s"] : null, "id"), (isset($context["s_key"]) ? $context["s_key"] : null) . ". " . (isset($context["kunci_index"]) ? $context["kunci_index"] : null), array("class" => "label label-info", "data-toggle" => "tooltip", "title" => word_limiter(strip_tags($this->getAttribute(isset($context["s"]) ? $context["s"] : null, "pertanyaan")), 50)));
         echo "\n                                </li>\n                                ";
     }
     $_parent = $context['_parent'];
     unset($context['_seq'], $context['_iterated'], $context['s_key'], $context['s'], $context['_parent'], $context['loop']);
     $context = array_intersect_key($context, $_parent) + $_parent;
     // line 70
     echo "                            </ul>\n                            <b>Jumlah Soal Tersimpan : ";
     // line 71
     echo twig_escape_filter($this->env, $this->getAttribute(isset($context["retrieve_all_pertanyaan"]) ? $context["retrieve_all_pertanyaan"] : null, "total_record"), "html", null, true);
     echo "</b>\n                        </td>\n                    </tr>\n                    <tr>\n                        <td>\n                            <h3>Pertanyaan Soal Ke ";
     // line 76
     echo twig_escape_filter($this->env, $this->getAttribute(isset($context["retrieve_all_pertanyaan"]) ? $context["retrieve_all_pertanyaan"] : null, "total_record") + 1, "html", null, true);
     echo " <span class=\"text-error\">*</span> ";
     echo form_error("pertanyaan");
     echo "</h3>\n                            <textarea id=\"question\" name=\"pertanyaan\" style=\"width:100%;height:200px;\">";
     // line 77
     echo set_value("pertanyaan");
     echo "</textarea>\n                        </td>\n                    </tr>\n                    ";
     // line 80
     if ($this->getAttribute(isset($context["tugas"]) ? $context["tugas"] : null, "type_id") == 3) {
         // line 81
         echo "                    <tr>\n                        <td>\n                            <div class=\"pull-right controls\">\n                                <label class=\"radio inline\"><input type=\"radio\" name=\"kunci\" value=\"pilihan_1\" ";
         // line 84
         echo twig_escape_filter($this->env, set_radio("kunci", "pilihan_1", get_post_data("kunci") == "" ? true : ""), "html", null, true);
         echo "> <b class=\"text-warning\">Jadikan Kunci</b></label>\n                            </div>\n                            <h3>Pilihan A</h3>\n                            <textarea class=\"tiny_options\" name=\"pilihan_1\" style=\"width:100%;height:200px;\">";
         // line 87
         echo set_value("pilihan_1");
         echo "</textarea>\n                        </td>\n                    </tr>\n                    <tr>\n                        <td>\n                            <div class=\"pull-right controls\">\n                                <label class=\"radio inline\"><input type=\"radio\" name=\"kunci\" value=\"pilihan_2\" ";
         // line 93
         echo twig_escape_filter($this->env, set_radio("kunci", "pilihan_2"), "html", null, true);
         echo "> <b class=\"text-warning\">Jadikan Kunci</b></label>\n                            </div>\n                            <h3>Pilihan B</h3>\n                            <textarea class=\"tiny_options\" name=\"pilihan_2\" style=\"width:100%;height:200px;\">";
         // line 96
         echo set_value("pilihan_2");
         echo "</textarea>\n                        </td>\n                    </tr>\n                    <tr>\n                        <td>\n                            <div class=\"pull-right controls\">\n                                <label class=\"radio inline\"><input type=\"radio\" name=\"kunci\" value=\"pilihan_3\" ";
         // line 102
         echo twig_escape_filter($this->env, set_radio("kunci", "pilihan_3"), "html", null, true);
         echo "> <b class=\"text-warning\">Jadikan Kunci</b></label>\n                            </div>\n                            <h3>Pilihan C</h3>\n                            <textarea class=\"tiny_options\" name=\"pilihan_3\" style=\"width:100%;height:200px;\">";
         // line 105
         echo set_value("pilihan_3");
         echo "</textarea>\n                        </td>\n                    </tr>\n                    <tr>\n                        <td>\n                            <div class=\"pull-right controls\">\n                                <label class=\"radio inline\"><input type=\"radio\" name=\"kunci\" value=\"pilihan_4\" ";
         // line 111
         echo twig_escape_filter($this->env, set_radio("kunci", "pilihan_4"), "html", null, true);
         echo "> <b class=\"text-warning\">Jadikan Kunci</b></label>\n                            </div>\n                            <h3>Pilihan D</h3>\n                            <textarea class=\"tiny_options\" name=\"pilihan_4\" style=\"width:100%;height:200px;\">";
         // line 114
         echo set_value("pilihan_4");
         echo "</textarea>\n                        </td>\n                    </tr>\n                    ";
     }
     // line 118
     echo "                    <tr>\n                        <td>\n                            <button class=\"btn btn-primary\" type=\"submit\">Simpan</button>\n                            <a class=\"btn btn-default\" href=\"";
     // line 121
     echo twig_escape_filter($this->env, site_url("admin/tugas/soal/" . $this->getAttribute(isset($context["mapel_ajar"]) ? $context["mapel_ajar"] : null, "id") . "/" . $this->getAttribute(isset($context["tugas"]) ? $context["tugas"] : null, "id")), "html", null, true);
     echo "\">Batal</a>\n                        </td>\n                    </tr>\n                </tbody>\n            </table>\n            ";
     // line 126
     echo form_close();
     echo "\n        </div>\n    </div>\n</div>\n";
 }
开发者ID:Raniratna,项目名称:new_elearning,代码行数:101,代码来源:67e3da52a21d786d44ebdda9bc4b8be632a0657be050a51a749fbff17e51.php

示例5: split_topic

/**
* Split topic
*/
function split_topic($action, $topic_id, $to_forum_id, $subject)
{
    global $db, $template, $user, $phpEx, $phpbb_root_path, $auth, $config;
    $post_id_list = request_var('post_id_list', array(0));
    $forum_id = request_var('forum_id', 0);
    $start = request_var('start', 0);
    if (!sizeof($post_id_list)) {
        $template->assign_var('MESSAGE', $user->lang['NO_POST_SELECTED']);
        return;
    }
    if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_split'))) {
        return;
    }
    $post_id = $post_id_list[0];
    $post_info = get_post_data(array($post_id));
    if (!sizeof($post_info)) {
        $template->assign_var('MESSAGE', $user->lang['NO_POST_SELECTED']);
        return;
    }
    $post_info = $post_info[$post_id];
    $subject = trim($subject);
    // Make some tests
    if (!$subject) {
        $template->assign_var('MESSAGE', $user->lang['EMPTY_SUBJECT']);
        return;
    }
    if ($to_forum_id <= 0) {
        $template->assign_var('MESSAGE', $user->lang['NO_DESTINATION_FORUM']);
        return;
    }
    $forum_info = get_forum_data(array($to_forum_id), 'f_post');
    if (!sizeof($forum_info)) {
        $template->assign_var('MESSAGE', $user->lang['USER_CANNOT_POST']);
        return;
    }
    $forum_info = $forum_info[$to_forum_id];
    if ($forum_info['forum_type'] != FORUM_POST) {
        $template->assign_var('MESSAGE', $user->lang['FORUM_NOT_POSTABLE']);
        return;
    }
    $redirect = request_var('redirect', build_url(array('quickmod')));
    $s_hidden_fields = build_hidden_fields(array('i' => 'main', 'post_id_list' => $post_id_list, 'f' => $forum_id, 'mode' => 'topic_view', 'start' => $start, 'action' => $action, 't' => $topic_id, 'redirect' => $redirect, 'subject' => $subject, 'to_forum_id' => $to_forum_id, 'icon' => request_var('icon', 0)));
    $success_msg = $return_link = '';
    if (confirm_box(true)) {
        if ($action == 'split_beyond') {
            $sort_days = $total = 0;
            $sort_key = $sort_dir = '';
            $sort_by_sql = $sort_order_sql = array();
            mcp_sorting('viewtopic', $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id, $topic_id);
            $limit_time_sql = $sort_days ? 'AND t.topic_last_post_time >= ' . (time() - $sort_days * 86400) : '';
            if ($sort_order_sql[0] == 'u') {
                $sql = 'SELECT p.post_id, p.forum_id, p.post_approved
					FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u\n\t\t\t\t\tWHERE p.topic_id = {$topic_id}\n\t\t\t\t\t\tAND p.poster_id = u.user_id\n\t\t\t\t\t\t{$limit_time_sql}\n\t\t\t\t\tORDER BY {$sort_order_sql}";
            } else {
                $sql = 'SELECT p.post_id, p.forum_id, p.post_approved
					FROM ' . POSTS_TABLE . " p\n\t\t\t\t\tWHERE p.topic_id = {$topic_id}\n\t\t\t\t\t\t{$limit_time_sql}\n\t\t\t\t\tORDER BY {$sort_order_sql}";
            }
            $result = $db->sql_query_limit($sql, 0, $start);
            $store = false;
            $post_id_list = array();
            while ($row = $db->sql_fetchrow($result)) {
                // If split from selected post (split_beyond), we split the unapproved items too.
                if (!$row['post_approved'] && !$auth->acl_get('m_approve', $row['forum_id'])) {
                    //					continue;
                }
                // Start to store post_ids as soon as we see the first post that was selected
                if ($row['post_id'] == $post_id) {
                    $store = true;
                }
                if ($store) {
                    $post_id_list[] = $row['post_id'];
                }
            }
            $db->sql_freeresult($result);
        }
        if (!sizeof($post_id_list)) {
            trigger_error('NO_POST_SELECTED');
        }
        $icon_id = request_var('icon', 0);
        $sql_ary = array('forum_id' => $to_forum_id, 'topic_title' => $subject, 'icon_id' => $icon_id, 'topic_approved' => 1);
        $sql = 'INSERT INTO ' . TOPICS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
        $db->sql_query($sql);
        $to_topic_id = $db->sql_nextid();
        move_posts($post_id_list, $to_topic_id);
        $topic_info = get_topic_data(array($topic_id));
        $topic_info = $topic_info[$topic_id];
        add_log('mod', $to_forum_id, $to_topic_id, 'LOG_SPLIT_DESTINATION', $subject);
        add_log('mod', $forum_id, $topic_id, 'LOG_SPLIT_SOURCE', $topic_info['topic_title']);
        // Change topic title of first post
        $sql = 'UPDATE ' . POSTS_TABLE . "\n\t\t\tSET post_subject = '" . $db->sql_escape($subject) . "'\n\t\t\tWHERE post_id = {$post_id_list[0]}";
        $db->sql_query($sql);
        $success_msg = 'TOPIC_SPLIT_SUCCESS';
        // Update forum statistics
        set_config_count('num_topics', 1, true);
        // Link back to both topics
        $return_link = sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 'f=' . $post_info['forum_id'] . '&amp;t=' . $post_info['topic_id']) . '">', '</a>') . '<br /><br />' . sprintf($user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 'f=' . $to_forum_id . '&amp;t=' . $to_topic_id) . '">', '</a>');
    } else {
//.........这里部分代码省略.........
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:101,代码来源:mcp_topic.php

示例6: api_auth_hmac

/**
 * PAM: Confirm the HMAC signature
 *
 * @return true if success - otherwise throws exception
 *
 * @throws SecurityException
 * @since 1.7.0
 * @access private
 */
function api_auth_hmac()
{
    global $CONFIG;
    // Get api header
    $api_header = get_and_validate_api_headers();
    // Pull API user details
    $api_user = get_api_user($CONFIG->site_id, $api_header->api_key);
    if (!$api_user) {
        throw new SecurityException(elgg_echo('SecurityException:InvalidAPIKey'), ErrorResult::$RESULT_FAIL_APIKEY_INVALID);
    }
    // Get the secret key
    $secret_key = $api_user->secret;
    // get the query string
    $query = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], '?') + 1);
    // calculate expected HMAC
    $hmac = calculate_hmac($api_header->hmac_algo, $api_header->time, $api_header->nonce, $api_header->api_key, $secret_key, $query, $api_header->method == 'POST' ? $api_header->posthash : "");
    if ($api_header->hmac !== $hmac) {
        throw new SecurityException("HMAC is invalid.  {$api_header->hmac} != [calc]{$hmac}");
    }
    // Now make sure this is not a replay
    if (cache_hmac_check_replay($hmac)) {
        throw new SecurityException(elgg_echo('SecurityException:DupePacket'));
    }
    // Validate post data
    if ($api_header->method == "POST") {
        $postdata = get_post_data();
        $calculated_posthash = calculate_posthash($postdata, $api_header->posthash_algo);
        if (strcmp($api_header->posthash, $calculated_posthash) != 0) {
            $msg = elgg_echo('SecurityException:InvalidPostHash', array($calculated_posthash, $api_header->posthash));
            throw new SecurityException($msg);
        }
    }
    return true;
}
开发者ID:socialweb,项目名称:PiGo,代码行数:43,代码来源:web_services.php

示例7: mn_natcasesort

                 $comments[] .= $c_line;
             }
         }
     }
 }
 $c_trash = 0;
 if (!empty($comments)) {
     $comments = mn_natcasesort($comments);
     $comments = array_reverse($comments);
     $comments_result = '';
     $c_count = 0;
     $c_authors = array();
     $c_ips = array();
     foreach ($comments as $comments_line) {
         $var = get_values('comments', $comments_line, false);
         $post = get_post_data($var['post_id']);
         $comments_timestamps[$var['timestamp']] = date('Y-m', $var['timestamp']);
         if (isset($var['author_id']) && !empty($var['author_id'])) {
             $c_authors[] = $var['author_id'];
         }
         if (isset($var['ip_address']) && !empty($var['ip_address'])) {
             $c_ips[] = $var['ip_address'];
         }
         if (isset($var['status']) && $var['status'] == 0) {
             $c_trash++;
         }
         $posts[$post['id']] = $post['title'];
         if (!isset($_GET['trash']) && $var['status'] == 0) {
             continue;
         }
         if (isset($_GET['trash']) && $var['status'] != 0) {
开发者ID:deanbrabec,项目名称:news_slider,代码行数:31,代码来源:mn-comments.php

示例8: main

    function main($id, $mode)
    {
        global $auth, $db, $user, $template;
        global $config, $phpbb_root_path, $phpEx, $action;
        include_once $phpbb_root_path . 'includes/functions_posting.' . $phpEx;
        $forum_id = request_var('f', 0);
        $start = request_var('start', 0);
        $this->page_title = 'MCP_QUEUE';
        switch ($action) {
            case 'approve':
            case 'disapprove':
                include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
                $post_id_list = request_var('post_id_list', array(0));
                if (!sizeof($post_id_list)) {
                    trigger_error('NO_POST_SELECTED');
                }
                if ($action == 'approve') {
                    approve_post($post_id_list, $mode);
                } else {
                    disapprove_post($post_id_list, $mode);
                }
                break;
        }
        switch ($mode) {
            case 'approve_details':
                $user->add_lang('posting');
                $post_id = request_var('p', 0);
                $topic_id = request_var('t', 0);
                if ($topic_id) {
                    $topic_info = get_topic_data(array($topic_id), 'm_approve');
                    if (isset($topic_info[$topic_id]['topic_first_post_id'])) {
                        $post_id = (int) $topic_info[$topic_id]['topic_first_post_id'];
                    } else {
                        $topic_id = 0;
                    }
                }
                $post_info = get_post_data(array($post_id), 'm_approve');
                if (!sizeof($post_info)) {
                    trigger_error('NO_POST_SELECTED');
                }
                $post_info = $post_info[$post_id];
                if ($post_info['topic_first_post_id'] != $post_id && topic_review($post_info['topic_id'], $post_info['forum_id'], 'topic_review', 0, false)) {
                    $template->assign_vars(array('S_TOPIC_REVIEW' => true, 'TOPIC_TITLE' => $post_info['topic_title']));
                }
                // Set some vars
                if ($post_info['user_id'] == ANONYMOUS) {
                    $poster = $post_info['post_username'] ? $post_info['post_username'] : $user->lang['GUEST'];
                }
                $poster = $post_info['user_colour'] ? '<span style="color:#' . $post_info['user_colour'] . '">' . $post_info['username'] . '</span>' : $post_info['username'];
                // Process message, leave it uncensored
                $message = $post_info['post_text'];
                if ($post_info['bbcode_bitfield']) {
                    include_once $phpbb_root_path . 'includes/bbcode.' . $phpEx;
                    $bbcode = new bbcode($post_info['bbcode_bitfield']);
                    $bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']);
                }
                $message = smiley_text($message);
                $template->assign_vars(array('S_MCP_QUEUE' => true, 'S_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", "i=queue&amp;p={$post_id}&amp;f={$forum_id}"), 'S_CAN_VIEWIP' => $auth->acl_get('m_info', $post_info['forum_id']), 'S_POST_REPORTED' => $post_info['post_reported'], 'S_POST_UNAPPROVED' => !$post_info['post_approved'], 'S_POST_LOCKED' => $post_info['post_edit_locked'], 'S_USER_NOTES' => true, 'U_EDIT' => $auth->acl_get('m_edit', $post_info['forum_id']) ? append_sid("{$phpbb_root_path}posting.{$phpEx}", "mode=edit&amp;f={$post_info['forum_id']}&amp;p={$post_info['post_id']}") : '', 'U_MCP_APPROVE' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=queue&amp;mode=approve_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_id), 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=reports&amp;mode=report_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_id), 'U_MCP_USER_NOTES' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=notes&amp;mode=user_notes&amp;u=' . $post_info['user_id']), 'U_MCP_WARN_USER' => $auth->acl_getf_global('m_warn') ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=warn&amp;mode=warn_user&amp;u=' . $post_info['user_id']) : '', 'U_VIEW_PROFILE' => $post_info['user_id'] != ANONYMOUS ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=viewprofile&amp;u=' . $post_info['user_id']) : '', 'RETURN_QUEUE' => sprintf($user->lang['RETURN_QUEUE'], '<a href="' . append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=queue' . ($topic_id ? '&amp;mode=unapproved_topics' : '&amp;mode=unapproved_posts')) . "&amp;start={$start}\">", '</a>'), 'REPORTED_IMG' => $user->img('icon_reported', $user->lang['POST_REPORTED']), 'UNAPPROVED_IMG' => $user->img('icon_unapproved', $user->lang['POST_UNAPPROVED']), 'EDIT_IMG' => $user->img('btn_edit', $user->lang['EDIT_POST']), 'POSTER_NAME' => $poster, 'POST_PREVIEW' => $message, 'POST_SUBJECT' => $post_info['post_subject'], 'POST_DATE' => $user->format_date($post_info['post_time']), 'POST_IP' => $post_info['poster_ip'], 'POST_IPADDR' => @gethostbyaddr($post_info['poster_ip']), 'POST_ID' => $post_info['post_id']));
                $this->tpl_name = 'mcp_post';
                break;
            case 'unapproved_topics':
            case 'unapproved_posts':
                $topic_id = request_var('t', 0);
                $forum_info = array();
                if ($topic_id) {
                    $topic_info = get_topic_data(array($topic_id));
                    if (!sizeof($topic_info)) {
                        trigger_error($user->lang['TOPIC_NOT_EXIST']);
                    }
                    $topic_info = $topic_info[$topic_id];
                    $forum_id = $topic_info['forum_id'];
                }
                $forum_list_approve = get_forum_list('m_approve', false, true);
                if (!$forum_id) {
                    $forum_list = array();
                    foreach ($forum_list_approve as $row) {
                        $forum_list[] = $row['forum_id'];
                    }
                    if (!($forum_list = implode(', ', $forum_list))) {
                        trigger_error('NOT_MODERATOR');
                    }
                    $sql = 'SELECT SUM(forum_topics) as sum_forum_topics
						FROM ' . FORUMS_TABLE . "\n\t\t\t\t\t\tWHERE forum_id IN (0, {$forum_list})";
                    $result = $db->sql_query($sql);
                    $forum_info['forum_topics'] = (int) $db->sql_fetchfield('sum_forum_topics');
                    $db->sql_freeresult($result);
                    $global_id = $forum_list[0];
                } else {
                    $forum_info = get_forum_data(array($forum_id), 'm_approve');
                    if (!sizeof($forum_info)) {
                        trigger_error('NOT_MODERATOR');
                    }
                    $forum_info = $forum_info[$forum_id];
                    $forum_list = $forum_id;
                    $global_id = $forum_id;
                }
                $forum_options = '<option value="0"' . ($forum_id == 0 ? ' selected="selected"' : '') . '>' . $user->lang['ALL_FORUMS'] . '</option>';
                foreach ($forum_list_approve as $row) {
                    $forum_options .= '<option value="' . $row['forum_id'] . '"' . ($forum_id == $row['forum_id'] ? ' selected="selected"' : '') . '>' . $row['forum_name'] . '</option>';
                }
//.........这里部分代码省略.........
开发者ID:yunsite,项目名称:gloryroad,代码行数:101,代码来源:mcp_queue.php

示例9: mysql_query

     echo '<form action="?action=search" method="post"><p><input name="search" type="text" value="' . $post_data['search'] . '"/></p><p><input type="submit" value="搜索" /></p></form>';
     if ($_POST) {
         $search_query = mysql_query('select * from `music_list` where `name` like \'%' . $post_data['search'] . '%\' or `singer` like \'%' . $post_data['search'] . '%\' or `url` like \'%' . $post_data['search'] . '%\'');
         if (mysql_num_rows($search_query) > 0) {
             echo '<ol>';
             while (($value = mysql_fetch_array($search_query)) !== false) {
                 echo '<li>' . $value['name'] . ' - ' . $value['singer'] . '&nbsp;<a href="' . $_SERVER['PHP_SELF'] . '?action=edit&id=' . $value['id'] . '">编辑</a>&nbsp;<a href="' . $_SERVER['PHP_SELF'] . '?action=del&id=' . $value['id'] . '">删除</a></li>';
             }
             echo '</ol><a href="' . $_SERVER['PHP_SELF'] . '">返回首页</a>';
         } else {
             echo '<p>无搜索结果</p>';
         }
     }
 } elseif ($_GET['action'] == 'add') {
     if ($_POST) {
         $post_data = get_post_data();
         $insert_query = mysql_query('insert into `music_list`(`name`,`url`,`singer`,`lrc`,`lrc_data`) values(\'' . $post_data['name'] . '\',\'' . $post_data['url'] . '\',\'' . $post_data['singer'] . '\',\'' . $post_data['lrc'] . '\',\'' . $post_data['lrc_data'] . '\')');
         if ($insert_query) {
             msg('数据插入成功');
         } else {
             msg('数据插入失败<br />' . mysql_errno() . ' ' . mysql_error());
         }
     } else {
         echo '<form action="" method="post"><p><label>歌&nbsp;&nbsp;&nbsp;&nbsp;名:<input type="text" name="name" /></p><p><label>歌&nbsp;&nbsp;&nbsp;&nbsp;手:<input type="text" name="singer" /></p><p><label>下载地址:<input type="text" name="url" value="http://" /></p><p><a href="http://tool.liujiantao.me/upload/" target="_blank">歌曲上传</a></p><p>显示 lrc 歌词: <label><input type="radio" name="lrc" value="1" />是</label>&nbsp;&nbsp;<label><input type="radio" name="lrc" value="0" checked="checked" />否</label></p><p>lrc 歌词(可选):<br /><textarea name="lrc_data">' . htmlspecialchars($select_query['lrc_data']) . '</textarea></p><p><input type="submit" name="submit" value="确定" /><a href="' . $_SERVER['PHP_SELF'] . '">取消</a></p></form>';
     }
 } else {
     echo '<form action="?action=search" method="post"><p><input name="search" type="text" /></p><p><input type="submit" value="搜索" /></p></form>';
     $all_list = get_music();
     echo '<ol>';
     foreach ($all_list as $value) {
         echo '<li>' . $value['name'] . ' - ' . $value['singer'] . '&nbsp;<a href="' . $_SERVER['PHP_SELF'] . '?action=edit&id=' . $value['id'] . '">编辑</a>&nbsp;<a href="' . $_SERVER['PHP_SELF'] . '?action=del&id=' . $value['id'] . '">删除</a></li>';
开发者ID:Jonham,项目名称:TT-Get-Lrc,代码行数:31,代码来源:list.php

示例10: m_get_report_post_func

function m_get_report_post_func()
{
    global $template, $auth, $user;
    $posts = array();
    foreach ($template->_tpldata['postrow'] as $postinfo) {
        $posts[] = $postinfo['POST_ID'];
    }
    $posts = get_post_data($posts);
    $post_list = array();
    foreach ($template->_tpldata['postrow'] as $postinfo) {
        $post = $posts[$postinfo['POST_ID']];
        if (empty($post['forum_id'])) {
            $user->setup('viewforum');
            $post['forum_id'] = 0;
            $post['forum_name'] = $user->lang['ANNOUNCEMENTS'];
        }
        $post_list[] = new xmlrpcval(array('forum_id' => new xmlrpcval($post['forum_id']), 'forum_name' => new xmlrpcval(basic_clean($post['forum_name']), 'base64'), 'topic_id' => new xmlrpcval($post['topic_id']), 'topic_title' => new xmlrpcval(basic_clean($post['topic_title']), 'base64'), 'post_id' => new xmlrpcval($post['post_id']), 'post_title' => new xmlrpcval(basic_clean($post['post_subject']), 'base64'), 'post_author_name' => new xmlrpcval(basic_clean($post['username']), 'base64'), 'icon_url' => new xmlrpcval(get_user_avatar_url($post['user_avatar'], $post['user_avatar_type'])), 'post_time' => new xmlrpcval(mobiquo_iso8601_encode($post['post_time']), 'dateTime.iso8601'), 'short_content' => new xmlrpcval(process_short_content($post['post_text']), 'base64'), 'can_delete' => new xmlrpcval($auth->acl_get('m_delete', $forum_id), 'boolean')), 'struct');
    }
    $response = new xmlrpcval(array('total_report_num' => new xmlrpcval($template->_rootref['TOTAL'], 'int'), 'reports' => new xmlrpcval($post_list, 'array')), 'struct');
    return new xmlrpcresp($response);
}
开发者ID:danielgospodinow,项目名称:GamingZone,代码行数:21,代码来源:moderation.php

示例11: disapprove_post

/**
* Disapprove Post/Topic
*/
function disapprove_post($post_id_list, $mode)
{
    global $_CLASS, $_CORE_CONFIG, $config;
    $forum_id = request_var('f', 0);
    if (!check_ids($post_id_list, FORUMS_POSTS_TABLE, 'post_id', 'm_approve')) {
        trigger_error('NOT_AUTHORIZED');
    }
    $redirect = request_var('redirect', $_CLASS['core_user']->data['session_page']);
    $reason = request_var('reason', '', true);
    $reason_id = request_var('reason_id', 0);
    $success_msg = $additional_msg = '';
    $s_hidden_fields = build_hidden_fields(array('i' => 'queue', 'f' => $forum_id, 'mode' => $mode, 'post_id_list' => $post_id_list, 'mode' => 'disapprove', 'redirect' => $redirect));
    $notify_poster = isset($_REQUEST['notify_poster']);
    $disapprove_reason = '';
    if ($reason_id) {
        $sql = 'SELECT reason_title, reason_description
			FROM ' . FORUMS_REPORTS_REASONS_TABLE . " \n\t\t\tWHERE reason_id = {$reason_id}";
        $result = $_CLASS['core_db']->query($sql);
        $row = $_CLASS['core_db']->fetch_row_assoc($result);
        $_CLASS['core_db']->free_result($result);
        if (!$row || !$reason && $row['reason_name'] === 'other') {
            $additional_msg = $_CLASS['core_user']->lang['NO_REASON_DISAPPROVAL'];
            unset($_POST['confirm']);
        } else {
            $disapprove_reason = $row['reason_title'] != 'other' ? isset($_CLASS['core_user']->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])]) ? $_CLASS['core_user']->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])] : $row['reason_description'] : '';
            $disapprove_reason .= $reason ? "\n\n" . $reason : '';
            unset($reason);
        }
    }
    require_once SITE_FILE_ROOT . 'includes/forums/functions_display.php';
    $reason = display_reasons($reason_id);
    $_CLASS['core_template']->assign_array(array('S_NOTIFY_POSTER' => true, 'S_APPROVE' => false, 'REASON' => $reason, 'ADDITIONAL_MSG' => $additional_msg));
    if (display_confirmation($_CLASS['core_user']->get_lang('DISAPPROVE_POST' . (sizeof($post_id_list) == 1 ? '' : 'S')), $s_hidden_fields, 'modules/forums/mcp_approve.html')) {
        $post_info = get_post_data($post_id_list, 'm_approve');
        // If Topic -> forum_topics_real -= 1
        // If Post -> topic_replies_real -= 1
        $forum_topics_real = 0;
        $topic_replies_real_sql = $post_disapprove_sql = $topic_id_list = array();
        foreach ($post_info as $post_id => $post_data) {
            $topic_id_list[$post_data['topic_id']] = 1;
            // Topic or Post. ;)
            if ($post_data['topic_first_post_id'] == $post_id && $post_data['topic_last_post_id'] == $post_id) {
                if ($post_data['forum_id']) {
                    $forum_topics_real++;
                }
            } else {
                if (!isset($topic_replies_real_sql[$post_data['topic_id']])) {
                    $topic_replies_real_sql[$post_data['topic_id']] = 1;
                } else {
                    $topic_replies_real_sql[$post_data['topic_id']]++;
                }
            }
            $post_disapprove_sql[] = $post_id;
        }
        if ($forum_topics_real) {
            $sql = 'UPDATE ' . FORUMS_FORUMS_TABLE . "\n\t\t\t\tSET forum_topics_real = forum_topics_real - {$forum_topics_real}\n\t\t\t\tWHERE forum_id = {$forum_id}";
            $_CLASS['core_db']->query($sql);
        }
        if (!empty($topic_replies_real_sql)) {
            foreach ($topic_replies_real_sql as $topic_id => $num_replies) {
                $sql = 'UPDATE ' . FORUMS_TOPICS_TABLE . "\n\t\t\t\t\tSET topic_replies_real = topic_replies_real - {$num_replies}\n\t\t\t\t\tWHERE topic_id = {$topic_id}";
                $_CLASS['core_db']->query($sql);
            }
        }
        if (sizeof($post_disapprove_sql)) {
            if (!function_exists('delete_posts')) {
                require_once SITE_FILE_ROOT . 'includes/forums/functions_admin.php';
            }
            // We do not check for permissions here, because the moderator allowed approval/disapproval should be allowed to delete the disapproved posts
            delete_posts('post_id', $post_disapprove_sql);
        }
        unset($post_disapprove_sql, $topic_replies_real_sql);
        update_post_information('topic', array_keys($topic_id_list));
        update_post_information('forum', $forum_id);
        unset($topic_id_list);
        // Notify Poster?
        if ($notify_poster) {
            require_once SITE_FILE_ROOT . 'includes/mailer.php';
            $mailer = new core_mailer();
            foreach ($post_info as $post_id => $post_data) {
                if ($post_data['poster_id'] == ANONYMOUS) {
                    continue;
                }
                $post_data['post_subject'] = censor_text($post_data['post_subject'], true);
                $post_data['topic_title'] = censor_text($post_data['topic_title'], true);
                if ($post_data['post_id'] == $post_data['topic_first_post_id'] && $post_data['post_id'] == $post_data['topic_last_post_id']) {
                    $email_template = 'topic_disapproved.txt';
                    $subject = 'Topic Disapproved - ' . $post_data['topic_title'];
                } else {
                    $email_template = 'post_disapproved.txt';
                    $subject = 'Post Disapproved - ' . $post_data['post_subject'];
                }
                $mailer->to($post_data['user_email'], $post_data['username']);
                //$mailer->reply_to($_CORE_CONFIG['email']['site_email']);
                $mailer->subject($subject);
                //$messenger->im($post_data['user_jabber'], $post_data['username']);
                $_CLASS['core_template']->assign_array(array('SITENAME' => $_CORE_CONFIG['global']['site_name'], 'USERNAME' => $post_data['username'], 'REASON' => stripslashes($disapprove_reason), 'POST_SUBJECT' => $post_data['post_subject'], 'TOPIC_TITLE' => $post_data['topic_title']));
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:101,代码来源:mcp_queue.php

示例12: mcp_delete_post

function mcp_delete_post($post_ids)
{
    global $_CLASS;
    if (!check_ids($post_ids, FORUMS_POSTS_TABLE, 'post_id', 'm_delete')) {
        return;
    }
    $redirect = get_variable('redirect', 'POST', $_CLASS['core_user']->data['session_url']);
    $hidden_fields = generate_hidden_fields(array('post_id_list' => $post_ids, 'mode' => 'delete_post', 'redirect' => $redirect));
    $success_msg = '';
    $message = $_CLASS['core_user']->get_lang(count($post_ids) === 1 ? 'DELETE_POST' : 'DELETE_POSTS');
    if (display_confirmation($message, $hidden_fields)) {
        // Count the number of topics that are affected
        // I did not use COUNT(DISTINCT ...) because I remember having problems
        // with it on older versions of MySQL -- Ashe
        $sql = 'SELECT DISTINCT topic_id
			FROM ' . FORUMS_POSTS_TABLE . '
			WHERE post_id IN (' . implode(', ', $post_ids) . ')';
        $result = $_CLASS['core_db']->query($sql);
        $topic_id_list = array();
        while ($row = $_CLASS['core_db']->fetch_row_assoc($result)) {
            $topic_id_list[] = $row['topic_id'];
        }
        $_CLASS['core_db']->free_result($result);
        $affected_topics = count($topic_id_list);
        $post_data = get_post_data($post_ids);
        foreach ($post_data as $id => $row) {
            add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_DELETE_POST', $row['post_subject']);
        }
        unset($post_data);
        // Now delete the posts, topics and forums are automatically resync'ed
        delete_posts('post_id', $post_ids);
        $sql = 'SELECT COUNT(topic_id) AS topics_left
			FROM ' . FORUMS_TOPICS_TABLE . '
			WHERE topic_id IN (' . implode(', ', $topic_id_list) . ')';
        $result = $_CLASS['core_db']->query($sql);
        $row = $_CLASS['core_db']->fetch_row_assoc($result);
        $_CLASS['core_db']->free_result($result);
        $deleted_topics = $row['topics_left'] ? $affected_topics - $row['topics_left'] : $affected_topics;
        $topic_id = request_var('t', 0);
        // Return links
        $return_link = array();
        if ($affected_topics === 1 && !$deleted_topics && $topic_id) {
            $return_link[] = sprintf($_CLASS['core_user']->lang['RETURN_TOPIC'], '<a href="' . generate_link("forums&amp;file=viewtopic&amp;f={$forum_id}&amp;t={$topic_id}") . '">', '</a>');
        }
        $return_link[] = sprintf($_CLASS['core_user']->lang['RETURN_FORUM'], '<a href="' . generate_link('forums&amp;file=viewforum&amp;f=' . $forum_id) . '">', '</a>');
        if (count($post_ids) === 1) {
            if ($deleted_topics) {
                // We deleted the only post of a topic, which in turn has
                // been removed from the database
                $success_msg = $_CLASS['core_user']->lang['TOPIC_DELETED_SUCCESS'];
            } else {
                $success_msg = $_CLASS['core_user']->lang['POST_DELETED_SUCCESS'];
            }
        } else {
            if ($deleted_topics) {
                // Some of topics disappeared
                $success_msg = $_CLASS['core_user']->lang['POSTS_DELETED_SUCCESS'] . '<br /><br />' . $_CLASS['core_user']->lang['EMPTY_TOPICS_REMOVED_WARNING'];
            } else {
                $success_msg = $_CLASS['core_user']->lang['POSTS_DELETED_SUCCESS'];
            }
        }
    }
    $redirect = generate_link('forums');
    if (!$success_msg) {
        redirect($redirect);
    } else {
        $_CLASS['core_display']->meta_refresh(3, $redirect);
        trigger_error($success_msg . '<br /><br />' . sprintf($_CLASS['core_user']->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>') . '<br /><br />' . implode('<br /><br />', $return_link));
    }
}
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:70,代码来源:mcp_main.php

示例13: mcp_post_details

function mcp_post_details($id, $mode, $action, $url)
{
    global $config, $_CLASS;
    $_CLASS['core_user']->add_lang('posting');
    $_CLASS['core_template']->assign(array('L_POST_DETAILS' => $_CLASS['core_user']->lang['POST_DETAILS'], 'L_POST_SUBJECT' => $_CLASS['core_user']->lang['POST_SUBJECT'], 'L_POSTER' => $_CLASS['core_user']->lang['POSTER'], 'L_READ_PROFILE' => $_CLASS['core_user']->lang['READ_PROFILE'], 'L_READ_USERNOTES' => $_CLASS['core_user']->lang['READ_USERNOTES'], 'L_READ_WARNINGS' => $_CLASS['core_user']->lang['READ_WARNINGS'], 'L_THIS_POST_IP' => $_CLASS['core_user']->lang['THIS_POST_IP'], 'L_POSTED' => $_CLASS['core_user']->lang['POSTED'], 'L_PREVIEW' => $_CLASS['core_user']->lang['PREVIEW'], 'L_APPROVE' => $_CLASS['core_user']->lang['APPROVE'], 'L_DISAPPROVE' => $_CLASS['core_user']->lang['DISAPPROVE'], 'L_REPORTS' => $_CLASS['core_user']->lang['REPORTS'], 'L_ADD_FEEDBACK' => $_CLASS['core_user']->lang['ADD_FEEDBACK'], 'L_FEEDBACK' => $_CLASS['core_user']->lang['FEEDBACK'], 'L_DELETE_MARKED' => $_CLASS['core_user']->lang['DELETE_MARKED'], 'L_DELETE_ALL' => $_CLASS['core_user']->lang['DELETE_ALL'], 'L_REPORTER' => $_CLASS['core_user']->lang['REPORTER'], 'L_MORE_INFO' => $_CLASS['core_user']->lang['MORE_INFO'], 'L_MOD_OPTIONS' => $_CLASS['core_user']->lang['MOD_OPTIONS'], 'L_CHANGE_POSTER' => $_CLASS['core_user']->lang['CHANGE_POSTER'], 'L_CONFIRM' => $_CLASS['core_user']->lang['CONFIRM'], 'L_SEARCH' => $_CLASS['core_user']->lang['SEARCH'], 'L_MOD_OPTIONS' => $_CLASS['core_user']->lang['MOD_OPTIONS'], 'L_UNLOCK_POST' => $_CLASS['core_user']->lang['UNLOCK_POST'], 'L_UNLOCK_POST_EXPLAIN' => $_CLASS['core_user']->lang['UNLOCK_POST_EXPLAIN'], 'L_LOCK_POST' => $_CLASS['core_user']->lang['LOCK_POST'], 'L_LOCK_POST_EXPLAIN' => $_CLASS['core_user']->lang['LOCK_POST_EXPLAIN'], 'L_DELETE_POST' => $_CLASS['core_user']->lang['DELETE_POST'], 'L_SUBMIT' => $_CLASS['core_user']->lang['SUBMIT'], 'L_IP_INFO' => $_CLASS['core_user']->lang['IP_INFO'], 'L_OTHER_USERS' => $_CLASS['core_user']->lang['OTHER_USERS'], 'L_NO_MATCHES_FOUND' => $_CLASS['core_user']->lang['NO_MATCHES_FOUND'], 'L_OTHER_IPS' => $_CLASS['core_user']->lang['OTHER_IPS'], 'L_LOOKUP_ALL' => $_CLASS['core_user']->lang['LOOKUP_ALL'], 'L_JUMP_TO' => $_CLASS['core_user']->lang['JUMP_TO'], 'L_GO' => $_CLASS['core_user']->lang['GO'], 'L_LOOKUP_IP' => $_CLASS['core_user']->lang['LOOKUP_IP']));
    $post_id = request_var('p', 0);
    $start = request_var('start', 0);
    // Get post data
    $post_info = get_post_data(array($post_id));
    if (!sizeof($post_info)) {
        trigger_error($_CLASS['core_user']->lang['POST_NOT_EXIST']);
    }
    $post_info = $post_info[$post_id];
    switch ($action) {
        case 'chgposter_search':
            $username = request_var('username', '');
            if ($username) {
                $users_ary = array();
                if (strpos($username, '*') === false) {
                    $username = "*{$username}*";
                }
                $username = str_replace('*', '%', str_replace('%', '\\%', $username));
                $sql = 'SELECT user_id, username
					FROM ' . USERS_TABLE . "\r\n\t\t\t\t\tWHERE username LIKE '" . $_CLASS['core_db']->sql_escape($username) . "'\r\n\t\t\t\t\t\tAND user_type NOT IN (" . USER_INACTIVE . ', ' . USER_IGNORE . ')
						AND user_id <> ' . $post_info['user_id'];
                $result = $_CLASS['core_db']->sql_query($sql);
                while ($row = $_CLASS['core_db']->sql_fetchrow($result)) {
                    $users_ary[strtolower($row['username'])] = $row;
                }
                $user_select = '';
                ksort($users_ary);
                foreach ($users_ary as $row) {
                    $user_select .= '<option value="' . $row['user_id'] . '">' . $row['username'] . "</option>\n";
                }
            }
            if (!$user_select) {
                $_CLASS['core_template']->assign('MESSAGE', $_CLASS['core_user']->lang['NO_MATCHES_FOUND']);
            }
            $_CLASS['core_template']->assign(array('S_USER_SELECT' => $user_select, 'SEARCH_USERNAME' => request_var('username', '')));
            break;
        case 'chgposter':
            $new_user = request_var('u', 0);
            if ($new_user && $_CLASS['auth']->acl_get('m_', $post_info['forum_id']) && $new_user != $post_info['user_id']) {
                $sql = 'UPDATE ' . POSTS_TABLE . "\r\n\t\t\t\t\tSET poster_id = {$new_user}\r\n\t\t\t\t\tWHERE post_id = {$post_id}";
                $_CLASS['core_db']->sql_query($sql);
                if ($post_info['topic_last_post_id'] == $post_info['post_id'] || $post_info['forum_last_post_id'] == $post_info['post_id']) {
                    sync('topic', 'topic_id', $post_info['topic_id'], false, false);
                    sync('forum', 'forum_id', $post_info['forum_id'], false, false);
                }
                // Renew post info
                $post_info = get_post_data(array($post_id));
                if (!sizeof($post_info)) {
                    trigger_error($_CLASS['core_user']->lang['POST_NOT_EXIST']);
                }
                $post_info = $post_info[$post_id];
            }
            break;
        case 'del_marked':
        case 'del_all':
        case 'add_feedback':
            $deletemark = $action == 'del_marked' ? true : false;
            $deleteall = $action == 'del_all' ? true : false;
            $marked = request_var('marknote', 0);
            $usernote = request_var('usernote', '');
            if (($deletemark || $deleteall) && $_CLASS['auth']->acl_get('a_clearlogs')) {
                $where_sql = '';
                if ($deletemark && $marked) {
                    $sql_in = array();
                    foreach ($marked as $mark) {
                        $sql_in[] = $mark;
                    }
                    $where_sql = ' AND log_id IN (' . implode(', ', $sql_in) . ')';
                    unset($sql_in);
                }
                $sql = 'DELETE FROM ' . LOG_TABLE . '
					WHERE log_type = ' . LOG_USERS . " \r\n\t\t\t\t\t\t{$where_sql}";
                $_CLASS['core_db']->sql_query($sql);
                add_log('admin', 'LOG_USERS_CLEAR');
                $msg = $deletemark ? 'MARKED_DELETED' : 'ALL_DELETED';
                $redirect = generate_link("{$url}&amp;i={$id}&amp;mode=post_details");
                $_CLASS['core_display']->meta_refresh(2, $redirect);
                trigger_error($_CLASS['core_user']->lang[$msg] . '<br /><br />' . sprintf($_CLASS['core_user']->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'));
            }
            if ($usernote && $action == 'add_feedback') {
                add_log('admin', 'LOG_USER_FEEDBACK', $post_info['username']);
                add_log('user', $post_info['user_id'], 'LOG_USER_GENERAL', $usernote);
                $redirect = generate_link("{$url}&amp;i={$id}&amp;mode=post_details");
                $_CLASS['core_display']->meta_refresh(2, $redirect);
                trigger_error($_CLASS['core_user']->lang['USER_FEEDBACK_ADDED'] . '<br /><br />' . sprintf($_CLASS['core_user']->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'));
            }
            break;
        default:
    }
    // Set some vars
    $users_ary = array();
    $poster = $post_info['user_colour'] ? '<span style="color:#' . $post_info['user_colour'] . '">' . $post_info['username'] . '</span>' : $post_info['username'];
    // Process message, leave it uncensored
    $message = $post_info['post_text'];
    if ($post_info['bbcode_bitfield']) {
        global $site_file_root;
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:101,代码来源:mcp_post.php

示例14: file_get_contents

 if (isset($_GET['a']) && !empty($_GET['a']) && $temp_var['author'] != $_GET['a']) {
     continue;
 }
 if (isset($_GET['s']) && !empty($_GET['s']) && $temp_var['status'] != $_GET['s']) {
     continue;
 }
 if (isset($_GET['t']) && !empty($_GET['t']) && !in_array($_GET['t'], $temp_var['tags_array'])) {
     continue;
 }
 if (isset($_GET['q']) && strlen($_GET['q']) > 2 && !preg_match('/[!?\'$&\\/()=%*:;,.@\\"#~|_+{}<>]/i', $_GET['q'])) {
     $post_content = file_get_contents(MN_ROOT . $dir['posts'] . 'post_' . $temp_var['post_id'] . '.php');
     if (stripos($post_content, $_GET['q']) === false) {
         continue;
     }
 }
 $var = get_post_data($temp_var['post_id']);
 $approve_button = $auth == 1 && $var['status'] == 4 ? ' &middot; <form action="./mn-posts.php" method="post" id="approve_' . $var['id'] . '"><span class="simurl" onclick="$(\'form:#approve_' . $var['id'] . '\').submit();">' . $lang['uni_approve'] . '</span><input type="hidden" name="id" value="' . $var['id'] . '" /><input type="hidden" name="action" value="approve" /></form>' : '';
 $comments_count = get_comments_count($var['id']);
 $comments_s = $var['comments'] == 1 && $conf['comments'] ? '' : ' off';
 $comments = $comments_count > 0 ? '<!-- ' . $comments_count . ' --><a href="./mn-comments.php?p=' . $var['id'] . '" class="comment-link' . $comments_s . '">' . $comments_count . '</a>' : '<!-- 0 --><span class="trivial' . $comments_s . '">0</span>';
 $author = !empty($users[$var['author']]) ? $users[$var['author']] : '<!-- anonym --><span class="trivial">' . $lang['posts_author_anonym'] . '</span>';
 $status = $var['timestamp'] > mn_time() && ($var['status'] == 1 || $var['status'] == 2) ? '<span class="status_6">' . $lang['posts_future_post'] . '</span>' : '<span class="status_' . $var['status'] . '">' . $lang['posts_status_name_' . $var['status']] . '</span>';
 $datetime = $var['timestamp'] == 9999999999 || empty($var['timestamp']) ? '<span class="trivial">-</span>' : date('d.m.Y', $var['timestamp']) . '<br /><span class="trivial">' . date('H:i', $var['timestamp']) . '</span>';
 $var['title'] = mb_strlen($var['title']) > 38 ? '<span title="' . $var['title'] . '">' . mb_substr($var['title'], 0, 36, 'utf-8') . '&hellip;</span>' : $var['title'];
 if ($var['cat'] == '-1') {
     $category_name = '<!-- uncategorized --><span class="trivial">' . $lang['cats_uncategorized'] . '</span>';
 } elseif (empty($categories[$var['cat']])) {
     $category_name = '<!-- unknown --><span class="trivial">' . $lang['cats_unknown_category'] . '</span>';
 } else {
     $category_name = $categories[$var['cat']];
 }
开发者ID:deanbrabec,项目名称:news_slider,代码行数:31,代码来源:mn-posts.php

示例15: pam_auth_hmac

/**
 * Secure authentication through headers and HMAC.
 */
function pam_auth_hmac($credentials = NULL)
{
    global $CONFIG;
    $api_header = get_and_validate_api_headers();
    // Get api header
    $api_user = get_api_user($CONFIG->site_id, $api_header->api_key);
    // Pull API user details
    if ($api_user) {
        // Get the secret key
        $secret_key = $api_user->secret;
        // Serialise parameters
        $encoded_params = array();
        foreach ($api_header->get_variables as $k => $v) {
            $encoded_params[] = urlencode($k) . '=' . urlencode($v);
        }
        $params = implode('&', $encoded_params);
        // Validate HMAC
        $hmac = calculate_hmac($api_header->hmac_algo, $api_header->time, $api_header->api_key, $secret_key, $params, $api_header->method == 'POST' ? $api_header->posthash : "");
        if (strcmp($api_header->hmac, $hmac) == 0 && $api_header->hmac && $hmac) {
            // Now make sure this is not a replay
            if (!cache_hmac_check_replay($hmac)) {
                // Validate post data
                if ($api_header->method == "POST") {
                    $postdata = get_post_data();
                    $calculated_posthash = calculate_posthash($postdata, $api_header->posthash_algo);
                    if (strcmp($api_header->posthash, $calculated_posthash) != 0) {
                        throw new SecurityException(sprintf(elgg_echo('SecurityException:InvalidPostHash'), $calculated_posthash, $api_header->posthash));
                    }
                }
                // If we've passed all the checks so far then we can be reasonably certain that the request is authentic, so return this fact to the PAM engine.
                return true;
            } else {
                throw new SecurityException(elgg_echo('SecurityException:DupePacket'));
            }
        } else {
            throw new SecurityException("HMAC is invalid.  {$api_header->hmac} != [calc]{$hmac} = {$api_header->hmac_algo}(**SECRET KEY**, time:{$api_header->time}, apikey:{$api_header->api_key}, get_vars:{$params}" . ($api_header->method == "POST" ? "posthash:{$api_header->posthash}}" : ")"));
        }
    } else {
        throw new SecurityException(elgg_echo('SecurityException:InvalidAPIKey'), ErrorResult::$RESULT_FAIL_APIKEY_INVALID);
    }
    return false;
}
开发者ID:eokyere,项目名称:elgg,代码行数:45,代码来源:api.php


注:本文中的get_post_data函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。