Exemple #1
0
 /**
  * AJAX验证验证码是否正确
  */
 public function check()
 {
     if (checkcode($_GET['code'])) {
         exit('1');
     }
     exit('0');
 }
/**
 * Parse navigation bar
 *
 * @param boolean $force
 */
function parse_navbar($force = False)
{
    // we hack the template root here as this is the template set of last resort
    $tpl = CreateObject('phpgwapi.Template', dirname(__FILE__), "remove");
    $tpl->set_file('navbar', 'navbar.tpl');
    $tpl->set_block('navbar', 'app', 'apps');
    $navbar = execMethod('phpgwapi.menu.get', 'navbar');
    prepare_navbar($navbar);
    foreach ($navbar as $app => $app_data) {
        if ($app == 'logout') {
            if (isset($GLOBALS['phpgw_info']['user']['apps']['manual'])) {
                $tpl->set_var(array('url' => "javascript:openwindow('" . $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'manual.uimanual.help', 'app' => $GLOBALS['phpgw_info']['flags']['currentapp'], 'section' => isset($GLOBALS['phpgw_info']['apps']['manual']['section']) ? $GLOBALS['phpgw_info']['apps']['manual']['section'] : '', 'referer' => phpgw::get_var('menuaction'))) . "','700','600')", 'text' => lang('help'), 'icon' => $GLOBALS['phpgw']->common->image('manual', 'navbar')));
            }
            $tpl->parse('apps', 'app', true);
        }
        $tpl->set_var(array('url' => $app_data['url'], 'text' => $app_data['text'], 'icon' => $GLOBALS['phpgw']->common->image($app_data['image'][0], $app_data['image'][1])));
        $tpl->parse('apps', 'app', true);
    }
    // Maybe we should create a common function in the phpgw_accounts_shared.inc.php file
    // to get rid of duplicate code.
    if (!isset($GLOBALS['phpgw_info']['user']['lastpasswd_change']) || $GLOBALS['phpgw_info']['user']['lastpasswd_change'] == 0) {
        $api_messages = lang('You are required to change your password during your first login') . '<br> Click this image on the navbar: <img src="' . $GLOBALS['phpgw']->common->image('preferences', 'navbar') . '">';
    } else {
        if ($GLOBALS['phpgw_info']['user']['lastpasswd_change'] < time() - 86400 * 30) {
            $api_messages = lang('it has been more then %1 days since you changed your password', 30);
        }
    }
    // This is gonna change
    if (isset($cd)) {
        $var['messages'] = "<div class=\"warn\">{$api_messages}<br>\n" . checkcode($cd) . "</div>\n";
    }
    if (isset($GLOBALS['phpgw_info']['flags']['app_header'])) {
        $var['current_app_header'] = $GLOBALS['phpgw_info']['flags']['app_header'];
    } else {
        $tpl->set_block('navbar', 'app_header', 'app_header');
        $var['app_header'] = '';
    }
    $tpl->set_var($var);
    $tpl->pfp('out', 'navbar');
    // If the application has a header include, we now include it
    if ((!isset($GLOBALS['phpgw_info']['flags']['noappheader']) || !$GLOBALS['phpgw_info']['flags']['noappheader']) && isset($_GET['menuaction'])) {
        list($app, $class, $method) = explode('.', $_GET['menuaction']);
        if (is_array($GLOBALS[$class]->public_functions) && isset($GLOBALS[$class]->public_functions['header'])) {
            $GLOBALS[$class]->header();
        }
    }
    $GLOBALS['phpgw']->template->set_root(PHPGW_APP_TPL);
    $GLOBALS['phpgw']->hooks->process('after_navbar');
    unset($GLOBALS['phpgw_info']['navbar']);
}
Exemple #3
0
 public function contact()
 {
     $_username = get_cookie('_username');
     if (isset($GLOBALS['submit'])) {
         checkcode($GLOBALS['checkcode']);
         $model_r = $this->db->get_one('model', array('m' => 'guestbook'));
         $formdata = '';
         require get_cache_path('guestbook_add', 'model');
         $form_add = new form_add($model_r['modelid']);
         $formdata = $form_add->execute($GLOBALS['form']);
         $formdata['master_data']['publisher'] = $_username;
         $formdata['master_data']['addtime'] = SYS_TIME;
         $formdata['master_data']['ip'] = get_ip();
         $formdata['master_data']['status'] = 9;
         $this->db->insert($formdata['master_table'], $formdata['master_data']);
         //执行更新
         require get_cache_path('guestbook_update', 'model');
         $form_update = new form_update($model_r['modelid']);
         $form_update->execute($formdata);
         MSG('您的留言已提交,我们将尽快给您回复', HTTP_REFERER, 3000);
     } else {
         $model_r = $this->db->get_one('model', array('m' => 'guestbook'));
         require get_cache_path('guestbook_form', 'model');
         $form_build = new form_build($model_r['modelid']);
         $formdata = $form_build->execute();
         $field_list = '';
         if (is_array($formdata['0'])) {
             foreach ($formdata['0'] as $field => $info) {
                 if ($info['powerful_field']) {
                     continue;
                 }
                 if ($info['formtype'] == 'powerful_field') {
                     foreach ($formdata['0'] as $_fm => $_fm_value) {
                         if ($_fm_value['powerful_field']) {
                             $info['form'] = str_replace('{' . $_fm . '}', $_fm_value['form'], $info['form']);
                         }
                     }
                     foreach ($formdata['1'] as $_fm => $_fm_value) {
                         if ($_fm_value['powerful_field']) {
                             $info['form'] = str_replace('{' . $_fm . '}', $_fm_value['form'], $info['form']);
                         }
                     }
                 }
                 $field_list[] = $info;
             }
         }
         include T('guestbook', 'contact');
     }
 }
Exemple #4
0
 /**
  * 用户登录
  */
 public function login()
 {
     if (isset($_GET['dosubmit'])) {
         $username = isset($_POST['username']) ? trim($_POST['username']) : showmessage(L('nameerror'), HTTP_REFERER, 301);
         $checkcode = isset($_POST['checkcode']) && trim($_POST['checkcode']) ? trim($_POST['checkcode']) : showmessage(L('input_checkcode'), HTTP_REFERER, 301);
         if (!checkcode($checkcode)) {
             showmessage(L('code_error'), HTTP_REFERER, 301);
         }
         // 密码错误剩余重试次数
         $this->times_db = Loader::model('times_model');
         $rtime = $this->times_db->where(array('username' => $username, 'isadmin' => 1))->find();
         $maxloginfailedtimes = S('common/common');
         $maxloginfailedtimes = (int) $maxloginfailedtimes['maxloginfailedtimes'];
         if ($rtime && $rtime['times'] > $maxloginfailedtimes) {
             $minute = 60 - floor((TIME - $rtime['logintime']) / 60);
             showmessage(L('wait_1_hour', array('minute' => $minute)), HTTP_REFERER, 301);
         }
         // 查询帐号
         $r = $this->db->where(array('username' => $username))->find();
         if (!$r) {
             showmessage(L('user_not_exist'), U('admin/index/login'));
         }
         $password = md5(md5(trim($_POST['password'])) . $r['encrypt']);
         if ($r['password'] != $password) {
             if ($rtime && $rtime['times'] < $maxloginfailedtimes) {
                 $times = $maxloginfailedtimes - intval($rtime['times']);
                 $this->times_db->where(array('username' => $username))->update(array('ip' => IP, 'isadmin' => 1, 'times' => '+=1'));
             } else {
                 $this->times_db->where(array('username' => $username, 'isadmin' => 1))->delete();
                 $this->times_db->insert(array('username' => $username, 'ip' => IP, 'isadmin' => 1, 'logintime' => TIME, 'times' => 1));
                 $times = $maxloginfailedtimes;
             }
             Loader::model('admin_login_log_model')->insert(array('username' => $username, 'password' => $_POST['password'], 'ip' => IP, 'time' => date('Y-m-d H-i-s', TIME)));
             showmessage(L('password_error', array('times' => $times)), HTTP_REFERER, 301);
         }
         $this->times_db->where(array('username' => $username))->delete();
         $this->db->where(array('userid' => $r['userid']))->update(array('lastloginip' => IP, 'lastlogintime' => TIME));
         $_SESSION['userid'] = $r['userid'];
         $_SESSION['roleid'] = $r['roleid'];
         $_SESSION['lock_screen'] = 0;
         $cookie_time = TIME + 86400 * 30;
         cookie('admin_username', $username, $cookie_time);
         cookie('userid', $r['userid'], $cookie_time);
         cookie('admin_email', $r['email'], $cookie_time);
         showmessage(L('login_success'), U('admin/index'));
     } else {
         include $this->view('login');
     }
 }
Exemple #5
0
 /**
  * 发送评论信息
  */
 public function post()
 {
     $comment = Loader::lib('comment:comment');
     $id = isset($_GET['id']) && intval($_GET['id']) ? intval($_GET['id']) : '';
     $SITE = S('common/common');
     $username = cookie('_username', $SITE['site_name'] . L('xtcms_friends'));
     $userid = cookie('_userid');
     $setting = S('common/comment');
     if (!empty($setting)) {
         // 是否允许游客
         if (!$setting['guest']) {
             if (!$username || !$userid) {
                 $this->_show_msg(L('landing_users_to_comment'), HTTP_REFERER);
             }
         }
         if ($setting['code']) {
             $code = isset($_POST['code']) && trim($_POST['code']) ? strtolower(trim($_POST['code'])) : $this->_show_msg(L('please_enter_code'), HTTP_REFERER);
             if (!checkcode($code)) {
                 $this->_show_msg(L('code_error'), HTTP_REFERER);
             }
         }
     }
     // 通过API接口调用数据的标题、URL地址
     if (!($data = get_comment_api($this->commentid))) {
         $this->_show_msg(L('illegal_parameters'));
     } else {
         $title = $data['title'];
         $url = $data['url'];
         unset($data);
     }
     if (strpos($url, SITE_URL) === 0) {
         $domain = SITE_URL;
     } else {
         $urls = parse_url($url);
         $domain = $urls['scheme'] . '://' . $urls['host'] . (isset($urls['port']) && !empty($urls['port']) ? ":" . $urls['port'] : '') . '/';
     }
     $content = isset($_POST['content']) && trim($_POST['content']) ? trim($_POST['content']) : $this->_show_msg(L('please_enter_content'), HTTP_REFERER);
     $data = array('userid' => $userid, 'username' => $username, 'content' => $content);
     $comment->add($this->commentid, $data, $id, $title, $url);
     $this->_show_msg($comment->get_error() . "<iframe width='0' id='top_src' height='0' src='{$domain}/js.html?200'></iframe>", in_array($comment->msg_code, array(0, 7)) ? HTTP_REFERER : '', in_array($comment->msg_code, array(0, 7)) ? 1 : 0);
 }
function parse_navbar($force = False)
{
    $GLOBALS['jerryr_tpl'] = createobject('phpgwapi.Template', PHPGW_TEMPLATE_DIR);
    $GLOBALS['jerryr_tpl']->set_file(array('navbar' => 'navbar.tpl'));
    $GLOBALS['jerryr_tpl']->set_block('navbar', 'navbar_header', 'navbar_header');
    $GLOBALS['jerryr_tpl']->set_block('navbar', 'extra_blocks_header', 'extra_block_header');
    $GLOBALS['jerryr_tpl']->set_block('navbar', 'extra_block_row', 'extra_block_row');
    $GLOBALS['jerryr_tpl']->set_block('navbar', 'extra_block_spacer', 'extra_block_spacer');
    $GLOBALS['jerryr_tpl']->set_block('navbar', 'extra_blocks_footer', 'extra_blocks_footer');
    $GLOBALS['jerryr_tpl']->set_block('navbar', 'sidebox_hide_header', 'sidebox_hide_header');
    $GLOBALS['jerryr_tpl']->set_block('navbar', 'sidebox_hide_footer', 'sidebox_hide_footer');
    $GLOBALS['jerryr_tpl']->set_block('navbar', 'appbox', 'appbox');
    $GLOBALS['jerryr_tpl']->set_block('navbar', 'navbar_footer', 'navbar_footer');
    $var['img_root'] = $GLOBALS['phpgw_info']['server']['webserver_url'] . '/phpgwapi/templates/jerryr/images';
    $var['table_bg_color'] = $GLOBALS['phpgw_info']['theme']['navbar_bg'];
    if ($GLOBALS['phpgw_info']['user']['preferences']['common']['click_or_onmouseover'] == 'onmouseover') {
        $show_menu_event = 'onMouseOver';
    } else {
        $show_menu_event = 'onClick';
    }
    $applications = '';
    //	== 'icons_and_text')
    $max_icons = $GLOBALS['phpgw_info']['user']['preferences']['common']['max_icons'];
    if (!$max_icons) {
        $max_icons = 200;
    }
    foreach ($GLOBALS['phpgw_info']['navbar'] as $app => $app_data) {
        if ($app != 'preferences' && $app != 'about' && $app != 'logout') {
            $title = $GLOBALS['phpgw_info']['apps'][$app]['title'];
            $icon = '<img src="' . $app_data['icon'] . '" alt="' . $title . '" title="' . $title . '" border="0" />';
            if ($app == 'home') {
                $title = lang('home');
                $icon = '<img src="' . $app_data['icon'] . '" alt="' . lang('home') . '" title="' . lang('home') . '" border="0" />';
            }
            if ($i < $max_icons) {
                if ($GLOBALS['phpgw_info']['user']['preferences']['common']['start_and_logout_icons'] == 'no') {
                    $tdwidth = 100 / $max_icons;
                } else {
                    $tdwidth = 100 / ($max_icons + 2);
                }
                $app_icons .= '<td height="40" valign="bottom" align="center"><a href="' . $app_data['url'] . '"';
                if (isset($GLOBALS['phpgw_info']['flags']['navbar_target']) && $GLOBALS['phpgw_info']['flags']['navbar_target']) {
                    $app_icons .= ' target="' . $GLOBALS['phpgw_info']['flags']['navbar_target'] . '"';
                }
                $app_icons .= $app_data['target'] . '>' . $icon . '</a></td>';
                $app_titles .= '<td align=center valign="top" class="appTitles"><a href="' . $app_data['url'] . '"';
                if (isset($GLOBALS['phpgw_info']['flags']['navbar_target']) && $GLOBALS['phpgw_info']['flags']['navbar_target']) {
                    $app_titles .= ' target="' . $GLOBALS['phpgw_info']['flags']['navbar_target'] . '"';
                }
                $app_titles .= $app_data['target'] . '>' . $title . '</a></td>';
            } else {
                // check for small icon version else use default and let the browser resize
                $icon = '<img src="' . $app_data['icon'] . '" alt="' . $title . '" width="16" title="' . $title . '" border="0" />';
                $app_extra_icons .= '<tr>';
                if ($GLOBALS['phpgw_info']['user']['preferences']['common']['navbar_format'] != 'text') {
                    $app_extra_icons .= '<td class="extraIconsRow"><a href="' . $app_data['url'] . '"';
                    if (isset($GLOBALS['phpgw_info']['flags']['navbar_target']) && $GLOBALS['phpgw_info']['flags']['navbar_target']) {
                        $app_extra_icons .= ' target="' . $GLOBALS['phpgw_info']['flags']['navbar_target'] . '"';
                    }
                    $app_extra_icons .= ' >' . $icon . '</a></td>';
                }
                //					$app_extra_icons .= '<tr><td><a href="' . $app_data['url'] . '"';
                //					if(isset($GLOBALS['phpgw_info']['flags']['navbar_target']) && $GLOBALS['phpgw_info']['flags']['navbar_target'])
                //					{
                //						$app_extra_icons .= ' target="' . $GLOBALS['phpgw_info']['flags']['navbar_target'] . '"';
                //					}
                //					$app_extra_icons .= '>' . $icon . '</a></td>';
                $app_extra_icons .= '<td align="left" class="extraIconsRow" style=""><a href="' . $app_data['url'] . '"';
                if (isset($GLOBALS['phpgw_info']['flags']['navbar_target']) && $GLOBALS['phpgw_info']['flags']['navbar_target']) {
                    $app_extra_icons .= ' target="' . $GLOBALS['phpgw_info']['flags']['navbar_target'] . '"';
                }
                $app_extra_icons .= '>' . $title . '</a></td></tr>';
            }
            unset($icon);
            unset($title);
            $i++;
        }
    }
    if ($GLOBALS['phpgw_info']['user']['preferences']['common']['start_and_logout_icons'] != 'no') {
        $app_icons .= '<td width="' . $tdwidth . '%" height="32" valign="bottom" align="center" style="text-align:center"><a 
href="' . $GLOBALS['phpgw_info']['navbar']['logout']['url'] . '"><img src="' . $GLOBALS['phpgw_info']['navbar']['logout']['icon'] . '" title="' . $GLOBALS['phpgw_info']['navbar']['logout']['title'] . '" alt="' . $GLOBALS['phpgw_info']['navbar']['logout']['title'] . '"></a></td>';
        $app_titles .= '<td align="center" valign="top" class="appTitles" style="text-align:center"><a href="' . $GLOBALS['phpgw_info']['navbar']['logout']['url'] . '">' . $GLOBALS['phpgw_info']['navbar']['logout']['title'] . '</a></td>';
    }
    //			$var['app_icons'] = $app_icons;
    if ($GLOBALS['phpgw_info']['user']['preferences']['common']['navbar_format'] != 'text') {
        $var['app_icons'] = $app_icons;
    }
    if ($i > $max_icons) {
        $app_extra_icons_div = '
				<script language="javascript">
				new ypSlideOutMenu("menu1", "down", 10, 90, 160, 200,\'right\')
				</script>
				<div id="menu1Container">
				<div id="menu1Content" style="position: relative; left: 0; text-align: left;">

				<div id="extraIcons">
				<table cellspacing="0" cellpadding="0" border="0" width="100%">
				<tr><td colspan="2" nowrap="nowrap" align="right" style="background-color:#dddddd;padding:1px;">
				<a href="#" ' . $show_menu_event . '="ypSlideOutMenu.hide(\'menu1\')" title="' . lang('close') . '">
				<img style="" border="0" src="' . $var['img_root'] . '/close.png"/></a></td></tr>
				' . $app_extra_icons . '					</table>
				</div>

				</div>
				</div>
				';
        $var['app_extra_icons_div'] = $app_extra_icons_div;
        //			$var['app_extra_icons_icon']= '<td width="26" valign="top" align="right" style="padding-right:3px;padding-top:30px;"><a title="'.lang('show_more_apps').'" href="javascript:void(0);" onClick="HideShow(\'extraIcons\');"><img src="'.$var['img_root'].'/extra_icons.png" border="0" /></a></td>';
        $var['app_extra_icons_icon'] = '<td width="26" valign="top" align="right" style="padding-right:3px;padding-top:30px;"><a title="' . lang('show_more_apps') . '" href="#"  ' . $show_menu_event . '="ypSlideOutMenu.showMenu(\'menu1\')"><img src="' . $var['img_root'] . '/extra_icons.png" border="0" /></a></td>';
    }
    if ($GLOBALS['phpgw_info']['user']['preferences']['common']['navbar_format'] != 'icons') {
        $var['app_titles'] = $app_titles;
    } else {
        $var['app_titles'] = '<td colspan="' . $max_icons . '">&nbsp;</td>';
    }
    if (isset($GLOBALS['phpgw_info']['flags']['app_header'])) {
        $var['current_app_title'] = $GLOBALS['phpgw_info']['flags']['app_header'];
    } else {
        $var['current_app_title'] = $GLOBALS['phpgw_info']['navbar'][$GLOBALS['phpgw_info']['flags']['currentapp']]['title'];
    }
    if (isset($GLOBALS['phpgw_info']['navbar']['admin']) && $GLOBALS['phpgw_info']['user']['preferences']['common']['show_currentusers']) {
        $var['current_users'] = '<a href="' . $GLOBALS['phpgw']->link('/index.php', 'menuaction=admin.uicurrentsessions.list_sessions') . '">' . lang('Current users') . ': ' . $GLOBALS['phpgw']->session->total() . '</a>';
    }
    $now = time();
    $var['user_info'] = '<b>' . $GLOBALS['phpgw']->common->display_fullname() . '</b>' . ' - ' . lang($GLOBALS['phpgw']->common->show_date($now, 'l')) . ' ' . $GLOBALS['phpgw']->common->show_date($now, $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
    if ($GLOBALS['phpgw_info']['user']['lastpasswd_change'] == 0) {
        $api_messages = lang('You are required to change your password during your first login') . '<br> Click this image on the navbar: <img src="' . $GLOBALS['phpgw']->common->image('preferences', 'navbar.gif') . '">';
    } elseif ($GLOBALS['phpgw_info']['user']['lastpasswd_change'] < time() - 86400 * 30) {
        $api_messages = lang('it has been more then %1 days since you changed your password', 30);
    }
    // This is gonna change
    if (isset($cd)) {
        $var['messages'] = $api_messages . '<br>' . checkcode($cd);
    }
    if (substr($GLOBALS['phpgw_info']['server']['login_logo_file'], 0, 4) == 'http') {
        $var['logo_file'] = $GLOBALS['phpgw_info']['server']['login_logo_file'];
    } else {
        $var['logo_file'] = $GLOBALS['phpgw']->common->image('phpgwapi', $GLOBALS['phpgw_info']['server']['login_logo_file'] ? $GLOBALS['phpgw_info']['server']['login_logo_file'] : 'logo');
    }
    $var['logo_url'] = $GLOBALS['phpgw_info']['server']['login_logo_url'] ? $GLOBALS['phpgw_info']['server']['login_logo_url'] : 'http://www.eGroupWare.org';
    if (substr($var['logo_url'], 0, 4) != 'http') {
        $var['logo_url'] = 'http://' . $var['logo_url'];
    }
    $var['logo_title'] = $GLOBALS['phpgw_info']['server']['login_logo_title'] ? $GLOBALS['phpgw_info']['server']['login_logo_title'] : 'www.eGroupWare.org';
    $GLOBALS['jerryr_tpl']->set_var($var);
    $GLOBALS['jerryr_tpl']->pfp('out', 'navbar_header');
    /******************************************************\
    			* The sidebox menu's                                   *
    			\******************************************************/
    $menu_title = lang('General Menu');
    $file['Home'] = $GLOBALS['phpgw_info']['navbar']['home']['url'];
    if ($GLOBALS['phpgw_info']['user']['apps']['preferences']) {
        $file['Preferences'] = $GLOBALS['phpgw_info']['navbar']['preferences']['url'];
    }
    $file += array(array('text' => lang('About %1', $GLOBALS['phpgw_info']['apps'][$GLOBALS['phpgw_info']['flags']['currentapp']]['title']), 'no_lang' => True, 'link' => $GLOBALS['phpgw_info']['navbar']['about']['url']), 'Logout' => $GLOBALS['phpgw_info']['navbar']['logout']['url']);
    if ($GLOBALS['phpgw_info']['user']['preferences']['common']['auto_hide_sidebox'] == 1) {
        $GLOBALS['jerryr_tpl']->set_var('show_menu_event', $show_menu_event);
        $GLOBALS['jerryr_tpl']->pparse('out', 'sidebox_hide_header');
        display_sidebox('', $menu_title, $file);
        $GLOBALS['phpgw']->hooks->single('sidebox_menu', $GLOBALS['phpgw_info']['flags']['currentapp']);
        $GLOBALS['jerryr_tpl']->pparse('out', 'sidebox_hide_footer');
        $var['sideboxcolstart'] = '';
        $GLOBALS['jerryr_tpl']->set_var($var);
        $GLOBALS['jerryr_tpl']->pparse('out', 'appbox');
        $var['remove_padding'] = 'style="padding-left:0px;"';
        $var['sideboxcolend'] = '';
    } else {
        $var['menu_link'] = '';
        $var['sideboxcolstart'] = '<td id="tdSidebox" valign="top">';
        $var['remove_padding'] = '';
        $GLOBALS['jerryr_tpl']->set_var($var);
        $GLOBALS['jerryr_tpl']->pparse('out', 'appbox');
        display_sidebox('', $menu_title, $file);
        $GLOBALS['phpgw']->hooks->single('sidebox_menu', $GLOBALS['phpgw_info']['flags']['currentapp']);
        $var['sideboxcolend'] = '</td>';
    }
    $GLOBALS['jerryr_tpl']->set_var($var);
    $GLOBALS['jerryr_tpl']->pparse('out', 'navbar_footer');
    // If the application has a header include, we now include it
    if (!@$GLOBALS['phpgw_info']['flags']['noappheader'] && @isset($_GET['menuaction'])) {
        list($app, $class, $method) = explode('.', $_GET['menuaction']);
        if (is_array($GLOBALS[$class]->public_functions) && $GLOBALS[$class]->public_functions['header']) {
            $GLOBALS[$class]->header();
        }
    }
    $GLOBALS['phpgw']->hooks->process('after_navbar');
    return;
}
<?php

defined("ZHANGXUAN") or die("no hacker.");
$resetpsdpostdataerror = -1;
//1:隐藏数据用户ID和令牌错误,2邮箱错误,3两个密码不同,4用户不存在,5令牌失效
if ($resetmod == 2) {
    if (ctype_digit($_POST["user_id"]) && checkcode($_POST['user_token'])) {
        $emailadd = db_iconv('oldPassword');
        if (valid_email($emailadd)) {
            $userid = $_POST["user_id"];
            $usertoken = $_POST['user_token'];
            $passwordA = db_iconv('newPassword');
            $passwordB = db_iconv('newPasswordVerify');
            if ($passwordA == $passwordB) {
                $unmd5newpassword = getunencryptpass($passwordA);
                $newpassword = md5($unmd5newpassword);
                $sql = "SELECT * FROM `users` WHERE `user_id`='{$userid}'";
                $row = queryRow($sql);
                if ($row) {
                    $username = $row['user_name'];
                    if ($usertoken == $row['user_psd_reset_token'] && $row['user_psd_reset_token_used'] == 0) {
                        $newtoken = randstr();
                        $sql = "UPDATE `users` SET `user_pass`='{$newpassword}',`user_psd_reset_token`='{$newtoken}',`user_psd_reset_token_used`=1 WHERE `user_id`='{$userid}'";
                        update($sql);
                        if (isset($_COOKIE['loginname']) && isset($_COOKIE['loginid']) && $_COOKIE['loginname'] != "" && $_COOKIE['loginid'] != "") {
                            $usertmp = mysqli_real_escape_string($dbconnect, htmlspecialchars($_COOKIE['loginname']));
                            $cookievalue = mysqli_real_escape_string($dbconnect, htmlspecialchars($_COOKIE['loginid'], ENT_QUOTES));
                            $sql = "DELETE FROM `cookiedata` WHERE `user_name`='{$usertmp}' AND `user_cookie` ='{$cookievalue}'";
                            delete($sql);
                        }
                        if (isset($_SESSION['loginuser']) && $_SESSION['loginuser'] != "") {
/**
 * Defined bounce parsing rules for standard DSN (Delivery Status Notification)
 *
 * @param string $dsn_msg           human-readable explanation
 * @param string $dsn_report        delivery-status report
 * @param boolean $debug_mode        show debug info. or not
 * @return array    $result an array include the following fields: 'email', 'bounce_type','remove','rule_no','rule_cat'
 *                      if we could NOT detect the type of bounce, return rule_no = '0000'
 * @author  Kevin : Wed Sep 06 15:22:22 PDT 2006
 */
function bmhDSNRules($dsn_msg, $dsn_report, $debug_mode = false)
{
    // initial the result array
    $result = array('email' => '', 'bounce_type' => false, 'remove' => 0, 'rule_cat' => 'unrecognized', 'rule_no' => '0000', 'dsn_msg' => wrapmsg($dsn_msg), 'dsn_report' => wrapmsg($dsn_report));
    $action = false;
    $status_code = false;
    $diag_code = false;
    // ======= parse $dsn_report ======
    // get the recipient email
    if (preg_match("/Original-Recipient: rfc822;(.*)/i", $dsn_report, $match)) {
        // TRICKY : or using the regex written by myself : /Original-Recipient: rfc822;(?:.*<| *)(\S+@\S+\w)/i
        $email_arr = imap_rfc822_parse_adrlist($match[1], 'default.domain.name');
        if (isset($email_arr[0]->host) && $email_arr[0]->host != '.SYNTAX-ERROR.' && $email_arr[0]->host != 'default.domain.name') {
            $result['dsn_original_rcpt'] = $email_arr[0]->mailbox . '@' . $email_arr[0]->host;
        }
    }
    if (preg_match("/Final-Recipient: rfc822;(.*)/i", $dsn_report, $match)) {
        $email_arr = imap_rfc822_parse_adrlist($match[1], 'default.domain.name');
        if (isset($email_arr[0]->host) && $email_arr[0]->host != '.SYNTAX-ERROR.' && $email_arr[0]->host != 'default.domain.name') {
            $result['dsn_final_rcpt'] = $email_arr[0]->mailbox . '@' . $email_arr[0]->host;
        }
    }
    if (!empty($result['dsn_original_rcpt'])) {
        $result['email'] = $result['dsn_original_rcpt'];
    } else {
        if (!empty($result['dsn_final_rcpt'])) {
            $result['email'] = $result['dsn_final_rcpt'];
        }
    }
    if (!empty($result['email'])) {
        if ($result['email'] == $result['dsn_original_rcpt']) {
            $result['dsn_original_rcpt'] = '-';
        }
        if ($result['email'] == $result['dsn_final_rcpt']) {
            $result['dsn_final_rcpt'] = '-';
        }
    }
    if (preg_match("/Action: (.+)/i", $dsn_report, $match)) {
        $action = strtolower(trim($match[1]));
    }
    if (preg_match("/Status: ([0-9\\.]+)/i", $dsn_report, $match)) {
        $status_code = $match[1];
    }
    // TRICKY : could be multi-line , if the new line is beginning with SPACE or HTAB
    if (preg_match("/Diagnostic-Code:((?:[^\n]|\n[\t ])+)(?:\n[^\t ]|\$)/is", $dsn_report, $match)) {
        $diag_code = $match[1];
    }
    // ======= rules ======
    if (empty($result['email'])) {
        // email address is empty
        // rule : full
        // sample:   DSN Message only
        //
        //User quota exceeded: SMTP <*****@*****.**>
        //
        if (preg_match("/quota exceed.*<(\\S+@\\S+\\w)>/is", $dsn_msg, $match)) {
            $result['rule_cat'] = 'full';
            $result['rule_no'] = '0161';
            $result['email'] = $match[1];
        }
    } else {
        // action could be one of them as RFC:1894
        // "failed" / "delayed" / "delivered" / "relayed" / "expanded"
        switch ($action) {
            case 'failed':
                $result['rule_cat'] = 'dsn_failed';
                $result['rule_no'] = '9999';
                $code = explode('.', $status_code);
                if (checkcode($code, 4)) {
                    // 4.X.X Persistent Transient Failure
                    // A persistent transient failure is one in which the message as sent
                    // is valid, but some temporary event prevents the successful sending
                    // of the message. Sending in the future may be successful.
                    $result['rule_cat'] = 'delayed';
                    $result['rule_no'] = '0245';
                } elseif (checkcode($code, 5, 1)) {
                    // 5.1.0 Other address status
                    // 5.1.1 Bad destination mailbox address
                    // 5.1.2 Bad destination system address
                    // 5.1.3 Bad destination mailbox address syntax
                    // 5.1.4 Destination mailbox address ambiguous
                    // 5.1.5 Destination mailbox address valid
                    // 5.1.6 Mailbox has moved
                    // 5.1.7 Bad sender's mailbox address syntax
                    // 5.1.8 Bad sender's system address
                    $result['rule_cat'] = 'unknown';
                    $result['rule_no'] = '0244';
                } elseif (checkcode($code, 5, 4, 4)) {
                    //Unable to route
                    $result['rule_cat'] = 'dns_unknown';
                    $result['rule_no'] = '0241';
                } else {
                    if (checkcode($code, 5, 2)) {
                        // 5.2.0 Other or undefined mailbox status
                        // 5.2.1 Mailbox disabled, not accepting messages
                        // 5.2.2 Mailbox full
                        // 5.2.3 Message length exceeds administrative limit.
                        // 5.2.4 Mailing list expansion problem
                        switch ($code[0]) {
                            case 0:
                            case 1:
                                $result['rule_cat'] = 'inactive';
                                $result['rule_no'] = '0247';
                                break;
                            case 2:
                                $result['rule_cat'] = 'full';
                                $result['rule_no'] = '0242';
                                break;
                            case 3:
                                $result['rule_cat'] = 'oversize';
                                $result['rule_no'] = '0246';
                                break;
                            case 4:
                                break;
                            default:
                                break;
                        }
                    } else {
                        if (checkcode($code, 5, 7)) {
                            // 5.7.0 Other or undefined security status
                            // 5.7.1 Delivery not authorized, message refused
                            // 5.7.2 Mailing list expansion prohibited
                            // 5.7.3 Security conversion required but not possible
                            // 5.7.4 Security features not supported
                            // 5.7.5 Cryptographic failure
                            // 5.7.6 Cryptographic algorithm not supported
                            // 5.7.7 Message integrity failure
                            switch ($code[2]) {
                                case 1:
                                    $result['rule_cat'] = 'antispam';
                                    $result['rule_no'] = '0243';
                                    break;
                                default:
                                    break;
                            }
                        } elseif (preg_match("/over.*quota/is", $diag_code)) {
                            $result['rule_cat'] = 'full';
                            $result['rule_no'] = '0105';
                        } elseif (preg_match("/exceed.*quota/is", $diag_code)) {
                            $result['rule_cat'] = 'full';
                            $result['rule_no'] = '0129';
                        } elseif (preg_match("/quota.*exceed/is", $diag_code)) {
                            $result['rule_cat'] = 'full';
                            $result['rule_no'] = '0250';
                        } elseif (preg_match("/(?:alias|account|recipient|address|email|mailbox|user).*full/is", $diag_code)) {
                            $result['rule_cat'] = 'full';
                            $result['rule_no'] = '0145';
                        } elseif (preg_match("/Insufficient system storage/is", $diag_code)) {
                            $result['rule_cat'] = 'full';
                            $result['rule_no'] = '0134';
                        } elseif (preg_match("/File too large/is", $diag_code)) {
                            $result['rule_cat'] = 'full';
                            $result['rule_no'] = '0192';
                        } elseif (preg_match("/larger than.*limit/is", $diag_code)) {
                            $result['rule_cat'] = 'oversize';
                            $result['rule_no'] = '0146';
                        } elseif (preg_match("/(?:alias|account|recipient|address|email|mailbox|user)(.*)not(.*)list/is", $diag_code)) {
                            $result['rule_cat'] = 'unknown';
                            $result['rule_no'] = '0103';
                        } elseif (preg_match("/user path no exist/is", $diag_code)) {
                            $result['rule_cat'] = 'unknown';
                            $result['rule_no'] = '0106';
                        } elseif (preg_match("/Relay.*(?:denied|prohibited)/is", $diag_code)) {
                            $result['rule_cat'] = 'unknown';
                            $result['rule_no'] = '0108';
                        } elseif (preg_match("/no.*valid.*(?:alias|account|recipient|address|email|mailbox|user)/is", $diag_code)) {
                            $result['rule_cat'] = 'unknown';
                            $result['rule_no'] = '0185';
                        } elseif (preg_match("/Invalid.*(?:alias|account|recipient|address|email|mailbox|user)/is", $diag_code)) {
                            $result['rule_cat'] = 'unknown';
                            $result['rule_no'] = '0111';
                        } elseif (preg_match("/(?:alias|account|recipient|address|email|mailbox|user).*(?:disabled|discontinued)/is", $diag_code)) {
                            $result['rule_cat'] = 'unknown';
                            $result['rule_no'] = '0114';
                        } elseif (preg_match("/user doesn't have.*account/is", $diag_code)) {
                            $result['rule_cat'] = 'unknown';
                            $result['rule_no'] = '0127';
                        } elseif (preg_match("/(?:unknown|illegal).*(?:alias|account|recipient|address|email|mailbox|user)/is", $diag_code)) {
                            $result['rule_cat'] = 'unknown';
                            $result['rule_no'] = '0128';
                        } elseif (preg_match("/(?:alias|account|recipient|address|email|mailbox|user).*(?:un|not\\s+)available/is", $diag_code)) {
                            $result['rule_cat'] = 'unknown';
                            $result['rule_no'] = '0122';
                        } elseif (preg_match("/no (?:alias|account|recipient|address|email|mailbox|user)/is", $diag_code)) {
                            $result['rule_cat'] = 'unknown';
                            $result['rule_no'] = '0123';
                        } elseif (preg_match("/(?:alias|account|recipient|address|email|mailbox|user).*unknown/is", $diag_code)) {
                            $result['rule_cat'] = 'unknown';
                            $result['rule_no'] = '0125';
                        } elseif (preg_match("/(?:alias|account|recipient|address|email|mailbox|user).*disabled/is", $diag_code)) {
                            $result['rule_cat'] = 'unknown';
                            $result['rule_no'] = '0133';
                        } elseif (preg_match("/No such (?:alias|account|recipient|address|email|mailbox|user)/is", $diag_code)) {
                            $result['rule_cat'] = 'unknown';
                            $result['rule_no'] = '0143';
                        } elseif (preg_match("/(?:alias|account|recipient|address|email|mailbox|user).*NOT FOUND/is", $diag_code)) {
                            $result['rule_cat'] = 'unknown';
                            $result['rule_no'] = '0136';
                        } elseif (preg_match("/deactivated (?:alias|account|recipient|address|email|mailbox|user)/is", $diag_code)) {
                            $result['rule_cat'] = 'unknown';
                            $result['rule_no'] = '0138';
                        } elseif (preg_match("/(?:alias|account|recipient|address|email|mailbox|user).*reject/is", $diag_code)) {
                            $result['rule_cat'] = 'unknown';
                            $result['rule_no'] = '0148';
                        } elseif (preg_match("/bounce.*administrator/is", $diag_code)) {
                            $result['rule_cat'] = 'unknown';
                            $result['rule_no'] = '0151';
                        } elseif (preg_match("/<.*>.*disabled/is", $diag_code)) {
                            $result['rule_cat'] = 'unknown';
                            $result['rule_no'] = '0152';
                        } elseif (preg_match("/not our customer/is", $diag_code)) {
                            $result['rule_cat'] = 'unknown';
                            $result['rule_no'] = '0154';
                        } elseif (preg_match("/Wrong (?:alias|account|recipient|address|email|mailbox|user)/is", $diag_code)) {
                            $result['rule_cat'] = 'unknown';
                            $result['rule_no'] = '0159';
                        } elseif (preg_match("/(?:unknown|bad).*(?:alias|account|recipient|address|email|mailbox|user)/is", $diag_code)) {
                            $result['rule_cat'] = 'unknown';
                            $result['rule_no'] = '0160';
                        } elseif (preg_match("/(?:alias|account|recipient|address|email|mailbox|user).*not OK/is", $diag_code)) {
                            $result['rule_cat'] = 'unknown';
                            $result['rule_no'] = '0186';
                        } elseif (preg_match("/Access.*Denied/is", $diag_code)) {
                            $result['rule_cat'] = 'unknown';
                            $result['rule_no'] = '0189';
                        } elseif (preg_match("/(?:alias|account|recipient|address|email|mailbox|user).*lookup.*fail/is", $diag_code)) {
                            $result['rule_cat'] = 'unknown';
                            $result['rule_no'] = '0195';
                        } elseif (preg_match("/(?:recipient|address|email|mailbox|user).*not.*member of domain/is", $diag_code)) {
                            $result['rule_cat'] = 'unknown';
                            $result['rule_no'] = '0198';
                        } elseif (preg_match("/(?:alias|account|recipient|address|email|mailbox|user).*cannot be verified/is", $diag_code)) {
                            $result['rule_cat'] = 'unknown';
                            $result['rule_no'] = '0202';
                        } elseif (preg_match("/Unable to relay/is", $diag_code)) {
                            $result['rule_cat'] = 'unknown';
                            $result['rule_no'] = '0203';
                        } elseif (preg_match("/(?:alias|account|recipient|address|email|mailbox|user).*(?:n't|not) exist/is", $diag_code)) {
                            $result['rule_cat'] = 'unknown';
                            $result['rule_no'] = '0205';
                        } elseif (preg_match("/not have an account/is", $diag_code)) {
                            $result['rule_cat'] = 'unknown';
                            $result['rule_no'] = '0207';
                        } elseif (preg_match("/(?:alias|account|recipient|address|email|mailbox|user).*is not allowed/is", $diag_code)) {
                            $result['rule_cat'] = 'unknown';
                            $result['rule_no'] = '0220';
                        } elseif (preg_match("/inactive.*(?:alias|account|recipient|address|email|mailbox|user)/is", $diag_code)) {
                            $result['rule_cat'] = 'inactive';
                            $result['rule_no'] = '0135';
                        } elseif (preg_match("/(?:alias|account|recipient|address|email|mailbox|user).*Inactive/is", $diag_code)) {
                            $result['rule_cat'] = 'inactive';
                            $result['rule_no'] = '0155';
                        } elseif (preg_match("/(?:alias|account|recipient|address|email|mailbox|user) closed due to inactivity/is", $diag_code)) {
                            $result['rule_cat'] = 'inactive';
                            $result['rule_no'] = '0170';
                        } elseif (preg_match("/(?:alias|account|recipient|address|email|mailbox|user) not activated/is", $diag_code)) {
                            $result['rule_cat'] = 'inactive';
                            $result['rule_no'] = '0177';
                        } elseif (preg_match("/(?:alias|account|recipient|address|email|mailbox|user).*(?:suspend|expire)/is", $diag_code)) {
                            $result['rule_cat'] = 'inactive';
                            $result['rule_no'] = '0183';
                        } elseif (preg_match("/(?:alias|account|recipient|address|email|mailbox|user).*no longer exist/is", $diag_code)) {
                            $result['rule_cat'] = 'inactive';
                            $result['rule_no'] = '0184';
                        } elseif (preg_match("/(?:forgery|abuse)/is", $diag_code)) {
                            $result['rule_cat'] = 'inactive';
                            $result['rule_no'] = '0196';
                        } elseif (preg_match("/(?:alias|account|recipient|address|email|mailbox|user).*restrict/is", $diag_code)) {
                            $result['rule_cat'] = 'inactive';
                            $result['rule_no'] = '0209';
                        } elseif (preg_match("/(?:alias|account|recipient|address|email|mailbox|user).*locked/is", $diag_code)) {
                            $result['rule_cat'] = 'inactive';
                            $result['rule_no'] = '0228';
                        } elseif (preg_match("/recipient never logged/is", $diag_code)) {
                            $result['rule_cat'] = 'inactive';
                            $result['rule_no'] = '0252';
                        } elseif (preg_match("/(?:alias|account|recipient|address|email|mailbox|user) refused/is", $diag_code)) {
                            $result['rule_cat'] = 'user_reject';
                            $result['rule_no'] = '0156';
                        } elseif (preg_match("/sender.*not/is", $diag_code)) {
                            $result['rule_cat'] = 'user_reject';
                            $result['rule_no'] = '0206';
                        } elseif (preg_match("/Message refused/is", $diag_code)) {
                            $result['rule_cat'] = 'command_reject';
                            $result['rule_no'] = '0175';
                        } elseif (preg_match("/No permit/is", $diag_code)) {
                            $result['rule_cat'] = 'command_reject';
                            $result['rule_no'] = '0190';
                        } elseif (preg_match("/domain isn't in.*allowed rcpthost/is", $diag_code)) {
                            $result['rule_cat'] = 'command_reject';
                            $result['rule_no'] = '0191';
                        } elseif (preg_match("/AUTH FAILED/is", $diag_code)) {
                            $result['rule_cat'] = 'command_reject';
                            $result['rule_no'] = '0197';
                        } elseif (preg_match("/relay.*not.*(?:permit|allow)/is", $diag_code)) {
                            $result['rule_cat'] = 'command_reject';
                            $result['rule_no'] = '0201';
                        } elseif (preg_match("/not local host/is", $diag_code)) {
                            $result['rule_cat'] = 'command_reject';
                            $result['rule_no'] = '0204';
                        } elseif (preg_match("/Unauthorized relay/is", $diag_code)) {
                            $result['rule_cat'] = 'command_reject';
                            $result['rule_no'] = '0215';
                        } elseif (preg_match("/Transaction.*fail/is", $diag_code)) {
                            $result['rule_cat'] = 'command_reject';
                            $result['rule_no'] = '0221';
                        } elseif (preg_match("/Invalid data/is", $diag_code)) {
                            $result['rule_cat'] = 'command_reject';
                            $result['rule_no'] = '0223';
                        } elseif (preg_match("/Local user only/is", $diag_code)) {
                            $result['rule_cat'] = 'command_reject';
                            $result['rule_no'] = '0224';
                        } elseif (preg_match("/not.*permit.*to/is", $diag_code)) {
                            $result['rule_cat'] = 'command_reject';
                            $result['rule_no'] = '0225';
                        } elseif (preg_match("/Content reject/is", $diag_code)) {
                            $result['rule_cat'] = 'content_reject';
                            $result['rule_no'] = '0165';
                        } elseif (preg_match("/MIME\\/REJECT/is", $diag_code)) {
                            $result['rule_cat'] = 'content_reject';
                            $result['rule_no'] = '0212';
                        } elseif (preg_match("/MIME error/is", $diag_code)) {
                            $result['rule_cat'] = 'content_reject';
                            $result['rule_no'] = '0217';
                        } elseif (preg_match("/Mail data refused.*AISP/is", $diag_code)) {
                            $result['rule_cat'] = 'content_reject';
                            $result['rule_no'] = '0218';
                        } elseif (preg_match("/Host unknown/is", $diag_code)) {
                            $result['rule_cat'] = 'dns_unknown';
                            $result['rule_no'] = '0130';
                        } elseif (preg_match("/Specified domain.*not.*allow/is", $diag_code)) {
                            $result['rule_cat'] = 'dns_unknown';
                            $result['rule_no'] = '0180';
                        } elseif (preg_match("/No route to host/is", $diag_code)) {
                            $result['rule_cat'] = 'dns_unknown';
                            $result['rule_no'] = '0188';
                        } elseif (preg_match("/domain.*(?:allowed|forbidden)/is", $diag_code)) {
                            $result['rule_cat'] = 'dns_unknown';
                            $result['rule_no'] = '0248';
                        } elseif (preg_match("/unrouteable address/is", $diag_code)) {
                            $result['rule_cat'] = 'dns_unknown';
                            $result['rule_no'] = '0208';
                        } elseif (preg_match("/System.*busy/is", $diag_code)) {
                            $result['rule_cat'] = 'defer';
                            $result['rule_no'] = '0112';
                        } elseif (preg_match("/Resources temporarily unavailable/is", $diag_code)) {
                            $result['rule_cat'] = 'defer';
                            $result['rule_no'] = '0116';
                        } elseif (preg_match("/sender is rejected/is", $diag_code)) {
                            $result['rule_cat'] = 'antispam';
                            $result['rule_no'] = '0101';
                        } elseif (preg_match("/Client host rejected/is", $diag_code)) {
                            $result['rule_cat'] = 'antispam';
                            $result['rule_no'] = '0102';
                        } elseif (preg_match("/MAIL FROM(.*)mismatches client IP/is", $diag_code)) {
                            $result['rule_cat'] = 'antispam';
                            $result['rule_no'] = '0104';
                        } elseif (preg_match("/denyip/is", $diag_code)) {
                            $result['rule_cat'] = 'antispam';
                            $result['rule_no'] = '0144';
                        } elseif (preg_match("/client host.*blocked/is", $diag_code)) {
                            $result['rule_cat'] = 'antispam';
                            $result['rule_no'] = '0201';
                        } elseif (preg_match("/mail.*reject/is", $diag_code)) {
                            $result['rule_cat'] = 'antispam';
                            $result['rule_no'] = '0147';
                        } elseif (preg_match("/spam.*detect/is", $diag_code)) {
                            $result['rule_cat'] = 'antispam';
                            $result['rule_no'] = '0162';
                        } elseif (preg_match("/reject.*spam/is", $diag_code)) {
                            $result['rule_cat'] = 'antispam';
                            $result['rule_no'] = '0216';
                        } elseif (preg_match("/SpamTrap/is", $diag_code)) {
                            $result['rule_cat'] = 'antispam';
                            $result['rule_no'] = '0200';
                        } elseif (preg_match("/Verify mailfrom failed/is", $diag_code)) {
                            $result['rule_cat'] = 'antispam';
                            $result['rule_no'] = '0210';
                        } elseif (preg_match("/MAIL.*FROM.*mismatch/is", $diag_code)) {
                            $result['rule_cat'] = 'antispam';
                            $result['rule_no'] = '0226';
                        } elseif (preg_match("/spam scale/is", $diag_code)) {
                            $result['rule_cat'] = 'antispam';
                            $result['rule_no'] = '0211';
                        } elseif (preg_match("/Client host bypass/is", $diag_code)) {
                            $result['rule_cat'] = 'antispam';
                            $result['rule_no'] = '0229';
                        } elseif (preg_match("/junk mail/is", $diag_code)) {
                            $result['rule_cat'] = 'antispam';
                            $result['rule_no'] = '0230';
                        } elseif (preg_match("/message filtered/is", $diag_code)) {
                            $result['rule_cat'] = 'antispam';
                            $result['rule_no'] = '0227';
                        } elseif (preg_match("/subject.*consider.*spam/is", $diag_code)) {
                            $result['rule_cat'] = 'antispam';
                            $result['rule_no'] = '0222';
                        } elseif (preg_match("/mail to.*recipient is not accepted.*5\\.7\\./is", $diag_code)) {
                            $result['rule_cat'] = 'antispam';
                            $result['rule_no'] = '0251';
                        } elseif (preg_match("/Temporary local problem/is", $diag_code)) {
                            $result['rule_cat'] = 'internal_error';
                            $result['rule_no'] = '0142';
                        } elseif (preg_match("/system config error/is", $diag_code)) {
                            $result['rule_cat'] = 'internal_error';
                            $result['rule_no'] = '0153';
                        } elseif (preg_match("/delivery.*suspend/is", $diag_code)) {
                            $result['rule_cat'] = 'delayed';
                            $result['rule_no'] = '0213';
                        } elseif (preg_match("/(?:alias|account|recipient|address|email|mailbox|user)(.*)invalid/i", $dsn_msg)) {
                            $result['rule_cat'] = 'unknown';
                            $result['rule_no'] = '0107';
                        } elseif (preg_match("/Deferred.*No such.*(?:file|directory)/i", $dsn_msg)) {
                            $result['rule_cat'] = 'unknown';
                            $result['rule_no'] = '0141';
                        } elseif (preg_match("/mail receiving disabled/i", $dsn_msg)) {
                            $result['rule_cat'] = 'unknown';
                            $result['rule_no'] = '0194';
                        } elseif (preg_match("/bad.*(?:alias|account|recipient|address|email|mailbox|user)/i", $dsn_msg)) {
                            $result['rule_cat'] = 'unknown';
                            $result['rule_no'] = '227';
                        } elseif (preg_match("/over.*quota/i", $dsn_msg)) {
                            $result['rule_cat'] = 'full';
                            $result['rule_no'] = '0131';
                        } elseif (preg_match("/quota.*exceeded/i", $dsn_msg)) {
                            $result['rule_cat'] = 'full';
                            $result['rule_no'] = '0150';
                        } elseif (preg_match("/exceed.*\n?.*quota/i", $dsn_msg)) {
                            $result['rule_cat'] = 'full';
                            $result['rule_no'] = '0187';
                        } elseif (preg_match("/(?:alias|account|recipient|address|email|mailbox|user).*full/i", $dsn_msg)) {
                            $result['rule_cat'] = 'full';
                            $result['rule_no'] = '0132';
                        } elseif (preg_match("/space.*not.*enough/i", $dsn_msg)) {
                            $result['rule_cat'] = 'full';
                            $result['rule_no'] = '0219';
                        } elseif (preg_match("/Deferred.*Connection (?:refused|reset)/i", $dsn_msg)) {
                            $result['rule_cat'] = 'defer';
                            $result['rule_no'] = '0115';
                        } elseif (preg_match("/Invalid host name/i", $dsn_msg)) {
                            $result['rule_cat'] = 'dns_unknown';
                            $result['rule_no'] = '0109';
                        } elseif (preg_match("/Deferred.*No route to host/i", $dsn_msg)) {
                            $result['rule_cat'] = 'dns_unknown';
                            $result['rule_no'] = '0109';
                        } elseif (preg_match("/Host unknown/i", $dsn_msg)) {
                            $result['rule_cat'] = 'dns_unknown';
                            $result['rule_no'] = '0140';
                        } elseif (preg_match("/Name server timeout/i", $dsn_msg)) {
                            $result['rule_cat'] = 'dns_unknown';
                            $result['rule_no'] = '0118';
                        } elseif (preg_match("/Deferred.*Connection.*tim(?:e|ed).*out/i", $dsn_msg)) {
                            $result['rule_cat'] = 'dns_unknown';
                            $result['rule_no'] = '0119';
                        } elseif (preg_match("/Deferred.*host name lookup failure/i", $dsn_msg)) {
                            $result['rule_cat'] = 'dns_unknown';
                            $result['rule_no'] = '0121';
                        } elseif (preg_match("/MX list.*point.*back/i", $dsn_msg)) {
                            $result['rule_cat'] = 'dns_loop';
                            $result['rule_no'] = '0199';
                        } elseif (preg_match("/I\\/O error/i", $dsn_msg)) {
                            $result['rule_cat'] = 'internal_error';
                            $result['rule_no'] = '0120';
                        } elseif (preg_match("/connection.*broken/i", $dsn_msg)) {
                            $result['rule_cat'] = 'internal_error';
                            $result['rule_no'] = '0231';
                        } elseif (preg_match("/Delivery to the following recipients failed.*\n.*\n.*" . $result['email'] . "/i", $dsn_msg)) {
                            $result['rule_cat'] = 'other';
                            $result['rule_no'] = '0176';
                        } elseif (preg_match("/User unknown/i", $dsn_msg)) {
                            $result['rule_cat'] = 'unknown';
                            $result['rule_no'] = '0193';
                        } elseif (preg_match("/Service unavailable/i", $dsn_msg)) {
                            $result['rule_cat'] = 'unknown';
                            $result['rule_no'] = '0214';
                        } elseif (preg_match("/Mail rejected.*policy reasons/i", $dsn_msg)) {
                            $result['rule_cat'] = 'antispam';
                            $result['rule_no'] = '0249';
                        }
                    }
                }
                break;
            case 'delayed':
                $result['rule_cat'] = 'delayed';
                $result['rule_no'] = '0110';
                break;
            case 'delivered':
            case 'relayed':
            case 'expanded':
                // unhandled cases
                break;
            default:
                break;
        }
    }
    global $rule_categories;
    if ($result['rule_no'] == '0000') {
        if ($debug_mode) {
            echo "email:{$result['email']}\n";
            echo "Action:{$action}\n";
            echo "Status:{$status_code}\n";
            echo "Diagnostic-Code:{$diag_code}\n";
            echo "DSN Message:\n{$dsn_msg}\n";
            //          echo "DSN Report:\n$dsn_report\n";
            echo "\n";
        }
    } else {
        if ($result['bounce_type'] === false) {
            $result['bounce_type'] = $rule_categories[$result['rule_cat']]['bounce_type'];
            $result['remove'] = $rule_categories[$result['rule_cat']]['remove'];
        }
    }
    $result['action'] = $action;
    $result['status_code'] = $status_code;
    $result['diag_code'] = $diag_code;
    return $result;
}
/**
 * Parse navigation var
 *
 * @param boolean $force
 * @ignore
 */
function parse_navbar($force = False)
{
    $tpl = createobject('phpgwapi.Template', PHPGW_TEMPLATE_DIR);
    $tpl->set_file('navbartpl', 'navbar.tpl');
    $tpl->set_block('navbartpl', 'preferences');
    $tpl->set_block('navbartpl', 'navbar');
    $var['img_root'] = $GLOBALS['phpgw_info']['server']['webserver_url'] . '/phpgwapi/templates/verdilak/images';
    $currentapp = $GLOBALS['phpgw_info']['flags']['currentapp'];
    $applications = '';
    $exclude = array('home', 'preferences', 'about', 'logout');
    $navbar = execMethod('phpgwapi.menu.get', 'navbar');
    prepare_navbar($navbar);
    foreach ($navbar as $app => $app_data) {
        if (in_array($app, $exclude)) {
            continue;
        }
        if ($app == $currentapp) {
            $app_data['text'] = "[<b>{$app_data['text']}</b>]";
        }
        $applications .= <<<HTML
\t\t\t\t<br>
\t\t\t\t<a href="{$app_data['url']}">{$app_data['text']}</a>
HTML;
        /*
        			$icon = $GLOBALS['phpgw']->common->image($app_data['image'][0], $app_data['image'][1]);
        			$applications .= <<<HTML
        				<br>
        				<a href="{$app_data['url']}">
        					<img src="{$icon}" alt="{$app_data['text']}" title="{$app_data['text']}">
        				</a>
        
        HTML;
        */
    }
    $menu_array = execMethod('phpgwapi.menu.get_local_menu', $currentapp);
    $var['app_menu'] = phpgwapi_menu::render_horisontal_menu($menu_array);
    $var['applications'] = $applications;
    $var['logo'] = 'logo.png';
    $var['home_url'] = $GLOBALS['phpgw']->link('/home.php');
    $var['home_text'] = lang('home');
    $var['about_url'] = $GLOBALS['phpgw']->link('/about.php', array('appname' => $GLOBALS['phpgw_info']['flags']['currentapp']));
    $var['about_text'] = lang('about');
    $var['logout_url'] = $GLOBALS['phpgw']->link('/logout.php');
    $var['logout_text'] = lang('logout');
    if (isset($GLOBALS['phpgw_info']['user']['apps']['manual'])) {
        $var['help_url'] = "javascript:openwindow('" . $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'manual.uimanual.help', 'app' => $GLOBALS['phpgw_info']['flags']['currentapp'], 'section' => isset($GLOBALS['phpgw_info']['apps']['manual']['section']) ? $GLOBALS['phpgw_info']['apps']['manual']['section'] : '', 'referer' => phpgw::get_var('menuaction'))) . "','700','600')";
        $var['help_text'] = lang('help');
        $var['help_icon'] = 'icon icon-help';
    }
    if ($GLOBALS['phpgw']->acl->check('run', PHPGW_ACL_READ, 'preferences')) {
        $var['preferences_url'] = $GLOBALS['phpgw']->link('/preferences/index.php');
        $var['preferences_text'] = lang('preferences');
    }
    if ($GLOBALS['phpgw_info']['flags']['currentapp'] == 'home') {
        $var['welcome_img'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'welcome-red');
    } else {
        $var['welcome_img'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'welcome-grey');
    }
    if ($GLOBALS['phpgw_info']['flags']['currentapp'] == 'preferences') {
        $var['preferences_img'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'preferences-red');
    } else {
        $var['preferences_img'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'preferences-grey');
    }
    $var['logout_img'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'logout-grey');
    $var['powered_by'] = lang('Powered by phpGroupWare version %1', $GLOBALS['phpgw_info']['server']['versions']['phpgwapi']);
    if (isset($GLOBALS['phpgw_info']['navbar']['admin']) && isset($GLOBALS['phpgw_info']['user']['preferences']['common']['show_currentusers'])) {
        $var['current_users'] = '<a style="font-family: Geneva,Arial,Helvetica,sans-serif; font-size: 12pt;" href="' . $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'admin.uicurrentsessions.list_sessions')) . '">&nbsp;' . lang('Current users') . ': ' . $GLOBALS['phpgw']->session->total() . '</a>';
    }
    $now = time();
    $var['user_info'] = $GLOBALS['phpgw']->common->display_fullname() . ' - ' . lang($GLOBALS['phpgw']->common->show_date($now, 'l')) . ' ' . $GLOBALS['phpgw']->common->show_date($now, $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
    //			. lang($GLOBALS['phpgw']->common->show_date($now,'F')) . ' '
    //			. $GLOBALS['phpgw']->common->show_date($now,'d, Y');
    // Maybe we should create a common function in the phpgw_accounts_shared.inc.php file
    // to get rid of duplicate code.
    if (!isset($GLOBALS['phpgw_info']['user']['lastpasswd_change']) || $GLOBALS['phpgw_info']['user']['lastpasswd_change'] == 0) {
        $api_messages = lang('You are required to change your password during your first login') . '<br> Click this image on the navbar: <img src="' . $GLOBALS['phpgw']->common->image('preferences', 'navbar.png') . '">';
    } else {
        if ($GLOBALS['phpgw_info']['user']['lastpasswd_change'] < time() - 86400 * 30) {
            $api_messages = lang('it has been more then %1 days since you changed your password', 30);
        }
    }
    // This is gonna change
    if (isset($cd)) {
        $var['messages'] = $api_messages . '<br>' . checkcode($cd);
    }
    if (isset($GLOBALS['phpgw_info']['flags']['app_header'])) {
        $var['current_app_header'] = $GLOBALS['phpgw_info']['flags']['app_header'];
    } else {
        $tpl->set_block('navbar', 'app_header', 'app_header');
        $var['app_header'] = '';
    }
    $tpl->set_var($var);
    // check if user is allowed to change his prefs
    if (isset($GLOBALS['phpgw_info']['user']['apps']['preferences']) && $GLOBALS['phpgw_info']['user']['apps']['preferences']) {
        $tpl->parse('preferences_icon', 'preferences');
    } else {
        $tpl->set_var('preferences_icon', '');
    }
    $tpl->pfp('out', 'navbar');
    // If the application has a header include, we now include it
    $menuaction = phpgw::get_var('menuaction', 'string', 'GET');
    if (!isset($GLOBALS['phpgw_info']['flags']['noappheader']) && $menuaction) {
        list($app, $class, $method) = explode('.', $menuaction);
        if (is_array($GLOBALS[$class]->public_functions) && isset($GLOBALS[$class]->public_functions['header'])) {
            $GLOBALS[$class]->header();
        }
    }
    $GLOBALS['phpgw']->hooks->process('after_navbar');
    return;
}
Exemple #10
0
/**
 * Parse navigation var
 *
 * @param boolean $force
 * @ignore
 */
function parse_navbar($force = False)
{
    $tpl = CreateObject('phpgwapi.Template', PHPGW_TEMPLATE_DIR);
    $tpl->set_unknowns('remove');
    $tpl->set_file(array('navbar' => 'navbar.tpl'));
    $tpl->set_block('navbar', 'preferences', 'preferences_icon');
    $var['img_root'] = PHPGW_IMAGES_DIR;
    $var['img_root_roll'] = PHPGW_IMAGES_DIR . '/rollover';
    $exclude = array('home', 'preferences', 'about', 'logout');
    $navbar = execMethod('phpgwapi.menu.get', 'navbar');
    prepare_navbar($navbar);
    foreach ($navbar as $app => $app_data) {
        if (in_array($app, $exclude)) {
            continue;
        }
        $img = $GLOBALS['phpgw']->common->image($app_data['image'][0], $app_data['image'][1]);
        $var['applications'] .= <<<HTML
\t\t\t<tr>
\t\t\t\t<td class="main_menu_apps">
\t\t\t\t\t<a class="main_menu" href="{$app_data['url']}">{$app_data['text']}></a>
\t\t\t\t</td>
\t\t\t</tr>

HTML;
        /* TODO this should be implemented at some point - skwashd feb08
        			$tpl->set_var(array
        			(
        				'text'	=> strtoupper($app_data['text']),
        				'url'	=> $app_data['url']
        				'img'	=> $GLOBALS['phpgw']->common->image($app_data['image'][0], $app_data['image'][1])
        			));
        			$tpl->parse('apps', 'app', true);
        			*/
    }
    $var['home_link'] = $navbar['home']['url'];
    $var['preferences_link'] = $navbar['preferences']['url'];
    $var['logout_link'] = $navbar['logout']['url'];
    $var['help_link'] = $navbar['about']['url'];
    $var['lang_welcome'] = $navbar['home']['text'];
    $var['lang_preferences'] = $navbar['preferences']['text'];
    $var['lang_logout'] = $navbar['logout']['text'];
    $var['lang_help'] = $navbar['about']['text'];
    // "powered_by_color" and "_size" are is also used by number of current users thing
    $var['powered_by_size'] = '2';
    $var['powered_by_color'] = '#ffffff';
    if ($GLOBALS['phpgw_info']['server']['showpoweredbyon'] == 'top') {
        $var['powered_by'] = lang('Powered by phpGroupWare version %1', $GLOBALS['phpgw_info']['server']['versions']['phpgwapi']);
        $tpl->set_var($var);
    } else {
        $var['powered_by'] = '';
        $tpl->set_var($var);
    }
    $var['phpgw_version'] = lang("version") . ": " . $GLOBALS['phpgw_info']['server']['versions']['phpgwapi'];
    $tpl->set_var($var);
    if (isset($GLOBALS['phpgw_info']['navbar']['admin']) && $GLOBALS['phpgw_info']['user']['preferences']['common']['show_currentusers']) {
        $var['current_users'] = '<a class="main_menu_bottom" href="' . $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'admin.uicurrentsessions.list_sessions')) . '">' . lang('Current users') . ': ' . $GLOBALS['phpgw']->session->total() . '</a>';
        $tpl->set_var($var);
    } else {
        $var['current_users'] = '';
        $tpl->set_var($var);
    }
    $var['user_info_name'] = $GLOBALS['phpgw']->common->display_fullname();
    $var['user_info_date'] = lang($GLOBALS['phpgw']->common->show_date(time(), 'l')) . ' ' . lang($GLOBALS['phpgw']->common->show_date(time(), 'F')) . ' ' . $GLOBALS['phpgw']->common->show_date(time(), 'd, Y');
    $var['user_info'] = $var['user_info_name'] . ' - ' . $var['user_info_date'];
    $var['user_info_size'] = '2';
    $var['user_info_color'] = '#000000';
    // Maybe we should create a common function in the phpgw_accounts_shared.inc.php file
    // to get rid of duplicate code.
    if ($GLOBALS['phpgw_info']['user']['lastpasswd_change'] == 0) {
        $api_messages = lang('You are required to change your password during your first login') . '<br> Click this image on the navbar: <img src="' . $GLOBALS['phpgw']->common->image('preferences', 'navbar.gif') . '">';
    } elseif ($GLOBALS['phpgw_info']['user']['lastpasswd_change'] < time() - 86400 * 30) {
        $api_messages = lang('it has been more then %1 days since you changed your password', 30);
    }
    // This is gonna change
    if (isset($cd)) {
        $var['messages'] = $api_messages . "<br>" . checkcode($cd);
    }
    if (isset($GLOBALS['phpgw_info']['flags']['app_header'])) {
        $var['current_app_header'] = $GLOBALS['phpgw_info']['flags']['app_header'];
        $var['th_bg'] = $GLOBALS['phpgw_info']['theme']['th_bg'];
        $var['message_top'] = '30px';
        $var['app_top'] = '40px';
    } else {
        $tpl->set_block('navbar', 'app_header', 'app_header');
        $var['app_header'] = '';
        $var['message_top'] = '0px';
        $var['app_top'] = '15px';
    }
    $tpl->set_var($var);
    // check if user is allowed to change his prefs
    if ($GLOBALS['phpgw_info']['user']['apps']['preferences']) {
        $tpl->parse('preferences_icon', 'preferences');
    } else {
        $tpl->set_var('preferences_icon', '');
    }
    $tpl->pfp('out', 'navbar');
    // If the application has a header include, we now include it
    if (!@$GLOBALS['phpgw_info']['flags']['noappheader'] && @isset($GLOBALS['HTTP_GET_VARS']['menuaction'])) {
        list($app, $class, $method) = explode('.', $GLOBALS['HTTP_GET_VARS']['menuaction']);
        if (is_array($GLOBALS[$class]->public_functions) && $GLOBALS[$class]->public_functions['header']) {
            $GLOBALS[$class]->header();
        }
    }
    $GLOBALS['phpgw']->hooks->process('after_navbar');
    return;
}
Exemple #11
0
<?php

require_once 'PEAR.php';
require_once 'DB.php';
include_once 'includes/trace.debugger.inc';
$dbh = DB::connect('mysql://*****:*****@localhost/emms_eird');
$dbh->setFetchMode(DB_FETCHMODE_ASSOC);
$dbh->setFetchMode(DB_FETCHMODE_ASSOC);
$data = $dbh->getAssoc("select id,code from tblClients");
//nftrace('just erasing the log file',1,'checkcode');
$c = 0;
echo '<table>';
foreach ($data as $id => $code) {
    if (!file_exists(sprintf('img/clients/%s.jpg', $code))) {
        if (checkcode($code) == TRUE) {
            $c++;
            echo sprintf('<tr><td align=right>%s</td><td width=30px></td><td>%s</td></tr>', $c, $code);
        }
    }
}
echo '</table>';
function checkcode($clientcode)
{
    //nftrace('just erasing the log file',1,'checkcode');
    if (preg_match('(^([0-9]{3}-[0-9]{7}-[0-9]{1})$)', $clientcode)) {
        $_pattern_match = TRUE;
    } else {
        $_pattern_match = FALSE;
    }
    //{return sprintf('<font color=red>%s</font>',$clientcode);}
    $code = str_replace('-', '', $clientcode);
Exemple #12
0
 /**
  * 修改密码
  */
 public function edit_password()
 {
     $memberinfo = $this->memberinfo;
     if (isset($GLOBALS['submit'])) {
         checkcode($GLOBALS['checkcode']);
         $password = $GLOBALS['password'];
         $password2 = $GLOBALS['password2'];
         if ($password != $password2) {
             MSG(L('password_not_identical'));
         }
         $oldpassword = $GLOBALS['oldpassword'];
         if (md5(md5($oldpassword) . $memberinfo['factor']) != $memberinfo['password']) {
             MSG(L('password_error'));
         }
         $factor = random_string('diy', 6);
         $this->db->update('member', array('factor' => $factor, 'password' => md5(md5($password) . $factor)), '`uid`=' . $memberinfo['uid']);
         MSG(L('operation_success'), 'index.php?m=member');
     } else {
         $seo_title = '修改密码';
         include T('member', 'edit_password');
     }
 }
Exemple #13
0
 public function pay_recharge()
 {
     if (isset($_POST['dosubmit'])) {
         $code = isset($_POST['code']) && trim($_POST['code']) ? trim($_POST['code']) : showmessage(L('input_code'), HTTP_REFERER);
         if (!checkcode($code)) {
             // 判断验证码
             showmessage(L('code_error'), HTTP_REFERER);
         }
         $pay_id = $_POST['pay_type'];
         if (!$pay_id) {
             showmessage(L('illegal_pay_method'));
         }
         $payment = $this->handle->get_payment($pay_id);
         $cfg = unserialize_config($payment['config']);
         $pay_name = ucwords($payment['pay_code']);
         if (!cookie('trade_sn')) {
             showmessage(L('illegal_creat_sn'));
         }
         $trade_sn = cookie('trade_sn');
         $usernote = $_POST['info']['usernote'] ? $_POST['info']['name'] . '[' . $trade_sn . ']' . '-' . new_htmlspecialchars(trim($_POST['info']['usernote'])) : $_POST['info']['name'] . '[' . $trade_sn . ']';
         $surplus = array('userid' => $this->_userid, 'username' => $this->_username, 'money' => trim(floatval($_POST['info']['price'])), 'quantity' => $_POST['quantity'] ? trim(intval($_POST['quantity'])) : 1, 'telephone' => trim($_POST['info']['telephone']), 'contactname' => $_POST['info']['name'] ? trim($_POST['info']['name']) . L('recharge') : $this->_username . L('recharge'), 'email' => trim($_POST['info']['email']), 'addtime' => TIME, 'ip' => IP, 'pay_type' => 'recharge', 'pay_id' => $payment['pay_id'], 'payment' => trim($payment['pay_name']), 'ispay' => '1', 'usernote' => $usernote, 'trade_sn' => $trade_sn);
         $recordid = $this->handle->set_record($surplus);
         $factory_info = $this->handle->get_record($recordid);
         if (!$factory_info) {
             showmessage(L('order_closed_or_finish'));
         }
         $pay_fee = pay_fee($factory_info['money'], $payment['pay_fee'], $payment['pay_method']);
         $logistics_fee = $factory_info['logistics_fee'];
         $discount = $factory_info['discount'];
         // calculate amount
         $factory_info['price'] = $factory_info['money'] + $pay_fee + $logistics_fee + $discount;
         // add order info
         $order_info['id'] = $factory_info['trade_sn'];
         $order_info['quantity'] = $factory_info['quantity'];
         $order_info['buyer_email'] = $factory_info['email'];
         $order_info['order_time'] = $factory_info['addtime'];
         // add product info
         $product_info['name'] = $factory_info['contactname'];
         $product_info['body'] = $factory_info['usernote'];
         $product_info['price'] = $factory_info['price'];
         // add set_customerinfo
         $customerinfo['telephone'] = $factory_info['telephone'];
         if ($payment['is_online'] === '1') {
             Loader::lib('pay:pay_factory', false);
             $payment_handler = new pay_factory($pay_name, $cfg);
             $payment_handler->set_productinfo($product_info)->set_orderinfo($order_info)->set_customerinfo($customer_info);
             $code = $payment_handler->get_code('value="' . L('confirm_pay') . '" class="btn btn-primary btn-sm"');
         } else {
             $this->account_db->where(array('id' => $recordid))->update(array('status' => 'waitting', 'pay_type' => 'offline'));
             $code = '<div class="point">' . L('pay_tip') . '</div>';
         }
     }
     include template('pay', 'payment_cofirm');
 }
function parse_navbar($force = False)
{
    $tpl = CreateObject('phpgwapi.Template', PHPGW_TEMPLATE_DIR);
    $tpl->set_unknowns('remove');
    $tpl->set_file(array('navbar' => 'navbar.tpl'));
    $tpl->set_block('navbar', 'preferences', 'preferences_icon');
    //$tpl->set_block('navbar','B_powered_top','V_powered_top');
    //$tpl->set_block('navbar','B_num_users','V_num_users');
    $var['img_root'] = PHPGW_IMAGES_DIR;
    $var['table_bg_color'] = $GLOBALS['phpgw_info']['theme']['navbar_bg'];
    $find_single = strrpos($GLOBALS['phpgw_info']['server']['webserver_url'], '/');
    $find_double = strpos(strrev($GLOBALS['phpgw_info']['server']['webserver_url'] . ' '), '//');
    if ($find_double) {
        $find_double = strlen($GLOBALS['phpgw_info']['server']['webserver_url']) - $find_double - 1;
    }
    if ($find_double) {
        if ($find_single == $find_double + 1) {
            $strip_portion = $GLOBALS['phpgw_info']['server']['webserver_url'];
        } else {
            $strip_portion = substr($GLOBALS['phpgw_info']['server']['webserver_url'], 0, $find_double + 1);
        }
    } else {
        $strip_portion = '';
    }
    #  echo '<pre>'; print_r($GLOBALS['phpgw_info']['navbar']); echo '</pre>';
    $applications = '';
    foreach ($GLOBALS['phpgw_info']['navbar'] as $app => $app_data) {
        if ($app != 'home' && $app != 'preferences' && !ereg('about', $app) && $app != 'logout') {
            $title = '<img src="' . $app_data['icon'] . '" alt="' . $app_data['title'] . '" title="' . $app_data['title'] . '" border="0" name="' . str_replace('-', '_', $app) . '">';
            $img_src_over = $app_data['icon_hover'];
            $img_src_out = $app_data['icon'];
            $applications .= '<tr><td><a href="' . $app_data['url'] . '"';
            if (isset($GLOBALS['phpgw_info']['flags']['navbar_target'])) {
                $applications .= ' target="' . $GLOBALS['phpgw_info']['flags']['navbar_target'] . '"';
            }
            if ($img_src_over != '') {
                $applications .= ' onMouseOver="' . str_replace('-', '_', $app) . ".src='" . $img_src_over . '\'"';
            }
            if ($img_src_out != '') {
                $applications .= ' onMouseOut="' . str_replace('-', '_', $app) . ".src='" . $img_src_out . '\'"';
            }
            $applications .= $app_data['target'] . '>' . $title . '</a></td></tr>' . "\r\n";
        } else {
            $img_src_over = $GLOBALS['phpgw']->common->image_on($app, array('navbar', 'nonav'), '-over');
        }
        if ($img_src_over != '') {
            //				if($strip_portion)
            //				{
            //					$img_src_over = str_replace($strip_portion,'',$img_src_over);
            //				}
            $pre_load[] = $img_src_over;
        }
    }
    $var['app_images'] = implode("',\r\n'", $pre_load);
    $var['applications'] = $applications;
    $var['home_link'] = $GLOBALS['phpgw_info']['navbar']['home']['url'];
    $var['preferences_link'] = $GLOBALS['phpgw_info']['navbar']['preferences']['url'];
    $var['logout_link'] = $GLOBALS['phpgw_info']['navbar']['logout']['url'];
    $var['help_link'] = $GLOBALS['phpgw_info']['navbar']['about']['url'];
    if ($GLOBALS['phpgw_info']['flags']['currentapp'] != 'home') {
        $var['welcome_img'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'welcome2');
        $var['welcome_img_hover'] = $GLOBALS['phpgw']->common->image_on('phpgwapi', 'welcome2', '_over');
    } else {
        $var['welcome_img'] = $GLOBALS['phpgw']->common->image_on('phpgwapi', 'welcome2', '_over');
        $var['welcome_img_hover'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'welcome2');
    }
    if ($GLOBALS['phpgw_info']['flags']['currentapp'] != 'preferences') {
        $var['preferences_img'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'preferences2');
        $var['preferences_img_hover'] = $GLOBALS['phpgw']->common->image_on('phpgwapi', 'preferences2', '_over');
    } else {
        $var['preferences_img'] = $GLOBALS['phpgw']->common->image_on('phpgwapi', 'preferences2', '_over');
        $var['preferences_img_hover'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'preferences2');
    }
    $var['logout_img'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'log_out2');
    $var['logout_img_hover'] = $GLOBALS['phpgw']->common->image_on('phpgwapi', 'log_out2', '_over');
    if ($GLOBALS['phpgw_info']['flags']['currentapp'] != 'about') {
        $var['about_img'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'question_mark2');
        $var['about_img_hover'] = $GLOBALS['phpgw']->common->image_on('phpgwapi', 'question_mark2', '_over');
    } else {
        $var['about_img'] = $GLOBALS['phpgw']->common->image_on('phpgwapi', 'question_mark2', '_over');
        $var['about_img_hover'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'question_mark2');
    }
    $var['content_spacer_middle_img'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'content_spacer_middle');
    $var['em_img'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'em');
    $var['top_spacer_middle_img'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'top_spacer_middle');
    $var['nav_bar_left_spacer_img'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'nav_bar_left_spacer');
    $var['nav_bar_left_top_bg_img'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'nav_bar_left_top_bg');
    // "powered_by_color" and "_size" are is also used by number of current users thing
    $var['powered_by_size'] = '2';
    $var['powered_by_color'] = '#ffffff';
    if ($GLOBALS['phpgw_info']['server']['showpoweredbyon'] == 'top') {
        $var['powered_by'] = lang('Powered by phpGroupWare version %1', $GLOBALS['phpgw_info']['server']['versions']['phpgwapi']);
    } else {
        $var['powered_by'] = '';
    }
    if (substr($GLOBALS['phpgw_info']['server']['login_logo_file'], 0, 4) == 'http') {
        $var['logo_file'] = $GLOBALS['phpgw_info']['server']['login_logo_file'];
    } else {
        $var['logo_file'] = $GLOBALS['phpgw']->common->image('phpgwapi', $GLOBALS['phpgw_info']['server']['login_logo_file'] ? $GLOBALS['phpgw_info']['server']['login_logo_file'] : 'logo');
    }
    $var['logo_url'] = $GLOBALS['phpgw_info']['server']['login_logo_url'] ? $GLOBALS['phpgw_info']['server']['login_logo_url'] : 'http://www.eGroupWare.org';
    if (substr($var['logo_url'], 0, 4) != 'http') {
        $var['logo_url'] = 'http://' . $var['logo_url'];
    }
    $var['logo_title'] = $GLOBALS['phpgw_info']['server']['login_logo_title'] ? $GLOBALS['phpgw_info']['server']['login_logo_title'] : 'www.eGroupWare.org';
    $tpl->set_var($var);
    if (isset($GLOBALS['phpgw_info']['navbar']['admin']) && $GLOBALS['phpgw_info']['user']['preferences']['common']['show_currentusers']) {
        $var['current_users'] = '<a href="' . $GLOBALS['phpgw']->link('/index.php', 'menuaction=admin.uicurrentsessions.list_sessions') . '">&nbsp;' . lang('Current users') . ': ' . $GLOBALS['phpgw']->session->total() . '</a>';
        $tpl->set_var($var);
    } else {
        $var['current_users'] = '';
        $tpl->set_var($var);
    }
    $var['user_info_name'] = $GLOBALS['phpgw']->common->display_fullname();
    $now = time();
    $var['user_info_date'] = lang($GLOBALS['phpgw']->common->show_date($now, 'l')) . ' ' . $GLOBALS['phpgw']->common->show_date($now, $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
    $var['user_info'] = $var['user_info_name'] . ' - ' . $var['user_info_date'];
    $var['user_info_size'] = '2';
    $var['user_info_color'] = '#000000';
    // Maybe we should create a common function in the phpgw_accounts_shared.inc.php file
    // to get rid of duplicate code.
    if ($GLOBALS['phpgw_info']['user']['lastpasswd_change'] == 0) {
        $api_messages = lang('You are required to change your password during your first login') . '<br> Click this image on the navbar: <img src="' . $GLOBALS['phpgw']->common->image('preferences', 'navbar.gif') . '">';
    } elseif ($GLOBALS['phpgw_info']['user']['lastpasswd_change'] < time() - 86400 * 30) {
        $api_messages = lang('it has been more then %1 days since you changed your password', 30);
    }
    // This is gonna change
    if (isset($cd)) {
        $var['messages'] = $api_messages . '<br>' . checkcode($cd);
    }
    $var['th_bg'] = $GLOBALS['phpgw_info']['theme']['th_bg'];
    if (isset($GLOBALS['phpgw_info']['flags']['app_header'])) {
        $var['current_app_header'] = $GLOBALS['phpgw_info']['flags']['app_header'];
    } else {
        $tpl->set_block('navbar', 'app_header', 'app_header');
        $var['app_header'] = '<br>';
    }
    $tpl->set_var($var);
    // check if user is allowed to change his prefs
    if ($GLOBALS['phpgw_info']['user']['apps']['preferences']) {
        $tpl->parse('preferences_icon', 'preferences');
    } else {
        $tpl->set_var('preferences_icon', '');
    }
    $tpl->pfp('out', 'navbar');
    // If the application has a header include, we now include it
    if (!@$GLOBALS['phpgw_info']['flags']['noappheader'] && @isset($_GET['menuaction'])) {
        list($app, $class, $method) = explode('.', $_GET['menuaction']);
        if (is_array($GLOBALS[$class]->public_functions) && $GLOBALS[$class]->public_functions['header']) {
            $GLOBALS[$class]->header();
        }
    }
    $GLOBALS['phpgw']->hooks->process('after_navbar');
    return;
}
function parse_navbar($force = False)
{
    $GLOBALS['idots_tpl'] = createobject('phpgwapi.Template', PHPGW_TEMPLATE_DIR);
    $GLOBALS['idots_tpl']->set_file(array('navbar' => 'navbar.tpl'));
    $GLOBALS['idots_tpl']->set_block('navbar', 'navbar_header', 'navbar_header');
    $GLOBALS['idots_tpl']->set_block('navbar', 'extra_blocks_header', 'extra_block_header');
    $GLOBALS['idots_tpl']->set_block('navbar', 'extra_block_row', 'extra_block_row');
    $GLOBALS['idots_tpl']->set_block('navbar', 'extra_block_spacer', 'extra_block_spacer');
    $GLOBALS['idots_tpl']->set_block('navbar', 'extra_blocks_footer', 'extra_blocks_footer');
    $GLOBALS['idots_tpl']->set_block('navbar', 'navbar_footer', 'navbar_footer');
    $var['img_root'] = $GLOBALS['phpgw_info']['server']['webserver_url'] . '/phpgwapi/templates/literati/images';
    $var['table_bg_color'] = $GLOBALS['phpgw_info']['theme']['navbar_bg'];
    $applications = '';
    //	== 'icons_and_text')
    foreach ($GLOBALS['phpgw_info']['navbar'] as $app => $app_data) {
        if ($app != 'home' && $app != 'preferences' && $app != 'about' && $app != 'logout') {
            $title = $GLOBALS['phpgw_info']['apps'][$app]['title'];
            $icon = '<img src="' . $app_data['icon'] . '" alt="' . $title . '" title="' . $title . '" border="0" height="60">';
            $app_icons .= '<TD align="center"><a href="' . $app_data['url'] . '"';
            if (isset($GLOBALS['phpgw_info']['flags']['navbar_target']) && $GLOBALS['phpgw_info']['flags']['navbar_target']) {
                $app_icons .= ' target="' . $GLOBALS['phpgw_info']['flags']['navbar_target'] . '"';
            }
            $app_icons .= $app_data['target'] . '>' . $icon . '</a></TD>';
            $app_titles .= '<TD align=center class="mainnote"><a href="' . $app_data['url'] . '"';
            if (isset($GLOBALS['phpgw_info']['flags']['navbar_target']) && $GLOBALS['phpgw_info']['flags']['navbar_target']) {
                $app_titles .= ' target="' . $GLOBALS['phpgw_info']['flags']['navbar_target'] . '"';
            }
            $app_titles .= $app_data['target'] . '>' . $title . '</a></TD>';
            unset($icon);
            unset($title);
        }
    }
    $var['app_icons'] = $app_icons;
    if ($GLOBALS['phpgw_info']['user']['preferences']['common']['navbar_format'] != 'icons') {
        $var['app_titles'] = $app_titles;
    }
    if (isset($GLOBALS['phpgw_info']['flags']['app_header'])) {
        $var['current_app_title'] = $GLOBALS['phpgw_info']['flags']['app_header'];
    } else {
        $var['current_app_title'] = $GLOBALS['phpgw_info']['navbar'][$GLOBALS['phpgw_info']['flags']['currentapp']]['title'];
    }
    if (isset($GLOBALS['phpgw_info']['navbar']['admin']) && $GLOBALS['phpgw_info']['user']['preferences']['common']['show_currentusers']) {
        $var['current_users'] = '<a href="' . $GLOBALS['phpgw']->link('/index.php', 'menuaction=admin.uicurrentsessions.list_sessions') . '">' . lang('Current users') . ': ' . $GLOBALS['phpgw']->session->total() . '</a>';
    }
    $now = time();
    $var['user_info'] = '<b>' . $GLOBALS['phpgw']->common->display_fullname() . '</b>' . ' - ' . lang($GLOBALS['phpgw']->common->show_date($now, 'l')) . ' ' . $GLOBALS['phpgw']->common->show_date($now, $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
    if ($GLOBALS['phpgw_info']['user']['lastpasswd_change'] == 0) {
        $api_messages = lang('You are required to change your password during your first login') . '<br> Click this image on the navbar: <img src="' . $GLOBALS['phpgw']->common->image('preferences', 'navbar.gif') . '">';
    } elseif ($GLOBALS['phpgw_info']['user']['lastpasswd_change'] < time() - 86400 * 30) {
        $api_messages = lang('it has been more then %1 days since you changed your password', 30);
    }
    // This is gonna change
    if (isset($cd)) {
        $var['messages'] = $api_messages . '<br>' . checkcode($cd);
    }
    if (substr($GLOBALS['phpgw_info']['server']['login_logo_file'], 0, 4) == 'http') {
        $var['logo_file'] = $GLOBALS['phpgw_info']['server']['login_logo_file'];
    } else {
        $var['logo_file'] = $GLOBALS['phpgw']->common->image('phpgwapi', $GLOBALS['phpgw_info']['server']['login_logo_file'] ? $GLOBALS['phpgw_info']['server']['login_logo_file'] : 'logo');
    }
    $var['logo_url'] = $GLOBALS['phpgw_info']['server']['login_logo_url'] ? $GLOBALS['phpgw_info']['server']['login_logo_url'] : 'http://www.eGroupWare.org';
    if (substr($var['logo_url'], 0, 4) != 'http') {
        $var['logo_url'] = 'http://' . $var['logo_url'];
    }
    $var['logo_title'] = $GLOBALS['phpgw_info']['server']['login_logo_title'] ? $GLOBALS['phpgw_info']['server']['login_logo_title'] : 'www.eGroupWare.org';
    $GLOBALS['idots_tpl']->set_var($var);
    $GLOBALS['idots_tpl']->pfp('out', 'navbar_header');
    $menu_title = lang('General Menu');
    $file['Home'] = $GLOBALS['phpgw_info']['navbar']['home']['url'];
    if ($GLOBALS['phpgw_info']['user']['apps']['preferences']) {
        $file['Preferences'] = $GLOBALS['phpgw_info']['navbar']['preferences']['url'];
    }
    $file += array('About %1' => $GLOBALS['phpgw_info']['navbar']['about']['url'], 'Logout' => $GLOBALS['phpgw_info']['navbar']['logout']['url']);
    display_sidebox('', $menu_title, $file);
    $GLOBALS['phpgw']->hooks->single('sidebox_menu', $GLOBALS['phpgw_info']['flags']['currentapp']);
    $GLOBALS['idots_tpl']->pparse('out', 'navbar_footer');
    // If the application has a header include, we now include it
    if (!@$GLOBALS['phpgw_info']['flags']['noappheader'] && @isset($_GET['menuaction'])) {
        list($app, $class, $method) = explode('.', $_GET['menuaction']);
        if (is_array($GLOBALS[$class]->public_functions) && $GLOBALS[$class]->public_functions['header']) {
            $GLOBALS[$class]->header();
        }
    }
    $GLOBALS['phpgw']->hooks->process('after_navbar');
    return;
}
Exemple #16
0
 /**
  * 找回密码
  */
 public function public_forget_password()
 {
     if (isset($_POST['dosubmit'])) {
         $checkcode = isset($_POST['code']) && trim($_POST['code']) ? trim($_POST['code']) : showmessage(L('input_code'), HTTP_REFERER);
         if (!checkcode($checkcode)) {
             // 判断验证码
             showmessage(L('code_error'), HTTP_REFERER);
         }
         $memberinfo = $this->db->getby_email($_POST['email']);
         if (!empty($memberinfo['email'])) {
             $email = $memberinfo['email'];
         } else {
             showmessage(L('email_error'), HTTP_REFERER);
         }
         $code = String::authcode($memberinfo['userid'] . "\t" . TIME, 'ENCODE', $this->auth_key);
         $url = SITE_URL . "index.php?app=member&controller=passport&action=public_forget_password&code={$code}";
         $message = $this->member_setting['forgetpassword'];
         $message = str_replace(array('{click}', '{url}'), array('<a href="' . $url . '">' . L('please_click') . '</a>', $url), $message);
         sendmail($email, L('forgetpassword'), $message);
         showmessage(L('operation_success'), 'index.php?app=member&controller=passport&action=login');
     } elseif (isset($_GET['code'])) {
         $hour = date('y-m-d h', TIME);
         $code = String::authcode($_GET['code'], 'DECODE', $this->auth_key);
         $code = explode("\t", $code);
         if (is_array($code) && is_numeric($code[0]) && date('y-m-d h', TIME) == date('y-m-d h', $code[1])) {
             $memberinfo = $this->db->getby_userid($code[0]);
             $password = String::rand_string(8);
             $updateinfo['password'] = password($password, $memberinfo['encrypt']);
             $this->db->where(array('userid' => $code[0]))->update($updateinfo);
             if (!is_null($this->api->uc) && !empty($memberinfo['ucenterid'])) {
                 $this->api->uc->uc_user_edit($memberinfo['username'], '', $password, '', 1);
             }
             showmessage(L('operation_success') . L('newpassword') . ':' . $password);
         } else {
             showmessage(L('operation_failure'), 'index.php?app=member&controller=passport&action=login');
         }
     } else {
         $siteinfo = S('common/common');
         include template('member', 'forget_password');
     }
 }
Exemple #17
0
/**
 * Parse navigation var
 *
 * @param boolean $force
 * @ignore
 */
function parse_navbar($force = False)
{
    $tpl = CreateObject('phpgwapi.Template', PHPGW_TEMPLATE_DIR, 'remove');
    $tpl->set_file('navbar', 'navbar.tpl');
    $tpl->set_block('navbar', 'app', 'apps');
    $tpl->set_block('navbar', 'preferences', 'preferences_icon');
    $exclude = array('home', 'preferences', 'about', 'logout');
    $navbar = execMethod('phpgwapi.menu.get', 'navbar');
    prepare_navbar($navbar);
    foreach ($navbar as $app => $app_data) {
        if (in_array($app, $exclude)) {
            continue;
        }
        $tpl->set_var(array('text' => strtoupper($app_data['text']), 'url' => $app_data['url']));
        $tpl->parse('apps', 'app', true);
    }
    $var['home_link'] = $navbar['home']['url'];
    $var['preferences_link'] = $navbar['preferences']['url'];
    $var['logout_link'] = $navbar['logout']['url'];
    $var['help_link'] = $navbar['about']['url'];
    if ($GLOBALS['phpgw_info']['flags']['currentapp'] != 'home') {
        $var['welcome_img'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'welcome2');
        $var['welcome_img_hover'] = $GLOBALS['phpgw']->common->image_on('phpgwapi', 'welcome2', '_over');
    } else {
        $var['welcome_img'] = $GLOBALS['phpgw']->common->image_on('phpgwapi', 'welcome2', '_over');
        $var['welcome_img_hover'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'welcome2');
    }
    if ($GLOBALS['phpgw_info']['flags']['currentapp'] != 'preferences') {
        $var['preferences_img'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'preferences2');
        $var['preferences_img_hover'] = $GLOBALS['phpgw']->common->image_on('phpgwapi', 'preferences2', '_over');
    } else {
        $var['preferences_img'] = $GLOBALS['phpgw']->common->image_on('phpgwapi', 'preferences2', '_over');
        $var['preferences_img_hover'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'preferences2');
    }
    $var['logout_img'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'log_out2');
    $var['logout_img_hover'] = $GLOBALS['phpgw']->common->image_on('phpgwapi', 'log_out2', '_over');
    if ($GLOBALS['phpgw_info']['flags']['currentapp'] != 'about') {
        $var['about_img'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'question_mark2');
        $var['about_img_hover'] = $GLOBALS['phpgw']->common->image_on('phpgwapi', 'question_mark2', '_over');
    } else {
        $var['about_img'] = $GLOBALS['phpgw']->common->image_on('phpgwapi', 'question_mark2', '_over');
        $var['about_img_hover'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'question_mark2');
    }
    $var['content_spacer_middle_img'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'content_spacer_middle');
    $var['em_img'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'em');
    $var['logo_img'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'logo');
    $var['top_spacer_middle_img'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'top_spacer_middle');
    $var['nav_bar_left_spacer_img'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'nav_bar_left_spacer');
    $var['nav_bar_left_top_bg_img'] = $GLOBALS['phpgw']->common->image('phpgwapi', 'nav_bar_left_top_bg');
    // "powered_by_color" and "_size" are is also used by number of current users thing
    $var['powered_by_size'] = '2';
    $var['powered_by_color'] = '#ffffff';
    if ($GLOBALS['phpgw_info']['server']['showpoweredbyon'] == 'top') {
        $var['powered_by'] = lang('Powered by phpGroupWare version %1', $GLOBALS['phpgw_info']['server']['versions']['phpgwapi']);
        $tpl->set_var($var);
    } else {
        $var['powered_by'] = '';
        $tpl->set_var($var);
    }
    if (isset($GLOBALS['phpgw_info']['navbar']['admin']) && $GLOBALS['phpgw_info']['user']['preferences']['common']['show_currentusers']) {
        $var['current_users'] = '<a href="' . $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'admin.uicurrentsessions.list_sessions')) . '">&nbsp;' . lang('Current users') . ': ' . $GLOBALS['phpgw']->session->total() . '</a>';
        $tpl->set_var($var);
    } else {
        $var['current_users'] = '';
        $tpl->set_var($var);
    }
    $var['user_info_name'] = $GLOBALS['phpgw']->common->display_fullname();
    $now = time();
    $var['user_info_date'] = lang($GLOBALS['phpgw']->common->show_date($now, 'l')) . ' ' . $GLOBALS['phpgw']->common->show_date($now, $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
    $var['user_info'] = $var['user_info_name'] . ' - ' . $var['user_info_date'];
    $var['user_info_size'] = '2';
    $var['user_info_color'] = '#000000';
    // Maybe we should create a common function in the phpgw_accounts_shared.inc.php file
    // to get rid of duplicate code.
    if ($GLOBALS['phpgw_info']['user']['lastpasswd_change'] == 0) {
        $api_messages = lang('You are required to change your password during your first login') . '<br> Click this image on the navbar: <img src="' . $GLOBALS['phpgw']->common->image('preferences', 'navbar.gif') . '">';
    } elseif ($GLOBALS['phpgw_info']['user']['lastpasswd_change'] < time() - 86400 * 30) {
        $api_messages = lang('it has been more then %1 days since you changed your password', 30);
    }
    // This is gonna change
    if (isset($cd)) {
        $var['messages'] = $api_messages . '<br>' . checkcode($cd);
    }
    $var['th_bg'] = $GLOBALS['phpgw_info']['theme']['th_bg'];
    if (isset($GLOBALS['phpgw_info']['flags']['app_header'])) {
        $var['current_app_header'] = $GLOBALS['phpgw_info']['flags']['app_header'];
    } else {
        $tpl->set_block('navbar', 'app_header', 'app_header');
        $var['app_header'] = '<br>';
    }
    $tpl->set_var($var);
    // check if user is allowed to change his prefs
    if ($GLOBALS['phpgw_info']['user']['apps']['preferences']) {
        $tpl->parse('preferences_icon', 'preferences');
    } else {
        $tpl->set_var('preferences_icon', '');
    }
    $tpl->pfp('out', 'navbar');
    // If the application has a header include, we now include it
    if (!isset($GLOBALS['phpgw_info']['flags']['noappheader']) && ($menuaction = phpgw::get_var('menuaction', 'string', 'GET'))) {
        list($app, $class, $method) = explode('.', $menuaction);
        if (is_array($GLOBALS[$class]->public_functions) && $GLOBALS[$class]->public_functions['header']) {
            $GLOBALS[$class]->header();
        }
    }
    $GLOBALS['phpgw']->hooks->process('after_navbar');
    return;
}
Exemple #18
0
<?php

defined("ZHANGXUAN") or die("no hacker.");
$mailcheckerrorid = -1;
//已经确认了1,错误2
if (check_data("userid", 'get') && check_data("checkcode", 'get')) {
    if (ctype_digit($_GET["userid"]) && checkcode($_GET["checkcode"])) {
        $userid = $_GET['userid'];
        $checkcode = db_iconv("checkcode", 'get');
        $sql = "SELECT * FROM `users` WHERE `user_id`='{$userid}'";
        $row = queryRow($sql);
        if ($row) {
            if ($row['user_email_checked'] == 0) {
                if ($checkcode == $row['user_email_checkid']) {
                    $sql = "UPDATE `users` SET `user_email_checked`=1 WHERE `user_id`='{$userid}'";
                    update($sql);
                    $mailcheckerrorid = 0;
                } else {
                    $mailcheckerrorid = 2;
                }
            } else {
                $mailcheckerrorid = 1;
                //已经确认了
            }
        } else {
            $mailcheckerrorid = 2;
            //没这个人
        }
    } else {
        $mailcheckerrorid = 2;
        //没这个人
Exemple #19
0
/**
 * Parse navigation bar
 *
 * @param boolean $force
 * @ignore
 */
function parse_navbar($force = false)
{
    $tpl = createobject('phpgwapi.Template', PHPGW_TEMPLATE_DIR);
    $tpl->set_unknowns('remove');
    $tpl->set_file('navbar', 'navbar.tpl');
    $tpl->set_block('navbar', 'app_row', 'app_rows');
    $var['api_root'] = $GLOBALS['phpgw_info']['server']['webserver_url'] . '/phpgwapi/templates/probusiness/';
    /*
     *  folder handling
     */
    if ($GLOBALS['phpgw_info']['user']['apps']['folders']['enabled'] == true) {
        $mtree = createobject('folders.uifolders', '');
        $var['switchlink'] = $mtree->get_switchlink();
        $folderMode = $mtree->get_folderMode();
    }
    if (false) {
        if ($GLOBALS['phpgw_info']['user']['apps']['folders']['enabled'] == true) {
            $var['navbarview'] = $mtree->get_iframe();
        }
    } else {
        /*
         *  application list
         */
        $navbar = execMethod('phpgwapi.menu.get', 'navbar');
        prepare_navbar($navbar);
        foreach ($navbar as $app => $app_data) {
            if ($app == 'logout') {
                if (isset($GLOBALS['phpgw_info']['user']['apps']['manual'])) {
                    $tpl->set_var(array('url' => "javascript:openwindow('" . $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'manual.uimanual.help', 'app' => $GLOBALS['phpgw_info']['flags']['currentapp'], 'section' => isset($GLOBALS['phpgw_info']['apps']['manual']['section']) ? $GLOBALS['phpgw_info']['apps']['manual']['section'] : '', 'referer' => phpgw::get_var('menuaction'))) . "','700','600')", 'text' => lang('help'), 'image' => $GLOBALS['phpgw']->common->image('manual', 'navbar')));
                }
                $tpl->parse('app_rows', 'app_row', true);
            }
            if ($app == $GLOBALS['phpgw_info']['flags']['currentapp']) {
                $app_data['class'] = ' class="selectedNavLink"';
            }
            $app_data['image'] = $GLOBALS['phpgw']->common->image($app_data['image'][0], $app_data['image'][1]);
            $tpl->set_var($app_data);
            $tpl->parse('app_rows', 'app_row', true);
        }
    }
    // get sidebox content and parse it as a menu
    // it's just a hack. You need to enable the folders module to get an ouput
    if ($GLOBALS['phpgw_info']['user']['apps']['folders']['enabled'] == true) {
        $GLOBALS['phpgw']->hooks->single('sidebox_menu', $GLOBALS['phpgw_info']['flags']['currentapp']);
        $var['sideboxcontent'] = parseMenu();
    }
    if (isset($GLOBALS['phpgw_info']['navbar']['admin']) && isset($GLOBALS['phpgw_info']['user']['preferences']['common']['show_currentusers']) && $GLOBALS['phpgw_info']['user']['preferences']['common']['show_currentusers']) {
        $var['current_users'] = '<a href="' . $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'admin.uicurrentsessions.list_sessions')) . '">&nbsp;' . lang('Current users') . ': ' . $GLOBALS['phpgw']->session->total() . '</a>';
    }
    if ($GLOBALS['phpgw_info']['user']['lastpasswd_change'] == 0) {
        $api_messages = lang('You are required to change your password during your first login') . '<br> Click this image on the navbar: <img src="' . $GLOBALS['phpgw']->common->image('preferences', 'navbar.gif') . '">';
    } elseif ($GLOBALS['phpgw_info']['user']['lastpasswd_change'] < time() - 86400 * 30) {
        $api_messages = lang('it has been more then %1 days since you changed your password', 30);
    }
    // This gonna change
    if (isset($cd)) {
        $var['messages'] = $api_messages . '<br>' . checkcode($cd);
    }
    if (isset($GLOBALS['phpgw_info']['flags']['app_header'])) {
        $var['current_app_header'] = $GLOBALS['phpgw_info']['flags']['app_header'];
    }
    $tpl->set_var($var);
    $tpl->pfp('out', 'navbar');
    // If the application has a header include, we now include it
    if (!@$GLOBALS['phpgw_info']['flags']['noappheader'] && @isset($_GET['menuaction'])) {
        list($app, $class, $method) = explode('.', $_GET['menuaction']);
        if (is_array($GLOBALS[$class]->public_functions) && isset($GLOBALS[$class]->public_functions['header']) && $GLOBALS[$class]->public_functions['header']) {
            $GLOBALS[$class]->header();
        }
    }
    $GLOBALS['phpgw']->hooks->process('after_navbar');
}
Exemple #20
0
/**
 * Parse navigation bar
 *
 * @param boolean $force
 * @ignore
 */
function parse_navbar($force = false)
{
    $GLOBALS['phpgw']->template->set_root(PHPGW_TEMPLATE_DIR);
    $GLOBALS['phpgw']->template->set_file('navbar', 'navbar.tpl');
    $GLOBALS['phpgw']->template->set_block('navbar', 'navbar_item', 'navbar_items');
    $GLOBALS['phpgw']->template->set_block('navbar', 'navbar_header', 'navbar_header');
    $GLOBALS['phpgw']->template->set_block('navbar', 'extra_blocks_header', 'extra_block_header');
    $GLOBALS['phpgw']->template->set_block('navbar', 'extra_blocks_menu', 'extra_blocks_menu');
    $GLOBALS['phpgw']->template->set_block('navbar', 'extra_block_row', 'extra_block_row');
    $GLOBALS['phpgw']->template->set_block('navbar', 'extra_blocks_footer', 'extra_blocks_footer');
    $GLOBALS['phpgw']->template->set_block('navbar', 'navbar_footer', 'navbar_footer');
    $var['img_root'] = $GLOBALS['phpgw_info']['server']['webserver_url'] . '/phpgwapi/templates/idots/images';
    $applications = '';
    $items = 0;
    $navbar = execMethod('phpgwapi.menu.get', 'navbar');
    prepare_navbar($navbar);
    $navigation = execMethod('phpgwapi.menu.get', 'navigation');
    $sidecontent = 'sidebox';
    if (isset($GLOBALS['phpgw_info']['user']['preferences']['common']['sidecontent']) && $GLOBALS['phpgw_info']['user']['preferences']['common']['sidecontent']) {
        $sidecontent = $GLOBALS['phpgw_info']['user']['preferences']['common']['sidecontent'];
    }
    $excluded = array('home', 'preferences', 'about', 'logout');
    foreach ($navbar as $app => $app_data) {
        if (!in_array($app, $excluded) || $sidecontent != 'sidebox' && $sidecontent != 'jsmenu') {
            $item = array('app_name' => '', 'alt_img_app' => lang($app), 'img_app' => "{$var['img_root']}/noimage_nav.png", 'url_app' => $app_data['url'], 'app_name' => $app_data['text'], 'img_app' => $GLOBALS['phpgw']->common->image($app_data['image'][0], $app_data['image'][1]));
            $GLOBALS['phpgw']->template->set_var($item);
            $GLOBALS['phpgw']->template->parse('navbar_items', 'navbar_item', true);
        }
    }
    if (isset($GLOBALS['phpgw_info']['flags']['app_header'])) {
        $var['current_app_title'] = $GLOBALS['phpgw_info']['flags']['app_header'];
    } else {
        $var['current_app_title'] = lang($GLOBALS['phpgw_info']['flags']['currentapp']);
    }
    if (isset($GLOBALS['phpgw_info']['navbar']['admin']) && isset($GLOBALS['phpgw_info']['user']['preferences']['common']['show_currentusers']) && $GLOBALS['phpgw_info']['user']['preferences']['common']['show_currentusers']) {
        $var['current_users'] = '<a href="' . $GLOBALS['phpgw']->link('/index.php', 'menuaction=admin.uicurrentsessions.list_sessions') . '">' . lang('Current users') . ': ' . $GLOBALS['phpgw']->session->total() . '</a>';
    }
    $now = time();
    $var['user_info'] = '<b>' . $GLOBALS['phpgw']->common->display_fullname() . '</b>' . ' - ' . lang($GLOBALS['phpgw']->common->show_date($now, 'l')) . ' ' . $GLOBALS['phpgw']->common->show_date($now, $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
    if (!isset($GLOBALS['phpgw_info']['user']['lastpasswd_change']) || $GLOBALS['phpgw_info']['user']['lastpasswd_change'] == 0) {
        $api_messages = lang('You are required to change your password during your first login') . '<br> Click this image on the navbar: <img src="' . $GLOBALS['phpgw']->common->image('preferences', 'navbar') . '">';
    } else {
        if (isset($GLOBALS['phpgw_info']['user']['lastpasswd_change']) && $GLOBALS['phpgw_info']['user']['lastpasswd_change'] < time() - 86400 * 30) {
            $api_messages = lang('it has been more then %1 days since you changed your password', 30);
        }
    }
    // This is gonna change
    if (isset($cd)) {
        $var['messages'] = $api_messages . '<br>' . checkcode($cd);
    }
    $var['content_class'] = $sidecontent == 'sidebox' || $sidecontent == 'jsmenu' ? 'content' : 'content_nosidebox';
    $GLOBALS['phpgw']->template->set_var($var);
    $GLOBALS['phpgw']->template->pfp('out', 'navbar_header');
    if ($sidecontent == 'sidebox' || $sidecontent == 'jsmenu') {
        $menu_title = lang('General Menu');
        $menu['home'] = $navbar['home'];
        if (isset($navbar['preferences'])) {
            $menu['preferences'] = $navbar['preferences'];
        }
        $menu['about'] = array('text' => lang('About'), 'url' => $GLOBALS['phpgw']->link('/about.php', array('app' => $GLOBALS['phpgw_info']['flags']['currentapp'])));
        $menu['logout'] = $navbar['logout'];
        display_sidebox($menu_title, $menu);
    }
    if (isset($navigation[$GLOBALS['phpgw_info']['flags']['currentapp']]) && $GLOBALS['phpgw_info']['flags']['currentapp'] != 'admin' && $GLOBALS['phpgw_info']['flags']['currentapp'] != 'preferences') {
        $app = $GLOBALS['phpgw_info']['flags']['currentapp'];
        $GLOBALS['phpgw']->template->set_var('lang_title', $navbar[$app]['text']);
        $GLOBALS['phpgw']->template->pfp('out', 'extra_blocks_header');
        $menu = createObject('phpgwapi.menu');
        $app_menu = $menu->render_menu($app, $navigation[$app], $navbar[$app]);
        $GLOBALS['phpgw']->template->set_var(array('app_menu' => $app_menu));
        $GLOBALS['phpgw']->template->pfp('out', 'extra_blocks_menu');
        $GLOBALS['phpgw']->template->pfp('out', 'extra_blocks_footer');
    }
    if (isset($navbar['preferences']) && $GLOBALS['phpgw_info']['flags']['currentapp'] != 'preferences') {
        $prefs = execMethod('phpgwapi.menu.get', 'preferences');
        if (isset($prefs[$GLOBALS['phpgw_info']['flags']['currentapp']])) {
            //				display_sidebox(lang('preferences'), $prefs[$GLOBALS['phpgw_info']['flags']['currentapp']]);
        }
    }
    if (isset($navigation['admin'][$GLOBALS['phpgw_info']['flags']['currentapp']]['children'])) {
        //			display_sidebox(lang('administration'), $navigation['admin'][$GLOBALS['phpgw_info']['flags']['currentapp']]['children']);
    }
    $GLOBALS['phpgw']->template->pparse('out', 'navbar_footer');
    // If the application has a header include, we now include it
    if ((!isset($GLOBALS['phpgw_info']['flags']['noappheader']) || !$GLOBALS['phpgw_info']['flags']['noappheader']) && isset($_GET['menuaction'])) {
        list($app, $class, $method) = explode('.', $_GET['menuaction']);
        if (is_array($GLOBALS[$class]->public_functions) && isset($GLOBALS[$class]->public_functions['header'])) {
            $GLOBALS[$class]->header();
        }
    }
    $GLOBALS['phpgw']->template->set_root(PHPGW_APP_TPL);
    $GLOBALS['phpgw']->hooks->process('after_navbar');
}
Exemple #21
0
function parse_navbar($force = False)
{
    $tpl = createobject('phpgwapi.Template', PHPGW_TEMPLATE_DIR);
    $tpl->set_unknowns('remove');
    $tpl->set_file(array('navbar' => 'navbar.tpl', 'navbar_app' => 'navbar_app.tpl'));
    $tpl->set_block('navbar', 'app', 'apps');
    $tpl->set_block('navbar', 'prefs', 'prefs_block');
    $target = '';
    if (isset($GLOBALS['phpgw_info']['flags']['navbar_target']) && $GLOBALS['phpgw_info']['flags']['navbar_target']) {
        $target = ' target="' . $GLOBALS['phpgw_info']['flags']['navbar_target'] . '"';
    }
    $prefs_ok = False;
    foreach ($GLOBALS['phpgw_info']['navbar'] as $app => $app_data) {
        if ($app == 'preferences') {
            $tpl->set_var(array('prefs_url' => $app_data['url'], 'lang_prefs' => $app_data['title']));
            $tpl->parse('prefs_block', 'prefs');
            $prefs_ok = True;
            continue;
        }
        if ($app == 'logout' || $app == 'about') {
            continue;
        }
        $app_data['target'] = $target;
        $tpl->set_var($app_data);
        $tpl->parse('apps', 'app', True);
    }
    if (!$prefs_ok) {
        $tpl->set_var('prefs', '');
    }
    $var = array();
    $var['lang_applications'] = lang('applications');
    $var['img_base_url'] = $GLOBALS['phpgw_info']['server']['webserver_url'] . '/phpgwapi/templates/desktop/images/';
    $var['lang_logout'] = lang('logout');
    $var['logout_url'] = $GLOBALS['phpgw_info']['navbar']['logout']['url'];
    $var['lang_about'] = lang('about');
    $var['about_url'] = $GLOBALS['phpgw_info']['navbar']['about']['url'];
    $var['cur_app_title'] = $GLOBALS['phpgw_info']['navbar'][$GLOBALS['phpgw_info']['flags']['currentapp']]['title'];
    $var['cur_app_icon'] = $GLOBALS['phpgw_info']['navbar'][$GLOBALS['phpgw_info']['flags']['currentapp']]['icon'];
    if (isset($GLOBALS['phpgw_info']['server']['showpoweredbyon']) && $GLOBALS['phpgw_info']['server']['showpoweredbyon'] == 'top') {
        $var['powered_by'] = lang('Powered by phpGroupWare version %1', $GLOBALS['phpgw_info']['server']['versions']['phpgwapi']);
    }
    if (isset($GLOBALS['phpgw_info']['navbar']['admin']) && isset($GLOBALS['phpgw_info']['user']['preferences']['common']['show_currentusers']) && $GLOBALS['phpgw_info']['user']['preferences']['common']['show_currentusers']) {
        $var['current_users'] = '<a href="' . $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'admin.uicurrentsessions.list_sessions')) . '">&nbsp;' . lang('Current users') . ': ' . $GLOBALS['phpgw']->session->total() . '</a>';
    }
    $now = time();
    $var['user_info'] = $GLOBALS['phpgw']->common->display_fullname() . ' - ' . lang($GLOBALS['phpgw']->common->show_date($now, 'l')) . ' ' . $GLOBALS['phpgw']->common->show_date($now, $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
    // Maybe we should create a common function in the phpgw_accounts_shared.inc.php file
    // to get rid of duplicate code.
    if ($GLOBALS['phpgw_info']['user']['lastpasswd_change'] == 0) {
        $api_messages = lang('You are required to change your password during your first login') . '<br /> Click this image on the navbar: <img src="' . $GLOBALS['phpgw']->common->image('preferences', 'navbar.gif') . '">';
    } elseif ($GLOBALS['phpgw_info']['user']['lastpasswd_change'] < time() - 86400 * 30) {
        $api_messages = lang('it has been more then %1 days since you changed your password', 30);
    }
    // This is gonna change
    if (isset($cd)) {
        $var['messages'] = $api_messages . '<br />' . checkcode($cd);
    }
    if (isset($GLOBALS['phpgw_info']['flags']['app_header'])) {
        $var['current_app_header'] = $GLOBALS['phpgw_info']['flags']['app_header'];
    } else {
        $tpl->set_block('navbar', 'app_header', 'app_header');
        $var['app_header'] = '';
    }
    $tpl->set_var($var);
    $tpl->pfp('out', 'navbar');
    // If the application has a header include, we now include it
    if (!(isset($GLOBALS['phpgw_info']['flags']['noappheader']) && $GLOBALS['phpgw_info']['flags']['noappheader']) && isset($_GET['menuaction'])) {
        list($app, $class, $method) = explode('.', $_GET['menuaction']);
        if (is_array($GLOBALS[$class]->public_functions) && isset($GLOBALS[$class]->public_functions['header']) && $GLOBALS[$class]->public_functions['header']) {
            $GLOBALS[$class]->header();
        }
    }
    $GLOBALS['phpgw']->hooks->process('after_navbar');
    return;
}
function parse_navbar($force = False)
{
    $tpl = createobject('phpgwapi.Template', PHPGW_TEMPLATE_DIR);
    $tpl->set_unknowns('remove');
    $tpl->set_file(array('navbar' => 'navbar.tpl', 'navbar_app' => 'navbar_app.tpl'));
    $var['navbar_color'] = $GLOBALS['phpgw_info']['theme']['navbar_bg'];
    if ($GLOBALS['phpgw_info']['flags']['navbar_target']) {
        $target = ' target="' . $GLOBALS['phpgw_info']['flags']['navbar_target'] . '"';
    }
    $i = 1;
    foreach ($GLOBALS['phpgw_info']['navbar'] as $app => $app_data) {
        if ($GLOBALS['phpgw_info']['user']['preferences']['common']['navbar_format'] == 'text') {
            $tabs[$i]['label'] = $app_data['title'];
            $tabs[$i]['link'] = $app_data['url'];
            if (!empty($app_data['target'])) {
                $tabs[$i]['target'] = $app_data['target'];
            } elseif (!empty($target)) {
                $tabs[$i]['target'] = $target;
            }
            if (ereg($GLOBALS['phpgw_info']['navbar'][$app], $_SERVER['PHP_SELF'])) {
                $selected = $i;
            }
            $i++;
        } else {
            $title = '<img src="' . $app_data['icon'] . '" alt="' . $app_data['title'] . '" title="' . $app_data['title'] . '" border="0">';
            if ($GLOBALS['phpgw_info']['user']['preferences']['common']['navbar_format'] == 'icons_and_text') {
                $title .= "<br>" . $app_data['title'];
                $var['width'] = '7%';
            } else {
                $var['width'] = '3%';
            }
            $var['value'] = '<a href="' . $app_data['url'] . '"' . ($app_data['target'] ? $app_data['target'] : $target) . '>' . $title . '</a>';
            $var['align'] = 'center';
            $tpl->set_var($var);
            $tpl->parse('applications', 'navbar_app', True);
        }
    }
    if ($GLOBALS['phpgw_info']['user']['preferences']['common']['navbar_format'] == 'text') {
        $var['navbar_color'] = $GLOBALS['phpgw_info']['theme']['bg_color'];
        $var['align'] = 'right';
        $var['value'] = $GLOBALS['phpgw']->common->create_tabs($tabs, $selected, -1);
        $tpl->set_var($var);
        $tpl->parse('applications', 'navbar_app', True);
    }
    if ($GLOBALS['phpgw_info']['server']['showpoweredbyon'] == 'top') {
        $var['powered_by'] = lang('Powered by phpGroupWare version %1', $GLOBALS['phpgw_info']['server']['versions']['phpgwapi']);
    }
    if (isset($GLOBALS['phpgw_info']['navbar']['admin']) && $GLOBALS['phpgw_info']['user']['preferences']['common']['show_currentusers']) {
        $var['current_users'] = '<a href="' . $GLOBALS['phpgw']->link('/index.php', 'menuaction=admin.uicurrentsessions.list_sessions') . '">&nbsp;' . lang('Current users') . ': ' . $GLOBALS['phpgw']->session->total() . '</a>';
    }
    $now = time();
    $var['user_info'] = $GLOBALS['phpgw']->common->display_fullname() . ' - ' . lang($GLOBALS['phpgw']->common->show_date($now, 'l')) . ' ' . $GLOBALS['phpgw']->common->show_date($now, $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
    //				. lang($GLOBALS['phpgw']->common->show_date($now,'F')) . ' '
    //				. $GLOBALS['phpgw']->common->show_date($now,'d, Y');
    // Maybe we should create a common function in the phpgw_accounts_shared.inc.php file
    // to get rid of duplicate code.
    if ($GLOBALS['phpgw_info']['user']['lastpasswd_change'] == 0) {
        $api_messages = lang('You are required to change your password during your first login') . '<br> Click this image on the navbar: <img src="' . $GLOBALS['phpgw']->common->image('preferences', 'navbar.gif') . '">';
    } elseif ($GLOBALS['phpgw_info']['user']['lastpasswd_change'] < time() - 86400 * 30) {
        $api_messages = lang('it has been more then %1 days since you changed your password', 30);
    }
    // This is gonna change
    if (isset($cd)) {
        $var['messages'] = $api_messages . '<br>' . checkcode($cd);
    }
    if (isset($GLOBALS['phpgw_info']['flags']['app_header'])) {
        $var['current_app_header'] = $GLOBALS['phpgw_info']['flags']['app_header'];
        $var['th_bg'] = $GLOBALS['phpgw_info']['theme']['th_bg'];
    } else {
        $tpl->set_block('navbar', 'app_header', 'app_header');
        $var['app_header'] = '';
    }
    $tpl->set_var($var);
    $tpl->pfp('out', 'navbar');
    // If the application has a header include, we now include it
    if (!@$GLOBALS['phpgw_info']['flags']['noappheader'] && @isset($_GET['menuaction'])) {
        list($app, $class, $method) = explode('.', $_GET['menuaction']);
        if (is_array($GLOBALS[$class]->public_functions) && $GLOBALS[$class]->public_functions['header']) {
            $GLOBALS[$class]->header();
        }
    }
    $GLOBALS['phpgw']->hooks->process('after_navbar');
    return;
}