Exemple #1
0
/**
 * Outputs all the external libraries;
 * Includes a widget to add more
 */
function formLibs()
{
    $output = '';
    $sql = sprintf("SELECT p.`id`,`unique`,`title`,GROUP_CONCAT(CONCAT(v.release,'~~~',v.url) ORDER BY v.release DESC SEPARATOR '%s') as `releases` " . "FROM `projects` AS p " . "LEFT JOIN `versions` AS v ON p.id = v.pid " . "WHERE `status` = 1 AND p.type = 'lib' " . "GROUP BY p.unique " . "ORDER BY p.unique ASC; ", SQL_SEPARATOR);
    $projects = mysql_query($sql);
    while ($p = mysql_fetch_assoc($projects)) {
        $releases = explode(SQL_SEPARATOR, $p['releases']);
        $latest = explode('~~~', $releases[0]);
        $output .= '
  				<label for="' . $p['unique'] . '-stable">
  					<input id="' . $p['unique'] . '-stable" type="checkbox" name="makefile[libs][' . $p['unique'] . ']" value="' . $latest[1] . '" /> <span class="title">' . $p['title'] . '</span>
  					<select id="' . $p['unique'] . '" name="makefile[libs][' . $p['unique'] . ']" disabled="disabled">
  					 <option value="' . $latest[1] . '">Latest (' . $latest[0] . ')</option>';
        array_shift($releases);
        foreach ($releases as $r) {
            $info = explode('~~~', $r);
            $output .= ' <option value="' . $info[1] . '">Use ' . $info[0] . '</option>';
        }
        $output .= '</select>';
        $output .= "\r\n\t\t\t\t" . '</label>' . "\r\n\t\t\t\t";
    }
    $output .= '<div class="libraries downloads">';
    $output .= formDownload('libraries', array('url' => '#url', 'unique' => 'library'));
    $output .= '</div>';
    $output .= formDownload('add');
    return $output;
}
Exemple #2
0
<?php

include '_lib.php';
// collect variables and validate if necessary
$ask = isset($_REQUEST['ask']) ? $_REQUEST['ask'] : FALSE;
$v = isset($_REQUEST['v']) && is_numeric($_REQUEST['v']) ? $_REQUEST['v'] : $version;
$output = '';
if ($ask) {
    switch ($ask) {
        case 'all':
            $output = formMakefile($v);
            break;
        case 'libraries':
            $output = formDownload('libraries', array('unique' => 'library'));
            break;
        case 'themes':
            $output = formDownload('themes', array('unique' => 'theme'));
            break;
        case 'modules':
            $output = formDownload('modules', array('unique' => 'module'));
            break;
        case 'includes':
            $output = formDownload('includes', array('unique' => 'include'));
            break;
        default:
            $output = 'ERROR :/';
            break;
    }
    print $output;
}