⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ad_announce.php

📁 泛微协同办公系统标准版E-office V5.5的源代码内含泛微办公系统V5.5自动注册文件。
💻 PHP
📖 第 1 页 / 共 2 页
字号:
		$ADMIN->html .= $SKIN->start_form( array(
			1 => array( "code", "doedit" ),
			2 => array( "act", "announcement" ),
			3 => array(
				"id",
				$IN['id']
			)
		), "REPLIER" );
		$SKIN->td_header[] = array( " ", "20%" );
		$SKIN->td_header[] = array( " ", "80%" );
		if ( $global )
		{
			$title = "全局公告";
		}
		else
		{
			$title = "论坛公告:".$ann[a_title];
		}
		$ADMIN->html .= $this->table_top( );
		$ADMIN->html .= $SKIN->start_table( $title );
		$ADMIN->html .= $this->topictitle_fields( $ann );
		$ADMIN->html .= $this->startend_fields( array(
			"start_time" => $this->date_array( $ann[a_start] ),
			"end_time" => $this->date_array( $ann[a_end] )
		) );
		$ADMIN->html .= $this->namefield( $ann[name] );
		$smilies = $this->html_add_smilie_box( );
		$ADMIN->html .= $this->postbox_buttons( array(
			"sig_checked" => $ann[a_use_sig] ? "checked" : "",
			"smilies_checked" => $ann[a_use_smile] ? "checked" : "",
			"smilies" => $smilies,
			"post" => $this->parser->unconvert( $ann[a_text], "1", "1" )
		) );
		$ADMIN->html .= $SKIN->end_form( "更新论坛公告" );
		$ADMIN->html .= $SKIN->end_table( );
		$ADMIN->output( );
	}

	function edit_announcement( )
	{
		$this->process( );
		exit( );
	}

	function date_array( $time )
	{
		if ( $time == "" )
		{
			$time = time( );
		}
		if ( $time <= "0" )
		{
			return "";
		}
		return date( "Y-m-d H:i:s", $time );
	}

	function html_add_smilie_box( )
	{
		global $ibforums;
		global $INFO;
		global $DB;
		$ibforums->vars['EMOTICONS_URL'] = $INFO['html_url']."/emoticons";
		$show_table = 0;
		$count = 0;
		$smilies = "<tr align='center'>\n";
		$DB->query( "SELECT * FROM ibf_emoticons WHERE clickable='1'" );
		while ( $elmo = $DB->fetch_row( ) )
		{
			++$show_table;
			++$count;
			$smilies .= "<td><a href=\"javascript:emoticon('".$elmo['typed']."')\"><img src=\"".$ibforums->vars['EMOTICONS_URL']."/".$elmo['image']."\" alt='smilie' border='0'></a>&nbsp;</td>\n";
			if ( $count == $ibforums->vars['emo_per_row'] )
			{
				$smilies .= "</tr>\n\n<tr align='center'>";
				$count = 0;
			}
		}
		if ( $count != $ibforums->vars['emo_per_row'] )
		{
			$i = $count;
			for ( ;	$i < $ibforums->vars['emo_per_row'];	++$i	)
			{
				$smilies .= "<td>&nbsp;</td>\n";
			}
			$smilies .= "</tr>";
		}
		$table = $this->smilie_table( );
		if ( $show_table != 0 )
		{
			$table = preg_replace( "/<!--THE SMILIES-->/", $smilies, $table );
			return $table;
		}
	}

	function compile_post( )
	{
		global $IN;
		global $root_path;
		global $INFO;
		global $DB;
		global $SKIN;
		global $ADMIN;
		global $std;
		global $MEMBER;
		global $GROUP;
		global $HTTP_POST_VARS;
		require( "./sources/lib/post_parser.php" );
		$this->parser = new post_parser( 1 );
		$id = $IN['id'];
		if ( $IN['code'] == "doadd" )
		{
			if ( $id == "global" )
			{
				$id = 0;
			}
			else
			{
				$DB->query( "SELECT id FROM ibf_forums where id='".$id."'" );
				$new_id = $DB->fetch_row( );
				$id = $new_id[id];
				if ( $id == "" )
				{
					$ADMIN->error( "无法找到论坛栏目" );
				}
			}
		}
		$IN['enablesig'] = $IN['enablesig'] == "yes" ? 1 : 0;
		$IN['enableemo'] = $IN['enableemo'] == "yes" ? 1 : 0;
		if ( strlen( trim( $HTTP_POST_VARS['Post'] ) ) < 1 )
		{
			$ADMIN->error( "你必须在文本框中输入文本内容" );
		}
		$DB->query( "SELECT id FROM ibf_members WHERE name='".$IN['UserName']."'" );
		$author = $DB->fetch_row( );
		if ( $author[id] == "" || !$author[id] )
		{
			$ADMIN->error( "公告发布作者无效" );
		}
		if ( $IN['end_time'] == "" )
		{
			$expire = "0";
			$end_time = "";
		}
		else
		{
			$expire = "1";
			$end_time = @strtotime( $IN['end_time'] );
		}
		if ( $IN['start_time'] == "" )
		{
			$ADMIN->error( "公告开始时间无效" );
		}
		$start_time = @strtotime( $IN['start_time'] );
		$post = array(
			"author_id" => $author[id],
			"use_sig" => $IN['enablesig'],
			"use_emo" => $IN['enableemo'],
			"start_time" => $start_time,
			"end_time" => $end_time,
			"expire" => $expire,
			"forum" => $id,
			"post" => $this->parser->convert( array(
				TEXT => $IN['Post'],
				SMILIES => $IN['enableemo'],
				"1",
				"1"
			) )
		);
		if ( $this->parser->error )
		{
			$ADMIN->error( $this->parser->error );
		}
		return $post;
	}

	function process( )
	{
		global $IN;
		global $root_path;
		global $INFO;
		global $DB;
		global $SKIN;
		global $ADMIN;
		global $std;
		global $MEMBER;
		global $GROUP;
		global $HTTP_POST_VARS;
		$this->post = $this->compile_post( );
		$IN['Title'] = str_replace( "<br>", "", $IN['Title'] );
		$IN['Title'] = trim( stripslashes( $IN['Title'] ) );
		if ( strlen( $IN['Title'] ) < 2 || !$IN['Title'] )
		{
			$ADMIN->error( "你输入的公告标题必须大于 2 个字符" );
		}
		if ( 64 < strlen( $HTTP_POST_VARS['Title'] ) )
		{
			$ADMIN->error( "你输入的公告标题必须小于 65 个字符" );
		}
		if ( $IN['code'] == "doedit" )
		{
			$this->edit_ann( );
		}
		else
		{
			$this->add_new_ann( );
		}
	}

	function add_new_ann( )
	{
		global $IN;
		global $root_path;
		global $INFO;
		global $DB;
		global $SKIN;
		global $ADMIN;
		global $std;
		global $MEMBER;
		global $GROUP;
		global $HTTP_POST_VARS;
		global $ibforums;
		$this->new_annc = array(
			"a_mid" => $this->post[author_id],
			"a_title" => $IN['Title'],
			"a_desc" => $IN['Desc'],
			"a_text" => $this->post[post],
			"a_expire" => $this->post[expire],
			"a_start" => $this->post[start_time],
			"a_end" => $this->post[end_time],
			"a_forum" => $this->post[forum],
			"a_use_sig" => $this->post[use_sig],
			"a_use_smile" => $this->post[use_emo]
		);
		$db_string = $DB->compile_db_insert_string( $this->new_annc );
		$DB->query( "INSERT INTO ibf_announcements (".$db_string['FIELD_NAMES'].") VALUES (".$db_string['FIELD_VALUES'].")" );
		$ADMIN->done_screen( "论坛公告已经添加", "论坛公告管理", "act=announcement" );
	}

	function edit_ann( )
	{
		global $IN;
		global $root_path;
		global $INFO;
		global $DB;
		global $SKIN;
		global $ADMIN;
		global $std;
		global $MEMBER;
		global $GROUP;
		global $HTTP_POST_VARS;
		global $ibforums;
		$this->new_annc = array(
			"a_mid" => $this->post[author_id],
			"a_title" => $IN['Title'],
			"a_desc" => $IN['Desc'],
			"a_text" => $this->post[post],
			"a_expire" => $this->post[expire],
			"a_start" => $this->post[start_time],
			"a_end" => $this->post[end_time],
			"a_use_sig" => $this->post[use_sig],
			"a_use_smile" => $this->post[use_emo]
		);
		$db_string = $DB->compile_db_update_string( $this->new_annc );
		$DB->query( "UPDATE ibf_announcements SET {$db_string} WHERE a_id='".$IN[id]."'" );
		$ADMIN->done_screen( "论坛公告已经编辑", "论坛公告管理", "act=announcement" );
	}

	function startend_fields( $data )
	{
		return "        <tr> \r\n          <td id=\"catrow\" colspan=\"2\">论坛公告持续时间</td>\r\n        </tr>\r\n        <tr> \r\n          <td id='tdrow1'><b>公告开始时间</b><BR>(yyyy-mm-dd hh:mm:ss)</td>\r\n          <td id='tdrow2' width=\"100%\" valign=\"top\"><input type='text' size='40' maxlength='50' name='start_time' value='{$data[start_time]}' tabindex='3' id='textinput'></td>\r\n        </tr>\r\n        <tr> \r\n          <td id='tdrow1'><b>公告结束时间</b><BR>(yyyy-mm-dd hh:mm:ss)<br>留空表示不设置公告结束时间</td>\r\n          <td id='tdrow2' width=\"100%\" valign=\"top\"><input type='text' size='40' maxlength='40' name='end_time' value='{$data[end_time]}' tabindex='4' id='textinput'></td>\r\n        </tr>";
	}

	function topictitle_fields( $data )
	{
		return "        <tr> \r\n          <td id=\"catrow\" colspan=\"2\">论坛公告参数设置</td>\r\n        </tr>\r\n        <tr> \r\n          <td id='tdrow1'>论坛公告标题</td>\r\n          <td id='tdrow2' width=\"100%\" valign=\"top\"><input type='text' size='40' maxlength='50' name='Title' value='{$data[a_title]}' tabindex='1' id='textinput'></td>\r\n        </tr>\r\n        <tr> \r\n          <td id='tdrow1'>论坛公告描述</td>\r\n          <td id='tdrow2' width=\"100%\" valign=\"top\"><input type='text' size='40' maxlength='40' name='Desc' value='{$data[a_desc]}' tabindex='2' id='textinput'></td>\r\n        </tr>";
	}

	function table_top( )
	{
		return "\t<script language='Javascript' type='text/javascript'>\r\n\t\t<!--\r\n\t\tfunction PopUp(url, name, width,height,center,resize,scroll,posleft,postop) {\r\n\t\t\tif (posleft != 0) { x = posleft }\r\n\t\t\tif (postop  != 0) { y = postop  }\r\n\t\t\r\n\t\t\tif (!scroll) { scroll = 1 }\r\n\t\t\tif (!resize) { resize = 1 }\r\n\t\t\r\n\t\t\tif ((parseInt (navigator.appVersion) >= 4 ) && (center)) {\r\n\t\t\t  X = (screen.width  - width ) / 2;\r\n\t\t\t  Y = (screen.height - height) / 2;\r\n\t\t\t}\r\n\t\t\tif (scroll != 0) { scroll = 1 }\r\n\t\t\r\n\t\t\tvar Win = window.open( url, name, 'width='+width+',height='+height+',top='+Y+',left='+X+',resizable='+resize+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no');\r\n\t     }\r\n\t\t//-->\r\n\t</script>\r\n";
	}

	function namefield( $data )
	{
		return "        <tr> \r\n          <td id=\"catrow\" colspan=\"2\">公告发布作者信息</td>\r\n        </tr>\r\n        <tr> \r\n          <td id=\"tdrow1\">公告发布作者</td>\r\n          <td id=\"tdrow2\" width=\"100%\"><input type='text' size='40' maxlength='40' name='UserName' id='textinput' tabindex='5' value='{$data}'></td>\r\n        </tr>";
	}

	function postbox_buttons( $data )
	{
		global $INFO;
		return "<script language=\"javascript1.2\">\r\n<!--\r\n\r\n\t\r\n\t\r\nfunction emo_pop()\r\n{\r\n\t\r\n  window.open('index.{$INFO['php_ext']}?act=legends&CODE=emoticons&s={$ibforums->session_id}','Legends','width=250,height=500,resizable=yes,scrollbars=yes'); \r\n     \r\n}\t\r\n\r\n\t\r\n\tfunction ValidateForm() {\r\n\t\tMessageLength  = document.REPLIER.Post.value.length;\r\n\t\terrors = \"\";\r\n\t\r\n\t\tif (MessageLength < 2) {\r\n\t\t\t errors = \"你必须输入公告内容!\";\r\n\t\t}\r\n\r\n\t\tif (errors != \"\") {\r\n\t\t\talert(errors);\r\n\t\t\treturn false;\r\n\t\t} else {\r\n\t\t\tdocument.REPLIER.submit.disabled = true;\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}\r\n\t\r\n\t\r\n\t\r\n\t// IBC Code stuff\r\n\tvar text_enter_url      = \"输入超链接的完整URL\";\r\n\tvar text_enter_url_name = \"输入网页的标题\";\r\n\tvar text_enter_image    = \"输入图片完整的URL\";\r\n\tvar text_enter_email    = \"输入电子邮件地址\";\r\n\tvar text_enter_flash    = \"输入Flash的完整URL。\";\r\n\tvar text_code           = \"用法:[CODE] 您的代码 [/CODE]\";\r\n\tvar text_quote          = \"用法:[QUOTE] 您的引用文章 [/QUOTE]\";\r\n\tvar error_no_url        = \"请输入URL\";\r\n\tvar error_no_title      = \"请输入标题\";\r\n\tvar error_no_email      = \"您必须输入电子邮件地址\";\r\n\tvar error_no_width      = \"请输入宽度\";\r\n\tvar error_no_height     = \"请输入高度\";\r\n\tvar prompt_start        = \"请输入需要格式化的文本\";\r\n\r\n\tvar text_enter_number\t= \"请输入能够查看隐藏内容所需的发帖数量\";\r\n\tvar text_enter_text\t\t= \"输入需要隐藏的内容\";\r\n\tvar error_no_number\t\t= \"你必须输入发帖数量\";\r\n\tvar error_no_text\t\t= \"你必须输入隐藏内容\";\r\n\tvar help_hidep\t\t\t= \"插入隐藏内容 (ALT + F)\";\r\n\t\r\n\tvar help_bold           = \"插入粗体字(ALT + B)\";\r\n\tvar help_italic         = \"插入斜体字(ALT + I)\";\r\n\tvar help_under          = \"插入下划线(ALT + U)\";\r\n\tvar help_font           = \"插入字体标签\";\r\n\tvar help_size           = \"插入字体大小标签\";\r\n\tvar help_color          = \"插入字体颜色标签\";\r\n\tvar help_close          = \"关闭所有打开标签\";\r\n\tvar help_url            = \"插入超级链接(ALT+ H)\";\r\n\tvar help_img            = \"插入图片(ALT + G)\";\r\n\tvar help_email          = \"插入电子邮件地址(ALT + E)\";\r\n\tvar help_quote          = \"插入引用文本(ALT + Q)\";\r\n\tvar help_list           = \"创建一个列表(ALT + L)\";\r\n\tvar help_code           = \"插入代码引用(ALT + P)\";\r\n\tvar help_click_close    = \"点击按钮再次关闭\";\r\n\tvar list_prompt         = \"输入列表项目。点击“取消”或者留空来结束此列表\";\r\n\r\n\t//-->\r\n</script>\r\n<script language='Javascript' src='html/ibfcode.js'></script>\r\n\r\n        <tr> \r\n          <td id=\"catrow\" colspan=\"2\">论坛快捷代码按钮</td>\r\n        </tr>\r\n        <tr> \r\n          <td id='tdrow1'>你可以用鼠标指向代码按钮获取帮助信息,同时按下键盘 'ALT' 和 'c' 可以关闭当前标签</td>\r\n          <td id='tdrow2' width=\"100%\" valign=\"top\">\r\n<table cellpadding='2' cellspacing='2' width='100%' align='center'>\r\n                \t\t<tr>\r\n                \t\t\t<td nowrap width='10%'>\r\n\t\t\t\t\t\t\t  <input type='button' accesskey='b' value=' B '       onClick='simpletag(\"B\")'       id='textinput' title=\"BOLD: [Control / Alt] + b\"      name='bold'   style=\"font-weight:bold\">\r\n\t\t\t\t\t\t\t  <input type='button' accesskey='i' value=' I '       onClick='simpletag(\"I\")'       id='textinput' title=\"ITALIC: [Control / Alt] + i\"    name='italic' style=\"font-style:italic\">\r\n\t\t\t\t\t\t\t  <input type='button' accesskey='u' value=' U '       onClick='simpletag(\"U\")'       id='textinput' title=\"UNDERLINE: [Control / Alt] + u\" name='under' style=\"text-decoration:underline\">\r\n\t\t\t\t\t\t\t  \r\n\t\t\t\t\t\t\t  <select name='ffont' id='textinput' onchange=\"alterfont(this.options[this.selectedIndex].value, 'FONT')\">\r\n\t\t\t\t\t\t\t  <option value='0'>字体</option>\r\n\t\t\t\t\t\t\t  <option value='Arial' style='font-family:Arial'>Arial</option>\r\n\t\t\t\t\t\t\t  <option value='Times' style='font-family:Times'>Times</option>\r\n\t\t\t\t\t\t\t  <option value='Courier' style='font-family:Courier'>Courier</option>\r\n\t\t\t\t\t\t\t  <option value='Impact' style='font-family:Impact'>Impact</option>\r\n\t\t\t\t\t\t\t  <option value='Geneva' style='font-family:Geneva'>Geneva</option>\r\n\t\t\t\t\t\t\t  <option value='Optima' style='font-family:Optima'>Optima</option>\r\n\t\t\t\t\t\t\t  </select><select name='fsize' id='textinput' onchange=\"alterfont(this.options[this.selectedIndex].value, 'SIZE')\">\r\n\t\t\t\t\t\t\t  <option value='0'>尺寸</option>\r\n\t\t\t\t\t\t\t  <option value='1'>Small</option>\r\n\t\t\t\t\t\t\t  <option value='7'>Large</option>\r\n\t\t\t\t\t\t\t  <option value='14'>Largest</option>\r\n\t\t\t\t\t\t\t  </select><select name='fcolor' id='textinput' onchange=\"alterfont(this.options[this.selectedIndex].value, 'COLOR')\">\r\n\t\t\t\t\t\t\t  <option value='0'>颜色</option>\r\n\t\t\t\t\t\t\t  <option value='blue' style='color:blue'>Blue</option>\r\n\t\t\t\t\t\t\t  <option value='red' style='color:red'>Red</option>\r\n\t\t\t\t\t\t\t  <option value='purple' style='color:purple'>Purple</option>\r\n\t\t\t\t\t\t\t  <option value='orange' style='color:orange'>Orange</option>\r\n\t\t\t\t\t\t\t  <option value='yellow' style='color:yellow'>Yellow</option>\r\n\t\t\t\t\t\t\t  <option value='gray' style='color:orange'>Gray</option>\r\n\t\t\t\t\t\t\t  <option value='green' style='color:green'>Green</option>\r\n\t\t\t\t\t\t\t  </select>\r\n\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t<td align='left'nowrap width='10%'><input type='button' accesskey='c' value=' x '       onClick='closelast()'          id='textinput' title=\"Close Current Tag: [Control / Alt] + c\"      name='bold'   style=\"color:red\"> 关闭当前标签</td>\r\n\t\t\t\t\t\t </tr>\r\n\t\t\t\t\t\t <tr>\r\n\t\t\t\t\t\t    <td align='left'>\r\n\t\t\t\t\t\t\t  <input type='button' accesskey='h' value=' http:// ' onClick='tag_url()'            id='textinput' title=\"HYPERLINK: [Control / Alt] + h\" style=\"text-decoration:underline;color:blue\">\r\n\t\t\t\t\t\t\t  <input type='button' accesskey='g' value=' IMG '     onClick='tag_image()'          id='textinput' title=\"IMG: [Control / Alt] + g\"       >\r\n\t\t\t\t\t\t\t  <input type='button' accesskey='e' value='  @  '     onClick='tag_email()'          id='textinput' title=\"EMAIL: [Control / Alt] + e\"     style=\"text-decoration:underline;color:blue\">\r\n\t\t\t\t\t\t\t  <input type='button' accesskey='q' value=' Quote '   onClick='simpletag(\"QUOTE\")'   id='textinput' title=\"QUOTE: [Control / Alt] + q\" name='quote'>\r\n\t\t\t\t\t\t\t  <input type='button' accesskey='p' value=' Code '    onClick='simpletag(\"CODE\")'    id='textinput' title=\"CODE: [Control / Alt] + p\"  name='code'>\r\n\t\t\t\t\t\t\t  <input type='button' accesskey='s' value=' SQL '     onClick='simpletag(\"SQL\")'    id='textinput' title=\"SQL: [Control / Alt] + s\"   name='code'>\r\n\t\t\t\t\t\t\t  <input type='button' accesskey='t' value=' HTML '     onClick='simpletag(\"HTML\")'    id='textinput' title=\"SQL: [Control / Alt] + t\"   name='code'>\r\n\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t<td align='left'>\r\n\t\t\t\t\t\t\t  <input type='button' accesskey='x' value=' X '       onClick='closeall()'          id='textinput' title=\"Close Current Tag: [Control / Alt] + x\"      name='bold'   style=\"color:red;font-weight:bold\"> 关闭所有标签\r\n\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t</table>\r\n          </td>\r\n        </tr>\r\n        <tr> \r\n          <td id=\"catrow\" colspan=\"2\">论坛公告内容</td>\r\n        </tr>\r\n        <tr> \r\n          <td id='tdrow1'>{$data['smilies']}<br><br><img src=\"/spacer.gif\" alt=\"\" width=\"180\" height=\"1\"></td>\r\n          <td id='tdrow2' width=\"100%\" valign=\"top\"><textarea cols='80' rows='15' wrap='soft' name='Post' tabindex='6' id='textinput'>{$data['post']}</textarea><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n              <tr> \r\n                <td><input type='checkbox' name='enableemo' value='yes' {$data['smilies_checked']}></td>\r\n                <td width=\"100%\">您希望在帖子 <b>使用</b> 表情图标吗?</td>\r\n              </tr>\r\n              <tr> \r\n                <td><input type='checkbox' name='enablesig' value='yes' {$data['sig_checked']}></td>\r\n                <td width=\"100%\">是否在帖子中加入签名?</td>\r\n              </tr>\r\n            </table></td>\r\n        </tr>";
	}

	function smilie_table( )
	{
		global $ibforums;
		return "    <table align=\"center\" cellspacing='1' cellpadding='3' border='0' id='tdrow1' style=\"border-width:1px; border-style:solid; width:95%\" align='left'>\r\n    <tr>\r\n        <td colspan='{$ibforums->vars['emo_per_row']}' align='center'>可用表情</td>\r\n    </tr>\r\n    <!--THE SMILIES-->\r\n    <tr>\r\n        <td colspan='{$ibforums->vars['emo_per_row']}' id='tdrow2' align='center'><a href='javascript:emo_pop()'>所有表情符号</a></td>\r\n    </tr>\r\n    </table>";
	}

}

ad_announce( );
$idx = new ad_announce( );
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -