Exemplo n.º 1
0
 function getDebugMessagesAsHtml()
 {
     if (is_array($this->_debugMessages)) {
         return format_error_block($this->_debugMessages, 'information');
     } else {
         return NULL;
     }
 }
Exemplo n.º 2
0
function show_login_form($HTTP_VARS, $errors = NULL)
{
    global $PHP_SELF;
    echo _theme_header(get_opendb_lang_var('login'), is_show_login_menu_enabled());
    echo "<h2>" . get_opendb_lang_var('login') . "</h2>";
    if (is_not_empty_array($errors)) {
        echo format_error_block($errors);
    }
    echo "<div id=\"loginFormDiv\">";
    if ($HTTP_VARS['rememberMeLogin'] == 'true') {
        echo "<p class=\"rememberMeLoginMessage\">" . get_opendb_lang_var('not_authorized_to_page_login') . "</p>";
    }
    if (strlen($HTTP_VARS['redirect']) > 0) {
        echo "<p class=\"redirectMessage\">" . get_opendb_lang_var('login_redirect_message', array('pageid' => get_page_id($HTTP_VARS['redirect']))) . "</p>";
    }
    echo "<form id=\"loginForm\" action=\"{$PHP_SELF}\" method=\"POST\" name=\"login\">";
    // The user tried to go straight to a menu item with an invalid session.
    // Set a "redirect" variable here so that after we give them a full session
    // we can redirect them back to the page they really wanted.
    if (strlen($HTTP_VARS['redirect']) > 0) {
        echo "<input type=\"hidden\" name=\"redirect\" value=\"" . $HTTP_VARS['redirect'] . "\">";
    }
    echo "<input type=\"hidden\" name=\"op\" value=\"login\">";
    echo "\n<ul>" . "\n<li><label class=\"label\" for=\"uid\">" . get_opendb_lang_var('userid') . "</label>" . "<input type=\"text\" class=\"text\" id=\"uid\" name=\"uid\" value=\"" . $HTTP_VARS['uid'] . "\"></li>" . "\n<li><label class=\"label\" for=\"password\">" . get_opendb_lang_var('password') . "</label>" . "<input type=\"password\" class=\"password\" id=\"passwd\" name=\"passwd\"></li>";
    echo "\n<li><label class=\"label\" for=\"remember\">" . get_opendb_lang_var('remember_me') . "</label>" . "<input type=\"checkbox\" class=\"remember\" id=\"remember\" name=\"remember\" value=\"true\"></li>";
    echo "</ul>" . "\n<input type=\"submit\" class=\"submit\" value=\"" . get_opendb_lang_var('login') . "\">";
    echo "</form>";
    // force uid field focus for login
    echo "\n<script type=\"text/javascript\">\n\t\tdocument.forms['login']['uid'].focus();\n\t</script>";
    if (is_site_enabled() && is_valid_opendb_mailer()) {
        if (strlen($HTTP_VARS['uid']) > 0 && get_opendb_config_var('login', 'enable_new_pwd_gen') !== FALSE && is_user_granted_permission(PERM_CHANGE_PASSWORD, $HTTP_VARS['uid'])) {
            $footer_links_r[] = array(url => $PHP_SELF . "?op=newpassword&uid=" . urlencode($HTTP_VARS['uid']), text => get_opendb_lang_var('forgot_your_pwd'));
        }
        // no point if site disabled, email is not available
        if (get_opendb_config_var('email', 'send_to_site_admin') !== FALSE) {
            $footer_links_r[] = array(text => get_opendb_lang_var('email_administrator'), target => "popup(640,480)", url => "email.php?op=send_to_site_admin&inc_menu=N");
        }
    }
    // Indicate we should show the signup link.
    if (get_opendb_config_var('login.signup', 'enable') !== FALSE) {
        $footer_links_r[] = array(url => "user_admin.php?op=signup", text => get_opendb_lang_var('sign_me_up'));
    }
    echo format_footer_links($footer_links_r);
    echo "</div>";
    echo _theme_footer();
}
Exemplo n.º 3
0
             $return_val = handle_user_insert($HTTP_VARS, $errors);
             if ($return_val !== FALSE) {
                 echo "\n<p class=\"success\">" . get_opendb_lang_var('new_account_reply', 'site', get_opendb_config_var('site', 'title')) . "</p>";
                 if (send_signup_info_to_admin($HTTP_VARS, $errors)) {
                     echo "\n<p class=\"smsuccess\">" . get_opendb_lang_var('new_account_admin_email_sent', 'site', get_opendb_config_var('site', 'title')) . "</p>";
                 } else {
                     echo format_error_block($errors);
                 }
             } else {
                 // $return_val === FALSE
                 echo format_error_block($errors);
                 echo get_user_input_form(NULL, $HTTP_VARS);
             }
         } else {
             //is_secretimage_code_valid
             echo format_error_block(get_opendb_lang_var('invalid_verify_code'));
             echo get_user_input_form(NULL, $HTTP_VARS);
         }
         echo format_footer_links($footer_links_r);
         echo _theme_footer();
     } else {
         $page_title = get_opendb_lang_var('new_account');
         echo _theme_header($page_title, is_show_login_menu_enabled());
         echo "\n<h2>" . $page_title . "</h2>";
         echo get_user_input_form(NULL, $HTTP_VARS);
         echo format_footer_links($footer_links_r);
         echo _theme_footer();
     }
 } else {
     //End of $HTTP_VARS['op'] checks
     opendb_operation_not_available();
Exemplo n.º 4
0
 function __listing_item_import_result_row($item_r, $status_type_r, $attribute_rs, $errorMsg = NULL)
 {
     $this->_listingsObject->startRow();
     if (is_not_empty_array($errorMsg) || !is_array($errorMsg) && strlen($errorMsg) > 0) {
         $this->_listingsObject->addThemeImageColumn("cross.gif");
         $this_failure_row_count++;
     } else {
         $this->_listingsObject->addThemeImageColumn("tick.gif");
         $this->_success_row_count++;
     }
     $this->_listingsObject->addItemTypeImageColumn($item_r['s_item_type']);
     if (is_numeric($item_r['instance_no'])) {
         $instance_no = $item_r['instance_no'];
     }
     // We have to include the title, instance, etc.
     $title = $item_r['title'] . (is_numeric($instance_no) && $instance_no > 1 ? '&nbsp;#' . $instance_no : '');
     $this->_listingsObject->addColumn($title);
     if (is_not_empty_array($errorMsg) || !is_array($errorMsg) && strlen($errorMsg) > 0) {
         $this->_listingsObject->addColumn(format_error_block($errorMsg, 'smerror'));
         $this->_listingsObject->addColumn();
     } else {
         // if override status type, then we are not showing this column
         if ($this->_cfg_override_status_type !== TRUE) {
             if (is_array($status_type_r)) {
                 $this->_listingsObject->addThemeImageColumn($status_type_r['img'], $status_type_r['description'], $status_type_r['description'], 's_status_type');
             } else {
                 $this->_listingsObject->addColumn('', 1);
             }
         }
         $column = '';
         if (is_array($attribute_rs)) {
             $column .= '<dl class="importAttribs">';
             reset($attribute_rs);
             while (list($key, $attribute_val) = each($attribute_rs)) {
                 $attribute_type_r = NULL;
                 $attribute_type_rs = $this->__getItemTypeAttribs($item_r['s_item_type']);
                 if (is_array($attribute_type_rs)) {
                     reset($attribute_type_rs);
                     while (list(, $attribute_type_r) = each($attribute_type_rs)) {
                         if ($key == get_field_name($attribute_type_r['s_attribute_type'], $attribute_type_r['order_no'])) {
                             if ($attribute_type_r['display_type'] == 'hidden' || $attribute_type_r['display_type'] == 0 && $attribute_type_r['input_type'] == 'hidden') {
                                 $attribute_type_r['display_type'] = 'display';
                                 $attribute_type_r['display_type_arg1'] = '%value%';
                             }
                             $attribute_type_r['listing_link_ind'] = 'N';
                             $column .= '<dt>' . $attribute_type_r['prompt'] . '</dt>';
                             $column .= '<dd>' . get_item_display_field(NULL, $attribute_type_r, $attribute_val, FALSE) . '</dd>';
                             break;
                         }
                     }
                 }
             }
             $column .= '</dl>';
         }
         $this->_listingsObject->addColumn($column);
     }
     $this->_listingsObject->endRow();
 }
Exemplo n.º 5
0
    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>";
        echo "\n<h3>Edit " . $HTTP_VARS['s_attribute_type'] . " Attribute Type Lookups</h3>";
        if (is_not_empty_array($errors)) {
            echo format_error_block($errors);
        }
        display_lookup_attribute_type_form($HTTP_VARS);
        echo format_help_block('Image(s) must be in a <i>theme search path</i> directory.');
    } else {
        if ($HTTP_VARS['op'] == '') {
            if (is_not_empty_array($errors)) {
                echo format_error_block($errors);
            }
            echo "<p>[<a href=\"{$PHP_SELF}?type={$ADMIN_TYPE}&op=new\">New Attribute Type</a>]</p>";
            display_attribute_type_form($HTTP_VARS);
        }
    }
}
Exemplo n.º 6
0
        } 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)) {
        echo format_error_block($success, 'information');
    }
    echo "<p>[<a href=\"admin.php?type={$ADMIN_TYPE}&op=flushexpired\">Delete expired cache entries</a>] " . "[<a href=\"admin.php?type={$ADMIN_TYPE}&op=flush\">Delete all cache entries</a>]</p>";
    if (strlen($HTTP_VARS['order_by']) == 0) {
        $HTTP_VARS['order_by'] = 'cache_date';
    }
    $listingObject = new HTML_Listing($PHP_SELF, $HTTP_VARS);
    $listingObject->setNoRowsMessage(get_opendb_lang_var('no_items_found'));
    $listingObject->startListing();
    $listingObject->addHeaderColumn('URL', 'url');
    $listingObject->addHeaderColumn('Cached', 'cache_date');
    $listingObject->addHeaderColumn('Expires', 'expire_date');
    if (is_numeric($listingObject->getItemsPerPage())) {
        $listingObject->setTotalItems(fetch_file_cache_cnt($HTTP_VARS['cache_type']));
    }
    $results = fetch_file_cache_rs($HTTP_VARS['cache_type'], $listingObject->getCurrentOrderBy(), $listingObject->getCurrentSortOrder(), $listingObject->getStartIndex(), $listingObject->getItemsPerPage());
Exemplo n.º 7
0
function send_email_to_userids($user_id_rs, $from_userid, $subject, $message, &$errors)
{
    if (strlen($subject) == 0) {
        $errors[] = get_opendb_lang_var('invalid_subject');
        return FALSE;
    }
    reset($user_id_rs);
    while (list(, $user_id) = each($user_id_rs)) {
        $touser_r = fetch_user_r($user_id);
        if (is_not_empty_array($touser_r)) {
            if (opendb_user_email($touser_r['user_id'], $from_userid, $subject, $message, $errors)) {
                $success[] = $touser_r['fullname'] . " (" . $user_id . ")";
            } else {
                $failures[] = array(user => $touser_r['fullname'] . " (" . $user_id . ")", error => $errors);
            }
            $errors = NULL;
        }
    }
    if (is_not_empty_array($success)) {
        echo "<p class=\"success\">" . get_opendb_lang_var('message_sent_to') . ": <ul>";
        while (list(, $touser) = each($success)) {
            echo "<li class=\"smsuccess\">" . $touser . "</li>";
        }
        echo "</ul></p>";
    }
    if (is_not_empty_array($failures)) {
        echo "<p class=\"error\">" . get_opendb_lang_var('message_not_sent_to') . ": <ul>";
        while (list(, $failure_r) = each($failures)) {
            echo "<li class=\\smerror\">" . $failure_r['user'] . format_error_block($failure_r['error']) . "</li>";
        }
        echo "</ul></p>";
    }
    return TRUE;
}
Exemplo n.º 8
0
                         echo format_error_block(array('error' => get_opendb_lang_var('no_records_found'), 'detail' => ''));
                         echo _theme_footer();
                     }
                 } else {
                     //get_plugin_type() not supported.
                     echo _theme_header(get_opendb_lang_var('undefined_error'));
                     echo "<p class=\"error\">" . get_opendb_lang_var('undefined_error') . "</p>";
                     echo _theme_footer();
                 }
             }
         } else {
             //if(strlen($HTTP_VARS['s_item_type'])==0 || is_valid_item_type_structure($HTTP_VARS['s_item_type']))
             $page_title = get_opendb_lang_var('type_export', array('description' => $exportPlugin->get_display_name()));
             echo _theme_header($page_title);
             echo "<h2>" . $page_title . "</h2>";
             echo format_error_block(array('error' => get_opendb_lang_var('invalid_item_type_structure', 's_item_type', $HTTP_VARS['s_item_type']), 'detail' => ''));
             echo _theme_footer();
         }
     } else {
         //if($importPlugin !== NULL)
         echo _theme_header(get_opendb_lang_var('undefined_error'));
         echo "<p class=\"error\">" . get_opendb_lang_var('undefined_error') . "</p>";
         echo _theme_footer();
     }
 } else {
     // A custom title.
     if (is_user_granted_permission(PERM_ADMIN_EXPORT) && strlen($HTTP_VARS['owner_id']) == 0) {
         $page_title = get_opendb_lang_var('export_items');
     } else {
         if ($HTTP_VARS['owner_id'] == get_opendb_session_var('user_id') || strlen($HTTP_VARS['owner_id']) == 0) {
             $page_title = get_opendb_lang_var('export_my_items');
Exemplo n.º 9
0
     if ($importPlugin->get_plugin_type() == 'xml') {
         // XML plugins will perform callbacks directly.
         $importPlugin->setItemImportHandler($itemImportHandler);
         $xmlHandler = new XMLImportPluginHandler($importPlugin, $fileHandler);
         if (($resultOfImport = $xmlHandler->handleImport()) !== TRUE) {
             $importError = $xmlHandler->getError();
         }
     }
 }
 // Close file.
 unset($fileHandler);
 @fclose($inFile);
 $listingObject->endListing();
 if ($resultOfImport !== TRUE) {
     $listingObject->setNoRowsMessage($importError);
     echo format_error_block($importError);
 }
 if ($cfg_is_trial_run) {
     echo "<form action=\"{$PHP_SELF}\" method=\"POST\">";
     echo get_url_fields($HTTP_VARS, array('op'), array('op2'));
     echo "<input type=\"button\" class=\"button\" onclick=\"this.form.op.value='uploaded'; this.form.submit();\" value=\"" . get_opendb_lang_var('back') . "\">";
     echo "<input type=\"button\" class=\"button\" onclick=\"this.form.trial_run.value='N'; this.form.op.value='import'; this.form.submit();\" value=\"" . get_opendb_lang_var('import_items') . "\">";
     echo "</form>";
 } else {
     if (is_not_empty_array($itemImportHandler->getItemIDList())) {
         $footer_links_r[] = array(url => 'listings.php?item_id_range=' . urlencode(get_item_id_range($itemImportHandler->getItemIDList())), text => get_opendb_lang_var('list_imported_items', 'count', count($itemImportHandler->getItemIDList())));
     }
     //Get rid of the file now!
     import_cache_delete($HTTP_VARS['ic_sequence_number']);
     echo format_footer_links($footer_links_r);
 }
Exemplo n.º 10
0
function perform_upgrade_step($HTTP_VARS, $opendb_release_r, $latest_to_version = NULL)
{
    if (is_upgrader_plugin($HTTP_VARS['upgrader_plugin'])) {
        include_once './install/upgrade/' . $HTTP_VARS['upgrader_plugin'] . '.class.php';
        $upgraderRef = $HTTP_VARS['upgrader_plugin'];
        $upgraderPlugin = new $upgraderRef();
        if (!is_array($opendb_release_r) || !is_numeric($opendb_release_r['upgrade_step'])) {
            if ($latest_to_version == $upgraderPlugin->getToVersion()) {
                $to_version = $latest_to_version;
            } else {
                $to_version = $upgraderPlugin->getToVersion();
            }
            $description = 'Upgrade from ' . $opendb_release_r['release_version'] . ' to ' . $to_version;
            // insert release record now.
            if (!is_exists_opendb_release_version($to_version)) {
                insert_opendb_release($to_version, $description, '0');
                $opendb_release_r = fetch_opendb_release_version_r(FALSE);
            }
        }
        $upgrade_step = $opendb_release_r['upgrade_step'];
        // first step
        if ($upgrade_step == 0) {
            $upgrade_step = 1;
        }
        if (is_numeric($opendb_release_r['upgrade_step_part']) && $opendb_release_r['upgrade_step_part'] > 0) {
            $upgrade_step_part = $opendb_release_r['upgrade_step_part'];
        } else {
            $upgrade_step_part = 1;
        }
        $remaining_count = -1;
        if ($HTTP_VARS['confirm_step'] == $upgrade_step) {
            if ($upgraderPlugin->isStepSkippable($upgrade_step) && strcasecmp($HTTP_VARS['skipStep'], 'true') === 0) {
                $step_result = TRUE;
            } else {
                $step_result = $upgraderPlugin->executeStep($upgrade_step, $upgrade_step_part - 1);
            }
            if ($step_result === TRUE) {
                $upgrade_step += 1;
                $upgrade_step_part = 1;
                if ($upgrade_step <= $upgraderPlugin->getNoOfSteps()) {
                    // complete step and move onto next one.
                    update_opendb_release_step($opendb_release_r['release_version'], $upgrade_step);
                } else {
                    // we have finished the installation process with this call
                    update_opendb_release_step($opendb_release_r['release_version'], NULL);
                }
            } else {
                if (is_numeric($step_result)) {
                    $upgrade_step_part += 1;
                    update_opendb_release_step($opendb_release_r['release_version'], $upgrade_step, $upgrade_step_part);
                    // specified number of steps to complete
                    if ($step_result > 0) {
                        $remaining_count = $step_result;
                    }
                }
            }
        }
        if ($upgrade_step <= $upgraderPlugin->getNoOfSteps()) {
            echo "<h2>" . $opendb_release_r['description'] . "</h2>";
            echo "\n<form action=\"{$PHP_SELF}\" method=\"GET\">" . "<input type=\"hidden\" name=\"step\" value=\"upgrade\">";
            echo "<input type=\"hidden\" name=\"upgrader_plugin\" value=\"" . $HTTP_VARS['upgrader_plugin'] . "\">";
            $step_title = $upgraderPlugin->getStepTitle($upgrade_step);
            $step_notes = NULL;
            if (is_numeric($upgrade_step_part) && $upgrade_step_part > 1) {
                if ($remaining_count > 0) {
                    $step_title .= " (Part " . $upgrade_step_part . " of " . ($upgrade_step_part + $remaining_count) . ")";
                } else {
                    $step_title .= " (Part " . $upgrade_step_part . " of ?)";
                    $step_notes = "Due to limitations in the installer there are an unknown number of parts for this step, please continue\n\t\t\t\t\t\t\t\t\texecuting the step until it is complete.";
                }
            }
            echo "<h3>" . $step_title . "</h3>";
            if (strlen($step_notes) > 0) {
                echo "<p class=\"help\">{$step_notes}</p>";
            }
            if (is_array($upgraderPlugin->getErrors())) {
                echo format_error_block($upgraderPlugin->getErrors());
            }
            $description = $upgraderPlugin->getStepDescription($upgrade_step);
            if (strlen($description) > 0) {
                echo '<p>' . $description . '</p>';
            }
            echo "<input type=\"hidden\" name=\"confirm_step\" value=\"{$upgrade_step}\">\n\t\t\t<input type=\"button\" class=\"button\" name=\"execute\" value=\"Execute Step\" onclick=\"this.value='Working...'; this.disabled=true; this.form.submit(); return true;\">\n";
            if ($upgraderPlugin->isStepSkippable($upgrade_step)) {
                echo "<input type=\"checkbox\" class=\"checkbox\" name=\"skipStep\" value=\"true\" onclick=\"if(this.checked){this.form['execute'].value='Skip Step';}else{this.form['execute'].value='Execute Step';}}\">Skip Step";
            }
            echo "</form>";
            return 'INCOMPLETE';
        } else {
            //if($upgrade_step <= $upgraderPlugin->getNoOfSteps())
            return TRUE;
        }
    } else {
        return FALSE;
    }
}
Exemplo n.º 11
0
function perform_site_process(&$item_r, &$status_type_r, &$HTTP_VARS, &$footer_links_r)
{
    $sitePlugin =& get_site_plugin_instance($HTTP_VARS['site_type']);
    if ($sitePlugin !== FALSE) {
        if ($HTTP_VARS['op'] == 'site-search') {
            $return_val = handle_site_search($sitePlugin, $HTTP_VARS, $errors, $footer_links_r);
            if ($return_val === "__EXACT_TITLE_MATCH__") {
                // do nothing - we have an exact match, so shall fall down
                // to do site / refresh operation instead.
            } else {
                if ($return_val !== FALSE) {
                    // display search page and break out.
                    do_op_title($item_r, $status_type_r, 'site-search');
                    echo $return_val;
                    if (get_opendb_config_var('item_input.site', 'debug') === TRUE) {
                        echo $sitePlugin->getDebugItemDataAsHtml();
                    }
                    return;
                } else {
                    // $return_val === FALSE)
                    do_op_title($item_r, $status_type_r, 'site-search');
                    echo format_error_block($errors);
                    if (get_opendb_config_var('item_input.site', 'debug') === TRUE) {
                        echo $sitePlugin->getDebugItemDataAsHtml();
                    }
                    return;
                }
            }
        } else {
            //if($HTTP_VARS['op'] == 'site-search')
            if ($sitePlugin->_queryItem($HTTP_VARS) !== TRUE) {
                // display error
                do_op_title($item_r, $status_type_r, 'new');
                $errors = $sitePlugin->getErrors();
                // we need to provide at least some indication of why there was a problem.
                if ($errors === FALSE) {
                    $errors = get_opendb_lang_var('undefined_error');
                }
                echo format_error_block($errors);
                if (get_opendb_config_var('item_input.site', 'debug') === TRUE) {
                    echo $sitePlugin->getDebugItemDataAsHtml();
                }
                return;
            }
        }
        // at this point we have an exact match!
        $site_item_attributes_r = $sitePlugin->getItemData($item_r['s_item_type']);
        if (is_not_empty_array($site_item_attributes_r)) {
            $HTTP_VARS = array_merge($HTTP_VARS, $site_item_attributes_r);
            if (is_exists_item($item_r['item_id'])) {
                $HTTP_VARS['op'] = 'refresh';
                $titleArticlesConfig = $sitePlugin->getConfigValue('item_input.title_articles');
                if (is_not_empty_array($titleArticlesConfig)) {
                    set_opendb_config_ovrd_var('item_input', 'title_articles', $titleArticlesConfig);
                }
                if (get_opendb_config_var('item_input', 'auto_site_update') === TRUE) {
                    // expand $HTTP_VARS to bypass edit form.
                    $HTTP_VARS = get_site_item_input_data($HTTP_VARS['op'], $item_r, $HTTP_VARS);
                    perform_update_process($item_r, $status_type_r, $HTTP_VARS, $footer_links_r);
                } else {
                    perform_edit_process($item_r, $status_type_r, $HTTP_VARS, $footer_links_r);
                }
            } else {
                //if(is_exists_item($item_r['item_id']))
                $HTTP_VARS['op'] = 'site';
                if (get_opendb_config_var('item_input', 'auto_site_insert') === TRUE) {
                    $item_r['s_status_type'] = fetch_default_status_type();
                    // expand $HTTP_VARS to bypass edit form.
                    $HTTP_VARS = get_site_item_input_data($HTTP_VARS['op'], $item_r, $HTTP_VARS);
                    perform_insert_process($item_r, $status_type_r, $HTTP_VARS, $footer_links_r);
                } else {
                    perform_new_process($item_r, $status_type_r, $HTTP_VARS, $footer_links_r);
                }
            }
            if (get_opendb_config_var('item_input.site', 'debug') === TRUE) {
                echo $sitePlugin->getDebugItemDataAsHtml();
            }
        } else {
            // no info found - drop down to new operation.
            $HTTP_VARS['op'] = 'new';
            perform_new_process($item_r, $status_type_r, $HTTP_VARS, $footer_links_r);
        }
    } else {
        //if($sitePlugin !== FALSE)
        do_op_title($item_r, $status_type_r, $HTTP_VARS['op']);
        echo format_error_block(get_opendb_lang_var('undefined_error'));
        opendb_logger(OPENDB_LOG_ERROR, __FILE__, __FUNCTION__, 'Site plugin class not found', $HTTP_VARS);
    }
}
Exemplo n.º 12
0
function display_s_item_type_row($item_type_r, $row)
{
    global $PHP_SELF;
    global $ADMIN_TYPE;
    echo "\n<tr>";
    $errors = NULL;
    if (check_item_type_structure($item_type_r['s_item_type'], $errors)) {
        $class = "data";
    } else {
        $class = "error";
    }
    // order_no
    echo "\n<td class=\"{$class}\">" . get_input_field("order_no[{$row}]", NULL, NULL, "number(3)", "N", $item_type_r['order_no'], FALSE) . "</td>";
    echo "\n<td class=\"{$class}\">" . get_input_field("s_item_type[{$row}]", NULL, "Item Type", "readonly", "Y", $item_type_r['s_item_type'], FALSE) . "<input type=\"hidden\" name=\"exists_ind[{$row}]\" value=\"Y\">" . "</td>";
    //description
    echo "\n<td class=\"{$class}\">" . get_input_field("description[{$row}]", NULL, NULL, "text(30,30)", "N", $item_type_r['description'], FALSE) . "</td>";
    echo "<td class=\"{$class}\">";
    // Get the theme specific source of the image.
    if (strlen($item_type_r['image']) > 0) {
        $src = theme_image_src($item_type_r['image']);
    }
    if ($src !== FALSE && strlen($src) > 0) {
        echo "<img src=\"{$src}\">";
    } else {
        echo "&nbsp;";
    }
    echo "</td>";
    echo "\n<td class=\"{$class}\">" . get_input_field("image[{$row}]", NULL, NULL, "url(15,*,\"gif,jpg,png\",N)", "N", $item_type_r['image'], FALSE) . "</td>";
    echo "\n<td class=\"{$class}\">";
    echo "\n<a href=\"{$PHP_SELF}?type={$ADMIN_TYPE}&op=edit&s_item_type=" . $item_type_r['s_item_type'] . "\">Edit</a>" . " / <a href=\"{$PHP_SELF}?type={$ADMIN_TYPE}&op=delete_type&s_item_type=" . $item_type_r['s_item_type'] . "\">Delete</a>" . "</td>";
    echo "\n<td class=\"{$class}\">";
    echo "\n<a href=\"{$PHP_SELF}?type={$ADMIN_TYPE}&op=sql&s_item_type={$item_type_r['s_item_type']}&mode=job\">SQL</a>";
    echo "\n</td>";
    echo "</tr>";
    if (is_not_empty_array($errors)) {
        echo "\n<tr>";
        echo "\n<td colspan=\"6\" class=\"{$class}\">";
        echo format_error_block($errors);
        echo "\n</td>";
        echo "\n<tr>";
    }
}
Exemplo n.º 13
0
function display_html_failure_borrow_results($section_intro, $results_rs)
{
    echo "<p class=\"error\">{$section_intro}</p>";
    echo "<ul class=\"failureItems\">";
    reset($results_rs);
    while (list(, $results_r) = each($results_rs)) {
        echo "<li>";
        echo $results_r['display_title'];
        if (is_not_empty_array($results_r['errors'])) {
            echo format_error_block($results_r['errors']);
        }
        echo "</li>";
    }
    echo "</ul>";
}