/**
  * Denna kan se lite annorlunda ut eftersom det är in showStyle.
  * Det kanske inte innehåller secifikt footer och header.
  */
 public function showContent()
 {
     /* First Gallery start on klick on Gallery */
     if ($this->m->level == 0) {
         $q = new Query("matruschka");
         $q->whereImage("mParent='" . $this->m->ID . "' AND mPublished='1' AND mLang='" . $this->m->lang . "'", "ASC", 1);
         $q->whereImage("mParent='" . $q->getResultRow("mRowid") . "' AND mPublished='1' AND mLang='" . $this->m->lang . "'", "ASC", 1);
         $showID = $q->getResultRow("mRowid");
     } else {
         if ($this->m->level == 2) {
             $showID = $this->m->ID;
         }
     }
     $q = new Query("matruschka");
     $q->whereImage("mParent='" . $showID . "' AND mPublished='1' AND mLang='" . $this->m->lang . "'", "ASC", 0);
     $qq = new Query("matruschka");
     $qq->whereImage("mRowid='" . $showID . "' AND mPublished='1' AND mLang='" . $this->m->lang . "'", "ASC", 0);
     /* Main image */
     $ret = '<div id="pic">';
     while ($row = mysql_fetch_object($q->getResult())) {
         $ret .= '<img src="admin/' . Settings::$uploaded_images . '/' . $row->miFilename . '" alt="' . $row->imagesName . '"/>';
     }
     $ret .= '<div id="play">';
     $ret .= '<p>Click to pause</p>';
     $ret .= '<p style="display:none;">Click to play</p>';
     $ret .= '</div>';
     $ret .= '<div id="imageInfo">';
     $ret .= '<span class="style1">';
     $ret .= '<br/><br/>';
     $ret .= $qq->getResultRow("mDescription");
     $ret .= '</span">';
     $ret .= '</div>';
     //imageInfo
     $ret .= '</div>';
     //pic
     /* The thumbs */
     $ret .= '<div id="thumbs">';
     $x = 0;
     $q->whereImage("mParent='" . $showID . "' AND mPublished='1' AND mLang='" . $this->m->lang . "'", "ASC", 0);
     while ($row = mysql_fetch_object($q->getResult())) {
         $class = $x % 2 == 1 ? "rightImg" : "";
         $ret .= '<img class="' . $class . '"src="admin/' . Settings::$uploaded_images . '/' . $row->miFilename . '" alt="' . $row->imagesName . '" />';
         $x++;
     }
     $ret .= '</div>';
     //thumbs
     return $ret;
 }
 public function setContent()
 {
     $q = new Query("matruschkaShowAtPlaces");
     $q->showAt("Menubar", $this->m->lang, "mOrderNo", "ASC", 10);
     $a = array();
     $i = 0;
     while ($row = mysql_fetch_object($q->getResult())) {
         // Get the id and image
         $a[$i][0] = $row->mRowid;
         $a[$i][1] = $row->mButtonTitle;
         $a[$i][2] = $row->mButtonImage;
         $i++;
     }
     for ($i = 0; $i < count($a); $i++) {
         $im = split(',', $a[$i][2]);
         $this->content .= '<span class="menuItem">' . "\n";
         $this->content .= "<a href=\"?ID=" . $a[$i][0] . "\" onmouseout=\"MM_swapImgRestore()\" onmouseover=\"MM_swapImage('" . $im[1] . "','','" . Settings::$graphics . "menu/" . $this->m->lang . "/" . $im[1] . "',1)\">";
         // Den man är inne på blir röd
         $image = $this->getActive($this->m->ID, $a[$i][0]) ? $im[1] : $im[0];
         $this->content .= '<img src="' . Settings::$graphics . 'menu/' . $this->m->lang . '/' . $image . '" alt="' . $im[1] . '" name="' . $im[1] . '"  border="0" id="' . $im[1] . '" />';
         $this->content .= '</a>';
         if ($i < count($a) - 1) {
             $this->content .= '<img src="' . Settings::$graphics . 'menu/' . $this->m->lang . '/stripe.gif" width="7" height="12" />';
         }
         $this->content .= "</span>\n";
     }
 }
Example #3
0
 /**
  * Inenhåller menun som passar till Art
  * subkategprierna ordnas efter orderNo i matrushkan.
  */
 public function setContent()
 {
     $q = new Query("matruschkaShowAtPlaces");
     $q->showAt($this->title, $this->m->lang, "msapOrderNo", "ASC", 100);
     $i = 1;
     while ($row = mysql_fetch_object($q->getResult())) {
         $this->content .= '<div class="leftMenu">';
         $this->content .= '<span class="subSecTitle">' . $row->mButtonTitle . '</span>';
         $qq = new Query("matruschka");
         $qq->whereCustom("mButtonTitle, mRowid", "mParent = '" . $row->mRowid . "' AND mPublished='1' AND mLang='" . $this->m->lang . "'  ", "mOrderNo", "ASC", 0);
         if ($qq->getNumRows()) {
             // om det finns nån som har denna som parent
             $this->content .= '<div class="subSection">';
             while ($row2 = mysql_fetch_object($qq->getResult())) {
                 /** Svart om aktiv **/
                 if ($this->getActive($this->m->ID, $row2->mRowid) == 1) {
                     $this->content .= '<span  class="sideMenuActive"><a href="?ID=' . $row2->mRowid . '">' . $row2->mButtonTitle . '</a></span><br/>';
                 } else {
                     $this->content .= '<a href="?ID=' . $row2->mRowid . '">' . $row2->mButtonTitle . '</a><br/>';
                 }
             }
             $this->content .= '</div>';
         }
         $this->content .= '</div>';
         if ($i != $q->getNumRows()) {
             $this->content .= '<img src="' . Settings::$graphics . 'stripes.gif" />' . "\n";
         }
         $i++;
     }
 }
Example #4
0
 /**
  * Inenhåller menun som passar till Art
  * subkategprierna ordnas efter orderNo i matrushkan.
  */
 public function setContent()
 {
     $q = new Query("matruschkaShowAtPlaces");
     $qq = new Query("matruschka");
     $qqq = new Query("matruschka");
     $q->showAt($this->title, $this->m->lang, "mOrderNo", "ASC", 100);
     $i = 1;
     while ($row = mysql_fetch_object($q->getResult())) {
         $this->content .= '<div class="leftMenu">';
         $this->content .= '<span class="subSecTitle">' . $row->mButtonTitle . "</span>\n";
         $qq->whereCustom("mButtonTitle, mRowid", "mParent = '" . $row->mRowid . "' AND mPublished='1' AND mLang='" . $this->m->lang . "'  ", "mOrderNo", "ASC", 0);
         // om det finns nån som har denna som parent
         if ($qq->getNumRows()) {
             /* Fulhack för att få första i galleriet rosa */
             $i = 0;
             $this->content .= '<div class="subSection">';
             while ($row2 = mysql_fetch_object($qq->getResult())) {
                 $qqq->whereCustom("mButtonTitle, mRowid, mTitle", "mParent = '" . $row2->mRowid . "' \n                             AND mPublished='1' \n                             AND mButtonTitle NOT LIKE ''\n                             AND mLang='" . $this->m->lang . "'  ", "mOrderNo", "ASC", 0);
                 /** Om det är den trenivåare **/
                 if ($qqq->getNumRows()) {
                     $this->content .= '<span class="subSecTitle">' . $row2->mButtonTitle . "</span>\n";
                     $this->content .= '<div class="subSection">';
                     while ($row3 = mysql_fetch_object($qqq->getResult())) {
                         /** Rosa om aktiv **/
                         if ($this->getActive($this->m->ID, $row3->mRowid) == 1) {
                             $this->content .= '<span class="sideMenuActive"><a href="?ID=';
                             $this->content .= $row3->mRowid . '">' . $row3->mButtonTitle . "</a></span><br/>\n";
                         } else {
                             $this->content .= '<a href="?ID=' . $row3->mRowid . '">' . $row3->mButtonTitle . "</a><br/>\n";
                         }
                     }
                     $this->content .= "</div>\n";
                     // subSection inre
                 } else {
                     /** Om det är en vanlig blir det en länk**/
                     /** Rosa om aktiv **/
                     /** Fulhack - Rosa om man klickat på galleriet */
                     if ($this->getActive($this->m->ID, $row2->mRowid) == 1 || $this->m->showStyle == "Gallery" && $i == 0 && $this->m->level == 0) {
                         $this->content .= '<span class="sideMenuActive"><a href="?ID=' . $row2->mRowid . '">' . $row2->mButtonTitle . "</a></span><br/>\n";
                     } else {
                         $this->content .= '<a href="?ID=' . $row2->mRowid . '">' . $row2->mButtonTitle . "</a><br/>\n";
                     }
                 }
                 /* Fulhack */
                 $i++;
             }
             $this->content .= "</div>\n";
             //subSection yttre
         }
         $this->content .= "</div>\n";
         // leftMenu
         if ($i != $q->getNumRows()) {
             $this->content .= '<img src="' . Settings::$graphics . 'stripes.gif" />' . "\n";
         }
         $i++;
     }
 }
Example #5
0
    public function closeupVimmelThumbs(Query $query, $width)
    {
        while ($row = mysql_fetch_object($query->getResult())) {
            ?>
	
			<div class="thumbnail"> 
          <?php 
            echo '<a href="?id=' . $row->rowid . '&category=' . $_GET['category'] . '">';
            echo '<img src="image_crop.php?source=' . Settings::getUploadedImages() . '/' . $row->file . '&dest=&thumb_size=' . $width . '" alt="' . $row->name . '" />';
            ?>
          </a>    
          </div>
		  <?php 
        }
    }
Example #6
0
function isPlay($idJoueur, $idTournoi, $database)
{
    $sql_func = 'SELECT * FROM joueurtournoi WHERE id_joueur = :id_joueur AND id_tournoi = :id_tournoi';
    $query_func = new Query($database, $sql_func);
    $query_func->bind(':id_joueur', $idJoueur, PDO::PARAM_INT);
    $query_func->bind(':id_tournoi', $idTournoi, PDO::PARAM_INT);
    if ($query_func->execute()) {
        $jeux = $query_func->getResult();
    }
    if (empty($jeux)) {
        //ne joue pas a ce jeux
        return 0;
    } else {
        //joue a ce jeux
        return 1;
    }
}
Example #7
0
    public function listEntryPlaces($class)
    {
        $entryPlaces = new Query("entryPlaces");
        $entryPlaces->makeQuery("*", "pubDate", "DESC", 0);
        echo '<table class="' . $class . '">';
        echo '<th align="left">Titel</th><th align="left">Beskrivning</th>
				<th align="left">Uppdaterad senast</th><th align="left">&Auml;ndra</th><th align="left">Ta bort</th>';
        while ($row = mysql_fetch_object($entryPlaces->getResult())) {
            echo '<tr>
			<td>' . strip_tags($row->title) . '</td>
			<td>' . strip_tags($row->description) . '</td>				
			<td>' . $row->updateDate . '</td>
			<td><a href="?action=edit&entryPlaceTitle=' . $row->title . '">&Auml;ndra</a></td>
			<td><a href="?action=delete&entryPlaceTitle=' . $row->title . '">Ta bort</a></td>
			</tr>';
        }
        echo '</table>';
    }
 /**
  * Denna kan se lite annorlunda ut eftersom det är in showStyle.
  * Det kanske inte innehåller secifikt footer och header.
  */
 public function showContent()
 {
     $q = new Query("matruschka");
     $q->whereImage("mParent='" . $this->m->ID . "' AND mPublished='1' AND mLang='" . $this->m->lang . "'", "DESC", 3);
     $qq = new Query("matruschka");
     $ret;
     while ($row = mysql_fetch_object($q->getResult())) {
         $ret .= '<table width="211" border="0" cellpadding="0" cellspacing="0" class="tableLeft">';
         $ret .= '<tr><td colspan="2" class="title2">' . $row->mTitle . '</td></tr>';
         $ret .= '<tr><td colspan="2" class="title2">';
         $ret .= '<img src="admin/' . Settings::$uploaded_images . '/' . $row->miFilename . '" width="210" height="160" />';
         $ret .= '</td>';
         $ret .= '</tr>';
         $qq->whereImage("mParent='" . $row->mRowid . "' AND mPublished='1'", "ASC", 0);
         while ($row2 = mysql_fetch_object($qq->getResult())) {
             $ret .= '<tr>';
             $ret .= '<td width="77"><span class="style1"><strong>' . $row2->mTitle . '</strong></span></td>';
             $ret .= '<td width="134"><span class="style1">' . $row2->mText . '</span></td>';
             $ret .= '</tr>';
         }
         $ret .= "</table>\n";
     }
     return $ret;
 }
Example #9
0
<?php

// Created by Ian Santagata
// Test script to test MySQL PHP interaction
// Feel free to edit and test for your own needs
include "Query.php";
$q = new Query("SELECT * FROM gstate");
$q->execute();
$result = $q->getResult();
for ($i = 0; $i <= 8; $i++) {
    $row = $q->getRow($i);
    printf("Coordinate: %s Username: %s\n", $row[0], $row[1]);
}
Example #10
0
        echo 'ERREUR SQL TOURNOI';
    }
    exit;
}
$jpt = $tournoi['joueurParTeam'];
$sql = 'SELECT id_match as id,nbr_manche,teamParMatch as tpm FROM matchs WHERE id_tournoi=:idt AND id_groupe IS NULL';
$query = new Query($database, $sql);
$query->bind('idt', $id_tournoi, PDO::PARAM_INT);
if (!$query->execute()) {
    global $glob_debug;
    if ($glob_debug) {
        echo 'ERREUR SQL MATCHS';
    }
    exit;
} else {
    $matchs = $query->getResult();
}
if ($jpt > 1) {
    foreach ($matchs as $match) {
        if (isset($_POST['m_' . $match['id'] . '_1'])) {
            $sql = 'DELETE FROM manches_equipes WHERE id_match=:idm';
            $query = new Query($database, $sql);
            $query->bind('idm', $match['id'], PDO::PARAM_INT);
            if (!$query->execute()) {
                global $glob_debug;
                if ($glob_debug) {
                    echo 'ERREUR SQL DELETE MANCHE_EQUIPE';
                }
                exit;
            }
            $sql = 'DELETE FROM matchs_equipes WHERE id_match=:idm';
Example #11
0
<?php

require_once 'common/head_admin.php';
// Database Queries
$locations = $database->getLocations();
$locations_1 = $database->getLocations_1();
$players = $database->getLogins();
$teams = $database->getTeams();
// Selection des pseudos => mais pourquoi ça existe?
$sql = 'SELECT pseudo FROM joueurs ORDER BY pseudo ASC';
$query = new Query($database, $sql);
$query->execute();
$joueurs_autre = $query->getResult();
// send to the template
$smarty->assign("emplacements", $locations);
$smarty->assign("emplacements1", $locations_1);
$smarty->assign('joueurs', $players);
$smarty->assign('equipes', $teams);
$smarty->assign('joueurs_autre', $joueurs_autre);
$smarty->display(DOCUMENT_ROOT . '/view/templates/admin/emplacements.tpl');
Example #12
0
session_start();
require_once '../common/var.conf.php';
require_once DOCUMENT_ROOT . '/common/utils.php';
require_once DOCUMENT_ROOT . '/class/Smarty_HEHLan.class.php';
require_once DOCUMENT_ROOT . '/class/Database.class.php';
require_once DOCUMENT_ROOT . '/class/Auth.class.php';
require_once DOCUMENT_ROOT . '/class/Query.class.php';
$connected = false;
$allowed = false;
$chatIsActive = false;
$database = new Database();
$smarty = new Smarty_HEHLan();
$connected = Auth::isLogged();
$allowed = Auth::isAllowed(3);
if (!$connected && !$allowed) {
    header('Location: ../index.php');
}
$sql = 'SELECT id_joueur, pseudo FROM joueurs ORDER BY pseudo';
$query = new Query($database, $sql);
if ($query->execute()) {
    $joueurs = $query->getResult();
} else {
    echo 'ERROR';
    exit;
}
// send to the template
$smarty->assign("con", $connected);
$smarty->assign("chat", $chatIsActive);
$smarty->assign('joueurs', $joueurs);
$smarty->display(DOCUMENT_ROOT . '/view/templates/admin/joueurs.tpl');
Example #13
0
	  <?php 
    }
    ?>
	  <br />
	  <br />  
		  <div class="thumbnailContainer">
			<?php 
    if (Helper::isInt($_GET['category'])) {
        $query = new Query("vimmel_images");
        $query->whereLeftJoinImageQuery("*", "category", $_GET['category'], "date", "DESC");
        // Dont forget the Javascript (effect.js)!!!
        $images = new ShowImages($query);
        $images->closeupVimmelThumbs($query, 50);
    }
    ?>
		  </div>
		  
	  <?php 
}
// if(isset($_GET['category']) end
$categories = new Query("vimmel_categories");
$categories->makeQuery("*", "date", "DESC", 10000);
echo '<span class="boldPink">Bildgalleri</span><span class="smallWhite"></span><br /><br />';
while ($row = mysql_fetch_object($categories->getResult())) {
    echo '<span class="boldWhite"><a href="?category=' . $row->rowid . '">' . $row->title . '</a></span><br /><br />';
}
?>
  </div>
  </div>
<?php 
include "footer.php";
Example #14
0
            } else {
                $finale = $match['id_match'];
            }
        }
        $nbrmatch++;
        $sql2 = 'SELECT mte.id_equipe, e.nom, (SELECT SUM(ma.score)
                FROM manches_equipes AS ma 
                WHERE ma.id_match=:idm AND ma.id_equipe=mte.id_equipe
                GROUP BY ma.id_equipe) AS score
                FROM matchs_equipes AS mte, equipes AS e 
                WHERE mte.id_match=:idm AND e.id_equipes=mte.id_equipe';
        $query2 = new Query($database, $sql2);
        $query2->bind(':idm', $match['id_match'], PDO::PARAM_INT);
        if ($query2->execute()) {
            $cpt = 1;
            foreach ($query2->getResult() as $team) {
                $matches[$match['id_match']][$cpt]['id'] = $team['id_equipe'];
                $matches[$match['id_match']][$cpt]['nom'] = $team['nom'];
                $matches[$match['id_match']][$cpt]['score'] = $team['score'];
                $cpt++;
            }
        } else {
            global $glob_debug;
            if ($glob_debug) {
                echo 'ERREUR SQL TEAMS';
            }
            exit;
        }
    }
} else {
    global $glob_debug;
Example #15
0
        }
    }
} else {
    global $glob_debug;
    if ($glob_debug) {
        echo 'ERREUR SQL MAPS';
    }
    exit;
}
$phase;
// determiner la phase du pick
$sql = "SELECT idMap FROM matchs WHERE id_match=:idMatch";
$query = new Query($database, $sql);
$query->bind(':idMatch', $matchId, PDO::PARAM_INT);
if ($query->execute()) {
    $idMap = $query->getResult()[0]['idMap'];
    if ($idMap == 0) {
        // on est tjs au stade de pick les maps
        $phase = "maps";
    } else {
        $phase = "heroes";
    }
} else {
    global $glob_debug;
    if ($glob_debug) {
        echo 'ERREUR SQL MAPS';
    }
    exit;
}
// ********************** Applying Template **********************
$smarty->assign('con', $connected);
Example #16
0
?>


<div id="competition">
  <div class="veckansFragaBg"><span class="boldWhite"></span></div>
    <div align="center"><span class="boldWhite">L&auml;s den hetaste </span><span class="boldPink2"><a href="/blogg">h&aring;rdrocksbloggen</a></span><span class="boldWhite"> eller regga dig f&ouml;r att </span><span class="boldPink2"> <a href="http://closeupmagazine.net/blogg/wp-login.php?action=register">b&ouml;rja blogga!</a></span></div>
    <div class="leftBoxFooter"></div>
  </div>
  <?php 
$voteQ = new Query("vote_group");
$voteQ->whereQuery("*", "active", 1, "rowid", "DESC", 1);
if ($voteQ->getNumRows() > 0) {
    while ($row = mysql_fetch_assoc($voteQ->getResult())) {
        $vote_itemsQ = new Query("vote_group_items");
        $vote_itemsQ->whereQuery("*", "group_id", $row['rowid'], "rowid", "ASC", 3);
        $item1 = mysql_result($vote_itemsQ->getResult(), 0, "rowid");
        $item2 = mysql_result($vote_itemsQ->getResult(), 1, "rowid");
        $item3 = mysql_result($vote_itemsQ->getResult(), 2, "rowid");
        $group = $row['rowid'];
        ?>
  <div id="vote">
    <div class="competitionBg"></div>
    <div class="leftTextMargin"> <span class="boldWhite"><?php 
        echo $row['title'];
        ?>
</span> 
      <span class="boldWhite"><?php 
        echo $row['description'];
        ?>
</span> <span class="lightGrey">
      <form action="" method="post" name="form1" id="form1">
Example #17
0
        WHERE id_tournoi = 2';
$query = new Query($database, $sql);
if ($query->execute()) {
    $teamsCOD4 = $query->getResult()[0]['nbr'];
}
$sql = 'SELECT COUNT(*) AS nbr FROM equipes_tournoi
        WHERE id_tournoi = 3';
$query = new Query($database, $sql);
if ($query->execute()) {
    $teamsTMNF = $query->getResult()[0]['nbr'];
}
$sql = 'SELECT COUNT(*) AS nbr FROM equipes_tournoi
        WHERE id_tournoi = 5';
$query = new Query($database, $sql);
if ($query->execute()) {
    $teamsHS = $query->getResult()[0]['nbr'];
}
$data1y = array($playersHOTS, $playersCOD4, $playersTMNF, $playersHS);
$data2y = array($teamsHOTS, $teamsCOD4, $teamsTMNF, $teamsHS);
// Create the graph. These two calls are always required
$graph = new Graph(300, 250);
$graph->ClearTheme();
$graph->SetShadow();
$graph->SetScale("textlin");
$graph->SetShadow();
$graph->img->SetMargin(40, 30, 20, 40);
// Create the bar plots
$b1plot = new BarPlot($data1y);
$b1plot->SetFillColor("#222C43");
$b1plot->SetLegend("Players");
$b2plot = new BarPlot($data2y);
 private function linksShow($level)
 {
     if ($level > 1) {
         $ret = '<span class="imgNr">' . "\n";
         /*** Länkarna ***/
         $q2 = new Query("matruschka");
         // Klickat på i menyn
         if ($level == 2) {
             $q2->whereImage("mParent = '" . $this->m->ID . "' AND mPublished='1' ", "ASC", 0);
         } elseif ($level == 3 && $this->m->buttonTitle == '') {
             $q2->whereImage("mParent = '" . $this->m->parent . "' AND mPublished='1' ", "ASC", 0);
         } elseif ($level == 3 && $this->m->buttonTitle != '') {
             $q2->whereImage("mParent = '" . $this->m->ID . "' AND mPublished='1' ", "ASC", 0);
         } elseif ($level == 4) {
             $q2->whereImage("mParent = '" . $this->m->parent . "' AND mPublished='1' ", "ASC", 0);
         }
         $i = 0;
         $a;
         while ($row = mysql_fetch_object($q2->getResult())) {
             $a[$i][0] = $row->mOrderNo;
             $a[$i][1] = $row->mTitle;
             $a[$i][2] = $row->mButtonTitle;
             $a[$i][3] = $row->mRowid;
             $i++;
         }
         // så många som ska synas
         $visible = 11;
         // Indexet i arrayen som man är på
         $index;
         /******** BLIR fel här nånstans ********/
         if ($level == 3 && $this->m->buttonTitle == '' || $level == 4) {
             for ($i = 0; $i < count($a); $i++) {
                 if ($this->m->ID == $a[$i][3]) {
                     $index = $i;
                 }
             }
         } else {
             $index = 0;
         }
         /* Inget visas om det bara finns EN */
         if (count($a) > 1) {
             $ss = $this->getOffset($a, $index, $visible);
             // Om man inte är på första, visa << och ...(Första)
             $indexBefore;
             if ($this->m->ID != $a[0][3] && $level == 3 && $this->m->buttonTitle == '' || $this->m->ID != $a[0][3] && $level == 4) {
                 for ($i = 0; $i < count($a); $i++) {
                     if ($this->m->ID == $a[$i][3]) {
                         $index = $i;
                         $indexBefore = $i - 1;
                     }
                 }
                 $ret .= '<a href="?ID=' . $a[$indexBefore][3] . '">' . "\n";
                 $ret .= "<<\n";
                 $ret .= "</a>\n";
             }
             for ($i = $ss[0]; $i <= $ss[1]; $i++) {
                 // Visa aktiv om den är aktiv
                 if ($a[$i][3] == $this->m->ID || $level == 2 && $i == 0 || $level == 3 && $this->m->buttonTitle != '' && $i == 0) {
                     $ret .= '<span class="imgNrActive">' . "\n";
                     $ret .= '<a href="?ID=' . $a[$i][3] . '">';
                     $ret .= strlen($a[$i][0]) > 1 ? $a[$i][0] : '0' . $a[$i][0];
                     $ret .= '</a> ' . "\n";
                     $ret .= "</span>\n";
                 } else {
                     $ret .= '<a href="?ID=' . $a[$i][3] . '">';
                     $ret .= strlen($a[$i][0]) > 1 ? $a[$i][0] : '0' . $a[$i][0];
                     $ret .= '</a> ' . "\n";
                 }
             }
             // Om man inte är på sista, visa >>
             $indexAfter;
             // om man e inne på en bild
             if (($this->m->ID != $a[count($a) - 1][3] && $level == 3 && $this->m->buttonTitle == '' || $this->m->ID != $a[count($a) - 1][3] && $level == 4) && count($a) > 1) {
                 for ($i = 0; $i < count($a); $i++) {
                     if ($this->m->ID == $a[$i][3]) {
                         $indexAfter = $i + 1;
                     }
                 }
                 $ret .= '<a href="?ID=' . $a[$indexAfter][3] . '">' . "\n";
                 $ret .= ">>\n";
                 $ret .= "</a>\n";
             } elseif (($this->m->ID != $a[count($a) - 1][3] && $level == 2 || $this->m->ID != $a[count($a) - 1][3] && $level == 3 && $this->m->buttonTitle != '') && count($a) > 1) {
                 $ret .= '<a href="?ID=' . $a[1][3] . '">' . "\n";
                 $ret .= ">>\n";
                 $ret .= "</a>\n";
             }
             $ret .= "</span>\n";
             // imgNr
         }
         return $ret;
     }
 }
Example #19
0
<?php

$uname = $_GET["uname"];
include "../lib/Query.php";
$counter = new Query("Select * FROM statistics");
$counter->execute();
$userTotal = $counter->numRows();
$leaderboardLimit = 10;
if ($userTotal < $leaderboardLimit) {
    $leaderboardLimit = $userTotal;
}
$query = new Query("Select * FROM statistics ORDER BY points DESC, wins DESC, uname ASC LIMIT {$leaderboardLimit}");
$query->execute();
$query->getResult();
echo '<html>
        <body>
	  <h3>Hello ' . $uname . ', this is the Leaderboard page. </h3>
	  <table border="1">
	  <tr>
	  <td>Ranking</td>
	  <td>Username</td>
	  <td>Wins</td>
	  <td>Losses</td>
	  <td>Ties</td>
	  <td>Total Games</td>
	  <td>Points</td>
	  </tr>';
for ($i = 0; $i < $leaderboardLimit; $i++) {
    $row = $query->getRow($i);
    $username = $row[0];
    $wins = $row[1];
 /**
  * Executes a DQL query and returns resources as entities or arrays.
  * If it returns arrays, it add a "pathfordisplay" field to each item.
  *
  * @param Query   $query   The query to execute
  * @param integer $offset  First row to start with
  * @param integer $numrows Maximum number of rows to return
  * @param boolean $asArray Whether the resources must be returned as arrays or as objects
  *
  * @return array[AbstractResource|array]
  */
 private function executeQuery($query, $offset = null, $numrows = null, $asArray = true)
 {
     $query->setFirstResult($offset);
     $query->setMaxResults($numrows);
     if ($asArray) {
         $resources = $query->getArrayResult();
         $return = $resources;
         // Add a field "pathfordisplay" in each entity (as array) of the given array.
         foreach ($resources as $key => $resource) {
             if (isset($resource['path'])) {
                 $return[$key]['path_for_display'] = ResourceNode::convertPathForDisplay($resource['path']);
             }
         }
         return $return;
     }
     return $query->getResult();
 }
Example #21
0
                    $first = false;
                    $nbr_match = $nbr_match >> 1;
                }
                $sql = 'SELECT id_match,id_enfant1,id_enfant2 FROM matchs WHERE id_tournoi=:idt
			AND id_groupe IS NULL AND (id_enfant1 IS NOT NULL OR id_enfant2 IS NOT NULL)';
                $query = new Query($database, $sql);
                $query->bind('idt', $id_tournoi, PDO::PARAM_INT);
                if (!$query->execute()) {
                    global $glob_debug;
                    if ($glob_debug) {
                        echo 'ERREUR SELECT FINALES ';
                    }
                    exit;
                }
            }
            foreach ($query->getResult() as $m) {
                $sql = 'UPDATE matchs SET id_parent=:idp WHERE id_match=:id1 OR id_match=:id2';
                $query2 = new Query($database, $sql);
                $query2->bind('idp', $m['id_match'], PDO::PARAM_INT);
                $query2->bind('id1', $m['id_enfant1'], PDO::PARAM_INT);
                $query2->bind('id2', $m['id_enfant2'], PDO::PARAM_INT);
                if (!$query2->execute()) {
                    global $glob_debug;
                    if ($glob_debug) {
                        echo 'ERREUR SUPDATE PARENT ';
                    }
                    exit;
                }
            }
            if ($petite_finale) {
                $sql = 'INSERT INTO matchs (id_tournoi,nbr_manche,teamParMatch,looser_bracket,heure)
Example #22
0
        $groupes[$itGroupe]['teams'] = $teams;
        $heures = '';
        if (is_array($teams)) {
            foreach ($teams as $team) {
                $sql = 'SELECT m.id_match,m.heure, SUM(me.score) as score, 
				(SELECT mte2.id_equipe FROM matchs_equipes as mte2 WHERE mte2.id_match=m.id_match AND mte2.id_equipe<>:ide LIMIT 0,1) as team2 
			FROM (matchs_equipes as mte, matchs as m) 
			LEFT JOIN (manches_equipes as me)
			ON (me.id_match=m.id_match AND me.id_equipe=:ide)
			WHERE m.id_groupe=:idg AND mte.id_match=m.id_match AND mte.id_equipe=:ide
			GROUP BY m.id_match';
                $query = new Query($database, $sql);
                $query->bind(':idg', $groupe['id_groupe'], PDO::PARAM_INT);
                $query->bind(':ide', $team['id'], PDO::PARAM_INT);
                if ($query->execute()) {
                    foreach ($query->getResult() as $ligne) {
                        if (!is_null($ligne['score'])) {
                            $scores[$team['id']][$ligne['team2']]['score'] = $ligne['score'];
                            $scores[$team['id']][$ligne['team2']]['id_match'] = $ligne['id_match'];
                        }
                        $heures[$team['id']][$ligne['team2']] = $ligne['heure'];
                    }
                } else {
                    global $glob_debug;
                    if ($glob_debug) {
                        echo 'ERREUR SQL SCORES TEAM 1';
                    }
                    exit;
                }
            }
        } else {
Example #23
0
$sql = $select . $lefton . ' ORDER BY e.nom';
$query = new Query($database, $sql);
$query->execute();
$donnees = $query->getResult();
/**********************************
 *	tournois individuels
 **********************************/
$sql = 'SELECT id_tournoi, nomTournoi FROM tournoi WHERE joueurParTeam = 1';
$query = new Query($database, $sql);
$query->execute();
$select = "SELECT j.*";
$lefton = " FROM  joueurs j";
$i = 0;
foreach ($query->getResult() as $tournoi) {
    $tabJT[$i][1] = $tournoi['id_tournoi'];
    $tabJT[$i][2] = $tournoi['nomTournoi'];
    $select .= ", jt" . $tournoi['id_tournoi'] . ".id_tournoi AS id_tournoi" . $tournoi['id_tournoi'] . ", jt" . $tournoi['id_tournoi'] . ".pseudoJeux AS pseudoJeux" . $tournoi['id_tournoi'];
    $lefton .= " LEFT OUTER JOIN joueurtournoi AS jt" . $tournoi['id_tournoi'] . " ON jt" . $tournoi['id_tournoi'] . ".id_joueur = j.id_joueur AND jt" . $tournoi['id_tournoi'] . ".id_tournoi = " . $tournoi['id_tournoi'];
    $i++;
}
$sql = $select . $lefton . ' ORDER BY j.pseudo';
$query = new Query($database, $sql);
$query->execute();
$donneesJT = $query->getResult();
// send to the template
$smarty->assign('con', $connected);
$smarty->assign('tab', $tab);
$smarty->assign('donnees', $donnees);
$smarty->assign('tabJT', $tabJT);
$smarty->assign('donneesJT', $donneesJT);
$smarty->display(DOCUMENT_ROOT . '/view/templates/admin/inscriptions.tpl');
Example #24
0
		LEFT OUTER JOIN equipes_joueur ej ON j.id_joueur = ej.id_joueur
		LEFT OUTER JOIN equipes e ON e.id_equipes = ej.id_equipes
		WHERE j.id_joueur = :idj';
$query = new Query($database, $sql);
$query->bind('idj', $_SESSION['id_joueur'], PDO::PARAM_INT);
$query->execute();
$joueur = $query->getResult()[0];
$pseudoJeux = '';
// Selecting player profile information
$sql = 'SELECT * FROM joueurs WHERE id_joueur = :id_player';
$query = new Query($database, $sql);
$query->bind(':id_player', $_SESSION['id_joueur'], PDO::PARAM_INT);
$query->execute();
$joueur = $query->getResult()[0];
$joueur['date_de_naissance'] = date("d/m/Y", strtotime($joueur['date_de_naissance']));
$sql = 'SELECT id_equipes, nom FROM equipes ORDER BY nom';
$query = new Query($database, $sql);
$query->execute();
$equipes = $query->getResult();
$smarty->assign("next_matches", $database->getNextMatches($connected));
$smarty->assign("navTournois", $database->getNavTournois());
$smarty->assign("joueur", $joueur);
$smarty->assign('pseudoJeux', $pseudoJeux);
$smarty->assign('equipes', $equipes);
$smarty->display('default/profile.tpl');
?>




Example #25
0
        if (!empty($_POST['id_joueur'])) {
            $sql = 'SELECT e.id_equipes, e.nom AS team
		FROM  equipes_joueur et
		LEFT OUTER JOIN equipes e ON e.id_equipes = et.id_equipes
		WHERE et.id_joueur = :id';
            $query = new Query($database, $sql);
            $query->bind(':id', $_POST['id_joueur'], PDO::PARAM_INT);
            $result = $query->execute();
            foreach ($query->getResult() as $equipe) {
                echo '<input type="checkbox" checked class="chkbxEquipeDuJoueur" value="' . $equipe["id_equipes"] . '">' . $equipe["team"] . '<br>';
            }
            $sql = 'SELECT id_equipes, nom FROM equipes ORDER BY nom';
            $query = new Query($database, $sql);
            $query->execute();
            echo 'Ajouter à l\'équipe : <select id="SelectAjoutJoueurEquipe" style="width: 200px;"><option></option>';
            foreach ($query->getResult() as $equipe) {
                echo '<option value="' . $equipe["id_equipes"] . '" style="color:#000">' . $equipe["nom"];
                echo '</option>';
            }
            echo '
                </select>
                <input type="button" id="submitChangementEquipeDuJoueur" value="Validez les changements">';
            echo '<input type="hidden" id="idJoueurAdminForEquipe" value="' . $_POST['id_joueur'] . '">';
        }
    } else {
        echo "Vous n'êtes pas autorisé à effectuer cette modification!";
    }
} else {
    echo "Vous n'êtes pas connecté!";
}
?>
Example #26
0
         $erreurEmail = "Votre email n'est pas valide. \n";
     }
 }
 if ($valid) {
     $pseudo = $_POST['pseudoOublie'];
     $email = $_POST['emailOublie'];
     // Génère une chaine aléatoire de 20 caractères
     $password = random(20);
     $sql = 'SELECT id_joueur, prenom FROM joueurs WHERE email = :email AND pseudo = :pseudo';
     $query = new Query($database, $sql);
     $query->bind(':email', $email, PDO::PARAM_STR);
     $query->bind(':pseudo', $pseudo, PDO::PARAM_INT);
     $query->execute();
     $nbr = $query->getPreparedQuery()->rowCount();
     if ($nbr != 0) {
         $joueur = $query->getResult()[0];
         //on a trouvé l'email dans la BD donc l'utilisateur
         try {
             $query = 'UPDATE joueurs SET password = :password WHERE id_joueur = :id_joueur';
             $query = new Query($database, $sql);
             $query->bind(':password', sha1($password), PDO::PARAM_STR);
             $query->bind(':id_joueur', $joueur['id_joueur'], PDO::PARAM_INT);
             $query->execute();
             $sql = 'SELECT * FROM joueurs WHERE email = :email AND pseudo = :pseudo AND password = :password';
             $query = new Query($database, $sql);
             $query->bind(':email', $email, PDO::PARAM_STR);
             $query->bind(':pseudo', $pseudo, PDO::PARAM_INT);
             $query->bind(':password', sha1($password), PDO::PARAM_STR);
             $query->execute();
             $nbr = $query->getPreparedQuery()->rowCount();
             if ($nbr != 0) {
Example #27
0
} else {
    $nbr_lb2 = $query->getResult()[0];
    $nbr_lb2 = $nbr_lb2['nbr'];
}
// Setting the loser brackets
$nbr_lb2 = 0;
$nbr_lb3 = 0;
//SQL Query to count the number of matchs for a tournament and a double looser bracket
$sql = 'SELECT COUNT(*) AS nbr
        FROM matchs
        WHERE id_groupe IS NULL AND id_tournoi=:idt AND looser_bracket=3';
$query = new Query($database, $sql);
$query->bind(':idt', $id_tournoi, PDO::PARAM_INT);
if (!$query->execute()) {
    global $glob_debug;
    if ($glob_debug) {
        echo 'ERREUR - SQL COUNT LB3';
    }
    exit;
} else {
    $nbr_lb3 = $query->getResult()[0];
    $nbr_lb3 = $nbr_lb3['nbr'];
}
// Select the Pool or Round mode
$tournoi = $database->getTournament($id_tournoi);
//if( $tournoi['joueurParTeam'] > 1)
if ($id_tournoi != 3) {
    include_once DOCUMENT_ROOT . '/modules/tournoisPools.php';
} else {
    include_once DOCUMENT_ROOT . '/modules/tournoisRounds.php';
}
Example #28
0
  <textarea name="bannersCode" cols="50" rows="25" onKeyUp="setValue('flashShow',this.value,'text')"></textarea><br /><br />
  <input name="action" type="submit" value="Skapa"/>
  

<div id="bannersRightShow"> 
    L&auml;nkar till: <span id="linkShow" ></span> <br/>
    Ordningnummer: <span id="orderShow" ></span> <br/>
    Flashbanner: <span id="flashShow" ></span> <br/>
    <span id="imageShow" limit="1" maxWidth="250"></span> <br/>
</div>

<h2>Befintliga banners</h2>
<?php 
$rightBannerQ = new Query("banners");
$rightBannerQ->whereLeftJoinImageQuery("*", "category", "right", "order_no", "ASC", 1);
while ($row = mysql_fetch_assoc($rightBannerQ->getResult())) {
    echo "Ordningsnummer: " . $row['order_no'] . "<br />";
    if (trim($row['bannersCode']) == "") {
        ?>
    		<a href="admin_banners_edit.php?category=right&id=<?php 
        echo $row['rowid'];
        ?>
"><img src="<?php 
        echo "../" . Settings::getUploadedImages() . '/' . $row['file'];
        ?>
" width="250" /></a>
		<a href="admin_banners_action.php?category=right&action=remove&id=<?php 
        echo $row['rowid'];
        ?>
"><img src="graphics/remove.jpg" alt="Ta bort" width="10" border="0"/></a>
		<br />
Example #29
0
<?php

session_start();
require_once '../common/var.conf.php';
require_once DOCUMENT_ROOT . '/common/utils.php';
require_once DOCUMENT_ROOT . '/class/Smarty_HEHLan.class.php';
require_once DOCUMENT_ROOT . '/class/Database.class.php';
require_once DOCUMENT_ROOT . '/class/Auth.class.php';
require_once DOCUMENT_ROOT . '/class/Query.class.php';
$connected = false;
$allowed = false;
$chatIsActive = false;
$database = new Database();
$smarty = new Smarty_HEHLan();
$connected = Auth::isLogged();
$allowed = Auth::isAllowed(3);
if (!$connected && !$allowed) {
    header('Location: ../index.php');
}
$sql = 'SELECT * FROM downloads ORDER BY published_date DESC';
$query = new Query($database, $sql);
$query->execute();
$downloads = $query->getResult();
// send to the template
$smarty->assign('con', $connected);
$smarty->assign('downloads', $downloads);
$smarty->display(DOCUMENT_ROOT . '/view/templates/admin/downloads.tpl');
Example #30
0
    ?>
</textarea><br /><br />
    
    </td>
      </tr>
      <tr>
        <td colspan="2"><strong>Annonskategori</strong></td>
      </tr>
      <tr>
        <td colspan="2">
          <label>
            <select name="category" id="category" class="field">
            <?php 
    $q2 = new Query("advertisement_categories");
    $q2->makeQuery("*", "category", "DESC", 100);
    while ($row = mysql_fetch_assoc($q2->getResult())) {
        echo '<option value="' . $row['rowid'] . '">' . $row['category'] . '</option>';
    }
    ?>
            </select>
            </label>
     <br />
    <br />
    </td>
      </tr>
      <tr>
        <td colspan="2"><strong>Verifieringskod</strong></td>
      </tr>
      <tr>
        <td colspan="2"><img src="scrambleImg.php"/></td>
      </tr>