Esempio n. 1
0
function photoplog_list_upload_fields($catid)
{
    global $vbulletin, $vbphrase;
    $catid = intval($catid);
    if ($catid != -1 && !photoplog_check_category($catid)) {
        print_stop_message('generic_error_x', $vbphrase['photoplog_bad_category']);
    }
    $photoplog_fields = $vbulletin->db->query_read("SELECT f1.inherited AS inherited1,\r\n\t\tf1.fieldid AS fieldid1, f1.groupid as groupid1, f1.displayorder AS displayorder1,\r\n\t\tf1.protected AS protected1, f1.parentid AS parentid1,\r\n\t\tf1.info AS info1 ,f2.info AS info2\r\n\t\tFROM " . PHOTOPLOG_PREFIX . "photoplog_customfields AS f1\r\n\t\tLEFT JOIN " . PHOTOPLOG_PREFIX . "photoplog_customfields AS f2\r\n\t\tON (f1.parentid = f2.catid AND f1.groupid = f2.groupid)\r\n\t\tWHERE f1.catid = " . intval($catid) . "\r\n\t\tORDER BY f1.displayorder ASC\r\n\t");
    print_form_header('photoplog_field', 'displayorder');
    construct_hidden_code('s', $vbulletin->session->vars['sessionhash']);
    construct_hidden_code('catid', $catid);
    $catname = $catid == -1 ? $vbphrase['photoplog_all_categories'] : photoplog_get_category_title($catid);
    print_table_header(htmlspecialchars_uni($catname), 3);
    if ($catid == -1) {
        print_description_row($vbphrase['photoplog_inherited_fields_cannot_be_modified_root'], 0, 3);
    } else {
        print_description_row($vbphrase['photoplog_inherited_fields_cannot_be_modified'], 0, 3);
    }
    print_cells_row(array($vbphrase['photoplog_field_title'], '<nobr>' . $vbphrase['photoplog_display_order'] . '</nobr>', $vbphrase['photoplog_controls']), 1, '', -1);
    while ($photoplog_field = $vbulletin->db->fetch_array($photoplog_fields)) {
        $photoplog_field['info'] = $photoplog_field['inherited1'] < 1 ? $photoplog_field['info1'] : $photoplog_field['info2'];
        // note: photoplog_field['info'] may be NULL
        $photoplog_field['info'] = empty($photoplog_field['info']) ? '' : unserialize($photoplog_field['info']);
        if (is_array($photoplog_field['info'])) {
            $photoplog_fieldid1 = $photoplog_field['fieldid1'];
            $photoplog_title1 = $photoplog_field['info']['title'];
            $photoplog_parentid1 = intval($photoplog_field['parentid1']);
            if ($photoplog_parentid1 == -2) {
                $photoplog_title1 = $vbphrase[$photoplog_title1];
            }
            $photoplog_protected1 = $photoplog_field['protected1'];
            $photoplog_edit_html = '' . $vbphrase['edit'] . '';
            $photoplog_delete_html = '' . $vbphrase['delete'] . '';
            $photoplog_title_link = htmlspecialchars_uni($photoplog_title1);
            if ($photoplog_protected1 == 0) {
                $photoplog_pre_ahref1 = "[<a href=\"photoplog_field.php?" . $vbulletin->session->vars['sessionurl'];
                $photoplog_pre_ahref2 = "<a href=\"photoplog_field.php?" . $vbulletin->session->vars['sessionurl'];
                $photoplog_post_ahref = "&amp;catid=" . intval($catid) . "&amp;fieldid=" . intval($photoplog_fieldid1) . "\">";
                $photoplog_edit_html = $photoplog_pre_ahref1 . "do=edit" . $photoplog_post_ahref . $photoplog_edit_html . "</a>]";
                $photoplog_delete_html = $photoplog_pre_ahref1 . "do=delete" . $photoplog_post_ahref . $photoplog_delete_html . "</a>]";
                $photoplog_title_link = $photoplog_pre_ahref2 . "do=edit" . $photoplog_post_ahref . $photoplog_title_link . "</a>";
            } else {
                $photoplog_edit_html = '[<del>' . $vbphrase['edit'] . '</del>]';
                $photoplog_delete_html = '[<del>' . $vbphrase['delete'] . '</del>]';
            }
            $bgclass = fetch_row_bgclass();
            if ($catid == -1) {
                echo "\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t<td class=\"{$bgclass}\" width=\"100%\">" . $photoplog_title_link . "</td>\r\n\t\t\t\t\t<td class=\"{$bgclass}\"><span class=\"smallfont\">" . $vbphrase['photoplog_na'] . "</span></td>\r\n\t\t\t\t\t<td class=\"{$bgclass}\"><nobr>" . $photoplog_edit_html . " " . $photoplog_delete_html . "</nobr></td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t";
            } else {
                echo "\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t<td class=\"{$bgclass}\" width=\"100%\">" . $photoplog_title_link . "</td>\r\n\t\t\t\t\t<td class=\"{$bgclass}\"><input type=\"text\" class=\"bginput\" name=\"displayorder[" . $photoplog_fieldid1 . "]\" value=\"" . $photoplog_field['displayorder1'] . "\" size=\"5\" /></td>\r\n\t\t\t\t\t<td class=\"{$bgclass}\"><nobr>" . $photoplog_edit_html . " " . $photoplog_delete_html . "</nobr></td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t";
            }
        }
    }
    $vbulletin->db->free_result($photoplog_fields);
    $photoplog_submit_button = $catid != -1 ? "<input type=\"submit\" class=\"button\" tabindex=\"1\" value=\"" . $vbphrase['save_display_order'] . "\" accesskey=\"s\" />" : "";
    print_table_footer(3, $photoplog_submit_button . construct_button_code($vbphrase['photoplog_add_new_field'], "photoplog_field.php?" . $vbulletin->session->vars['sessionurl'] . "do=add&amp;catid=" . intval($catid)) . construct_button_code($vbphrase['go_back'], "photoplog_field.php?" . $vbulletin->session->vars['sessionurl'] . "do=view"));
}
Esempio n. 2
0
 $photoplog_phrase_number = '';
 if ($photoplog_move_action) {
     $photoplog_phrase_action = $vbphrase['photoplog_move_files'];
     $photoplog_phrase_number = $vbphrase['photoplog_number_to_be_moved'];
 } else {
     $photoplog_phrase_action = $vbphrase['photoplog_delete_files'];
     $photoplog_phrase_number = $vbphrase['photoplog_number_to_be_deleted'];
 }
 $photoplog_abort = false;
 $photoplog_abort_message = '';
 $photoplog_check_category_source = $photoplog_source_category > 0 ? photoplog_check_category($photoplog_source_category) : true;
 if (!$photoplog_check_category_source) {
     photoplog_set_abort($vbphrase['photoplog_bad_source_category']);
 }
 // check destination category:  no selection == -1 ==> no change
 $photoplog_check_destination = $photoplog_destination_category >= 0 ? photoplog_check_category($photoplog_destination_category) : true;
 if (!$photoplog_check_destination && $photoplog_move_action) {
     photoplog_set_abort($vbphrase['photoplog_bad_destination_category']);
 }
 // select where conditions on fileuploads LEFT JOIN ratecomments
 $photoplog_where_conditions = array();
 $photoplog_multi_wheres = array();
 // add categories to the where condition
 $photoplog_source_list_categories = array();
 $photoplog_destination_list_categories = array();
 $photoplog_parent_list_categories = array();
 $photoplog_move_categories = true;
 if ($photoplog_destination_category < 0) {
     $photoplog_destination_category = $photoplog_source_category;
     $photoplog_move_categories = false;
     $photoplog_make_subcategories = 0;