<?
//template code
include "config.inc.php";
include "class/article.class.php";
define('DEFAULT_LANG', 'en-us.php');
define('DOMAIN_ADDRESS', PLUS_URL . '/editor');
define('WP_FILE_DIRECTORY', PLUS_ROOT_PATH . '/editor/');
define('WP_WEB_DIRECTORY', PLUS_URL . '/editor/');
$art=new article();

function getBlockTemplate($template = "default")
    {
        $dir = "template/" . $template . "/blocks/";
        $d = dir($dir);

        while ($file = $d->read()) {
            $ext_name = strtolower(str_replace(".", "", strrchr($file, ".")));

            if ($file == "." || $file == ".." || $ext_name != "tpl")
                continue;

            $ret[$file] = $file;
        } 

        return $ret;
    } 
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE><?=_LANG_0955?></TITLE>
<META http-equiv=Content-Type content="text/html; charset=<?=_CHARSET?>">
<META content="MSHTML 6.00.2800.1106" name=GENERATOR>
<META content="noindex, nofollow" name=robots>
<link href="images/style.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="editor/fckeditor.js"></script>
<script language="JavaScript" type="text/javascript" src="<?php echo WP_WEB_DIRECTORY; ?>js/dialogEditorShared.js"></script>
<script language="JavaScript" type="text/javascript" src="<?php echo WP_WEB_DIRECTORY; ?>js/dialogShared.js"></script>
<script>
function insertNCode(){
	var text;
	text='{'+document.tcode.n_code.value+'}';
	add(text);
}
function insertN2Code(){
	var text;
	text='{'+document.tcode.n2_code.value+'}';
	add(text);
}
function insertN3Code(){
	var text;
	text='{'+document.tcode.n3_code.value+'}';
	add(text);
}
function insertN4Code(){
	var text;
	text='{'+document.tcode.n4_code.value+'}';
	add(text);
}
function insertN5Code(){
	var text;
	text='{'+document.tcode.n5_code.value+'}';
	add(text);
}
function insertN6Code(){
	var text;
	text='{'+document.tcode.n6_code.value+'}';
	add(text);
}
function insertN7Code(){
	var text;
	text='{'+document.tcode.n7_code.value+'}';
	add(text);
}
function insertN8Code(){
	var text;
	text='{'+'insert name=article cid='+document.tcode.a_cid.value+' limit='+document.tcode.a_limit.value+' ismax='+document.tcode.a_max.value+' ismore='+document.tcode.a_more.value+' template='+document.tcode.a_template.value+' order_by='+document.tcode.a_order.value+'}';
	add(text);
}
function insertN9Code(){
	var text;
	text='{insert name=poll id='+document.tcode.n9_code.value+' template=poll.tpl}';
	add(text);
}
function insertN10Code(){
	var text;
	text='{insert name=ad aid='+document.tcode.n10_code.value+'}';
	add(text);
}
function insertN11Code(){
	var text;
	text='{insert name=ad tid='+document.tcode.n11_code.value+'}';
	add(text);
}
function insertN12Code(){
	var text;
	text='{insert name=block bid='+document.tcode.n12_code.value+'}';
	add(text);
}
function add(text){
	//opener.AddText(text);
	//top.window.close();
			opener.oEditor.InsertHtml( '- This is some <b>sample</b> HTML -' ) ;
}
</script>
<form name=tcode action=# method=get>
<table width=100% border=0 bgcolor=#cccccc>
<tr class=tablerow><td width=120>
<?=_LANG_0956?>
</td></tr>
<tr><td>
<select name=n_code>
	<option value='$page_title'><?_LANG_0957?></option>
	<option value='$position'><?=_LANG_0958?></option>
	<option value='$system.site_name'><?=_LANG_0959?></option>
	<option value='$system.site_email'><?=_LANG_0960?></option>
	<option value='$system.site_license'><?=_LANG_0961?></option>
</select>&nbsp;<a href="javascript:insertNCode('')" ><?=_LANG_0962?></a>
</td></tr>
<tr class=tablerow><td>
<?=_LANG_0963?>
</td></tr>
<tr><td>
<select name=n2_code>
	<option value='$ctitle'><?=_LANG_0964?></option>
	<option value='$list[article].id'><?=_LANG_0965?></option>
	<option value='$list[article].cid'><?=_LANG_0966?></option>
	<option value='$list[article].aurl'><?=_LANG_0967?></option>
	<option value='$list[article].title'><?=_LANG_0968?></option>
	<option value='$list[article].author'><?=_LANG_0969?></option>
	<option value='$list[article].source'><?=_LANG_0970?></option>
	<option value='$list[article].thumb'><?=_LANG_0971?></option>
	<option value='$list[article].ctime'><?=_LANG_0972?></option>
	<option value='$list[article].utime'><?=_LANG_0973?></option>
</select>&nbsp;<a href="javascript:insertN2Code('')" ><?=_LANG_0962?></a>
</td></tr>
<tr class=tablerow><td>
<?=_LANG_0974?>
</td></tr>
<tr><td>
<select name=n3_code>
	<option value='$ctitle'><?=_LANG_0975?></option>
	<option value='$list[article].id'><?=_LANG_0976?></option>
	<option value='$list[article].cid'><?=_LANG_0977?></option>
	<option value='$list[article].aurl'><?=_LANG_0978?></option>
	<option value='$list[article].title'><?=_LANG_0979?></option>
	<option value='$list[article].author'><?=_LANG_0980?></option>
	<option value='$list[article].source'><?=_LANG_0981?></option>
	<option value='$list[article].thumb'><?=_LANG_0982?></option>
	<option value='$list[article].ctime'><?=_LANG_0983?></option>
	<option value='$list[article].utime'><?=_LANG_0984?></option>
</select>&nbsp;<a href="javascript:insertN3Code('')" ><?=_LANG_0962?></a>
</td></tr>
<tr class=tablerow><td>
<?=_LANG_0985?>
</td></tr>
<tr><td>
<select name=n4_code>
	<option value='$ctitle'><?=_LANG_0986?></option>
	<option value='$list[article].id'><?=_LANG_0987?></option>
	<option value='$list[article].cid'><?=_LANG_0988?></option>
	<option value='$list[article].aurl'><?=_LANG_0989?></option>
	<option value='$list[article].title'><?=_LANG_0990?></option>
	<option value='$list[article].author'><?=_LANG_0991?></option>
	<option value='$list[article].source'><?=_LANG_0992?></option>
	<option value='$list[article].thumb'><?=_LANG_0993?></option>
	<option value='$list[article].ctime'><?=_LANG_0994?></option>
	<option value='$list[article].utime'><?=_LANG_0995?></option>
</select>&nbsp;<a href="javascript:insertN4Code('')" ><?=_LANG_0962?></a>
</td></tr>
<tr class=tablerow><td>
<?=_LANG_0996?>
</td></tr>
<tr><td>
<select name=n5_code>
	<option value='$ctitle'><?=_LANG_0997?></option>
	<option value='$list[article].id'><?=_LANG_0998?></option>
	<option value='$list[article].cid'><?=_LANG_0999?></option>
	<option value='$list[article].aurl'><?=_LANG_1000?></option>
	<option value='$list[article].title'><?=_LANG_1044?></option>
	<option value='$list[article].author'><?=_LANG_1045?></option>
	<option value='$list[article].source|string_format:"%.2f"'><?=_LANG_1046?></option>
	<option value='$list[article].thumb'><?=_LANG_1047?></option>
	<option value='$list[article].ctime'><?=_LANG_1048?></option>
	<option value='$list[article].utime'><?=_LANG_1049?></option>
	<option value='}<form name=addcart{$list[article].id} action={$root}/index.php method=get>
    <input type=hidden name=module value=cart>
	<input name=action value=add type=hidden>
	<input name=aid value={$list[article].id} type=hidden>
	<input name=num value=1 type=hidden>
    <div align=\"right\"><a href = {$list[article].aurl}><img src={$root}/template/company_004/images/details.gif border=0></a> &nbsp; <a href=\"javascript:addcart{$list[article].id}.submit()\"><img src={$root}/template/company_004/images/add.gif border=0></a></div>
    </form>{'><?=_LANG_1001?></option>
'
</select>&nbsp;<a href="javascript:insertN5Code('')" ><?=_LANG_0962?></a>
</td></tr>
<tr class=tablerow><td>
<?=_LANG_1002?></td></tr>
<tr><td>
<select name=n6_code>
	<option value='$ctitle'><?=_LANG_1003?></option>
	<option value='$list[article].id'><?=_LANG_1004?></option>
	<option value='$list[article].cid'><?=_LANG_1005?></option>
	<option value='$list[article].aurl'><?=_LANG_1006?></option>
	<option value='$list[article].title'><?=_LANG_1007?></option>
	<option value='$list[article].author'><?=_LANG_1008?></option>
	<option value='$list[article].source'><?=_LANG_1009?></option>
	<option value='$list[article].thumb'><?=_LANG_1010?></option>
	<option value='$list[article].ctime'><?=_LANG_1011?></option>
	<option value='$list[article].utime'><?=_LANG_1012?></option>
</select>&nbsp;<a href="javascript:insertN6Code('')" ><?=_LANG_0962?></a>
</td></tr>
<tr class=tablerow><td>
<?_LANG_1013?></td></tr>
<tr ><td>
<select name=n7_code>
	<option value='$ctitle'><?=_LANG_1014?></option>
	<option value='$list[article].id'><?=_LANG_1015?></option>
	<option value='$list[article].cid'><?=_LANG_1016?></option>
	<option value='$list[article].aurl'><?=_LANG_1017?></option>
	<option value='$list[article].title'><?=_LANG_1018?></option>
	<option value='$list[article].author'><?=_LANG_1019?></option>
	<option value='$list[article].source'><?=_LANG_1020?></option>
	<option value='$list[article].thumb'><?=_LANG_1021?></option>
	<option value='$list[article].ctime'><?=_LANG_1022?></option>
	<option value='$list[article].utime'><?=_LANG_1023?></option>
</select>&nbsp;<a href="javascript:insertN7Code('')" ><?=_LANG_0962?></a>
</td></tr>
<tr class=tablerow><td>
<?=_LANG_1024?>
<?
	global $art;
	   $newTree = $art->getArticleCategoryNoImage(0);
        $newTree[0] = _LANG_1025; 
        $tlist = getBlockTemplate($site_conf[template][site_template]);
?>
</td></tr>
<tr><td><?=_LANG_1026?>
<select name=a_cid>
<?foreach($newTree as $cid=>$ctitle){?>
	<option value='<?=$cid?>'><?=$ctitle?></option>
	<?}?>
</select>
&nbsp;<?=_LANG_1027?><input type=text name=a_limit value=5 size=3>
&nbsp;<?=_LANG_1028?><input type=text name=a_max value=20 size=3>
&nbsp;<?=_LANG_1029?><select name=a_more><option value=yes><?=_LANG_1030?></option><option value=no><?=_LANG_1031?></option></select>
<br><?=_LANG_1032?><select name=a_template>
<?foreach($tlist as $tname){?>
	<option value='<?=$tname?>'><?=$tname?></option>
<?}?>
</select>
&nbsp;<?=_LANG_1033?>
<select name=a_order >
<option value=date_asc><?=_LANG_1034?></option>
<option value=date_desc><?=_LANG_1035?></option>
<option value=hit_asc><?=_LANG_1036?></option>
<option value=hit_desc><?=_LANG_1037?></option>
</select>
&nbsp;<a href="javascript:insertN8Code('')" ><?=_LANG_0962?></a>
</td></tr>
<tr class=tablerow><td>
<?=_LANG_1038?>
</td></tr>
<tr ><td>
<?
	$sql="select * from ".$PlusDB->prefix(poll)." where 1=1";
	$rt=$PlusDB->query($sql);
	$num = $rt->RecordCount($rt);
	if($num==0){
	    echo _LANG_1039;
	}else{
	echo "<select name=n9_code>";
	   while($row= $rt->fetchRow($rt)){
		   echo "	<option value='$row[id]'>$row[title] </option>";
	   }
	   echo "</select>";
	}
?>
&nbsp;<a href="javascript:insertN9Code('')" ><?=_LANG_0962?></a>
</td></tr>
<tr class=tablerow><td>
<?=_LANG_1040?>
</td></tr>
<tr ><td>
<?
	$sql="select * from ".$PlusDB->prefix(ad)." where 1=1";
	$rt=$PlusDB->query($sql);
	$num = $rt->RecordCount($rt);
	if($num==0){
	    echo _LANG_1041;
	}else{
	echo "<select name=n10_code>";
	   while($row= $rt->fetchRow($rt)){
		   echo "	<option value='$row[id]'>$row[title] </option>";
	   }
	   echo "</select>";
	}
?>
&nbsp;<a href="javascript:insertN10Code('')" ><?=_LANG_0962?></a>
</td></tr>
<tr class=tablerow><td>
<?=_LANG_1042?>
</td></tr>
<tr ><td>
<?
	echo "<select name=n11_code>";
	   for($i=1;$i<=40;$i++){
		   echo "	<option value='$i'>$i</option>";
	   }
	   echo "</select>";
?>
&nbsp;<a href="javascript:insertN11Code('')" ><?=_LANG_0962?></a>
</td></tr>
<tr class=tablerow><td>
<?=_LANG_1043?>
</td></tr>
<tr ><td>
<?
	echo "<select name=n12_code>";
	$bdb=$PlusDB->prefix(blocks);
	$sql="select id,title from $bdb where 1=1";
	$rt=$PlusDB->query($sql);
	while($row=$rt->fetchRow($rt)){
			echo "<option value='$row[id]'>$row[title]</option>";
	}
	   echo "</select>";
?>
&nbsp;<a href="javascript:insertN12Code('')" ><?=_LANG_0962?></a>
</td></tr>
</table>
</form>