Пример #1
0
function build_child($oldID)
{
    // Refer to the global array defined at the top of this script
    global $exclude, $depth, $db, $tprefix, $editid, $tld;
    $tempTree = '';
    $child_sql = "SELECT * FROM `{$tprefix}" . "_category` WHERE parent_id=" . $oldID;
    //echo $child_sql ;
    $child_query = $db->query($child_sql);
    while ($child = $child_query->fetch_array()) {
        if ($child['cat_id'] != $child['parent_id']) {
            for ($c = 0; $c < $depth; $c++) {
                $tempTree .= "&nbsp;";
            }
            $tempTree .= "- " . '<input type="checkbox" name="category[]" value="' . $child['cat_id'] . '" ' . check_category($editid, $child['cat_id']) . ' />' . $child['cat_label'] . '<a href="' . $tld . '/manage/settings/category-form.php?parent_id=' . $child['cat_id'] . '&parent_name=' . $child['cat_label'] . '">[+]</a><br>';
            $depth++;
            // Incriment depth b/c we're building this child's child tree  (complicated yet???)
            $tempTree .= build_child($child['cat_id']);
            // Add to the temporary local tree
            $depth--;
            // Decrement depth b/c we're done building the child's child tree.
            ARRAY_PUSH($exclude, $child['cat_id']);
            // Add the item to the exclusion list
        }
    }
    return $tempTree;
    // Return the entire child tree
}
 /**
  * 文档新增页面初始化
  * @author huajie <*****@*****.**>
  */
 public function add()
 {
     //获取左边菜单
     $this->getMenu();
     $cate_id = I('get.cate_id', 0);
     $model_id = I('get.model_id', 0);
     $group_id = I('get.group_id', '');
     empty($cate_id) && $this->error('参数不能为空!');
     empty($model_id) && $this->error('该分类未绑定模型!');
     //检查该分类是否允许发布
     $allow_publish = check_category($cate_id);
     !$allow_publish && $this->error('该分类不允许发布内容!');
     // 获取当前的模型信息
     $model = get_document_model($model_id);
     //处理结果
     $info['pid'] = $_GET['pid'] ? $_GET['pid'] : 0;
     $info['model_id'] = $model_id;
     $info['category_id'] = $cate_id;
     $info['group_id'] = $group_id;
     if ($info['pid']) {
         // 获取上级文档
         $article = D('Document')->field('id,title,type')->find($info['pid']);
         $this->assign('article', $article);
     }
     //获取表单字段排序
     $fields = get_model_attribute($model['id']);
     $this->assign('info', $info);
     $this->assign('fields', $fields);
     $this->assign('type_list', get_type_bycate($cate_id));
     $this->assign('model', $model);
     $this->meta_title = '新增' . $model['title'];
     $this->display();
 }
Пример #3
0
            $forum_name = get_forumname($POST_f);
            $topic_name = get_topicname($POST_t);
            opmain_body("Move Topic " . $forum_name . " > " . $topic_name . "");
            echo "<TABLE width=\"100%\" cellspacing=\"1\" cellpadding=\"5\" align=\"center\">\n\t<form action=\"index.php?act=mod\" method=\"post\" enctype=\"multipart/form-data\" name=\"Move_Topic_Form\">\n\t<input type=\"hidden\" name=\"code\" value=\"08\">\n\t<input type=\"hidden\" name=\"f\" value=\"{$POST_f}\">\n\t<input type=\"hidden\" name=\"t\" value=\"{$POST_t}\">\n\t<TR class=\"topic_title5\">\n\t\t<TD colspan=\"2\" height=\"27\">\n\t\t\t<div class=\"title_face\">Please select the destination forum and method of moving</div>\n\t\t</TD>\n\t</TR>\n\t<TR class=\"topic_title6\">\n\t\t<TD width=\"30%\">\n\t\t\t<div class=\"title_face4\"><b>Move this topic from New Forum to</b></div>\n\t\t</TD>\n\t\t<TD width=\"70%\">\n\t\t\t<select name=\"select_forum\" class=\"selectmenu\">\n";
            $query = "SELECT memory_value1,memory_value3 FROM {$CONFIG_sql_cpdbname}.memory WHERE memory_object =\"forum_category\" ORDER by memory_value2 ASC";
            $sql->result = $sql->execute_query($query, 'forum_manage.php');
            $sql->total_query++;
            if ($sql->count_rows()) {
                while ($row = $sql->fetch_row()) {
                    $query = "SELECT forum_id,forum_title FROM {$CONFIG_sql_cpdbname}.forum WHERE category_id=\"" . $row[memory_value1] . "\" ORDER by forum_id ASC";
                    $sql->result2 = $sql->execute_query($query, 'forum_manage.php');
                    echo "\t\t\t\t<optgroup label=\"{$row['memory_value3']}\"></optgroup>\n";
                    if ($sql->count_rows($sql->result2)) {
                        while ($row2 = $sql->fetch_row($sql->result2)) {
                            echo "\t\t\t\t<option value=\"{$row2['forum_id']}\">&nbsp;&nbsp;&#0124;-- {$row2['forum_title']}</option>\n";
                        }
                    }
                }
            }
            echo "\t\t\t</select>\n\t\t</TD>\n\t</TR>\n\t<TR class=\"topic_title5\" align=\"center\">\n\t\t<TD colspan=\"2\">\n\t\t\t<input type=\"submit\" name=\"Submit\" value=\"Move�this�topic\" class=\"textinput\">\n\t\t</TD>\n\t</TR>\n\t</form>\n</TABLE>\n";
            clmain_body();
        }
        if ($POST_code == '08' && checkprivilege_action($CP[login_id], g_move_topics) && check_category($POST_f) && check_category($POST_select_forum) && $POST_t) {
            $sql->execute_query("UPDATE {$CONFIG_sql_cpdbname}.board_reply SET forum_id=\"" . mysql_res($POST_select_forum) . "\" WHERE topic_id =\"" . mysql_res($POST_t) . "\" AND forum_id = \"" . mysql_res($POST_f) . "\" ", 'moderate.php');
            $sql->execute_query("UPDATE {$CONFIG_sql_cpdbname}.board_topic SET forum_id=\"" . mysql_res($POST_select_forum) . "\" WHERE topic_id =\"" . mysql_res($POST_t) . "\" AND forum_id = \"" . mysql_res($POST_f) . "\" ", 'moderate.php');
            header_location("index.php?showtopic={$POST_t}");
        }
    }
} else {
    redir("index.php?act=idx", "{$lang['No_privilege']}", 3);
}
Пример #4
0
                                    $start_topics_selected = "";
                                }
                                echo "\t<TR align=\"center\" class=\"topic_title6\">\n\t\t<TD>{$grow['1']}</TD>\n\t\t<TD><input name=\"show_forum_" . $grow[0] . "\" type=\"checkbox\" value=\"1\"" . $show_forum_selected . "></TD>\n\t\t<TD><input name=\"read_topics_" . $grow[0] . "\" type=\"checkbox\" value=\"1\"" . $read_topics_selected . "></TD>\n\t\t<TD><input name=\"reply_topics_" . $grow[0] . "\" type=\"checkbox\" value=\"1\"" . $reply_topics_selected . "></TD>\n\t\t<TD><input name=\"start_topics_" . $grow[0] . "\" type=\"checkbox\" value=\"1\"" . $start_topics_selected . "></TD>\n\t</TR>\n";
                            }
                            echo "</TABLE>\n";
                        }
                        echo "<TABLE width=\"100%\" cellspacing=\"1\" cellpadding=\"5\" align=\"center\">\n\t<TR class=\"topic_title5\">\n\t\t<TD width=\"100%\" align=\"center\">\n\t\t\t<input type=\"submit\" name=\"Submit\" value=\"Edit�this�forum\" class=\"textinput\">\n\t\t\t<input type=\"reset\" name=\"Reset\" value=\"Restore\" class=\"textinput\">\n\t\t</TD>\n\t</TR>\n</TABLE>\n\t\t</TD>\n\t</TR>\n\t</form>\n</TABLE>\n";
                        clmain_body();
                    } else {
                        if ($GET_code == "dropcategory" && $GET_c) {
                            $category_name = get_categoryname($GET_c);
                            opmain_body("Delete Category");
                            echo "<TABLE width=\"100%\" cellspacing=\"1\" cellpadding=\"5\" align=\"center\">\n\t<TBODY>\n\t<form action=\"index.php?act=forum_manage&manage=dropcategory\" method=\"post\" enctype=\"multipart/form-data\" name=\"Category_Form\">\n\t<input type=\"hidden\" name=\"c\" value=\"{$GET_c}\">\n\t\t<TR class=\"topic_title5\">\n\t\t\t<TD height=\"27\" colspan=\"2\"><div class=\"title_face\">{$category_name}</div></TD>\n\t\t</TR>\n\t\t<TR class=\"topic_title6\">\n\t\t\t<TD width=\"30%\"><div class=\"title_face4\"><B>Category to remove:</B></div></TD>\n\t\t\t<TD width=\"70%\"><B>{$category_name}</B></TD>\n\t\t</TR>\n\t\t\t<TR class=\"topic_title5\">\n\t\t\t\t<TD width=\"100%\" colspan=\"2\" align=\"center\">\n\t\t\t\t\t<input type=\"submit\" name=\"Submit\" value=\"Delete�this�category\" class=\"textinput\">\n\t\t\t\t</TD>\n\t\t</TR>\n\t</form>\n\t</TBODY>\n</TABLE>\n";
                            clmain_body();
                        } else {
                            if ($GET_code == "dropforum" && $GET_f) {
                                $category_name = get_categoryname(check_category($GET_f));
                                $forum_name = get_forumname($GET_f);
                                opmain_body("Delete Forum");
                                echo "<TABLE width=\"100%\" cellspacing=\"1\" cellpadding=\"5\" align=\"center\">\n\t<TBODY>\n\t<form action=\"index.php?act=forum_manage&manage=dropforum\" method=\"post\" enctype=\"multipart/form-data\" name=\"Forum_Form\">\n\t<input type=\"hidden\" name=\"f\" value=\"{$GET_f}\">\n\t\t<TR class=\"topic_title5\">\n\t\t\t<TD height=\"27\" colspan=\"2\"><div class=\"title_face\">{$category_name} -> {$forum_name}</div></TD>\n\t\t</TR>\n\t\t<TR class=\"topic_title6\">\n\t\t\t<TD width=\"30%\"><div class=\"title_face4\"><B>Forum to remove:</B></div></TD>\n\t\t\t<TD width=\"70%\"><B>{$forum_name}</B></TD>\n\t\t</TR>\n\t\t\t<TR class=\"topic_title5\">\n\t\t\t\t<TD width=\"100%\" colspan=\"2\" align=\"center\">\n\t\t\t\t\t<input type=\"submit\" name=\"Submit\" value=\"Delete�this�forum\" class=\"textinput\">\n\t\t\t\t</TD>\n\t\t</TR>\n\t</form>\n\t</TBODY>\n</TABLE>\n";
                                clmain_body();
                            }
                        }
                    }
                }
            }
        }
    }
} else {
    redir("index.php?act=idx", "{$lang['No_privilege']}", 3);
}
Пример #5
0
// =========================================================================
// Project Lead by: Mysterious
// =========================================================================
-->
<?php 
if (!$SERVER['system_safe']) {
    exit;
}
$GET_showtopic = (int) $GET_showtopic;
if (checkprivilege_action($CP[login_id], g_view_board)) {
    $query = "SELECT forum_id,topic_name,topic_description,closed_mode,pinned_mode FROM {$CONFIG_sql_cpdbname}.board_topic WHERE topic_id =\"" . mysql_res($GET_showtopic) . "\"";
    $sql->result2 = $sql->execute_query($query, 'showtopic.php');
    $sql->total_query++;
    $row = $sql->fetch_row($sql->result2);
    $forum_id = $row[forum_id];
    if ($category_id = check_category($forum_id)) {
        $CP['g_id'] = checkprivilege($CP[login_id]);
        if (check_forum_perm($forum_id, $CP['g_id'], 'read_perm')) {
            if (!isset($GET_st)) {
                $GET_st = 0;
            }
            $GET_st = (int) $GET_st;
            $page = get_page($GET_st, $CONFIG_per_page);
            $query = "SELECT COUNT(*) FROM {$CONFIG_sql_cpdbname}.board_reply WHERE topic_id =\"" . mysql_res($GET_showtopic) . "\"";
            $sql->result = $sql->execute_query($query, 'showtopic.php');
            $sql->total_query++;
            $total = $sql->result();
            $query = "SELECT reply_id,reply_user_id,reply_emo,reply_date,reply_edit_date,reply_message,reply_ip,reply_edit_name,reply_upload\n\tFROM {$CONFIG_sql_cpdbname}.board_reply\n\tWHERE topic_id =\"" . mysql_res($GET_showtopic) . "\" ORDER by reply_id ASC LIMIT " . mysql_res($GET_st) . "," . mysql_res($CONFIG_per_page) . "";
            $sql->result = $sql->execute_query($query, 'showtopic.php');
            $sql->total_query++;
            $topic_name = $row["topic_name"];
Пример #6
0
function extra($mode = '', $styleit = 0, $classname = '', $idname = '')
{
    global $categorySEF, $subcatSEF, $articleSEF, $_ID, $_catID;
    if (empty($mode)) {
        $mode = retrieve('seftitle', 'extras', 'id', 1);
    }
    if (!_ADMIN) {
        $qwr = ' AND visible=\'YES\'';
    } else {
        $qwr = '';
    }
    $mode = strtolower($mode);
    $getExtra = retrieve('id', 'extras', 'seftitle', $mode);
    $subCat = retrieve('subcat', 'categories', 'id', $_catID);
    if (!empty($_ID)) {
        $getArt = $_ID;
    }
    if (!empty($subcatSEF)) {
        $catSEF = $subcatSEF;
    }
    $url = $categorySEF . (!empty($subcatSEF) ? '/' . $subcatSEF : '') . (!empty($articleSEF) ? '/' . $articleSEF : '');
    $sql = 'SELECT
			id,title,seftitle,text,category,extraid,page_extra,
			position,displaytitle,show_in_subcats,visible
		FROM ' . _PRE . 'articles' . '
		WHERE published = 1
			AND position = 2 ';
    $query = $sql . (!empty($getExtra) ? ' AND extraid = ' . $getExtra : ' AND extraid = 1');
    $query = $query . $qwr . ' ORDER BY artorder ASC,id ASC';
    $result = mysql_query($query) or die(mysql_error());
    while ($r = mysql_fetch_array($result)) {
        $category = $r['category'];
        $page = $r['page_extra'];
        switch (true) {
            case $category == 0 && $page < 1:
                $print = false;
                break;
            case $category == 0 && empty($_catID) && $page != '':
                $print = check_category($catSEF) != true ? true : false;
                break;
            case $category == $_catID || $category == $subCat && $r['show_in_subcats'] == 'YES':
                $print = true;
                break;
            case $category == -3 && $getArt == $page:
                $print = true;
                break;
            case $category == -3 && $_catID == 0 && $getArt != $page && $page == 0 && $categorySEF != '' && !in_array($categorySEF, explode(',', l('cat_listSEF'))) && substr($categorySEF, 0, 2) != l('paginator'):
                $print = true;
                break;
                // To show up on all pages only
            // To show up on all pages only
            case $category == -1 && $_catID == 0 && $getArt != $page && $page == 0:
                $print = true;
                break;
                // To show up on all categories and pages
            // To show up on all categories and pages
            case $category == -1:
                $print = true;
                break;
            default:
                $print = false;
        }
        if ($print == true) {
            if ($styleit == 1) {
                $container = '<div';
                $container .= !empty($classname) ? ' class="' . $classname . '"' : '';
                $container .= !empty($idname) ? ' id="' . $idname . '"' : '';
                $container .= '>';
                echo $container;
            }
            if ($r['displaytitle'] == 'YES') {
                echo '<h3>' . $r['title'] . '</h3>';
            }
            file_include($r['text'], 9999000);
            $visiblity = $r['visible'] == 'YES' ? '<a href="' . _SITE . '?action=process&amp;task=hide&amp;item=snews_articles&amp;id=' . $r['id'] . '&amp;back=' . $url . '">' . l('hide') . '</a>' : l('hidden') . ' ( <a href="' . _SITE . '?action=process&amp;task=show&amp;item=snews_articles&amp;id=' . $r['id'] . '&amp;back=' . $url . '">' . l('show') . '</a> )';
            echo _ADMIN ? '<p><a href="' . _SITE . '?action=admin_article&amp;id=' . $r['id'] . '" title="' . l('edit') . ' ' . $r['seftitle'] . '">
				' . l('edit') . '</a>' . ' ' . l('divider') . ' ' . $visiblity . '</p>' : '';
            if ($styleit == 1) {
                echo '</div>';
            }
        }
    }
}
Пример #7
0
// / /__/ _ \/ _ \/ __/ __/ _ \/ / / ___/ _ `/ _ \/ -_) / 
// \___/\___/_//_/\__/_/  \___/_/ /_/   \_,_/_//_/\__/_/ 
// =========================================================================
// Copyright (c) Stargames Control Panel - Licensed under GNU GPL.
// See LICENSE File
// =========================================================================
// Project Lead by: Mysterious
// =========================================================================
-->
<?php 
if (!$SERVER['system_safe']) {
    exit;
}
if (checkprivilege_action($CP[login_id], g_view_board)) {
    $GET_showforum = (int) $GET_showforum;
    if ($category_id = check_category($GET_showforum)) {
        $CP['g_id'] = checkprivilege($CP[login_id]);
        if (check_forum_perm($GET_showforum, $CP['g_id'], 'read_perm')) {
            if (!isset($GET_st)) {
                $GET_st = 0;
            }
            $GET_st = (int) $GET_st;
            $page = get_page($GET_st, $CONFIG_t_per_page);
            $query = "SELECT COUNT(*) FROM {$CONFIG_sql_cpdbname}.board_topic WHERE forum_id = \"" . mysql_res($GET_showforum) . "\" AND pinned_mode =\"0\"";
            $sql->result = $sql->execute_query($query, 'showforum.php');
            $sql->total_query++;
            $total = $sql->result();
            $query = "SELECT us.display_name,t.* FROM {$CONFIG_sql_cpdbname}.board_topic t\n\t\tLEFT JOIN {$CONFIG_sql_cpdbname}.user_profile us ON (us.user_id=t.topic_starter)\n\tWHERE t.forum_id = \"" . mysql_res($GET_showforum) . "\" AND t.pinned_mode =\"0\" ORDER by t.topic_last_action_date DESC LIMIT " . mysql_res($GET_st) . "," . mysql_res($CONFIG_t_per_page) . "";
            $sql->result = $sql->execute_query($query, 'showforum.php');
            $sql->total_query++;
            $query = "SELECT us.display_name,t.* FROM {$CONFIG_sql_cpdbname}.board_topic t\n\t\tLEFT JOIN {$CONFIG_sql_cpdbname}.user_profile us ON (us.user_id=t.topic_starter)\n\tWHERE t.forum_id = \"" . mysql_res($GET_showforum) . "\" AND t.pinned_mode =\"1\" ORDER by t.topic_last_action_date DESC";
Пример #8
0
                 }
                 $files_upload = upload_files($_FILES['attach']);
                 $flood_timer = $CP['time'] + $CONFIG_delay_post;
                 $POST_t_mes = checkstring($POST_t_mes, 1);
                 $POST_t_emo = (int) $POST_t_emo;
                 $sql->execute_query("UPDATE {$CONFIG_sql_cpdbname}.user_profile SET user_ranking=user_ranking+1,user_flood_protection=\"" . mysql_res($flood_timer) . "\" WHERE user_id = \"" . $CP['login_id'] . "\"", 'insert_topic.php');
                 $sql->execute_query("UPDATE {$CONFIG_sql_cpdbname}.board_topic SET pinned_mode=\"" . mysql_res($pinned_mode) . "\",closed_mode=\"" . mysql_res($closed_mode) . "\",topic_lastreply_name=\"" . $CP['login_id'] . "\",topic_replying=topic_replying+1,topic_last_action_date=\"" . $CP['time'] . "\" WHERE topic_id=\"" . mysql_res($POST_t) . "\"", 'insert_topic.php');
                 $sql->execute_query("INSERT INTO {$CONFIG_sql_cpdbname}.board_reply (topic_id,forum_id,reply_user_id,reply_emo,reply_message,reply_ip,reply_date,reply_upload) VALUES (\"" . mysql_res($POST_t) . "\",\"" . mysql_res($POST_f) . "\",\"" . $CP['login_id'] . "\",\"" . mysql_res($POST_t_emo) . "\",\"" . $POST_t_mes . "\",\"" . $CP['ip_address'] . "\",\"" . $CP['time'] . "\",\"" . mysql_res($files_upload['name']) . "\")", 'insert_topic.php');
             }
         }
         redir("index.php?showtopic={$POST_t}&view=getnewpost", "{$files_upload['error']}{$lang['Topic_insert']}", 3);
     } else {
         redir("index.php?act=forum", "{$lang['No_privilege']}", 3);
     }
 }
 if ($GET_code == 02 && check_category($POST_f) && length($POST_t_mes, 3)) {
     if (check_forum_perm($POST_f, $CP['g_id'], 'reply_perm')) {
         $query = "SELECT topic_name FROM {$CONFIG_sql_cpdbname}.board_topic WHERE topic_id =\"" . mysql_res($POST_t) . "\"";
         $sql->result = $sql->execute_query($query, 'insert_topic.php');
         $row = $sql->fetch_row();
         $topic_name = $row["topic_name"];
         $count1 = $sql->count_rows();
         $query = "SELECT reply_user_id FROM {$CONFIG_sql_cpdbname}.board_reply WHERE reply_id =\"" . mysql_res($POST_p) . "\"";
         $sql->result = $sql->execute_query($query, 'insert_topic.php');
         $row_check = $sql->fetch_row();
         $checkuserid = $row_check["reply_user_id"];
         if (!length($POST_t_mes, 3, $CONFIG_max_post_length)) {
             redir_back("Your messages are more than {$CONFIG_max_post_length} characters");
         } else {
             if ($count1 && ($checkuserid == $CP[login_id] || checkprivilege_action($CP[login_id], g_edit_posts)) && !empty($CP[login_id])) {
                 $query = "SELECT reply_id FROM {$CONFIG_sql_cpdbname}.board_reply WHERE topic_id = \"" . mysql_res($POST_t) . "\" ORDER by reply_id LIMIT 1";