function smarty_function_imagesize($params, &$smarty) { // Make sure they passed a source file if (!$params['src']) { return '<!-- Imagesizer Error: You must specify a source image -->'; } // Get various paths and urls for the image if (!($paths = getImagePath($params['src'], $smarty))) { return false; } // Make sure it's a file-type we can deal with if (!in_array(strtolower($paths['fileExt']), array('gif', 'jpeg', 'jpg', 'png'))) { return '<!-- Imagesizer Error: Invalid file type -->'; } // Calculate the final dimensions $finalSize = getNewSize($params, $paths); // Do the actual resizing and cache the result if (!($finalImage = resizeAndCache($finalSize, $paths, $params))) { return '<!-- Imagesizer Error: Could not resize the image -->'; } // Build the options for the img tag $opts = 'alt="' . $params['alt'] . '"'; $opts .= isset($params['class']) ? ' class="' . $params['class'] . '"' : ''; $opts .= isset($params['id']) ? ' id="' . $params['id'] . '"' : ''; $opts .= isset($params['title']) ? ' title="' . $params['title'] . '"' : ''; $opts .= isset($params['style']) ? ' style="' . $params['style'] . '"' : ''; // Output the tag return '<img src="' . $finalImage . '" ' . $opts . ' width="' . $finalSize[0] . '" height="' . $finalSize[1] . '" />'; }
/** * 获取图片库中图片路径和名称 * * @param $dirName string 目录名 * @param &$files array 引用变量,存储图片库中图片 */ function getImagePath($dirName, &$files) { $handle = @opendir($dirName); while (($file = @readdir($handle)) !== false) { if ($file != '.' && $file != '..') { $dir = $dirName . '/' . $file; if (is_dir($dir)) { getImagePath($dir, &$files); } else { $files[] = array('path' => $dirName, 'filename' => $file); } } } }
function getImageFromPath($sURL) { if (strpos($sURL, 'http://') === false) { $sURL = getImagePath($sURL); list($iWidth, $iHeight, $iType, $sAttr) = getimagesize($sURL); } else { $aImageSize = getimagesize($sURL); list($iWidth, $iHeight, $iType, $sAttr) = $aImageSize; } switch ($iType) { case 1: $objImage = imagecreatefromgif($sURL); break; case 2: $objImage = imagecreatefromjpeg($sURL); break; case 3: $objImage = imagecreatefrompng($sURL); break; } return $objImage; }
echo '<table id="tablesorter1" class="tablesorter" border="1" cellspacing="0" cellpadding="3" width="100%">'; echo "<thead>\n<tr valign='top'>\n"; echo "<th>".$this->lang->line('kago_id')."</th>\n<th>".$this->lang->line('kago_name')."</th><th>Image</th><th>Image Size</th>" ."<th>".$this->lang->line('kago_status')."</th><th>".$this->lang->line('kago_actions')."</th>\n"; echo "</tr>\n</thead>\n<tbody>\n"; foreach ($slideshow as $key => $list){ echo "<tr valign='top'>\n"; //echo "<td align='center'>".form_checkbox('p_id[]',$list['id'],FALSE)."</td>"; echo "<td align='center'>".$list['id']."</td>\n"; echo "<td align='center'>"; //.$list['name']. echo anchor('slideshow/admin/edit/'.$list['id'],$list['name']); echo "</td>\n"; $subject = $list['image']; $imagename = getImageName($subject); $imagepath = getImagePath($subject); //$filepath = base_url()."assets/images/frontpage/".$list['name']; $filepath = base_url().$imagepath; //$imagepath = "assets/images/frontpage/".$list['name']; echo "<td class='tableimg'><img width=\"70px\" src='".$filepath."' /></td>"; echo "<td>"; if ($imagepath!="") $filesize = getimagesize($imagepath); // print_r ($filesize); echo "width: ".$filesize[0]. "px<br />"; echo "height: ".$filesize[1]. "px<br />"; echo "</td>"; echo "<td align='center'>"; $active_icon = ($list['status']=='active'?'tick':'cross'); echo anchor("kaimonokago/admin/changeStatus/$module/".$list['id'],$this->bep_assets->icon($active_icon), array('class' => $list['status']. ' changestatus'));
echo "<h4 class='text-center no-margin-top'><a href='{$linkTarget}'>" . $row->ad_headline . "</a></h4>"; if (isset($row->images[0])) { echo "<div class='text-center'><a href='" . $linkTarget . "'><img src='" . JURI_IMAGES_FOLDER . "/" . $row->images[0]->{$imagetype} . "' alt=\"" . htmlspecialchars($row->ad_headline) . "\" border='0' /></a></div>"; } else { echo "<div class='text-center'><a href='" . $linkTarget . "'><img src='" . ADSMANAGER_NOPIC_IMG . "' alt='noimage' border='0' /></a></div>"; } $iconflag = false; if ($conf->show_new == true && isNewContent($row->date_created, $conf->nbdays_new)) { echo "<div class='text-center'><img align='center' src='" . getImagePath('new.gif') . "' /> "; $iconflag = true; } if ($conf->show_hot == true && $row->views >= $conf->nbhits) { if ($iconflag == false) { echo "<div class='text-center'>"; } echo "<img align='center' src='" . getImagePath('hot.gif') . "' />"; $iconflag = true; } if ($iconflag == true) { echo "</div>"; } if ($displaycategory == 1) { echo "<div class='text-center '><span class=\"adsmanager-cat\">(" . $row->parent . " / " . $row->cat . ")</span></div>"; } if ($displaydate == 1) { echo "<div class='text-center'>" . reorderDate($row->date_created) . "</div>"; $iconflag = true; } foreach ($adfields as $f) { $fieldname = $f->name; if ($row->{$fieldname} != null) {
/favicon.ico" rel="shortcut icon"> <script> (function(d) { var config = { kitId: 'gxo1ywi', scriptTimeout: 3000 }, h=d.documentElement,t=setTimeout(function(){h.className=h.className.replace(/\bwf-loading\b/g,"")+" wf-inactive";},config.scriptTimeout),tk=d.createElement("script"),f=false,s=d.getElementsByTagName("script")[0],a;h.className+=" wf-loading";tk.src='//use.typekit.net/'+config.kitId+'.js';tk.async=true;tk.onload=tk.onreadystatechange=function(){a=this.readyState;if(f||a&&a!="complete"&&a!="loaded")return;f=true;clearTimeout(t);try{Typekit.load(config)}catch(e){}};s.parentNode.insertBefore(tk,s) })(document); </script> <?php wp_head(); ?> <script> var getThemePath = '<?php echo getThemePath(); ?> '; /* grunticon Stylesheet Loader | https://github.com/filamentgroup/grunticon | (c) 2012 Scott Jehl, Filament Group, Inc. | MIT license. */ window.grunticon=function(e){if(e&&3===e.length){var t=window,n=!(!t.document.createElementNS||!t.document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect||!document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Image","1.1")||window.opera&&-1===navigator.userAgent.indexOf("Chrome")),o=function(o){var r=t.document.createElement("link"),a=t.document.getElementsByTagName("script")[0];r.rel="stylesheet",r.href=e[o&&n?0:o?1:2],a.parentNode.insertBefore(r,a)},r=new t.Image;r.onerror=function(){o(!1)},r.onload=function(){o(1===r.width&&1===r.height)},r.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=="}}; grunticon( [ getThemePath+"/dist/images/icons.data.svg.css", getThemePath+"/dist/images/icons.data.png.css", getThemePath+"/dist/images/icons.fallback.css" ] );</script> <noscript><link href="<?php getImagePath(); ?> \icons.fallback.css" rel="stylesheet"></noscript> </head>
} } }); } function getLegendColor(pos){ var imagesColor = ['/legend-color-0.png','/legend-color-1.png','/legend-color-2.png', '/legend-color-3.png','/legend-color-4.png','/legend-color-5.png', '/legend-color-6.png','/legend-color-7.png','/legend-color-8.png', '/legend-color-9.png']; var path = "<?php echo getImagePath(); ?> "+imagesColor[pos]; return path; } $(document).ready(function() { setupLegendAfterChartIsPresent(); }); </script> <div class="chart_legend"> <ul> </ul> </div>
//图片路径 $_GET['path'] = str_replace("img.boqii.com", "img.boqiicdn.com", $_GET['path']); $imgpath = $_GET['path']; if (!$imgpath) { echo ''; exit; } //$imgpath = 'http://imglocal.boqiicdn.com/Data/Vet/C/1404/21/img66921398048759_420x300.jpg'; //验证码 $v = $_GET['v']; //验证码校验错误则返回 if ($v !== md5($imgpath . 'comboqiiwwwvetappimg') && empty($_GET['debug'])) { echo 'Sign Error!'; exit; } $localfile = getImagePath($imgpath); //判断图片是否存在 if (@file_exists($localfile)) { getheader($imgpath); echo file_get_contents($localfile, 'r'); exit; } //图片不存在则创建图片 //提取所需图片尺寸 if (strpos($imgpath, 'x') !== false) { $size = str_replace(strrchr($imgpath, "."), '', str_replace('_', '', strrchr($imgpath, "_"))); } //访问地址不含图片尺寸,则直接返回 if ($size) { //宽x高 $sizeinfo = explode('x', $size);
?> <?php if (!isset($this->conf->display_column_date) || $this->conf->display_column_date == 1) { ?> <td class="tdcenter column_date hidden-phone"> <?php $iconflag = false; if ($this->conf->show_new == true && $this->isNewcontent($content->date_created, $this->conf->nbdays_new)) { echo "<div class='text-center'><img alt='new' src='" . getImagePath('new.gif') . "' /> "; $iconflag = true; } if ($this->conf->show_hot == true && $content->views >= $this->conf->nbhits) { if ($iconflag == false) { echo "<div class='text-center'>"; } echo "<img alt='hot' src='" . getImagePath('hot.gif') . "' />"; $iconflag = true; } if ($iconflag == true) { echo "</div>"; } if (!isset($this->conf->display_column_date_date) || $this->conf->display_column_date_date == 1) { echo $this->reorderDate($content->date_created); } ?> <br /> <?php if ($content->userid != 0 && (!isset($this->conf->display_column_date_user) || $this->conf->display_column_date_user == 1)) { echo JText::_('ADSMANAGER_FROM') . " "; $target = TLink::getUserAdsLink($content->userid); if ($this->conf->display_fullname == 1) {
function display($tpl = null) { $app = JFactory::getApplication(); $user = JFactory::getUser(); $pathway = $app->getPathway(); $document = JFactory::getDocument(); $contentmodel = $this->getModel("content"); $catmodel = $this->getModel("category"); $positionmodel = $this->getModel("position"); $columnmodel = $this->getModel("column"); $fieldmodel = $this->getModel("field"); $usermodel = $this->getModel("user"); $configurationmodel = $this->getModel("configuration"); $uri = JFactory::getURI(); $this->requestURL = $uri->toString(); // Get the parameters of the active menu item $menus = $app->getMenu(); $menu = $menus->getActive(); $conf = $configurationmodel->getConfiguration(); $catid = JRequest::getInt('catid', 0); $this->assignRef('catid', $catid); if ($catid != "0") { $category = $catmodel->getCategory($catid); if ($category == null) { echo "Invalid Catid"; exit; } $category->img = TTools::getCatImageUrl($catid, true); $category->imgdefault = false; } else { $category = new stdClass(); $category->name = JText::_("ADSMANAGER_ALL_ADS"); $category->description = ""; $category->img = getImagePath('default.gif'); $category->imgdefault = true; } jimport('joomla.session.session'); $currentSession = JSession::getInstance('none', array()); $currentSession->set("search_fields", ""); $currentSession->set("searchfieldssql", " 1 "); $currentSession->set("searchfieldscatid", 0); $currentSession->set("tsearch", "", 'adsmanager'); $global_filter = JRequest::getInt('global_filter', 0); if ($global_filter == 1) { $searchfields = $fieldmodel->getFields(0); $globalfiltersql = $fieldmodel->getSearchFieldsSql($searchfields); $currentSession->set("sqlglobalfilter", $globalfiltersql); $currentSession->set("globalfilter_values", JRequest::get('request')); } $filters = array(); $filters['publish'] = 1; if ($catid != 0) { $filters['category'] = $catid; } if (isset($conf->publication_date) && $conf->publication_date == 1) { $filters['publication_date'] = 1; } $modeuser = 0; $listuser = JRequest::getInt('user', -1); if ($listuser == 0 && $user->id != 0) { $listuser = $user->id; } if ($listuser != -1) { $filters['user'] = $listuser; $user = $usermodel->getUser($listuser); if ($conf->display_fullname) { $category->name = JText::_('ADSMANAGER_LIST_USER_TEXT') . " " . $user->name; } else { $category->name = JText::_('ADSMANAGER_LIST_USER_TEXT') . " " . $user->username; } $this->assignRef('listuser', $listuser); $modeuser = 1; } $this->assignRef('modeuser', $modeuser); $session = JFactory::getSession(); $list_type = $session->get('list_type', '', 'adsmanager'); $list_value = $session->get('list_value', '', 'adsmanager'); if ($listuser != -1) { if ($list_type == 'user' && $list_value == $listuser) { $tsearch = JRequest::getVar('tsearch', $session->get('tsearch', '', 'adsmanager')); $session->set('tsearch', $tsearch, 'adsmanager'); } else { $session->set('list_type', 'user', 'adsmanager'); $session->set('list_value', $listuser, 'adsmanager'); $session->set('tsearch', '', 'adsmanager'); $tsearch = ''; } } else { if ($list_type == 'category' && $list_value == $catid) { $tsearch = JRequest::getVar('tsearch', $session->get('tsearch', '', 'adsmanager')); $session->set('tsearch', $tsearch, 'adsmanager'); } else { $session->set('list_type', 'category', 'adsmanager'); $session->set('list_value', $catid, 'adsmanager'); $session->set('tsearch', '', 'adsmanager'); $tsearch = ''; } } if ($tsearch != "") { $filters['search'] = $tsearch; } $this->assignRef('tsearch', $tsearch); $rootid = JRequest::getInt('rootid', 0); if ($listuser == -1) { $subcats = $catmodel->getSubCats($catid, 'read', $rootid); $pathlist = $catmodel->getPathList($catid, 'read', $rootid); } else { $subcats = array(); $pathlist = array(); } $orderfields = $fieldmodel->getOrderFields($catid); $this->assignRef('orders', $orderfields); $this->assignRef('subcats', $subcats); $this->assignRef('pathlist', $pathlist); $limitstart = JRequest::getInt("limitstart", 0); $customlimit = $app->getUserStateFromRequest('com_adsmanager.front_content.limit_per_page', 'limit', 0, 'String'); $this->assignRef('adsperpage', $customlimit); if ($customlimit == 0) { $limit = $conf->ads_per_page; } else { if ($customlimit == 'all') { $limit = $conf->ads_per_page; } else { $limit = (int) $customlimit; } } $fields = $fieldmodel->getFields(); $this->assignRef('fields', $fields); $order = $app->getUserStateFromRequest('com_adsmanager.front_content.order', 'order', 0, 'int'); $orderdir = $app->getUserStateFromRequest('com_adsmanager.front_content.orderdir', 'orderdir', 'DESC'); $orderdir = strtoupper($orderdir); if ($orderdir != "DESC" && $orderdir != "ASC") { $orderdir = "DESC"; } $filter_order = $contentmodel->getFilterOrder($order); $filter_order_dir = $orderdir; $this->assignRef('order', $order); $this->assignRef('orderdir', $orderdir); $this->assignRef('lists', $lists); $filters['rootid'] = $rootid; $total = $contentmodel->getNbContents($filters); $contents = $contentmodel->getContents($filters, $limitstart, $limit, $filter_order, $filter_order_dir); if ($user->id > 0) { $favorites = $contentmodel->getFavorites($user->id); } else { $favorites = array(); } $this->assignRef('favorites', $favorites); $showContact = TPermissions::checkRightContact(); $this->assignRef('showContact', $showContact); jimport('joomla.html.pagination'); $pagination = new JPagination($total, $limitstart, $limit); $this->assignRef('pagination', $pagination); $this->assignRef('list_name', $category->name); $this->assignRef('list_img_default', $category->imgdefault); $this->assignRef('list_img', $category->img); $this->assignRef('list_description', $category->description); $this->assignRef('contents', $contents); $mode = $app->getUserStateFromRequest('com_adsmanager.front_content.mode', 'mode', $conf->display_expand); if ($mode == 2) { $mode = 0; } $this->assignRef('mode', $mode); $columns = array(); $fcolumns = array(); $positions = array(); $fDisplay = array(); if ($mode == 0) { $columns = $columnmodel->getColumns($catid); $fcolumns = $fieldmodel->getFieldsbyColumns(); $this->assignRef('columns', $columns); $this->assignRef('fColumns', $fcolumns); } else { $positions = $positionmodel->getPositions('details'); $fDisplay = $fieldmodel->getFieldsbyPositions(); $this->assignRef('positions', $positions); $this->assignRef('fDisplay', $fDisplay); } $this->assignRef('conf', $conf); $this->assignRef('userid', $user->id); $this->assignRef('requestURL', $requestURL); $document->setTitle(JText::_('ADSMANAGER_PAGE_TITLE') . JText::_($category->name)); if ($catid != 0 && $conf->metadata_mode != 'nometadata') { $document->setMetaData("description", $category->metadata_description); $document->setMetaData("keywords", $category->metadata_keywords); } $field_values = $fieldmodel->getFieldValues(); $plugins = $fieldmodel->getPlugins(); $field = new JHTMLAdsmanagerField($conf, $field_values, $mode, $plugins); $this->assignRef('field', $field); //set breadcrumbs $nb = count($pathlist); for ($i = $nb - 1; $i >= 0; $i--) { $pathway->addItem($pathlist[$i]->text, $pathlist[$i]->link); } $general = new JHTMLAdsmanagerGeneral($catid, $conf, $user); $this->assignRef('general', $general); $searchfields = $fieldmodel->getSearchFields(); $cats = $catmodel->getCatTree(true, false, $nbcontents, 'read', $rootid); $this->assignRef('searchfields', $searchfields); $this->assignRef('cats', $cats); $defaultvalues = array(); $this->assignRef('defaultvalues', $defaultvalues); $this->assignRef('catid', $catid); $text_search = ""; $this->assignRef('text_search', $text_search); parent::display($tpl); }
function getMapImageResize($mimage) { global $pref; return 'class="eb_map_image" ' . getImageResize(getImagePath($mimage, 'games_maps'), $pref['eb_max_map_image_size'], $pref['eb_max_map_image_size_check']) . ' alt="' . $mimage . '"'; }
/** * displayTeamSummary - Displays ... */ function displayTeamSummary($clan_id) { global $sql; global $text; global $pref; global $tp; $q = "SELECT " . TBL_CLANS . ".*, " . TBL_USERS . ".*" . " FROM " . TBL_CLANS . ", " . TBL_USERS . " WHERE (" . TBL_CLANS . ".ClanID = '{$clan_id}')" . " AND (" . TBL_USERS . ".user_id = " . TBL_CLANS . ".Owner)"; $result = $sql->db_Query($q); $num_rows = mysql_numrows($result); $clan_name = mysql_result($result, 0, TBL_CLANS . ".Name"); $clan_owner = mysql_result($result, 0, TBL_USERS . ".user_id"); $clan_owner_name = mysql_result($result, 0, TBL_USERS . ".user_name"); $clan_tag = mysql_result($result, 0, TBL_CLANS . ".Tag"); $clan_avatar = mysql_result($result, 0, TBL_CLANS . ".Image"); $clan_website = mysql_result($result, 0, TBL_CLANS . ".websiteURL"); $clan_email = mysql_result($result, 0, TBL_CLANS . ".email"); $clan_IM = mysql_result($result, 0, TBL_CLANS . ".IM"); $clan_Description = mysql_result($result, 0, TBL_CLANS . ".Description"); $can_manage = 0; if (check_class($pref['eb_mod_class'])) { $can_manage = 1; } if (USERID == $clan_owner) { $can_manage = 1; } if ($can_manage == 1) { $text .= ' <form action="' . e_PLUGIN . 'ebattles/clanmanage.php?clanid=' . $clan_id . '" method="post"> ' . ebImageTextButton('submit', 'page_white_edit.png', EB_CLAN_L8) . ' </form>'; } $text .= '<b>' . $clan_name . ' (' . $clan_tag . ')</b><br />'; $image = ""; if ($clan_avatar) { $image = '<img ' . getAvatarResize(getImagePath($clan_avatar, 'team_avatars')) . '/>'; } else { if ($pref['eb_avatar_default_team_image'] != '') { $image = '<img ' . getAvatarResize(getImagePath($pref['eb_avatar_default_team_image'], 'team_avatars')) . '/>'; } } $text .= '<div>' . $image . '</div>'; $text .= '<table class="eb_table table_left"><tbody>'; $text .= '<tr><td class="eb_td eb_tdc1">' . EB_CLAN_L7 . ':</td>'; $text .= '<td class="eb_td"><a href="' . e_PLUGIN . 'ebattles/userinfo.php?user='******'">' . $clan_owner_name . '</a></td>'; $text .= '</tr>'; $text .= '<tr><td class="eb_td eb_tdc1">' . EB_CLAN_L27 . ':</td>'; $text .= '<td class="eb_td"><a href="http://' . $clan_website . '" rel="external">' . $clan_website . '</a></td>'; $text .= '</tr>'; $text .= '<tr><td class="eb_td eb_tdc1">' . EB_CLAN_L28 . ':</td>'; $text .= '<td class="eb_td"><a href="mailto:' . $clan_email . '">' . $clan_email . '</a></td>'; $text .= '</tr>'; $text .= '<tr><td class="eb_td eb_tdc1">' . EB_CLAN_L29 . ':</td>'; $text .= '<td class="eb_td">' . $clan_IM . '</td>'; $text .= '</tr>'; $text .= '<tr><td class="eb_td eb_tdc1">' . EB_CLAN_L30 . ':</td>'; $text .= '<td class="eb_td">' . $tp->toHTML($clan_Description, true) . '</td>'; $text .= '</tr>'; $text .= '</tbody></table>'; }
} $themePath = getThemePath(true); function getBasePath($return = false) { $url = site_url(); if ($return === true) { return $url; } else { echo $url; } } $basePath = getBasePath(true); function getImagePath($return = false) { $url = get_template_directory_uri() . '/dist/images'; if ($return === true) { return $url; } else { echo $url; } } $imagePath = getImagePath(true); function dist_url() { $url = get_template_directory_uri() . '/dist'; if ($return === true) { return $url; } else { echo $url; } }
/** * displayClans - Displays the Clans database table in * a nicely formatted html table. */ function displayClans() { global $pref; global $sql; global $text; $pages = new Paginator(); if (check_class($pref['eb_teams_create_class'])) { $text .= '<form action="' . e_PLUGIN . 'ebattles/clancreate.php" method="post">'; $text .= '<div>'; $text .= '<input type="hidden" name="userid" value="' . USERID . '"/>'; $text .= '<input type="hidden" name="username" value="' . USERNAME . '"/>'; $text .= '</div>'; $text .= ebImageTextButton('createteam', 'add.png', EB_CLANS_L7); $text .= '</form><br />'; } else { //$text .= '<div>'..'</div>'; } /* set pagination variables */ $q = "SELECT count(*) " . " FROM " . TBL_CLANS; $result = $sql->db_Query($q); $totalItems = mysql_result($result, 0); $pages->items_total = $totalItems; $pages->mid_range = eb_PAGINATION_MIDRANGE; $pages->paginate(); $q = "SELECT " . TBL_CLANS . ".*" . " FROM " . TBL_CLANS . " ORDER BY Name" . " {$pages->limit}"; $result = $sql->db_Query($q); /* Error occurred, return given name by default */ $num_rows = mysql_numrows($result); if (!$result || $num_rows < 0) { $text .= EB_CLANS_L3; return; } if ($num_rows == 0) { $text .= '<div>' . EB_CLANS_L4 . '</div>'; } else { // Paginate $text .= '<span class="paginate" style="float:left;">' . $pages->display_pages() . '</span>'; $text .= '<span style="float:right">'; // Go To Page $text .= $pages->display_jump_menu(); $text .= ' '; // Items per page $text .= $pages->display_items_per_page(); $text .= '</span><br /><br />'; /* Display table contents */ $text .= '<table class="eb_table" style="width:95%"><tbody>'; $text .= '<tr> <th class="eb_th2">' . EB_CLANS_L5 . '</th> <th class="eb_th2">' . EB_CLANS_L6 . '</th> </tr>'; for ($i = 0; $i < $num_rows; $i++) { $clan_id = mysql_result($result, $i, TBL_CLANS . ".ClanID"); $clan = new Clan($clan_id); $image = ""; if ($pref['eb_avatar_enable_teamslist'] == 1) { if ($clan->getField('Image')) { $image = '<img ' . getAvatarResize(getImagePath($clan->getField('Image'), 'team_avatars')) . '/>'; } else { if ($pref['eb_avatar_default_team_image'] != '') { $image = '<img ' . getAvatarResize(getImagePath($pref['eb_avatar_default_team_image'], 'team_avatars')) . '/>'; } } } $text .= '<tr> <td class="eb_td">' . $image . ' <a href="' . e_PLUGIN . 'ebattles/claninfo.php?clanid=' . $clan_id . '">' . $clan->getField('Name') . '</a></td> <td class="eb_td">' . $clan->getField('Tag') . '</td></tr>'; } $text .= '</tbody></table><br />'; } }
if ($conf->metadata_mode != 'nometadata') { $document->setMetaData("description", strip_tags($this->content->metadata_description)); $document->setMetaData("keywords", strip_tags($this->content->metadata_keywords)); } ?> <div class="juloawrapper"> <?php if ($conf->display_inner_pathway == 1) { ?> <div class="breadcrumb row-fluid"> <?php $pathway = ""; $nb = count($this->pathlist); for ($i = $nb - 1; $i > 0; $i--) { $pathway .= '<a href="' . $this->pathlist[$i]->link . '">' . $this->pathlist[$i]->text . '</a>'; $pathway .= ' <img src="' . getImagePath('arrow.png') . '" alt="arrow" /> '; } $pathway .= '<a href="' . $this->pathlist[0]->link . '">' . $this->pathlist[0]->text . '</a>'; echo $pathway; if (function_exists('getContentClass')) { $classcontent = getContentClass($this->content, "details"); } else { $classcontent = ""; } ?> </div> <?php } echo $this->content->event->onContentBeforeDisplay; if (@$conf->print == 1) {
$result_2 = $sql->db_Query($q_2); $tmatches = mysql_result($result_2, 0); // Can replace only if the team has not played a match yet if ($tmatches > 0) { $can_replace_seed[$tseed] = false; } $q_2 = "SELECT DISTINCT " . TBL_AWARDS . ".*" . " FROM " . TBL_AWARDS . ", " . TBL_TEAMS . " WHERE (" . TBL_TEAMS . ".TeamID = '{$tid}')" . " AND (" . TBL_AWARDS . ".Team = " . TBL_TEAMS . ".TeamID)"; $result_2 = $sql->db_Query($q_2); $tawards = mysql_numrows($result_2); $image = ""; if ($pref['eb_avatar_enable_teamslist'] == 1) { if ($clan->getField('Image')) { $image = '<img ' . getAvatarResize(getImagePath($clan->getField('Image'), 'team_avatars')) . '/>'; } else { if ($pref['eb_avatar_default_team_image'] != '') { $image = '<img ' . getAvatarResize(getImagePath($pref['eb_avatar_default_team_image'], 'team_avatars')) . '/>'; } } } $text .= '<tr id="team_' . $tid . '">'; if ($show_seeds_teams == true) { // Column "Seed" if ($can_replace_seed[$tseed] == true) { $can_replace = true; } $text .= '<td class="eb_td">' . $tseed; if ($waiting_list == true) { if ($can_replace_team == true && $can_replace == true) { $text .= '<select class="tbox" name="replace_team_' . $tid . '">'; for ($seed = 1; $seed <= $eMaxNumberPlayers; $seed++) { if ($can_replace_seed[$seed] == true) {
function displayClanSettingsForm($create = false) { global $sql; if (e_WYSIWYG) { $insertjs = "rows='15'"; } else { require_once e_HANDLER . "ren_help.php"; $insertjs = "rows='5' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'"; } if ($create == true) { $clan_str = ''; $action_str = 'actionid=create'; } else { $clan_str = 'clanid=' . $this->getField('ClanID'); $action_str = '&actionid=edit'; } $text .= "\r\n\t\t<script type='text/javascript'>\r\n\t\t<!--//\r\n\t\tfunction changeteamtext(v)\r\n\t\t{\r\n\t\tdocument.getElementById('clanavatar').value=v;\r\n\t\t} //-->\r\n\t\t</script>\r\n\t\t"; if ($this->getField('Image') == '' && $pref['eb_avatar_default_team_image'] != '') { $this->setFieldDB('Image', $pref['eb_avatar_default_team_image']); } $text .= '<form id="form-clan-settings" action="' . e_PLUGIN . 'ebattles/clanprocess.php?' . $clan_str . $action_str . '" method="post">'; $text .= ' <table class="eb_table" style="width:95%"> <tbody> '; //<!-- Clan Name -->' $text .= '<tr>'; $text .= ' <td class="eb_td eb_tdc1 eb_w40">' . EB_CLANM_L9 . '<span class="required">*</span></td> <td class="eb_td"> <input class="tbox required" type="text" size="40" name="clanname" value="' . $this->getField('Name') . '"/> </td> </tr>'; //<!-- Clan Avatar --> $text .= '<tr> <td class="eb_td eb_tdc1 eb_w40">' . EB_CLANM_L29 . '<div class="smalltext">' . EB_CLANM_L30 . '</div></td> <td class="eb_td">'; if ($this->getField('Image') != '') { $text .= '<img ' . getAvatarResize(getImagePath($this->getField('Image'), 'team_avatars')) . '/> '; } $text .= '<input class="tbox" type="text" id="clanavatar" name="clanavatar" size="20" value="' . $this->getField('Image') . '"/>'; $text .= '<div><br />'; $avatarlist = array(); $avatarlist[0] = ""; $handle = opendir(e_PLUGIN . "ebattles/images/team_avatars/"); while ($file = readdir($handle)) { if ($file != "." && $file != ".." && $file != "index.html" && $file != ".svn" && $file != "Thumbs.db") { $avatarlist[] = $file; } } closedir($handle); for ($c = 1; $c <= count($avatarlist) - 1; $c++) { $text .= '<a href="javascript:changeteamtext(\'' . $avatarlist[$c] . '\')"><img src="' . e_PLUGIN . 'ebattles/images/team_avatars/' . $avatarlist[$c] . '" alt="' . $avatarlist[$c] . '" style="border:0"/></a> '; } $text .= ' </div> </td> </tr>'; //<!-- Clan Tag --> $text .= ' <tr> <td class="eb_td eb_tdc1 eb_w40">' . EB_CLANM_L10 . '</td> <td class="eb_td"> <input class="tbox" type="text" size="40" name="clantag" value="' . $this->getField('Tag') . '"/> </td> </tr> '; //<!-- Clan Password --> $text .= ' <tr> <td class="eb_td eb_tdc1 eb_w40">' . EB_CLANM_L11 . '</td> <td class="eb_td"> <input class="tbox" type="text" size="40" name="clanpassword" value="' . $this->getField('password') . '"/> </td> </tr> '; //<!-- Clan Website --> $text .= ' <tr> <td class="eb_td eb_tdc1 eb_w40">' . EB_CLANM_L31 . '</td> <td class="eb_td"> <input class="tbox" type="text" size="40" name="clanwebsite" value="' . $this->getField('websiteURL') . '"/> </td> </tr> '; //<!-- Clan Email --> $text .= ' <tr> <td class="eb_td eb_tdc1 eb_w40">' . EB_CLANM_L32 . '</td> <td class="eb_td"> <input class="tbox" type="text" size="40" name="clanemail" value="' . $this->getField('email') . '"/> </td> </tr> '; //<!-- Clan IM --> $text .= ' <tr> <td class="eb_td eb_tdc1 eb_w40">' . EB_CLANM_L33 . '</td> <td class="eb_td"> <input class="tbox" type="text" size="40" name="clanIM" value="' . $this->getField('IM') . '"/> </td> </tr> '; //<!-- Clan Description --> $text .= ' <tr> <td class="eb_td eb_tdc1 eb_w40">' . EB_CLANM_L34 . '</td> <td class="eb_td"> '; $text .= '<textarea class="tbox" id="clandescription" name="clandescription" cols="70" ' . $insertjs . '>' . $this->getField('Description') . '</textarea>'; if (!e_WYSIWYG) { $text .= '<br />' . display_help("helpb", 1); } $text .= ' </td> </tr> </tbody> </table> '; //<!-- Save Button --> $text .= ' <table><tbody><tr><td> <div> ' . ebImageTextButton('clansettingssave', 'disk.png', EB_CLANM_L12) . ' </div> </td></tr></tbody></table> </form>'; return $text; }
function updateStats($event_id, $time, $serialize = TRUE) { global $sql; global $pref; $rater = new rater(); $file = e_PLUGIN . 'ebattles/cache/sql_cache_event_' . $event_id . '.txt'; $id = array(); $uid = array(); $team = array(); $name = array(); $avatar = array(); $games_played = array(); $ELO = array(); $Skill = array(); $G2 = array(); $win = array(); $loss = array(); $draw = array(); $windrawloss = array(); $streaks = array(); $victory_ratio = array(); $victory_percent = array(); $unique_opponents = array(); $opponentsELO = array(); $score = array(); $oppscore = array(); $scorediff = array(); $points = array(); $forfeits = array(); $forfeits_percent = array(); $banned = array(); $rating = array(); $games_played_score = array(); $ELO_score = array(); $Skill_score = array(); $G2_score = array(); $win_score = array(); $loss_score = array(); $draw_score = array(); $windrawloss_score = array(); $victory_ratio_score = array(); $victory_percent_score = array(); $unique_opponents_score = array(); $opponentsELO_score = array(); $streak_score = array(); $score_score = array(); $oppscore_score = array(); $scorediff_score = array(); $points_score = array(); $forfeits_score = array(); $forfeits_percent_score = array(); /* Event Info */ $event = new Event($event_id); $type = $event->getField('Type'); $competition_type = $event->getCompetitionType(); $hide_ratings_column = $event->getField('hide_ratings_column'); if ($event->getField('RankingType') == "Classic") { $hide_ratings_column = TRUE; } // Update Players stats $q_Players = "SELECT " . TBL_PLAYERS . ".*, " . TBL_USERS . ".*" . " FROM " . TBL_PLAYERS . ", " . TBL_GAMERS . ", " . TBL_USERS . " WHERE (" . TBL_PLAYERS . ".Event = '{$event_id}')" . " AND (" . TBL_PLAYERS . ".Gamer = " . TBL_GAMERS . ".GamerID)" . " AND (" . TBL_USERS . ".user_id = " . TBL_GAMERS . ".User)"; $result_Players = $sql->db_Query($q_Players); $numPlayers = mysql_numrows($result_Players); $players_rated = 0; for ($player = 0; $player < $numPlayers; $player++) { // For each player $pid = mysql_result($result_Players, $player, TBL_PLAYERS . ".PlayerID"); $puid = mysql_result($result_Players, $player, TBL_USERS . ".user_id"); $gamer_id = mysql_result($result_Players, $player, TBL_PLAYERS . ".Gamer"); $gamer = new Gamer($gamer_id); $pname = $gamer->getField('Name'); $pavatar = mysql_result($result_Players, $player, TBL_USERS . ".user_image"); $pteam = mysql_result($result_Players, $player, TBL_PLAYERS . ".Team"); $pgames_played = mysql_result($result_Players, $player, TBL_PLAYERS . ".GamesPlayed"); $pELO = mysql_result($result_Players, $player, TBL_PLAYERS . ".ELORanking"); $pTS_mu = mysql_result($result_Players, $player, TBL_PLAYERS . ".TS_mu"); $pTS_sigma = mysql_result($result_Players, $player, TBL_PLAYERS . ".TS_sigma"); $pSkill = $pTS_mu - 3 * $pTS_sigma; $pG2_r = mysql_result($result_Players, $player, TBL_PLAYERS . ".G2_r"); $pG2_RD = mysql_result($result_Players, $player, TBL_PLAYERS . ".G2_RD"); $pG2 = $pG2_r - 2 * $pG2_RD; $pwin = mysql_result($result_Players, $player, TBL_PLAYERS . ".Win"); $pdraw = mysql_result($result_Players, $player, TBL_PLAYERS . ".Draw"); $ploss = mysql_result($result_Players, $player, TBL_PLAYERS . ".Loss"); $pstreak = mysql_result($result_Players, $player, TBL_PLAYERS . ".Streak"); $pstreak_worst = mysql_result($result_Players, $player, TBL_PLAYERS . ".Streak_Worst"); $pstreak_best = mysql_result($result_Players, $player, TBL_PLAYERS . ".Streak_Best"); $pwindrawloss = $pwin . "/" . $pdraw . "/" . $ploss; $pwinloss = $pwin . "/" . $ploss; $pvictory_ratio = $ploss > 0 ? $pwin / $ploss : $pwin; //fm- draw here??? $pvictory_percent = $pwin + $pdraw + $ploss > 0 ? 100 * $pwin / ($pwin + $pdraw + $ploss) : 0; $pscore = mysql_result($result_Players, $player, TBL_PLAYERS . ".Score"); $poppscore = mysql_result($result_Players, $player, TBL_PLAYERS . ".ScoreAgainst"); $ppoints = mysql_result($result_Players, $player, TBL_PLAYERS . ".Points"); $pforfeits = mysql_result($result_Players, $player, TBL_PLAYERS . ".Forfeits"); $pforfeits_percent = $pgames_played > 0 ? 100 * $pforfeits / $pgames_played : 0; $pbanned = mysql_result($result_Players, $player, TBL_PLAYERS . ".Banned"); $popponentsELO = 0; $popponents = 0; $prating = 0; $prating_votes = 0; // Unique Opponents // Find all matches played by current player $q_Matches = "SELECT " . TBL_MATCHS . ".*, " . TBL_SCORES . ".*, " . TBL_PLAYERS . ".*" . " FROM " . TBL_MATCHS . ", " . TBL_SCORES . ", " . TBL_PLAYERS . " WHERE (" . TBL_SCORES . ".MatchID = " . TBL_MATCHS . ".MatchID)" . " AND (" . TBL_MATCHS . ".Status = 'active')" . " AND (" . TBL_PLAYERS . ".PlayerID = " . TBL_SCORES . ".Player)" . " AND (" . TBL_PLAYERS . ".PlayerID = '{$pid}')"; $result_Matches = $sql->db_Query($q_Matches); $numMatches = mysql_numrows($result_Matches); $players = array(); if ($numMatches > 0) { for ($match = 0; $match < $numMatches; $match++) { // For each match played by current player $mID = mysql_result($result_Matches, $match, TBL_MATCHS . ".MatchID"); $mplayermatchteam = mysql_result($result_Matches, $match, TBL_SCORES . ".Player_MatchTeam"); // Find all scores/players(+users) for that match $q_Scores = "SELECT " . TBL_MATCHS . ".*, " . TBL_SCORES . ".*, " . TBL_PLAYERS . ".*, " . TBL_USERS . ".*" . " FROM " . TBL_MATCHS . ", " . TBL_SCORES . ", " . TBL_PLAYERS . ", " . TBL_GAMERS . ", " . TBL_USERS . " WHERE (" . TBL_MATCHS . ".MatchID = '{$mID}')" . " AND (" . TBL_SCORES . ".MatchID = " . TBL_MATCHS . ".MatchID)" . " AND (" . TBL_PLAYERS . ".PlayerID = " . TBL_SCORES . ".Player)" . " AND (" . TBL_PLAYERS . ".Gamer = " . TBL_GAMERS . ".GamerID)" . " AND (" . TBL_USERS . ".user_id = " . TBL_GAMERS . ".User)"; $result_Scores = $sql->db_Query($q_Scores); $numScores = mysql_numrows($result_Scores); for ($scoreIndex = 0; $scoreIndex < $numScores; $scoreIndex++) { $osid = mysql_result($result_Scores, $scoreIndex, TBL_SCORES . ".ScoreID"); $ouid = mysql_result($result_Scores, $scoreIndex, TBL_USERS . ".user_id"); $oplayermatchteam = mysql_result($result_Scores, $scoreIndex, TBL_SCORES . ".Player_MatchTeam"); $oELO = mysql_result($result_Scores, $scoreIndex, TBL_PLAYERS . ".ELORanking"); if ($oplayermatchteam != $mplayermatchteam) { $players[] = "{$ouid}"; $popponentsELO += $oELO; $popponents += 1; } if ($ouid == $puid) { // Get user rating. $rate = $rater->GetRating("ebscores", $osid); $prating += $rate[0] * ($rate[1] + $rate[2] / 10); $prating_votes += $rate[0]; } } } } $punique_opponents = count(array_unique($players)); if ($popponents != 0) { $popponentsELO /= $popponents; } if ($prating_votes != 0) { $prating /= $prating_votes; } // For display $id[] = $pid; $uid[] = $puid; $name[] = $pname; $avatar[] = $pavatar; $team[] = $pteam; $games_played[] = $pgames_played; $ELO[] = $pELO; $Skill[] = max(0, number_format($pSkill, 0)); $G2[] = number_format($pG2_r, 0) . " +/- " . number_format($pG2_RD, 0); $win[] = $pwin; $loss[] = $ploss; $draw[] = $pdraw; $streaks[] = $pstreak . "|" . $pstreak_best . "|" . $pstreak_worst; $windrawloss[] = $pwindrawloss; $victory_ratio[] = $pwinloss; $victory_percent[] = number_format($pvictory_percent, 2) . "%"; $unique_opponents[] = $punique_opponents; $opponentsELO[] = floor($popponentsELO); $score[] = $pgames_played > 0 ? number_format($pscore / $pgames_played, 2) : 0; $oppscore[] = $pgames_played > 0 ? number_format($poppscore / $pgames_played, 2) : 0; $scorediff[] = $pgames_played > 0 ? number_format(($pscore - $poppscore) / $pgames_played, 2) : 0; $points[] = $ppoints; $forfeits[] = $pforfeits; $forfeits_percent[] = number_format($pforfeits_percent, 2) . "%"; $banned[] = $pbanned; $rating[] = displayRating($prating, $prating_votes); // Actual score (not for display) $games_played_score[] = $pgames_played; $ELO_score[] = $pELO; $Skill_score[] = $pSkill; $G2_score[] = $pG2; $win_score[] = $pwin; $loss_score[] = $ploss; $draw_score[] = $pdraw; $windrawloss_score[] = $pwin - $ploss; //fm - ??? $victory_ratio_score[] = $pvictory_ratio; $victory_percent_score[] = $pvictory_percent; $unique_opponents_score[] = $punique_opponents; $opponentsELO_score[] = $popponentsELO; $streaks_score[] = $pstreak_best; //max(0,$pstreak_best + $pstreak_worst); //fmarc- TBD $score_score[] = $pgames_played > 0 ? $pscore / $pgames_played : 0; $oppscore_score[] = $pgames_played > 0 ? -$poppscore / $pgames_played : 0; $scorediff_score[] = $pgames_played > 0 ? ($pscore - $poppscore) / $pgames_played : 0; $points_score[] = $ppoints; $forfeits_score[] = -$pforfeits; $forfeits_percent_score[] = -$pforfeits_percent; if ($pgames_played >= $event->getField('nbr_games_to_rank') && $pbanned == 0) { $players_rated++; } } $rating_max = 0; $q_Categories = "SELECT " . TBL_STATSCATEGORIES . ".*" . " FROM " . TBL_STATSCATEGORIES . " WHERE (" . TBL_STATSCATEGORIES . ".Event = '{$event_id}')" . " ORDER BY " . TBL_STATSCATEGORIES . ".CategoryMaxValue DESC"; $result_Categories = $sql->db_Query($q_Categories); $numCategories = mysql_numrows($result_Categories); $stat_cat_header = array(); $stat_min = array(); $stat_max = array(); $stat_a = array(); $stat_b = array(); $stat_score = array(); $stat_display = array(); $cat_index = 0; $categories = array(); for ($category = 0; $category < $numCategories; $category++) { $cat_name = mysql_result($result_Categories, $category, TBL_STATSCATEGORIES . ".CategoryName"); $cat_minpoints = mysql_result($result_Categories, $category, TBL_STATSCATEGORIES . ".CategoryMinValue"); $cat_maxpoints = mysql_result($result_Categories, $category, TBL_STATSCATEGORIES . ".CategoryMaxValue"); $cat_InfoOnly = mysql_result($result_Categories, $category, TBL_STATSCATEGORIES . ".InfoOnly"); if ($cat_maxpoints > 0) { //dbg- echo "$cat_name<br>"; $display_cat = 1; switch ($cat_name) { case "ELO": $cat_header_title = EB_STATS_L1; $cat_header_text = EB_STATS_L2; $min = min($ELO_score); $max = max($ELO_score); $stat_score[$cat_index] = $ELO_score; $stat_display[$cat_index] = $ELO; break; case "Skill": $cat_header_title = EB_STATS_L3; $cat_header_text = EB_STATS_L4; $min = min($Skill_score); $max = max($Skill_score); $stat_score[$cat_index] = $Skill_score; $stat_display[$cat_index] = $Skill; break; case "Glicko2": $cat_header_title = EB_STATS_L41; $cat_header_text = EB_STATS_L42; $min = min($G2_score); $max = max($G2_score); $stat_score[$cat_index] = $G2_score; $stat_display[$cat_index] = $G2; break; case "GamesPlayed": $cat_header_title = EB_STATS_L5; $cat_header_text = EB_STATS_L6; $min = 0; //min($games_played_score); $max = max($games_played); $stat_score[$cat_index] = $games_played_score; $stat_display[$cat_index] = $games_played; break; case "VictoryRatio": $cat_header_title = EB_STATS_L7; $cat_header_text = EB_STATS_L8; $min = 0; //min($victory_ratio_score); $max = max($victory_ratio_score); $stat_score[$cat_index] = $victory_ratio_score; $stat_display[$cat_index] = $victory_ratio; break; case "VictoryPercent": $cat_header_title = EB_STATS_L9; $cat_header_text = EB_STATS_L10; $min = 0; //min($victory_percent_score); $max = max($victory_percent_score); $stat_score[$cat_index] = $victory_percent_score; $stat_display[$cat_index] = $victory_percent; break; case "WinDrawLoss": $cat_header_title = EB_STATS_L11; $cat_header_text = EB_STATS_L12; $min = min($windrawloss_score); $max = max($windrawloss_score); $stat_score[$cat_index] = $windrawloss_score; $stat_display[$cat_index] = $windrawloss; break; case "UniqueOpponents": $cat_header_title = EB_STATS_L13; $cat_header_text = EB_STATS_L14; $min = 0; //min($unique_opponents_score); $max = max($unique_opponents_score); $stat_score[$cat_index] = $unique_opponents_score; $stat_display[$cat_index] = $unique_opponents; break; case "OpponentsELO": $cat_header_title = EB_STATS_L15; $cat_header_text = EB_STATS_L16; $min = min($opponentsELO_score); $max = max($opponentsELO_score); $stat_score[$cat_index] = $opponentsELO_score; $stat_display[$cat_index] = $opponentsELO; break; case "Streaks": $cat_header_title = EB_STATS_L17; $cat_header_text = EB_STATS_L18; $min = min($streaks_score); $max = max($streaks_score); $stat_score[$cat_index] = $streaks_score; $stat_display[$cat_index] = $streaks; break; case "Score": $cat_header_title = EB_STATS_L19; $cat_header_text = EB_STATS_L20; $min = min($score_score); $max = max($score_score); $stat_score[$cat_index] = $score_score; $stat_display[$cat_index] = $score; break; case "ScoreAgainst": $cat_header_title = EB_STATS_L21; $cat_header_text = EB_STATS_L22; $min = min($oppscore_score); $max = max($oppscore_score); $stat_score[$cat_index] = $oppscore_score; $stat_display[$cat_index] = $oppscore; break; case "ScoreDiff": $cat_header_title = EB_STATS_L23; $cat_header_text = EB_STATS_L24; $min = min($scorediff_score); $max = max($scorediff_score); $stat_score[$cat_index] = $scorediff_score; $stat_display[$cat_index] = $scorediff; break; case "Points": $cat_header_title = EB_STATS_L25; $cat_header_text = EB_STATS_L26; $min = min($points_score); $max = max($points_score); $stat_score[$cat_index] = $points_score; $stat_display[$cat_index] = $points; break; case "Forfeits": $cat_header_title = EB_STATS_L43; $cat_header_text = EB_STATS_L44; $min = min($forfeits_score); $max = max($forfeits_score); $stat_score[$cat_index] = $forfeits_score; $stat_display[$cat_index] = $forfeits; break; case "ForfeitsPercent": $cat_header_title = EB_STATS_L45; $cat_header_text = EB_STATS_L46; $min = min($forfeits_percent_score); $max = max($forfeits_percent_score); $stat_score[$cat_index] = $forfeits_percent_score; $stat_display[$cat_index] = $forfeits_percent; break; default: $display_cat = 0; } if ($display_cat == 1) { $stat_InfoOnly[$cat_index] = $cat_InfoOnly; switch ($event->getField('RankingType')) { case "CombinedStats": if ($cat_InfoOnly == TRUE) { $cat_header = '<b title="' . $cat_header_title . '">' . $cat_header_text . '</b>'; } else { $categories[] = $cat_index; $cat_header = '<b title="' . $cat_header_title . ' [' . number_format($cat_maxpoints, 2) . ' ' . EB_STATS_L27 . ']">' . $cat_header_text . '</b>'; /* $cat_header = ' <b title="'.$cat_header_title.'">'.$cat_header_text.'</b> <br /><div class="smalltext">['.number_format ($cat_maxpoints,2).' '.EB_STATS_L27.']</div> '; */ // a = (ymax-ymin)/(xmax-xmin) // b = ymin - a.xmin if ($max == $min) { $a = 0; $b = $cat_maxpoints; } else { $a = ($cat_maxpoints - $cat_minpoints) / ($max - $min); $b = $cat_minpoints - $a * $min; } $stat_min[$cat_index] = $min; $stat_max[$cat_index] = $max; $stat_a[$cat_index] = $a; $stat_b[$cat_index] = $b; $rating_max += $cat_maxpoints; } break; case "Classic": if ($cat_InfoOnly == TRUE) { $cat_header = '<span title="' . $cat_header_title . '">' . $cat_header_text . '</span>'; } else { $cat_header = '<b title="' . $cat_header_title . '">' . $cat_header_text . '</b>'; $categories[] = $cat_index; } break; default: } $stat_cat_header[$cat_index] = $cat_header; $cat_index++; } } } $numDisplayedCategories = $cat_index; $ranks = getRanking($stat_score, $categories); $stats = array("0" => array('header', '<b>' . EB_STATS_L28 . '</b>', '<b>' . EB_STATS_L29 . '</b>')); // user rating not shown // $stats[0][] = '<b>'.EB_STATS_L30.'</b>'; if ($hide_ratings_column == FALSE) { $stats[0][] = '<b title="' . EB_STATS_L31 . ' [' . number_format($rating_max, 2) . ' ' . EB_STATS_L27 . ']">' . EB_STATS_L32 . '</b>'; } //$stats[0][] = '<b title="'.EB_STATS_L31.'">'.EB_STATS_L32.'</b><br /><div class="smalltext">['.number_format ($rating_max,2).' '.EB_STATS_L27.']</div>'; for ($category = 0; $category < $numDisplayedCategories; $category++) { $stats[0][] = $stat_cat_header[$category]; } // Challenge column $stats[0][] = "<b>" . EB_CHALLENGE_L1 . "<b>"; switch ($event->getField('RankingType')) { case "CombinedStats": $OverallScoreThreshold = 0; $final_score = array(); for ($player = 0; $player < $numPlayers; $player++) { $OverallScore[$player] = 0; if ($games_played[$player] >= $event->getField('nbr_games_to_rank') && $banned[$player] == 0) { for ($category = 0; $category < $numDisplayedCategories; $category++) { if ($stat_InfoOnly[$category] == FALSE) { $final_score[$category][$player] = $stat_a[$category] * $stat_score[$category][$player] + $stat_b[$category]; $OverallScore[$player] += $final_score[$category][$player]; } } } else { for ($category = 0; $category < $numDisplayedCategories; $category++) { $final_score[$category][$player] = 0; } } $q_update = "UPDATE " . TBL_PLAYERS . " SET OverallScore = '" . floatToSQL($OverallScore[$player]) . "' WHERE (PlayerID = '{$id[$player]}') AND (Event = '{$event_id}')"; $result_update = $sql->db_Query($q_update); } break; case "Classic": $OverallScoreThreshold = $numPlayers; for ($player = 0; $player < $numPlayers; $player++) { if ($games_played[$player] >= $event->getField('nbr_games_to_rank') && $banned[$player] == 0) { $OverallScore[$player] = array_search($player, $ranks, false) + $numPlayers + 1; } else { $OverallScore[$player] = array_search($player, $ranks, false); } //dbg: echo "<br>Player $player ($name[$player]), os: $OverallScore[$player]"; $q_update = "UPDATE " . TBL_PLAYERS . " SET OverallScore = '" . floatToSQL($OverallScore[$player]) . "' WHERE (PlayerID = '{$id[$player]}') AND (Event = '{$event_id}')"; $result_update = $sql->db_Query($q_update); } break; default: } // Build results table //-------------------- $q_Players = "SELECT *" . " FROM " . TBL_PLAYERS . " WHERE (Event = '{$event_id}')" . " ORDER BY " . TBL_PLAYERS . ".OverallScore DESC, " . TBL_PLAYERS . ".GamesPlayed DESC, " . TBL_PLAYERS . ".ELORanking DESC, " . TBL_PLAYERS . ".Banned ASC"; $result_Players = $sql->db_Query($q_Players); $ranknumber = 1; for ($player = 0; $player < $numPlayers; $player++) { $pid = mysql_result($result_Players, $player, TBL_PLAYERS . ".PlayerID"); $puid = mysql_result($result_Players, $player, TBL_PLAYERS . ".User"); $prank = mysql_result($result_Players, $player, TBL_PLAYERS . ".Rank"); $prankdelta = mysql_result($result_Players, $player, TBL_PLAYERS . ".RankDelta"); $pstreak = mysql_result($result_Players, $player, TBL_PLAYERS . ".Streak"); // Find index of player $index = array_search($pid, $id); $prank_side_image = ""; if ($banned[$index] == 1) { $rank = '<span title="' . EB_STATS_L33 . '"><img class="eb_image" src="' . e_PLUGIN . 'ebattles/images/user_delete.ico" alt="' . EB_STATS_L34 . '" title="' . EB_STATS_L34 . '"/></span>'; $prankdelta_string = ""; $q_update = "UPDATE " . TBL_PLAYERS . " SET Rank = 0 WHERE (PlayerID = '{$pid}') AND (Event = '{$event_id}')"; $result_update = $sql->db_Query($q_update); } elseif ($OverallScore[$index] <= $OverallScoreThreshold) { $rank = '<span title="' . EB_STATS_L35 . '">' . EB_STATS_L36 . '</span>'; $prankdelta_string = ""; $q_update = "UPDATE " . TBL_PLAYERS . " SET Rank = 0 WHERE (PlayerID = '{$pid}') AND (Event = '{$event_id}')"; $result_update = $sql->db_Query($q_update); } else { $rank = $ranknumber; $ranknumber++; // increases $ranknumber by 1 $q_update = "UPDATE " . TBL_PLAYERS . " SET Rank = {$rank} WHERE (PlayerID = '{$pid}') AND (Event = '{$event_id}')"; $result_update = $sql->db_Query($q_update); $new_rankdelta = $prank - $rank; if ($new_rankdelta != 0) { $prankdelta += $new_rankdelta; $q_update = "UPDATE " . TBL_PLAYERS . " SET RankDelta = {$prankdelta} WHERE (PlayerID = '{$pid}') AND (Event = '{$event_id}')"; $result_update = $sql->db_Query($q_update); } if ($new_rankdelta != 0 && $rank == 1 && $competition_type == 'Ladder') { // Award: player took 1st place $q_Awards = "INSERT INTO " . TBL_AWARDS . "(Player,Type,timestamp)\r\n\t\t\t\tVALUES ({$pid},'PlayerTookFirstPlace',{$time})"; $result_Awards = $sql->db_Query($q_Awards); } if ($new_rankdelta != 0 && ($prank > 10 || $prank == 0) && $rank <= 10 && $competition_type == 'Ladder') { // Award: player enters top 10 $q_Awards = "INSERT INTO " . TBL_AWARDS . "(Player,Type,timestamp)\r\n\t\t\t\tVALUES ({$pid},'PlayerInTopTen',{$time})"; $result_Awards = $sql->db_Query($q_Awards); } $q_Awards = "SELECT " . TBL_AWARDS . ".*, " . TBL_PLAYERS . ".*" . " FROM " . TBL_AWARDS . ", " . TBL_PLAYERS . " WHERE (" . TBL_AWARDS . ".Player = " . TBL_PLAYERS . ".PlayerID)" . " AND (" . TBL_PLAYERS . ".PlayerID = '{$pid}')" . " ORDER BY " . TBL_AWARDS . ".timestamp DESC"; $result_Awards = $sql->db_Query($q_Awards); $numAwards = mysql_numrows($result_Awards); if ($numAwards > 0) { $paward = mysql_result($result_Awards, 0, TBL_AWARDS . ".AwardID"); $pawardType = mysql_result($result_Awards, 0, TBL_AWARDS . ".Type"); } if ($rank == 1) { $prank_side_image = '<img class="eb_image" src="' . e_PLUGIN . 'ebattles/images/awards/award_star_gold_3.png" alt="' . EB_AWARD_L3 . '" title="' . EB_AWARD_L3 . '"/>'; } else { if ($rank <= 10 && ($rank + $prankdelta > min(10, $numPlayers) || $rank + $prankdelta == 0)) { $prank_side_image = '<img class="eb_image" src="' . e_PLUGIN . 'ebattles/images/awards/award_star_bronze_3.png" alt="' . EB_AWARD_L5 . '" title="' . EB_AWARD_L5 . '"/>'; } else { if ($numAwards > 0 && $pawardType != 'PlayerTookFirstPlace' && $pawardType != 'PlayerInTopTen' && $pstreak >= 5) { switch ($pawardType) { case 'PlayerStreak5': if ($pstreak >= 5) { $award = EB_AWARD_L6; $prank_side_image = '<img class="eb_image" src="' . e_PLUGIN . 'ebattles/images/awards/medal_bronze_3.png" alt="' . EB_AWARD_L7 . '" title="' . EB_AWARD_L7 . '"/>'; } break; case 'PlayerStreak10': if ($pstreak >= 10) { $award = EB_AWARD_L8; $prank_side_image = '<img class="eb_image" src="' . e_PLUGIN . 'ebattles/images/awards/medal_silver_3.png" alt="' . EB_AWARD_L9 . '" title="' . EB_AWARD_L9 . '"/>'; } break; case 'PlayerStreak25': if ($pstreak >= 25) { $award = EB_AWARD_L10; $prank_side_image = '<img class="eb_image" src="' . e_PLUGIN . 'ebattles/images/awards/medal_gold_3.png" alt="' . EB_AWARD_L11 . '" title="' . EB_AWARD_L11 . '"/>'; } break; } } else { if ($prankdelta > 0) { $prank_side_image = '<img class="eb_image" src="' . e_PLUGIN . 'ebattles/images/arrow_up.gif" alt="+' . $prankdelta . '" title="+' . $prankdelta . '"/>'; } else { if ($prankdelta < 0 && $rank + $prankdelta != 0) { $prank_side_image = '<img class="eb_image" src="' . e_PLUGIN . 'ebattles/images/arrow_down.gif" alt="' . $prankdelta . '" title="' . $prankdelta . '"/>'; } else { if ($rank + $prankdelta == 0) { $prank_side_image = '<img class="eb_image" src="' . e_PLUGIN . 'ebattles/images/arrow_up.gif" alt="Up" title="' . EB_STATS_L37 . '"/>'; } } } } } } } list($pclan, $pclantag, $pclanid) = getClanInfo($team[$index]); if (strcmp(USERID, $puid) == 0) { $stats_row = array("row_highlight"); } else { $stats_row = array("row"); } $stats_row[] = "<b>{$rank}</b> {$prank_side_image}"; $image = ""; if ($pref['eb_avatar_enable_playersstandings'] == 1) { if ($avatar[$index]) { $image = '<img ' . getAvatarResize(avatar($avatar[$index])) . '/>'; } else { if ($pref['eb_avatar_default_image'] != '') { $image = '<img ' . getAvatarResize(getImagePath($pref['eb_avatar_default_image'], 'avatars')) . '/>'; } } } $stats_row[] = $image . ' <a href="' . e_PLUGIN . 'ebattles/userinfo.php?user='******'"><b>' . $pclantag . $name[$index] . '</b></a>'; // user rating not shown //$stats_row[] = $rating[$index]; if ($hide_ratings_column == FALSE) { $stats_row[] = number_format($OverallScore[$index], 2); } for ($category = 0; $category < $numDisplayedCategories; $category++) { if ($stat_InfoOnly[$category] == TRUE || $event->getField('RankingType') == "Classic") { $stats_row[] = $stat_display[$category][$index]; } else { $stats_row[] = $stat_display[$category][$index] . '<br /><div class="smalltext">[' . number_format($final_score[$category][$index], 2) . ']</div>'; } } // Add challenge button here $challenge_text = ' <a href="javascript:challenge_player_js(\'' . $pid . '\');" title="' . EB_CHALLENGE_L1 . ' ' . $pclantag . $name[$index] . '"><img class="eb_image" src="' . e_PLUGIN . 'ebattles/images/challenge.png" alt="' . EB_CHALLENGE_L1 . ' ' . $pclantag . $name[$index] . '"/></a>'; $stats_row[] = $challenge_text; $stats[] = $stats_row; } /* // debug print array print_r($stats); print_r($stat_score); echo "<br>"; print_r($ranks); */ if ($serialize) { // Serialize results array $OUTPUT = serialize($stats); $fp = fopen($file, "w"); // open file with Write permission if ($fp == FALSE) { // handle error $error .= EB_STATS_L38; echo $error; exit; } fputs($fp, $OUTPUT); fclose($fp); /* $stats = unserialize(implode('',file($file))); foreach ($stats as $id=>$row) { print $row['category_name']."<br />"; } */ } }
if (!checkPrivacy($conn)) { exit("Sorry, your friend(s) is not a registered user."); } $recipeName = getRecipeName($conn); $allSteps = getAllSteps($conn); $privacy = getPrivacy(); $recipeId = insertRecipeIntoDB($recipeName, $userId, $allSteps, $privacy, $conn); //if error in inserting recipe into db if ($recipeId < 0) { exit("Sorry, could not access database when adding recipe. Please try again."); } $photoPath = NULL; //check if image uploaded if (checkImageUploaded()) { $photo = getImageTmpName(); $photoPath = getImagePath($recipeId); if (!mkdir("images/" . $recipeId, 0777, true)) { exit('Could not upload image to server.'); } if (!move_uploaded_file($photo, "images/" . $photoPath)) { exit('Could not create space on server for image.'); } if (!updateImagePathInDB($conn, "images/" . $photoPath, $recipeId)) { exit('Could not connect image to account.'); } } $numFriends = countFriends(); $success = addFriendsToDB($conn, $numFriends, $recipeId); //if error in inserting friends into db if (!$success) { exit("Sorry, could not access database when adding friends. Please try again.");
<?php if ($this->list_img != "") { // if($this->list_img_default) { // echo '<i class="icon-th-list"></i>'; // } else { echo '<img class="imgheading" src="' . $this->list_img . '" alt="' . $this->list_img . '" />'; // } } echo JText::_($this->list_name); if ($this->conf->show_rss == 1) { if (isset($this->listuser)) { $linkrss = TRoute::_("index.php?option=com_adsmanager&view=list&format=feed&user="******"index.php?option=com_adsmanager&view=list&format=feed&catid=" . $this->catid); } echo '<a href="' . $linkrss . '" target="_blank"><img class="feed imgheading" src="' . getImagePath('rss.png') . '" alt="rss" /></a>'; } ?> </legend> </fieldset> </div> <div class="row-fluid"> <div class="span12"> <?php foreach ($this->subcats as $key => $subcat) { $subcat->link = TRoute::_('index.php?option=com_adsmanager&view=list&catid=' . $subcat->id); if ($key != 0) { echo ' | '; } echo '<a href="' . $subcat->link . '">' . $subcat->name . '</a>';
function uploadedFileExists($u, $subdir = "") { $imagePath = getImagePath($u, $subdir); return file_exists($imagePath); }
<?php getData("hardrock"); ?> </div> </div> </div> <div data-role="page" id="dialogPage_14" data-transition="slidedown" data-rel="dialog"> <h1 class="verplaatsing">Hair Metal</h1> <div role="main" class="ui-content"> <?php getData("hairmetal"); ?> <div class="gallery" align="center"> <div class="thumbnails"> <?php getImagePath("hairmetal"); ?> </div> </div> <?php getMore("hairmetal"); ?> </div> </div> <div data-role="page" id="dialogPage_7" data-transition="slidedown" data-rel="dialog"> <h1 class="verplaatsing">Deathcore</h1> <div role="main" class="ui-content"> <?php getData("deathcore"); ?> <div data-role="collapsible" data-collapsed="true">
$classcontent = " " . getContentClass($content, "grid"); } else { $classcontent = ""; } //icon flag $iconflag = false; $iconText = ''; if ($this->conf->show_new == true && $this->isNewcontent($content->date_created, $this->conf->nbdays_new)) { $iconText .= "<span class='iconflag'><img alt='new' src='" . getImagePath('new.gif') . "' /> "; $iconflag = true; } if ($this->conf->show_hot == true && $content->views >= $this->conf->nbhits) { if ($iconflag == false) { $iconText .= "<span class='iconflag'>"; } $iconText .= "<img alt='hot' src='" . getImagePath('hot.gif') . "' />"; $iconflag = true; } if ($iconflag == true) { $iconText .= "</span>"; } ?> <!-- <div class="row image_container container">--> <div class="adsmanager-grid<?php echo $classcontent; ?> "> <h4 class="no-margin-top"> <?php echo "<a href='" . $linkTarget . "'>" . $content->ad_headline . "</a>"; ?>