Ejemplo n.º 1
0
// check $xoopsModule
if (!is_object($xoopsModule)) {
    redirect_header("{$mod_url}/", 1, _NOPERM);
}
echo "<h3 style='text-align:left;'>" . sprintf(_AM_H3_FMT_CATEGORIES, $xoopsModule->name()) . "</h3>\n";
if ($disp == "edit" && $cid > 0) {
    // Editing
    $sql = "SELECT cid,pid,title,imgurl FROM {$table_cat} WHERE cid='{$cid}'";
    $crs = $xoopsDB->query($sql);
    $cat_array = $xoopsDB->fetchArray($crs);
    display_edit_form($cat_array, _AM_CAT_MENU_EDIT, 'update');
} else {
    if ($disp == "new") {
        // New
        $cat_array = array('cid' => 0, 'pid' => $cid, 'title' => '', 'imgurl' => 'http://');
        display_edit_form($cat_array, _AM_CAT_MENU_NEW, 'insert');
    } else {
        // Listing
        $cat_tree_array = $cattree->getChildTreeArray(0, 'title');
        // Get ghost categories
        $live_cids = $cattree->getAllChildId(0);
        $whr_cid = "cid NOT IN (";
        foreach ($live_cids as $cid) {
            $whr_cid .= "{$cid},";
        }
        $whr_cid .= "0)";
        $rs = $xoopsDB->query("SELECT * FROM {$table_cat} WHERE {$whr_cid}");
        if ($xoopsDB->fetchArray($rs) != false) {
            $xoopsDB->queryF("UPDATE {$table_cat} SET pid='0' WHERE {$whr_cid}");
            redirect_header('index.php', 0, 'A Ghost Category found.');
            exit;
Ejemplo n.º 2
0
 if ($disp == "new") {
     // 更新時と同じ形のオブジェクトを用意
     class Dummy
     {
         var $cid = 0;
         var $pid = 0;
         var $cat_title = '';
         var $cat_desc = '';
         var $weight = 0;
         var $ismenuitem = 0;
         var $udtstamp = 0;
     }
     $cat = new Dummy();
     $cat->pid = $cid;
     $cat->udtstamp = time();
     display_edit_form($cat, _AM_MENU_CAT_NEW, 'insert');
 } else {
     echo "<h4>" . _AM_MENU_CATEGORIES . "</h4>\n";
     if (!empty($_GET['mes'])) {
         echo "<p><font color='blue'>" . htmlspecialchars($_GET['mes'], ENT_QUOTES) . "</font></p>";
     }
     echo "<p><a href='?disp=new&cid=0'>" . _AM_MB_MAKETOPCAT . "<img src='../images/cat_add.gif' width='18' height='15' alt='' /></a></p>\n";
     // カテゴリーデータ取得
     $cat_tree_array = $cattree->getChildTreeArray(0, 'weight ASC,cat_title');
     // TH Part
     echo "\n\t<form name='MainForm' action='' method='post' style='margin:10px;'>\n\t" . $xoopsGTicket->getTicketHtml(__LINE__) . "\n\t<input type='hidden' name='delcat' value='' />\n\t<table width='75%' class='outer' cellpadding='4' cellspacing='1'>\n\t  <tr valign='middle'>\n\t    <th>" . _AM_CAT_TH_TITLE . "</th>\n\t    <th>" . _AM_CAT_TH_OPERATION . "</th>\n\t    <th>" . _AM_CAT_TH_ENABLED . "</th>\n\t    <th>" . _AM_CAT_TH_WEIGHT . "</th>\n\t  </tr>\n\t";
     // リスト出力部
     $oddeven = 'odd';
     foreach ($cat_tree_array as $cat_node) {
         $oddeven = $oddeven == 'odd' ? 'even' : 'odd';
         extract($cat_node);
Ejemplo n.º 3
0
        $save_op = 'update';
        $save_button = 'Update';
    } else {
        echo "\n<h3>New Attribute type</h3>";
        $save_op = 'insert';
        $save_button = 'Insert';
    }
    if (is_not_empty_array($errors)) {
        echo format_error_block($errors);
    }
    echo "\n<form name=\"s_attribute_type\" action=\"{$PHP_SELF}\" method=\"POST\">";
    echo "\n<input type=\"hidden\" name=\"type\" value=\"" . $HTTP_VARS['type'] . "\">";
    echo "\n<input type=\"hidden\" name=\"op\" value=\"{$save_op}\">";
    echo "\n<input type=\"hidden\" name=\"active_tab\" value=\"" . $HTTP_VARS['active_tab'] . "\">";
    echo "\n<table>";
    display_edit_form($attribute_type_r, $HTTP_VARS);
    echo "\n</table>";
    echo format_help_block(array('img' => 'compulsory.gif', 'text' => get_opendb_lang_var('compulsory_field'), id => 'compulsory'));
    if (get_opendb_config_var('widgets', 'enable_javascript_validation') !== FALSE) {
        echo "\n<input type=\"button\" class=\"button\" value=\"{$save_button}\" onclick=\"if(!checkForm(this.form)){return false;}else{this.form.submit();}\">";
    } else {
        echo "\n<input type=\"button\" class=\"button\" value=\"{$save_button}\" onclick=\"this.form.submit();\">";
    }
    echo "\n</form>";
} else {
    if ($HTTP_VARS['op'] == 'edit-lookups') {
        // ################################################################
        // Do for both 'update' and 'edit'
        // ################################################################
        echo "<p>[<a href=\"{$PHP_SELF}?type={$ADMIN_TYPE}&active_tab=" . $HTTP_VARS['active_tab'] . "\">Back to Main</a>]</p>";
        echo "<script language=\"JavaScript1.2\">\n\t\tfunction toggleChecked(element, name)\n\t\t{\n\t\t\tvar form = element.form;\n\n\t\t\t// then we have to uncheck everything else.\n\t\t\tfor (var i=0; i < form.length; i++)\n\t\t\t{\n\t\t        if (form.elements[i].type.toLowerCase() == 'checkbox' && form.elements[i].name.substring(0, name.length+1) == name+'[')\n\t\t\t\t{\n\t\t\t\t\tif(element.checked && form.elements[i].name != element.name)\n\t\t                form.elements[i].checked = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}</script>";
Ejemplo n.º 4
0
function protect_change_folder($vars)
{
    global $db;
    $err = array();
    /// first delete protection from the folder
    $fl = get_folders();
    $folder = $fl[$vars['folder_id']];
    if (!$folder) {
        die("Folder not found: {$vars['folder_id']}");
    }
    if (is_dir($folder['path'])) {
        $errs = 0;
        foreach ($folder['files_content'] as $fname => $content) {
            $f = "{$folder['path']}/{$fname}";
            if (!is_file($f)) {
                continue;
            }
            $res = unlink($f);
            if (!$res) {
                $errs++;
                $err[] = "File {$f} couldn't be removed - please remove it manually";
            }
        }
    } else {
        print "Folder {$folder['path']} seems to be removed...skipping protection removing step<br />";
    }
    /////// now protect folder
    if ($errs) {
        display_edit_form($vars, $err);
        return;
    }
    $err = array();
    $func_name = "protect_{$vars[method]}";
    $files = array();
    $err = $func_name($vars, $files);
    if ($err) {
        display_edit_form($vars, (array) $err);
        return;
    }
    // save folder info now
    global $config, $db;
    $path = $db->escape($vars['path']);
    $url = $db->escape($vars['url']);
    $method = $db->escape($vars['method']);
    $product_ids = $vars['product_id_all'] ? 'ALL' : join(',', $vars['product_id']);
    $files = $db->escape(serialize($files));
    $db->query("UPDATE {$db->config[prefix]}folders\n    SET path = '{$path}', url = '{$url}', method = '{$method}',\n        product_ids = '{$product_ids}', files_content = '{$files}'\n    WHERE folder_id={$vars['folder_id']}\n    ");
    if ($GLOBALS['protection_is_instruction']) {
    } else {
        admin_log("Folder protection changed ({$path}) - {$method}", "folders", $vars['folder_id']);
        admin_html_redirect("protect.php?added=ok", "Folder protected", "Folder has been protected successfully");
    }
    exit;
}
Ejemplo n.º 5
0
function do_page_content_edit_metadata($objid, $object_general, $object_rights, $object_lifecycle, $object_tech)
{
    ?>
<div class="container theme-showcase" role="main">

<div class="page-header">
  <p>Fill in your new metadata.</p>
</div>
  
<?php 
    display_edit_form($objid, $object_general, $object_rights, $object_lifecycle, $object_tech);
    ?>
     
</div>
<?php 
}
Ejemplo n.º 6
0
// check $xoopsModule
if (!is_object($xoopsModule)) {
    redirect_header("{$mod_url}/", 1, _NOPERM);
}
echo "<h3 style='text-align:left;'>" . sprintf(_MD_A_GNAVI_FMT_CATEGORIES, $xoopsModule->name()) . "</h3>\n";
if ($disp == "edit" && $cid > 0) {
    // Editing
    $sql = "SELECT cid,pid,title,imgurl,kmlurl,description,weight,lat,lng,zoom,mtype,icd FROM {$table_cat} WHERE cid='{$cid}'";
    $crs = $xoopsDB->query($sql);
    $cat_array = $xoopsDB->fetchArray($crs);
    display_edit_form($cat_array, _MD_A_GNAVI_CAT_MENU_EDIT, 'update');
} else {
    if ($disp == "new") {
        // New
        $cat_array = array('cid' => 0, 'pid' => $cid, 'title' => '', 'imgurl' => 'http://', 'kmlurl' => 'http://', 'description' => '', 'weight' => 0, 'lat' => 0, 'lng' => 0, 'zoom' => 0, 'mtype' => '', 'icd' => 0);
        display_edit_form($cat_array, _MD_A_GNAVI_CAT_MENU_NEW, 'insert');
    } else {
        // Listing
        $cat_tree_array = $cattree->getChildTreeArray(0, 'weight,title');
        // Get ghost categories
        $live_cids = $cattree->getAllChildId(0);
        $whr_cid = "cid NOT IN (";
        foreach ($live_cids as $cid) {
            $whr_cid .= "{$cid},";
        }
        $whr_cid .= "0)";
        $rs = $xoopsDB->query("SELECT * FROM {$table_cat} WHERE {$whr_cid}");
        if ($xoopsDB->fetchArray($rs) != false) {
            $xoopsDB->queryF("UPDATE {$table_cat} SET pid='0' WHERE {$whr_cid}");
            redirect_header('index.php?page=category', 0, 'A Ghost Category found.');
            exit;
function delete_guest()
{
    global $db, $t, $vars;
    if (!$vars['confirm']) {
        $g = $db->get_guest($vars['guest_id']);
        display_confirm("Delete newsletter: {$g['guest_name']}", "\n        <center>Do you really want to delete guest: {$g['guest_name']}?\n        </center>\n        ");
        return;
    } elseif ($vars['confirm'] != 'Yes') {
        display_edit_form();
        return;
    }
    $g = $db->get_guest($vars['guest_id']);
    $db->delete_guest($vars['guest_id']);
    $db->delete_guest_threads($vars['guest_id']);
    $t->assign('msg', "Guest deleted");
    $t->assign('link', 'newsletter_guests.php');
    $t->display("admin/newsletter_guest_saved.html");
}
Ejemplo n.º 8
0
            if (!$fav->move(@$_GET['id'], @$_GET['order'])) {
                html_error_quit($fav->err);
            }
            break;
        case 'choose':
            $fav->load_all_dirs();
            $form = 2;
            break;
        default:
    }
    $fav->load($pid);
}
display_super_fav($fav);
switch ($form) {
    case 1:
        display_edit_form($fav, $editArr);
        break;
    case 2:
        display_add_form($fav, true);
        break;
    default:
        display_add_form($fav, false);
}
unset($fav);
page_footer();
function display_super_fav($fav)
{
    ?>
<table class="main adj">
<caption>我的百宝箱</caption>
<col class="center"/><col class="center"/><col/><col class="center"/>
Ejemplo n.º 9
0
        echo "\n<h3>Edit Status Type</h3>";
        $save_op = 'update';
        $save_button = 'Update';
    } else {
        echo "\n<h3>New Status Type</h3>";
        $save_op = 'insert';
        $save_button = 'Insert';
    }
    if (is_not_empty_array($errors)) {
        echo format_error_block($errors);
    }
    echo "\n<form name=\"s_status_type\" action=\"{$PHP_SELF}\" method=\"POST\">";
    echo "\n<input type=\"hidden\" name=\"op\" value=\"{$save_op}\">";
    echo "\n<input type=\"hidden\" name=\"type\" value=\"" . $HTTP_VARS['type'] . "\">";
    echo "\n<table>";
    display_edit_form($status_type_r, $HTTP_VARS);
    echo "\n</table>";
    echo format_help_block(array('img' => 'compulsory.gif', 'text' => get_opendb_lang_var('compulsory_field'), id => 'compulsory'));
    if (get_opendb_config_var('widgets', 'enable_javascript_validation') !== FALSE) {
        echo "\n<input type=\"button\" class=\"button\" value=\"{$save_button}\" onclick=\"if(!checkForm(this.form)){return false;}else{this.form.submit();}\">";
    } else {
        echo "\n<input type=\"button\" class=\"button\" value=\"{$save_button}\" onclick=\"this.form.submit();\">";
    }
    echo "\n</form>";
} else {
    if (strlen($HTTP_VARS['op']) == 0) {
        echo "<p>[<a href=\"{$PHP_SELF}?type={$ADMIN_TYPE}&op=new\">New Status Type</a>]</p>";
        if (is_not_empty_array($errors)) {
            echo format_error_block($errors);
        }
        $results = fetch_status_type_rs();
Ejemplo n.º 10
0
function edit_save()
{
    global $db, $t;
    global $member_additional_fields, $config;
    $vars = get_input_vars();
    $oldm = $db->get_user($vars['member_id']);
    $vars['email_verified'] = $oldm['email_verified'];
    $vars['security_code'] = $oldm['security_code'];
    $vars['securitycode_expire'] = $oldm['securitycode_expire'];
    $errors = array();
    if (strlen($vars['generate_login'])) {
        $vars['login'] = generate_login($vars);
    }
    if (strlen($vars['generate_pass'])) {
        $vars['pass'] = generate_password($vars);
    }
    if (!strlen($vars['login'])) {
        $errors[] = "'Login' is a required field";
    }
    if ($vars['pass'] == '' && $config['hide_password_cp']) {
        $vars['pass'] = $oldm['pass'];
    }
    if (!strlen($vars['pass'])) {
        $errors[] = "'Password' is a required field";
    }
    foreach ($member_additional_fields as $f) {
        $fname = $f['name'];
        if ($f['validate_func']) {
            foreach ((array) $f['validate_func'] as $func) {
                if (!function_exists($func)) {
                    fatal_error("Validation function '{$func}' for field: '{$fname}' not defined. Internal error");
                }
                if ($err = $func($vars[$fname], $f['title'], $f)) {
                    $errors[] = $err;
                }
            }
        }
    }
    foreach ($member_additional_fields as $f) {
        if ($f['sql']) {
            continue;
        }
        $fname = $f['name'];
        if (isset($vars[$fname])) {
            $vars['data'][$fname] = $vars[$fname];
        }
        unset($vars[$fname]);
    }
    if ($errors) {
        $t->assign('errors', $errors);
        return display_edit_form($vars);
    }
    // no subscriptions for updated user
    //$db->subscribe_member ($vars['member_id'], $vars['is_affiliate']);
    //
    $err = $db->update_user($vars['member_id'], $vars);
    $db->delete_member_threads($vars['member_id']);
    $db->add_member_threads($vars['member_id'], $vars['threads']);
    if ($err) {
        fatal_error("Cannot update user info: {$err}");
    }
    update_cc_info($vars['member_id'], $vars);
    admin_log("Member record changed ({$oldm['login']})", 'members', $vars['member_id']);
    if ($config['manually_approve']) {
        if ($oldm['data']['is_approved'] != $vars['data']['is_approved'] && $vars['data']['is_approved']) {
            check_for_signup_mail(0, $vars['member_id']);
        }
    }
    $t->assign('link', "users.php?member_id={$vars['member_id']}&action=edit");
    $t->display("admin/user_saved.html");
}
function delete_thread()
{
    global $db, $t, $vars;
    if (!$vars['confirm']) {
        $tr = $db->get_thread($vars['thread_id']);
        display_confirm("Delete thread: {$tr['thread_title']}", "\n        <center>Do you really want to delete newsletter thread: {$tr['thread_title']}?\n        </center>\n        ");
        return;
    } elseif ($vars['confirm'] != 'Yes') {
        display_edit_form();
        return;
    }
    $tr = $db->get_thread($vars['thread_id']);
    $db->delete_thread($vars['thread_id']);
    $t->assign('msg', "Thread deleted");
    $t->assign('link', 'newsletter_threads.php');
    $t->display("admin/newsletter_thread_saved.html");
}
Ejemplo n.º 12
0
     }
     $new_field = $old_field = get_field_from_saved($old_field);
     if ($vars['save']) {
         check_demo();
         $new_field = get_field_from_form($vars);
         if ($err = validate_edit_form($new_field, $old_field)) {
             $t->assign('error', $err);
         } elseif ($err = save_field($new_field, $old_field)) {
             $t->assign('error', $err);
         } else {
             admin_log("Additonal Field ({$new_field['name']}) changed");
             admin_html_redirect("fields.php", "Field info saved", "Field info saved to config");
             break;
         }
     }
     display_edit_form($new_field);
     break;
 case 'delete':
     check_demo();
     foreach ($ff as $f) {
         if ($f['name'] == $vars['name']) {
             $old_field = $f;
         }
     }
     $err = drop_field($old_field);
     if ($err) {
         fatal_error($err, 1);
     } else {
         admin_log("Additonal Field ({$old_field['name']}) deleted");
         admin_html_redirect("fields.php", "Field has been deleted", "Field has been deleted succesfully");
     }
Ejemplo n.º 13
0
// check $xoopsModule
if (!is_object($xoopsModule)) {
    redirect_header("{$mod_url}/", 1, _NOPERM);
}
echo "<h3 style='text-align:left;'>" . sprintf(_MD_A_GNAVI_FMT_ICONS, $xoopsModule->name()) . "</h3>\n";
if ($disp == "edit" && $icd > 0) {
    // Editing
    $sql = "SELECT * FROM {$table_icon} WHERE icd={$icd}";
    $crs = $xoopsDB->query($sql);
    $icons = $xoopsDB->fetchArray($crs);
    display_edit_form($icons, _MD_A_GNAVI_CAT_MENU_EDIT, 'update');
} else {
    if ($disp == "new") {
        // New
        $icons = array('icd' => 0, 'title' => '', 'ext' => '', 'shadow_ext' => '', 'Anchor_x' => 0, 'Anchor_y' => 0, 'infoWindowAnchor_x' => 0, 'infoWindowAnchor_y' => 0);
        display_edit_form($icons, _MD_A_GNAVI_CAT_MENU_NEW, 'insert');
    } else {
        // Top links
        echo "<p><a href='?page=icon&disp=new&icd=0'>" . _MD_A_GNAVI_CAT_LINK_MAKEICO . "</a></p>\n";
        // TH
        echo "\n\t<form name='MainForm' action='' method='post' style='margin:10px;'>\n\t" . $xoopsGTicket->getTicketHtml(__LINE__) . "\n\t<input type='hidden' name='delcat' value='' />\n\t<table width='75%' class='outer' cellpadding='4' cellspacing='1'>\n\t  <tr valign='middle'>\n\t    <th>" . _MD_A_GNAVI_ICO_LIST_NO . "</th>\n\t    <th>" . _MD_A_GNAVI_ICO_LIST_TITLE . "</th>\n\t    <th>" . _MD_A_GNAVI_ICO_LIST_ICON . "</th>\n\t    <th>" . _MD_A_GNAVI_ICO_LIST_SHADOW . "</th>\n\t    <th>" . _MD_A_GNAVI_ICO_LIST_ANCHOR . "</th>\n\t    <th>" . _MD_A_GNAVI_ICO_LIST_WINANC . "</th>\n\t    <th>" . _MD_A_GNAVI_ICO_LIST_EDIT . "</th>\n\t  </tr>\n\t";
        // TD
        $oddeven = 'odd';
        $sql = "SELECT * FROM {$table_icon} ORDER BY icd";
        $crs = $xoopsDB->query($sql);
        while ($icon = $xoopsDB->fetchArray($crs)) {
            $oddeven = $oddeven == 'odd' ? 'even' : 'odd';
            extract($icon);
            $del_confirm = 'confirm("' . sprintf(_MD_A_GNAVI_ICO_FMT_CATDELCONFIRM, $title) . '")';
            echo "\n\t  <tr>\n\t    <td class='{$oddeven}' style='vertical-align:middle;' align='center'>{$icd}</td>\n\t    <td class='{$oddeven}' style='vertical-align:middle;' align='center'>{$title}</td>\n\t    <td class='{$oddeven}' ><img src='{$icon_url}/{$icd}.{$ext}' align='middle' />&nbsp;&nbsp;({$x},{$y})</td>\n\t    <td class='{$oddeven}' ><img src='{$icon_url}/" . $icd . "_s.{$shadow_ext}' align='middle' />&nbsp;&nbsp;({$shadow_x},{$shadow_y})</td>\n\t    <td class='{$oddeven}' style='vertical-align:middle;' align='center'>{$Anchor_x},{$Anchor_y}</td>\n\t    <td class='{$oddeven}' style='vertical-align:middle;' align='center'>{$infoWindowAnchor_x},{$infoWindowAnchor_y}</td>\n\t    <td class='{$oddeven}' style='vertical-align:middle;' align='center'>\n\t      &nbsp;\n\t      [<a href='?page=icon&disp=edit&amp;icd={$icd}'>" . _MD_A_GNAVI_CAT_LINK_EDIT . "</a>]\n\t      &nbsp;\n\t      <input type='button' value='" . _DELETE . "' onclick='if({$del_confirm}){document.MainForm.delcat.value=\"{$icd}\"; submit();}' />\n\t    </td>\n\t  </tr>\n";
        }
function delete_newsletter()
{
    global $db, $t, $vars;
    if (!$vars['confirm']) {
        $nl = $db->get_newsletter($vars['archive_id']);
        display_confirm("Delete newsletter: {$nl['subject']}", "\n        <center>Do you really want to delete newsletter: {$nl['subject']}?\n        </center>\n        ");
        return;
    } elseif ($vars['confirm'] != 'Yes') {
        display_edit_form();
        return;
    }
    $db->delete_newsletter($vars['archive_id']);
    $t->assign('msg', "Newsletter deleted");
    $t->assign('link', 'newsletter_archive.php');
    $t->display("admin/newsletter_archive_saved.html");
}