Example #1
0
 function listcategory($listtype = 0)
 {
     global $xoopsDB, $xoopsConfig, $xoopsModule;
     $orders = array();
     $cat = array();
     echo "<form name='reorder' METHOD='post'>";
     echo "<table border='0' width='100%' cellpadding = '2' cellspacing ='1' class = 'outer'>";
     echo "<tr class = bg3>";
     echo "<td align='center' width=3% height =16 ><b>" . _AM_REORDERID . "</b>";
     echo "</td><td align='center' width=3%><b>" . _AM_REORDERPID . "</b>";
     echo "</td><td align='left' width=30%><b>" . _AM_REORDERTITLE . "</b>";
     echo "</td><td align='left'><b>" . _AM_REORDERDESCRIPT . "</b>";
     echo "</td><td align='center' width=5%><b>" . _AM_REORDERWEIGHT . "</b>";
     echo "</td></tr>";
     $xt = new WfsCategory();
     $maintopics = $xt->getFirstChild();
     $deps = 0;
     $listtype = intval($listtype);
     showcategory($maintopics, 0, $listtype);
     echo "<tr><td class='foot' align='center' colspan='6'>\n\t\t<input type='hidden' name='op' value=reorder />\n\t\t<input type='submit' name='submit' value='" . _SUBMIT . "' />\n\t\t\n\t\t</td></tr>";
     echo "</table>";
     echo "</form>";
 }
Example #2
0
 function editform()
 {
     global $xoopsModule, $HTTP_SERVER_VARS, $HTTP_POST_VARS, $groupid, $myts, $xoopsConfig, $xoopsUser, $xoopsDB, $textareaname, $wfsConfig;
     include XOOPS_ROOT_PATH . "/include/xoopscodes.php";
     $textareaname = '';
     //$maintext = '';
     echo "<table width='100%' border='0' cellspacing='0' cellpadding='1'>";
     echo "<table><tr><td><form action='index.php' method='post' name='coolsus'>";
     echo "<div><b>" . _AM_GROUPPROMPT . "</b><br />";
     if (isset($this->groupid)) {
         listGroups($this->groupid);
     } else {
         listGroups();
     }
     echo "<br />";
     echo "</div><br />";
     echo "<div><b>" . _WFS_CATEGORY . "</b><br>";
     $xt = new WfsCategory();
     if (isset($this->categoryid)) {
         $xt->makeSelBox(0, $this->categoryid, "categoryid");
     } else {
         $xt->makeSelBox(0, 0, "categoryid");
     }
     echo "</div><br />";
     echo "<div><b>" . _AM_ARTICLEWEIGHT . "</b><br />";
     echo "<input type='text' name='weight' id='weight' value='";
     if (isset($this->weight)) {
         echo $this->weight("F");
     } else {
         $this->weight = 0;
         echo $this->weight("F");
     }
     echo "' size='5' /></div><br>";
     echo "<div>" . _WFS_CAUTH . "<br></div>";
     echo "<div><select name='changeuser'>";
     echo "<option value='-1'>------</option>";
     $result = $xoopsDB->query("SELECT uid, uname FROM " . $xoopsDB->prefix("users") . " ORDER BY uname");
     while (list($uid, $uname) = $xoopsDB->fetchRow($result)) {
         if ($uid == $this->uid) {
             $opt_selected = "selected='selected'";
         } else {
             $opt_selected = "";
         }
         echo "<option value='" . $uid . "' {$opt_selected}>" . $uname . "</option>";
     }
     echo "</select></div><br />";
     echo "<div><b>" . _WFS_TITLE . "</b><br />";
     echo "<input type='text' name='title' id='title' value='";
     if (isset($this->title)) {
         if ($this->titleFlag) {
             echo $this->title("F");
         } else {
             echo $this->title("E");
         }
     }
     echo "' size='50' /></div><br />";
     //HTML Page Seclection//
     echo "<div><b>" . _WFS_HTMLPAGE . "</b></div>";
     //echo " <b>HTML Path: </b>".$htmlpath."<br /><br /></div>";
     $html_array = XoopsLists::getFileListAsArray(XOOPS_ROOT_PATH . '/' . $wfsConfig['htmlpath']);
     echo "<div><select size='1' name='htmlpage'>";
     echo "<option value=' '>------</option>";
     foreach ($html_array as $htmlpage) {
         if ($htmlpage == $this->htmlpage()) {
             $opt_selected = "selected='selected'";
         } else {
             $opt_selected = "";
         }
         echo "<option value='" . $htmlpage . "' {$opt_selected}>" . $htmlpage . "</option>";
     }
     echo "</select>";
     $htmlpath = XOOPS_ROOT_PATH . '/' . $wfsConfig['htmlpath'];
     echo " <b>HTML Path: </b>" . $htmlpath . "<br /><br /></div>";
     //echo "</div><br />";
     echo "<div><b>" . _WFS_MAINTEXT . "</b></div>";
     if (isset($this->maintext)) {
         if ($this->maintextFlag) {
             $GLOBALS['maintext'] = $this->maintext("F");
         } else {
             $GLOBALS['maintext'] = $this->maintext("E");
         }
     }
     if (!strstr($HTTP_SERVER_VARS["HTTP_USER_AGENT"], "MSIE")) {
         $wfsConfig['wysiwygeditor'] = '0';
     }
     if ($wfsConfig['wysiwygeditor'] == '1') {
         html_editor('maintext');
         $smiliepath = $wfsConfig['smiliepath'];
         $smilie_array = XoopsLists::getimgListAsArray(XOOPS_ROOT_PATH . "/" . $smiliepath);
         echo "<br /><div style='text-align: left;'><b>" . _AM_SMILIE . "</b><br />";
         echo "<table><tr><td align='top' valign='left'>";
         echo "<div><script type='text/javascript'>\n\t\t<!--\n\t\t\tfunction showbutton() {\n\t\t\t   \tdocument.all." . $textareaname . "_mysmile.src = '" . $xoopsConfig['xoops_url'] . "/{$smiliepath}/' + document.all." . $textareaname . "_smiley.value;\n\t\t\t}\n\t\t// -->\n\t\t</script>";
         echo "<select name='" . $textareaname . "_smiley' onchange='showbutton();'>";
         foreach ($smilie_array as $file) {
             echo "<option value='" . $file . "' {$opt_selected}>" . $file . "</option>";
         }
         echo "</select></td><td align='top' valign='left'>";
         echo "<img name='" . $textareaname . "_mysmile' src='" . $xoopsConfig['xoops_url'] . "/{$smiliepath}/{$file}' style='cursor:hand;' border='0' onclick=\"doFormat('InsertImage', document.all." . $textareaname . "_mysmile.src);\" />";
         echo "</td></tr></table>\n\t\t<script type='text/javascript'>\n\t\t\tshowbutton();\n\t\t</script>";
         //Start of article images
         $graphpath = $wfsConfig['graphicspath'];
         $graph_array =& XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . "/" . $graphpath);
         echo "<br><div style='text-align: left;'><b>" . _AM_GRAPHIC . "</b><br />";
         echo "<table><tr><td align='top' valign='left'>";
         echo "<script type='text/javascript'>\n\t\t<!--\n\t\t\tfunction showbutton2() {\n\t\t\t\tdocument.all." . $textareaname . "_mygraph.src = '" . $xoopsConfig['xoops_url'] . "/{$graphpath}/' + document.all." . $textareaname . "_graph.value;\n\t\t\t}\n\t\t// -->\n\t\t</script>";
         echo "<select name='" . $textareaname . "_graph' onchange='showbutton2();'>";
         foreach ($graph_array as $file2) {
             echo "<option value='" . $file2 . "' {$opt_selected}>" . $file2 . "</option>";
         }
         echo "</select></td><td align='top' valign='left'>";
         echo "<img name='" . $textareaname . "_mygraph' src='" . $xoopsConfig['xoops_url'] . "/{$graphpath}/{$file2}' style='cursor:hand;' border='0' onclick=\"doFormat('InsertImage', document.all." . $textareaname . "_mygraph.src);\" />";
         echo "</td></tr></table>\n\t\t<script type='text/javascript'>\n\t\t\tshowbutton2();\n\t\t</script>";
     } else {
         xoopsCodeTarea("maintext", 60, 15);
         xoopsSmilies("maintext");
     }
     echo "<div><b>" . _WFS_SUMMARY . "</b></div>";
     echo "<div><textarea id='summary' name='summary' wrap='virtual' cols='60' rows='5'>";
     if (isset($this->summary)) {
         if ($this->summaryFlag) {
             echo $this->summary("F");
         } else {
             echo $this->summary("E");
         }
     }
     echo "</textarea></div>";
     echo "<div class = 'bg3'><h4>" . _WFS_ARTICLELINK . "</h4></div>";
     echo "<div><b>" . _WFS_LINKURL . "</b><br />";
     echo "<input type='text' name='url' id='url' value='";
     if (isset($this->url)) {
         echo $this->url("F");
     }
     echo "' size='70' /></div><br />";
     echo "<div><b>" . _WFS_LINKURLNAME . "</b><br />";
     echo "<input type='text' name='urlname' id='urlname' value='";
     if (isset($this->urlname)) {
         echo $this->urlname("F");
     }
     echo "' size='50' /></div><br>";
     echo "<div class = 'bg3'><h4>" . _WFS_ATTACHEDFILES . "</h4></div>";
     echo "<div>" . _WFS_ATTACHEDFILESTXT . "</div><br />";
     if (empty($this->articleid)) {
         echo _WFS_AFTERREGED . "<br />";
     } elseif ($num = $this->getFilesCount()) {
         echo "<table border='1' style='border-collapse: collapse' bordercolor='#ffffff' width='100%' >";
         echo "<tr class='bg3'><td align='center'>" . _AM_FILEID . "</td><td align='center'>" . _AM_FILEICON . "</td><td align='center'>" . _AM_FILESTORE . "</td><td align='center'>" . _AM_REALFILENAME . "</td><td align='center'>" . _AM_USERFILENAME . "</td><td align='center' class='nw'>" . _AM_FILEMIMETYPE . "</td><td align='center' class='nw'>" . _AM_FILESIZE . "</td><td align='center'>" . _AM_ACTION . "</td></tr>";
         foreach ($this->files as $attached) {
             if (is_file(XOOPS_ROOT_PATH . "/" . $wfsConfig['filesbasepath'] . "/" . $attached->getFileRealName())) {
                 $filename = $attached->getFileRealName();
             } else {
                 $filename = "File Error!";
             }
             $fileid = $attached->getFileid();
             $mimetype = new mimetype();
             $icon = get_icon(XOOPS_ROOT_PATH . "/" . $wfsConfig['filesbasepath'] . "/" . $filename);
             $iconshow = "<img src=" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/" . $icon . " align='middle'>";
             if (is_file(XOOPS_ROOT_PATH . "/" . $wfsConfig['filesbasepath'] . "/" . $filename)) {
                 $size = Prettysize(filesize(XOOPS_ROOT_PATH . "/" . $wfsConfig['filesbasepath'] . "/" . $filename));
             } else {
                 $size = '0';
             }
             $filerealname = $attached->downloadname;
             $mimeshow = $mimetype->getType(XOOPS_ROOT_PATH . "/" . $wfsConfig['filesbasepath'] . "/" . $filename);
             $counter = $attached->getCounter();
             $linkedname = $attached->getFileShowName();
             //$linkedname = $attached->getLinkedName(XOOPS_URL."/modules/".$xoopsModule->dirname()."/download.php?fileid=");
             $editlink = "<a href='index.php?op=fileedit&amp;fileid=" . $fileid . "'>" . _AM_EDIT . "</a>";
             $dellink = "<a href='index.php?op=delfile&amp;fileid=" . $fileid . "'>" . _AM_DELETE . "</a>";
             echo "<tr><td align='center'><b>" . $fileid . "</b>";
             echo "</td><td align='center'>" . $iconshow . "";
             echo "</td><td align='center'>" . $filename . "";
             echo "</td><td align='center'>" . $filerealname . "";
             echo "</td><td align='center'>" . $linkedname . "";
             echo "</td><td align='center'>" . $mimeshow . "";
             echo "</td><td align='center'>" . $size . "";
             //echo "</td><td align='center' class='nw'>".$counter."";
             echo "</td><td align='center'>" . $editlink . " " . $dellink . "";
             echo "</td></tr>";
         }
         echo "</table>";
     } else {
         echo "<div align='left'>" . _WFS_NOFILE . "</div>";
     }
     echo "</div><br />";
     echo "<div class = 'bg3'><h4>" . _WFS_MISCSETTINGS . "</h4></div>";
     echo "<input type='checkbox' name='autodate' value='1'";
     if (isset($autodate) && $autodate == 1) {
         echo " checked='checked'";
     }
     echo "> ";
     $time = time();
     if (!empty($this->articleid)) {
         $isedit = 1;
     }
     if (isset($isedit) && $isedit == 1 && $this->published > $time) {
         echo "<b>" . _AM_CHANGEDATETIME . "</b><br /><br />";
         printf(_AM_NOWSETTIME, formatTimestamp($this->published));
         $published = xoops_getUserTimestamp($this->published);
         echo "<br /><br />";
         printf(_AM_CURRENTTIME, formatTimestamp($time));
         echo "<br />";
         echo "<input type='hidden' name='isedit' value='1' />";
     } else {
         echo "<b>" . _AM_SETDATETIME . "</b><br /><br />";
         printf(_AM_CURRENTTIME, formatTimestamp($time));
         echo "<br />";
     }
     echo "<br /> &nbsp; " . _AM_MONTHC . " <select name='automonth'>";
     if (isset($automonth)) {
         $automonth = intval($automonth);
     } elseif (isset($this->published)) {
         $automonth = date('m', $this->published);
     } else {
         $automonth = date('m');
     }
     for ($xmonth = 1; $xmonth < 13; $xmonth++) {
         if ($xmonth == $automonth) {
             $sel = 'selected="selected"';
         } else {
             $sel = '';
         }
         echo "<option value='{$xmonth}' {$sel}>{$xmonth}</option>";
     }
     echo "</select>&nbsp;";
     echo _AM_DAYC . " <select name='autoday'>";
     if (isset($autoday)) {
         $autoday = intval($autoday);
     } elseif (isset($published)) {
         $autoday = date('d', $this->published);
     } else {
         $autoday = date('d');
     }
     for ($xday = 1; $xday < 32; $xday++) {
         if ($xday == $autoday) {
             $sel = 'selected="selected"';
         } else {
             $sel = '';
         }
         echo "<option value='{$xday}' {$sel}>{$xday}</option>";
     }
     echo "</select>&nbsp;";
     echo _AM_YEARC . " <select name='autoyear'>";
     if (isset($autoyear)) {
         $autoyear = intval($autoyear);
     } elseif (isset($this->published)) {
         $autoyear = date('Y', $this->published);
     } else {
         $autoyear = date('Y');
     }
     $cyear = date('Y');
     for ($xyear = $autoyear - 8; $xyear < $cyear + 2; $xyear++) {
         if ($xyear == $autoyear) {
             $sel = 'selected="selected"';
         } else {
             $sel = '';
         }
         echo "<option value='{$xyear}' {$sel}>{$xyear}</option>";
     }
     echo "</select>";
     echo "&nbsp;" . _AM_TIMEC . " <select name='autohour'>";
     if (isset($autohour)) {
         $autohour = intval($autohour);
     } elseif (isset($this->publishedshed)) {
         $autohour = date('H', $this->published);
     } else {
         $autohour = date('H');
     }
     for ($xhour = 0; $xhour < 24; $xhour++) {
         if ($xhour == $autohour) {
             $sel = 'selected="selected"';
         } else {
             $sel = '';
         }
         echo "<option value='{$xhour}' {$sel}>{$xhour}</option>";
     }
     echo "</select>";
     echo " : <select name='automin'>";
     if (isset($automin)) {
         $automin = intval($automin);
     } elseif (isset($published)) {
         $automin = date('i', $published);
     } else {
         $automin = date('i');
     }
     for ($xmin = 0; $xmin < 61; $xmin++) {
         if ($xmin == $automin) {
             $sel = 'selected="selected"';
         } else {
             $sel = '';
         }
         $xxmin = $xmin;
         if ($xxmin < 10) {
             $xxmin = "{$xmin}";
         }
         echo "<option value='{$xmin}' {$sel}>{$xxmin}</option>";
     }
     echo "</select></br />";
     echo "<br /><input type='checkbox' name='autoexpdate' value='1'";
     if (isset($autoexpdate) && $autoexpdate == 1) {
         echo " checked='checked'";
     }
     echo "> ";
     $time = time();
     if (isset($isedit) && $isedit == 1 && $this->expired > 0) {
         echo "<b>" . _AM_CHANGEEXPDATETIME . "</b><br /><br />";
         printf(_AM_NOWSETEXPTIME, formatTimestamp($this->expired));
         echo "<br /><br />";
         $expired = xoops_getUserTimestamp($this->expired);
         printf(_AM_CURRENTTIME, formatTimestamp($time));
         echo "<br />";
         echo "<input type='hidden' name='isedit' value='1' />";
     } else {
         echo "<b>" . _AM_SETEXPDATETIME . "</b><br /><br />";
         printf(_AM_CURRENTTIME, formatTimestamp($time));
         echo "<br />";
     }
     echo "<br /> &nbsp; " . _AM_MONTHC . " <select name='autoexpmonth'>";
     if (isset($autoexpmonth)) {
         $autoexpmonth = intval($autoexpmonth);
     } elseif (isset($expired)) {
         $autoexpmonth = date('m', $expired);
     } else {
         $autoexpmonth = date('m');
         $autoexpmonth = $autoexpmonth + 1;
     }
     for ($xmonth = 1; $xmonth < 13; $xmonth++) {
         if ($xmonth == $autoexpmonth) {
             $sel = 'selected="selected"';
         } else {
             $sel = '';
         }
         echo "<option value='{$xmonth}' {$sel}>{$xmonth}</option>";
     }
     echo "</select>&nbsp;";
     echo _AM_DAYC . " <select name='autoexpday'>";
     if (isset($autoexpday)) {
         $autoexpday = intval($autoexpday);
     } elseif (isset($expired)) {
         $autoexpday = date('d', $expired);
     } else {
         $autoexpday = date('d');
     }
     for ($xday = 1; $xday < 32; $xday++) {
         if ($xday == $autoexpday) {
             $sel = 'selected="selected"';
         } else {
             $sel = '';
         }
         echo "<option value='{$xday}' {$sel}>{$xday}</option>";
     }
     echo "</select>&nbsp;";
     echo _AM_YEARC . " <select name='autoexpyear'>";
     if (isset($autoexpyear)) {
         $autoyear = intval($autoexpyear);
     } elseif (isset($expired)) {
         $autoexpyear = date('Y', $expired);
     } else {
         $autoexpyear = date('Y');
     }
     $cyear = date('Y');
     for ($xyear = $autoexpyear - 8; $xyear < $cyear + 2; $xyear++) {
         if ($xyear == $autoexpyear) {
             $sel = 'selected="selected"';
         } else {
             $sel = '';
         }
         echo "<option value='{$xyear}' {$sel}>{$xyear}</option>";
     }
     echo "</select>";
     echo "&nbsp;" . _AM_TIMEC . " <select name='autoexphour'>";
     if (isset($autoexphour)) {
         $autoexphour = intval($autoexphour);
     } elseif (isset($expired)) {
         $autoexphour = date('H', $expired);
     } else {
         $autoexphour = date('H');
     }
     for ($xhour = 0; $xhour < 24; $xhour++) {
         if ($xhour == $autoexphour) {
             $sel = 'selected="selected"';
         } else {
             $sel = '';
         }
         echo "<option value='{$xhour}' {$sel}>{$xhour}</option>";
     }
     echo "</select>";
     echo " : <select name='autoexpmin'>";
     if (isset($autoexpmin)) {
         $autoexpmin = intval($autoexpmin);
     } elseif (isset($expired)) {
         $autoexpmin = date('i', $expired);
     } else {
         $autoexpmin = date('i');
     }
     for ($xmin = 0; $xmin < 61; $xmin++) {
         if ($xmin == $autoexpmin) {
             $sel = 'selected="selected"';
         } else {
             $sel = '';
         }
         $xxmin = $xmin;
         if ($xxmin < 10) {
             $xxmin = "0{$xmin}";
         }
         echo "<option value='{$xmin}' {$sel}>{$xxmin}</option>";
     }
     echo "</select><br /><br />";
     if (isset($this->published) && $this->published == 0 && isset($this->type) && $this->type == "user") {
         echo "<div><input type='checkbox' name='approved' value='1' checked='checked'>&nbsp;<b>" . _AM_APPROVE . "</b></div><br />";
     }
     echo "<br /><div><input type='checkbox' name='nosmiley' value='1'";
     if (isset($this->nosmiley) && $this->nosmiley == 1) {
         echo " checked='checked'";
     }
     echo " /> <b>" . _WFS_DISAMILEY . "</b></div>";
     echo "<div><input type='checkbox' name='nohtml' value='1'";
     if (isset($this->nohtml) && $this->nohtml == 1) {
         echo " checked='checked'";
     }
     echo " /> <b>" . _WFS_DISHTML . "</b><br />";
     echo "</div><br />";
     if (isset($isedit) && $isedit == 1) {
         echo "<input type='checkbox' name='movetotop' value='1'";
         if (isset($movetotop) && $movetotop == 1) {
             echo " checked='checked'";
         }
         echo " />&nbsp;<b>" . _AM_MOVETOTOP . "</b><br />";
     }
     echo "<br /><div><input type='checkbox' name='justhtml' value='2'";
     if (isset($this->htmlpage) && $this->ishtml == '2') {
         echo " checked='checked'";
     }
     echo " />" . _AM_JUSTHTML . "<br /></div>";
     echo "<div><input type='checkbox' name='noshowart' value='1'";
     if (isset($this->noshowart) && $this->noshowart == 1) {
         echo " checked='checked'";
     }
     echo " /> " . _AM_NOSHOART . "<br />";
     echo "</div><br />";
     echo "<input type='checkbox' name='offline' value='1'";
     if (isset($this->offline) && $this->offline == 1) {
         echo " checked='checked'";
     }
     echo " />&nbsp;" . _AM_OFFLINE . "<br />";
     echo "<br />";
     if (!empty($this->articleid)) {
         echo "<input type='hidden' name='articleid' value='" . $this->articleid . "' />\n";
     }
     if (!empty($HTTP_POST_VARS['referer'])) {
         echo "<input type='hidden' name='referer' value='" . $HTTP_POST_VARS['referer'] . "' />\n";
     } elseif (!empty($HTTP_SERVER_VARS['HTTP_REFERER'])) {
         echo "<input type='hidden' name='referer' value='" . $HTTP_SERVER_VARS['HTTP_REFERER'] . "' />\n";
     }
     echo "<input type='submit' name='op' class='formButton' value='Preview' />&nbsp;<input type='submit' name='op' class='formButton' value='Save' />&nbsp;<input type='submit' name='op' class='formButton' value='Clean' />";
     echo "</form>";
     echo "</td></tr></table>";
     if (!empty($this->articleid)) {
         echo "<hr />";
         $upload = new UploadFile();
         echo $upload->formStart("index.php?op=fileup");
         echo "<h4>" . _WFS_FILEUPLOAD . "</h4>\n";
         echo "" . _WFS_ATTACHFILEACCESS . "<br />";
         echo "<br /><b>" . _WFS_ATTACHFILE . "</b><br />";
         echo $upload->formMax();
         echo $upload->formField();
         echo "<br /><br /><b>" . _WFS_FILESHOWNAME . "</b><br />";
         echo "<input type='text' name='fileshowname' id='fileshowname' value='";
         if (isset($this->fileshowname)) {
             echo $this->fileshowname;
         }
         echo "' size='70' maxlength='80' /><br />";
         echo "<br /><b>" . _WFS_FILEDESCRIPT . "</b><br />";
         echo "<textarea name='textfiledescript' cols='50' rows='5'></textarea><br />";
         echo "<br /><b>" . _WFS_FILETEXT . "</b><br />";
         echo "<textarea name='textfilesearch' cols='50' rows='3'></textarea><br />";
         echo "<input type='hidden' name='groupid' value='" . $this->groupip . "' />";
         echo "<input type='hidden' name='articleid' value='" . $this->articleid . "' />";
         echo "<input type='hidden' name='groupid' value= '" . $this->groupid . "' />";
         echo $upload->formSubmit(_WFS_UPLOAD);
         echo $upload->formEnd();
     }
 }
Example #3
0
	function getNicePathToPid($funcURL) {
	        if ( $this->pid() != 0) {
        	        $xt = new WfsCategory($this->pid());
        	        $ret = $xt->getNicePathToPid($funcURL).
        	                " >> <a href='".$funcURL.$this->pid()."'>".$xt->title()."</a>";
        	        return $ret;
        	} else  {
        	        return "";
        	}
	}
Example #4
0
function editCategoryForm($id=0) {

//      global $xoopsConfig, $wfsConfig, $modify, $xoopsUser;
		global $xoopsConfig, $wfsConfig, $xoopsUser;

		$modify = 0;
		if ( isset($_POST['modify']) )
		{
			$modify = intval($_POST['modify']);
		}

		$xt = new WfsCategory($id);        

		if (!isset($xt->imgurl)) $xt->imgurl = 'blank.gif';
		include_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php';
		
		if ($id) {
			$sform = new XoopsThemeForm(_AM_MODIFYCATEGORY, "op", xoops_getenv('PHP_SELF'));
		} else {
			$sform = new XoopsThemeForm(_AM_ADDMCATEGORY, "op", xoops_getenv('PHP_SELF'));
		}
		
		//if ( $xoopsUser->uid() == 1 ) {
		//	if ($modify) {
		//		$sform->addElement(new XoopsFormSelectGroup(_WFS_GROUPPROMPT, 'editaccess', true, getGroupIda($xt->editaccess), 5, true));
		//	}else{
		//		$sform->addElement(new XoopsFormSelectGroup(_WFS_GROUPPROMPT, 'editaccess', true, true, 5, true));
		//	}
		//}
		
		if ($modify) {
			$sform->addElement(new XoopsFormSelectGroup(_WFS_GROUPPROMPT, 'groupid', true, getGroupIda($xt->groupid), 5, true));
		}else{
			$sform->addElement(new XoopsFormSelectGroup(_WFS_GROUPPROMPT, 'groupid', true, true, 5, true));
		}
		if (!$modify) $xt->orders = '1';
		$sform->addElement(new XoopsFormText(_AM_CATEGORYWEIGHT, 'orders', 10, 80, $xt->orders), false);
		$sform->addElement(new XoopsFormText(_AM_CATEGORYNAME, 'title', 50, 80, $xt->title()), true);
		
		ob_start();
		$sform->addElement(new XoopsFormHidden('pid', 0));
		if ($id) {
			$xt->makeSelBox(1, $xt->pid(), "pid");
		}else{
			$xt->makeSelBox(1, 0, "pid");
		}
		if ($id) {
			$sform->addElement(new XoopsFormLabel(_AM_MOVETO, ob_get_contents()));
		}else{
			$sform->addElement(new XoopsFormLabel(_AM_IN, ob_get_contents()));
		}
		
		ob_end_clean();
		
		$graph_array =& XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH."/".$wfsConfig['sgraphicspath']);
		$indeximage_select = new XoopsFormSelect('', 'indeximage', $xt->imgurl);
		$indeximage_select->addOptionArray($graph_array);

// Section Image can't display
//		$indeximage_select->setExtra("onchange='showImgSelected(\"image\", \"indeximage\", \"".$wfsConfig['sgraphicspath']."\", \"\")'");
$xoops_url = $xoopsConfig['xoops_url'];
$indeximage_select->setExtra("onchange='showImgSelected(\"image\",\"indeximage\", \"".$wfsConfig['sgraphicspath']."\",\"\", \"$xoops_url\")'");

		$indeximage_tray = new XoopsFormElementTray(_AM_CATEGORYIMG, '&nbsp;');
		$indeximage_tray->addElement($indeximage_select);
		$indeximage_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='".$xoopsConfig['xoops_url']."/". $wfsConfig['sgraphicspath']."/".$xt->imgurl."' name='image' id='image' alt='' />" ));
		$sform->addElement($indeximage_tray);

		if (!isset($xt->displayimg)) $xt->displayimg = '0';		
		$submenus_radio = new XoopsFormRadioYN(_AM_SHOWCATEGORYIMG, 'displayimg', $xt->displayimg, ' Yes', ' No');
		$sform->addElement($submenus_radio);
		
		$sform->addElement(new XoopsFormTextArea(_AM_CATEGORYDESC, 'description', $xt->description("E")), false);
		$sform->addElement(new XoopsFormDhtmlTextArea(_WFS_CATEGORYHEAD, 'catdescription', $xt->catdescription("E"), 10, 60), false);
		$sform->addElement(new XoopsFormTextArea(_WFS_CATEGORYFOOT, 'catfooter', $xt->catfooter("E"), 10, 60), false);

		$button_tray = new XoopsFormElementTray('','');
		if ($id) {
			$button_tray->addElement(new XoopsFormHidden('id', $id));
			$button_tray->addElement(new XoopsFormButton('', 'save', _AM_SAVECHANGE, 'submit'));
			$button_tray->addElement(new XoopsFormButton('', 'delete', _AM_DEL, 'submit'));
		} else {
			$button_tray->addElement(new XoopsFormButton('', 'save', _AM_ADD, 'submit'));
		}
		$sform->addElement($button_tray);
		$sform->display();
		
}
Example #5
0
function listArticle($catid, $start = 0, $num = 20) 
{
	global $xoopsDB, $orderby, $xoopsConfig, $xoopsUser, $xoopsModule, $wfsConfig, $myts, $counter, $mydownloads_popular, $dataselect;
	
	global $wfsModule;	// add
	
	$xt = new WfsCategory($catid);
 
	if (file_exists(XOOPS_ROOT_PATH . "/" . $wfsConfig['sgraphicspath'] . "/" . $xt->imgurl) && $xt->imgurl !='blank.gif' ) {
		$image = "<img src='" . XOOPS_URL . "/" . $wfsConfig['sgraphicspath'] . "/" . $xt->imgurl("S") . "'>";
	} else {
		if ($xoopsUser && $xoopsUser->isAdmin($xoopsModule->mid()) && $xt->imgurl !='blank.gif') {

// multi language
//			$image = "ERROR: Please check path/file for image";
			$image = "<font color=red>"._WFS_ERROR_IMAGE."</font>";

		} else {
			$image = '';
		} 
	} 

	$title = $xt->title() ;
	$catdescription = $xt->catdescription('S');

	echo "<table border='0' cellpadding='2' cellspacing='1' valign='top' align = 'center' width = '100%'>";
	if ((!empty($xt->imgurl) && $xt->displayimg == 1)) {
		echo "<tr><td colspan='5' align='center'>".$image."</td></tr>\n";
	} 
	echo "<tr><td colspan='5' align='center'>&nbsp;</td></tr>\n";
	echo "<tr><td colspan='5' align='center'><h3>".$title."</h3></td></tr>\n";
	
	echo "<tr><td>";
	// -- Skalpack2 [start]

// easy to rename module and table
//	$jump = XOOPS_URL."/modules/wfsection/index.php?";
	$jump = XOOPS_URL."/modules/$wfsModule/index.php?";

	$tree = new wfsTree($xt->table, "id", "pid");
	switch ($wfsConfig['aidxpathtype']) {
	case 1:	// Local selectbox
		$tree->makeMyRootedSelBox('title', 'title', $xt->id, true, $xt->id, true, "", "location.href='{$jump}category='+this.options[this.selectedIndex].value");
		break;
	case 2:	// Linked path

// BUG 217: category link is wrong
//		echo preg_replace('/&id=/', '&category=', $tree->getNicePathFromId($xt->id, "title", $jump));
		echo preg_replace('/&amp;id=/', '&category=', $tree->getNicePathFromId($xt->id, "title", $jump));

		break;
	case 3: // Path and local select box

// BUG 217: category link is wrong
//		echo preg_replace('/&id=/', '&category=', $tree->getNicePathFromId($xt->pid, "title", $jump));
		echo preg_replace('/&amp;id=/', '&category=', $tree->getNicePathFromId($xt->pid, "title", $jump));

// bug fix: it can't jump at Path and local select box
//		$tree->makeMySelBox('title', 'title', $xt->id, true, $xt->id, true, "", "location.href='{$jump}category='+this.options[this.selectedIndex].value");
		$tree->makeMyRootedSelBox('title', 'title', $xt->id, true, $xt->id, true, "", "location.href='{$jump}category='+this.options[this.selectedIndex].value");

		break;
	case 4:	// None
		break;
	case 0: // Full selectbox
	default:
		$xt->makeSelBox(1, $xt->id, "pid", "location.href='{$jump}category='+this.options[this.selectedIndex].value")."";
		break;
	}
// -- Skalpack2 [/end]	echo "</td></td>";
	
	echo "<tr><td colspan='5'><br />$catdescription<br /></td></tr>\n";
	echo "<tr><td colspan='5'>&nbsp;</td></tr>\n";
	echo "</table>\n";
				
	$sarray = WfsArticle::getAllArticle($num, $start, $catid, $dataselect='4');
	$articlecount = WfsArticle::countByCategory($catid);
	echo "<table border='0' cellpadding='2' cellspacing='1' width = '100%' class= 'outer'>";
	If ($articlecount != 0) {
		
		echo "<tr align='left'>"; 
		// These will always be shown
		echo "<td align='left' width = '30%' class='itemHead'><b>" . _WFS_ARTICLE . "</b></td>";
		if ($wfsConfig['summary']) {
			echo "<td align='left' width = '50%' class='itemHead'><b>" . _WFS_SUMMARY . "</b></td>"; 
		}
		// You can choose which of these to show
		if ($wfsConfig['showauthor']) 
		   echo "<td align='center' class='itemHead'><b>" . _WFS_AUTH . "</b></td>";
		if ($wfsConfig['showhits']) echo "<td align='center' class='itemHead'><b>" . _WFS_HITS . "</b></td>";
		if ($wfsConfig['showcomments']) { 
			if ($wfsConfig['comments']) echo "<td align='center' class='itemHead'><b>" . _WFS_COMMENT . "</b></td>";
		}
		if ($wfsConfig['showfile']) echo "<td align='center' class='itemHead'><b>" . _WFS_FILES . "</b></td>";
		if ($wfsConfig['novote']) {
			if ($wfsConfig['showrated']) echo "<td align='center' class='itemHead'><b>" . _WFS_RATED . "</b></td>";
		}
		if ($wfsConfig['novote']) {
			if ($wfsConfig['showvotes']) echo "<td align='center' class='itemHead'><b>" . _WFS_VOTES . "</b></td>";
		}
		if ($wfsConfig['showupdated']) echo "<td align='center' class='itemHead'><b>" . _WFS_PUBLISHEDHOME . "</b></td>";
		echo "</tr>\n";

		foreach ($sarray as $article) {
			$counter = $article->counter();
			$time = $article->created();
			$stat = $article->changed();
			$articlelink = "<a href='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/article.php?articleid=" . $article->articleid() . "'>";
			if ($wfsConfig['picon']) {
				$articlelink .= "".$article->iconLink("S") . "</a>";
			} else {
				$articlelink .= "".$article->textLink("S") . "</a>";
			}
			
			$summary = $article->summary();
			$published = formatTimestamp($article->published(), $wfsConfig['timestamp']);
			$counter = $article->counter();
			if ($wfsConfig['comments']) $commentcount = $article->getCommentsCount();
			$attachedfiles = $article->getFilesCount();
			
			if ($article->uid > 0) {
				$user = new xoopsUser($article->uid);
				if (($wfsConfig['realname']) && $user->getvar('name')) {
						$username = $user->getvar('name');
					} else {
				   		$username = $user->getvar('uname');
					} 
				$username = "******".XOOPS_URL."/userinfo.php?uid=".$article->uid()."'>".$username."</a>";
			} else {
				$username = $GLOBALS['xoopsConfig']['anonymous'];
			}
						
			//$username = "******" . XOOPS_URL . "/userinfo.php?uid=" . $article->uid() . "'>" . $article->uname() . "</a>";
			if ($wfsConfig['novote']) $rating = number_format($article->rating, 2);
			$groupid = $article->groupid;
			if ($wfsConfig['novote']) $votes = $myts->makeTboxData4Show($article->votes) ;
			$status = 1;
			$orderbyTrans = convertorderbytrans($orderby);

			if ($stat != $time) $status = 2;
			if (checkAccess($groupid)) {
			
				echo "<tr><td valign='top' class='even'>$articlelink";
				if ($wfsConfig['noicons']) { 
				popgraphic($counter);
				newdownloadgraphic($time, $status);
				}
				echo "</td>";
				if ($wfsConfig['summary']) echo "<td valign='top' class='even'>$summary</td>";
				if ($wfsConfig['showauthor']) echo "<td align='center'  valign='top' class='even' nowrap='nowrap'>$username</td>";
				if ($wfsConfig['showhits']) echo "<td align='center'  valign='top' class='even'>$counter</td>";
				//if ($wfsConfig['comments']) {
				if ($wfsConfig['showcomments']) { 
					if ($wfsConfig['comments']) echo "<td align='center'  valign='top' class='even'>$commentcount</td>";
				}
				if ($wfsConfig['showfile']) echo "<td align='center'  valign='top' class='even'>$attachedfiles</td>";
				if ($wfsConfig['novote']) {
					if ($wfsConfig['showrated']) echo "<td align='center'  valign='top' class='even'>$rating</td>";
					if ($wfsConfig['showvotes']) echo "<td align='center'  valign='top' class='even'>$votes</td>";
				}
				if ($wfsConfig['showupdated']) {
					echo "<td align='center' nowrap='nowrap' valign='top' class='even'>$published</td></tr>\n";
				} 
			} 
		} //end check access
	} 
	echo "</table>\n";

	if ($articlecount > $num) {
		echo "<table border='0' width='100%' cellpadding='0' cellspacing='0' align='center' valign='top'><tr><td align='center'>";

// take over the order to previos and next page
//		if ($articlecount < $start + $num) echo "<a href='index.php?category=" . $catid . "&amp;start=" . ($start - $num) . "'>" . _WFS_PREVPAGE . "</a>&nbsp;";
//		if ($articlecount > $start + $num) echo "<a href='index.php?category=" . $catid . "&amp;start=" . ($start + $num) . "'>" . _WFS_NEXTPAGE . "</a>&nbsp;";

		$orderbyOut = convertorderbyout($orderby);
		if ($articlecount < $start + $num) echo "<a href='index.php?category=" . $catid . "&amp;start=" . ($start - $num) . "&amp;orderby=" . $orderbyOut . "'>" . _WFS_PREVPAGE . "</a>&nbsp;";
		if ($articlecount > $start + $num) echo "<a href='index.php?category=" . $catid . "&amp;start=" . ($start + $num) . "&amp;orderby=" . $orderbyOut . "'>" . _WFS_NEXTPAGE . "</a>&nbsp;";

// BUG 8186: page number is displayed too many
//		for($i = 0, $j = 1; $i <= $articlecount; $i += $num, $j++) 
		for($i = 0, $j = 1; $i < $articlecount; $i += $num, $j++) 

		{
			if (($i <= $start) && ($start < ($i + $num))) {
				echo $j . "&nbsp;";
			} else {

// take over the order to previos and next page
//				echo "<a href='index.php?category=" . $catid . "&amp;start=" . ($i) . "'>" . ($j) . "</a>&nbsp;";
				echo "<a href='index.php?category=" . $catid . "&amp;start=" . ($i) . "&amp;orderby=" . $orderbyOut . "'>" . ($j) . "</a>&nbsp;";

			} 
		} 
		echo "</td></tr></table>\n";
	} 

	echo "<table cellpadding='2' cellspacing='1' width='100%'>";
	if ($xt->catfooter)
	{
		echo "<tr><td><br />\n";
		echo $xt->catfooter('S') . "<br /><br />\n";
		echo "</td></tr>\n";
	}
	echo "</table>\n";

	echo "<table border='0' cellpadding='1' cellspacing='1' width='100%'>";
	if (!$xt->catfooter) echo "<br />";
	echo "<tr><td align='center' class='head' >[ <a href='javascript:history.back(1)'>" . _WFS_BACK2 . "</a> | <a href='./index.php'>" . _WFS_RETURN2INDEX . "</a> ]</a></td></tr>\n";
	echo "</table>\n";
	echo "<br />";

	if (($articlecount > 0)) {
		echo "<table border='0' cellpadding='1' cellspacing='1' width='100%' class = 'outer'>";
		echo "<tr><td align='center' class='even'>";
		$orderbyTrans = convertorderbytrans($orderby);

// BUG 7854: redundant samll tag
//		echo "<small><center>" . _WFS_SORTBY1 . "&nbsp;";
		echo "<center>" . _WFS_SORTBY1 . "&nbsp;";

       	echo "  " . _WFS_TITLE1 . " (<a href='index.php?category=$catid&orderby=titleA'><img src='images/up.gif' border='0' align='middle' alt='' /></a><a href='index.php?category=$catid&orderby=titleD'><img src='images/down.gif' border='0' align='middle' alt='' /></a>)";
       	echo "  " . _WFS_DATE1 . " (<a href='index.php?category=$catid&orderby=createdA'><img src='images/up.gif' border='0' align='middle' alt='' /></a><a href='index.php?category=$catid&orderby=createdD'><img src='images/down.gif' border='0' align='middle' alt='' /></a>)";
	    echo "  " . _WFS_WEIGHT . " (<a href='index.php?category=$catid&orderby=weight'>Reset</a>)";

      	if ($wfsConfig['novote']) {
		echo "	" . _WFS_RATING1 . " (<a href='index.php?category=$catid&orderby=ratingA'><img src='images/up.gif' border='0' align='middle' alt='' /></a><a href=index.php?category=$catid&orderby=ratingD><img src='images/down.gif' border='0' align='middle' alt='' /></a>)";
       	}
		echo "	" . _WFS_POPULARITY1 . " (<a href='index.php?category=$catid&orderby=counterA'><img src='images/up.gif' border='0' align='middle' alt='' /></a><a href='index.php?category=$catid&orderby=counterD'><img src='images/down.gif' border='0' align='middle' alt='' /></a>)";
       
		echo "<br /><b><small>";
		printf(_WFS_CURSORTBY1, $orderbyTrans);
		$orderby = convertorderbyout($orderby);
		echo "</small></b></center>";
		echo "</td></tr></table>\n";
	} 

} 
Example #6
0
    default:
        xoops_cp_header();
        echo "<div><h4>" . _AM_ARTICLEMANAGEMENT . "</h4></div>";
        adminmenu();
        echo "<table width='100%' border='0' cellpadding = '1' cellspacing='0' class='outer'>";
        echo "<tr class = 'even'><td>";
        echo "<div><a href='allarticles.php?action=all'>" . _AM_ALLARTICLES . "</a></div>";
        echo "<div><a href='allarticles.php?action=published'>" . _AM_PUBLARTICLES . "</a></div>";
        echo "<div><a href='allarticles.php?action=autoart'>" . _AM_AUTOARTICLES . "</a><div>";
        echo "<div><a href='allarticles.php?action=expired'>" . _AM_EXPIREDARTICLES . "</a><div>";
        echo "<div><a href='allarticles.php?action=autoexpire'>" . _AM_AUTOEXPIREARTICLES . "</a><div>";
        echo "<div><a href='allarticles.php?action=submitted'>" . _AM_SUBLARTICLES . "</a><div>";
        echo "<div><a href='allarticles.php?action=online'>" . _AM_ONLINARTICLES . "</a><div>";
        echo "<div><a href='allarticles.php?action=offline'>" . _AM_OFFLIARTICLES . "</a><div>";
        echo "</td></tr></table><br>";
        if (WfsCategory::countByArticle() > 0) {
            echo "<table width='100%' border='0' cellspacing='1' cellpadding = '2' class='outer'><tr>";
            echo "<td class='even'>";
            echo "<div class= 'bg3'><h4>" . _AM_POSTNEWARTICLE . "</h4></div>";
            $article = new WfsArticle();
            $article->editform();
            echo "</td></tr></table>";
        } else {
            echo "<table width='100%' border='0' cellspacing='1' class='outer'><tr><td class='odd'>";
            echo "<h4>" . _AM_NOCATEGORY . "</h4>";
            echo "<div><b><a href='category.php?op=default'>" . _AM_CATEGORYTAKEMETO . "</a></b></div>";
            echo "</td></tr></table>";
        }
        wfsfooter();
        break;
}
Example #7
0
function register_form() 
{
	global $xoopsModule, $xoopsConfig;

	echo "<table width='100%' border='0' cellspacing='0' cellpadding='1'>\n";
        echo "<form action='import.php' method='post' name='coolsus'>\n";

	echo "<div><b>"._WFS_CATEGORY."</b><br>";
        $xt = new WfsCategory();
	$xt->makeSelBox(0, 0, "categoryid");
        echo "</div><br />\n";

	$dir = XOOPS_ROOT_PATH;
	echo "<b>"._AM_IMPORT_DIRNAME."</b><br>";
	echo "<input type='text' name='dir_src' size='70' value=$dir><br><br>\n";

	echo "<b>"._AM_IMPORT_HTMLPROC."</b><br><br>";
	echo _AM_IMPORT_EXTFILTER."<br>";
	echo "<input type='text' name='filter' size='70'><br><br>\n";

// multi language
// bug fix : japanese -> 'japanese'
	if ($xoopsConfig['language'] == 'japanese')
	{	echo _AM_IMPORT_CHARCONV."<br>\n";
		echo "<input type='radio' name='charset' value='0'> ";
		echo _AM_IMPORT_CHARNON."<br>\n";
		echo "<input type='radio' name='charset' value='1' checked> ";
		echo _AM_IMPORT_CHARAUTO."<br>\n";
		echo "<input type='radio' name='charset' value='2'> ";
		echo _AM_IMPORT_CHARFORCE."<br>\n";
		echo "<br>\n";
	}
	else
	{	echo "<input type='hidden' name='charset' value='0'> ";
	}

	echo "<input type='checkbox' name='html' checked> ";
	echo _AM_IMPORT_BODY."<br>\n";

	echo "<input type='checkbox' name='index' checked> ";
	echo _AM_IMPORT_INDEXHTML."<br>\n";

	echo "<input type='checkbox' name='link' checked> ";
	echo _AM_IMPORT_LINK."<br>\n";

	echo "<input type='checkbox' name='image' checked> ";
	echo _AM_IMPORT_IMAGE."<br>\n";

	echo "<input type='checkbox' name='atmark' checked> ";
	echo _AM_IMPORT_ATMARK."<br><br>\n";
	
	echo "<b>"._AM_IMPORT_TEXTPROC."</b><br>";
	echo "<input type='checkbox' name='text' checked> ";
	echo _AM_IMPORT_TEXTPRE."<br><br>\n";

	echo "<b>"._AM_IMPORT_IMAGEPROC."</b><br><br>";
	$dir = '/modules/'.$xoopsModule->dirname().'/images/contents';
	echo _AM_IMPORT_IMAGEDIR."<br>";
	echo XOOPS_ROOT_PATH."<input type='text' name='dir_image' size='50' value=$dir><br><br>\n";

	echo "<input type='checkbox' name='image_copy' checked> ";
	echo _AM_IMPORT_IMAGECOPY."<br><br>\n";

	echo "<b>"._AM_IMPORT_TESTMODE."</b><br>";
	echo _AM_IMPORT_TESTDB."<br>";
	echo "<input type='checkbox' name='test' checked> ";
	echo _AM_IMPORT_TESTEXEC."<br>\n";
	echo "<input type='checkbox' name='test_text' checked> ";
	echo _AM_IMPORT_TESTTEXT."<br><br>\n";

	if(!empty($_POST['referer']))
	{	echo "<input type='hidden' name='referer' value='".$_POST['referer']."' >\n";	}
	elseif (!empty($_SERVER['HTTP_REFERER']))
	{	echo "<input type='hidden' name='referer' value='".$_SERVER['HTTP_REFERER']."' >\n";	}

	echo "<input type='submit' name='op' class='formButton' value='Save' />";
	echo "</form>";
	
	echo "<hr><br>";
	echo _AM_IMPORT_EXPLANE;

	echo "</td></tr></table>";
}