Example #1
0
/** Show the translation for a message you're reading */
function translate_read_form()
{
    global $color, $translate_server;
    global $message, $translate_dir;
    global $translate_show_read;
    global $imapConnection, $wrap_at, $passed_id, $mailbox;
    if (!$translate_show_read) {
        return;
    }
    $translate_dir = 'to';
    $trans_ar = $message->findDisplayEntity(array(), array('text/plain'));
    $body = '';
    if (!empty($trans_ar[0])) {
        for ($i = 0; $i < count($trans_ar); $i++) {
            $body .= formatBody($imapConnection, $message, $color, $wrap_at, $trans_ar[$i], $passed_id, $mailbox, true);
        }
        $hookResults = do_hook('message_body', $body);
        $body = $hookResults[1];
    } else {
        $body = 'Message can\'t be translated';
    }
    $new_body = $body;
    $trans = get_html_translation_table(HTML_ENTITIES);
    $trans[' '] = '&nbsp;';
    $trans = array_flip($trans);
    $new_body = strtr($new_body, $trans);
    $new_body = urldecode($new_body);
    $new_body = strip_tags($new_body);
    /* I really don't like this next part ... */
    $new_body = str_replace('"', "''", $new_body);
    $new_body = strtr($new_body, "\n", ' ');
    $function = 'translate_form_' . $translate_server;
    $function($new_body);
}
Example #2
0
/**
 * Does the actual password changing (meaning it calls the hook function
 * from the backend that does this. If something goes wrong, return error
 * message(s). If everything ok, change the password in the session so the
 * user doesn't have to log out, and redirect back to the options screen.
 */
function cpw_do_change()
{
    global $cpw_backend;
    sqgetGlobalVar('cpw_curpass', $curpw, SQ_POST);
    sqgetGlobalVar('cpw_newpass', $newpw, SQ_POST);
    sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION);
    sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION);
    sqgetGlobalVar('key', $key, SQ_COOKIE);
    sqgetGlobalVar('username', $username, SQ_SESSION);
    require_once SM_PATH . 'plugins/change_password/backend/' . $cpw_backend . '.php';
    $msgs = do_hook('change_password_dochange', $temp = array('username' => &$username, 'curpw' => &$curpw, 'newpw' => &$newpw));
    /* something bad happened, return */
    if (count($msgs) > 0) {
        return $msgs;
    }
    /* update our password stored in the session */
    $onetimepad = OneTimePadCreate(strlen($newpw));
    sqsession_register($onetimepad, 'onetimepad');
    $key = OneTimePadEncrypt($newpw, $onetimepad);
    sqsetcookie('key', $key, 0, $base_uri);
    /* make sure we write the session data before we redirect */
    session_write_close();
    header('Location: ' . SM_PATH . 'src/options.php?optmode=submit&optpage=change_password&plugin_change_password=1&smtoken=' . sm_generate_security_token());
    exit;
}
function logout_error($errString, $errTitle = '')
{
    global $frame_top, $org_logo, $org_name, $org_logo_width, $org_logo_height, $hide_sm_attributions, $version, $squirrelmail_language, $color, $theme, $theme_default;
    $base_uri = sqm_baseuri();
    include_once SM_PATH . 'functions/page_header.php';
    if (!isset($org_logo)) {
        // Don't know yet why, but in some accesses $org_logo is not set.
        include SM_PATH . 'config/config.php';
    }
    /* Display width and height like good little people */
    $width_and_height = '';
    if (isset($org_logo_width) && is_numeric($org_logo_width) && $org_logo_width > 0) {
        $width_and_height = " width=\"{$org_logo_width}\"";
    }
    if (isset($org_logo_height) && is_numeric($org_logo_height) && $org_logo_height > 0) {
        $width_and_height .= " height=\"{$org_logo_height}\"";
    }
    if (!isset($frame_top) || $frame_top == '') {
        $frame_top = '_top';
    }
    // load default theme if possible
    if (!isset($color) && @file_exists($theme[$theme_default]['PATH'])) {
        @(include $theme[$theme_default]['PATH']);
    }
    if (!isset($color)) {
        $color = array();
        $color[0] = '#dcdcdc';
        /* light gray    TitleBar               */
        $color[1] = '#800000';
        /* red                                  */
        $color[2] = '#cc0000';
        /* light red     Warning/Error Messages */
        $color[4] = '#ffffff';
        /* white         Normal Background      */
        $color[7] = '#0000cc';
        /* blue          Links                  */
        $color[8] = '#000000';
        /* black         Normal text            */
    }
    $logout_link = $base_uri . 'src/login.php';
    list($junk, $errString, $errTitle, $logout_link) = do_hook('logout_error', $errString, $errTitle, $logout_link);
    if ($errTitle == '') {
        $errTitle = $errString;
    }
    set_up_language($squirrelmail_language, true);
    displayHtmlHeader($org_name . ' - ' . $errTitle, '', false);
    echo '<body text="' . $color[8] . '" bgcolor="' . $color[4] . '" link="' . $color[7] . '" vlink="' . $color[7] . '" alink="' . $color[7] . "\">\n\n" . '<center>';
    if (isset($org_logo) && $org_logo != '') {
        echo '<img src="' . $org_logo . '" alt="' . sprintf(_("%s Logo"), $org_name) . "\"{$width_and_height} /><br />\n";
    }
    echo ($hide_sm_attributions ? '' : '<small>' . sprintf(_("SquirrelMail version %s"), $version) . '<br />' . _("By the SquirrelMail Project Team") . "<br /></small>\n") . '<table cellspacing="1" cellpadding="0" bgcolor="' . $color[1] . '" width="70%">' . '<tr><td>' . '<table width="100%" border="0" bgcolor="' . $color[4] . '" align="center">' . '<tr><td bgcolor="' . $color[0] . '" align="center">' . '<font color="' . $color[2] . '"><b>' . _("ERROR") . '</b></font>' . '</td></tr>' . '<tr><td align="center">' . $errString . '</td></tr>' . '<tr><td bgcolor="' . $color[0] . '" align="center">' . '<font color="' . $color[2] . '"><b>' . '<a href="' . $logout_link . '" target="' . $frame_top . '">' . _("Go to the login page") . '</a></b></font></td></tr>' . '</table></td></tr></table></center></body></html>';
}
Example #4
0
} elseif (do_hook('verify_permission', 'zone_content_edit_own')) {
    $perm_content_edit = "own";
} elseif (do_hook('verify_permission', 'zone_content_edit_own_as_client')) {
    $perm_content_edit = "own_as_client";
} else {
    $perm_content_edit = "none";
}
if (do_hook('verify_permission', 'zone_meta_edit_others')) {
    $perm_meta_edit = "all";
} elseif (do_hook('verify_permission', 'zone_meta_edit_own')) {
    $perm_meta_edit = "own";
} else {
    $perm_meta_edit = "none";
}
$zid = get_zone_id_from_record_id($_GET['id']);
$user_is_zone_owner = do_hook('verify_user_is_owner_zoneid', $zid);
$zone_type = get_domain_type($zid);
$zone_name = get_zone_name_from_id($zid);
if (isset($_POST["commit"])) {
    if ($zone_type == "SLAVE" || $perm_content_edit == "none" || ($perm_content_edit == "own" || $perm_content_edit == "own_as_client") && $user_is_zone_owner == "0") {
        error(ERR_PERM_EDIT_RECORD);
    } else {
        $old_record_info = get_record_from_id($_POST["rid"]);
        $ret_val = edit_record($_POST);
        if ($ret_val == "1") {
            if ($_POST['type'] != "SOA") {
                update_soa_serial($zid);
            }
            success(SUC_RECORD_UPD);
            $new_record_info = get_record_from_id($_POST["rid"]);
            log_info(sprintf('client_ip:%s user:%s operation:edit_record' . ' old_record_type:%s old_record:%s old_content:%s old_ttl:%s old_priority:%s' . ' record_type:%s record:%s content:%s ttl:%s priority:%s', $_SERVER['REMOTE_ADDR'], $_SESSION["userlogin"], $old_record_info['type'], $old_record_info['name'], $old_record_info['content'], $old_record_info['ttl'], $old_record_info['prio'], $new_record_info['type'], $new_record_info['name'], $new_record_info['content'], $new_record_info['ttl'], $new_record_info['prio']));
Example #5
0
/* Define basic, general purpose preference constants. */
define('SMPREF_NO', 0);
define('SMPREF_OFF', 0);
define('SMPREF_YES', 1);
define('SMPREF_ON', 1);
define('SMPREF_NONE', 'none');
/* Define constants for location based preferences. */
define('SMPREF_LOC_TOP', 'top');
define('SMPREF_LOC_BETWEEN', 'between');
define('SMPREF_LOC_BOTTOM', 'bottom');
define('SMPREF_LOC_LEFT', '');
define('SMPREF_LOC_RIGHT', 'right');
/* Define preferences for folder settings. */
define('SMPREF_UNSEEN_NONE', 1);
define('SMPREF_UNSEEN_INBOX', 2);
define('SMPREF_UNSEEN_ALL', 3);
define('SMPREF_UNSEEN_SPECIAL', 4);
// Only special folders
define('SMPREF_UNSEEN_NORMAL', 5);
// Only normal folders
define('SMPREF_UNSEEN_ONLY', 1);
define('SMPREF_UNSEEN_TOTAL', 2);
/* Define constants for time/date display preferences. */
define('SMPREF_TIME_24HR', 1);
define('SMPREF_TIME_12HR', 2);
/* Define constants for javascript preferences. */
define('SMPREF_JS_OFF', 0);
define('SMPREF_JS_ON', 1);
define('SMPREF_JS_AUTODETECT', 2);
do_hook('loading_constants');
Example #6
0
    } else {
        foreach ($owners as $owner) {
            echo "    <tr><td>" . $owner["fullname"] . "</td><td>&nbsp;</td></tr>";
        }
    }
}
if ($meta_edit) {
    echo "      <form method=\"post\" action=\"edit.php?id=" . $zone_id . "\">\n";
    echo "       <input type=\"hidden\" name=\"domain\" value=\"" . $zone_id . "\">\n";
    echo "       <tr>\n";
    echo "        <td>\n";
    echo "         <select name=\"newowner\">\n";
    /*
     Show list of users to add as owners of this domain, only if we have permission to do so.
    */
    $users = do_hook('show_users');
    foreach ($users as $user) {
        $add = '';
        if ($user["id"] == $_SESSION["userid"]) {
            echo "          <option" . $add . " value=\"" . $user["id"] . "\">" . $user["fullname"] . "</option>\n";
        } elseif ($perm_view_others == "1") {
            echo "          <option  value=\"" . $user["id"] . "\">" . $user["fullname"] . "</option>\n";
        }
    }
    echo "         </select>\n";
    echo "        </td>\n";
    echo "        <td>\n";
    echo "         <input type=\"submit\" class=\"sbutton\" name=\"co\" value=\"" . _('Add') . "\">\n";
    echo "        </td>\n";
    echo "       </tr>\n";
    echo "      </form>\n";
    $selopts['-1'] = _("All address books");
    $ret = $abook->get_backend_list();
    while (list($undef, $v) = each($ret)) {
        $selopts[$v->bnum] = $v->sname;
    }
    echo addSelect('backend', $selopts, $backend, TRUE);
} else {
    echo addHidden('backend', '-1');
}
if (isset($session)) {
    echo addHidden('session', $session);
}
echo '<input type="submit" value="' . _("Search") . '" />' . '&nbsp;|&nbsp;<input type="submit" value="' . _("List all") . '" name="listall" />' . "\n" . '</form></center></td></tr></table>' . "\n";
addr_insert_hidden();
echo '</center>';
do_hook('addrbook_html_search_below');
/* End search form */
/* Show personal addressbook */
if (!empty($listall)) {
    $addrquery = '*';
}
if ($addrquery == '' && empty($listall)) {
    if (!isset($backend) || $backend != -1 || $addrquery == '') {
        if ($addrquery == '') {
            $backend = $abook->localbackend;
        }
        /* echo '<h3 align="center">' . $abook->backends[$backend]->sname) . "</h3>\n"; */
        $res = $abook->list_addr($backend);
        if (is_array($res)) {
            usort($res, 'alistcmp');
            addr_display_result($res, false);
Example #8
0
        }
    }
    $addresses[$current_backend]['Addresses'] = $new_address_list;
}
if ($showaddrlist) {
    $oTemplate->assign('show_all', $show_all);
    $oTemplate->assign('page_number', $page_number);
    $oTemplate->assign('page_size', $page_size);
    $oTemplate->assign('total_addresses', $total_addresses);
    $oTemplate->assign('abook_compact_paginator', $abook_compact_paginator);
    $oTemplate->assign('abook_page_selector', $abook_page_selector);
    $oTemplate->assign('current_page_args', $current_page_args);
    $oTemplate->assign('abook_page_selector_max', $abook_page_selector_max);
    $oTemplate->assign('addresses', $addresses);
    $oTemplate->assign('current_backend', $current_backend);
    $oTemplate->assign('backends', $list_backends);
    $oTemplate->assign('abook_has_extra_field', $abook->add_extra_field);
    $oTemplate->assign('compose_new_win', $compose_new_win);
    $oTemplate->assign('compose_height', $compose_height);
    $oTemplate->assign('compose_width', $compose_width);
    $oTemplate->assign('form_action', $form_url);
    $oTemplate->display('addressbook_list.tpl');
}
/* Display the "new address" form */
//FIXME: Remove HTML from here! (echo abook_create_form() is OK, since it is all template based output
echo '<a name="AddAddress"></a>' . "\n";
echo abook_create_form($form_url, 'addaddr', _("Add to address book"), _("Add address"), $current_backend, $defdata);
echo "</form>\n";
/* Hook for extra address book blocks */
do_hook('addressbook_bottom', $null);
$oTemplate->display('footer.tpl');
Example #9
0
 *
 * @package     Poweradmin
 * @copyright   2007-2010 Rejo Zenger <*****@*****.**>
 * @copyright   2010-2014 Poweradmin Development Team
 * @license     http://opensource.org/licenses/GPL-3.0 GPL
 */
require_once "inc/toolkit.inc.php";
include_once "inc/header.inc.php";
echo "     <h3>" . _('Welcome') . " " . $_SESSION["name"] . "</h3>\n";
do_hook('verify_permission', 'search') ? $perm_search = "1" : ($perm_search = "0");
do_hook('verify_permission', 'zone_content_view_own') ? $perm_view_zone_own = "1" : ($perm_view_zone_own = "0");
do_hook('verify_permission', 'zone_content_view_others') ? $perm_view_zone_other = "1" : ($perm_view_zone_other = "0");
do_hook('verify_permission', 'supermaster_view') ? $perm_supermaster_view = "1" : ($perm_supermaster_view = "0");
do_hook('verify_permission', 'zone_master_add') ? $perm_zone_master_add = "1" : ($perm_zone_master_add = "0");
do_hook('verify_permission', 'zone_slave_add') ? $perm_zone_slave_add = "1" : ($perm_zone_slave_add = "0");
do_hook('verify_permission', 'supermaster_add') ? $perm_supermaster_add = "1" : ($perm_supermaster_add = "0");
echo "    <ul>\n";
echo "    <li><a href=\"index.php\">" . _('Index') . "</a></li>\n";
if ($perm_search == "1") {
    echo "    <li><a href=\"search.php\">" . _('Search zones and records') . "</a></li>\n";
}
if ($perm_view_zone_own == "1" || $perm_view_zone_other == "1") {
    echo "    <li><a href=\"list_zones.php\">" . _('List zones') . "</a></li>\n";
}
if ($perm_zone_master_add) {
    echo "    <li><a href=\"list_zone_templ.php\">" . _('List zone templates') . "</a></li>\n";
}
if ($perm_supermaster_view) {
    echo "    <li><a href=\"list_supermasters.php\">" . _('List supermasters') . "</a></li>\n";
}
if ($perm_zone_master_add) {
Example #10
0
}
// Determine where the navigation frame should be
$location_of_bar = getPref($data_dir, $username, 'location_of_bar');
if (isset($languages[$squirrelmail_language]['DIR']) && strtolower($languages[$squirrelmail_language]['DIR']) == 'rtl') {
    $temp_location_of_bar = 'right';
} else {
    $temp_location_of_bar = 'left';
}
if ($location_of_bar == '') {
    $location_of_bar = $temp_location_of_bar;
}
// this value may be changed by a plugin, but initialize
// it first to avoid register_globals headaches
//
$right_frame_url = '';
do_hook('webmail_top', $null);
// Determine the main frame URL
/*
 * There are three ways to call webmail.php
 * 1.  webmail.php
 *      - This just loads the default entry screen.
 * 2.  webmail.php?right_frame=right_main.php&sort=X&startMessage=X&mailbox=XXXX
 *      - This loads the frames starting at the given values.
 * 3.  webmail.php?right_frame=folders.php
 *      - Loads the frames with the Folder options in the right frame.
 *
 * This was done to create a pure HTML way of refreshing the folder list since
 * we would like to use as little Javascript as possible.
 *
 * The test for // should catch any attempt to include off-site webpages into
 * our frameset.
Example #11
0
                    echo html_tag('td', '&nbsp;', 'center', '', 'valign="top" width="1%"');
                }
                echo html_tag('td', '&nbsp;<label for="' . $row['backend'] . '_' . urlencode($row['nickname']) . '">' . htmlspecialchars($row['nickname']) . '</label>&nbsp;', 'left', '', 'valign="top" width="10%" nowrap') . html_tag('td', '&nbsp;<label for="' . $row['backend'] . '_' . urlencode($row['nickname']) . '">' . htmlspecialchars($row['name']) . '</label>&nbsp;', 'left', '', 'valign="top" width="10%" nowrap') . html_tag('td', '', 'left', '', 'valign="top" width="10%" nowrap') . '&nbsp;';
            }
            $email = $abook->full_address($row);
            echo addHidden($row['backend'] . ':' . $row['nickname'], rawurlencode($email)) . makeComposeLink('src/compose.php?send_to=' . rawurlencode($email), htmlspecialchars($row['email'])) . '&nbsp;</td>' . "\n" . html_tag('td', '&nbsp;<label for="' . $row['backend'] . '_' . urlencode($row['nickname']) . '">' . htmlspecialchars($row['label']) . '</label>&nbsp;', 'left', '', 'valign="top" width="10%"');
            // add extra column if third party backend needs it
            if ($abook->add_extra_field) {
                echo html_tag('td', '&nbsp;' . (isset($row['extra']) ? $row['extra'] : '') . '&nbsp;', 'left', '', 'valign="top" width="10%"');
            }
            echo "</tr>\n";
            $line++;
            $count++;
        }
        /* End of list. Close table. */
        if ($headerprinted) {
            echo html_tag('tr', html_tag('td', addSubmit(_("Edit selected"), 'editaddr') . addSubmit(_("Delete selected"), 'deladdr') . addSubmit(_("Compose to selected"), 'compose_to', $javascript_on && $compose_new_win ? $compose_to_in_new_window_javascript : ''), 'center', '', "colspan=\"{$abook_fields}\""));
        }
        echo '</table></form>';
    }
}
/* end of addresslist */
/* Display the "new address" form */
echo '<a name="AddAddress"></a>' . "\n" . addForm($form_url, 'post', 'f_add') . html_tag('table', html_tag('tr', html_tag('td', "\n" . '<strong>' . sprintf(_("Add to %s"), $abook->localbackendname) . '</strong>' . "\n", 'center', $color[0])), 'center', '', 'width="95%"') . "\n";
address_form('addaddr', _("Add address"), $defdata);
echo "</form>\n";
/* Add hook for anything that wants on the bottom */
do_hook('addressbook_bottom');
?>
</body></html>
Example #12
0
$mbx_response = sqimap_mailbox_select($imapConnection, $mailbox);
$location = set_url_var($location, 'composenew', 0, false);
$location = set_url_var($location, 'composesession', 0, false);
$location = set_url_var($location, 'session', 0, false);
// make sure that cache is not used
$location = set_url_var($location, 'use_mailbox_cache', 0, false);
/* remember changes to mailbox setting */
if (!isset($lastTargetMailbox)) {
    $lastTargetMailbox = 'INBOX';
}
if ($targetMailbox != $lastTargetMailbox) {
    $lastTargetMailbox = $targetMailbox;
    sqsession_register($lastTargetMailbox, 'lastTargetMailbox');
}
$exception = false;
do_hook('move_before_move');
/*
    Move msg list sorting up here, as it is used several times,
    makes it more efficient to do it in one place for the code
*/
$id = array();
if (isset($msg) && is_array($msg)) {
    foreach ($msg as $key => $uid) {
        // using foreach removes the risk of infinite loops that was there //
        $id[] = $uid;
    }
}
// expunge-on-demand if user isn't using move_to_trash or auto_expunge
if (isset($expungeButton)) {
    $cnt = sqimap_mailbox_expunge($imapConnection, $mailbox, true);
    if ($startMessage + $cnt - 1 >= $mbx_response['EXISTS']) {
Example #13
0
function formatAttachments($message, $exclude_id, $mailbox, $id)
{
    global $where, $what, $startMessage, $color, $passed_ent_id;
    static $ShownHTML = 0;
    $att_ar = $message->getAttachments($exclude_id);
    if (!count($att_ar)) {
        return '';
    }
    $attachments = '';
    $urlMailbox = urlencode($mailbox);
    foreach ($att_ar as $att) {
        $ent = $att->entity_id;
        $header = $att->header;
        $type0 = strtolower($header->type0);
        $type1 = strtolower($header->type1);
        $name = '';
        $links['download link']['text'] = _("Download");
        $links['download link']['href'] = SM_PATH . "src/download.php?absolute_dl=true&amp;passed_id={$id}&amp;mailbox={$urlMailbox}&amp;ent_id={$ent}";
        $ImageURL = '';
        if ($type0 == 'message' && $type1 == 'rfc822') {
            $default_page = SM_PATH . 'src/read_body.php';
            $rfc822_header = $att->rfc822_header;
            $filename = $rfc822_header->subject;
            if (trim($filename) == '') {
                $filename = 'untitled-[' . $ent . ']';
            }
            $from_o = $rfc822_header->from;
            if (is_object($from_o)) {
                $from_name = $from_o->getAddress(false);
            } elseif (is_array($from_o) && count($from_o) && is_object($from_o[0])) {
                // when a digest message is opened and you return to the digest
                // now the from object is part of an array. This is a workaround.
                $from_name = $from_o[0]->getAddress(false);
            } else {
                $from_name = _("Unknown sender");
            }
            $from_name = decodeHeader($from_name);
            $description = $from_name;
        } else {
            $default_page = SM_PATH . 'src/download.php';
            if (is_object($header->disposition)) {
                $filename = $header->disposition->getProperty('filename');
                if (trim($filename) == '') {
                    $name = decodeHeader($header->disposition->getProperty('name'));
                    if (trim($name) == '') {
                        $name = $header->getParameter('name');
                        if (trim($name) == '') {
                            if (trim($header->id) == '') {
                                $filename = 'untitled-[' . $ent . ']';
                            } else {
                                $filename = 'cid: ' . $header->id;
                            }
                        } else {
                            $filename = $name;
                        }
                    } else {
                        $filename = $name;
                    }
                }
            } else {
                $filename = $header->getParameter('name');
                if (!trim($filename)) {
                    if (trim($header->id) == '') {
                        $filename = 'untitled-[' . $ent . ']';
                    } else {
                        $filename = 'cid: ' . $header->id;
                    }
                }
            }
            if ($header->description) {
                $description = decodeHeader($header->description);
            } else {
                $description = '';
            }
        }
        $display_filename = $filename;
        if (isset($passed_ent_id)) {
            $passed_ent_id_link = '&amp;passed_ent_id=' . $passed_ent_id;
        } else {
            $passed_ent_id_link = '';
        }
        $defaultlink = $default_page . "?startMessage={$startMessage}" . "&amp;passed_id={$id}&amp;mailbox={$urlMailbox}" . '&amp;ent_id=' . $ent . $passed_ent_id_link;
        if ($where && $what) {
            $defaultlink .= '&amp;where=' . urlencode($where) . '&amp;what=' . urlencode($what);
        }
        // IE does make use of mime content sniffing. Forcing a download
        // prohibit execution of XSS inside an application/octet-stream attachment
        if ($type0 == 'application' && $type1 == 'octet-stream') {
            $defaultlink .= '&amp;absolute_dl=true';
        }
        /* This executes the attachment hook with a specific MIME-type.
         * If that doesn't have results, it tries if there's a rule
         * for a more generic type. Finally, a hook for ALL attachment
         * types is run as well.
         */
        $hookresults = do_hook("attachment {$type0}/{$type1}", $links, $startMessage, $id, $urlMailbox, $ent, $defaultlink, $display_filename, $where, $what);
        if (count($hookresults[1]) <= 1) {
            $hookresults = do_hook("attachment {$type0}/*", $links, $startMessage, $id, $urlMailbox, $ent, $defaultlink, $display_filename, $where, $what);
        }
        $hookresults = do_hook("attachment */*", $hookresults[1], $startMessage, $id, $urlMailbox, $ent, $hookresults[6], $display_filename, $where, $what);
        $links = $hookresults[1];
        $defaultlink = $hookresults[6];
        $attachments .= '<tr><td>' . '<a href="' . $defaultlink . '">' . decodeHeader($display_filename) . '</a>&nbsp;</td>' . '<td><small><b>' . show_readable_size($header->size) . '</b>&nbsp;&nbsp;</small></td>' . '<td><small>[ ' . htmlspecialchars($type0) . '/' . htmlspecialchars($type1) . ' ]&nbsp;</small></td>' . '<td><small>';
        $attachments .= '<b>' . $description . '</b>';
        $attachments .= '</small></td><td><small>&nbsp;';
        $skipspaces = 1;
        foreach ($links as $val) {
            if ($skipspaces) {
                $skipspaces = 0;
            } else {
                $attachments .= '&nbsp;&nbsp;|&nbsp;&nbsp;';
            }
            $attachments .= '<a href="' . $val['href'] . '">' . $val['text'] . '</a>';
        }
        unset($links);
        $attachments .= "</td></tr>\n";
    }
    return $attachments;
}
Example #14
0
        $line = "<span style=\"white-space: nowrap;\"><tt>{$prefix}</tt>";
        /* Add the folder name and link. */
        if (!isset($color[15])) {
            $color[15] = $color[6];
        }
        if (in_array('noselect', $boxes[$i]['flags'])) {
            if (isSpecialMailbox($boxes[$i]['unformatted'])) {
                $line .= "<font color=\"{$color['11']}\">";
            } else {
                $line .= "<font color=\"{$color['15']}\">";
            }
            if (ereg("^( *)([^ ]*)", $mailbox, $regs)) {
                $mailbox = str_replace('&nbsp;', '', $mailbox);
                $line .= str_replace(' ', '&nbsp;', $mailbox);
            }
            $line .= '</font>';
        } else {
            $line .= formatMailboxName($imapConnection, $boxes[$i]);
        }
        /* Put the final touches on our folder line. */
        $line .= "</span><br />\n";
        /* Output the line for this folder. */
        echo $line;
    }
}
do_hook('left_main_after');
sqimap_logout($imapConnection);
?>
</td></tr></table>
</body></html>
Example #15
0
    $rtypes[] = 'CURL';
}
/* * ***********
 * Includes  *
 * *********** */
$db = dbConnect();
require_once "plugin.inc.php";
require_once "i18n.inc.php";
require_once "auth.inc.php";
require_once "users.inc.php";
require_once "dns.inc.php";
require_once "record.inc.php";
require_once "dnssec.inc.php";
require_once "templates.inc.php";
//do_hook('hook_post_includes');
do_hook('authenticate');
/* * ***********
 * Functions *
 * *********** */
/** Print paging menu
 *
 * Display the page option: [ < ][ 1 ] .. [ 8 ][ 9 ][ 10 ][ 11 ][ 12 ][ 13 ][ 14 ][ 15 ][ 16 ] .. [ 34 ][ > ]
 *
 * @param int $amount Total number of items
 * @param int $rowamount Per page number of items
 * @param int $id Page specific ID (Zone ID, Template ID, etc)
 *
 * @return null
 */
function show_pages($amount, $rowamount, $id = '')
{
/**
 * Outputs a complete SquirrelMail page header, starting with <!doctype> and
 * including the default menu bar. Uses displayHtmlHeader and takes
 * JavaScript and locale settings into account.
 *
 * @param array color the array of theme colors
 * @param string mailbox the current mailbox name to display
 * @param string xtra extra html code to add
 * @param bool session
 * @return void
 */
function displayPageHeader($color, $mailbox, $xtra = '', $session = false)
{
    global $hide_sm_attributions, $PHP_SELF, $frame_top, $compose_new_win, $compose_width, $compose_height, $attachemessages, $provider_name, $provider_uri, $javascript_on, $default_use_mdn, $mdn_user_support, $startMessage;
    sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION);
    sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
    $module = substr($PHP_SELF, (strlen($PHP_SELF) - strlen($base_uri)) * -1);
    if ($qmark = strpos($module, '?')) {
        $module = substr($module, 0, $qmark);
    }
    if (!isset($frame_top)) {
        $frame_top = '_top';
    }
    if ($session) {
        $compose_uri = $base_uri . 'src/compose.php?mailbox=' . urlencode($mailbox) . '&amp;attachedmessages=true&amp;session=' . "{$session}";
    } else {
        $compose_uri = $base_uri . 'src/compose.php?newmessage=1';
        $session = 0;
    }
    if ($javascript_on) {
        switch ($module) {
            case 'src/read_body.php':
                $js = '';
                // compose in new window code
                if ($compose_new_win == '1') {
                    if (!preg_match("/^[0-9]{3,4}\$/", $compose_width)) {
                        $compose_width = '640';
                    }
                    if (!preg_match("/^[0-9]{3,4}\$/", $compose_height)) {
                        $compose_height = '550';
                    }
                    $js .= "function comp_in_new_form(comp_uri, button, myform) {\n" . '   if (!comp_uri) {' . "\n" . '       comp_uri = "' . $compose_uri . "\";\n" . '   }' . "\n" . '   comp_uri += "&" + button.name + "=1";' . "\n" . '   for ( var i=0; i < myform.elements.length; i++ ) {' . "\n" . '      if ( myform.elements[i].type == "checkbox"  && myform.elements[i].checked )' . "\n" . '         comp_uri += "&" + myform.elements[i].name + "=1";' . "\n" . '   }' . "\n" . '   var newwin = window.open(comp_uri' . ', "_blank",' . '"width=' . $compose_width . ',height=' . $compose_height . ',scrollbars=yes,resizable=yes,status=yes");' . "\n" . "}\n\n";
                    $js .= "function comp_in_new(comp_uri) {\n" . "       if (!comp_uri) {\n" . '           comp_uri = "' . $compose_uri . "\";\n" . '       }' . "\n" . '    var newwin = window.open(comp_uri' . ', "_blank",' . '"width=' . $compose_width . ',height=' . $compose_height . ',scrollbars=yes,resizable=yes,status=yes");' . "\n" . "}\n\n";
                }
                // javascript for sending read receipts
                if ($default_use_mdn && $mdn_user_support) {
                    $js .= 'function sendMDN() {' . "\n" . "    mdnuri=window.location+'&sendreceipt=1'; " . "var newwin = window.open(mdnuri,'right');" . "\n}\n\n";
                }
                // if any of the above passes, add the JS tags too.
                if ($js) {
                    $js = "\n" . '<script language="JavaScript" type="text/javascript">' . "\n<!--\n" . $js . "// -->\n</script>\n";
                }
                displayHtmlHeader('SquirrelMail', $js);
                $onload = $xtra;
                break;
            case 'src/compose.php':
                $js = '<script language="JavaScript" type="text/javascript">' . "\n<!--\n" . "function checkForm() {\n";
                global $action, $reply_focus;
                if (strpos($action, 'reply') !== FALSE && $reply_focus) {
                    if ($reply_focus == 'select') {
                        $js .= "document.forms['compose'].body.select();}\n";
                    } else {
                        if ($reply_focus == 'focus') {
                            $js .= "document.forms['compose'].body.focus();}\n";
                        } else {
                            if ($reply_focus == 'none') {
                                $js .= "}\n";
                            }
                        }
                    }
                } else {
                    if ($reply_focus == 'none') {
                        $js .= "}\n";
                    } else {
                        $js .= "var f = document.forms.length;\n" . "var i = 0;\n" . "var pos = -1;\n" . "while( pos == -1 && i < f ) {\n" . "var e = document.forms[i].elements.length;\n" . "var j = 0;\n" . "while( pos == -1 && j < e ) {\n" . "if ( document.forms[i].elements[j].type == 'text' ) {\n" . "pos = j;\n" . "}\n" . "j++;\n" . "}\n" . "i++;\n" . "}\n" . "if( pos >= 0 ) {\n" . "document.forms[i-1].elements[pos].focus();\n" . "}\n" . "}\n";
                    }
                }
                $js .= "// -->\n" . "</script>\n";
                $onload = 'onload="checkForm();"';
                displayHtmlHeader('SquirrelMail', $js);
                break;
            default:
                $js = '<script language="JavaScript" type="text/javascript">' . "\n<!--\n" . "function checkForm() {\n" . "var f = document.forms.length;\n" . "var i = 0;\n" . "var pos = -1;\n" . "while( pos == -1 && i < f ) {\n" . "var e = document.forms[i].elements.length;\n" . "var j = 0;\n" . "while( pos == -1 && j < e ) {\n" . "if ( document.forms[i].elements[j].type == 'text' " . "|| document.forms[i].elements[j].type == 'password' ) {\n" . "pos = j;\n" . "}\n" . "j++;\n" . "}\n" . "i++;\n" . "}\n" . "if( pos >= 0 ) {\n" . "document.forms[i-1].elements[pos].focus();\n" . "}\n" . "{$xtra}\n" . "}\n";
                if ($compose_new_win == '1') {
                    if (!preg_match("/^[0-9]{3,4}\$/", $compose_width)) {
                        $compose_width = '640';
                    }
                    if (!preg_match("/^[0-9]{3,4}\$/", $compose_height)) {
                        $compose_height = '550';
                    }
                    $js .= "function comp_in_new(comp_uri) {\n" . "       if (!comp_uri) {\n" . '           comp_uri = "' . $compose_uri . "\";\n" . '       }' . "\n" . '    var newwin = window.open(comp_uri' . ', "_blank",' . '"width=' . $compose_width . ',height=' . $compose_height . ',scrollbars=yes,resizable=yes,status=yes");' . "\n" . "}\n\n";
                }
                $js .= "// -->\n" . "</script>\n";
                $onload = 'onload="checkForm();"';
                displayHtmlHeader('SquirrelMail', $js);
                break;
        }
    } else {
        /* do not use JavaScript */
        displayHtmlHeader('SquirrelMail');
        $onload = '';
    }
    echo "<body text=\"{$color['8']}\" bgcolor=\"{$color['4']}\" link=\"{$color['7']}\" vlink=\"{$color['7']}\" alink=\"{$color['7']}\" {$onload}>\n\n";
    /** Here is the header and wrapping table **/
    $shortBoxName = htmlspecialchars(imap_utf7_decode_local(readShortMailboxName($mailbox, $delimiter)));
    if ($shortBoxName == 'INBOX') {
        $shortBoxName = _("INBOX");
    }
    echo "<a name=\"pagetop\"></a>\n" . html_tag('table', '', '', $color[4], 'border="0" width="100%" cellspacing="0" cellpadding="2"') . "\n" . html_tag('tr', '', '', $color[9]) . "\n" . html_tag('td', '', 'left') . "\n";
    if ($shortBoxName != '' && strtolower($shortBoxName) != 'none') {
        echo '         ' . _("Current Folder") . ": <b>{$shortBoxName}&nbsp;</b>\n";
    } else {
        echo '&nbsp;';
    }
    echo "      </td>\n" . html_tag('td', '', 'right') . "<b>\n";
    displayInternalLink('src/signout.php', _("Sign Out"), $frame_top);
    echo "</b></td>\n" . "   </tr>\n" . html_tag('tr', '', '', $color[4]) . "\n" . ($hide_sm_attributions ? html_tag('td', '', 'left', '', 'colspan="2"') : html_tag('td', '', 'left')) . "\n";
    $urlMailbox = urlencode($mailbox);
    echo makeComposeLink('src/compose.php?mailbox=' . $urlMailbox . '&amp;startMessage=' . $startMessage);
    echo "&nbsp;&nbsp;\n";
    displayInternalLink('src/addressbook.php', _("Addresses"));
    echo "&nbsp;&nbsp;\n";
    displayInternalLink('src/folders.php', _("Folders"));
    echo "&nbsp;&nbsp;\n";
    displayInternalLink('src/options.php', _("Options"));
    echo "&nbsp;&nbsp;\n";
    displayInternalLink("src/search.php?mailbox={$urlMailbox}", _("Search"));
    echo "&nbsp;&nbsp;\n";
    displayInternalLink('src/help.php', _("Help"));
    echo "&nbsp;&nbsp;\n";
    do_hook('menuline');
    echo "      </td>\n";
    if (!$hide_sm_attributions) {
        echo html_tag('td', '', 'right') . "\n";
        if (!isset($provider_uri)) {
            $provider_uri = 'http://www.squirrelmail.org/';
        }
        if (!isset($provider_name)) {
            $provider_name = 'SquirrelMail';
        }
        echo '<a href="' . $provider_uri . '" target="_blank">' . $provider_name . '</a>';
        echo "</td>\n";
    }
    echo "   </tr>\n" . "</table><br />\n\n";
}
/**
 * Displays error message
 * 
 * Since 1.4.1 function checks if page header is already displayed.
 * 
 * Since 1.4.3 and 1.5.1, this function contains the error_box hook.
 * Use plain_error_message() and make sure that page header is created,
 * if you want compatibility with 1.4.0 and older.
 *
 * In 1.5.2 second function argument is changed. Older functions used it
 * for $color array, new function uses it for optional link data. Function 
 * will ignore color array and use standard colors instead.
 *
 * The $return_output argument was added in 1.5.2
 *
 * @param string $string Error message to be displayed
 * @param array $link Optional array containing link details to be displayed.
 *  Array uses three keys. 'URL' key is required and should contain link URL.
 *  'TEXT' key is optional and should contain link name. 'FRAME' key is 
 *  optional and should contain link target attribute.
 * @param boolean $return_output When TRUE, output is returned to caller
 *                               instead of being sent to browser (OPTIONAL;
 *                               default = FALSE)
 *
 * @since 1.3.2
 */
function error_box($string, $link = NULL, $return_output = FALSE)
{
    global $pageheader_sent, $oTemplate, $org_title;
    $err = _("ERROR");
    do_hook('error_box', $string);
    if (!isset($org_title)) {
        $org_title = 'SquirrelMail';
    }
    // check if the page header has been sent; if not, send it!
    //
    // (however, if $return_output is turned on, the output of this
    // should be being used in some other page, so we don't have
    // to worry about page headers in that case)
    //
    if (!$return_output && empty($pageheader_sent)) {
        displayHtmlHeader($org_title . ': ' . $err);
        $pageheader_sent = TRUE;
        echo create_body();
        // this is template-safe (see create_body() function)
    }
    // Double check the link for everything we need
    if (!is_null($link)) {
        // safety check for older code
        if (isset($link['URL'])) {
            if (!isset($link['FRAME'])) {
                $link['FRAME'] = '';
            }
            if (!isset($link['TEXT'])) {
                $link['TEXT'] = $link['URL'];
            }
        } else {
            // somebody used older error_box() code
            $link = null;
        }
    }
    /** ERROR is pre-translated to avoid multiple translation calls. **/
    $oTemplate->assign('error', $err);
    $oTemplate->assign('errorMessage', $string);
    $oTemplate->assign('link', $link);
    $output = $oTemplate->fetch('error_box.tpl');
    if ($return_output) {
        return $output;
    }
    echo $output;
}
Example #18
0
            $aConfig['search'] = $search['search'];
            $aConfig['charset'] = $search['charset'];
            $aConfig['setindex'] = 1;
            // $what $where = 'search'
            $aMailbox = sqm_api_mailbox_select($imapConnection, $mbx, $aConfig, $aMailboxPref);
            /**
             * Handle form actions like flag / unflag, seen / unseen, delete
             */
            if (sqgetGlobalVar('mailbox', $postMailbox, SQ_POST)) {
                if ($postMailbox === $mbx) {
                    handleMessageListForm($imapConnection, $aMailbox);
                }
            }
            if (fetchMessageHeaders($imapConnection, $aMailbox)) {
                $msgsfound = true;
                echo '<br />';
                asearch_print_mailbox_msgs($imapConnection, $aMailbox, $color);
                flush();
            }
            /* add the mailbox to the cache */
            $mailbox_cache[$aMailbox['NAME']] = $aMailbox;
        }
    }
    if (!$msgsfound) {
        echo '<br />' . html_tag('div', asearch_get_error_display($color, _("No Messages Found")), 'center') . "\n";
    }
}
do_hook('search_bottom');
sqimap_logout($imapConnection);
echo '</body></html>';
sqsession_register($mailbox_cache, 'mailbox_cache');
Example #19
0
    include_once SM_PATH . 'plugins/change_password/backend/' . $cpw_backend . '.php';
}
/* the form was submitted, go for it */
if (sqgetGlobalVar('cpw_go', $cpw_go, SQ_POST)) {
    // security check
    sqgetGlobalVar('smtoken', $submitted_token, SQ_POST, '');
    sm_validate_security_token($submitted_token, -1, TRUE);
    /* perform basic checks */
    $Messages = cpw_check_input();
    /* if no errors, go ahead with the actual change */
    if (count($Messages) == 0) {
        $Messages = cpw_do_change();
    }
}
displayPageHeader($color);
do_hook('change_password_init', $null);
?>

<br />
<table align="center" cellpadding="2" cellspacing="2" border="0">
<tr><td bgcolor="<?php 
echo $color[0];
?>
">
   <div style="text-align: center;"><b><?php 
echo _("Change Password");
?>
</b></div>
</td><?php 
if (isset($Messages) && count($Messages) > 0) {
    echo "<tr><td>\n";
$subject = trim($rfc822_header->subject);
/* we can clean these up if the list is too long... */
$cc = $rfc822_header->getAddr_s('cc');
$to = $rfc822_header->getAddr_s('to');
if ($show_html_default == 1) {
    $ent_ar = $message->findDisplayEntity(array());
} else {
    $ent_ar = $message->findDisplayEntity(array(), array('text/plain'));
}
$body = '';
if ($ent_ar[0] != '') {
    for ($i = 0; $i < count($ent_ar); $i++) {
        $body .= formatBody($imapConnection, $message, $color, $wrap_at, $ent_ar[$i], $passed_id, $mailbox, true);
        $body .= '<hr noshade size="1" />';
    }
    $hookResults = do_hook('message_body', $body);
    $body = $hookResults[1];
} else {
    $body = _("Message not printable");
}
/* now, if they choose to, we clean up the display a bit... */
if ($pf_cleandisplay) {
    $num_leading_spaces = 9;
    // nine leading spaces for indentation
    // sometimes I see ',,' instead of ',' seperating addresses *shrug*
    $cc = pf_clean_string(str_replace(',,', ',', $cc), $num_leading_spaces);
    $to = pf_clean_string(str_replace(',,', ',', $to), $num_leading_spaces);
    // the body should have no leading zeros
    // disabled because it destroys html mail
    //    $body = pf_clean_string($body, 0);
    // clean up everything else...
/**
 * Processes octet-stream attachments.
 * Calls attachment_common-load_mime_types and attachment $type hooks.
 * @param array $Args attachment $type hook arguments
 * @since 1.2.0
 */
function attachment_common_octet_stream(&$Args)
{
    global $FileExtensionToMimeType, $null;
    //FIXME: I propose removing this hook; I don't like having two hooks close together, but moreover, this hook appears to merely give plugins the chance to add to the global $FileExtensionToMimeType variable, which they can do in any hook before now - I'd recommend prefs_backend (which is what config_override used to be) because it's the one hook run at the beginning of almost all page requests in init.php -- the con is that we don't need it run on ALL page requests, do we?  There may be another hook in THIS page request that we can recommend, in which case, we *really should* remove this hook here.
    //FIXME: or at least we can move this hook up to the top of this file where $FileExtensionToMimeType is defined.  What else is this hook here for?  What plugins use it?
    do_hook('attachment_common-load_mime_types', $null);
    preg_match('/\\.([^.]+)$/', $Args[7], $Regs);
    $Ext = '';
    if (is_array($Regs) && isset($Regs[1])) {
        $Ext = $Regs[1];
        $Ext = strtolower($Regs[1]);
    }
    if ($Ext == '' || !isset($FileExtensionToMimeType[$Ext])) {
        return;
    }
    $temp = array(&$Args[0], &$Args[1], &$Args[2], &$Args[3], &$Args[4], &$Args[5], &$Args[6], &$Args[7], &$Args[8]);
    do_hook('attachment ' . $FileExtensionToMimeType[$Ext], $temp);
}
Example #22
0
/** Delete array of domains
 *
 * Deletes a domain by a given id.
 * Function always succeeds. If the field is not found in the database, thats what we want anyway.
 *
 * @param int[] $domains Array of Domain IDs to delete
 *
 * @return boolean true on success, false otherwise
 */
function delete_domains($domains)
{
    global $db;
    global $pdnssec_use;
    $error = false;
    $return = false;
    $response = $db->beginTransaction();
    foreach ($domains as $id) {
        if (do_hook('verify_permission', 'zone_content_edit_others')) {
            $perm_edit = "all";
        } elseif (do_hook('verify_permission', 'zone_content_edit_own')) {
            $perm_edit = "own";
        } else {
            $perm_edit = "none";
        }
        $user_is_zone_owner = do_hook('verify_user_is_owner_zoneid', $id);
        if ($perm_edit == "all" || $perm_edit == "own" && $user_is_zone_owner == "1") {
            if (is_numeric($id)) {
                $zone_type = get_domain_type($id);
                if ($pdnssec_use && $zone_type == 'MASTER') {
                    $zone_name = get_zone_name_from_id($id);
                    dnssec_unsecure_zone($zone_name);
                }
                $db->exec("DELETE FROM zones WHERE domain_id=" . $db->quote($id, 'integer'));
                $db->exec("DELETE FROM domains WHERE id=" . $db->quote($id, 'integer'));
                $db->exec("DELETE FROM records WHERE domain_id=" . $db->quote($id, 'integer'));
                $db->query("DELETE FROM records_zone_templ WHERE domain_id=" . $db->quote($id, 'integer'));
            } else {
                error(sprintf(ERR_INV_ARGC, "delete_domains", "id must be a number"));
                $error = true;
            }
        } else {
            error(ERR_PERM_DEL_ZONE);
            $error = true;
        }
    }
    if (PEAR::isError($response)) {
        $response = $db->rollback();
        $commit = false;
    } else {
        $response = $db->commit();
        $commit = true;
    }
    if (true == $commit && false == $error) {
        $return = true;
    }
    return $return;
}
Example #23
0
/** Modify zone template
 *
 * @param mixed[] $details array of new zone template details
 * @param int $zone_templ_id zone template id
 *
 * @return boolean true on success, false otherwise
 */
function edit_zone_templ($details, $zone_templ_id)
{
    global $db;
    $zone_name_exists = zone_templ_name_exists($details['templ_name'], $zone_templ_id);
    if (!do_hook('verify_permission', 'zone_master_add')) {
        error(ERR_PERM_ADD_ZONE_TEMPL);
        return false;
    } elseif ($zone_name_exists != '0') {
        error(ERR_ZONE_TEMPL_EXIST);
        return false;
    } else {
        $query = "UPDATE zone_templ\n\t\t\tSET name=" . $db->quote($details['templ_name'], 'text') . ",\n\t\t\tdescr=" . $db->quote($details['templ_descr'], 'text') . "\n\t\t\tWHERE id=" . $db->quote($zone_templ_id, 'integer');
        $result = $db->query($query);
        if (PEAR::isError($result)) {
            error($result->getMessage());
            return false;
        }
        return true;
    }
}
Example #24
0
/* Page selector options */
$page_selector = getPref($data_dir, $username, 'page_selector', SMPREF_ON);
$page_selector_max = getPref($data_dir, $username, 'page_selector_max', 10);
/* SqClock now in the core */
$date_format = getPref($data_dir, $username, 'date_format', 3);
$hour_format = getPref($data_dir, $username, 'hour_format', SMPREF_TIME_12HR);
/*  compose in new window setting */
$compose_new_win = getPref($data_dir, $username, 'compose_new_win', 0);
$compose_height = getPref($data_dir, $username, 'compose_height', 550);
$compose_width = getPref($data_dir, $username, 'compose_width', 640);
/* signature placement settings */
$sig_first = getPref($data_dir, $username, 'sig_first', 0);
/* use the internal date of the message for sorting instead of the supplied header date */
$internal_date_sort = getPref($data_dir, $username, 'internal_date_sort', SMPREF_ON);
/* if server sorting is enabled/disabled */
$sort_by_ref = getPref($data_dir, $username, 'sort_by_ref', 1);
/* Load the javascript settings. */
$javascript_setting = getPref($data_dir, $username, 'javascript_setting', SMPREF_JS_AUTODETECT);
$javascript_on = getPref($data_dir, $username, 'javascript_on', SMPREF_ON);
$use_javascript_addr_book = getPref($data_dir, $username, 'use_javascript_addr_book', $default_use_javascript_addr_book);
$search_memory = getPref($data_dir, $username, 'search_memory', 0);
$mailbox_select_style = getPref($data_dir, $username, 'mailbox_select_style', 1);
/* Allow user to customize, and display the full date, instead of day, or time based
   on time distance from date of message */
$show_full_date = getPref($data_dir, $username, 'show_full_date', 0);
/* Allow user to customize length of from field */
$truncate_sender = getPref($data_dir, $username, 'truncate_sender', 50);
/* Allow user to customize length of subject field */
$truncate_subject = getPref($data_dir, $username, 'truncate_subject', 50);
do_hook('loading_prefs');
Example #25
0
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
/**
 * Script that displays list of zone templates
 *
 * @package     Poweradmin
 * @copyright   2007-2010 Rejo Zenger <*****@*****.**>
 * @copyright   2010-2014 Poweradmin Development Team
 * @license     http://opensource.org/licenses/GPL-3.0 GPL
 */
require_once "inc/toolkit.inc.php";
include_once "inc/header.inc.php";
do_hook('verify_permission', 'zone_master_add') ? $perm_zone_master_add = "1" : ($perm_zone_master_add = "0");
$zone_templates = get_list_zone_templ($_SESSION['userid']);
$username = do_hook('get_fullname_from_userid', $_SESSION['userid']);
if ($perm_zone_master_add == "0") {
    error(ERR_PERM_EDIT_ZONE_TEMPL);
} else {
    echo "    <h2>" . _('Zone templates for') . " " . $username . "</h2>\n";
    echo "     <table>\n";
    echo "      <tr>\n";
    echo "       <th>&nbsp;</th>\n";
    echo "       <th>" . _('Name') . "</th>\n";
    echo "       <th>" . _('Description') . "</th>\n";
    echo "      </tr>\n";
    foreach ($zone_templates as $template) {
        echo "      <tr>\n";
        if ($perm_zone_master_add == "1") {
            echo "       <td>\n";
            echo "        <a href=\"edit_zone_templ.php?id=" . $template["id"] . "\"><img src=\"images/edit.gif\" alt=\"[ " . _('Edit template') . " ]\"></a>\n";
Example #26
0
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
/**
 * Script that displays supermasters list
 *
 * @package     Poweradmin
 * @copyright   2007-2010 Rejo Zenger <*****@*****.**>
 * @copyright   2010-2014 Poweradmin Development Team
 * @license     http://opensource.org/licenses/GPL-3.0 GPL
 */
require_once "inc/toolkit.inc.php";
include_once "inc/header.inc.php";
do_hook('verify_permission', 'supermaster_view') ? $perm_sm_view = "1" : ($perm_sm_view = "0");
do_hook('verify_permission', 'supermaster_edit') ? $perm_sm_edit = "1" : ($perm_sm_edit = "0");
$supermasters = get_supermasters();
$num_supermasters = $supermasters == -1 ? 0 : count($supermasters);
echo "     <h2>" . _('List supermasters') . "</h2>\n";
echo "     <table>\n";
echo "      <tr>\n";
echo "       <th>&nbsp;</th>\n";
echo "       <th>" . _('IP address of supermaster') . "</th>\n";
echo "       <th>" . _('Hostname in NS record') . "</th>\n";
echo "       <th>" . _('Account') . "</th>\n";
echo "      </tr>\n";
if ($num_supermasters == "0") {
    echo "      <tr>\n";
    echo "       <td class=\"n\">&nbsp;</td>\n";
    echo "       <td class=\"n\" colspan=\"3\">\n";
    echo "        " . _('There are no zones to show in this listing.') . "\n";
if (isset($_GET['confirm']) && v_num($_GET['confirm'])) {
    $confirm = $_GET['confirm'];
}
if ($record_id == "-1" || $zone_templ_id == "-1") {
    error(ERR_INV_INPUT);
} else {
    $owner = get_zone_templ_is_owner($zone_templ_id, $_SESSION['userid']);
    if ($confirm == '1' && $owner) {
        if (delete_zone_templ_record($record_id)) {
            success(SUC_RECORD_DEL);
        }
    } else {
        $templ_details = get_zone_templ_details($zone_templ_id);
        $record_info = get_zone_templ_record_from_id($record_id);
        echo "     <h2>" . _('Delete record in zone') . " \"" . $templ_details['name'] . "\"</h2>\n";
        if (!do_hook('verify_permission', 'zone_master_add') || !$owner) {
            error(ERR_PERM_DEL_RECORD);
        } else {
            echo "     <table>\n";
            echo "      <tr>\n";
            echo "       <th>Name</th>\n";
            echo "       <th>Type</th>\n";
            echo "       <th>Content</th>\n";
            echo "       <th>Priority</th>\n";
            echo "       <th>TTL</th>\n";
            echo "      </tr>\n";
            echo "      <tr>\n";
            echo "       <td>" . $record_info['name'] . "</td>\n";
            echo "       <td>" . $record_info['type'] . "</td>\n";
            echo "       <td>" . $record_info['content'] . "</td>\n";
            echo "       <td>" . $record_info['prio'] . "</td>\n";
                $pre_defined_color = 1;
                break;
            }
        }
    }
    if (isset($theid) && !isset($message_highlight_list[$theid]['color'])) {
        $selected_choose = TRUE;
    } else {
        if ($pre_defined_color) {
            $selected_predefined = TRUE;
        } else {
            if ($selected_choose == '') {
                $selected_input = TRUE;
            }
        }
    }
    $oTemplate->assign('rule_name', $name);
    $oTemplate->assign('rule_value', $value);
    $oTemplate->assign('rule_field', $field);
    $oTemplate->assign('rule_color', $color);
    $oTemplate->assign('color_radio', $selected_choose ? 1 : ($selected_input ? 2 : 0));
    $oTemplate->assign('color_input', $selected_input ? $color : '');
    echo addForm('options_highlight.php', 'post', 'f', '', '', array(), TRUE) . addHidden('action', 'save');
    if ($action == 'edit') {
        echo addHidden('theid', isset($theid) ? $theid : '');
    }
    $oTemplate->display('options_highlight_addedit.tpl');
    echo "</form>\n";
}
do_hook('options_highlight_bottom', $null);
$oTemplate->display('footer.tpl');
Example #29
0
        }
        if ($use_folder == true) {
            $box[$q] = htmlspecialchars($boxes_all[$i]['unformatted-dm']);
            $box2[$q] = htmlspecialchars(imap_utf7_decode_local($boxes_all[$i]['unformatted-disp']));
            $q++;
        }
    }
    if ($box && $box2) {
        echo addForm('folders_subscribe.php?method=sub') . '<tt><select name="mailbox[]" multiple="multiple" size="8">';
        for ($q = 0; $q < count($box); $q++) {
            echo '         <option value="' . $box[$q] . '">' . $box2[$q] . "</option>\n";
        }
        echo '</select></tt><br /><br />' . '<input type="submit" value="' . _("Subscribe") . "\" />\n" . "</form></td></tr></table><br />\n";
    } else {
        echo _("No folders were found to subscribe to!") . '</td></tr></table>';
    }
} else {
    /* don't perform the list action -- this is much faster */
    echo addForm('folders_subscribe.php?method=sub') . _("Subscribe to:") . '<br />' . '<tt><input type="text" name="mailbox[]" size="35" />' . '<input type="submit" value="' . _("Subscribe") . "\" />\n" . "</form></td></tr></table><br />\n";
}
do_hook('folders_bottom');
?>
    </td></tr>
    </table>
</td></tr>
</table>
<?php 
sqimap_logout($imapConnection);
?>
</body></html>
Example #30
0
            $submit_name = 'submit_folder';
            break;
        case SMOPT_PAGE_ORDER:
            $inside_hook_name = 'options_order_inside';
            $bottom_hook_name = 'options_order_bottom';
            $submit_name = 'submit_order';
            break;
        default:
            $inside_hook_name = '';
            $bottom_hook_name = '';
            $submit_name = 'submit';
    }
    /* If it is not empty, trigger the inside hook. */
    if ($inside_hook_name != '') {
        do_hook($inside_hook_name);
    }
    /* Spit out a submit button. */
    OptionSubmit($submit_name);
    echo '</td></tr></table></form>';
    /* If it is not empty, trigger the bottom hook. */
    if ($bottom_hook_name != '') {
        do_hook($bottom_hook_name);
    }
}
?>
</td></tr>
</table>
</td></tr>
</table>
</body></html>