Ejemplo n.º 1
0
             } else {
                 if ($s_field_type != 'ADDRESS' && $s_field_type != 'RATING' && is_exists_item_attribute_type(NULL, $HTTP_VARS['s_attribute_type'])) {
                     $errors[] = array('error' => 'Attribute type not deleted.', 'detail' => 'Attribute is linked to at least one system item type');
                     $HTTP_VARS['op'] = '';
                 } else {
                     if ($HTTP_VARS['confirmed'] == 'true') {
                         if (delete_s_attribute_type($HTTP_VARS['s_attribute_type'])) {
                             $HTTP_VARS['op'] = NULL;
                         } else {
                             $errors[] = array('error' => 'Attribute type not deleted.', 'detail' => db_error());
                             $HTTP_VARS['op'] = '';
                         }
                     } else {
                         if ($HTTP_VARS['confirmed'] != 'false') {
                             echo "\n<h3>Delete Attribute type</h3>";
                             echo get_op_confirm_form($PHP_SELF, "Are you sure you want to delete attribute type '" . $HTTP_VARS['s_attribute_type'] . "'?", array('type' => $ADMIN_TYPE, 'op' => 'delete', 's_attribute_type' => $HTTP_VARS['s_attribute_type'], 'active_tab' => $HTTP_VARS['active_tab']));
                         } else {
                             $HTTP_VARS['op'] = '';
                         }
                     }
                 }
             }
         }
     } else {
         $errors[] = array('error' => 'Attributes with \'S_\' prefix are reserved for internal use.');
         $HTTP_VARS['op'] = '';
     }
 } else {
     $errors[] = array('error' => 'Attribute type not deleted.', 'detail' => 'Attribute is referenced by one or more Item Types');
     $HTTP_VARS['op'] = '';
 }
Ejemplo n.º 2
0
             //if(!is_user_active($HTTP_VARS['user_id']))
             echo format_error_block(get_opendb_lang_var('operation_not_available'));
         }
         echo format_footer_links($footer_links_r);
         echo _theme_footer();
     } else {
         opendb_not_authorised_page(PERM_ADMIN_USER_PROFILE, $HTTP_VARS);
     }
 } else {
     if ($HTTP_VARS['op'] == 'delete') {
         if (is_user_granted_permission(PERM_ADMIN_USER_PROFILE)) {
             echo _theme_header(get_opendb_lang_var('delete_user'));
             echo "<h2>" . get_opendb_lang_var('delete_user') . "</h2>";
             $return_val = handle_user_delete($HTTP_VARS['user_id'], $HTTP_VARS, $errors);
             if ($return_val === '__CONFIRM__') {
                 echo get_op_confirm_form($PHP_SELF, get_opendb_lang_var('confirm_user_delete', array('fullname' => fetch_user_name($HTTP_VARS['user_id']), 'user_id' => $HTTP_VARS['user_id'])), $HTTP_VARS);
             } else {
                 if ($return_val === '__ABORTED__') {
                     echo "<p class=\"success\">" . get_opendb_lang_var('user_not_deleted') . "</p>";
                     $footer_links_r[] = array(url => "{$PHP_SELF}?op=edit&user_id=" . $HTTP_VARS['user_id'], text => $HTTP_VARS['user_id'] == get_opendb_session_var('user_id') ? get_opendb_lang_var('edit_my_info') : get_opendb_lang_var('edit_user_info'));
                 } else {
                     if ($return_val === TRUE) {
                         echo "<p class=\"success\">" . get_opendb_lang_var('user_deleted') . "</p>";
                     } else {
                         //if($return_val === FALSE)
                         echo format_error_block($errors);
                     }
                 }
             }
             echo format_footer_links($footer_links_r);
             echo _theme_footer();
Ejemplo n.º 3
0
include_once "./lib/filecache.php";
include_once "./lib/listutils.php";
include_once "./lib/HTML_Listing.class.php";
@set_time_limit(600);
$HTTP_VARS['cache_type'] = 'HTTP';
if ($HTTP_VARS['op'] == 'flush') {
    if ($HTTP_VARS['confirmed'] == 'true') {
        $files_deleted = file_cache_delete_files($HTTP_VARS['cache_type']);
        if ($files_deleted > 0) {
            $success[] = 'Deleted ' . $files_deleted . ' cache files';
        }
        $HTTP_VARS['op'] = '';
    } else {
        if ($HTTP_VARS['confirmed'] != 'false') {
            echo "\n<h3>Delete All Cache files</h3>";
            echo get_op_confirm_form($PHP_SELF, "Are you sure you want to delete all cache files?", array('type' => $ADMIN_TYPE, 'op' => 'flush'));
        } else {
            $HTTP_VARS['op'] = '';
        }
    }
} else {
    if ($HTTP_VARS['op'] == 'flushexpired') {
        $files_deleted = file_cache_delete_files($HTTP_VARS['cache_type'], EXPIRED_ONLY);
        if ($files_deleted > 0) {
            $success[] = 'Deleted ' . $files_deleted . ' cache files';
        }
        $HTTP_VARS['op'] = '';
    }
}
if (strlen($HTTP_VARS['op']) == 0) {
    if (is_not_empty_array($success)) {
Ejemplo n.º 4
0
         $HTTP_VARS['op'] = 'list_site_plugins';
     }
 } else {
     if ($HTTP_VARS['op'] == 'delete_site_plugin_s_attribute_type_lookup_map') {
         $site_plugin_r = fetch_site_plugin_r($HTTP_VARS['site_type']);
         if (is_not_empty_array($site_plugin_r)) {
             $site_plugin_s_attribute_type_lookup_map_r = fetch_site_plugin_s_attribute_type_lookup_map_r($HTTP_VARS['site_type'], $HTTP_VARS['sequence_number']);
             if (is_not_empty_array($site_plugin_s_attribute_type_lookup_map_r)) {
                 if ($HTTP_VARS['confirmed'] == 'false') {
                     // return to edit mode
                     $HTTP_VARS['op'] = 'edit_site_plugin_s_attribute_type_lookup_maps';
                 } else {
                     if ($HTTP_VARS['confirmed'] != 'true') {
                         echo "\n<h3>Delete " . $site_plugin_r['title'] . " Site Plugin Lookup Attribute Type Map</h3>";
                         $op_confirm_prompt .= "Are you sure you want to delete Site Plugin Lookup Attribute Type Map (s_attribute_type=" . $site_plugin_s_attribute_type_lookup_map_r['s_attribute_type'] . ", value=" . $site_plugin_s_attribute_type_lookup_map_r['value'] . ", lookup_attribute_val=" . $site_plugin_s_attribute_type_lookup_map_r['lookup_attribute_val'] . ")?";
                         echo get_op_confirm_form($PHP_SELF, $op_confirm_prompt, $HTTP_VARS);
                     } else {
                         // $HTTP_VARS['confirmed'] == 'true'
                         delete_s_site_plugin_s_attribute_type_lookup_map($HTTP_VARS['site_type'], $HTTP_VARS['sequence_number']);
                         // return to edit mode
                         $HTTP_VARS['op'] = 'edit_site_plugin_s_attribute_type_lookup_maps';
                     }
                 }
             } else {
                 $errors[] = array('error' => 'Site Plugin Lookup Attribute Type Map not found');
                 $HTTP_VARS['op'] = 'edit_site_plugin_s_attribute_type_lookup_maps';
             }
         } else {
             $errors[] = array('error' => 'Site Plugin not found');
             $HTTP_VARS['op'] = 'list_site_plugins';
         }
Ejemplo n.º 5
0
    echo "\n</td>";
    echo "</tr>";
}
if (strlen($HTTP_VARS['op']) == 0) {
    $HTTP_VARS['op'] = 'edit_item_type_groups';
}
if ($HTTP_VARS['op'] == 'delete_item_type_group') {
    $item_type_group_r = fetch_item_type_group_r($HTTP_VARS['s_item_type_group']);
    if (is_not_empty_array($item_type_group_r)) {
        if ($HTTP_VARS['confirmed'] == 'false') {
            // return to edit form
            $HTTP_VARS['op'] = 'edit_item_type_groups';
        } else {
            if ($HTTP_VARS['confirmed'] != 'true') {
                echo "<h3>Delete Item Type Group</h3>";
                echo get_op_confirm_form($PHP_SELF, 'Are you sure you want to delete Item Type Group ' . $HTTP_VARS['s_item_type_group'] . '?', $HTTP_VARS);
            } else {
                // $HTTP_VARS['confirmed'] == 'true'
                if (delete_s_item_type_group_rltshp($HTTP_VARS['s_item_type_group'])) {
                    if (!delete_s_item_type_group($HTTP_VARS['s_item_type_group'])) {
                        $errors[] = array('error' => 'Item Type Group not deleted', 'detail' => db_error());
                    }
                } else {
                    $errors[] = array('error' => 'Item Type Group not deleted', 'detail' => db_error());
                }
                $HTTP_VARS['op'] = 'edit_item_type_groups';
            }
        }
    } else {
        $errors[] = array('error' => 'Item Type Group not found');
        $HTTP_VARS['op'] = 'edit_item_type_groups';
Ejemplo n.º 6
0
            $HTTP_VARS['op'] = NULL;
        } else {
            if (is_exists_items_with_status_type($HTTP_VARS['s_status_type'])) {
                // Validate that no items are attached for this status type.
                $errors[] = array('error' => 'Status Type not deleted', 'detail' => 'Status Type cannot be deleted while ' . $status_type_r['description'] . ' item instance(s) exist.');
                $HTTP_VARS['op'] = NULL;
            } else {
                if ($HTTP_VARS['confirmed'] == 'true') {
                    if (!delete_s_status_type($HTTP_VARS['s_status_type'])) {
                        $errors[] = array('error' => 'Status Type not deleted', 'detail' => db_error());
                    }
                    $HTTP_VARS['op'] = NULL;
                } else {
                    if ($HTTP_VARS['confirmed'] != 'false') {
                        echo "\n<h3>Delete Status Type</h3>";
                        echo get_op_confirm_form($PHP_SELF, "Are you sure you want to delete Status Type '" . $HTTP_VARS['s_status_type'] . " - " . $status_type_r['description'] . "'?", array('type' => $HTTP_VARS['type'], 'op' => 'delete', 's_status_type' => $HTTP_VARS['s_status_type']));
                    } else {
                        // confirmation required.
                        $HTTP_VARS['op'] = NULL;
                    }
                }
            }
        }
    } else {
        $errors[] = array('error' => 'Invalid Status Type specified');
        $HTTP_VARS['op'] = NULL;
    }
} else {
    if ($HTTP_VARS['op'] == 'update') {
        if (is_valid_s_status_type($HTTP_VARS['s_status_type'])) {
            $status_type_r = fetch_status_type_r($HTTP_VARS['s_status_type']);
Ejemplo n.º 7
0
            $HTTP_VARS['op'] = 'new';
        }
    } else {
        if ($HTTP_VARS['op'] == 'delete') {
            //delete an existing announcement
            if ($HTTP_VARS['confirmed'] == 'false') {
                $HTTP_VARS['op'] = 'list';
            } else {
                if ($HTTP_VARS['confirmed'] == 'true') {
                    if (!delete_announcement($HTTP_VARS['announcement_id'])) {
                        $errors[] = array('error' => 'Announcement not deleted', 'detail' => db_error());
                    }
                    $HTTP_VARS['op'] = 'list';
                } else {
                    echo "<h3>Delete Announcement</h3>";
                    echo get_op_confirm_form($PHP_SELF, 'Are you sure you want to permanently delete announcement "' . fetch_announcement_title($HTTP_VARS['announcement_id']) . '"?', $HTTP_VARS);
                }
            }
        }
    }
}
if ($HTTP_VARS['op'] == 'list') {
    echo "<p>[<a href=\"{$PHP_SELF}?type={$ADMIN_TYPE}&op=new\">New Announcement</a>]</p>";
    if (is_not_empty_array($errors)) {
        echo format_error_block($errors);
    }
    $result = fetch_announcement_rs();
    if ($result) {
        $submitted_datetime_mask = get_opendb_config_var('welcome.announcements', 'datetime_mask');
        echo "<table>";
        echo "<tr class=\"navbar\">" . "<th>Title</th>" . "<th>Content</th>" . "<th>Submitted</th>" . "<th>Display Days</th>" . "<th>Closed</th>" . "<th></th>" . "</tr>";
Ejemplo n.º 8
0
    echo "</td>";
    echo "</tr>";
}
if ($HTTP_VARS['op'] == 'delete') {
    if (is_exists_address_type($HTTP_VARS['s_address_type'])) {
        // In the case where we are deleting the whole type, there is no need
        // to check whether individual attributes exist, checking for items
        // is sufficient - we don't care about orphaned attributes.
        if (is_s_address_type_deletable($HTTP_VARS['s_address_type'])) {
            if ($HTTP_VARS['confirmed'] == 'false') {
                // do nothing.
                $HTTP_VARS['op'] = '';
            } else {
                if ($HTTP_VARS['confirmed'] != 'true') {
                    echo "<h3>Delete Address Type</h3>";
                    echo get_op_confirm_form($PHP_SELF, "Are you sure you want to delete Address Type \"" . $HTTP_VARS['s_address_type'] . "\"?", $HTTP_VARS);
                } else {
                    // $HTTP_VARS['confirmed'] == 'true'
                    // Check if there are any s_item_attribute_type records.
                    if (!is_exists_addr_attribute_type_rltshp($HTTP_VARS['s_address_type'], NULL) || delete_s_addr_attribute_type_rltshp($HTTP_VARS['s_address_type'], NULL, NULL)) {
                        if (!delete_s_address_type($HTTP_VARS['s_address_type'])) {
                            $errors[] = array('error' => 'Address Type (' . $HTTP_VARS['s_address_type'] . ') not deleted', 'detail' => db_error());
                        }
                    } else {
                        $errors[] = array('error' => 'Address Type (' . $HTTP_VARS['s_address_type'] . ') attributes not deleted', 'detail' => db_error());
                    }
                    $HTTP_VARS['op'] = '';
                }
            }
        } else {
            $errors[] = array('error' => 'Address Type (' . $HTTP_VARS['s_address_type'] . ') not deleted', 'detail' => 'Address Type has dependant item(s)');
Ejemplo n.º 9
0
     }
 } else {
     if ($HTTP_VARS['op'] == 'delete') {
         if (get_opendb_config_var('item_review', 'delete_support') !== FALSE) {
             if (is_review_author($review_r['sequence_number']) || is_user_granted_permission(PERM_ADMIN_REVIEWER)) {
                 if ($HTTP_VARS['confirmed'] == 'true') {
                     if (delete_review($HTTP_VARS['sequence_number'])) {
                         echo "<p class=\"success\">" . get_opendb_lang_var('review_deleted') . "</p>";
                     } else {
                         echo "<p class=\"error\">" . get_opendb_lang_var('review_not_deleted') . "</p>";
                     }
                 } else {
                     if ($HTTP_VARS['confirmed'] == 'false') {
                         echo "<p class=\"success\">" . get_opendb_lang_var('review_not_deleted') . "</p>";
                     } else {
                         echo get_op_confirm_form($PHP_SELF, get_opendb_lang_var('confirm_delete_review'), $HTTP_VARS);
                     }
                 }
             } else {
                 echo "<p class=\"error\">" . get_opendb_lang_var('operation_not_available') . "</p>";
             }
         } else {
             echo "<p class=\"error\">" . get_opendb_lang_var('operation_not_available') . "</p>";
         }
     } else {
         if ($HTTP_VARS['op'] == 'edit') {
             if (get_opendb_config_var('item_review', 'update_support') !== FALSE) {
                 if (is_review_author($review_r['sequence_number']) || is_user_granted_permission(PERM_ADMIN_REVIEWER)) {
                     echo get_edit_form('update', $review_r, $HTTP_VARS);
                 } else {
                     echo "<p class=\"error\">" . get_opendb_lang_var('operation_not_available') . "</p>";
Ejemplo n.º 10
0
function perform_delete_relation_process(&$item_r, &$status_type_r, &$HTTP_VARS, &$footer_links_r)
{
    global $PHP_SELF;
    global $titleMaskCfg;
    $parent_item_r = fetch_item_r($HTTP_VARS['parent_item_id']);
    do_op_title($parent_item_r, $status_type_r, 'delete_related');
    $errors = null;
    $return_val = handle_item_relation_delete($item_r, $status_type_r, $HTTP_VARS, $errors);
    if ($return_val === "__CONFIRM__") {
        echo get_op_confirm_form($PHP_SELF, get_opendb_lang_var('confirm_delete_relation_title', 'display_title', $titleMaskCfg->expand_item_title($parent_item_r)), $HTTP_VARS);
    } else {
        if ($return_val == "__ABORTED__") {
            echo "<p class=\"success\">" . get_opendb_lang_var('item_relation_not_deleted') . "</p>";
            $footer_links_r[] = array(url => "item_input.php?op=edit&item_id=" . $item_r['item_id'] . "&instance_no=" . $item_r['instance_no'], text => get_opendb_lang_var('back_to_item'));
        } else {
            if ($return_val === FALSE) {
                echo format_error_block($errors);
                $footer_links_r[] = array(url => "item_input.php?op=edit&item_id=" . $item_r['item_id'] . "&instance_no=" . $item_r['instance_no'], text => get_opendb_lang_var('back_to_item'));
            } else {
                echo "<p class=\"success\">" . get_opendb_lang_var('item_relation_deleted') . "</p>";
                $footer_links_r[] = array(url => "item_input.php?op=edit&item_id=" . $item_r['item_id'] . "&instance_no=" . $item_r['instance_no'], text => get_opendb_lang_var('back_to_item'));
            }
        }
    }
}
Ejemplo n.º 11
0
         if ($HTTP_VARS['op'] == 'update-tables') {
             if (is_exists_language($HTTP_VARS['language']) && !is_default_language($HTTP_VARS['language'])) {
                 update_system_table_lang_vars($HTTP_VARS);
                 $HTTP_VARS['op'] = 'edit-tables';
             } else {
                 echo "<div class=\"error\">" . get_opendb_lang_var('operation_not_available') . "</div>";
             }
         } else {
             if ($HTTP_VARS['op'] == 'delete') {
                 if (is_exists_language($HTTP_VARS['language']) && !is_default_language($HTTP_VARS['language'])) {
                     if ($HTTP_VARS['confirmed'] == 'false') {
                         $HTTP_VARS['op'] = '';
                     } else {
                         if ($HTTP_VARS['confirmed'] != 'true') {
                             echo "\n<h3>Delete Language</h3>";
                             echo get_op_confirm_form($PHP_SELF, "Are you sure you want to delete language '" . $HTTP_VARS['language'] . "'?", array('type' => $ADMIN_TYPE, 'op' => 'delete', 'language' => $HTTP_VARS['language']));
                         } else {
                             // $HTTP_VARS['confirmed'] == 'true'
                             delete_s_language_var($HTTP_VARS['language']);
                             delete_s_table_language_var($HTTP_VARS['language']);
                             delete_s_language($HTTP_VARS['language']);
                             $HTTP_VARS['op'] = '';
                         }
                     }
                 } else {
                     echo "<div class=\"error\">" . get_opendb_lang_var('operation_not_available') . "</div>";
                 }
             }
         }
     }
 }
Ejemplo n.º 12
0
     // confirm with user to delete log
     if ($HTTP_VARS['confirmed'] == 'true') {
         $result = @unlink(get_opendb_config_var('logging', 'file'));
         if ($result) {
             opendb_logger(OPENDB_LOG_INFO, __FILE__, __FUNCTION__, 'Usage log cleared');
         } else {
             opendb_logger(OPENDB_LOG_ERROR, __FILE__, __FUNCTION__, 'Usage log not cleared');
         }
         // return to log file without POST params so can do immediate refresh of log
         opendb_redirect(basename($PHP_SELF) . "?type={$ADMIN_TYPE}");
     } else {
         if ($HTTP_VARS['confirmed'] != 'false') {
             echo "<h3>" . get_opendb_lang_var('clear_usagelog') . "</h3>\n";
             // hack to get the redirect to work
             $HTTP_VARS['mode'] = 'job';
             echo get_op_confirm_form($PHP_SELF, get_opendb_lang_var('confirm_clear_log'), $HTTP_VARS);
         } else {
             // confirmation required.
             $HTTP_VARS['op'] = '';
             // return to log file without POST params so can do immediate refresh of log
             opendb_redirect(basename($PHP_SELF) . "?type={$ADMIN_TYPE}");
         }
     }
 } else {
     if ($HTTP_VARS['op'] == 'backup') {
         if (strlen($logging_config_r['backup_ext_date_format']) > 0) {
             $mask = get_localised_timestamp($logging_config_r['backup_ext_date_format']);
         } else {
             $mask = get_localised_timestamp('DDMMYY');
         }
         $filename = $logging_config_r['file'] . '.' . get_localised_timestamp($mask);
Ejemplo n.º 13
0
    } else {
        echo "&nbsp;";
    }
    echo "\n</td>";
    echo "</tr>";
}
if ($HTTP_VARS['op'] == 'delete') {
    if ($HTTP_VARS['confirmed'] == 'true') {
        if (!delete_s_file_type($HTTP_VARS['content_type'])) {
            $errors[] = array('error' => 'File Type not deleted', 'detail' => db_error());
        }
        $HTTP_VARS['op'] = NULL;
    } else {
        if ($HTTP_VARS['confirmed'] != 'false') {
            echo "\n<h3>Delete File type</h3>";
            echo get_op_confirm_form($PHP_SELF, "Are you sure you want to delete file type '" . $HTTP_VARS['content_type'] . "'?", array('type' => $HTTP_VARS['type'], 'op' => 'delete', 'content_type' => $HTTP_VARS['content_type']));
        } else {
            // confirmation required.
            $HTTP_VARS['op'] = NULL;
        }
    }
} else {
    if ($HTTP_VARS['op'] == 'update') {
        if (is_not_empty_array($HTTP_VARS['content_type'])) {
            for ($i = 0; $i < count($HTTP_VARS['content_type']); $i++) {
                if ($HTTP_VARS['exists_ind'][$i] == 'Y') {
                    if (is_exists_file_type($HTTP_VARS['content_type'][$i])) {
                        if (!update_s_file_type($HTTP_VARS['content_type'][$i], $HTTP_VARS['content_group'][$i], $HTTP_VARS['extension'][$i], trim_explode(',', $HTTP_VARS['alt_extensions'][$i]), $HTTP_VARS['description'][$i], $HTTP_VARS['image'][$i], $HTTP_VARS['thumbnail_support_ind'][$i])) {
                            $errors[] = array('error' => 'File Type "' . $HTTP_VARS['content_type'][$i] . '" not updated.', 'detail' => db_error());
                        }
                    }