function search_form($search_id = false) { global $db, $dl_prefix, $user_prefix, $module_name, $CPG_SESS, $bgcolor3; $searchdata = $_POST; $return = ''; if ($search_id) { if (isset($CPG_SESS[$module_name]['search'][$search_id])) { $searchdata = $CPG_SESS[$module_name]['search'][$search_id]; $return .= '<div style="background-color: ' . $bgcolor3 . '; padding: 3px;">Editing criteria for search #' . $search_id . '; <a href="' . URL::index('&file=search') . '">start new search</a></div>'; } else { $return .= $this->show_error('Invalid or expired search session. Please start a new search below.'); } } $return .= '<form action="' . URL::index('&file=search') . '" method="post" enctype="multipart/form-data" accept-charset="utf-8"> <h3>Keywords</h3><input type="text" name="s_BASICSEARCH" size="53" value="' . (isset($searchdata['s_BASICSEARCH']) ? htmlprepare($searchdata['s_BASICSEARCH']) : '') . '" maxlength="255" /><br /><br /> <div style="float: left; width: 50%"><h3>Basic information</h3> <label class="ulog" for="s_cid">' . _CATEGORY . '</label> ' . DL_Cat::selectbox(isset($searchdata['s_cid']) ? intval($searchdata['s_cid']) : 0, 's_cid', 2) . '<br /> <label class="ulog" for="s_submitter">' . _DLP_SUBMITTEDBY . '</label> <input type="text" name="s_submitter" id="s_submitter" size="30" maxlength="255" value="' . (isset($searchdata['s_submitter']) ? htmlprepare($searchdata['s_submitter']) : '') . '" /><br /> <label class="ulog" for="s_name">' . _AUTHORNAME . '</label> <input type="text" name="s_name" id="s_name" size="30" maxlength="255" value="' . (isset($searchdata['s_name']) ? htmlprepare($searchdata['s_name']) : '') . '" /><br /> <label class="ulog" for="s_email">' . _AUTHOREMAIL . '</label> <input type="text" name="s_email" id="s_email" size="30" maxlength="255" value="' . (isset($searchdata['s_email']) ? htmlprepare($searchdata['s_email']) : '') . '" /><br /> <h3>Special options</h3> <label class="ulog" for="s_pick">' . _DLP_EDPICK . '</label> <input type="checkbox" name="s_pick" id="s_pick" value="1"' . (isset($searchdata['s_pick']) && $searchdata['s_pick'] == 1 ? ' checked="checked"' : '') . ' /> ' . _YES . '<br /> <label class="ulog" for="s_screenshot">Only downloads with screenshot(s)</label> <input type="checkbox" name="s_screenshot" id="s_screenshot" value="1"' . (isset($searchdata['s_screenshot']) && $searchdata['s_screenshot'] == 1 ? ' checked="checked"' : '') . ' /> ' . _YES . '<br /> <label class="ulog" for="s_date">Published in past</label> ' . select_option('s_date', isset($searchdata['s_date']) ? intval($searchdata['s_date']) : '', array('', 3, 7, 14, 30, 60, 90, 180, 365)) . ' days<br /> <label class="ulog" for="s_updated">Updated in past</label> ' . select_option('s_updated', isset($searchdata['s_updated']) ? intval($searchdata['s_updated']) : '', array('', 3, 7, 14, 30, 60, 90, 180, 365)) . ' days</div> <div style="float: right; width: 50%"><h3>Additional information</h3>'; $result = $db->sql_uquery("SELECT * FROM " . $dl_prefix . "_fields \n\t\t\tWHERE visible > 0 \n\t\t\tORDER BY title"); while ($field = $db->sql_fetchrow($result)) { $f_title = defined($field['title']) ? constant($field['title']) : $field['title']; $f_title = $field['visible'] == 2 ? '* ' . $f_title : $f_title; $return .= '<label class="ulog" for="s_' . $field['field'] . '">' . $f_title . '</label>'; if ($field['type'] == 1 || $field['type'] == 3) { $f_value = isset($searchdata['s_' . $field['field']]) ? intval($searchdata['s_' . $field['field']]) : 0; $return .= '<input type="checkbox" name="s_' . $field['field'] . '" id="s_' . $field['field'] . '" value="1"' . ($f_value == 1 ? ' checked="checked"' : '') . ' /> ' . _YES . '<br />'; } else { $f_value = isset($searchdata['s_' . $field['field']]) ? htmlprepare($searchdata['s_' . $field['field']]) : ''; $return .= '<input type="text" name="s_' . $field['field'] . '" id="s_' . $field['field'] . '" size="30" maxlength="' . $field['size'] . '" value="' . $f_value . '" /><br />'; } } $return .= '</div><br /><br /><input type="submit" name="search" value="' . _SEARCH . '" /></form>'; return $return; }
if (!can_admin($module_name)) { $d_queue = $db->sql_count($dl_prefix . '_downloads', "lid!='{$next_id}' AND active=2"); cpg_error('Your download has been queued for review by an administrator<br /><br />At this time, we have <strong>' . $d_queue . '</strong> other downloads awaiting approval', _TB_INFO, URL::index('&file=manage&s=1', true, true)); } DL_Cat::count_dl(); URL::redirect(URL::index('&file=details&id=' . $next_id)); } } } $cats = array(); DL_Cat::list_all($cats); if (count($cats) < 1) { cpg_error('There are no categories in which you can add a download'); } if (can_admin($module_name) || $dl_config['user_catparent']) { $selects = DL_Cat::selectbox($in['cat'], 'in[cat]', false); } else { $selects = '<select class="set" name="in[cat]" id="in[cat]"> <option selected="selected" label="none" value="none">select a category</option>'; foreach ($cats as $cat) { if ($cat['level'] == 1) { if ($selects != '') { $selects .= '</optgroup>'; } $selects .= '<optgroup label="' . $cat['crumb'] . '">'; } else { $selects .= '<option value="' . $cat['cid'] . '"' . (isset($_GET['c']) && $cat['cid'] == intval($_GET['c']) || $cat['cid'] == $in['cat'] ? ' selected="selected"' : '') . '>' . $cat['crumb'] . '</option>'; } } $selects .= '</optgroup></select>'; }