Esempio n. 1
0
 function renderForm()
 {
     /*
     		$template = "
     		<div class='form-group'>
             <label for='firstname' class='col-sm-3 control-label'>First Name:**</label>
             <div class='col-sm-9'>
                     <input id='firstname' class=\"form-control tbox\" type=\"text\" name=\"FIRSTNAME\" size=\"20\" maxlength=\"20\" value=\"". $_POST['FIRSTNAME']. "\" required />
             </div>
          	 </div>	";
     */
     $ns = e107::getRender();
     $tp = e107::getParser();
     $text = "<div style='text-align:center'>\n\t\t\t<form enctype='multipart/form-data' method='post' onsubmit='return frmVerify()' action='" . e_SELF . "'>\n\t\t\t<table style='" . USER_WIDTH . "' class='table fborder'>\n\t\t\t<colgroup>\n\t\t\t<col style='width:30%' />\n\t\t\t<col style='width:70%' />\n\t\t\t</colgroup>\n\t\t\t<tr>\n\t\t\t<td class='forumheader3'>" . DOWLAN_11 . ":</td>\n\t\t\t<td class='forumheader3'>";
     require_once e_CORE . "shortcodes/batch/download_shortcodes.php";
     $dlparm = isset($download_category) ? $download_category : "";
     $text .= $tp->parseTemplate("{DOWNLOAD_CATEGORY_SELECT={$dlparm}}", true, $download_shortcodes);
     //FIXME - move to e_upload.php
     $text .= "</td>\n\t\t\t</tr>\n\t\t\n\t\t\t<tr>\n\t\t\t<td style='text-align:center' class='forumheader3'>" . LAN_419 . "</td>\n\t\t\t<td class='forumheader3'>";
     //	$text .= "<b>".LAN_406."</b><br />".LAN_419.":";
     $a_filetypes = get_filetypes();
     if (count($a_filetypes) == 0) {
         $ns->tablerender(LAN_417, LAN_UL_025);
         return;
     }
     $max_upload_size = calc_max_upload_size(-1);
     // Find overriding maximum upload size
     $max_upload_size = set_max_size($a_filetypes, $max_upload_size);
     if (ADMIN) {
         $upper_limit = calc_max_upload_size();
         $allowed_filetypes = "<table class='table table-striped table-bordered'><tr><th class='text-center'>" . LAN_UL_023 . "&nbsp;&nbsp;</th><th style='text-align:right'>" . LAN_UL_024 . "</th></tr>";
         foreach ($a_filetypes as $type => $size) {
             $allowed_filetypes .= "<tr><td>{$type}</td><td style='text-align:right'>" . eHelper::parseMemorySize($size, 0) . "</td></tr>";
         }
         $allowed_filetypes .= "</table>";
     } else {
         $a_filetypes = array_keys($a_filetypes);
         $allowed_filetypes = implode(' | ', $a_filetypes);
     }
     $text .= " " . $allowed_filetypes;
     $text .= "<div class='alert alert-block alert-danger'>" . LAN_407 . "<br />" . LAN_418 . eHelper::parseMemorySize($max_upload_size, 0) . " (" . LAN_UL_022 . ")<br />";
     $text .= "<span style='text-decoration:underline'>" . LAN_408 . "</span> " . LAN_420;
     $text .= "</div>";
     $text .= "</td></tr>";
     //TODO Replcae all form inputs with $frm methods.
     if (!USER) {
         $text .= "<tr>\n\t\t\t<td class='forumheader3'>" . LAN_61 . "</td>\n\t\t\t<td class='forumheader3'><input class='tbox form-control' style='width:90%' name='file_poster' type='text' size='50' maxlength='100' value='{$poster}' /></td>\n\t\t\t</tr>\n\t\t\n\t\t\t<tr>\n\t\t\t<td class='forumheader3'><span style='text-decoration:underline'>" . LAN_112 . "</span></td>\n\t\t\t<td class='forumheader3'><input class='tbox form-control' style='width:90%' name='file_email' id='user_email' type='text' size='50' maxlength='100' value='" . $postemail . "' required /></td>\n\t\t\t</tr>";
     }
     $text .= "\n\t\t\t<tr>\n\t\t\t<td class='forumheader3'><span style='text-decoration:underline'>" . LAN_409 . "</span></td>\n\t\t\t<td class='forumheader3'><input class='tbox form-control' style='width:90%'  name='file_name' id='file_name' type='text' size='50' maxlength='100' required /></td>\n\t\t\t</tr>\n\t\t\n\t\t\t<tr>\n\t\t\t<td class='forumheader3'>" . LAN_410 . "</td>\n\t\t\t<td class='forumheader3'><input class='tbox form-control' style='width:90%' name='file_version' type='text' size='10' maxlength='10' /></td>\n\t\t\t</tr>\n\t\t\n\t\t\n\t\t\t<tr>\n\t\t\t<td class='forumheader3'><span style='text-decoration:underline'>" . LAN_411 . "</span></td>\n\t\t\t<td class='forumheader3'><input class='tbox' style='width:90%'  id='file_realpath' name='file_userfile[]' type='file' size='47' /></td>\n\t\t\t</tr>\n\t\t\n\t\t\t<tr>\n\t\t\t<td class='forumheader3'>" . LAN_412 . "</td>\n\t\t\t<td class='forumheader3'><input class='tbox' style='width:90%' name='file_userfile[]' type='file' size='47' /></td>\n\t\t\t</tr>\n\t\t\n\t\t\t<tr>\n\t\t\t<td class='forumheader3'><span style='text-decoration:underline'>" . LAN_413 . "</span></td>\n\t\t\t<td class='forumheader3'><textarea class='tbox form-control' style='width:90%' name='file_description' id='file_description' cols='59' rows='6' required></textarea></td>\n\t\t\t</tr>\n\t\t\n\t\t\t<tr>\n\t\t\t<td class='forumheader3'>" . LAN_144 . "</td>\n\t\t\t<td class='forumheader3'><input class='tbox form-control' style='width:90%' name='file_website' type='text' size='50' maxlength='100' value='" . (defined(USERURL) ? USERURL : "") . "' /></td>\n\t\t\t</tr>\n\t\t\n\t\t\t<tr>\n\t\t\t<td class='forumheader3'>" . LAN_414 . "<br /><span class='smalltext'>" . LAN_415 . "</span></td>\n\t\t\t<td class='forumheader3'><input class='tbox form-control' style='width:90%' name='file_demo' type='text' size='50' maxlength='100' /></td>\n\t\t\t</tr>\n\t\t\n\t\t\t<tr>\n\t\t\t<td style='text-align:center' colspan='2' class='forumheader'><input class='btn btn-primary button' type='submit' name='upload' value='" . LAN_416 . "' /></td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t\t</form>\n\t\t\t</div>";
     $ns->tablerender(LAN_417, $text);
 }
Esempio n. 2
0
 function init()
 {
     $sql = e107::getDb();
     $tp = e107::getParser();
     $ns = e107::getRender();
     $frm = e107::getForm();
     require_once e_PLUGIN . 'forum/forum_class.php';
     $gen = e107::getDate();
     $forum = new e107forum();
     $total_posts = $sql->count('forum_post');
     $total_topics = $sql->count('forum_thread');
     $total_replies = $total_posts - $total_topics;
     $total_views = 0;
     $query = 'SELECT sum(thread_views) AS total FROM `#forum_thread` ';
     if ($sql->gen($query)) {
         $row = $sql->fetch();
         $total_views = $row['total'];
     }
     $firstpost = $sql->select('forum_post', 'post_datestamp', 'post_datestamp > 0 ORDER BY post_datestamp ASC LIMIT 0,1', 'default');
     $fp = $sql->fetch();
     $open_ds = $fp['post_datestamp'];
     $open_date = $gen->convert_date($open_ds, 'long');
     $open_since = $gen->computeLapse($open_ds);
     $open_days = floor((time() - $open_ds) / 86400);
     $postsperday = $open_days < 1 ? $total_posts : round($total_posts / $open_days);
     global $mySQLdefaultdb;
     $query = "SHOW TABLE STATUS FROM `{$mySQLdefaultdb}`";
     $sql->gen($query);
     $array = $sql->db_getList();
     foreach ($array as $table) {
         if ($table['Name'] == MPREFIX . 'forum_post') {
             $db_size = eHelper::parseMemorySize($table['Data_length']);
             $avg_row_len = eHelper::parseMemorySize($table['Avg_row_length']);
             break;
         }
     }
     $query = "\n\t\tSELECT ft.thread_id, ft.thread_user, ft.thread_name, ft.thread_total_replies, ft.thread_datestamp, f.forum_sef, f.forum_class, u.user_name, u.user_id FROM #forum_thread as ft\n\t\tLEFT JOIN #user AS u ON ft.thread_user = u.user_id\n\t\tLEFT JOIN #forum AS f ON f.forum_id = ft.thread_forum_id\n\t\tWHERE ft.thread_active > 0\n\t\tAND f.forum_class IN (" . USERCLASS_LIST . ")\n\t\tORDER BY ft.thread_total_replies DESC LIMIT 0,10";
     $sql->gen($query);
     $most_activeArray = $sql->db_getList();
     $query = "\n\t\tSELECT ft.*, f.forum_class, f.forum_sef, u.user_name, u.user_id FROM #forum_thread as ft\n\t\tLEFT JOIN #user AS u ON ft.thread_user = u.user_id\n\t\tLEFT JOIN #forum AS f ON f.forum_id = ft.thread_forum_id\n\t\tWHERE f.forum_class IN (" . USERCLASS_LIST . ")\n\t\tORDER BY ft.thread_views DESC LIMIT 0,10";
     $sql->gen($query);
     $most_viewedArray = $sql->db_getList();
     /*$sql->db_Select("user", "user_id, user_name, user_forums", "ORDER BY user_forums DESC LIMIT 0, 10", "no_where");
     		$posters = $sql -> db_getList();
     		$top_posters = array();
     		foreach($posters as $poster)
     		{
     			$percen = round(($poster['user_forums'] / $total_posts) * 100, 2);
     			$top_posters[] = array("user_id" => $poster['user_id'], "user_name" => $poster['user_name'], "user_forums" => $poster['user_forums'], "percentage" => $percen);
     		}*/
     // get all replies
     $query = "\n\t\tSELECT COUNT(fp.post_id) AS post_count, u.user_name, u.user_id, fp.post_thread FROM #forum_post as fp\n\t\tLEFT JOIN #user AS u ON fp.post_user = u.user_id\n\t\tGROUP BY fp.post_user\n\t\tORDER BY post_count DESC LIMIT 0,10";
     $sql->gen($query);
     // 	$top_repliers_data = $sql->db_getList('ALL', false, false, 'user_id');
     $top_repliers_data = $sql->retrieve($query, true);
     // build top posters meanwhile
     $top_posters = array();
     $topReplier = array();
     foreach ($top_repliers_data as $poster) {
         $percent = round($poster['post_count'] / $total_posts * 100, 2);
         $topReplier[] = intval($poster['user_id']);
         $top_posters[] = array("user_id" => $poster['user_id'], "user_name" => vartrue($poster['user_name'], LAN_ANONYMOUS), "user_forums" => $poster['post_count'], "percentage" => $percent);
     }
     // end build top posters
     $ids = implode(',', $topReplier);
     // find topics by top 10 users
     $query = "\n\t\tSELECT COUNT(ft.thread_id) AS thread_count, u.user_id FROM #forum_thread as ft\n\t\tLEFT JOIN #user AS u ON ft.thread_user = u.user_id\n\t\tWHERE u.user_id IN ({$ids})\tGROUP BY ft.thread_user";
     $sql->gen($query);
     $top_repliers_data_c = $sql->db_getList('ALL', false, false, 'user_id');
     $top_repliers = array();
     foreach ($top_repliers_data as $uid => $poster) {
         $poster['post_count'] = $poster['post_count'] - $top_repliers_data_c[$uid]['thread_count'];
         $percent = round($poster['post_count'] / $total_replies * 100, 2);
         $top_repliers_sort[$uid] = $poster['post_count'];
         //$top_repliers[$uid] = $poster;
         $top_repliers_data[$uid]['user_forums'] = $poster['post_count'];
         $top_repliers_data[$uid]['percentage'] = $percent;
         //$top_repliers_data[$uid] = array("user_id" => $poster['user_id'], "user_name" => $poster['user_name'], "user_forums" => $poster['post_count'], "percentage" => $percent);
     }
     // sort
     arsort($top_repliers_sort, SORT_NUMERIC);
     // build top repliers
     foreach ($top_repliers_sort as $uid => $c) {
         $top_repliers[] = $top_repliers_data[$uid];
     }
     // get all replies
     $query = "\n\t\tSELECT COUNT(ft.thread_id) AS thread_count, u.user_name, u.user_id FROM #forum_thread as ft\n\t\tLEFT JOIN #user AS u ON ft.thread_user = u.user_id\n\t\tGROUP BY ft.thread_user\n\t\tORDER BY thread_count DESC LIMIT 0,10";
     $sql->gen($query);
     $top_topic_starters_data = $sql->db_getList();
     $top_topic_starters = array();
     foreach ($top_topic_starters_data as $poster) {
         $percent = round($poster['thread_count'] / $total_topics * 100, 2);
         $top_topic_starters[] = array("user_id" => $poster['user_id'], "user_name" => vartrue($poster['user_name'], LAN_ANONYMOUS), "user_forums" => $poster['thread_count'], "percentage" => $percent);
     }
     /*
     			$query = "
     			SELECT SUBSTRING_INDEX(thread_user,'.',1) AS t_user, COUNT(SUBSTRING_INDEX(ft.thread_user,'.',1)) AS ucount, u.user_name, u.user_id FROM #forum_t as ft
     			LEFT JOIN #user AS u ON SUBSTRING_INDEX(ft.thread_user,'.',1) = u.user_id
     			WHERE ft.thread_parent=0
     			GROUP BY t_user
     			ORDER BY ucount DESC
     			LIMIT 0,10";
     			$sql -> db_Select_gen($query);
     			$posters = $sql -> db_getList();
     			$top_topic_starters = array();
     			foreach($posters as $poster)
     			{
     				$percen = round(($poster['ucount'] / $total_topics) * 100, 2);
     				$top_topic_starters[] = array("user_id" => $poster['user_id'], "user_name" => $poster['user_name'], "user_forums" => $poster['ucount'], "percentage" => $percen);
     			}*/
     /*
     $query = "
     SELECT SUBSTRING_INDEX(thread_user,'.',1) AS t_user, COUNT(SUBSTRING_INDEX(ft.thread_user,'.',1)) AS ucount, u.user_name, u.user_id FROM #forum_t as ft
     LEFT JOIN #user AS u ON SUBSTRING_INDEX(ft.thread_user,'.',1) = u.user_id
     WHERE ft.thread_parent!=0
     GROUP BY t_user
     ORDER BY ucount DESC
     LIMIT 0,10";
     $sql -> db_Select_gen($query);
     $posters = $sql -> db_getList();
     
     $top_repliers = array();
     foreach($posters as $poster)
     {
     	$percen = round(($poster['ucount'] / $total_replies) * 100, 2);
     	$top_repliers[] = array("user_id" => $poster['user_id'], "user_name" => $poster['user_name'], "user_forums" => $poster['ucount'], "percentage" => $percen);
     }
     */
     $text_0 = "\n\t\t<table style='width: 100%;' class='fborder table'>\n\t\t\t<tr><td style='width: 50%; text-align: right;'><b>" . LAN_FORUM_6001 . ":</b>&nbsp;&nbsp;</td><td style='width: 50%;'>{$open_date}</td></tr>\n\t\t\t<tr><td style='width: 50%; text-align: right;'><b>" . LAN_FORUM_6002 . ":</b>&nbsp;&nbsp;</td><td style='width: 50%;'>{$open_since}</td></tr>\n\t\t\t<tr><td style='width: 50%; text-align: right;'><b>" . LAN_FORUM_6003 . ":</b>&nbsp;&nbsp;</td><td style='width: 50%;'>{$total_posts}</td></tr>\n\t\t\t<tr><td style='width: 50%; text-align: right;'><b>" . LAN_FORUM_1007 . ":</b>&nbsp;&nbsp;</td><td style='width: 50%;'>{$total_topics}</td></tr>\n\t\t\t<tr><td style='width: 50%; text-align: right;'><b>" . LAN_FORUM_6004 . ":</b>&nbsp;&nbsp;</td><td style='width: 50%;'>{$total_replies}</td></tr>\n\t\t\t<tr><td style='width: 50%; text-align: right;'><b>" . LAN_FORUM_6005 . ":</b>&nbsp;&nbsp;</td><td style='width: 50%;'>{$total_views}</td></tr>\n\t\t\t<tr><td style='width: 50%; text-align: right;'><b>" . LAN_FORUM_6014 . ":</b>&nbsp;&nbsp;</td><td style='width: 50%;'>{$postsperday}</td></tr>\n\t\t\t<tr><td style='width: 50%; text-align: right;'><b>" . LAN_FORUM_6006 . ":</b>&nbsp;&nbsp;</td><td style='width: 50%;'>{$db_size}</td></tr>\n\t\t\t<tr><td style='width: 50%; text-align: right;'><b>" . LAN_FORUM_6007 . ":</b>&nbsp;&nbsp;</td><td style='width: 50%;'>{$avg_row_len}</td></tr>\n\t\t</table>";
     $text_1 = "\n\t\t<table style='width: 100%;' class='fborder table'>\n\t\t<thead>\n\t\t<tr>\n\t\t<th style='width: 10%; text-align: center;' class='fcaption'>" . LAN_FORUM_6008 . "</th>\n\t\t<th style='width: 40%;' class='fcaption'>" . LAN_FORUM_1003 . "</th>\n\t\t<th style='width: 10%; text-align: center;' class='fcaption'>" . LAN_FORUM_0003 . "</th>\n\t\t<th style='width: 20%; text-align: center;' class='fcaption'>" . LAN_FORUM_6009 . "</th>\n\t\t<th style='width: 20%; text-align: center;' class='fcaption'>" . LAN_DATE . "</th>\n\t\t</tr>\n\t\t</thead>\n\t\t";
     $count = 1;
     foreach ($most_activeArray as $ma) {
         if ($ma['user_name']) {
             //$uinfo = "<a href='".e_HTTP."user.php ?id.{$ma['user_id']}'>{$ma['user_name']}</a>"; //TODO SEf Url .
             $uparams = array('id' => $ma['user_id'], 'name' => $ma['user_name']);
             $link = e107::getUrl()->create('user/profile/view', $uparams);
             $uinfo = "<a href='" . $link . "'>" . $ma['user_name'] . "</a>";
         } else {
             $tmp = explode(chr(1), $ma['thread_anon']);
             $uinfo = $tp->toHTML($tmp[0]);
         }
         $ma['thread_sef'] = eHelper::title2sef($ma['thread_name'], 'dashl');
         $url = e107::url('forum', 'topic', $ma);
         $text_1 .= "\n\t\t\t<tr>\n\t\t\t<td style='width: 10%; text-align: center;' class='forumheader3'>{$count}</td>\n\t\t\t<td style='width: 40%;' class='forumheader3'><a href='" . $url . "'>{$ma['thread_name']}</a></td>\n\t\t\t<td style='width: 10%; text-align: center;' class='forumheader3'>{$ma['thread_total_replies']}</td>\n\t\t\t<td style='width: 20%; text-align: center;' class='forumheader3'>{$uinfo}</td>\n\t\t\t<td style='width: 20%; text-align: center;' class='forumheader3'>" . $gen->convert_date($ma['thread_datestamp'], "forum") . "</td>\n\t\t\t</tr>\n\t\t\t";
         $count++;
     }
     $text_1 .= "</table>";
     $text_2 = "\n\t\t<table style='width: 100%;' class='fborder table'>\n\t\t<thead>\n\t\t<tr>\n\t\t<th style='width: 10%; text-align: center;' class='fcaption'>" . LAN_FORUM_6008 . "</th>\n\t\t<th style='width: 40%;' class='fcaption'>" . LAN_FORUM_1003 . "</th>\n\t\t<th style='width: 10%; text-align: center;' class='fcaption'>" . LAN_FORUM_1005 . "</th>\n\t\t<th style='width: 20%; text-align: center;' class='fcaption'>" . LAN_FORUM_6009 . "</th>\n\t\t<th style='width: 20%; text-align: center;' class='fcaption'>" . LAN_DATE . "</th>\n\t\t</tr>\n\t\t</thead>\n\t\t";
     $count = 1;
     foreach ($most_viewedArray as $ma) {
         if ($ma['user_name']) {
             //$uinfo = "<a href='".e_HTTP."user.php ?id.{$ma['user_id']}'>".$ma['user_name']."</a>";  //TODO SEf Url .
             $uparams = array('id' => $ma['user_id'], 'name' => $ma['user_name']);
             $link = e107::getUrl()->create('user/profile/view', $uparams);
             $uinfo = "<a href='" . $link . "'>" . $ma['user_name'] . "</a>";
         } else {
             $tmp = explode(chr(1), $ma['thread_anon']);
             $uinfo = $tp->toHTML($tmp[0]);
         }
         $ma['thread_sef'] = eHelper::title2sef($ma['thread_name'], 'dashl');
         $url = e107::url('forum', 'topic', $ma);
         $text_2 .= "\n\t\t\t<tr>\n\t\t\t<td style='width: 10%; text-align: center;' class='forumheader3'>{$count}</td>\n\t\t\t<td style='width: 40%;' class='forumheader3'><a href='" . $url . "'>" . $ma['thread_name'] . "</a></td>\n\t\t\t<td style='width: 10%; text-align: center;' class='forumheader3'>" . $ma['thread_views'] . "</td>\n\t\t\t<td style='width: 20%; text-align: center;' class='forumheader3'>" . $uinfo . "</td>\n\t\t\t<td style='width: 20%; text-align: center;' class='forumheader3'>" . $gen->convert_date($ma['thread_datestamp'], "forum") . "</td>\n\t\t\t</tr>\n\t\t\t";
         $count++;
     }
     $text_2 .= "</table>";
     $text_3 = "\n\t\t<table style='width: 100%;' class='fborder table'>\n\t\t<thead>\n\t\t<tr>\n\t\t<th style='width: 10%; text-align: center;' class='fcaption'>" . LAN_FORUM_6008 . "</th>\n\t\t<th style='width: 20%;' class='fcaption'>" . LAN_NAME . "</th>\n\t\t<th style='width: 10%; text-align: center;' class='fcaption'>" . LAN_FORUM_2032 . "</th>\n\t\t<th style='width: 10%; text-align: center;' class='fcaption'>%</th>\n\t\t<th style='width: 50%; text-align: center;' class='fcaption'>&nbsp;</th>\n\t\t</tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t";
     $count = 1;
     foreach ($top_posters as $ma) {
         $text_3 .= "<tr>\n\t\t\t<td style='width: 10%; text-align: center;' class='forumheader3'>{$count}</td>\n\t\t\t<td style='width: 20%;' class='forumheader3'><a href='" . e107::getUrl()->create('user/profile/view', $ma) . "'>" . $ma['user_name'] . "</a></td>\n\t\t\t<td style='width: 10%; text-align: center;' class='forumheader3'>" . $ma['user_forums'] . "</td>\n\t\t\t<td style='width: 10%; text-align: center;' class='forumheader3'>" . $ma['percentage'] . "%</td>\n\t\t\t<td style='width: 50%;' class='forumheader3'>" . $this->showBar($ma['percentage']) . "\n\t\t\t</td>\n\t\t\t</tr>\n\t\t\t";
         $count++;
     }
     $text_3 .= "</tbody>\n\t\t</table>\n\t\t";
     $text_4 = "\n\t\t<table style='width: 100%;' class='fborder table'>\n\t\t<thead>\n\t\t<tr>\n\t\t<th style='width: 10%; text-align: center;' class='fcaption'>" . LAN_FORUM_6008 . "</th>\n\t\t<th style='width: 20%;' class='fcaption'>" . LAN_NAME . "</th>\n\t\t<th style='width: 10%; text-align: center;' class='fcaption'>" . LAN_FORUM_2032 . "</th>\n\t\t<th style='width: 10%; text-align: center;' class='fcaption'>%</th>\n\t\t<th style='width: 50%; text-align: center;' class='fcaption'>&nbsp;</th>\n\t\t</tr>\n\t\t</thead>\n\t\t";
     $count = 1;
     foreach ($top_topic_starters as $ma) {
         $text_4 .= "<tr>\n\t\t\t<td style='width: 10%; text-align: center;' class='forumheader3'>{$count}</td>\n\t\t\t<td style='width: 20%;' class='forumheader3'><a href='" . e107::getUrl()->create('user/profile/view', $ma) . "'>" . $ma['user_name'] . "</a></td>\n\t\t\t<td style='width: 10%; text-align: center;' class='forumheader3'>" . $ma['user_forums'] . "</td>\n\t\t\t<td style='width: 10%; text-align: center;' class='forumheader3'>" . $ma['percentage'] . "%</td>\n\t\t\t<td style='width: 50%; text-align: center;' class='forumheader3'>" . $this->showBar($ma['percentage']) . "</td>\n\t\t\t</tr>\n\t\t\t";
         $count++;
     }
     $text_4 .= "</table>";
     $text_5 = "\n\t\t<table style='width: 100%;' class='fborder table'>\n\t\t<thead>\n\t\t<tr>\n\t\t<th style='width: 10%; text-align: center;' class='fcaption'>" . LAN_FORUM_6008 . "</th>\n\t\t<th style='width: 20%;' class='fcaption'>" . LAN_NAME . "</th>\n\t\t<th style='width: 10%; text-align: center;' class='fcaption'>" . LAN_FORUM_2032 . "</th>\n\t\t<th style='width: 10%; text-align: center;' class='fcaption'>%</th>\n\t\t<th style='width: 50%; text-align: center;' class='fcaption'>&nbsp;</th>\n\t\t</tr>\n\t\t</thead>\n\t\t";
     $count = 1;
     foreach ($top_repliers as $ma) {
         $text_5 .= "\n\t\t\t<tr>\n\t\t\t<td style='width: 10%; text-align: center;' class='forumheader3'>{$count}</td>\n\t\t\t<td style='width: 20%;' class='forumheader3'><a href='" . e107::getUrl()->create('user/profile/view', $ma) . "'>" . $ma['user_name'] . "</a></td>\n\t\t\t<td style='width: 10%; text-align: center;' class='forumheader3'>" . $ma['user_forums'] . "</td>\n\t\t\t<td style='width: 10%; text-align: center;' class='forumheader3'>" . $ma['percentage'] . "%</td>\n\t\t\t<td style='width: 50%; text-align: center;' class='forumheader3'>" . $this->showBar($ma['percentage']) . "</td>\n\t\t\t</tr>\n\t\t\t";
         $count++;
     }
     $text_5 .= '</table>';
     if (deftrue('BOOTSTRAP')) {
         $tabs = array();
         $tabs[0] = array('caption' => LAN_FORUM_6000, 'text' => $text_0);
         $tabs[1] = array('caption' => LAN_FORUM_0011, 'text' => $text_1);
         $tabs[2] = array('caption' => LAN_FORUM_6010, 'text' => $text_2);
         $tabs[3] = array('caption' => LAN_FORUM_0010, 'text' => $text_3);
         $tabs[4] = array('caption' => LAN_FORUM_6011, 'text' => $text_4);
         $tabs[5] = array('caption' => LAN_FORUM_6012, 'text' => $text_5);
         $frm = e107::getForm();
         $breadarray = array(array('text' => e107::pref('forum', 'title', LAN_PLUGIN_FORUM_NAME), 'url' => e107::url('forum', 'index')), array('text' => LAN_FORUM_6013, 'url' => null));
         $text = $frm->breadcrumb($breadarray);
         $text = "<div id='forum-stats'>" . $text . e107::getForm()->tabs($tabs) . "</div>";
     } else {
         $text = "\n\t\t\t<h3>" . LAN_FORUM_6000 . "</h3>" . $text_0 . "<h3>" . LAN_FORUM_0011 . "</h3>" . $text_1 . "<h3>" . LAN_FORUM_6010 . "</h3>" . $text_2 . "<h3>" . LAN_FORUM_0010 . "</h3>" . $text_3 . "<h3>" . LAN_FORUM_6011 . "</h3>" . $text_4 . "<h3>" . LAN_FORUM_6012 . "</h3>" . $text_5;
     }
     $text .= "<div class='center'>" . e107::getForm()->pagination(e107::url('forum', 'index'), LAN_BACK) . "</div>";
     $ns->tablerender(LAN_FORUM_6013, $text);
 }
Esempio n. 3
0
 function orphanFiles()
 {
     $files = e107::getFile()->get_files(e_DOWNLOAD);
     $foundSome = false;
     foreach ($files as $file) {
         if (0 == $sql->db_Count('download', '(*)', " WHERE download_url='" . $file['fname'] . "'")) {
             if (!$foundSome) {
                 // $text .= $rs->form_open("post", e_SELF."?".e_QUERY, "myform");
                 $text .= '<form method="post" action="' . e_SELF . '?' . e_QUERY . '" id="myform">
                  <table class="adminlist">';
                 $text .= '<tr>';
                 $text .= '<th>' . DOWLAN_13 . '</th>';
                 $text .= '<th>' . DOWLAN_182 . '</th>';
                 $text .= '<th>' . DOWLAN_66 . '</th>';
                 $text .= '<th>' . LAN_OPTIONS . '</th>';
                 $text .= '</tr>';
                 $foundSome = true;
             }
             $filesize = is_readable(e_DOWNLOAD . $row['download_url']) ? eHelper::parseMemorySize(filesize(e_DOWNLOAD . $file['fname'])) : DOWLAN_181;
             $filets = is_readable(e_DOWNLOAD . $row['download_url']) ? e107::getDate()->convert_date(filectime(e_DOWNLOAD . $file['fname']), "long") : DOWLAN_181;
             $text .= '<tr>';
             $text .= '<td>' . $tp->toHTML($file['fname']) . '</td>';
             $text .= '<td>' . $filets . '</td>';
             $text .= '<td>' . $filesize . '</td>';
         }
     }
 }
Esempio n. 4
0
    if (FILE_UPLOADS && is_writable(e_BASE . $path . $dirs[$c])) {
        $up_button = $frm->admin_button('erquest', FMLAN_21, 'action', '', array('id' => false, 'other' => "onclick='e107Helper.toggle(\"{$el_id}\")'"));
    } else {
        $up_button = "&nbsp;leave_32.png";
    }
    //FIXME - upload link not working, raplace with image
    $text .= "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class='center middle'><a href='#{$el_id}' class='e-expandit'>upload</a></td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<a class='action' href='" . e_SELF . "?" . $path . $dirs[$c] . "/'><img class='icon action S16' src='" . $imagedir . "folder.png' alt='" . $dirs[$c] . " " . FMLAN_31 . "' /></a>\n\t\t\t\t\t\t\t<a href='" . e_SELF . "?" . $path . $dirs[$c] . "/'>" . $dirs[$c] . "</a>\n\t\t\t\t\t\t\t<div class='e-hideme' id='{$el_id}'>\n\t\t\t\t\t\t\t\t<div class='field-spacer'>" . $frm->file('file_userfile[]', array('id' => false, 'size' => '20')) . $frm->admin_button('upload', FMLAN_22, '', '', array('id' => false)) . "</div>\n\t\t\t\t\t\t\t\t<input type='hidden' name='upload_dir[]' value='" . $path . $dirs[$c] . "' />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td class='right'>" . $dirsize . "</td>\n\t\t\t\t\t\t<td class='right'>&nbsp;</td>\n\t\t\t\t\t</tr>\n\t";
    $c++;
}
$c = 0;
while ($files[$c]) {
    $img = strtolower(substr(strrchr($files[$c], "."), 1, 3));
    if (!$img || !preg_match("/css|exe|gif|htm|jpg|js|php|png|txt|xml|zip/i", $img)) {
        $img = "def";
    }
    $size = eHelper::parseMemorySize(filesize(e_BASE . $path . "/" . $files[$c]));
    $gen = new convert();
    $filedate = e107::getDate()->convert_date(filemtime(e_BASE . $path . "/" . $files[$c]), "forum");
    $text .= "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class='center middle autocheck'>\n\t\t\t\t\t\t\t" . $frm->checkbox("selectedfile[{$c}]", 1, false, array('id' => false)) . "\n\t\t\t\t\t\t\t<input type='hidden' name='deleteconfirm[{$c}]' value='" . $path . $files[$c] . "' />\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<img class='icon' src='" . $imagedir . $img . ".png' alt='" . $files[$c] . "' />\n\t\t\t\t\t\t\t<a href='" . e_SELF . "?" . $path . $files[$c] . "'>" . $files[$c] . "</a>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td class='right'>" . $size . "</td>\n\t\t\t\t\t\t<td class='right'>" . $filedate . "</td>\n\t\t\t\t\t</tr>\n\t";
    $c++;
}
$text .= "\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t\t<div class='buttons-bar left'>\n\t\t\t\t" . $frm->admin_button('check_all', 'jstarget:selectedfile', 'action', LAN_CHECKALL, array('id' => false)) . "\n\t\t\t\t" . $frm->admin_button('uncheck_all', 'jstarget:selectedfile', 'action', LAN_UNCHECKALL, array('id' => false)) . "\n\t";
if ($pubfolder || e_QUERY == "") {
    require_once e_HANDLER . "file_class.php";
    $fl = new e_file();
    $dl_dirlist = $fl->get_dirs(e_DOWNLOAD);
    $movechoice = array();
    $movechoice[] = e_DOWNLOAD;
    foreach ($dl_dirlist as $dirs) {
        $movechoice[] = e_DOWNLOAD . $dirs . "/";
    }
Esempio n. 5
0
 /**
  * Get the current memory usage of the code
  * If $separator argument is null, raw data (array) will be returned
  *
  * @param null|string $separator
  * @return string|array memory usage
  */
 public static function getMemoryUsage($separator = '/')
 {
     $ret = array();
     if (function_exists("memory_get_usage")) {
         $ret[] = eHelper::parseMemorySize(memory_get_usage());
         // With PHP>=5.2.0, can show peak usage as well
         if (function_exists("memory_get_peak_usage")) {
             $ret[] = eHelper::parseMemorySize(memory_get_peak_usage(TRUE));
         }
     } else {
         $ret[] = 'Unknown';
     }
     return null !== $separator ? implode($separator, $ret) : $ret;
 }
Esempio n. 6
0
 /**
  * MOVED TO eHelper::parseMemorySize()
  * FIXME - find all calls, replace with eHelper::parseMemorySize() (once eHelper lives in a separate file)
  *
  * @param integer $size
  * @param integer $dp
  * @return string formatted size
  */
 public function parseMemorySize($size, $dp = 2)
 {
     return eHelper::parseMemorySize($size, $dp);
 }
Esempio n. 7
0
 function sc_download_mirror_filesize()
 {
     return eHelper::parseMemorySize($this->mirror['dlmirrorfile'][3]);
 }