function extractRedirect() { if (isset($_POST['redirect'])) { return $_POST['redirect']; } $redirect = isset($_GET['redirect']) ? $_GET['redirect'] : ''; $redirect = trim($redirect); if (strlen($redirect) < 1) { return ''; } if (strpos($redirect, '#') || strpos($redirect, '&')) { return $redirect; } if (strpos($redirect, '?') === FALSE) { return urldecode($redirect); } $params = array(); $excluded = array('login', 'logout', 'sid', 'redirect', 'login_success'); foreach ($_GET as $k => $v) { $k = strtolower($k); if (in_array($k, $excluded) || in_array($v, $excluded)) { continue; } $params[$k] = $v; } return generateUrl(urldecode($redirect), $params); }
public function modifierAction($id) { if ($id === null) { throw NotFoundHttpException('Article non trouvé '); } $message = ''; // entity $em = $this->getDoctrine()->getManager(); // objet $article = $em->getRepository('BlogBundle:Article')->find($id); //$article = new Article(); //form $form = $this->createForm(new ArticleType(), $article); $request = $this->get('request'); // condition de validation if ($request->getMethod() == 'POST') { // lier le formulaire et la requete $form->bind($request); // vérification de la validité des données if ($form->isValid()) { $em = $this->getDoctrine()->getManager(); $em->persist($article); $em->flush(); $message = 'Article bien enrégistré'; return $this->redirect(generateUrl('BlogBundle:Blog:ajouter.html.twig', array('message' => $message, 'form' => $form->createView(), 'article' => $article))); } } return $this->render('BlogBundle:Blog:modifier.html.twig', array('article' => $article, 'form' => $form->createView())); }
/** * generate a valid and not taken URL * @return string $url if success, call generateUrl (recursif) if url taken */ function generateUrl($pdo, $length = 5, $try = 0) { // generate a <20 characters (numerical and alphabetical) string, not present in the DB ex: ajf63 if ($try > $length * $length) { $length += 1; $try = 0; } $pool = 'abcdefghijklmnopqrstuvwxyz0123456789'; $url = ''; for ($i = 0; $i < $length; $i++) { $url .= $pool[rand(0, strlen($pool) - 1)]; } try { $stmt = $pdo->prepare("SELECT id from note where id = :url"); $stmt->bindParam(':url', $url); $stmt->execute(); $result = $stmt->fetch(PDO::FETCH_ASSOC); } catch (PDOException $e) { throw $e->getMessage(); } if (empty($result)) { // la requete n'a rien renvoyé donc url pas prise return $url; } else { generateUrl($length, $try + 1); } }
public function testGenerateUrl() { // null value $this->assertEquals(generateUrl(), 'index.php'); // empty value $this->assertEquals(generateUrl(''), 'index.php'); // credible value $this->assertEquals(generateUrl("abcd"), 'index.php?p=abcd'); }
/** * @return array */ function LoadInlineMenu($SqlConnection, $PageID) { $sql = "SELECT inlinemenu_html, inlinemenu_image, inlinemenu_image_thumb, inlinemenu_image_title\r\n\t\t\t\tFROM " . DB_PREFIX . "inlinemenu\r\n\t\t\t\tWHERE page_id = {$PageID}"; $inlinemenu_result = $SqlConnection->SqlQuery($sql); $replacements = array(); if ($inlinemenu = mysql_fetch_object($inlinemenu_result)) { if ($inlinemenu->inlinemenu_html != '' || $inlinemenu->inlinemenu_image_thumb != '') { $replacements['INLINEMENU_TEXT'] = $inlinemenu->inlinemenu_html; $imageString = ''; if (file_exists($inlinemenu->inlinemenu_image_thumb)) { list($imageWidth, $imageHeight) = getimagesize($inlinemenu->inlinemenu_image_thumb); $imageString = "<div class=\"thumb\">\r\n\t<img width=\"{$imageWidth}\" height=\"{$imageHeight}\"src=\"" . generateUrl($inlinemenu->inlinemenu_image_thumb) . "\" title=\"{$inlinemenu->inlinemenu_image_title}\" alt=\"{$inlinemenu->inlinemenu_image_title}\" />\r\n\t<div class=\"description\" title=\"{$inlinemenu->inlinemenu_image_title}\">\r\n\t\t<div class=\"magnify\">\r\n\t\t\t<a href=\"special.php?page=image&file=" . generateUrl(basename($inlinemenu->inlinemenu_image)) . "\" title=\"vergrößern\">\r\n\t\t\t\t<img src=\"img/magnify.png\" title=\"vergrößern\" alt=\"vergrößern\"/>\r\n\t\t\t</a>\r\n\t\t</div>{$inlinemenu->inlinemenu_image_title}\r\n\t</div>\r\n</div>"; } $replacements['INLINEMENU_IMAGE'] = $imageString; } } return $replacements; }
$text = 'Die Seite wurde leider gelöscht. <br /> Falls die Seite dennoch da sein müsste, melden sie sich bitte beim Seitenbetreiber.'; break; case 'image': $imageID = GetPostOrGet('id'); $imageFile = GetPostOrGet('file'); if (is_numeric($imageID) || !empty($imageFile)) { $title = 'Bild'; $condition = 'file_id = ' . $imageID; if (empty($imageID)) { $condition = "file_name = '{$imageFile}'"; } $sql = "SELECT *\r\n\t\t\t\t\tFROM " . DB_PREFIX . "files\r\n\t\t\t\t\tWHERE {$condition}\r\n\t\t\t\t\tLIMIT 1"; $imageResult = $sqlConnection->SqlQuery($sql); if ($imageData = mysql_fetch_object($imageResult)) { $text = "<img src=\"" . generateUrl($imageData->file_path) . "\" class=\"pureimage\"/>"; } } break; case 'module': // Get the name of Module to show $moduleName = GetPostOrGet('moduleName'); if (file_exists('./modules/' . $moduleName . '/' . $moduleName . '_module.php')) { include_once './modules/' . $moduleName . '/' . $moduleName . '_module.php'; } // If the menu is activated it's class should be created // check if the module-class is already created if (!isset(${$moduleName})) { // is the module-class available? if (class_exists('Module_' . $moduleName)) { // create a link to the initialisation-function for the module-class
public function editerAction($id = null) { // vérification de la validité de l'id if (!isset($id)) { //on crée un nouvel acteur $acteur = new Acteur(); // l'id est null: soit c'est un formulaire vide soit elle a des requete $em = $this->getDoctrine()->getManager(); //On exécute l'ajout de formulaire $form = $this->createForm(new ActeurType(), $acteur); // on recuper la requette en cours $request = $this->get('request'); //vérifier if ($request->getMethod() == 'POST') { $form->bind('request'); if ($form->isValid()) { $em->persist($acteur); $em->flush(); return $this->redirect(generateUrl('acteur_list')); } } // s'il n'y a pas de requette donc c'est get return $this->render('FilmothequeBundle:Acteur:ajouter.html.twig', array('form' => $form->createView())); } else { //si le id est valide donc nous sommes dans le cas de la modification $em = $this->getDoctrine()->getManager(); //il faut recuperer l'id de l'utisateur $acteur = $em->getRepository('FilmothequeBundle:Acteur')->find($id); //on recupere les l'id del'acteur du repository $form = $this->createForm(new ActeurType(), $acteur); // on requepere la requette $request = $this->get('request'); // Condition de validation vérifier si la requete est get ou POST if ($request->getMethod() == 'POST') { $form->bind($request); // si le formulaire est valide if ($form->isValid()) { //C'est une donnée a enrégistré $em->persist($acteur); $em->flush(); return $this->redirect(generateUrl('acteur_list')); } } // si c'est une requete get on fait le modification return $this->render('FilmothequeBundle:Acteur:ajouter.html.twig', array('id' => $id, 'form' => $form->createView())); } }
function MakeImage($Image) { #[size] {[int_x]X[int_y],[int_maxsize], w[int_maxwidth], thumb=>w180, original=>[orig_x]X[orig_y], big=>800} #[format] {box, box_only, picture} #[Url]|[Title] => [Url]|box|thumb|[Title] #[Url]|[size]|[Title] = [Url]|box|[size]|[Title] #[Url]|[display]|[size]|[Title] // TODO: get the connection through the parameters, not as a global global $sqlConnection; // Defaults $ImageAlign = IMG_ALIGN_NORMAL; $imageDisplay = IMG_DISPLAY_BOX; $imageSize = 'w180'; $imageWidth = 180; $imageHeight = 180; $imageTitle = ''; $imageUrl = ''; $leftSpace = false; $rightSpace = false; if (substr($Image, 0, 1) == ' ') { $leftSpace = true; } if (substr($Image, -1, 1) == ' ') { $rightSpace = true; } if ($leftSpace && $rightSpace) { $ImageAlign = IMG_ALIGN_CENTER; } else { if ($leftSpace) { $ImageAlign = IMG_ALIGN_LEFT; } else { if ($rightSpace) { $ImageAlign = IMG_ALIGN_RIGHT; } } } // remove spaces at the begin and end of the string $Image = preg_replace("~^\\ *(.+?)\\ *\$~", '$1', $Image); // Split into all Parameters $parameters = explode('|', $Image); // set the path to the local media dir $imageUrl = preg_replace("~^\\media:\\ *(.+?)\$~", 'data/upload/' . '$1', $parameters[0]); $imageTitle = $parameters[0]; //remove first entry (we don't have to check it) unset($parameters[0]); // go through each parameter foreach ($parameters as $key => $value) { // extract the image layout if (preg_match('~^(' . IMG_DISPLAY_BOX_ONLY . '|' . IMG_DISPLAY_BOX . '|' . IMG_DISPLAY_PICTURE . ')$~', $value)) { $imageDisplay = $value; } else { if (preg_match('~^(thumb|original|big|[0-9]+[Xx][0-9]+|[0-9]+|\\w[0-9]+)$~', $value)) { $imageSize = $value; } else { // its the Title of the picture (it is the last unused parameter) $imageTitle = $value; } } } // TODO: // check if the image isn't saved "local", if it is, download it! // extern_{$filename}_timestamp.png // if the file doesn't exists under the given path, try to find it in the database if (!file_exists($imageUrl)) { $sql = "SELECT file_path\n\t\t\t\t\t\tFROM " . DB_PREFIX . "files\n\t\t\t\t\t\tWHERE LOWER(file_path) = '" . strtolower($imageUrl) . "'\n\t\t\t\t\t\t\tOR LOWER(file_name) = '" . strtolower(basename($imageUrl)) . "'\n\t\t\t\t\t\tLIMIT 1"; $result = $sqlConnection->SqlQuery($sql); if ($fileData = mysql_fetch_object($result)) { $imageUrl = $fileData->file_path; } clearstatcache(); // check if the file from the database really exists if (!file_exists($imageUrl)) { return "<strong>Bild ("<em>{$imageUrl}</em>") nicht gefunden.</strong>"; } } // Resize the image $image = new ImageConverter($imageUrl); // convert the 'name-sizes' to 'pixel-sizes' if ($imageSize == 'thumb') { $imageSize = 'w180'; } else { if ($imageSize == 'big') { $imageSize = '800'; } else { if ($imageSize == 'original') { // took the original sizes $imageWidth = $image->Size[0]; $imageHeight = $image->Size[1]; } } } // 'width-format'' if (preg_match('~^w[0-9]+$~', $imageSize)) { $imageWidth = substr($imageSize, 1); // calculate the proporitonal height $imageHeight = round($image->Size[1] / $image->Size[0] * $imageWidth, 0); } else { if (preg_match('~^[0-9]+$~', $imageSize)) { // look for the longer side and resize it to te given size, // short the other side proportional to the longer side $imageWidth = $image->Size[0] > $image->Size[1] ? round($imageSize, 0) : round($image->Size[0] / ($image->Size[1] / $imageSize), 0); $imageHeight = $image->Size[1] > $image->Size[0] ? round($imageSize, 0) : round($image->Size[1] / ($image->Size[0] / $imageSize), 0); } else { if (preg_match('~^([0-9]+)[Xx]([0-9]+)$~', $imageSize, $maches)) { // took the given sizes $imageWidth = $maches[1] < $image->Size[0] ? $maches[1] : $image->Size[0]; $imageHeight = $maches[2] < $image->Size[1] ? $maches[2] : $image->Size[1]; } } } $originalUrl = encodeUri($imageUrl); // str_replace(' ', '%20', basename($imageUrl)); // TODO: don't use the global global $config; // check if the image exists already $thumbnailfolder = $config->Get('thumbnailfolder', 'data/thumbnails/'); if (file_exists($thumbnailfolder . '/' . $imageWidth . 'x' . $imageHeight . '_' . basename($imageUrl))) { $imageUrl = $thumbnailfolder . '/' . $imageWidth . 'x' . $imageHeight . '_' . basename($imageUrl); } else { if ($image->Size[0] >= $imageWidth && $image->Size[1] > $imageHeight || $image->Size[0] > $imageWidth && $image->Size[1] >= $imageHeight) { $imageUrl = $image->SaveResizedTo($imageWidth, $imageHeight, $thumbnailfolder, $imageWidth . 'x' . $imageHeight . '_'); if ($imageUrl === false) { return "Not enough memory available!(resize your image!)"; } } else { $imageWidth = $image->Size[0]; $imageHeight = $image->Size[1]; } } $imageName = generateUrl(basename($image->_file)); $originalUrl = generateUrl($originalUrl); $imageUrl = generateUrl($imageUrl); if ($imageDisplay == IMG_DISPLAY_BOX) { $imageString = "</p>\n\n<div class=\"thumb t" . $ImageAlign . "\">\n\t\t\t\t\t\t<div style=\"width:" . ($imageWidth + 4) . "px\">\n\t\t\t\t\t\t\t<img width=\"{$imageWidth}\" height=\"{$imageHeight}\" src=\"{$imageUrl}\" title=\"{$imageTitle}\" alt=\"{$imageTitle}\" />\n\t\t\t\t\t\t\t<div class=\"description\" title=\"{$imageTitle}\"><div class=\"magnify\"><a href=\"special.php?page=image&file={$imageName}\" title=\"vergrößern\"><img src=\"img/magnify.png\" title=\"vergrößern\" alt=\"vergrößern\"/></a></div>{$imageTitle}</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div><p>\n"; } else { if ($imageDisplay == IMG_DISPLAY_BOX_ONLY) { $imageString = "</p>\n\n<div class=\"thumb tbox t" . $ImageAlign . "\">\n\t\t\t\t\t\t<div style=\"width:" . ($imageWidth + 4) . "px\">\n\t\t\t\t\t\t\t<img width=\"{$imageWidth}\" height=\"{$imageHeight}\" src=\"{$imageUrl}\" title=\"{$imageTitle}\" alt=\"{$imageTitle}\" />\n\t\t\t\t\t\t\t<div class=\"magnify\"><a href=\"special.php?page=image&file={$imageName}\" title=\"vergrößern\"><img src=\"img/magnify.png\" title=\"vergrößern\" alt=\"vergrößern\"/></a></div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n<p>"; } else { if ($imageDisplay == IMG_DISPLAY_PICTURE) { $imageString = "</p>\n\n<div class=\"thumb tbox t" . $ImageAlign . "\">\n\t\t\t\t\t<img width=\"{$imageWidth}\" height=\"{$imageHeight}\" src=\"{$imageUrl}\" title=\"{$imageTitle}\" alt=\"{$imageTitle}\" />\n\t\t\t\t\t</div><p>"; } } } return "{$imageString}"; }
<?php //given vars: $total $todo $inprogress $done ?> <div class="count-stats"> <a href="<?php echo generateUrl('listTask'); ?> "> <div class="row text-center"> <div class="count total col-lg-12 container"> <p><?php echo _t("TOTAL"); ?> <strong><?php echo $total; ?> </strong></p> </div> </div> <div class="row text-center"> <div class="count todo col-lg-4 container"> <p><?php echo _t("TODOLIST"); ?> <strong><?php echo $todo; ?>
public function editerAction($id = null) { // vérification de l'existance de l'id if (isset($id)) { // existance de l'id donc on procede a la modification $em = $this->getDoctrine()->getManager(); // création du formulaire $form = $this->createForm(new FilmType(), $film); //recupếration de l'id du repository $film = $em->getRepository('FilmothequeBundle:Film')->find($id); // vérification de la requete $request = $this->get('request'); // vérification si la requete est get ou post if ($request->getMethod() == 'POST') { //on lie le formulaire et la requete $form->bind($request); // vérification de la validité du formulaire if ($request->isValid()) { //on persist $em->persist($film); //on flush $em->flush(); // on fait une redirection return $this->rediect($this->generateUrl('film_list')); } } return $this->render('FilmothequeBundle:Film:ajouter.html.twig', array('form' => $form->createView(), 'id' => $id)); } else { // id inexistant $em = $this->getDoctrine()->getManager(); //instantiation d'un objet $film = new Film(); //création d'un formulaire $form = $this->createForm(new FilmType(), $film); // vérification de la requete $request->get('request'); //vérification si c'est un get ou post if ($request->getMehod() == 'POST') { // on lie le formulaire et la requete $form->bind($request); // vérification de la validité du formulaire if ($form->isValid()) { $em->persist($film); // on flush $em->flush(); // redirection vers les vues liste return $this->redirect(generateUrl('film_list')); } } return $this->render('FilmothequeBundle:Film:ajouter.html.twig', array('form' => $form->createView())); } }
<h3> <?php echo _t("EDITTASK"); ?> </h3> <?php if ($formError) { ?> <strong>Bad submit!</strong> <?php } ?> <form class="task-form" action="<?php echo generateUrl('updateTask') . "&id=" . $id; ?> " method="post"> <!-- Form --> <?php include "views/components/taskForm.php"; ?> <input type="submit" class="btn btn-success" name="submit" value="<?php echo _t("VALIDATE"); ?> " /> </form> </div> <div class="col-md-3"> </div>
/** * @access private * @return sring */ function _setImage($article_id) { if (!is_numeric($article_id)) { return $this->_homePage(); } $sql = "SELECT *\r\n\t\t\t\tFROM " . DB_PREFIX . "articles\r\n\t\t\t\tWHERE article_id={$article_id}"; $article_result = $this->_SqlConnection->SqlQuery($sql); if ($article = mysql_fetch_object($article_result)) { $out = ''; $sql = "SELECT file_path\r\n\t\t\t\t\tFROM " . DB_PREFIX . "files\r\n\t\t\t\t\tWHERE file_type LIKE 'image/%'\r\n\t\t\t\t\tORDER BY file_name ASC"; $images_result = $this->_SqlConnection->SqlQuery($sql); $imgmax = 100; $imgmax2 = 100; $thumbnailfolder = 'data/thumbnails/'; $out .= "<form action=\"admin.php\" method=\"post\"><div class=\"imagesblock\">\r\n\t\t\t\t<input type=\"hidden\" name=\"page\" value=\"module_articles\"/>\r\n\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"saveImage\"/>\r\n\t\t\t\t<input type=\"hidden\" name=\"article_id\" value=\"{$article_id}\"/>"; while ($imageData = mysql_fetch_object($images_result)) { $imageUrl = $imageData->file_path; if (file_exists($imageUrl)) { $image = new ImageConverter($imageUrl); $size = $image->CalcSizeByMax($imgmax); $resizedFileName = $thumbnailfolder . '/' . $size[0] . 'x' . $size[1] . '_' . basename($imageUrl); if (!file_exists($resizedFileName)) { $resizedFileName = $image->SaveResizedTo($size[0], $size[1], $thumbnailfolder, $size[0] . 'x' . $size[1] . '_'); } if (file_exists($resizedFileName) && $resizedFileName !== false) { $margin_top = round(($imgmax - $size[1]) / 2); $margin_bottom = $imgmax - $size[1] - $margin_top; $out .= "<div class=\"imageblock\">\r\n\t\t\t\t\t\t\t<a href=\"" . generateUrl($resizedFileName) . "\">\r\n\t\t\t\t\t\t\t<img style=\"margin-top:" . $margin_top . "px;margin-bottom:" . $margin_bottom . "px;width:" . $size[0] . "px;height:" . $size[1] . "px;\" src=\"" . generateUrl($resizedFileName) . "\" alt=\"" . basename($imageData->file_path) . "\" /></a><br />\r\n\t\t\t\t\t\t<input type=\"radio\" name=\"image_path\" " . ($article->article_image == $imageData->file_path ? 'checked="checked" ' : '') . " value=\"" . $imageData->file_path . "\"/></div>"; } } } $out .= "</div><input type=\"submit\" value=\"" . $this->_Translation->GetTranslation('apply') . "\" class=\"button\"/><a href=\"admin.php?page=module_articles&action=edit&article_id={$article_id}\" class=\"button\">" . $this->_Translation->GetTranslation('back') . "</a></form>"; return $out; } }
<div id="loginModal" class="modal show" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <h1 class="text-center">ZZTasks - <?php echo _t("LOGIN"); ?> </h1> </div> <div class="modal-body"> <form class="form col-md-12 center-block" action="<?php echo generateUrl('login'); ?> " method="post"> <div class="form-group"> <input type="text" name="login" class="form-control input-lg" placeholder="<?php echo _t("USERLOGIN"); ?> " value="<?php echo getUsername(); ?> " required /> </div> <div class="form-group"> <input type="password" name="password" class="form-control input-lg" placeholder="<?php echo _t("USERPASSWORD"); ?> " required /> </div> <div class="form-group">
/** * Prints the whole page including form but without the footer. * Call this function, then call chmodRecursively() which will output some HTML, * and finally call printFooter(); */ function printPageWithoutFooter($plugins, $path, $filePermissions, $folderPermissions, $permissionBitSets) { global $baseUrl; ?> <html> <head> <title>Gallery Support - Change Filesystem Permissions</title> <link rel="stylesheet" type="text/css" href="<?php print $baseUrl; ?> support.css"/> <style type="text/css"> </style> <script type="text/javascript"> var plugins = new Array(); <?php foreach ($plugins as $pluginId => $isOpenForEdit) { print "plugins['{$pluginId}'] = {$isOpenForEdit};\n "; } ?> function setEditOrSecure(pluginId, formObj) { if (pluginId == -1) { formObj.mode.value=''; formObj.open.disabled = true; formObj.secure.disabled = true; } else if (plugins[pluginId]) { formObj.mode.value='secure'; formObj.open.disabled = true; formObj.secure.disabled = false; } else { formObj.mode.value='open'; formObj.open.disabled = false; formObj.secure.disabled = true; } } function printStatusMessage(message) { var statusElement = document.getElementById('status'); statusElement.innerHTML = message + "<a href=\"#details\">[details]</a>"; statusElement.style.display = 'block'; } function printErrorMessage(message) { var errorElement = document.getElementById('error'); errorElement.innerHTML = message + "<br/>Note: Please look at the <a href=\"#details\">[details]</a>. " + "You might be able to change the filesystem permissions of the failed directories " + "successfully yourself with an FTP program or a command line shell." errorElement.style.display = 'block'; } </script> </head> <body> <div id="content"> <div id="title"> <a href="../../">Gallery</a> » <a href="<?php generateUrl('index.php'); ?> ">Support</a> » Change Filesystem Permissions </div> <h2> This tool lets you change the filesystem permissions of files and folders owned by the webserver. </h2> <p> All files and folders in your Gallery storage folder are owned by the webserver. If you installed Gallery2 by unpacking a .zip or .tar.gz file, then the gallery2 folder is probably owned by you which means that you can edit the files directly. However, if you used the preinstaller then your gallery2 directory is also owned by the webserver. For more information, see the <b><a href="http://codex.gallery2.org/Gallery2:Security">Gallery Security Guide</a>.</b> </p> <!-- Identifyable placeholders such that we can insert our messages during runtime via JS. --> <div id="error" class="error" style="display: none;"> </div> <div id="status" class="success" style="display: none;"> </div> <hr class="faint"/> <?php if (!isModulesOrThemesDirWriteable()) { ?> <h2> <a href="<?php generateUrl('index.php?chmod&command=' . CMD_CHMOD_MODULES_AND_THEMES_DIR . '&mode=open'); ?> ">Make modules & themes directories writeable</a> </h2> <p class="description"> Useful when adding a new module or theme. This makes your modules and themes folders writeable. It only works if you have installed Gallery with the pre-installer. Usually you can change the filesystem permissions with your FTP program or command line shell. </p> <?php } else { ?> <h2> <a href="<?php generateUrl('index.php?chmod&command=' . CMD_CHMOD_MODULES_AND_THEMES_DIR . '&mode=secure'); ?> ">Make modules & themes directories read-only</a> </h2> <p class="description"> Useful when you're not going to be making changes by hand. This makes your modules and themes folders writeable. Only works if you have installed Gallery with the pre-installer. Usually you can change the filesystem permissions with your FTP program or command line shell. </p> <?php } ?> <hr class="faint"/> <?php startForm('index.php?chmod&command=' . CMD_CHMOD_PLUGIN_DIR, 'pluginForm'); ?> <h2 id="themeOrModule"> Make a specific theme or module editable </h2> <p class="description"> If you want to edit a page template file of a specific module or theme and your Gallery was originally installed with the pre-installer, you might have to make the corresponding plugin folder writeable first. </p> <p class="description"> <select name="pluginId" onchange="setEditOrSecure(this.options[this.selectedIndex].value, this.form)"> <option value="-1">« select a module or theme »</option> <?php foreach ($plugins as $pluginId => $writeable) { ?> <option value="<?php print $pluginId; ?> "> <?php print $pluginId; ?> </option> <?php } ?> </select> <input type="hidden" name="mode" value="open"/> <input type="submit" disabled="disabled" name="open" value="Make it open (read/write)"/> | <input type="submit" disabled="disabled" name="secure" value="Make it secure (read-only)"/> </p> </form> <hr class="faint"/> <h2><a href="<?php generateUrl('index.php?chmod&command=' . CMD_CHMOD_STORAGE_DIR); ?> ">Make the data folder read/write</a></h2> <p class="description"> For some reason, your Gallery data folder might no longer be writeable by Gallery itself and if that happens, Gallery will usually show a ERROR_PLATFORM_FAILURE. In that case the problem might be solved by the above action. If the problem persists, you will have to talk to your webhost to get data folder writeable again. </p> <hr class="faint"/> <h2><a href="<?php generateUrl('index.php?chmod&command=' . CMD_CHMOD_LOCALE_DIR); ?> ">Make the locale folder read/write</a></h2> <p class="description"> If you're localizing Gallery, you may see warnings when you compile up your localization since you may not have permissions to copy the the new localized version into your g2data/locale folder. Making the locale folder read/write should solve this problem. </p> <hr class="faint"/> <?php if (isGalleryDirWriteable()) { ?> <h2><a href="<?php generateUrl('index.php?chmod&command=' . CMD_CHMOD_GALLERY_DIR); ?> &mode=open">Make everything read/write</a></h2> <p class="description"> If your Gallery has been installed with the pre-installer, you might have to make the whole Gallery directory structure read/write before you can upgrade or delete your installation. </p> <?php } else { ?> <h2><a href="<?php generateUrl('index.php?chmod&command=' . CMD_CHMOD_GALLERY_DIR); ?> &mode=secure">Make everything read-only</a></h2> <p class="description"> If your Gallery has been installed with the pre-installer you may want to change all your files back to read-only for a small amount of additional security. </p> <?php } ?> <hr class="faint"/> <h2>Advanced: Choose the path and the permissions manually</h2> <?php startForm('index.php?chmod&command=' . CMD_ADVANCED); ?> <p class="description"> <b> Path to change: </b> <input type="text" name="path" size="50" value="<?php print $path; ?> "/> <br/> <span class="subtext"> Gallery folder: <i><?php print GallerySetupUtilities::getConfigDir(); ?> </i> <br/> Gallery data folder: <i><?php print getGalleryStoragePath(); ?> </i> <br/> </span> <br/> <b> New permissions: </b> <?php foreach ($permissionBitSets as $permissionBitSet) { $checked = $permissionBitSet[1]->equals($filePermissions) ? 'checked="checked"' : ''; $value = $permissionBitSet[0]->getAsString() . $permissionBitSet[1]->getAsString(); ?> <br/> <input id="set_<?php print $value; ?> " type="radio" name="permissions" value="<?php print $value; ?> " <?php print $checked; ?> > <label for="set_<?php print $value; ?> "> <span class="hasToolTip" title="Files: <?php print $permissionBitSet[1]->getAsString(); ?> , Folders: <?php print $permissionBitSet[0]->getAsString(); ?> "> <?php print $permissionBitSet[1]->getDescription(); ?> </span> </label> </input> <?php } ?> <br/><br/> <input type="submit" value="Change the Permissions now!"/> </p> </form> <?php }
/** * @NoAdminRequired */ public function makeurl() { require_once 'shorten/lib/makeurl.php'; return generateUrl(); }
?> &lang=<?php echo $value; ?> "><img src="img/flags/<?php echo $value; ?> .png"/></a></li> <?php } ?> </ul> </li> <li> <a href="<?php echo generateUrl('logout'); ?> "> <i class="glyphicon glyphicon-log-out"></i> <?php echo _t("LOGOUT"); ?> </a> </li> </ul> </nav> </div> </header> <!-- /Navbar --> <div id="masthead"> <div class="container">
<hr class="faint" /> <h2> <a href="<?php generateUrl('index.php?gd'); ?> ">GD</a> </h2> <p class="description"> Information about your GD configuration </p> <hr class="faint" /> <h2> <a href="<?php generateUrl('index.php?import'); ?> ">Import Database</a> </h2> <p class="description"> Restore your Gallery database from an export that was made from the site administration maintenance screen or from the Database Backup step of the Gallery upgrader. </p> <hr class="faint" /> <h2> <?php require_once '../../embed.php'; $ret = GalleryEmbed::init(array('fullInit' => false, 'noDatabase' => true)); /* Ignore error */ $url = GalleryUrlGenerator::appendParamsToUrl('../../' . GALLERY_MAIN_PHP, array('view' => 'core.UserAdmin', 'subView' => 'core.UserRecoverPasswordAdmin'));
<p> "<?php echo $value["title"]; ?> " <?php echo _t("OF"); ?> <strong><cite><?php echo $value["owner"]; ?> </cite></strong> </p> </blockquote> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal"><?php echo _t("CANCEL"); ?> </button> <a class="btn btn-danger btn-ok" href="<?php echo generateUrl('deleteTask') . '&id=' . $key; ?> "> <?php echo _t("DELETE"); ?> </a> </div> </div> </div> </div>
function _EditPageOverview($PageID) { if (!is_numeric($PageID)) { return false; } $this->_ComaLate->SetReplacement('LANG_TITLE', $this->_Translation->GetTranslation('title')); $this->_ComaLate->SetReplacement('LANG_EDIT_GALLERY', $this->_Translation->GetTranslation('edit_gallery')); $this->_ComaLate->SetReplacement('LANG_TITLE_INFO', $this->_Translation->GetTranslation('the_title_is_someting_like_a_headline_of_the_page')); $this->_ComaLate->SetReplacement('LANG_APPLY', $this->_Translation->GetTranslation('apply')); $this->_ComaLate->SetReplacement('LANG_BACK', $this->_Translation->GetTranslation('back')); $this->_ComaLate->SetReplacement('LANG_REGENERATE_THUMBNAILS', $this->_Translation->GetTranslation('regenerate_thumbnails')); $this->_ComaLate->SetReplacement('LANG_ADD_IMAGES', $this->_Translation->GetTranslation('add_images')); $this->_ComaLate->SetReplacement('LANG_GALLERY', $this->_Translation->GetTranslation('gallery')); $this->_ComaLate->SetReplacement('LANG_IMAGE', $this->_Translation->GetTranslation('image')); $this->_ComaLate->SetReplacement('PAGE_ID', $PageID); $this->_ComaLate->SetReplacement('LANG_MOVE_UP', $this->_Translation->GetTranslation('move_up')); $this->_ComaLate->SetReplacement('LANG_MOVE_DOWN', $this->_Translation->GetTranslation('move_down')); $this->_ComaLate->SetReplacement('LANG_EDIT', $this->_Translation->GetTranslation('edit')); $this->_ComaLate->SetReplacement('LANG_DELETE', $this->_Translation->GetTranslation('delete')); // Load the images of the gallery with file-information $sql = 'SELECT gallery.gallery_file_id, gallery.gallery_image, gallery.gallery_description, gallery.gallery_image_thumbnail, page.page_title FROM ( (' . DB_PREFIX . 'pages page LEFT JOIN ' . DB_PREFIX . 'pages_gallery gallery_page ON page.page_id = gallery_page.page_id) LEFT JOIN ' . DB_PREFIX . 'gallery gallery ON gallery_page.gallery_id =gallery.gallery_id) WHERE page.page_id=' . $PageID . ' ORDER BY gallery.gallery_orderid'; $imagesResult = $this->_SqlConnection->SqlQuery($sql); $images = array(); $imgmax = 100; $imageID = 0; $title = ''; $thumbnailfolder = $this->_Config->Get('thumbnailfolder', 'data/thumbnails/'); while ($image = mysql_fetch_object($imagesResult)) { if ($title == '') { $title = $image->page_title; } $imageResizer = new ImageConverter($image->gallery_image); $sizes = $imageResizer->CalcSizeByMax($imgmax); $gif = ''; if (substr($image->gallery_image, -4) == '.gif') { $gif = '.png'; } $prefix = $sizes[0] . 'x' . $sizes[1] . '_'; $fileName = $imageUrl = $thumbnailfolder . '/' . $prefix . basename($image->gallery_image . $gif); if (!file_exists($fileName)) { $fileName = $imageResizer->SaveResizedTo($sizes[0], $sizes[1], $thumbnailfolder, $prefix); } $marginTop = round(($imgmax - $sizes[1]) / 2); $marginBottom = $imgmax - $sizes[1] - $marginTop; if (file_exists($fileName)) { $images[] = array('IMAGE_TITLE' => $image->gallery_description, 'IMAGE_MARGIN_TOP' => $marginTop, 'IMAGE_MARGIN_BOTTOM' => $marginBottom, 'IMAGE_ID' => $imageID++, 'IMAGE_WIDTH' => $sizes[0], 'IMAGE_HEIGHT' => $sizes[1], 'IMAGE_SRC' => generateUrl($fileName), 'IMAGE_FILE_ID' => $image->gallery_file_id); } } $this->_ComaLate->SetReplacement('IMAGES', $images); $this->_ComaLate->SetReplacement('PAGE_TITLE', $title); $template = '<fieldset> <legend>{LANG_EDIT_GALLERY}</legend> <form action="{ADMIN_FORM_URL}" method="post"> <input type="hidden" name="{ADMIN_FORM_PAGE}" value="pagestructure" /> <input type="hidden" name="action" value="editPage" /> <input type="hidden" name="action2" value="saveTitle" /> <input type="hidden" name="pageID" value="{PAGE_ID}" /> <div class="row"> <label class="row" for="pageTitle"> <strong>{LANG_TITLE}:</strong> <span class="info">{LANG_TITLE_INFO}</span> </label> <input type="text" name="pageTitle" id="pageTitle" value="{PAGE_TITLE}" /> </div> <div class="row"> <input type="submit" value="{LANG_APPLY}" class="button" /> </div> </form> <div class="row"> <a href="{ADMIN_LINK_URL}page=pagestructure&action=editPage&action2=addNewImageDialog&pageID={PAGE_ID}" class="button">{LANG_ADD_IMAGES}</a> <a href="{ADMIN_LINK_URL}page=pagestructure&action=editPage&action2=regenerateThumbnails&pageID={PAGE_ID}" class="button">{LANG_REGENERATE_THUMBNAILS}</a> <a href="{ADMIN_LINK_URL}page=pagestructure" class="button">{LANG_BACK}</a> </div> <div class="row"> <IMAGES:loop> <div class="imageblock"> <a href="index.php?page={PAGE_ID}&imageID={IMAGE_ID}"> <img style="margin-top:{IMAGE_MARGIN_TOP}px;margin-bottom:{IMAGE_MARGIN_BOTTOM}px;width:{IMAGE_WIDTH}px;height:{IMAGE_HEIGHT}px;" src="{IMAGE_SRC}" alt="{LANG_IMAGE}: {IMAGE_TITLE}" title="{IMAGE_TITLE}" /> </a> <div class="actions"> <a href="{ADMIN_LINK_URL}page=pagestructure&action=editPage&pageID={PAGE_ID}&action2=moveImageUp&imageID={IMAGE_FILE_ID}"><img src="./img/up.png" alt="{LANG_MOVE_UP}" title="{LANG_MOVE_UP}"/></a> <a href="{ADMIN_LINK_URL}page=pagestructure&action=editPage&pageID={PAGE_ID}&action2=editImage&imageID={IMAGE_FILE_ID}"><img src="./img/edit.png" alt="{LANG_EDIT}" title="{LANG_EDIT}"/></a> <a href="{ADMIN_LINK_URL}page=pagestructure&action=editPage&pageID={PAGE_ID}&action2=removeImage&imageID={IMAGE_FILE_ID}"><img src="./img/del.png" alt="{LANG_DELETE}" title="{LANG_DELETE}"/></a> <a href="{ADMIN_LINK_URL}page=pagestructure&action=editPage&pageID={PAGE_ID}&action2=moveImageDown&imageID={IMAGE_FILE_ID}"><img src="./img/down.png" alt="{LANG_MOVE_DOWN}" title="{LANG_MOVE_DOWN}"/></a> </div> </div> </IMAGES> </div> </fieldset>'; return $template; }
<h3> <?php echo _t("ADDTASK"); ?> </h3> <?php if ($formError) { ?> <strong>Bad submit!</strong> <?php } ?> <form class="task-form" action="<?php echo generateUrl('createTask'); ?> " method="post"> <!-- Form --> <?php include "views/components/taskForm.php"; ?> <input type="submit" class="btn btn-success" name="submit" value="<?php echo _t("VALIDATE"); ?> " /> </form> </div> <div class="col-md-3"> </div>
/** * mainpage with an overview over all files and a form to select 3 files for an upload * @access private */ function _homePage() { $path = GetPostOrGet('path'); if (substr($path, -1, 1) == '/') { $path = substr($path, 0, -1); } $pathPart = explode('/', $path); array_pop($pathPart); $uppath = implode('/', $pathPart); $pathLen = strlen($path); $out = "\t\t\t<fieldset>\n\t \t\t\t<legend>" . $this->_Translation->GetTranslation('upload') . "</legend>\n\t\t\t\t<form enctype=\"multipart/form-data\" action=\"admin.php?page=files\" method=\"post\">\n\t\t\t\t\t<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"1600000\" />\n\t\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"upload\" />\n\t\t\t\t\t<input type=\"hidden\" name=\"path\" value=\"" . $path . "\" />\n\t\t\t\t\t<div class=\"row\">\n\t\t\t\t\t\t<label>\n\t\t\t\t\t\t\t<strong>" . $this->_Translation->GetTranslation('file') . " 1:</strong>\n\t\t\t\t\t\t</label>\n\t\t\t\t\t\t<input name=\"uploadfile0\" type=\"file\" />\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"row\">\n\t\t\t\t\t\t<label>\n\t\t\t\t\t\t\t<strong>" . $this->_Translation->GetTranslation('file') . " 2:</strong>\n\t\t\t\t\t\t</label>\n\t\t\t\t\t\t<input name=\"uploadfile1\" type=\"file\" />\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"row\">\n\t\t\t\t\t\t<label>\n\t\t\t\t\t\t\t<strong>" . $this->_Translation->GetTranslation('file') . " 3:</strong>\n\t\t\t\t\t\t</label>\n\t\t\t\t\t\t<input name=\"uploadfile2\" type=\"file\" />\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"row\">\n\t\t\t\t\t\t<input type=\"submit\" class=\"button\" value=\"" . $this->_Translation->GetTranslation('upload_files') . "\"/>\n\t\t\t\t\t</div>\n\t\t\t\t</form>\n\t\t\t\t<div class=\"row\">\n\t\t\t\t\t<a href=\"admin.php?page=files&action=check_new_files\" class=\"button\">" . $this->_Translation->GetTranslation('check_for_changes') . "</a>\n\t\t\t\t</div>\n\t\t\t</fieldset>\n\t\t\t<fieldset>\n\t \t\t\t<legend>" . $this->_Translation->GetTranslation('create_directory') . "</legend>\n\t\t\t\t<form action=\"admin.php?page=files\" method=\"post\">\n\t\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"new_dir\" />\n\t\t\t\t\t<input type=\"hidden\" name=\"path\" value=\"" . $path . "\" />\n\t\t\t\t\t<div class=\"row\">\n\t\t\t\t\t\t<label>\n\t\t\t\t\t\t\t<strong>" . $this->_Translation->GetTranslation('directory') . " </strong>\n\t\t\t\t\t\t</label>\n\t\t\t\t\t\t<input name=\"dirname\" type=\"text\" />\n\t\t\t\t\t</div>\n\t\t\t\t\t\n\t\t\t\t\t<div class=\"row\">\n\t\t\t\t\t\t<input type=\"submit\" class=\"button\" value=\"" . $this->_Translation->GetTranslation('create_directory') . "\"/>\n\t\t\t\t\t</div>\n\t\t\t\t</form>\n\t\t\t</fieldset>\t<h3>Pfad: /" . $path . "</h3>"; if ($pathLen > 0) { $out .= "\n\t\t\t\t<div class=\"row\">\n\t\t\t\t\t<a href=\"admin.php?page=files&path=" . $uppath . "\" class=\"button\">" . $this->_Translation->GetTranslation('directory_up') . "</a>\n\t\t\t\t</div>"; } $out .= "\n\t\t\t<table id=\"files\" class=\"text_table full_width\">\n\t\t\t\t<thead>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th>\n\t\t\t\t\t\t\t" . $this->_Translation->GetTranslation('preview') . "\n\t\t\t\t\t\t</th>\n\t\t\t\t\t\t<th>\n\t\t\t\t\t\t\t<a href=\"admin.php?page=files&order=filename#files\" title=\"" . @sprintf($this->_Translation->GetTranslation('sort_ascending_by_%name%'), $this->_Translation->GetTranslation('filename')) . "\"><img alt=\"[" . @sprintf($this->_Translation->GetTranslation('sort_ascending_by_%name%'), $this->_Translation->GetTranslation('filename')) . "]\" src=\"img/up.png\"/></a>\n\t\t\t\t\t\t\t" . $this->_Translation->GetTranslation('filename') . "\n\t\t\t\t\t\t\t<a href=\"admin.php?page=files&order=filename&desc=1#files\" title=\"" . @sprintf($this->_Translation->GetTranslation('sort_descending_by_%name%'), $this->_Translation->GetTranslation('filename')) . "\"><img alt=\"[" . @sprintf($this->_Translation->GetTranslation('sort_descending_by_%name%'), $this->_Translation->GetTranslation('filename')) . "]\" src=\"img/down.png\"/></a>\n\t\t\t\t\t\t</th>\n\t\t\t\t\t\t<th class=\"small_width\">\n\t\t\t\t\t\t\t<a href=\"admin.php?page=files&order=filesize#files\" title=\"" . sprintf($this->_Translation->GetTranslation('sort_ascending_by_%name%'), $this->_Translation->GetTranslation('filesize')) . "\"><img alt=\"[" . sprintf($this->_Translation->GetTranslation('sort_ascending_by_%name%'), $this->_Translation->GetTranslation('filesize')) . "]\" src=\"img/up.png\"/></a>\n\t\t\t\t\t\t\t" . $this->_Translation->GetTranslation('filesize') . "\n\t\t\t\t\t\t\t<a href=\"admin.php?page=files&order=filesize&desc=1#files\" title=\"" . sprintf($this->_Translation->GetTranslation('sort_descending_by_%name%'), $this->_Translation->GetTranslation('filesize')) . "\"><img alt=\"[" . sprintf($this->_Translation->GetTranslation('sort_descending_by_%name%'), $this->_Translation->GetTranslation('filesize')) . "]\" src=\"img/down.png\"/></a>\n\t\t\t\t\t\t</th>\n\t\t\t\t\t\t<th class=\"table_date_width_plus\">\n\t\t\t\t\t\t\t<a href=\"admin.php?page=files&order=filedate#files\" title=\"" . sprintf($this->_Translation->GetTranslation('sort_ascending_by_%name%'), $this->_Translation->GetTranslation('date')) . "\"><img alt=\"[" . sprintf($this->_Translation->GetTranslation('sort_ascending_by_%name%'), $this->_Translation->GetTranslation('date')) . "]\" src=\"img/up.png\"/></a>\n\t\t\t\t\t\t\t" . $this->_Translation->GetTranslation('uploaded_on') . "\n\t\t\t\t\t\t\t<a href=\"admin.php?page=files&order=filedate&desc=1#files\" title=\"" . sprintf($this->_Translation->GetTranslation('sort_descending_by_%name%'), $this->_Translation->GetTranslation('date')) . "\"><img alt=\"[" . sprintf($this->_Translation->GetTranslation('sort_descending_by_%name%'), $this->_Translation->GetTranslation('date')) . "]\" src=\"img/down.png\"/></a>\n\t\t\t\t\t\t</th>\n\t\t\t\t\t\t<th class=\"small_width\">\n\t\t\t\t\t\t\t<a href=\"admin.php?page=files&order=filetype#files\" title=\"" . sprintf($this->_Translation->GetTranslation('sort_ascending_by_%name%'), $this->_Translation->GetTranslation('filetype')) . "\"><img alt=\"[" . sprintf($this->_Translation->GetTranslation('sort_ascending_by_%name%'), $this->_Translation->GetTranslation('filetype')) . "]\" src=\"img/up.png\"/></a>\n\t\t\t\t\t\t\t" . $this->_Translation->GetTranslation('filetype') . "\n\t\t\t\t\t\t\t<a href=\"admin.php?page=files&order=filetype&desc=1#files\" title=\"" . sprintf($this->_Translation->GetTranslation('sort_descending_by_%name%'), $this->_Translation->GetTranslation('filetype')) . "\"><img alt=\"[" . sprintf($this->_Translation->GetTranslation('sort_descending_by_%name%'), $this->_Translation->GetTranslation('filetype')) . "]\" src=\"img/down.png\"/></a>\n\t\t\t\t\t\t</th>\n\t\t\t\t\t\t<th class=\"table_mini_width\">\n\t\t\t\t\t\t\t<a href=\"admin.php?page=files&order=filedownloads#files\" title=\"" . sprintf($this->_Translation->GetTranslation('sort_ascending_by_%name%'), $this->_Translation->GetTranslation('downloads')) . "\"><img alt=\"[" . sprintf($this->_Translation->GetTranslation('sort_ascending_by_%name%'), $this->_Translation->GetTranslation('downloads')) . "]\" src=\"img/up.png\"/></a>\n\t\t\t\t\t\t\t<abbr title=\"" . $this->_Translation->GetTranslation('downloads') . "\">" . $this->_Translation->GetTranslation('downl') . "</abbr>\n\t\t\t\t\t\t\t<a href=\"admin.php?page=files&order=filedownloads&desc=1#files\" title=\"" . sprintf($this->_Translation->GetTranslation('sort_descending_by_%name%'), $this->_Translation->GetTranslation('downloads')) . "\"><img alt=\"[" . sprintf($this->_Translation->GetTranslation('sort_descending_by_%name%'), $this->_Translation->GetTranslation('downloads')) . "]\" src=\"img/down.png\"/></a>\n\t\t\t\t\t\t</th>\n\t\t\t\t\t\t<th class=\"actions\">" . $this->_Translation->GetTranslation('actions') . "</th>\n\t\t\t\t\t</tr>\n\t\t\t\t</thead>\n\t\t\t\t\r\n"; $dateDayFormat = $this->_Config->Get('date_day_format', 'd.m.Y'); $dateTimeFormat = $this->_Config->Get('date_time_format', 'H:i:s'); $dateFormat = $dateDayFormat . ' ' . $dateTimeFormat; $thumbnailfolder = $this->_Config->Get('thumbnailfolder', 'data/thumbnails/'); $files = new Files($this->_SqlConnection, $this->_User); $order = FILES_NAME; $ascending = true; $orderByGet = GetPostOrGet('order'); $desc = GetPostOrGet('desc'); switch ($orderByGet) { case 'filesize': $order = FILES_SIZE; break; case 'filedate': $order = FILES_DATE; break; case 'filetype': $order = FILES_TYPE; break; case 'filedownloads': $order = FILES_DOWNLOADS; break; case 'filename': default: $order = FILES_NAME; break; } // descending or ascending? if ($desc == 1) { $ascending = false; } // get all files from the database/ which are registered in the database $filesArrayTmp = $files->FillArray($order, $ascending); //print str_replace(' ',' ',nl2br(print_r($fileArray, true))); //die(); $filesCount = count($filesArrayTmp); $filesArray = array(); for ($i = 0; $i < $filesCount; $i++) { $fileArray = $filesArrayTmp[$i]; if (substr($fileArray['FILE_NAME'], 0, $pathLen) == $path && strlen($fileArray['FILE_NAME']) > $pathLen && !strpos($fileArray['FILE_NAME'], '/', $pathLen + 1)) { $fileArray['FILE_SIZE'] = kbormb($fileArray['FILE_SIZE']); $fileArray['FILE_DATE'] = date($dateFormat, $fileArray['FILE_DATE']); $fileArray['FILE_DOWNLOAD_FILE'] = sprintf($this->_Translation->GetTranslation('download_file_%file%'), $fileArray['FILE_NAME']); $fileArray['FILE_DELETE_FILE'] = sprintf($this->_Translation->GetTranslation('delete_file_%file%'), $fileArray['FILE_NAME']); $fileArray['FILE_MOVE_FILE'] = sprintf($this->_Translation->GetTranslation('move_file_%file%'), $fileArray['FILE_NAME']); $preview = ''; if (strpos($fileArray['FILE_TYPE'], 'image/') === 0) { $image = new ImageConverter($fileArray['FILE_PATH']); // max: 100px; $maximum = 100; $size = $image->CalcSizeByMax($maximum); $imageUrl = $image->SaveResizedTo($size[0], $size[1], $thumbnailfolder, $size[0] . 'x' . $size[1] . '_'); if (file_exists($imageUrl)) { $preview = "<img alt=\"{$fileArray['FILE_NAME']}\" src=\"" . generateUrl($imageUrl) . "\" />"; } } $fileArray['FILE_PREVIEW'] = $preview; if ($pathLen > 0) { $fileArray['FILE_NAME'] = substr($fileArray['FILE_NAME'], $pathLen + 1); } if ($fileArray['FILE_TYPE'] == 'dir') { $det = $pathLen > 0 ? '/' : ''; $fileArray['FILE_NAME'] = '<a href="admin.php?page=files&path=' . $path . $det . $fileArray['FILE_NAME'] . '">' . $fileArray['FILE_NAME'] . '</a>'; } $fileArray['FILE_ACTION'] = ''; if ($fileArray['FILE_TYPE'] != 'dir') { $file_id = $fileArray['FILE_ID']; $fileArray['FILE_ACTION'] .= '<a href="download.php?file_id=' . $file_id . '" ><img src="img/download.png" alt="[' . $fileArray['FILE_DOWNLOAD_FILE'] . ']" title="' . $fileArray['FILE_DOWNLOAD_FILE'] . '"/></a>'; $fileArray['FILE_ACTION'] .= '<a href="admin.php?page=files&action=move&file_id=' . $file_id . '" ><img src="img/restore.png" alt="[' . $fileArray['FILE_MOVE_FILE'] . ']" title="' . $fileArray['FILE_MOVE_FILE'] . '"/></a>'; } $filesArray[] = $fileArray; } } $this->_ComaLate->SetReplacement('FILES', $filesArray); $this->_ComaLate->SetReplacement('SIZE_COUNT', kbormb($files->SizeCount)); $this->_ComaLate->SetReplacement('LANG_ALTOGETHER', $this->_Translation->GetTranslation('altogether')); $out .= '<FILES:loop> <tr> <td>{FILE_PREVIEW}</td> <td>{FILE_NAME}</td> <td>{FILE_SIZE}</td> <td>{FILE_DATE}</td> <td>{FILE_TYPE}</td> <td>{FILE_DOWNLOADS}</td> <td>{FILE_ACTION} <a href="admin.php?page=files&action=delete&file_id={FILE_ID}" ><img src="img/del.png" alt="[{FILE_DELETE_FILE}]" title="{FILE_DELETE_FILE}" /></a></td> </tr> </FILES> </table> {LANG_ALTOGETHER} {SIZE_COUNT}'; return $out; }
<?php // arrivée standard $pdo = $app['pdo']; $app->get('/', function () use($app) { $pdo = $app['pdo']; require './src/model_index.php'; $url = generateUrl($pdo); return $app->redirect($url . '/edit'); }); //arrivée avec url deja connue $app->get('/{url}', function ($url) use($app) { $pdo = $app['pdo']; require './src/model_index.php'; if (checkUrl($url, $pdo)) { return $app->redirect($url . '/view'); } else { $app->abort(404, "l'url \" {$url} \" is not a valid one. Must be alphanumeric and less than 10 characters."); } }); $app->get('/{url}/', function ($url) use($app) { return $app->redirect($url); }); // la view pour chaque note $app->get('/{url}/view', function ($url) use($app) { $pdo = $app['pdo']; require './src/model_note_view.php'; if (!isViewProtected($url, $pdo)) { $content = getContent($url, $pdo); return $app['twig']->render('view_note_view.html.twig', array('content' => $content, 'url' => $url)); } else {
$gdInfo = getGdLibraryInfo(); ?> <html> <head> <title>Gallery Support | GD Library Info</title> <link rel="stylesheet" type="text/css" href="<?php print $baseUrl; ?> support.css"/> </head> <body> <div id="content"> <div id="title"> <a href="../../">Gallery</a> » <a href="<?php generateUrl('index.php'); ?> ">Support</a> » GD Library Info </div> <?php if ($gdInfo == '') { ?> <h2>No GD library found.</h2> <?php } else { ?> <h2>This information might be useful for the GD module developers:</h2> <pre style="padding-left: 20px"><?php echo $gdInfo; ?> </pre>
/** * @access private * @return string */ function _InlineMenuHomePage($PageID) { $adminLang = $this->_AdminLang; $image = 'Noch kein Bild gesetzt'; $thumbPath = $this->_PageStructure->GetInlineMenuData($PageID, 'imageThumb'); $imagePath = $this->_PageStructure->GetInlineMenuData($PageID, 'image'); $imageTitle = $this->_PageStructure->GetInlineMenuData($PageID, 'imageTitle'); if (file_exists($thumbPath)) { $image = "<img alt=\"{$imageTitle}\" src=\"" . generateUrl($thumbPath) . "\"/>"; } else { $imgmax2 = 200; $inlinemenuFolder = 'data/thumbnails/'; $thumbnail = resizeImageToWidth($imagePath, $inlinemenuFolder, $imgmax2); if ($thumbnail !== false) { $image = "<img alt=\"{$imageTitle}\" src=\"" . generateUrl($thumbnail) . "\"/>"; } } $out = "\r\n\t\t\t\t<fieldset>\r\n\t\t\t\t\t<legend>" . $adminLang['inlinemenu'] . "</legend>\r\n\t\t\t\t<div class=\"row\">\r\n\t\t\t\t\t\t<label class=\"row\">\r\n\t\t\t\t\t\t\t" . $adminLang['inlinemenu_image'] . ":\r\n\t\t\t\t\t\t\t<span class=\"info\">Das ist der Pfad zu dem Bild, das dem Zusatzmenü zugeordnet wird, es kann der Einfachheit halber aus den bereits hochgeladenen Bildern ausgewählt werden.</span>\r\n\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t{$image}\r\n\t\t\t\t</div>\r\n\t\t\t\t<div class=\"row\">\r\n\t\t\t\t\t<a href=\"admin.php?page=pagestructure&action=pageInlineMenu&pageID={$PageID}&action2=selectImage\" class=\"button\">Bild auswählen/verändern</a>\r\n\t\t\t\t\t" . (file_exists($thumbPath) ? "<a href=\"admin.php?page=pagestructure&action=pageInlineMenu&pageID={$PageID}&action2=removeImage\" class=\"button\">Bild entfernen</a>" : '') . "\r\n\t\t\t\t</div>\r\n\t\t\t\t<form action=\"admin.php\" method=\"post\">\r\n\t\t\t\t<input type=\"hidden\" name=\"page\" value=\"pagestructure\" />\r\n\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"pageInlineMenu\" />\r\n\t\t\t\t<input type=\"hidden\" name=\"pageID\" value=\"{$PageID}\" />\r\n\t\t\t\t<input type=\"hidden\" name=\"action2\" value=\"setImageTitle\" />\r\n\t\t\t\t<div class=\"row\">\r\n\t\t\t\t\t<label for=\"inlinemenuThumbTitle\"class=\"row\">\r\n\t\t\t\t\t\tBildunterschrift:\r\n\t\t\t\t\t\t<span class=\"info\">Die Bildunterschrift kann das Bild noch ein wenig erläutern.</span>\r\n\t\t\t\t\t</label>\r\n\t\t\t\t\t<input id=\"inlinemenuThumbTitle\" name=\"imageTitle\" type=\"text\" value=\"{$imageTitle}\" />\r\n\t\t\t\t</div>\r\n\t\t\t\t<div class=\"row\">\r\n\t\t\t\t\t<input type=\"submit\" class=\"button\" value=\"" . $adminLang['save'] . "\" />\r\n\t\t\t\t</div>\r\n\t\t\t\t</form>"; $sql = "SELECT *\r\n\t\t\t\tFROM " . DB_PREFIX . "inlinemenu_entries\r\n\t\t\t\tWHERE inlineentry_page_id = {$PageID}\r\n\t\t\t\tORDER BY inlineentry_sortid ASC"; $entries_result = db_result($sql); $out .= "<h3 id=\"entries\">Einträge</h3>\r\n\t\t\t\t<div class=\"row\"><table class=\"text_table full_width\">\r\n\t\t\t\t\t<thead><tr><th>Text</th><th class=\"small_width\">Typ</th><th class=\"actions\">Aktion</th></tr></thead>"; while ($entry = mysql_fetch_object($entries_result)) { $typeImage = ''; switch ($entry->inlineentry_type) { case 'download': $typeImage = "<img alt=\"\" src=\"img/download.png\"/>Download"; break; case 'link': $typeImage = "<img alt=\"\" src=\"img/extern.png\"/>Externer-Link"; break; case 'intern': $typeImage = "<img alt=\"\" src=\"img/view.png\"/>Interner-Link"; break; default: $typeImage = "Text"; break; } $out .= "<tr>\r\n\t\t\t\t\t<td>" . nl2br($entry->inlineentry_text) . "</td>\r\n\t\t\t\t\t<td>" . $typeImage . "</td>\r\n\t\t\t\t\t<td>\r\n\t\t\t\t\t\t<a href=\"admin.php?page=pagestructure&action=pageInlineMenu&pageID={$PageID}&entrySortID={$entry->inlineentry_sortid}&action2=moveEntryUp#entries\"><img src=\"./img/up.png\" alt=\"" . $adminLang['move_up'] . "\" title=\"" . $adminLang['move_up'] . "\" /></a>\r\n\t\t\t\t\t\t<a href=\"admin.php?page=pagestructure&action=pageInlineMenu&pageID={$PageID}&entrySortID={$entry->inlineentry_sortid}&action2=moveEntryDown#entries\"><img src=\"./img/down.png\" alt=\"" . $adminLang['move_down'] . "\" title=\"" . $adminLang['move_down'] . "\" /></a>\r\n\t\t\t\t\t\t<a href=\"admin.php?page=pagestructure&action=pageInlineMenu&pageID={$PageID}&entryID={$entry->inlineentry_id}&action2=editEntry\"><img src=\"./img/edit.png\" alt=\"" . $adminLang['edit'] . "\" title=\"" . $adminLang['edit'] . "\" /></a>\r\n\t\t\t\t\t\t<a href=\"admin.php?page=pagestructure&action=pageInlineMenu&pageID={$PageID}&entryID={$entry->inlineentry_id}&action2=removeEntry\"><img src=\"./img/del.png\" alt=\"" . $adminLang['delete'] . "\" title=\"" . $adminLang['delete'] . "\" /></a>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t</td>\r\n\t\t\t\t\t</tr>"; } $out .= "</table>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div class=\"row\"><a href=\"admin.php?page=pagestructure&action=pageInlineMenu&pageID={$PageID}&action2=addNewEntryDialog\" class=\"button\">Einen Eintrag hinzufügen</a></div>\r\n\t\t\t\t\t</fieldset>"; return $out; }
<!-- Display beautiful message --> <p> <img src="img/stop_sign.jpg" alt="Stop sign" /> <div class="alert alert-danger"> <strong><?php echo _t('WARNING'); ?> </strong> <?php echo _t('ERRORPERMISSIONTEXT'); ?> </div> </p> <p> <a class="btn btn-primary" href="<?php echo generateUrl('accueil'); ?> "> <?php echo _t("HOME"); ?> </a> </p> </div> <div class="col-md-2"> </div> </div>
function redirect($routeName = '') { // redirect to generate url redirectUrl(generateUrl($routeName)); }
function _OverviewPage() { $sql = "SELECT *\r\n\t\t\t\tFROM " . DB_PREFIX . "articles\r\n\t\t\t\tORDER BY article_date DESC"; $articlesResult = $this->_SqlConnection->SqlQuery($sql); $imgMax = 120; $thumbnailFolder = $this->_Config->Get('thumbnailfolder', 'data/thumbnails/'); $dateFormat = $this->_Config->Get('articles_date_format', 'd.m.Y'); $dateFormat .= ' ' . $this->_Config->Get('articles_time_format', 'H:i:s'); $showAuthor = $this->_Config->Get('articles_display_author', 1); $articlesArray = array(); while ($article = mysql_fetch_object($articlesResult)) { $thumbnail = ''; if ($article->article_image != '') { if (file_exists($article->article_image)) { $image = new ImageConverter($article->article_image); $size = $image->Size; if ($size[0] > $imgMax && $size[1] > $imgMax) { $size = $image->CalcSizeByMax($imgMax); } $resizedFileName = $thumbnailFolder . $size[0] . 'x' . $size[1] . '_' . basename($article->article_image); if (!file_exists($resizedFileName)) { $image->SaveResizedTo($size[0], $size[1], $thumbnailFolder, $size[0] . 'x' . $size[1] . '_'); } if (file_exists($resizedFileName)) { $thumbnail = '<img class="article_image" title="' . $article->article_title . '" alt="' . $article->article_title . '" src="' . generateUrl($resizedFileName) . '" />'; } } } $author = ''; if ($showAuthor) { $author = $this->_ComaLib->GetUserByID($article->article_creator); } $articlesArray[] = array('ARTICLE_ID' => $article->article_id, 'ARTICLE_TITLE' => $article->article_title, 'ARTICLE_THUMBNAIL' => $thumbnail, 'ARTICLE_DESCRIPTION' => nl2br($article->article_description), 'ARTICLE_DATE' => date($dateFormat, $article->article_date), 'ARTICLE_AUTHOR' => $author); } $articlesTitle = $this->_Config->Get('articles_title', ''); if ($articlesTitle != '') { $articlesTitle = '<h2>' . $articlesTitle . '</h2>'; } $this->_ComaLate->SetReplacement('ARTICLES_BIG_TITLE', $articlesTitle); $this->_ComaLate->SetReplacement('ARTICLESOVERVIEW', $articlesArray); $articleOverviewString = '{ARTICLES_BIG_TITLE} <ol class="articles_overview"> <ARTICLESOVERVIEW:loop> <li><h2>{ARTICLE_TITLE}</h2> <div class="article_date">{ARTICLE_DATE}</div> <div>{ARTICLE_THUMBNAIL} <div class="article_description">{ARTICLE_DESCRIPTION}</div> <div class="article_link"><a href="special.php?page=module&moduleName=articles&action=show&articleId={ARTICLE_ID}">Den Artikel "{ARTICLE_TITLE}" weiterlesen...</a></div> </div> <div class="article_author">{ARTICLE_AUTHOR}</div> </li> </ARTICLESOVERVIEW> </ol>'; return $articleOverviewString; }
function LoadGalleryPage($PageID) { if (!is_numeric($PageID)) { return false; } $this->_ComaLate->SetReplacement('LANG_GALLERY', $this->_Translation->GetTranslation('gallery')); $this->_ComaLate->SetReplacement('LANG_IMAGE', $this->_Translation->GetTranslation('image')); $this->_ComaLate->SetReplacement('PAGE_ID', $PageID); // Load the images of the gallery with file-information $sql = 'SELECT gallery.gallery_description, gallery.gallery_image_thumbnail, page.page_title FROM ( (' . DB_PREFIX . 'pages page LEFT JOIN ' . DB_PREFIX . 'pages_gallery gallery_page ON page.page_id = gallery_page.page_id) LEFT JOIN ' . DB_PREFIX . 'gallery gallery ON gallery_page.gallery_id =gallery.gallery_id) WHERE page.page_id=' . $PageID . ' ORDER BY gallery.gallery_orderid'; $imagesResult = $this->_SqlConnection->SqlQuery($sql); $images = array(); $imgmax = 100; $imageID = 0; $title = ''; while ($image = mysql_fetch_object($imagesResult)) { if ($title == '') { $title = $image->page_title; } if (file_exists($image->gallery_image_thumbnail)) { $sizes = getimagesize($image->gallery_image_thumbnail); $marginTop = round(($imgmax - $sizes[1]) / 2); $marginBottom = $imgmax - $sizes[1] - $marginTop; $images[] = array('IMAGE_TITLE' => $image->gallery_description, 'IMAGE_MARGIN_TOP' => $marginTop, 'IMAGE_MARGIN_BOTTOM' => $marginBottom, 'IMAGE_ID' => $imageID++, 'IMAGE_WIDTH' => $sizes[0], 'IMAGE_HEIGHT' => $sizes[1], 'IMAGE_SRC' => generateUrl($image->gallery_image_thumbnail)); } } $this->_ComaLate->SetReplacement('IMAGES', $images); $this->_ComaLate->SetReplacement('PAGE_TITLE', $title); $this->HTML = '<h2>{LANG_GALLERY}: {PAGE_TITLE}</h2><div class="imagesblock"> <IMAGES:loop> <div class="imageblock"> <a href="index.php?page={PAGE_ID}&imageID={IMAGE_ID}"> <img style="margin-top:{IMAGE_MARGIN_TOP}px;margin-bottom:{IMAGE_MARGIN_BOTTOM}px;width:{IMAGE_WIDTH}px;height:{IMAGE_HEIGHT}px;" src="{IMAGE_SRC}" alt="{LANG_IMAGE}: {IMAGE_TITLE}" title="{IMAGE_TITLE}" /></a><br /> </div> </IMAGES> </div>'; return true; }
/** * Will get URL for a given pictureId. * @param $pictureId = ID from the database for the picture you want the URL from. * @param $db = PDO connection to the database. * @return $url complete URL for a pictureID. */ function getUrlForPicture($pictureId, $db) { $sql = "SELECT * FROM picture\n\tJOIN pictureset ON picture.pictureSet = pictureset.id\n\tWHERE picture.id = ?;"; $sth = $db->prepare($sql); $sth->bindParam(1, $pictureId); $sth->execute(); $row = $sth->fetch(); $url = generateUrl($row); return $url; }
/** * Returns data of experiment and resultsbased on experimenttype * @param int $experimentId Id of experiment * @param object $db object of current database * @return array [0] = experimenttype, [1] = image sets, [2] = experimentorders, [3] = results */ function getExperimentResults($experimentId, $db, $complete) { $result = array(); $imageSetImages = array(); $pictureQueues = array(); //Gets experiment type and adds to result array $sql = "SELECT experimentType FROM experiment WHERE experiment.id = ?"; $sth = $db->prepare($sql); $sth->bindParam(1, $experimentId); $sth->execute(); $type = $sth->fetch(); $type = $type['experimentType']; $result[] = $type; //Gets all imageset id's and adds to result $sql = "SELECT pictureset.id, pictureset.name FROM experiment " . " JOIN experimentqueue ON experimentqueue.experiment = experiment.id " . " JOIN experimentorder ON experimentqueue.id = experimentorder.experimentQueue " . " JOIN picturequeue ON experimentorder.pictureQueue = picturequeue.id " . " JOIN pictureorder ON picturequeue.id = pictureorder.pictureQueue " . " JOIN picture ON pictureorder.picture = picture.id " . " JOIN pictureset ON picture.pictureSet = pictureset.id " . " WHERE experiment.id = ? AND experiment.person = ? " . " GROUP BY eOrder"; $sth = $db->prepare($sql); $sth->bindParam(1, $experimentId); $sth->bindParam(2, $_SESSION['user']['id']); $sth->execute(); $imageSets = $sth->fetchAll(); $result[] = $imageSets; //Gets all experimentorders, since not all images in imagesets might be used in experiment $sql = "SELECT experimentorder.eOrder FROM experiment " . " JOIN experimentqueue ON experimentqueue.experiment = experiment.id " . " JOIN experimentorder ON experimentqueue.id = experimentorder.experimentQueue " . " JOIN picturequeue ON experimentorder.pictureQueue = picturequeue.id " . " JOIN pictureorder ON picturequeue.id = pictureorder.pictureQueue " . " JOIN picture ON pictureorder.picture = picture.id " . " JOIN pictureset ON picture.pictureSet = pictureset.id " . " WHERE experiment.id = ? AND experiment.person = ? " . " GROUP BY pictureorder.pictureQueue"; $sth = $db->prepare($sql); $sth->bindParam(1, $experimentId); $sth->bindParam(2, $_SESSION['user']['id']); $sth->execute(); $experimentOrders = $sth->fetchAll(); $result['experimentOrders'] = $experimentOrders; foreach ($experimentOrders as $experimentOrder) { $sql = "SELECT picture.name, picture.id, picture.pictureset FROM picture " . " JOIN pictureorder ON picture.id = pictureorder.picture " . " JOIN picturequeue ON pictureorder.pictureQueue = picturequeue.id " . " JOIN experimentorder ON experimentorder.picturequeue = picturequeue.id " . " JOIN experimentqueue ON experimentorder.experimentQueue = experimentqueue.id " . " JOIN experiment ON experimentqueue.experiment = experiment.id " . " WHERE experiment.id = ? AND experiment.person = ? AND experimentorder.eOrder = ?" . " GROUP BY picture.id"; $sth = $db->prepare($sql); $sth->bindParam(1, $experimentId); $sth->bindParam(2, $_SESSION['user']['id']); $sth->bindParam(3, $experimentOrder['eOrder']); $sth->execute(); $imageSetImages[] = $sth->fetchAll(); } $result[] = $imageSetImages; // Retrieves url for thumbnail picture of each image set foreach ($imageSets as $key => $imageSet) { $sql = "SELECT * FROM picture\n\t JOIN pictureset ON picture.pictureset=pictureset.id\n\t WHERE picture.isOriginal = 1 AND picture.pictureSet = ?;"; $sth = $db->prepare($sql); $sth->bindParam(1, $imageSet['id']); $sth->execute(); $result['imageUrl'][$key] = generateUrl($sth->fetch()); } //If rating experiment if ($type == 1) { $resultArray = array(); //Iterates through all experimentorders for ($i = 0; $i < sizeof($experimentOrders); $i++) { $currentResult = array(); //Result for current experimentorder $tempArray = array(); $experimentOrder = $experimentOrders[$i]; $imagesLength = sizeof($imageSetImages[$i]); $sql = "SELECT result.*, person.firstName, person.lastName, picture.id as pictureId, picture.name, result.created, pictureset.id AS pictureSet, eOrder " . "FROM `result` \n" . "JOIN experiment ON result.experimentId = experiment.id\n" . "JOIN person ON result.personId = person.id\n" . "JOIN pictureorder ON result.pictureOrderId = pictureorder.id\n" . "JOIN picturequeue ON pictureorder.pictureQueue = picturequeue.id\n" . "JOIN experimentorder ON picturequeue.id = experimentorder.pictureQueue\n" . "JOIN picture ON picture.id = pictureorder.picture \n" . "JOIN pictureset ON picture.pictureSet = pictureset.id \n" . ($complete == 1 ? " JOIN experimentresult ON result.experimentId = experimentresult.experiment AND experimentresult.person = result.personId " : ' ') . "WHERE result.experimentId = ? AND experimentorder.eOrder = ? AND experiment.person = ? " . ($complete == 1 ? " AND experimentresult.complete != 1 " : " ") . "ORDER BY result.id "; $sth = $db->prepare($sql); $sth->bindParam(1, $experimentId); $sth->bindParam(2, $experimentOrder['eOrder']); $sth->bindParam(3, $_SESSION['user']['id']); $sth->execute(); $experimentOrderResult = $sth->fetchAll(); $rows = sizeof($experimentOrderResult); //Iterates through first row of all results for ($k = 0; $k < $rows; $k += $imagesLength) { $tempArray = array(); //Iterates through rest of results for ($j = $k; $j < $k + $imagesLength; $j++) { $tmp = $experimentOrderResult[$j]; $tempArray['person'] = $tmp['firstName'] . ' ' . $tmp['lastName']; $tempArray['timeStamp'] = $tmp['created']; $tempArray['eOrderId'] = $tmp['eOrder']; $imageIndex = arrayObjectIndexOf($imageSetImages[$i], $tmp['pictureId'], 'id'); $tempArray[$j - $k] = $imageIndex + 1; // $resultRow = array('pictureName' => $tmp['name'], // 'person' => ($tmp['lastName'].", ".$tmp['firstName']), // 'pictureId' => $tmp['pictureId']); // $currentResult[] = $resultRow; } //Saves current row to experimentorderarray $currentResult[] = $tempArray; } //Saves current experimentorderresult to array $resultArray[] = $currentResult; } //Adds all results to array $result[] = $resultArray; } elseif ($type == 2) { //If paired comparison $pairResults = array(); foreach ($experimentOrders as $experimentOrder) { $sql = "SELECT picture.name, picture.id AS pictureId, pictureorder.id AS orderId, pictureorder.pOrder po, " . "COUNT(result.pictureOrderId) AS won, result.chooseNone, experimentorder.eOrder AS eOrderId, result.personId, result.created, " . "(SELECT picture.id " . " FROM picture " . " JOIN pictureorder ON picture.id = pictureorder.picture " . " JOIN picturequeue ON pictureorder.pictureQueue = picturequeue.id " . " JOIN experimentorder ON picturequeue.id = experimentorder.pictureQueue " . " WHERE pictureorder.pOrder = po AND experimentorder.eOrder = eOrderId AND picture.id != pictureId " . " LIMIT 0,1) AS wonAgainst, " . "(SELECT picture.name " . " FROM picture " . " JOIN pictureorder ON picture.id = pictureorder.picture " . " JOIN picturequeue ON pictureorder.pictureQueue = picturequeue.id " . " JOIN experimentorder ON picturequeue.id = experimentorder.pictureQueue " . " WHERE pictureorder.pOrder = po AND experimentorder.eOrder = eOrderId AND picture.id != pictureId " . " LIMIT 0,1) AS wonAgainstName " . "FROM pictureorder " . "JOIN picturequeue ON pictureorder.pictureQueue = picturequeue.id " . "JOIN experimentorder ON picturequeue.id = experimentorder.pictureQueue " . "JOIN experimentqueue on experimentorder.experimentQueue = experimentqueue.id " . "JOIN experiment ON experiment.id = experimentqueue.experiment " . "JOIN picture ON pictureorder.picture = picture.id " . "LEFT JOIN result ON pictureorder.id = result.pictureOrderId " . ($complete == 1 ? " JOIN experimentresult ON result.experimentId = experimentresult.experiment AND experimentresult.person = result.personId " : ' ') . "WHERE experiment.id = ? AND experiment.person = ? AND experimentorder.eOrder = ? AND created IS NOT NULL " . ($complete == 1 ? " AND experimentresult.complete != 1 " : " ") . "GROUP BY orderId, personId " . "ORDER BY orderId "; $sth = $db->prepare($sql); $sth->bindParam(1, $experimentId); $sth->bindParam(2, $_SESSION['user']['id']); $sth->bindParam(3, $experimentOrder['eOrder']); $sth->execute(); $pairResults[] = $sth->fetchAll(); } $result[] = $pairResults; //If category experiment } elseif ($type == 3) { //Gets all categories and saves in result, needed in case all categories aren't chosen $sql = "SELECT categoryname.name, categoryname.id FROM categoryname " . " JOIN experimentcategory ON categoryname.id = experimentcategory.category " . " JOIN experiment ON experiment.id = experimentcategory.experiment " . " WHERE experiment.id = ? AND experiment.person = ?"; $sth = $db->prepare($sql); $sth->bindParam(1, $experimentId); $sth->bindParam(2, $_SESSION['user']['id']); $sth->execute(); $result[] = $sth->fetchAll(); //Gets all pictures and saves in result, needed in case all pictures aren't reviewed yet $sql = "SELECT picture.name, picture.id, picture.pictureset FROM result " . " JOIN experiment ON experiment.id = result.experimentId " . " JOIN pictureorder ON result.pictureOrderId = pictureorder.id " . " JOIN picture ON pictureorder.picture = picture.id " . " WHERE experiment.id = ? AND experiment.person = ? " . " GROUP BY picture.id"; $sth = $db->prepare($sql); $sth->bindParam(1, $experimentId); $sth->bindParam(2, $_SESSION['user']['id']); $sth->execute(); $result[] = $sth->fetchAll(); $resultArray = array(); for ($i = 0; $i < sizeof($experimentOrders); $i++) { $currentResult = array(); //Result for current experimentorder $tempArray = array(); $experimentOrder = $experimentOrders[$i]; $imagesLength = sizeof($imageSetImages[$i]); //Gets all results and saves in result $sql = "SELECT categoryname.name AS categoryName, result.category AS categoryId, experiment.id AS experimentId, " . " experiment.title AS experimentName,COUNT(categoryname.name) AS points, picture.name AS pictureName, " . " picture.url, picture.pictureSet, picture.id as pictureId " . " FROM `result` " . " JOIN experiment ON result.experimentId = experiment.id " . " JOIN experimenttype ON experiment.experimentType = experimenttype.id " . " JOIN categoryname ON result.category = categoryname.id " . " JOIN pictureorder ON pictureorder.id = result.pictureOrderId " . " JOIN picturequeue ON pictureorder.pictureQueue = picturequeue.id " . " JOIN experimentorder ON picturequeue.id = experimentorder.pictureQueue " . " JOIN picture ON pictureorder.picture = picture.id " . ($complete == 1 ? " JOIN experimentresult ON result.experimentId = experimentresult.id AND experimentresult.person = result.personId " : ' ') . " WHERE experimenttype.id = 3 AND experiment.id = ? AND experiment.person = ? AND experimentorder.eOrder = ? " . ($complete == 1 ? " AND experimentresult.complete != 1" : " ") . " GROUP BY picture.id, result.category "; $sth = $db->prepare($sql); $sth->bindParam(1, $experimentId); $sth->bindParam(2, $_SESSION['user']['id']); $sth->bindParam(3, $experimentOrder['eOrder']); $sth->execute(); $resultArray[] = $sth->fetchAll(); } $result[] = $resultArray; //If error } else { $result = 0; } return $result; }