Example #1
0
function show_navigation($start_with)
{
    start_form("", "get");
    if ($start_with > 0) {
        echo get_href("<p>Previous", set_var(get_current_url(), "start", max(0, $start_with - SHOW_ITEMS)));
    } else {
        echo "Previous";
    }
    echo " ";
    echo get_href("Next", set_var(get_current_url(), "start", $start_with + SHOW_ITEMS));
    end_form();
}
Example #2
0
/**
 * Commands available in the control_panel of the page
 *
 * @return array
 */
function cmd_control_pane($type)
{
    if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs = func_get_args()) || ($fargs = 'NOARGS'))) {
        debug_log('Entered (%%)', 1, 0, __FILE__, __LINE__, __METHOD__, $fargs);
    }
    switch ($type) {
        case 'main':
            return array('home' => array('title' => _('Home'), 'enable' => true, 'link' => sprintf('href="index.php" title="%s"', _('Home')), 'image' => sprintf('<img src="%s/home-big.png" alt="%s" />', IMGDIR, _('Home'))), 'purge' => array('title' => _('Purge caches'), 'enable' => isset($_SESSION[APPCONFIG]) ? $_SESSION[APPCONFIG]->isCommandAvailable('script', 'purge_cache') : false, 'link' => sprintf('href="cmd.php?cmd=purge_cache" onclick="return ajDISPLAY(\'BODY\',\'cmd=purge_cache\',\'%s\');" title="%s"', _('Clearing cache'), _('Purge caches')), 'image' => sprintf('<img src="%s/trash-big.png" alt="%s" />', IMGDIR, _('Purge caches'))), 'hide_debug_info' => array('title' => _('Show Cache'), 'enable' => isset($_SESSION[APPCONFIG]) ? $_SESSION[APPCONFIG]->isCommandAvailable('script', 'show_cache') : false, 'link' => sprintf('href="cmd.php?cmd=show_cache" onclick="return ajDISPLAY(\'BODY\',\'cmd=show_cache\',\'%s\');" title="%s"', _('Loading'), _('Show Cache'), _('Show Cache')), 'image' => sprintf('<img src="%s/debug-cache.png" alt="%s" />', IMGDIR, _('Show Cache'))));
            break;
        case 'top':
            return array('forum' => array('title' => _('Forum'), 'enable' => isset($_SESSION[APPCONFIG]) ? $_SESSION[APPCONFIG]->isCommandAvailable('cmd', 'oslinks') : true, 'link' => sprintf('href="%s" title="%s" onclick="target=\'_blank\';"', get_href('forum'), _('Forum')), 'image' => sprintf('<img src="%s/forum-big.png" alt="%s" />', IMGDIR, _('Forum'))), 'feature' => array('title' => _('Request feature'), 'enable' => isset($_SESSION[APPCONFIG]) ? $_SESSION[APPCONFIG]->isCommandAvailable('cmd', 'oslinks') : true, 'link' => sprintf('href="%s" title="%s" onclick="target=\'_blank\';"', get_href('add_rfe'), _('Request feature')), 'image' => sprintf('<img src="%s/request-feature-big.png" alt="%s" />', IMGDIR, _('Request feature'))), 'bug' => array('title' => _('Report a bug'), 'enable' => isset($_SESSION[APPCONFIG]) ? $_SESSION[APPCONFIG]->isCommandAvailable('cmd', 'oslinks') : true, 'link' => sprintf('href="%s" title="%s" onclick="target=\'_blank\';"', get_href('add_bug'), _('Report a bug')), 'image' => sprintf('<img src="%s/bug-big.png" alt="%s" />', IMGDIR, _('Report a bug'))), 'donation' => array('title' => _('Donate'), 'enable' => isset($_SESSION[APPCONFIG]) ? $_SESSION[APPCONFIG]->isCommandAvailable('cmd', 'oslinks') : true, 'link' => sprintf('href="%s" title="%s" onclick="target=\'_blank\';"', get_href('donate'), _('Donate')), 'image' => sprintf('<img src="%s/smile-big.png" alt="%s" />', IMGDIR, _('Donate'))), 'help' => array('title' => _('Help'), 'enable' => isset($_SESSION[APPCONFIG]) ? $_SESSION[APPCONFIG]->isCommandAvailable('cmd', 'oslinks') : true, 'link' => sprintf('href="%s" title="%s" onclick="target=\'_blank\';"', get_href('documentation'), _('Help')), 'image' => sprintf('<img src="%s/help-big.png" alt="%s" />', IMGDIR, _('Help'))));
            break;
    }
}
Example #3
0
// grab the tree out of the session variable
$tree = $_SESSION['tree'];
$tree_icons = $_SESSION['tree_icons'];
?>

<?php 
include 'header.php';
?>

<body>

<?php 
$bug_href = get_href('add_bug');
$open_bugs_href = get_href('open_bugs');
$feature_href = get_href('add_rfe');
$open_features_href = get_href('open_rfes');
?>

<h3 class="subtitle" style="margin:0px">phpLDAPadmin - <?php 
echo pla_version();
?>
</h3>
<table class="edit_dn_menu">
<tr>
	<td><img src="images/light.png" /></td>
	<td><nobr><a href="<?php 
echo $feature_href;
?>
" target="new"><?php 
echo $lang['request_new_feature'];
?>
/**
 * return the html for a tabel that contains current list that is being build
 * @param array $definition defintion of current list that is being build
 * @return string html of current list
 */
function get_field_definition_table($definition)
{
    global $logging;
    $logging->trace("getting field definition table");
    $input_html_id = "<input type=text size=\"2\" maxlength=\"2\"";
    $input_html_name = "<input type=text size=\"24\" maxlength=\"40\"";
    $input_html_options = "<input type=text size=\"32\" maxlength=\"200\"";
    $input_html_value_invisible = "<input style=\"visibility: hidden;\" type=text size=\"1\" maxlength=\"100\"";
    $html_str = "";
    $html_str .= "            <div class=\"corner top_left_normal\"></div>\n";
    $html_str .= "            <div class=\"corner top_right_normal\"></div>\n";
    $html_str .= "            <div class=\"listbuilder_title\">" . translate("LABEL_DEFINE_TABLE_FIELDS") . "</div>\n";
    $html_str .= "            <div id=\"listbuilder_contents\" class=\"listbuilder_contents\">\n";
    $html_str .= "                <form id=\"database_definition_form\" action=\"javascript:void(0);\" method=\"javascript:void(0);\" onsubmit=\"javascript:void(0);\">\n";
    $html_str .= "                    <table id=\"listbuilder_definition\" align=\"left\" border=\"0\" cellspacing=\"0\">\n";
    $html_str .= "                        <thead>\n";
    $html_str .= "                            <tr>\n";
    $html_str .= "                                <th>" . translate("LABEL_FIELDTYPE") . "</th>\n";
    $html_str .= "                                <th>" . translate("LABEL_FIELDNAME") . "</th>\n";
    $html_str .= "                                <th>" . translate("LABEL_OPTIONS") . "</th>\n";
    $html_str .= "                                <th>&nbsp;</th>\n";
    $html_str .= "                                <th colspan=\"3\">&nbsp;</th>\n";
    $html_str .= "                            </tr>\n";
    $html_str .= "                        </thead>\n";
    $html_str .= "                        <tbody>\n";
    for ($row = 0; $row < count($definition) / 4; $row += 1) {
        $position_id = $row * 4;
        $position_type = $row * 4 + 1;
        $position_name = $row * 4 + 2;
        $position_options = $row * 4 + 3;
        $logging->debug("row " . $row . " (id=" . $definition[$position_id] . ", type=" . $definition[$position_type] . ", name=" . $definition[$position_name] . ", opt=" . $definition[$position_options] . ")");
        # do not display a row for the attachment field
        if ($definition[$position_type] == FIELD_TYPE_DEFINITION_ATTACHMENTS && $definition[$position_name] == DB_ATTACHMENTS_NAME) {
            $html_str .= "                            <tr class=\"invisible_collapsed\">\n";
        } else {
            $html_str .= "                            <tr>\n";
        }
        # first an invisible column
        $html_str .= "                                <td class=\"invisible_collapsed\">" . $input_html_id . " readonly ";
        $html_str .= "name=\"row_" . $row . "_0\" value=\"" . $definition[$position_id] . "\"</td>\n";
        # the first column - type
        # create a different kind of select for the first row and for the attachment row
        if ($row == 0 || $definition[$position_type] == FIELD_TYPE_DEFINITION_ATTACHMENTS && $definition[$position_name] == DB_ATTACHMENTS_NAME) {
            $html_str .= "                                <td id=\"row_" . $row . "_1\"><select class=\"inactive_input\" name=\"row_" . $row . "_1\">\n";
            $html_str .= "                                    <option value=\"" . $definition[$position_type] . "\" selected>" . translate($definition[$position_type]) . "</option>\n";
            $html_str .= "                                </select></td>\n";
        } else {
            $html_str .= "                                <td id=\"row_" . $row . "_1\">" . get_select("", $row, $definition[$position_type]) . "</td>\n";
        }
        # the second column - name
        $html_str .= "                                <td id=\"row_" . $row . "_2\">" . $input_html_name . " name=\"row_" . $row . "_2\" ";
        if ($row == 0) {
            $html_str .= "readonly class=\"inactive_input\" ";
        } else {
            $html_str .= "class=\"input_box\" ";
        }
        $html_str .= "value=\"" . $definition[$position_name] . "\"></td>\n";
        # the third column - options
        if ($definition[$position_type] == FIELD_TYPE_DEFINITION_SELECTION) {
            $html_str .= "                                <td id=\"row_" . $row . "_3\">" . $input_html_options . " name=\"row_" . $row . "_3\" value=\"" . $definition[$position_options] . "\"></td>\n";
        } else {
            if ($definition[$position_type] == FIELD_TYPE_DEFINITION_NUMBER || $definition[$position_type] == FIELD_TYPE_DEFINITION_FLOAT) {
                $html_str .= "                                <td id=\"row_" . $row . "_3\"><select class=\"selection_box\" name=\"row_" . $row . "_3\">\n";
                $html_str .= "                                    <option value=\"" . NUMBER_COLUMN_NO_SUMMATION . "\"";
                if ($definition[$position_options] == NUMBER_COLUMN_NO_SUMMATION) {
                    $html_str .= " selected";
                }
                $html_str .= ">" . translate("LABEL_NUMBER_COLUMN_NO_SUMMATION") . "</option>\n";
                $html_str .= "                                    <option value=\"" . NUMBER_COLUMN_SUMMATION . "\"";
                if ($definition[$position_options] == NUMBER_COLUMN_SUMMATION) {
                    $html_str .= " selected";
                }
                $html_str .= ">" . translate("LABEL_NUMBER_COLUMN_SUMMATION") . "</option>\n";
                $html_str .= "                                </select></td>\n";
            } else {
                if ($definition[$position_type] == FIELD_TYPE_DEFINITION_AUTO_NUMBER) {
                    $html_str .= "                                <td id=\"row_" . $row . "_3\"><select class=\"selection_box\" name=\"row_" . $row . "_3\">\n";
                    $html_str .= "                                    <option value=\"" . COLUMN_SHOW . "\"";
                    if ($definition[$position_options] == COLUMN_SHOW) {
                        $html_str .= " selected";
                    }
                    $html_str .= ">" . translate("LABEL_COLUMN_SHOW") . "</option>\n";
                    $html_str .= "                                    <option value=\"" . COLUMN_NO_SHOW . "\"";
                    if ($definition[$position_options] == COLUMN_NO_SHOW) {
                        $html_str .= " selected";
                    }
                    $html_str .= ">" . translate("LABEL_COLUMN_NO_SHOW") . "</option>\n";
                    $html_str .= "                                </select></td>\n";
                } else {
                    if ($definition[$position_type] == FIELD_TYPE_DEFINITION_AUTO_CREATED || $definition[$position_type] == FIELD_TYPE_DEFINITION_AUTO_MODIFIED) {
                        $html_str .= "                                <td id=\"row_" . $row . "_3\"><select class=\"selection_box\" name=\"row_" . $row . "_3\">\n";
                        $html_str .= "                                    <option value=\"" . NAME_DATE_OPTION_DATE_NAME . "\"";
                        if ($definition[$position_options] == NAME_DATE_OPTION_DATE_NAME) {
                            $html_str .= " selected";
                        }
                        $html_str .= ">" . translate("LABEL_DATE_NAME") . "</option>\n";
                        $html_str .= "                                    <option value=\"" . NAME_DATE_OPTION_DATE . "\"";
                        if ($definition[$position_options] == NAME_DATE_OPTION_DATE) {
                            $html_str .= " selected";
                        }
                        $html_str .= ">" . translate("LABEL_DATE_ONLY") . "</option>\n";
                        $html_str .= "                                    <option value=\"" . NAME_DATE_OPTION_NAME . "\"";
                        if ($definition[$position_options] == NAME_DATE_OPTION_NAME) {
                            $html_str .= " selected";
                        }
                        $html_str .= ">" . translate("LABEL_NAME_ONLY") . "</option>\n";
                        $html_str .= "                                </select></td>\n";
                    } else {
                        $html_str .= "                                <td>&nbsp;-&nbsp;" . $input_html_value_invisible . " name=\"row_" . $row . "_3\" value=\"\"></td>\n";
                    }
                }
            }
        }
        # the fourth column - remarks
        $html_str .= "                                <td>" . translate($definition[$position_type] . "_EXPLANATION") . "</td>\n";
        # the fifth column - up
        if ($row > 1 && $row < count($definition) / 4 - 1) {
            $html_str .= "                                <td width=\"1%\">";
            $html_str .= get_href(get_onclick(ACTION_MOVE_LISTBUILDER_ROW, HTML_NO_LIST_PERMISSION_CHECK, "", "", "({$row}, %27up%27, xajax.getFormValues(%27database_definition_form%27))"), "&nbsp;", "icon_up");
            $html_str .= "</td>\n";
        } else {
            $html_str .= "                                <td width=\"1%\">";
            $html_str .= "<p style=\"visibility: hidden;\">up</p>";
            $html_str .= "</td>\n";
        }
        # the sixth column - down
        if ($row > 0 && $row < count($definition) / 4 - 2) {
            $html_str .= "                                <td width=\"1%\">";
            $html_str .= get_href(get_onclick(ACTION_MOVE_LISTBUILDER_ROW, HTML_NO_LIST_PERMISSION_CHECK, "", "", "({$row}, %27down%27, xajax.getFormValues(%27database_definition_form%27))"), "&nbsp;", "icon_down");
            $html_str .= "</td>\n";
        } else {
            $html_str .= "                                <td width=\"1%\">";
            $html_str .= "<p style=\"visibility: hidden;\">dn</p>";
            $html_str .= "</td>\n";
        }
        # the seventh column - delete
        if ($row > 0 && $row < count($definition) / 4 - 1) {
            $html_str .= "                                <td width=\"1%\">";
            $html_str .= get_href(get_onclick(ACTION_DELETE_LISTBUILDER_ROW, HTML_NO_LIST_PERMISSION_CHECK, "", "", "({$row}, xajax.getFormValues(%27database_definition_form%27))"), translate("BUTTON_DELETE"), "icon_delete");
            $html_str .= "</td>\n";
        } else {
            $html_str .= "                                <td width=\"1%\">";
            $html_str .= "<p style=\"visibility: hidden;\">dl</p>";
            $html_str .= "</td>\n";
        }
        $html_str .= "                            </tr>\n";
    }
    $html_str .= "                        </tbody>\n";
    $html_str .= "                    </table> <!-- listbuilder_general_settings -->\n";
    $html_str .= "                </form> <!-- database_definition_form -->\n\n";
    $html_str .= "            </div> <!-- listbuilder_contents -->\n";
    $html_str .= "            <div class=\"corner bottom_left_normal\"></div>\n";
    $html_str .= "            <div class=\"corner bottom_right_normal\"></div>\n";
    $logging->trace("got field definition table");
    return $html_str;
}
Example #5
0
/**
 * get html to display the login status of a user
 * @param $response xajaxResponse response object
 * @return string html for login status
 */
function get_login_status()
{
    global $user;
    global $logging;
    $html_str = "";
    $logging->trace("getting login_status");
    $html_str .= "<div id=\"header_contents_status_login_status_left\"></div>";
    $html_str .= "<div id=\"header_contents_status_login_status_body\">";
    if ($user->is_login()) {
        $html_str .= get_href(get_onclick(ACTION_LOGOUT, HTML_NO_PERMISSION_CHECK, "", "", ""), translate("BUTTON_LOGOUT") . " " . $user->get_name(), "icon_cancel") . "</div>";
    } else {
        $html_str .= translate("LABEL_ANONYMOUS_USER") . "</div>";
    }
    $html_str .= "<div id=\"header_contents_status_login_status_right\"></div>";
    $logging->trace("got login_status");
    return $html_str;
}
/**
 * generate html for one note
 * this function is called only by function get_list_record_notes
 * @todo list of arguments is too long
 * @param string $db_field_name name of the field that contains this note
 * @param int $count the index number of this note
 * @param int $is_last indicates that this is the last existing note when set to 1
 * @param int $id the id number of this note
 * @param array $note_array array describing a single note
 * @return string resulting html
 */
function get_list_record_note($db_field_name, $count, $is_last, $id, $note_array)
{
    global $user;
    global $logging;
    $html_str = "";
    # display the first note only
    if ($count == 0) {
        $class_name = "";
    } else {
        $class_name = "invisible_collapsed";
    }
    # set the previous and next count
    $previous_count = $count - 1;
    $next_count = $count + 1;
    if ($id == 0) {
        $next_count = -1;
    }
    # set the id's for current, previous and next note
    $td_id = $db_field_name . "_" . $count;
    $previous_td_id = $db_field_name . "_" . $previous_count;
    $next_td_id = $db_field_name . "_" . $next_count;
    # set name of textarea
    $textarea_name = $db_field_name . GENERAL_SEPARATOR . FIELD_TYPE_DEFINITION_NOTES_FIELD . GENERAL_SEPARATOR . $id;
    # set the text of note when this is not a new note
    if ($id != 0) {
        $note_str = str_replace("\n", "\\n", $note_array["_note"]);
    } else {
        $note_str = "";
    }
    $logging->trace("getting list_record_note (count={$count}, is_last={$is_last}, id={$id})");
    $html_str .= "                                    <td id=\"{$td_id}\" class=\"{$class_name}\">\n";
    # create a box around the actual note and the various buttons
    $html_str .= "                                        <div class=\"note_box\">\n";
    # first we will create the delete button with its containers
    $html_str .= "                                            <div class=\"note_box_top_buttons\">\n";
    # show reference to previous note
    $html_str .= "                                                <div id=\"" . $td_id . "_ref_prev\" class=\"invisible_collapsed\">" . $previous_count . "</div>\n";
    # show reference to next note
    $html_str .= "                                                <div id=\"" . $td_id . "_ref_next\" class=\"invisible_collapsed\">" . $next_count . "</div>\n";
    # set to 1 when this note has an add button
    $html_str .= "                                                <div id=\"" . $td_id . "_ref_add\" class=\"invisible_collapsed\">" . $is_last . "</div>\n";
    $html_str .= "                                                <div id=\"" . $td_id . "_delete\" class=\"note_box_top_buttons_right\">";
    # only display delete button when this is an existing note
    if ($id != 0) {
        $html_str .= get_href(get_onclick(ACTION_DELETE_NOTE, HTML_NO_PERMISSION_CHECK, "", "", "('{$db_field_name}', {$count}, \$('#" . $td_id . "_ref_prev').html(), \$('#" . $td_id . "_ref_next').html(), \$('#" . $td_id . "_ref_add').html())"), translate("BUTTON_DELETE_NOTE"), "icon_delete");
    } else {
        $html_str .= get_inactive_button(translate("BUTTON_DELETE_NOTE"));
    }
    $html_str .= "</div>\n";
    $html_str .= "                                            </div>\n";
    # next we will display info about the creator of this note only when this is not a new note
    $html_str .= "                                            <div class=\"note_box_header\">";
    if ($id != 0) {
        $html_str .= str_replace('-', '&#8209;', get_date_str(DATE_FORMAT_NORMAL, $note_array[DB_TS_CREATED_FIELD_NAME], $user->get_date_format()));
        $html_str .= "&nbsp;(" . $note_array[DB_CREATOR_FIELD_NAME] . ")";
    } else {
        $html_str .= translate("LABEL_NEW_NOTE") . "&nbsp;(" . $user->get_name() . ")";
    }
    $html_str .= "</div>\n";
    $html_str .= "                                            <textarea cols=60 rows=4 name=\"{$textarea_name}\" id=\"" . $td_id . "_note\" class=\"note_text\">{$note_str}</textarea>\n";
    $html_str .= "                                            <div class=\"note_box_bottom_buttons\">\n";
    $html_str .= "                                                <div id=\"" . $td_id . "_previous" . "\" class=\"note_box_bottom_buttons_left\">";
    # display button to go to the previous note when this is note the first note
    if ($count != 0) {
        $html_str .= get_href(get_onclick(ACTION_PREVIOUS_NOTE, HTML_NO_PERMISSION_CHECK, "", "", "('{$db_field_name}', {$count}, \$('#" . $td_id . "_ref_prev').html())"), translate("BUTTON_PREVIOUS_NOTE"), "icon_back");
    } else {
        $html_str .= get_inactive_button(translate("BUTTON_PREVIOUS_NOTE"));
    }
    $html_str .= "</div>\n";
    $html_str .= "                                                <div id=\"" . $td_id . "_next" . "\" class=\"note_box_bottom_buttons_right\">";
    # display inactive buttion when there is no next note
    if ($id == 0) {
        $html_str .= get_inactive_button(translate("BUTTON_ADD_NOTE"));
    } else {
        if ($is_last == 1) {
            $html_str .= get_href(get_onclick(ACTION_ADD_NOTE, HTML_NO_PERMISSION_CHECK, "", "", "('{$db_field_name}', {$count}, \$('#" . $td_id . "_ref_next').html())"), translate("BUTTON_ADD_NOTE"), "icon_add");
        } else {
            $html_str .= get_href(get_onclick(ACTION_NEXT_NOTE, HTML_NO_PERMISSION_CHECK, "", "", "('{$db_field_name}', {$count}, \$('#" . $td_id . "_ref_next').html())"), translate("BUTTON_NEXT_NOTE"), "icon_next");
        }
    }
    $html_str .= "&nbsp;</div>\n";
    $html_str .= "                                            </div>\n";
    $html_str .= "                                        </div>\n";
    $html_str .= "                                    </td>\n";
    $logging->trace("got list_record_note");
    return $html_str;
}
Example #7
0
<?php

/**
 * Show a simple welcome page.
 *
 * @package phpLDAPadmin
 * @subpackage Page
 */
/**
 */
require './common.php';
echo '<center>';
echo '<br /><br />';
printf('<img src="%s/logo.png" title="%s" alt="%s" />', IMGDIR, _('phpLDAPadmin logo'), _('phpLDAPadmin logo'));
echo '<br /><br />';
echo _('Use the menu to the left to navigate');
echo '<br /><br />';
if ($_SESSION[APPCONFIG]->isCommandAvailable('cmd', 'oslinks')) {
    printf('<a href="%s" target="_blank">%s</a>', get_href('credits'), _('Credits'));
    printf(' | <a href="%s" target="_blank">%s</a>', get_href('documentation'), _('Documentation'));
    printf(' | <a href="%s" target="_blank">%s</a>', get_href('donate'), _('Donate'));
    echo '<br /><br />';
}
echo '</center>';
Example #8
0
/**
 * phpLDAPadmin's custom error handling function. When a PHP error occurs,
 * PHP will call this function rather than printing the typical PHP error string.
 * This provides phpLDAPadmin the ability to format an error message more "pretty"
 * and provide a link for users to submit a bug report. This function is not to
 * be called by users. It is exclusively for the use of PHP internally. If this
 * function is called by PHP from within a context where error handling has been
 * disabled (ie, from within a function called with "@" prepended), then this
 * function does nothing.
 *
 * @param int $errno The PHP error number that occurred (ie, E_ERROR, E_WARNING, E_PARSE, etc).
 * @param string $errstr The PHP error string provided (ie, "Warning index "foo" is undefined)
 * @param string $file The file in which the PHP error ocurred.
 * @param int $lineno The line number on which the PHP error ocurred
 *
 * @see set_error_handler
 */
function pla_error_handler($errno, $errstr, $file, $lineno)
{
    if (DEBUG_ENABLED) {
        debug_log('pla_error_handler(): Entered with (%s,%s,%s,%s)', 1, $errno, $errstr, $file, $lineno);
    }
    // error_reporting will be 0 if the error context occurred
    // within a function call with '@' preprended (ie, @ldap_bind() );
    // So, don't report errors if the caller has specifically
    // disabled them with '@'
    if (0 == ini_get('error_reporting') || 0 == error_reporting()) {
        return;
    }
    $file = basename($file);
    $caller = basename($_SERVER['PHP_SELF']);
    $errtype = "";
    switch ($errno) {
        case E_STRICT:
            $errtype = "E_STRICT";
            break;
        case E_ERROR:
            $errtype = "E_ERROR";
            break;
        case E_WARNING:
            $errtype = "E_WARNING";
            break;
        case E_PARSE:
            $errtype = "E_PARSE";
            break;
        case E_NOTICE:
            $errtype = "E_NOTICE";
            break;
        case E_CORE_ERROR:
            $errtype = "E_CORE_ERROR";
            break;
        case E_CORE_WARNING:
            $errtype = "E_CORE_WARNING";
            break;
        case E_COMPILE_ERROR:
            $errtype = "E_COMPILE_ERROR";
            break;
        case E_COMPILE_WARNING:
            $errtype = "E_COMPILE_WARNING";
            break;
        case E_USER_ERROR:
            $errtype = "E_USER_ERROR";
            break;
        case E_USER_WARNING:
            $errtype = "E_USER_WARNING";
            break;
        case E_USER_NOTICE:
            $errtype = "E_USER_NOTICE";
            break;
        case E_ALL:
            $errtype = "E_ALL";
            break;
        default:
            $errtype = _('Unrecognized error number: ') . $errno;
    }
    $errstr = preg_replace("/\\s+/", " ", $errstr);
    if ($errno == E_NOTICE) {
        echo sprintf(_('<center><table class=\'notice\'><tr><td colspan=\'2\'><center><img src=\'images/warning.png\' height=\'12\' width=\'13\' />
             <b>You found a non-fatal phpLDAPadmin bug!</b></td></tr><tr><td>Error:</td><td><b>%s</b> (<b>%s</b>)</td></tr><tr><td>File:</td>
             <td><b>%s</b> line <b>%s</b>, caller <b>%s</b></td></tr><tr><td>Versions:</td><td>PLA: <b>%s</b>, PHP: <b>%s</b>, SAPI: <b>%s</b>
             </td></tr><tr><td>Web server:</td><td><b>%s</b></td></tr>
	<tr><td colspan=\'2\'><center><a target=\'new\' href=\'%s\'>Please check and see if this bug has been reported here</a>.</center></td></tr>
	<tr><td colspan=\'2\'><center><a target=\'new\' href=\'%s\'>If it hasnt been reported, you may report this bug by clicking here</a>.</center></td></tr>
	</table></center><br />'), $errstr, $errtype, $file, $lineno, $caller, pla_version(), phpversion(), php_sapi_name(), $_SERVER['SERVER_SOFTWARE'], get_href('search_bug', "&summary_keyword=" . htmlspecialchars($errstr)), get_href('add_bug'));
        return;
    }
    $server = isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : 'undefined';
    $phpself = isset($_SERVER['PHP_SELF']) ? basename($_SERVER['PHP_SELF']) : 'undefined';
    pla_error(sprintf(_('Congratulations! You found a bug in phpLDAPadmin.<br /><br />
	     <table class=\'bug\'>
	     <tr><td>Error:</td><td><b>%s</b></td></tr>
	     <tr><td>Level:</td><td><b>%s</b></td></tr>
	     <tr><td>File:</td><td><b>%s</b></td></tr>
	     <tr><td>Line:</td><td><b>%s</b></td></tr>
		 <tr><td>Caller:</td><td><b>%s</b></td></tr>
	     <tr><td>PLA Version:</td><td><b>%s</b></td></tr>
	     <tr><td>PHP Version:</td><td><b>%s</b></td></tr>
	     <tr><td>PHP SAPI:</td><td><b>%s</b></td></tr>
	     <tr><td>Web server:</td><td><b>%s</b></td></tr>
	     </table>
	     <br />
	     Please report this bug by clicking below!'), $errstr, $errtype, $file, $lineno, $phpself, pla_version(), phpversion(), php_sapi_name(), $server));
}
Example #9
0
 private function footer_print()
 {
     if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs = func_get_args()) || ($fargs = 'NOARGS'))) {
         debug_log('Entered (%%)', 129, 0, __FILE__, __LINE__, __METHOD__, $fargs);
     }
     printf('<tr class="foot"><td><small>%s</small></td><td colspan=2><div id="ajFOOT">%s</div>%s</td></tr>', isCompress() ? '[C]' : '&nbsp;', app_version(), get_href('logo') ? sprintf('<a href="%s"><img src="%s" border="0" alt="SourceForge.net Logo" /></a>', get_href('sf'), get_href('logo')) : '&nbsp;');
 }
Example #10
0
function get_image_grid($attr)
{
    $options = get_option('dc_phgmgmtconsole');
    if (has_tag('bacara')) {
        $options['image1'] = '/wp-content/uploads/2016/03/bacara-patio-residence.png';
        $options['image2'] = '/wp-content/uploads/2016/03/bacara-health-wellness.png';
        $options['image3'] = '/wp-content/uploads/2016/03/bacara-foley-wine-tasting-room.png';
        $options['image4'] = '/wp-content/uploads/2016/03/bacara-culinary.png';
        $options['image5'] = '/wp-content/uploads/2016/03/bacara-mission.png';
    } elseif (has_tag('balboa')) {
        $options['image1'] = '/wp-content/uploads/2016/03/BALBOA-OUTDOORS.png';
        $options['image2'] = '/wp-content/uploads/2016/03/BALBOA-WELLNESS.png';
        $options['image3'] = '/wp-content/uploads/2016/03/BALBOA-ARTSCULTURE.png';
        $options['image4'] = '/wp-content/uploads/2016/03/BALBOA-CULINARY.png';
        $options['image5'] = '/wp-content/uploads/2016/03/BALBOA-SPIRITUALITY.png';
    } elseif (has_tag('estancia')) {
        $options['image1'] = '/wp-content/uploads/2016/03/ESTANCIA-OUTDOORS.png';
        $options['image2'] = '/wp-content/uploads/2016/03/ESTANCIA-WELLNESS.png';
        $options['image3'] = '/wp-content/uploads/2016/03/ESTANCIA-ARTSCULTURE.png';
        $options['image4'] = '/wp-content/uploads/2016/03/ESTANCIA-CULINARY.png';
        $options['image5'] = '/wp-content/uploads/2016/03/ESTANCIA-SPIRITUALITY.png';
    } elseif (has_tag('koakea')) {
        $options['image1'] = '/wp-content/uploads/2016/03/KOAKEA-OUTDOORS.png';
        $options['image2'] = '/wp-content/uploads/2016/03/KOAKEA-WELLNESS.png';
        $options['image3'] = '/wp-content/uploads/2016/03/KOAKEA-ARTSCULTURE.png';
        $options['image4'] = '/wp-content/uploads/2016/03/KOAKEA-CULINARY.png';
        $options['image5'] = '/wp-content/uploads/2016/03/KOAKEA-SPIRITUALITY.png';
    } elseif (has_tag('meritage')) {
        $options['image1'] = '/wp-content/uploads/2016/03/stay-golden-cocktail.jpg';
        $options['image2'] = '/wp-content/uploads/2016/03/health-wellness.jpg';
        $options['image3'] = '/wp-content/uploads/2016/03/arts-culture.jpg';
        $options['image4'] = '/wp-content/uploads/2016/03/culinary-wine-joseph-phelps.jpg';
        $options['image5'] = '/wp-content/uploads/2016/03/spirituality.jpg';
    } elseif (has_tag('pasea')) {
        $options['image1'] = '/wp-content/uploads/2016/03/PASEA-OUTDOORS.png';
        $options['image2'] = '/wp-content/uploads/2016/03/PASEA-WELLNESS.png';
        $options['image3'] = '/wp-content/uploads/2016/03/PASEA-ARTSCULTURE.png';
        $options['image4'] = '/wp-content/uploads/2016/03/PASEA-CULINARY.png';
        $options['image5'] = '/wp-content/uploads/2016/03/PASEA-SPIRITUALITY.png';
    } else {
        $options['image1'] = '/wp-content/uploads/2016/03/MC-HOME_OUTDOORS.jpg';
        $options['image2'] = '/wp-content/uploads/2016/03/MC-HOME-WELLNESS.jpg';
        $options['image3'] = '/wp-content/uploads/2016/03/MC-HOME-ARTSCULTURE.jpg';
        $options['image4'] = '/wp-content/uploads/2016/03/MC-HOME-CULINARY.jpg';
        $options['image5'] = '/wp-content/uploads/2016/03/MC-HOME-SPIRITUALITY.jpg';
    }
    $options['header1'] = 'Outdoor Experiences';
    $options['header2'] = 'Health & Wellness';
    $options['header3'] = 'Arts & Culture';
    $options['header4'] = 'Culinary & Wine';
    $options['header5'] = 'Spirituality';
    /***** Custom Headers *****/
    if (has_tag('bacara')) {
        $options['header1'] = 'Outdoor Experiences';
        $options['header2'] = 'Health & Wellness';
        $options['header3'] = 'Arts & Culture';
        $options['header4'] = 'Culinary & Wine';
        $options['header5'] = 'Spirituality';
    } elseif (has_tag('balboa')) {
        $options['header1'] = 'Outdoor Experiences';
        $options['header2'] = 'Health & Wellness';
        $options['header3'] = 'Arts & Culture';
        $options['header4'] = 'Culinary & Wine';
        $options['header5'] = 'Spirituality';
    } elseif (has_tag('estancia')) {
        $options['header1'] = 'Outdoor Experiences';
        $options['header2'] = 'Health & Wellness';
        $options['header3'] = 'Arts & Culture';
        $options['header4'] = 'Culinary & Wine';
        $options['header5'] = 'Spirituality';
    } elseif (has_tag('koakea')) {
        $options['header1'] = 'Outdoor Experiences';
        $options['header2'] = 'Health & Wellness';
        $options['header3'] = 'Arts & Culture';
        $options['header4'] = 'Culinary & Wine';
        $options['header5'] = 'Spirituality';
    } elseif (has_tag('meritage')) {
        $options['header1'] = 'Outdoor Experiences';
        $options['header2'] = 'Health & Wellness';
        $options['header3'] = 'Arts & Culture';
        $options['header4'] = 'Culinary & Wine';
        $options['header5'] = 'Spirituality';
    } elseif (has_tag('pasea')) {
        $options['header1'] = 'Outdoor Experiences';
        $options['header2'] = 'Health & Wellness';
        $options['header3'] = 'Arts & Culture';
        $options['header4'] = 'Culinary & Wine';
        $options['header5'] = 'Spirituality';
    }
    extract(shortcode_atts(array('id' => ''), $attr));
    $img_array = array('image2', 'image3', 'image4', 'image5');
    $header_array = array('header2', 'header3', 'header4', 'header5');
    shuffle($img_array);
    shuffle($header_array);
    $links['arts-culture']['bacara'] = 'http://meritagecollection.com/bacararesort/best-santa-barbara-dining/';
    $links['arts-culture']['balboa'] = '/balboabayresort/southern-california-getaways/';
    $links['arts-culture']['estancia'] = '/estancialajolla/hotel/la-jolla-vacation-activities/';
    $links['arts-culture']['koakea'] = '/koakea/hotel-overview/island-activities/';
    $links['arts-culture']['meritage'] = 'http://live-meritagecollectionevents.time.ly/event/napa-valley-arts-in-april/?instance_id=1119';
    $links['arts-culture']['pasea'] = '/paseahotel/huntington-beach-luxury-hotels/oceanfront-activities/';
    $links['culinary-wine']['bacara'] = '/bacararesort/best-santa-barbara-dining/santa-barbara-food-wine-weekend-3/';
    $links['culinary-wine']['balboa'] = '/balboabayresort/newport-beach-ca-restaurants/';
    $links['culinary-wine']['estancia'] = '/estancialajolla/san-diego-outdoor-dining/';
    $links['culinary-wine']['koakea'] = '/koakea/dining-at-red-salt/';
    $links['culinary-wine']['meritage'] = '/meritageresort/luxury-napa-valley-hotel/upcoming-resort-events/#event|masters-winemaker-dinner-with-joseph-phelps-vineyards|1303';
    $links['culinary-wine']['pasea'] = '/paseahotel/best-huntington-beach-restaurants/';
    $links['outdoor-experiences']['bacara'] = 'http://meritagecollection.com/bacararesort/santa-barbara-vacation-packages/#third';
    $links['outdoor-experiences']['balboa'] = '/balboabayresort/newport-beach-ca-hotels/';
    $links['outdoor-experiences']['estancia'] = '/estancialajolla/san-diego-hotel-deals/hotel-deals-san-diego/';
    $links['outdoor-experiences']['koakea'] = '/koakea/hotel-overview/island-activities/';
    $links['outdoor-experiences']['meritage'] = '/meritageresort/wine-county-vacation-packages/';
    $links['outdoor-experiences']['pasea'] = '/paseahotel/huntington-beach-luxury-hotels/';
    $links['spirituality']['bacara'] = 'http://meritagecollection.com/bacararesort/santa-barbara-luxury-hotels/santa-barbara-vacations/';
    $links['spirituality']['balboa'] = '/balboabayresort/newport-beach-ca-spa/luxury-resort-spas/';
    $links['spirituality']['estancia'] = '/estancialajolla/san-diego-hotel-spa/';
    $links['spirituality']['koakea'] = '/koakea/spa-experience/';
    $links['spirituality']['meritage'] = '/meritageresort/luxury-napa-valley-hotel/upcoming-resort-events/#event|mothers-day-brunch-2|1327';
    $links['spirituality']['pasea'] = '/paseahotel/huntington-beach-spa-resort/';
    $links['health-wellness']['bacara'] = 'http://meritagecollection.com/bacararesort/santa-barbara-spa-resort/luxury-treatments/';
    $links['health-wellness']['balboa'] = '/balboabayresort/newport-beach-ca-spa/';
    $links['health-wellness']['estancia'] = '/estancialajolla/san-diego-hotel-spa/fitness-spa-resort/';
    $links['health-wellness']['koakea'] = '/koakea/spa-experience/';
    $links['health-wellness']['meritage'] = '/meritageresort/napa-valley-spa-resorts/';
    $links['health-wellness']['pasea'] = '/paseahotel/huntington-beach-spa-resort/';
    $first_header = 'header1';
    $widget_html = "<div class='fp-table'><div class='column c1'><a href='" . $links[get_header_page($options[$first_header])][get_href()] . "' class='highlight-1 image1' style='background:url(\"" . $options['image1'] . "\") no-repeat; background-size: cover;'><div class='text'><h1>" . $options[$first_header] . "</h1><span class='subheader'>Add copy here.</span></div></a></div>";
    $second_header = array_pop($header_array);
    $third_header = array_pop($header_array);
    $second_index = substr($second_header, -1, 1);
    $third_index = substr($third_header, -1, 1);
    $widget_html .= "<div class='column c2'><div class='row r1'><a href='" . $links[get_header_page($options[$second_header])][get_href()] . "' class='sub-highlight image2 " . $second_index . "' style='background:url(\"" . $options['image' . $second_index] . "\") no-repeat; background-size: cover;'><div class='text'><h1>" . $options[$second_header] . "</h1></div></a><a href='" . $links[get_header_page($options[$third_header])][get_href()] . "' class='sub-highlight image3 " . $third_index . "' style='background:url(\"" . $options['image' . $third_index] . "\") no-repeat; background-size: cover;'><div class='text'><h1>" . $options[$third_header] . "</h1></div></a></div>";
    $fourth_header = array_pop($header_array);
    $fifth_header = array_pop($header_array);
    $fourth_index = substr($fourth_header, -1, 1);
    $fifth_index = substr($fifth_header, -1, 1);
    $widget_html .= "<div class='row r2'><a href='" . $links[get_header_page($options[$fourth_header])][get_href()] . "' class='sub-highlight image4' style='background:url(\"" . $options['image' . $fourth_index] . "\") no-repeat; background-size: cover;'><div class='text'><h1>" . $options[$fourth_header] . "</h1></div></a><a href='" . $links[get_header_page($options[$fifth_header])][get_href()] . "' class='sub-highlight image5' style='background:url(\"" . $options['image' . $fifth_index] . "\") no-repeat; background-size: cover;'><div class='text'><h1>" . $options[$fifth_header] . "</h1></div></a></div></div>";
    $widget_html .= "<div class='clearfix'></div></div>";
    return $widget_html;
}
Example #11
0
echo "\n\n";
echo '<!-- Links at the top of the tree viewer -->';
echo '<table class="edit_dn_menu" width=100%><tr>';
printf('<td><img src="images/home.png" alt="%s" /></td>', _('Home'));
printf('<td width=50%%><nobr><a href="welcome.php" target="right_frame">%s</a></nobr></td>', _('Home'));
printf('<td><img src="images/trash.png" alt="%s" /></td>', _('Purge caches'));
printf('<td width=50%%><nobr><a href="purge_cache.php" target="right_frame" title="%s">%s</a></nobr></td>', _('Purge all cached data in phpLDAPadmin, including server schemas.'), _('Purge caches'));
echo '</tr><tr>';
if (!$config->GetValue('appearance', 'hide_configuration_management')) {
    printf('<td><img src="images/light.png" alt="%s" /></td>', _('light'));
    printf('<td width=50%%><nobr><a href="%s" target="new">%s</a></nobr></td>', get_href('add_rfe'), _('Request feature'));
    printf('<td><img src="images/bug.png" alt="%s" /></td>', _('bug'));
    printf('<td width=50%%><nobr><a href="%s" target="new">%s</a></nobr></td>', get_href('add_bug'), _('Report a bug'));
    echo '</tr><tr>';
    printf('<td><img src="images/smile.png" alt="%s" /></td>', _('Donate'));
    printf('<td width=50%%><nobr><a href="%s" target="right_frame">%s</a></nobr></td>', get_href('donate'), _('Donate'));
}
printf('<td><img src="images/help.png" alt="%s" /></td>', _('Help'));
printf('<td><nobr><a href="help.php" target="right_frame">%s</a></nobr></td>', _('Help'));
echo '</tr></table>';
echo "\n\n";
# We want the std tree function as a fallback
require LIBDIR . 'tree_functions.php';
# Are we going to use the PLM tree?
if ($config->GetValue('appearance', 'tree_plm')) {
    require JSDIR . 'phplayersmenu/lib/PHPLIB.php';
    require JSDIR . 'phplayersmenu/lib/layersmenu-common.inc.php';
    require JSDIR . 'phplayersmenu/lib/treemenu.inc.php';
}
# For each of the configured servers
foreach ($ldapservers->GetServerList() as $server_id) {
 /**
  * get html for filter
  * @param $database_table DatabaseTable database table object
  * @param $list_title string title of list
  * @return string returned html
  */
 function get_filter($database_table, $list_title)
 {
     $this->_log->trace("get filter");
     $html_str = "";
     $this->_user->get_list_state($database_table->get_table_name());
     $filter_str = $this->_list_state->get_filter_str();
     $html_str .= "                    <div id=\"" . $this->configuration[HTML_TABLE_CSS_NAME_PREFIX] . "filter\">\n";
     $html_str .= "                        <form name=\"filter_form_name\" id=\"filter_form\" ";
     $html_str .= "onsubmit=\"javascript:handleFunction('action_set_" . $this->configuration[HTML_TABLE_JS_NAME_PREFIX] . "filter', '" . $list_title . "', document.getElementById('filter_str').value); return false;\">\n";
     $html_str .= "                            <input size=\"34\" maxlength=\"100\" value=\"" . $filter_str . "\" id=\"filter_str\">\n";
     $html_str .= "                            " . get_href(get_onclick(ACTION_SET_LIST_FILTER, $list_title, "filter_str", "below", "(%27" . $list_title . "%27, document.getElementById(%27filter_str%27).value)"), "&nbsp;", "icon_none") . "\n";
     $html_str .= "                        </form>\n";
     $html_str .= "                        " . get_href(get_onclick(ACTION_SET_LIST_FILTER, $list_title, "filter_str", "below", "(%27" . $list_title . "%27, %27%27)"), "&nbsp;", "icon_delete") . "\n";
     $html_str .= "                    </div>\n";
     $this->_log->trace("got filter");
     return $html_str;
 }
Example #13
0
function display_pla_parse_error($exception, $faultyEntry)
{
    global $actionErrorMsg;
    $errorMessage = $actionErrorMsg[$faultyEntry->getChangeType()];
    echo '<center>';
    echo '<table class="error"><tr><td class="img"><img src="images/warning.png" /></td>';
    echo '<td>';
    printf('<center><h2>%s</h2></center>', _('LDIF Parse Error'));
    echo '<br />';
    printf('%s %s', $errorMessage, $faultyEntry->dn);
    printf('<p><b>%s</b>: %s</p>', _('Description'), $exception->message);
    printf('<p><b>%s</b>: %s</p>', _('Line'), $exception->currentLine);
    printf('<p><b>%s</b>: %s</p>', _('Line Number'), $exception->lineNumber);
    echo '<br />';
    printf('<p><center><small>%s %s</small></center></p>', _('Is this a phpLDAPadmin bug?'), sprintf(_('If so, please <a href="%s">report it</a>.'), get_href('add_bug')));
    echo '</td>';
    echo '</tr>';
    echo '<center>';
}
######################################
# SJ Stationsscraper
# PHP Scraper av Emmanuel Ay 2011
######################################
# Syftet är att scrape:a upp samtliga
# stationer med Banverkets unika ID
# för att kunna bearbeta på fler sätt
######################################
require 'scraperwiki/simple_html_dom.php';
# get startpage
$html = scraperwiki::scrape("http://www4.banverket.se/trafikinformation/WebPage/StartPage.aspx?JF=7");
$dom = new simple_html_dom();
$dom->load($html);
# get redirect URL that contains ASP.NET state string
$newurl = $dom->find("a");
$newhref = get_href($newurl[0]);
# URL found, fetch it
if ($newhref != "") {
    $html = scraperwiki::scrape($newhref);
    $dom->load($html);
    # parse it
    $grid = $dom->find('#TrafficInfoStart_StationList', 0);
    $stations = $grid->find("option");
    # rip it apart
    $rowCount = 0;
    foreach ($stations as $station) {
        if ($rowCount > 0) {
            # save it
            $dataset = array('Station' => fix_chars($station->plaintext), 'StationID' => fix_chars($station->value));
            scraperwiki::save(array('Station', 'StationID'), $dataset);
        }
 protected function getHeader()
 {
     $server = $this->getServer();
     $type = $this->getType();
     $output = '';
     $output .= sprintf('# %s %s %s%s', $type['description'], _('for'), implode('|', array_keys($this->results)), $this->br);
     $output .= sprintf('# %s: %s (%s)%s', _('Server'), $server->getName(), $server->getValue('server', 'host'), $this->br);
     $output .= sprintf('# %s: %s%s', _('Search Scope'), $this->resultsdata['scope'], $this->br);
     $output .= sprintf('# %s: %s%s', _('Search Filter'), $this->resultsdata['filter'], $this->br);
     $output .= sprintf('# %s: %s%s', _('Total Entries'), $this->items, $this->br);
     $output .= sprintf('#%s', $this->br);
     $output .= sprintf('# Generated by %s (%s) on %s%s', app_name(), get_href('web'), date('F j, Y g:i a'), $this->br);
     $output .= sprintf('# Version: %s%s', app_version(), $this->br);
     $output .= $this->br;
     return $output;
 }
Example #16
0
<?php

// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/help.php,v 1.5 2005/02/26 12:35:05 wurley Exp $
/**
 * @package phpLDAPadmin
 */
/**
 */
include './common.php';
include './header.php';
$forum_href = get_href('forum');
?>

<body>

<h3 class="title">Help</h3>
<br />
<center>
<p>Do you have a problem or question?</p>
<p>Perhaps you are new to LDAP and need a little guidance?</p>
<p>Help is only one click away. Visit the online <a href="<?php 
echo $forum_href;
?>
">phpLDAPadmin support forum</a>.</p>
<br />
</center>

</body>
</html>
function scrapeTable($inputGrid, $stationID)
{
    $entries = $inputGrid->find("tr");
    $rowCount = 0;
    foreach ($entries as $entry) {
        $trainDepartureTime = "";
        $isDeviationInDeparture = "";
        $trainDeviatingDepartureTime = "";
        $trainName = "";
        $trainLink = "";
        $trainDestination = "";
        $trainOperatorName = "";
        $trainOperatorLink = "";
        $trainCurrentState = "";
        $trainCurrentStatePlace = "";
        $trainDeviationInMinutes = "";
        $trainDeviationType = "";
        $trainType = "";
        $trainTrack = "";
        $cells = $entry->find("td");
        $colCount = 0;
        if ($rowCount > 0) {
            foreach ($cells as $cell) {
                $divs = $cell->find("div");
                $divCount = 0;
                $isDeviationInDeparture = false;
                foreach ($divs as $div) {
                    $data = strip_tags_attributes($div, '<a>', 'href');
                    if ($colCount == 0) {
                        if ($divCount == 0) {
                            $trainDepartureTime = $data;
                            # print("Ordinarie avgångstid: " . $trainDepartureTime);
                        }
                        if ($divCount == 1) {
                            if ($data == "Avgick") {
                                $isDeviationInDeparture = true;
                            } else {
                                $isDeviationInDeparture = false;
                            }
                        }
                        if ($divCount == 2 && $isDeviationInDeparture == true) {
                            $trainDeviatingDepartureTime = $data;
                            # print("\nAvgick: ". $data);
                        }
                    }
                    if ($colCount == 1) {
                        // 1. Tåg nr + länk
                        if ($divCount == 0) {
                            $trainLink = get_href($data);
                            $trainName = str_replace(" till", "", strip_tags(fix_chars($data)));
                            $trainName = str_replace("Tåg nr ", "", $trainName);
                            # print("Tåg nr: ". $trainName);
                        }
                        // 2. Destination
                        if ($divCount == 1) {
                            $trainDestination = fix_chars($data);
                            # print(" Till: " . $trainDestination );
                        }
                        // 3. Operatör + länk
                        if ($divCount == 2) {
                            $trainOperatorLink = get_href($data);
                            $trainOperatorName = fix_chars(trim(strip_tags($data)));
                            # print (" Operatör: " . $trainOperatorName . " (" . $trainOperatorLink . ")" );
                        }
                    }
                    if ($colCount == 2) {
                        // Tåg som just passerat / ankommit
                        if ($divCount == 0) {
                            if (strpos($data, "Ankom")) {
                                $trainCurrentState = "ARRIVED";
                                $trainCurrentStatePlace = str_replace("Ankom ", "", fix_chars($data));
                            } else {
                                $trainCurrentState = "PASSED";
                                $trainCurrentStatePlace = str_replace("Passerade ", "", fix_chars($data));
                            }
                            # print("--> " . $trainCurrentState . " " . $trainCurrentStatePlace );
                        }
                        // Avvikelse i minuter
                        if ($divCount == 1) {
                            if (strpos($data, "tidig")) {
                                $trainDeviationInMinutes = str_replace(" min tidig", "", fix_chars($data));
                                $trainDeviationType = "EARLY";
                            } else {
                                $trainDeviationInMinutes = str_replace(" min försenad", "", fix_chars($data));
                                $trainDeviationType = "EARLY";
                            }
                            # print(" (" . $trainDeviationInMinutes . " " . $trainDeviationType . ")");
                        }
                    }
                    if ($colCount == 3) {
                        // Hämta tågtyp
                        if ($divCount == 0) {
                            $trainType = fix_chars($data);
                            # print("Tågtyp: " . $trainType);
                        }
                    }
                    if ($colCount == 4) {
                        if ($divCount == 0) {
                            $trainTrack = trim($data);
                            # print("Spår: " . $data);
                        }
                    }
                    $divCount++;
                }
                # print("\n");
                $colCount++;
            }
        }
        // trainDepartureTime, isDeviationInDeparture, trainDeviatingDepartureTime
        // trainName, trainLink, trainDestination, trainOperatorName, trainOperatorLink,
        // trainCurrentState, trainCurrentStatePlace
        // trainDeviationInMinutes, trainDeviationType
        // trainType, trainTrack
        $dataset = array('StationID' => $stationID, 'Avgång' => $trainDepartureTime, 'Avvikelse' => $isDeviationInDeparture, 'AvvikelseAvgång' => $isDeviationInDeparture, 'TågNamn' => $trainName, 'TågLänk' => $trainLink, 'Destination' => $trainDestination, 'Operatör' => $trainOperatorName, 'OperatörLänk' => $trainOperatorLink, 'Aktuellt' => $trainCurrentState, 'AktuelltPlats' => $trainCurrentStatePlace, 'AvvikelseMinuter' => $trainDeviationInMinutes, 'AvvikelseTyp' => $trainDeviationType, 'TågTyp' => $trainType, 'Spår' => $trainTrack);
        if ($rowCount > 0) {
            scraperwiki::save(array('Avgång', 'TågNamn'), $dataset);
            #print("Tågnamn : " . $trainName);
        }
        #print( "\n" );
        $rowCount++;
    }
}
Example #18
0
<?php

/**
 * Show a simple welcome page.
 *
 * @package phpLDAPadmin
 * @subpackage Page
 */
/**
 */
require './common.php';
echo '<div style="text-align: center;">';
echo '<br /><br />';
printf('<img src="%s/logo.png" title="%s" alt="%s" />', IMGDIR, _('phpLDAPadmin logo'), _('phpLDAPadmin logo'));
echo '<br /><br />';
echo _('Use the menu to the left to navigate');
echo '<br /><br />';
if ($_SESSION[APPCONFIG]->isCommandAvailable('cmd', 'oslinks')) {
    printf('<a href="%s" onclick="target=\'_blank\';">%s</a>', get_href('credits'), _('Credits'));
    printf(' | <a href="%s" onclick="target=\'_blank\';">%s</a>', get_href('documentation'), _('Documentation'));
    printf(' | <a href="%s" onclick="target=\'_blank\';">%s</a>', get_href('donate'), _('Donate'));
    echo '<br /><br />';
}
echo '</div>';
Example #19
0
if (!$config->GetValue('appearance', 'hide_configuration_management')) {
    ?>
<a href="<?php 
    echo get_href('credits');
    ?>
"><?php 
    echo _('Credits');
    ?>
</a> |
<a href="<?php 
    echo get_href('documentation');
    ?>
"><?php 
    echo _('Documentation');
    ?>
</a> |
<a href="<?php 
    echo get_href('donate');
    ?>
"><?php 
    echo _('Donate');
    ?>
</a>
<?php 
}
?>

</center>
</body>
</html>
/**
 * generate html for one attachment and for the add attachment button
 * @param string $list_title title of current list
 * @param int $attachment_id id of the attachment to generate
 * @param string $attachment_specifications specifications of attachment
 * return string resulting html
 */
function get_list_record_attachment($list_title, $attachment_id, $attachment_specifications)
{
    global $logging;
    $logging->trace("getting list_record_attachment (attachment_specs={$attachment_specifications}");
    $attachment_array = explode("|", $attachment_specifications);
    $tmp_file_name = $attachment_array[0];
    $file_type = $attachment_array[1];
    $file_size = $attachment_array[2];
    $file_name = $attachment_array[3];
    $logging->info("id={$attachment_id}, tmp_file_name={$tmp_file_name}, type={$file_type}, size={$file_size}, name={$file_name}");
    $db_field_name = ListTable::_get_db_field_name(DB_ATTACHMENTS_NAME);
    # set name and id of input
    $input_name = $db_field_name . GENERAL_SEPARATOR . FIELD_TYPE_DEFINITION_ATTACHMENTS . GENERAL_SEPARATOR . $attachment_id;
    if ($attachment_id == 0) {
        $html_str = "                                        <div id=\"upload_line\" class=\"upload_line\">\n";
        $html_str .= "                                            <span class=\"invisible_collapsed\" id=\"upload_attachment_id\">1</span>";
        $html_str .= "<input class=\"invisible_collapsed\" name=\"{$input_name}\" id=\"{$input_name}\" value=\"" . LISTTABLEATTACHMENT_EMPTY_ATTACHMENT . "|-|-|-\">";
        $html_str .= "<span id=\"upload_animation\"></span>";
        $html_str .= "<span id=\"button_upload\" class=\"icon icon_add\">" . translate("BUTTON_SELECT_UPLOAD_FILE") . "</a></span>\n";
        $html_str .= "                                        </div>\n";
    } else {
        $html_str = "                                        <div id=\"attachment_{$attachment_id}\" class=\"attachment_line\">\n";
        $html_str .= "                                            <span id=\"attachment_name_{$attachment_id}\">";
        $html_str .= "<input class=\"invisible_collapsed\" name=\"{$input_name}\" id=\"{$input_name}\" value=\"{$attachment_specifications}\">";
        # existing attachments get a clickable link
        if ($tmp_file_name == LISTTABLEATTACHMENT_EXISTING_ATTACHMENT) {
            $html_str .= get_href(get_onclick(ACTION_DOWNLOAD_ATTACHMENT, HTML_NO_PERMISSION_CHECK, "", "", "('{$list_title}', '{$attachment_id}')"), str_replace(" ", "&nbsp;", $file_name), "icon_attachment") . "&nbsp;&nbsp;";
        } else {
            $html_str .= str_replace(" ", "&nbsp;", $file_name) . "&nbsp;&nbsp;";
        }
        $html_str .= get_href(get_onclick(ACTION_DELETE_ATTACHMENT, HTML_NO_PERMISSION_CHECK, "", "", "('{$attachment_id}', \$('#{$input_name}').val())"), translate("BUTTON_DELETE"), "icon_delete") . "</span>\n";
        $html_str .= "                                        </div>\n";
    }
    $logging->trace("got list_record_attachment");
    return $html_str;
}
function pla_error($msg, $ldap_err_msg = null, $ldap_err_no = -1)
{
    include_once 'header.php';
    ?>
	<center>
	<table class="error"><tr><td class="img"><img src="images/warning.png" /></td>
	<td><center><h2>Error</h2></center>
	<?php 
    echo $msg;
    ?>
	<br />
	<?php 
    if ($ldap_err_msg) {
        echo "<b>LDAP said</b>: " . htmlspecialchars($ldap_err_msg) . "<br /><br />\n";
    }
    if ($ldap_err_no != -1) {
        $ldap_err_no = '0x' . str_pad(dechex($ldap_err_no), 2, 0, STR_PAD_LEFT);
        $verbose_error = pla_verbose_error($ldap_err_no);
        if ($verbose_error) {
            echo "<b>Error number</b>: {$ldap_err_no} <small>(" . $verbose_error['title'] . ")</small><br /><br />\n";
            echo "<b>Description</b>: " . $verbose_error['desc'] . "<br /><br />\n\n";
        } else {
            echo "<b>Error number</b>: {$ldap_err_no}<br /><br />\n";
            echo "<b>Description</b>: (no description available)<br />\n\n";
        }
    }
    ?>
	<br />
	<br />
	<center>
	<small>
		Is this a phpLDAPadmin bug? If so, please 
		<a href="<?php 
    echo get_href('add_bug');
    ?>
">report it</a>.
	</small>
	</center>
	</td></tr></table>
	</center>
	<?php 
    die;
}