Esempio n. 1
0
while ($files[$c]) {
    $img = strtolower(substr(strrchr($files[$c], "."), 1, 3));
    if (!$img || !preg_match("/css|exe|gif|htm|jpg|js|php|png|txt|xml|zip/i", $img)) {
        $img = "def";
    }
    $size = eHelper::parseMemorySize(filesize(e_BASE . $path . "/" . $files[$c]));
    $gen = new convert();
    $filedate = e107::getDate()->convert_date(filemtime(e_BASE . $path . "/" . $files[$c]), "forum");
    $text .= "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class='center middle autocheck'>\n\t\t\t\t\t\t\t" . $frm->checkbox("selectedfile[{$c}]", 1, false, array('id' => false)) . "\n\t\t\t\t\t\t\t<input type='hidden' name='deleteconfirm[{$c}]' value='" . $path . $files[$c] . "' />\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<img class='icon' src='" . $imagedir . $img . ".png' alt='" . $files[$c] . "' />\n\t\t\t\t\t\t\t<a href='" . e_SELF . "?" . $path . $files[$c] . "'>" . $files[$c] . "</a>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td class='right'>" . $size . "</td>\n\t\t\t\t\t\t<td class='right'>" . $filedate . "</td>\n\t\t\t\t\t</tr>\n\t";
    $c++;
}
$text .= "\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t\t<div class='buttons-bar left'>\n\t\t\t\t" . $frm->admin_button('check_all', 'jstarget:selectedfile', 'action', LAN_CHECKALL, array('id' => false)) . "\n\t\t\t\t" . $frm->admin_button('uncheck_all', 'jstarget:selectedfile', 'action', LAN_UNCHECKALL, array('id' => false)) . "\n\t";
if ($pubfolder || e_QUERY == "") {
    require_once e_HANDLER . "file_class.php";
    $fl = new e_file();
    $dl_dirlist = $fl->get_dirs(e_DOWNLOAD);
    $movechoice = array();
    $movechoice[] = e_DOWNLOAD;
    foreach ($dl_dirlist as $dirs) {
        $movechoice[] = e_DOWNLOAD . $dirs . "/";
    }
    sort($movechoice);
    $movechoice[] = e_FILE . "downloadimages/";
    if (e_QUERY != str_replace("../", "", e_UPLOAD)) {
        $movechoice[] = e_UPLOAD;
    }
    if (e_QUERY != str_replace("../", "", e_FILE . "downloadthumbs/")) {
        $movechoice[] = e_FILE . "downloadthumbs/";
    }
    if (e_QUERY != str_replace("../", "", e_FILE . "misc/")) {
        $movechoice[] = e_FILE . "misc/";
Esempio n. 2
0
 function user_extended_edit($struct, $curval)
 {
     global $tp;
     if (trim($curval) == "" && $struct['user_extended_struct_default'] != "") {
         $curval = $struct['user_extended_struct_default'];
     }
     $choices = explode(",", $struct['user_extended_struct_values']);
     foreach ($choices as $k => $v) {
         $choices[$k] = str_replace("[E_COMMA]", ",", $choices[$k]);
     }
     $parms = explode("^,^", $struct['user_extended_struct_parms']);
     $include = preg_replace("/\n/", " ", $tp->toHtml($parms[0]));
     $regex = $tp->toText($parms[1]);
     $regexfail = $tp->toText($parms[2]);
     $fname = "ue[user_" . $struct['user_extended_struct_name'] . "]";
     if (strpos($include, 'class') === FALSE) {
         $include .= " class='tbox' ";
     }
     switch ($struct['user_extended_struct_type']) {
         case EUF_TEXT:
             //textbox
         //textbox
         case EUF_INTEGER:
             //integer
             $ret = "<input name='{$fname}' value='{$curval}' {$include} />";
             return $ret;
             break;
         case EUF_RADIO:
             //radio
             $ret = '';
             foreach ($choices as $choice) {
                 $choice = trim($choice);
                 $choice = deftrue($choice, $choice);
                 $chk = $curval == $choice ? " checked='checked' " : "";
                 $ret .= "<input {$include} type='radio' name='{$fname}' value='{$choice}' {$chk} /> {$choice}";
             }
             return $ret;
             break;
         case EUF_CHECKBOX:
             //checkboxes
             foreach ($choices as $choice) {
                 $choice = trim($choice);
                 if (strpos($choice, "|") !== FALSE) {
                     list($val, $label) = explode("|", $choice);
                 } else {
                     $val = $choice;
                     $label = $choice;
                 }
                 $label = deftrue($label, $label);
                 $chk = $curval == $val ? " checked='checked' " : "";
                 $ret .= "<input {$include} type='checkbox' name='{$fname}[]' value='{$val}' {$chk} /> {$label}<br />";
             }
             return $ret;
             break;
         case EUF_DROPDOWN:
             //dropdown
             $ret = "<select {$include} name='{$fname}'>\n";
             $ret .= "<option value=''>&nbsp;</option>\n";
             // ensures that the user chose it.
             foreach ($choices as $choice) {
                 $choice = trim($choice);
                 $choice = deftrue($choice, $choice);
                 $sel = $curval == $choice ? " selected='selected' " : "";
                 $ret .= "<option value='{$choice}' {$sel}>{$choice}</option>\n";
             }
             $ret .= "</select>\n";
             return $ret;
             break;
         case EUF_PREDEFINED:
             // predefined list, shown in dropdown
             $filename = e_ADMIN . 'sql/extended_' . trim($struct['user_extended_struct_values']) . '.php';
             if (!is_readable($filename)) {
                 return 'No file: ' . $filename;
             }
             require $filename;
             $list_name = $struct['user_extended_struct_values'] . '_list';
             $display_func = $struct['user_extended_struct_values'] . '_value';
             if (!function_exists($display_func)) {
                 $display_func = '';
             }
             $source_data = ${$list_name};
             $ret = "<select {$include} name='{$fname}'>\n";
             $ret .= "<option value=''>&nbsp;</option>\n";
             // ensures that the user chose it.
             foreach ($source_data as $v) {
                 $val = $v[0];
                 $choice = trim($v[1]);
                 if ($display_func) {
                     $choice = $display_func($val, $choice);
                 }
                 $sel = $curval == $val ? " selected='selected' " : "";
                 $ret .= "<option value='{$val}' {$sel}>{$choice}</option>\n";
             }
             $ret .= "</select>\n";
             return $ret;
             break;
         case EUF_DB_FIELD:
             //db_field
             global $sql;
             $order = $choices[3] ? "ORDER BY " . $tp->toDB($choices[3], true) : "";
             if ($sql->db_Select($tp->toDB($choices[0], true), $tp->toDB($choices[1], true) . "," . $tp->toDB($choices[2], true), "1 {$order}")) {
                 $choiceList = $sql->db_getList('ALL', FALSE);
                 $ret = "<select {$include} name='{$fname}'  >\n";
                 $ret .= "<option value=''>&nbsp;</option>\n";
                 // ensures that the user chose it.
                 foreach ($choiceList as $cArray) {
                     $cID = trim($cArray[$choices[1]]);
                     $cText = trim($cArray[$choices[2]]);
                     $sel = $curval == $cID ? " selected='selected' " : "";
                     $ret .= "<option value='{$cID}' {$sel}>{$cText}</option>\n";
                 }
                 $ret .= "</select>\n";
                 return $ret;
             } else {
                 return "";
             }
             break;
         case EUF_TEXTAREA:
             //textarea
             return "<textarea {$include} name='{$fname}' >{$curval}</textarea>";
             break;
         case EUF_DATE:
             //date
             return e107::getForm()->datepicker($fname, $curval, 'dateformat=yy-mm-dd');
             break;
         case EUF_LANGUAGE:
             // language
             require_once e_HANDLER . "file_class.php";
             $fl = new e_file();
             $lanlist = $fl->get_dirs(e_LANGUAGEDIR);
             sort($lanlist);
             $ret = "<select {$include} name='{$fname}'>\n";
             $ret .= "<option value=''>&nbsp;</option>\n";
             // ensures that the user chose it.
             foreach ($lanlist as $choice) {
                 $choice = trim($choice);
                 $sel = $curval == $choice || !USER && $choice == e_LANGUAGE ? " selected='selected' " : "";
                 $ret .= "<option value='{$choice}' {$sel}>{$choice}</option>\n";
             }
             $ret .= "</select>\n";
             break;
     }
     return $ret;
 }