コード例 #1
0
<div class="header">
	<div class="header_title">
		Purge trash
	</div>
</div>
<div class="container">
	<?php 
sql_order("objTitle");
sql_where(array("objEid*" => "objid", "objPending" => 0, "objCreator" => $_auth["useid"], "objDeleted" => 1, "objDeletedBy" => $_auth["useid"], "objDeleteDate<!" => "DATE_SUB( NOW(), INTERVAL 30 DAY )"));
$result = sql_rowset("objects, objExtData");
$showForm = sql_num_rows($result) > 0 && !isset($_POST["submit"]);
if ($showForm) {
    ?>
		<form action="<?php 
    echo url(".");
    ?>
" method="post">
		<div>
			Select deleted submissions you want to purge forever:
		</div>
		<?php 
}
include_once INCLUDES . "submission.php";
while ($objData = sql_next($result)) {
    if (isset($_POST["delete" . $objData["objid"]])) {
        eraseSubmission($objData["objid"], false, false);
        notice("Purged: " . $objData["objTitle"]);
        continue;
    }
    if ($showForm) {
        ?>
コード例 #2
0
/**
 * Consulta de varios registros 
 * @param $cTitulo   titulo (h2)
 * @param $aTable    definiciones DD
 * @param $cSQL      consulta SQL sin LIMIT
 * @param $aNodo     información sobre controlador,accion e id.
 * @param $aOpciones menu para cada registro
 * @param $aMenu     Menu de opciones (puede ser una cadena) 
 */
function tablaConsulta($cTitulo, $aTabla, $cSQL, $aNodo, $aOpciones = "", $aMenu = NULL)
{
    global $aEstado, $hizkuntza;
    $order = $aEstado["order"];
    $orderBy = $aEstado["orderby"];
    $lHayOpciones = is_array($aOpciones) and count($aOpciones);
    if ($cTitulo != "") {
        $cResul .= "<h2><span>{$cTitulo}</span></h2>\n";
    } else {
        $cResul = "";
    }
    // Ordenar los campos
    if ($aEstado["order"] != "" and stripos($cSQL, "order by") === false) {
        $cSQL .= sql_order($aTabla[$aEstado["order"]]["order"], $aEstado["orderby"] == "ASC" ? " ASC" : " DESC");
    }
    // incluir el menu de Opciones
    if (!is_null($aMenu)) {
        if (is_array($aMenu)) {
            foreach ($aMenu as $unaOpcion) {
                $lista .= "<li>{$unaOpcion}</li>\n";
            }
        } else {
            $lista .= "<li>{$aMenu}</li>\n";
        }
        $cResul .= "<div id='menuConsulta'>\n<ul>\n{$lista}</ul></div>";
    }
    $aPaginacion = paginacion($cSQL, "leyenda", 20, 10, $hizkuntza, $aNodo);
    $cResul .= "<table class='consulta'>\n";
    /* Dibujar las cabeceras de datos */
    $nCont = 0;
    $lista = "";
    foreach ($aTabla as $oCelda) {
        if ($oCelda["acceso"] !== false) {
            $lista .= "<th>";
            $cNodo = "c={$aNodo[c]}&amp;a={$aNodo[a]}";
            if (isset($oCelda["order"])) {
                if ($nCont == $order) {
                    $lista .= "<a href='?{$cNodo}&amp;orderby=" . ($orderBy == "ASC" ? "DESC" : "ASC") . "&amp;order={$nCont}' class='orden{$orderBy}'>{$oCelda[cabecera]}</a>";
                } else {
                    $lista .= "<a href='?{$cNodo}&amp;orderby=ASC&amp;order={$nCont}' class='ordenASC'>" . $oCelda["cabecera"] . "</a>";
                }
            } else {
                $lista .= $oCelda["cabecera"];
            }
            $lista .= "</th>\n";
            $nCont++;
        }
    }
    if ($lHayOpciones) {
        $lista .= "<th>" . t("Opciones") . "</th>";
    }
    $cResul .= "<thead>\n<tr>\n{$lista}</tr>\n</thead>";
    /* Dibujar el pie de la pagina */
    $cResul .= "<tfoot><tr><td colspan='" . (count($aTabla) + ($lHayOpciones ? 1 : 0)) . "' >" . $aPaginacion[3] . "</td></tr></tfoot>\n";
    $cResul .= "<tbody>\n";
    /* dibujar los datos */
    $lPar = true;
    $rsEmaitza = mysql_query($aPaginacion[2]);
    while ($lerroa = mysql_fetch_array($rsEmaitza)) {
        $cResul .= "\n<tr" . ($lPar ? "" : " class='impar' ") . ">";
        // dibujamos cada celda según su tipo //
        foreach ($aTabla as $oCelda) {
            if ($oCelda["acceso"] === false) {
                continue;
            }
            $aParametros = explode(" ", $oCelda["campo"]);
            // ------- Primero calcular el campo ----------
            switch ($aParametros[0]) {
                case "lista":
                    if (isset($aParametros[2]) and isset($aParametros[1])) {
                        $campo = mlista($aParametros[2], $lerroa[$aParametros[1]]);
                    } else {
                        $campo = "";
                    }
                    break;
                case "idioma":
                case "funcionget":
                    $campo = tCampo($lerroa, $aParametros[1], $aParametros[2]);
                    break;
                case "funcion":
                    if (isset($aParametros[2])) {
                        $campo = call_user_func($aParametros[1], $lerroa[$aParametros[2]]);
                    } else {
                        $campo = call_user_func($aParametros[1], $lerroa);
                    }
                    break;
                default:
                    $campo = $lerroa[$aParametros[0]];
            }
            // -------- segundo, calcular su representación ------------
            $aParametros = explode(" ", $oCelda["tipo"]);
            $formato = $aParametros[0];
            switch ($formato) {
                /* Los parametros pueden ser:
                 			- el nombre del campo
                 			- una función que se denotara funcion NombreFuncion [Campo]
                 			- una lista campo cadenalista
                 		*/
                case "adjunto":
                case "url":
                    $cTempBase = isset($aParametros[1]) ? $aParametros[1] : "";
                    $visualizar = "<a href='{$cTempBase}/{$campo}'>" . corta($campo, 25) . "</a>";
                    break;
                case "lista":
                    if (isset($aParametros[1])) {
                        $visualizar .= mlista($aParametros[1], $campo);
                    } else {
                        $visualizar .= $campo;
                    }
                    break;
                case "sino":
                    $idiomas = $hizkuntza == "es" ? array("No", "Si") : array("Ez", "Bai");
                    $visualizar = $idiomas[$campo];
                    break;
                case "si":
                    $idiomas = $hizkuntza == "es" ? array("", "Si") : array("", "Bai");
                    $visualizar = $idiomas[$campo];
                    break;
                case "no":
                    $idiomas = $hizkuntza == "es" ? array("No", "") : array("Ez", "");
                    $visualizar = $idiomas[$campo];
                    break;
                case "funcion":
                    $visualizar = call_user_func($aParametros[1], isset($aParametros[2]) ? $campo : $lerroa);
                    break;
                default:
                    $visualizar = $campo;
            }
            $class = isset($oCelda["class"]) ? $oCelda["class"] : $formato;
            if (isset($oCelda["styling"])) {
                $cResul .= "<td class='{$class}'>" . call_user_func($oCelda["styling"], $visualizar) . "</td>";
            } else {
                $cResul .= "<td class='{$class}'>{$visualizar}</td>";
            }
        }
        /* ahorita dibujamos las opciones */
        if ($lHayOpciones) {
            $cResul .= "<td class='opciones'>";
            foreach ($aOpciones as $aOpcion) {
                if (is_array($aOpcion)) {
                    $cResul .= strtr($aOpcion["enlace"], array("%ID%" => $lerroa[$aOpcion["ID"]])) . " ";
                } else {
                    $cResul .= sprintf($aOpcion, $lerroa[0]);
                }
            }
            $cResul .= "</td>";
        }
        $cResul .= "</tr>";
        $lPar = !$lPar;
    }
    $cResul .= "</tbody>\n";
    $cResul .= "</table>\n";
    mysql_free_result($rsEmaitza);
    return $cResul;
}
コード例 #3
0
    //}
    $mysqlUptime = round(preg_replace('/.*' . preg_quote("Uptime: ") . '([0-9\\.]+).*/', "\\1", $mysqlStat), 2);
    $upDays = floor($mysqlUptime / 60 / 60 / 24);
    $upHours = floor($mysqlUptime / 60 / 60) % 24;
    $upMinutes = $mysqlUptime / 60 % 60;
    echo " <br /> " . sprintf(_PAGE_GENERATED, $generationTime) . ", MySQL: " . $queriesPerSecond . " queries/sec, " . "uptime " . $upDays . "d " . $upHours . "h " . $upMinutes . "m. &middot; Server load: {$loadavg}";
    //Testing area for new advert
    //echo '<div class="mar_top"><a href="/helpdesk/faq/general/sitesupport/">'.getIMG( url()."images/support.gif" ).'</a></div>';
}
//	Spy Versus Spy Banner
//	echo '<div class="mar_top"><a href="http://www.y-gallery.net/donate.html">'.getIMG( url()."images/spyvsspyban.gif" ).'</a></div>';
//	Teahouse Comic Banner
//	echo '<div class="mar_top"><a href="http://www.teahousecomic.com/">'.getIMG( url()."images/teahouse-banner3.gif" ).'</a></div>';
global $isSearchBot;
if (!$_isSearchBot) {
    sql_order("RAND()");
    sql_where(array("banUntil>!" => "NOW()", "banType" => "banner"));
    if ($banid = sql_value("banners", "banid")) {
        ?>
			<div class="mar_top">
			<a href="<?php 
        echo url("banner/goto/" . $banid);
        ?>
"><img alt="" src="/images/banners/<?php 
        echo $banid;
        ?>
.gif" /></a>

				<div style="font-size : 9px; margin : 0.2em;"><a href="<?php 
        echo url("helpdesk/faq/general/advert");
        ?>
コード例 #4
0
    function putTagList($title, $order)
    {
        ?>
		<div style="margin-left : 2em;">
			<?php 
        echo $title;
        ?>
:
		</div>
		<ul style="margin : 0.3em 1.2em; padding : 0; padding-left : 2em;">
		<?php 
        sql_order($order);
        sql_where(array("hftCount>" => 0));
        $tagResult = sql_rowset("helpdeskFAQTags");
        while ($tagData = sql_next($tagResult)) {
            $url = url("helpdesk/faq/tag", array("tag" => $tagData["hftName"]));
            ?>
<li><a href="<?php 
            echo $url;
            ?>
"><?php 
            echo $tagData["hftName"];
            ?>
</a> (<?php 
            echo $tagData["hftCount"];
            ?>
)</li><?php 
        }
        sql_free($tagResult);
        ?>
		</ul>
		<?php 
    }
コード例 #5
0
ファイル: datadriven.php プロジェクト: phyluis/librerias-php
/**
 * Consulta de varios registros en forma tabular 
 * @param $aCampos   definiciones DD
 * @param $cSQL      consulta SQL sin LIMIT
 * @param $aOpciones menu para cada registro 
 */
function ddlib_consulta($aCampos, $cSQL, $aOpciones = "")
{
    /*
       $aCampos array de campos
         campos
            acceso
            cabecera
            order
            campo
            tipo
            formato ( si no existe, se usa tipo ).
            styling
       $cSQL
         una SQL completa, o desde FROM, o nombre  de la tabla
       $apciones
         titulo
         tituloSinHTML
         menu
         opciones (array o string), 
         		requiere opcionesId
         		opcional opcionesSeparador
         queryString
         paginacion
         registrosPorPagina 20
         paginas 10.
         tablaClase
         tablaID
         order   $aEstado["order"]
         orderby  $aEstado["orderby"]
    */
    // titulo
    $cResul = "";
    if (isset($aOpciones["titulo"])) {
        $cResul .= $aOpciones["tituloSinHTML"] == true ? $aOpciones["titulo"] : "<h2><span>{$aOpciones[titulo]}</span></h2>\n";
    }
    // incluir el menu de Opciones
    if (isset($aOpciones["menu"])) {
        $aMenu = $aOpciones["menu"];
        if (is_array($aMenu)) {
            foreach ($aMenu as $unaOpcion) {
                $lista .= "<li>{$unaOpcion}</li>\n";
            }
        } else {
            $lista .= "<li>{$aMenu}</li>\n";
        }
        $cResul .= "<div class='menuConsulta'>\n<ul>\n{$lista}</ul></div>";
    }
    // queryString
    $querystring = por_defecto($aOpciones["querystring"], $_SERVER["QUERY_STRING"]);
    // Calcular cabecera las cabecera de la tabla
    $lHayOpciones = isset($aOpciones["opciones"]);
    // Ordenar los campos
    global $aEstado;
    $order = isset($_REQUEST["order"]) ? $aEstado["order"] : por_defecto($aOpciones["order"], 0);
    $orderby = por_defecto($aEstado["orderby"], $aOpciones["orderby"], "ASC");
    // completar SELECT
    if (stripos($cSQL, "SELECT ") !== 0) {
        foreach ($aCampos as $dd) {
            if (isset($dd["campo"])) {
                if (preg_match("/^(funcion |serializ[ea]|tcampo |funcionget)/i", $dd["campo"])) {
                    $campos = array("*");
                    break;
                } else {
                    $campos[] = $dd["campo"];
                }
            } elseif (isset($dd["campos"])) {
                $campos = array_merge($campos, $dd["campos"]);
            }
        }
        $cSQL = "SELECT " . implode(",", $campos) . (stripos($cSQL, "FROM ") === 0 ? " " . $cSQL : " FROM {$cSQL}");
    }
    if (stripos($cSQL, "order by")) {
        // NO PUEDE SER cero
        //if (preg_match ("#order by (.*)( LIMIT)?#uim", $cSQL, $aTemp )) Esta seria la buena
        if (preg_match("#order by ([^ ,]*)#uim", $cSQL, $aTemp)) {
            $leyenda = $aTemp[1];
        }
    } elseif (isset($aCampos[$order]["order"])) {
        $cTempOrder = $aCampos[$order]["order"];
        if ($cTempOrder == 1) {
            $cTempOrder = $aCampos[$order]["campo"];
        }
        $cSQL .= sql_order($cTempOrder, $orderby == "ASC" ? " ASC" : " DESC");
        $leyenda = $cTempOrder;
        // @TODO ordenes de varios campos
    }
    // Paginación.
    if (!isset($aOpciones['paginacion']) || !$aOpciones['paginacion']) {
        $pags = por_defecto($aOpciones["paginas"], 10);
        $regs = por_defecto($aOpciones["registrosPorPagina"], 20);
        $aPaginacion = paginacion($cSQL, $leyenda, $regs, $pags, tIdiomaLocale("paginacion"));
    } else {
        $aPaginacion = array("", "", $cSQL, "");
    }
    // calcular la cabecera (pie incluido ) y luego el cuerpo.
    $atributosTabla = "class='" . por_defecto($aOpciones["tablaClase"], "consulta") . "'";
    if (isset($aOpciones["tablaID"])) {
        $atributosTabla .= " id='{$aOpciones[tablaID]}";
    }
    $cResul .= "\n<table {$atributosTabla}>\n";
    $cResul .= _ddlib_consulta_cabecera($aCampos, $querystring, $lHayOpciones, $aPaginacion[3], $order, $orderby);
    $cResul .= _ddlib_consulta_cuerpo($aCampos, $aPaginacion[2], $aOpciones);
    $cResul .= "\n</table>\n";
    return $cResul;
}
コード例 #6
0
ファイル: p_helpdesk.php プロジェクト: brocococonut/yGallery
function putRequestData($hlpData, $showDetails = false)
{
    global $_auth;
    ?>
	<div class="container2 mar_bottom">
		<div style="margin-left : 20px;">
			<div style="margin-left : -20px; margin-top : 0.4em; float : left;">
				<?php 
    echo getIMG(url() . "images/emoticons/star.png");
    ?>
			</div>
			<?php 
    if ($hlpData["hlpReferenceType"] == "submission") {
        ?>
				<div style="float : right; margin-left : 1em; margin-bottom : 0.5em;">
					<?php 
        echo getObjectThumb($hlpData["hlpReferenceId"], 100, false);
        ?>
				</div>
				<?php 
    }
    if ($hlpData["hlpReferenceType"] == "extras") {
        ?>
				<div style="float : right; margin-left : 1em; margin-bottom : 0.5em;">
					<?php 
        echo getObjectThumb($hlpData["hlpReferenceId"], 100, true);
        ?>
				</div>
				<?php 
    }
    ?>
			<div class="header" style="padding : 0; padding-bottom : 0.3em;">
				<a href="<?php 
    echo url("helpdesk/details/" . $hlpData["hlpid"]);
    ?>
">
					<?php 
    echo getRequestCategoryText($hlpData["hlpCategory"]);
    ?>
</a>
			</div>
			<?php 
    $ref = getRequestRefText($hlpData["hlpReferenceType"], $hlpData["hlpReferenceId"]);
    if ($ref != "--") {
        ?>
				<div>
					<b>In reference to</b>: <?php 
        echo $ref;
        ?>
				</div>
				<?php 
    }
    ?>
			<div>
				<b>Status</b>:
				<?php 
    echo getRequestStatusText($hlpData["hlpStatus"]);
    ?>
			</div>
			<div>
				<b>Urgency</b>:
				<?php 
    echo getRequestUrgencyText($hlpData["hlpUrgency"]);
    ?>
			</div>
			<?php 
    $hasOwner = $hlpData["hlpOwner"] > 0;
    $isStaff = atLeastModerator();
    $isSubmitter = isLoggedIn() && $_auth["useid"] == $hlpData["hlpSubmitter"];
    $isOwner = isLoggedIn() && $_auth["useid"] == $hlpData["hlpOwner"];
    if ($isOwner && $hlpData["hlpStatus"] == "wait-assign") {
        ?>
				<div class="mar_top">
					<span class="error">Summary will be available after the request is assigned.</span>
				</div>
				<?php 
    } else {
        ?>
				<div class="mar_top">
					<?php 
        echo formatText($hlpData["hlpSummary"], true, true);
        ?>
				</div>
				<?php 
    }
    $allowedPrivacy = "'all'";
    if ($isStaff) {
        $allowedPrivacy .= ",'private','submitter','owner'";
    } else {
        if ($isSubmitter) {
            $allowedPrivacy .= ",'submitter'";
        }
        if ($isOwner) {
            $allowedPrivacy .= ",'owner'";
        }
    }
    if ($showDetails) {
        ?>
				<div style="clear : both;"></div>
				<?php 
        sql_order("hddSubmitDate");
        sql_where(array("hddItem" => $hlpData["hlpid"], "|1" => "`hddPrivacy` IN(" . $allowedPrivacy . ")"));
        $hddResult = sql_rowset("helpdeskDetails");
        while ($hddData = sql_next($hddResult)) {
            putRequestDetail($hlpData, $hddData);
        }
        sql_free($hddResult);
        $doSubmitDetail = false;
        $detailPrivacy = "?";
        if (isset($_POST["submitPrivate"])) {
            $doSubmitDetail = true;
            $detailPrivacy = "private";
        }
        if (isset($_POST["submitSubmitter"])) {
            $doSubmitDetail = true;
            $detailPrivacy = "submitter";
        }
        if (isset($_POST["submitOwner"])) {
            $doSubmitDetail = true;
            $detailPrivacy = "owner";
        }
        if (isset($_POST["submitAll"])) {
            $doSubmitDetail = true;
            $detailPrivacy = "all";
        }
        if ($doSubmitDetail) {
            addRequestDetail($hlpData["hlpid"], "detailText", "detailFile", $detailPrivacy);
            redirect(url("."));
        }
        if ($hlpData["hlpStatus"] == "completed") {
            ?>
					<span class="error"><b>COMPLETED</b></span>.
					This request's status is 'completed', no further details are accepted.
					<?php 
        } else {
            ?>
					<div class="container2 mar_bottom">
						<div class="header" style="padding-left : 0; padding-top : 0;">
							Submit new detail
						</div>
						<form action="<?php 
            echo url(".");
            ?>
" enctype="multipart/form-data" method="post">
							<div class="mar_bottom">
								<textarea name="detailText" rows="9" style="width : 95%;"></textarea>
							</div>
							<div class="mar_bottom" style="padding-right : 10%">
								(optionally) <b>Upload a file</b>:
							</div>
							<div class="mar_bottom">
								<input name="detailFile" type="file" size="30" />
							</div>
							<?php 
            if ($isSubmitter && !$hasOwner) {
                // A simple submit button.
                ?>
								<div class="mar_top">
									<input type="submit" name="submitSubmitter" value="<?php 
                echo _SUBMIT;
                ?>
" />
								</div>
								<?php 
            } else {
                ?>
								<div class="mar_top">
									Who should be able to read this detail:
								</div>
								<?php 
                if ($hasOwner) {
                    ?>
									<div class="mar_top">
										<button name="submitAll">
											<?php 
                    echo getRequestPrivacyText("all", $hlpData);
                    ?>
</button>
									</div>
									<?php 
                    if (!$isSubmitter) {
                        ?>
										<div class="mar_top">
											<button name="submitOwner">
												<?php 
                        echo getRequestPrivacyText("owner", $hlpData);
                        ?>
</button>
										</div>
										<?php 
                    }
                }
                ?>
								<div class="mar_top">
									<button name="submitSubmitter">
										<?php 
                echo getRequestPrivacyText("submitter", $hlpData);
                ?>
</button>
								</div>
								<?php 
                if ($isStaff) {
                    // Only staff can submit staff-only details :3
                    ?>
									<div class="mar_top">
										<button name="submitPrivate">
											<?php 
                    echo getRequestPrivacyText("private", $hlpData);
                    ?>
</button>
									</div>
									<?php 
                }
                ?>
								<div class="mar_top">
									* <b>Submitter</b> &mdash; The user that made the request.
									<?php 
                if ($hasOwner) {
                    ?>
										<br />
										* <b>Owner</b> &mdash; The user that owns the object questioned by the request.
										<?php 
                }
                ?>
								</div>
								<?php 
            }
            ?>
						</form>
					</div>
					<?php 
        }
    } else {
        sql_where(array("hddItem" => $hlpData["hlpid"], "|1" => "`hddPrivacy` IN(" . $allowedPrivacy . ")"));
        $detailCount = sql_count("helpdeskDetails");
        ?>
				<div style="text-align : left; margin-top : 0.6em;">
					<a href="<?php 
        echo url("helpdesk/details/" . $hlpData["hlpid"]);
        ?>
">
						View Request Details</a>
						(<?php 
        echo $detailCount;
        ?>
)
				</div>
				<div style="clear : both;"></div>
				<?php 
    }
    ?>
		</div>
	</div>
	<?php 
}
コード例 #7
0
		<label for="idArticleIdent">Short:</label>
		<input name="ident" type="text" id="idArticleIdent" size="10" value="<?php 
echo htmlspecialchars($editArticleIdent);
?>
" />
		<div class="mar_top">
			<textarea name="article" cols="70" rows="15"><?php 
echo htmlspecialchars($editArticleText);
?>
</textarea>
		</div>
		<div class="mar_top">
			Category:
			<select name="category">
				<?php 
sql_order("hfcName");
$editCatResult = sql_rowset("helpdeskFAQCats");
while ($editCatData = sql_next($editCatResult)) {
    ?>
<option<?php 
    echo $editCatData["hfcid"] == $editCategory ? ' selected="selected"' : '';
    ?>
						value="<?php 
    echo $editCatData["hfcid"];
    ?>
"><?php 
    echo htmlspecialchars(preg_replace('/^.*\\|/', "", $editCatData["hfcName"]));
    ?>
</option><?php 
}
sql_free($editCatResult);
コード例 #8
0
			<form action="<?php 
    echo url("helpdesk/faq");
    ?>
" method="get">
			<button class="smalltext">
				<?php 
    echo getIMG(url() . "images/emoticons/nav-prev.png");
    ?>
				Return to FAQ
			</button>
			</form>
		</div>
		<div style="margin-left : 0.7em;">
			Tags:
			<?php 
    sql_order("hfmid");
    sql_where(array("hfmArticle" => $faqData["hfqid"], "hfmTag*" => "hftid"));
    $tags = array();
    $tagResult = sql_rowset("helpdeskFAQTagMap, helpdeskFAQTags");
    while ($tagData = sql_next($tagResult)) {
        if (count($tags) > 0) {
            echo ", ";
        }
        $url = url("helpdesk/faq/tag", array("tag" => $tagData["hftName"]));
        ?>
<a href="<?php 
        echo $url;
        ?>
"><?php 
        echo $tagData["hftName"];
        ?>