DB_query("INSERT INTO {$_FM_TABLES['filemgmt_votedata']} " . "(lid, ratinguser, rating, ratinghostname, ratingtimestamp) " . "VALUES ('{$lid}', '{$ratinguser}', '{$rating}', '{$ip}', '{$datetime}')"); //All is well. Calculate Score & Add to Summary (for quick retrieval & sorting) to DB. updaterating($lid); $ratemessage = _MD_VOTEAPPRE . "<br>" . sprintf(_MD_THANKYOU, $_CONF[site_name]); redirect_header("index.php", 4, $ratemessage); exit; } else { $lid = 0; if (isset($_GET['lid'])) { $lid = COM_applyFilter($_GET['lid'], true); } $display = ''; $display .= COM_startBlock("<b>" . _MD_RATEFILETITLE . "</b>"); $result = DB_query("SELECT title FROM {$_FM_TABLES['filemgmt_filedetail']} WHERE lid='{$lid}'"); list($title) = DB_fetchArray($result); $title = $myts->makeTboxData4Show($title); $display .= '<table border="0" cellpadding="1" cellspacing="0" width="80%" class="plugin"><tr>'; $display .= '<td class="pluginHeader">' . _MD_FILE . ': ' . $title . '</td></tr>'; $display .= '<tr><td style="padding:10px;"><ul>'; $display .= '<li>' . _MD_VOTEONCE . '</li>'; $display .= '<li>' . _MD_RATINGSCALE . '</li>'; $display .= '<li>' . _MD_BEOBJECTIVE . '</li>'; $display .= '<li>' . _MD_DONOTVOTE . '</li>'; $display .= "\n </ul></td></tr><tr><td style=\"text-align:center;\">\n <form method=\"post\" action=\"ratefile.php\"><div>\n <input type=\"hidden\" name=\"lid\" value=\"{$lid}\"" . XHTML . ">\n <select name=\"rating\"><option>--</option>"; for ($i = 10; $i > 0; $i--) { $display .= "<option value=\"" . $i . "\">" . $i . "</option>\n"; } $display .= "</select><br" . XHTML . "><br" . XHTML . ">"; $display .= "<input type=\"submit\" name=\"submit\" value=\"" . _MD_RATEIT . "\"" . XHTML . ">\n"; $display .= " <input type=\"button\" value=\"" . _MD_CANCEL; $display .= "\" onclick=\"javascript:history.go(-1)\"" . XHTML . ">\n";
list($fileAccessCnt) = DB_fetchArray(DB_query($sql)); if ($fileAccessCnt > 0 and DB_count($_FM_TABLES['filemgmt_filedetail'], "lid", $lid) == 1) { $p->set_var('block_header', COM_startBlock("<b>" . $LANG_FILEMGMT['plugin_name'] . "</b>")); $p->set_var('block_footer', COM_endBlock()); require_once $_CONF['path_system'] . 'lib-comment.php'; $sql = "SELECT d.lid, d.cid, d.title, d.url, d.homepage, d.version, d.size, d.logourl, d.submitter, d.status, d.date, "; $sql .= "d.hits, d.rating, d.votes, d.comments, t.description FROM {$_FM_TABLES['filemgmt_filedetail']} d, "; $sql .= "{$_FM_TABLES['filemgmt_filedesc']} t WHERE d.lid='{$lid}' AND d.lid=t.lid AND status > 0"; $result = DB_query($sql); list($lid, $cid, $dtitle, $url, $homepage, $version, $size, $logourl, $submitter, $status, $time, $hits, $rating, $votes, $comments, $description) = DB_fetchArray($result); $pathstring = '<a href="' . $_CONF['site_url'] . '/filemgmt/index.php">' . _MD_MAIN . '</a> : '; $nicepath = $mytree->getNicePathFromId($cid, "title", "{$_CONF['site_url']}/filemgmt/viewcat.php"); $pathstring .= $nicepath; $p->set_var('category_path_link', $pathstring); $rating = number_format($rating, 2); $dtitle = $myts->makeTboxData4Show($dtitle); $url = $myts->makeTboxData4Show($url); $homepage = $myts->makeTboxData4Show($homepage); $version = $myts->makeTboxData4Show($version); $size = $myts->makeTboxData4Show($size); $platform = $myts->makeTboxData4Show($platform); $logourl = $myts->makeTboxData4Show($logourl); $datetime = formatTimestamp($time); $description = $myts->makeTareaData4Show($description, 0); //no html $result2 = DB_query("SELECT username,fullname,photo FROM {$_TABLES['users']} WHERE uid = {$submitter}"); list($submitter_name, $submitter_fullname, $photo) = DB_fetchArray($result2); $submitter_name = COM_getDisplayName($submitter, $submitter_name, $submitter_fullname); include $_CONF['path_html'] . '/filemgmt/include/dlformat.php'; $p->set_var('cssid', 1); $p->parse('filelisting_records', 'records');
/** * * * @param string $text * @param array $glossaryterms * @param bool $html allow html? * @return string **/ function getLinkedText( $text, $glossaryterms, $html ,$addtext ) { #### matching #### $count = 0; $count = count( $glossaryterms ); if ($count > 0 && is_array($glossaryterms)) { if (!$html) { $text = parent::htmlSpecialChars( $text ); } $q_arr = array(); $parts = array(); $text2 = array(); $text3 = ""; list($spatternf,$spatterne) = explode(",",$this->getModuleConfig("spattern")); $parts = explode(">", $text); foreach($parts as $key=>$part) { for ( $i = 0; $i < $count; $i++ ) { foreach($glossaryterms[$i]['list'] as $md) { $q_arr1 = array(); $q_arr2 = array(); $q_arr3 = array(); $search_term = array(); $replace_term = $pattern = ""; $title = $md['title']; if (!$md['title']) { continue; } if (!$html) { $title = $md['title'] = parent::htmlSpecialChars( $md['title'] ); } if (!$md['image']) { $image_url = XOOPS_URL.'/images/icons/posticon2.gif'; } else { $image_url = XOOPS_URL."/modules/".$glossaryterms[$i]['mod']."/".$md['image']; } $title = '<a href="'.XOOPS_URL.'/modules/'.$glossaryterms[$i]['mod'].'/'.$md['link'].'" title="'.parent::makeTboxData4Show($this->getModuleConfig("linktermstitle")).$glossaryterms[$i]['name'].'"><img src="'.$image_url.'" width="21" height="21" alt="'.parent::makeTboxData4Show($this->getModuleConfig("linktermstitle")).$glossaryterms[$i]['name'].'" />'.$title.'</a>'; $md['title'] = preg_quote($md['title'],"/"); // if (_CHARSET =="EUC-JP") if ($spatternf && $spatterne) { // $search_term[] = $pattern = "/(\xA1[\xAE\xC6\xC8\xCC\xCE\xD0\xD2\xD4\xD6\xD8\xDA])(".$md['title'].")(\xA1[\xAD\xC7\xC9\xCD\xCF\xD1\xD3\xD5\xD7\xD9\xDB])/i"; $search_term[] = $pattern = "/($spatternf)(".$md['title'].")($spatterne)/i"; if (preg_match($pattern,$parts[$key])) { $text2[] = $title; } } if (preg_match('/^[\x20-\x7e]+$/',$md['title'])) { $md['title'] = $md['title']."|".$md['title']."s|".$md['title']."es"; $search_term[] = $pattern = "/([\'\\\"`]|"|')(".$md['title'].")(\\1)/i"; if (preg_match($pattern,$parts[$key])) { $text2[] = $title; } } if ($this->getModuleConfig("linktermsposition")) { // $replace_term = '<a href="'.XOOPS_URL.'/modules/'.$glossaryterms[$i]['mod'].'/'.$md['link'].'"><img src="'.$image_url.'" width="21" height="21" alt="'.parent::makeTboxData4Show($this->getModuleConfig("linktermstitle")).$glossaryterms[$i]['name'].'" /></a>$1$2$3'; $replace_term = '<a href="'.XOOPS_URL.'/modules/'.$glossaryterms[$i]['mod'].'/'.$md['link'].'"><img src="'.$image_url.'" width="21" height="21" alt="'.parent::makeTboxData4Show($this->getModuleConfig("linktermstitle")).$glossaryterms[$i]['name'].'" />$2</a>'; $parts[$key] = preg_replace($search_term, $replace_term, $parts[$key]); } } } } $text = implode(">", $parts); $text2 = array_unique($text2); if ( $addtext ) { $text3 = implode(" ", $text2); $text3 = ( $text3 != "" && !$this->getModuleConfig("linktermsposition")) ? "\n<p style='clear:both;margin:4em 0em 0em 0em;'>".parent::makeTboxData4Show($this->getModuleConfig("linktermstitle")).$text3."</p>" : ""; $text = $text.$text3; } else { $text = implode(" ", $text2); } } elseif ( !$addtext ) { $text = ""; } return $text; }
$sql .= " AND grp_access IN (" . implode(',', array_values($_GROUPS)) . ") "; } $sql .= "ORDER BY cid"; $query = DB_query($sql); while (list($cid, $title, $directUploadGroup) = DB_fetchArray($query)) { $categorySelectHTML .= '<option value="' . $cid . '">'; if (!SEC_inGroup($directUploadGroup)) { $categorySelectHTML .= "{$title} *"; } else { $categorySelectHTML .= "{$title}"; } $categorySelectHTML .= "</option>\n"; $arr = $mytree->getChildTreeArray($cid); foreach ($arr as $option) { $option['prefix'] = str_replace(".", "--", $option['prefix']); $catpath = $option['prefix'] . " " . $myts->makeTboxData4Show($option[2]); $categorySelectHTML .= '<option value="' . $option[$mytree->id] . '">'; if (!SEC_inGroup($option[5])) { $categorySelectHTML .= "{$catpath} *"; } else { $categorySelectHTML .= "{$catpath}"; } $categorySelectHTML .= "</option>\n"; } } $T->set_var(array('lang_submitnotice' => _MD_SUBMITONCE, 'lang_allpending' => _MD_ALLPENDING, 'lang_dontabuse' => _MD_DONTABUSE, 'lang_takedays' => _MD_TAKEDAYS, 'lang_required' => _MD_REQUIRED, 'lang_filetitle' => _MD_FILETITLE, 'lang_filename' => _MD_DLFILENAME, 'lang_category' => _MD_CATEGORY, 'lang_approve' => _MD_APPROVEREQ, 'lang_homepage' => _MD_HOMEPAGEC, 'lang_version' => _MD_VERSIONC, 'lang_desc' => _MD_DESCRIPTIONC, 'lang_screenshot' => _MD_SHOTIMAGE, 'lang_commentoption' => _MD_COMMENTOPTION, 'lang_no' => _MD_NO, 'lang_yes' => _MD_YES, 'lang_submit' => _MD_SUBMIT, 'lang_cancel' => _MD_CANCEL, 'token_name' => CSRF_TOKEN, 'security_token' => SEC_createToken(), 'cat_select_options' => $categorySelectHTML, 'uid' => $uid)); $display .= FM_siteHeader(); $display .= COM_startBlock("<b>" . _MD_UPLOADTITLE . "</b>"); $T->parse('output', 'page'); $display .= $T->finish($T->get_var('output')); $display .= COM_endBlock();
} $orderby = convertorderbyin($orderby); $pathstring = '<a href="index.php">' . _MD_MAIN . '</a> : '; $nicepath = $mytree->getNicePathFromId($cid, "title", "{$_CONF['site_url']}/filemgmt/viewcat.php"); $pathstring .= $nicepath; $p->set_var('category_path_link', $pathstring); $p->set_var('cid', $cid); // get child category objects $subcategories = ''; $arr = array(); $arr = $mytree->getFirstChild($cid, 'title'); if (count($arr) > 0) { $count = 1; foreach ($arr as $ele) { $totalfiles = 0; $chtitle = $myts->makeTboxData4Show($ele['title']); $totalfiles = $totalfiles + getTotalItems($ele['cid'], 1); $subcategories = '<a href="' . $_CONF[site_url] . '/filemgmt/viewcat.php?cid=' . $ele['cid'] . '">' . $chtitle . '</a> (' . $totalfiles . ') '; $p->set_var('subcategories', $subcategories); $p->set_var('new_table_row', $count == 1 ? '<tr>' : ''); $p->set_var('end_of_row', $count == $numCategoriesPerRow ? '</tr>' : ''); $count = $count == $numCategoriesPerRow ? 1 : $count + 1; $p->parse('category_records', 'category', true); } } else { $p->set_var('subcategories', ''); $p->set_var('new_table_row', '<tr>'); $p->set_var('end_of_row', '</tr>'); $p->parse('category_records', 'category'); } $sql = "SELECT COUNT(*) FROM {$_FM_TABLES['filemgmt_filedetail']} a ";
if ($fileAccessCnt > 0 and DB_count($_TABLES['filemgmt_filedetail'], "lid", DB_escapeString($lid)) == 1) { $p->set_var('block_header', COM_startBlock("<b>" . $LANG_FILEMGMT['plugin_name'] . "</b>")); $p->set_var('block_footer', COM_endBlock()); USES_lib_comment(); $sql = "SELECT d.lid, d.cid, d.title, d.url, d.homepage, d.version, d.size, d.logourl, d.submitter, d.status, d.date, "; $sql .= "d.hits, d.rating, d.votes, d.comments, t.description FROM {$_TABLES['filemgmt_filedetail']} d, "; $sql .= "{$_TABLES['filemgmt_filedesc']} t WHERE d.lid='" . DB_escapeString($lid) . "' AND d.lid=t.lid AND status > 0"; $result = DB_query($sql); list($lid, $cid, $dtitle, $url, $homepage, $version, $size, $logourl, $submitter, $status, $time, $hits, $rating, $votes, $comments, $description) = DB_fetchArray($result); $display = FM_siteHeader($dtitle); $pathstring = "<a href='{$_CONF['site_url']}/filemgmt/index.php'>" . _MD_MAIN . "</a> : "; $nicepath = $mytree->getNicePathFromId($cid, "title", "{$_CONF['site_url']}/filemgmt/viewcat.php"); $pathstring .= $nicepath; $p->set_var('category_path_link', $pathstring); $rating = number_format($rating, 2); $dtitle = $myts->makeTboxData4Show($dtitle); $url = $myts->makeTboxData4Show($url); $homepage = $myts->makeTboxData4Show($homepage); $version = $myts->makeTboxData4Show($version); $size = $myts->makeTboxData4Show($size); $platform = $myts->makeTboxData4Show(isset($platform) ? $platform : ''); $logourl = $myts->makeTboxData4Show($logourl); $datetime = formatTimestamp($time); $description = PLG_replaceTags($myts->makeTareaData4Show($description, 0), 'filemgmt', 'description'); //no html $result2 = DB_query("SELECT username,fullname,photo FROM {$_TABLES['users']} WHERE uid = {$submitter}"); list($submitter_name, $submitter_fullname, $photo) = DB_fetchArray($result2); $submitter_name = COM_getDisplayName($submitter, $submitter_name, $submitter_fullname); include $_CONF['path'] . 'plugins/filemgmt/include/dlformat.php'; $p->set_var('cssid', 1); $p->parse('filelisting_records', 'records');