当前位置: 首页>>代码示例>>PHP>>正文


PHP is_disabled函数代码示例

本文整理汇总了PHP中is_disabled函数的典型用法代码示例。如果您正苦于以下问题:PHP is_disabled函数的具体用法?PHP is_disabled怎么用?PHP is_disabled使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了is_disabled函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: admin

function admin($message = '')
{
    global $txp_user;
    pagetop(gTxt('site_administration'), $message);
    if (is_disabled('mail')) {
        echo tag(gTxt('warn_mail_unavailable'), 'p', ' id="warning" ');
    }
    $email = fetch('email', 'txp_users', 'name', $txp_user);
    if (has_privs('admin.edit')) {
        echo author_form();
    }
    if (has_privs('admin.list')) {
        echo author_list();
    }
    echo new_pass_form();
    if (!has_privs('admin.edit')) {
        echo change_email_form($email);
    }
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:19,代码来源:txp_admin.php

示例2: getDbInfo

function getDbInfo()
{
    $GLOBALS['textarray'] = setup_load_lang(ps('lang'));
    @(include txpath . '/config.php');
    if (!empty($txpcfg['db'])) {
        exit(graf(gTxt('already_installed', array('{txpath}' => txpath))));
    }
    if (@$_SERVER['SCRIPT_NAME'] && (@$_SERVER['SERVER_NAME'] || @$_SERVER['HTTP_HOST'])) {
        $guess_siteurl = @$_SERVER['HTTP_HOST'] ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'];
        $guess_siteurl .= $GLOBALS['rel_siteurl'];
    } else {
        $guess_siteurl = 'mysite.com';
    }
    echo '<form action="' . $GLOBALS['rel_siteurl'] . '/textpattern/setup/index.php" method="post">', '<table id="setup" cellpadding="0" cellspacing="0" border="0">', tr(tda(hed(gTxt('welcome_to_textpattern'), 3) . graf(gTxt('need_details'), ' style="margin-bottom:3em"') . hed('MySQL', 3) . graf(gTxt('db_must_exist')), ' width="400" height="50" colspan="4" align="left"')), tr(fLabelCell(gTxt('mysql_login')) . fInputCell('duser', '', 1) . fLabelCell(gTxt('mysql_password')) . fInputCell('dpass', '', 2)), tr(fLabelCell(gTxt('mysql_server')) . fInputCell('dhost', 'localhost', 3) . fLabelCell(gTxt('mysql_database')) . fInputCell('ddb', '', 4)), tr(fLabelCell(gTxt('table_prefix')) . fInputCell('dprefix', '', 5) . tdcs(small(gTxt('prefix_warning')), 2)), tr(tdcs('&nbsp;', 4)), tr(tdcs(hed(gTxt('site_url'), 3) . graf(gTxt('please_enter_url')), 4)), tr(fLabelCell('http://') . tdcs(fInput('text', 'siteurl', $guess_siteurl, 'edit', '', '', 40) . popHelp('siteurl'), 3));
    if (is_disabled('mail')) {
        echo tr(tdcs(gTxt('warn_mail_unavailable'), 3, null, '" style="color:red;text-align:center'));
    }
    echo tr(td() . td(fInput('submit', 'Submit', gTxt('next'), 'publish')) . td() . td());
    echo endTable(), hInput('lang', LANG), sInput('printConfig'), '</form>';
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:20,代码来源:index.php

示例3: author_edit

function author_edit($message = '')
{
    global $txp_user;
    pagetop(gTxt('site_administration'), $message);
    if (is_disabled('mail')) {
        echo tag(gTxt('warn_mail_unavailable'), 'p', ' id="warning" ');
    }
    $email = fetch('email', 'txp_users', 'name', $txp_user);
    echo n . '<div id="users_container" class="txp-container">';
    if (has_privs('admin.edit')) {
        echo n . '<div class="txp-edit">' . author_form() . '</div>';
    }
    if (has_privs('admin.list')) {
        echo author_list();
    }
    echo new_pass_form();
    if (!has_privs('admin.edit')) {
        echo change_email_form($email);
    }
    echo n . '</div>';
}
开发者ID:psic,项目名称:websites,代码行数:21,代码来源:txp_admin.php

示例4: updateUpdate

 function updateUpdate($param)
 {
     // This is sort of a hack... The ssl configuration of the ipaddress has to be reflected properly in the domain too. So the web objects are initialized, the ssl parameters are changed on the fly and synced again. All this is because, apache will refuse to start if the ssl files are missing, which is fucking terrible. (later)... Apache is actually ok. The whole damn problem is with iis. Be careful about the createExtraVariables. As for now, the web object doesn't create objects from the parent domain object, and thus web object will work indepnednely without the help of the domain parent object. Thus the parent of the web can anything. But if in the at any time in the future the web object starts needing any parameter from the domain, then this will have to be rewritten. Then the domain objects have to initialized first, then the web objects are initialized, and the web can be created only UNDER the domain, and not directly under this object.
     global $gbl, $sgbl, $login, $ghtml;
     $driverapp = $gbl->getSyncClass($this->__masterserver, $this->__readserver, 'web');
     $olddom = $this->domain;
     $newdom = $param['domain'];
     if (!csb($newdom, "lxdummy") && !is_disabled($newdom)) {
         $ip = gethostbyname($newdom);
         if ($ip != $this->getParentO()->ipaddr) {
             throw new lxexception("this_domain_does_not_resolve_to_this_ip", 'domain', $newdom);
         }
     }
     $this->domain = $param['domain'];
     $this->ipaddr = $this->getParentO()->ipaddr;
     $this->setUpdateSubaction();
     $this->write();
     if ($olddom) {
         $odo = new Web(null, $this->syncserver, $olddom);
         $odo->get();
         // Need to get the client here itself so that it won't run into problems later. You don't need the client anymore...
         //$odo->getParentO()->getParentO();
         if ($odo->dbaction !== 'add') {
             $odo->setUpdateSubaction('fixipdomain');
             $odo->was();
         }
     }
     if ($olddom === $newdom) {
         return;
     }
     if (is_disabled($newdom)) {
         return;
     }
     $ndo = new Web(null, $this->syncserver, $newdom);
     $ndo->get();
     //$ndo->getParentO()->getParentO(); //you don't need client anymore..
     $ndo->setUpdateSubaction('fixipdomain');
     $ndo->was();
 }
开发者ID:lonelywoolf,项目名称:hypervm,代码行数:39,代码来源:domainipaddresslib.php

示例5: run_awstats

 static function run_awstats($statsprog, $list)
 {
     global $gbl, $sgbl, $login, $ghtml;
     global $global_dontlogshell;
     log_log("run_stats", "In awstats");
     $global_dontlogshell = true;
     foreach ($list as $p) {
         log_log("run_stats", "In awstats for {$p->nname} {$statsprog}");
         if ($p->priv->isOn('awstats_flag')) {
             lxfile_mkdir("__path_httpd_root/{$p->nname}/webstats/");
             $name = $p->nname;
             web::createstatsConf($p->nname, $p->stats_username, $p->stats_password);
             if (is_disabled($statsprog)) {
                 continue;
             }
             log_log("run_stats", "Execing {$statsprog}");
             //system("rm /home/httpd/$p->nname/webstats/*");
             if ($statsprog === 'webalizer') {
                 print "webalizer: {$p->nname}\n";
                 lxshell_return("nice", "-n", "15", "webalizer", "-n", $p->nname, "-t", $p->nname, "-c", "__path_real_etc_root/webalizer/webalizer.{$p->nname}.conf");
             } else {
                 print "awstats: {$p->nname}\n";
                 putenv("GATEWAY_INTERFACE=");
                 //system("nice -n 15 perl /home/kloxo/httpd/awstats/wwwroot/cgi-bin/awstats.pl -update -config=$name > /tmp/test 2>&1");
                 lxshell_return("nice", "-n", "15", "perl", "__path_kloxo_httpd_root/awstats/wwwroot/cgi-bin/awstats.pl", "-update", "-config={$name}");
                 //lxshell_return("__path_kloxo_httpd_root/awstats/tools/awstats_buildstaticpages.pl", "-awstatsprog=$sgbl->__path_kloxo_httpd_root/awstats/wwwroot/cgi-bin/awstats.pl", "-dir=$sgbl->__path_httpd_root/$name/webstats/", "-config=$name");
                 //lxfile_cp("__path_httpd_root/$name/webstats/awstats.$name.html", "__path_httpd_root/$name/webstats/index.html");
             }
         }
     }
     /// Needed to get the domain list from the files in the /etc/awstats directory.
     /*	$list = lscandir_without_dot("__path_real_etc_root/awstats");
     	foreach($list as $l) {
     		$p = preg_replace("/awstats\.(.*)\.conf/", "$1", $l);
     		dprint($p);
     		dprint("\n");
     */
 }
开发者ID:zseand,项目名称:kloxo,代码行数:38,代码来源:webtrafficlib.php

示例6: getDbInfo

function getDbInfo()
{
    $lang = ps('lang');
    if ($lang) {
        $_SESSION['lang'] = $lang;
    }
    $GLOBALS['textarray'] = setup_load_lang($_SESSION['lang']);
    global $txpcfg;
    echo n . '<div id="setup_container" class="txp-container">', txp_setup_progress_meter(1), n . '<div class="txp-setup">';
    if (!isset($txpcfg['db'])) {
        @(include txpath . '/config.php');
    }
    if (!empty($txpcfg['db'])) {
        echo graf('<span class="warning">' . setup_gTxt('already_installed', array('{txpath}' => txpath)) . '</span>') . n . setup_back_button(__FUNCTION__) . n . '</div>' . n . '</div>';
        exit;
    }
    if (isset($_SESSION['siteurl'])) {
        $guess_siteurl = $_SESSION['siteurl'];
    } elseif (@$_SERVER['SCRIPT_NAME'] && (@$_SERVER['SERVER_NAME'] || @$_SERVER['HTTP_HOST'])) {
        $guess_siteurl = @$_SERVER['HTTP_HOST'] ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'];
        $guess_siteurl .= $GLOBALS['rel_siteurl'];
    } else {
        $guess_siteurl = 'mysite.com';
    }
    echo '<form action="' . txpspecialchars($_SERVER['PHP_SELF']) . '" method="post">' . n . hed(setup_gTxt('need_details'), 1) . n . hed('MySQL', 2) . n . graf(setup_gTxt('db_must_exist')) . n . graf('<span class="edit-label"><label for="setup_mysql_login">' . setup_gTxt('mysql_login') . '</label></span>' . n . '<span class="edit-value">' . fInput('text', 'duser', isset($_SESSION['duser']) ? txpspecialchars($_SESSION['duser']) : '', '', '', '', INPUT_REGULAR, '', 'setup_mysql_login') . '</span>') . n . graf('<span class="edit-label"><label for="setup_mysql_pass">' . setup_gTxt('mysql_password') . '</label></span>' . n . '<span class="edit-value">' . fInput('text', 'dpass', isset($_SESSION['dpass']) ? txpspecialchars($_SESSION['dpass']) : '', '', '', '', INPUT_REGULAR, '', 'setup_mysql_pass') . '</span>') . n . graf('<span class="edit-label"><label for="setup_mysql_server">' . setup_gTxt('mysql_server') . '</label></span>' . n . '<span class="edit-value">' . fInput('text', 'dhost', isset($_SESSION['dhost']) ? txpspecialchars($_SESSION['dhost']) : 'localhost', '', '', '', INPUT_REGULAR, '', 'setup_mysql_server') . '</span>') . n . graf('<span class="edit-label"><label for="setup_mysql_db">' . setup_gTxt('mysql_database') . '</label></span>' . n . '<span class="edit-value">' . fInput('text', 'ddb', isset($_SESSION['ddb']) ? txpspecialchars($_SESSION['ddb']) : '', '', '', '', INPUT_REGULAR, '', 'setup_mysql_db') . '</span>') . n . graf('<span class="edit-label"><label for="setup_table_prefix">' . setup_gTxt('table_prefix') . '</label>' . sp . popHelp('table_prefix') . '</span>' . n . '<span class="edit-value">' . fInput('text', 'dprefix', isset($_SESSION['dprefix']) ? txpspecialchars($_SESSION['dprefix']) : '', '', '', '', INPUT_REGULAR, '', 'setup_table_prefix') . '</span>') . n . hed(setup_gTxt('site_url'), 2) . n . graf(setup_gTxt('please_enter_url')) . n . graf('<span class="edit-label"><label for="setup_site_url">http://</label>' . sp . popHelp('siteurl') . '</span>' . n . '<span class="edit-value">' . fInput('text', 'siteurl', txpspecialchars($guess_siteurl), '', '', '', INPUT_REGULAR, '', 'setup_site_url') . '</span>');
    if (is_disabled('mail')) {
        echo n . graf('<span class="warning">' . setup_gTxt('warn_mail_unavailable') . '</span>');
    }
    echo n . graf(fInput('submit', 'Submit', setup_gTxt('next_step', '', 'raw'), 'publish'));
    echo n . sInput('printConfig') . n . '</form>' . n . '</div>' . n . '</div>';
}
开发者ID:balcides,项目名称:Cathartic_server,代码行数:31,代码来源:index.php

示例7: author_list

/**
 * The main author list.
 *
 * @param string|array $message The activity message
 */
function author_list($message = '')
{
    global $txp_user, $author_list_pageby;
    pagetop(gTxt('tab_site_admin'), $message);
    if (is_disabled('mail')) {
        echo graf(span(null, array('class' => 'ui-icon ui-icon-alert')) . ' ' . gTxt('warn_mail_unavailable'), array('class' => 'alert-block warning'));
    }
    echo hed(gTxt('tab_site_admin'), 1, array('class' => 'txp-heading'));
    echo n . '<div id="users_control" class="txp-control-panel">';
    $buttons = array();
    // Change password button.
    $buttons[] = sLink('admin', 'new_pass_form', gTxt('change_password'));
    if (!has_privs('admin.edit')) {
        // Change email address button.
        $buttons[] = sLink('admin', 'change_email_form', gTxt('change_email_address'));
    } else {
        // New author button.
        $buttons[] = sLink('admin', 'author_edit', gTxt('add_new_author'));
    }
    echo graf(join(n, $buttons), array('class' => 'txp-buttons'));
    // User list.
    if (has_privs('admin.list')) {
        extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));
        if ($sort === '') {
            $sort = get_pref('admin_sort_column', 'name');
        }
        if ($dir === '') {
            $dir = get_pref('admin_sort_dir', 'asc');
        }
        $dir = $dir == 'desc' ? 'desc' : 'asc';
        if (!in_array($sort, array('name', 'RealName', 'email', 'privs', 'last_login'))) {
            $sort = 'name';
        }
        $sort_sql = $sort . ' ' . $dir;
        set_pref('admin_sort_column', $sort, 'admin', 2, '', 0, PREF_PRIVATE);
        set_pref('admin_sort_dir', $dir, 'admin', 2, '', 0, PREF_PRIVATE);
        $switch_dir = $dir == 'desc' ? 'asc' : 'desc';
        $criteria = 1;
        if ($search_method and $crit != '') {
            $verbatim = preg_match('/^"(.*)"$/', $crit, $m);
            $crit_escaped = $verbatim ? doSlash($m[1]) : doLike($crit);
            $critsql = $verbatim ? array('id' => "user_id in ('" . join("','", do_list($crit_escaped)) . "')", 'login' => "name = '{$crit_escaped}'", 'real_name' => "RealName = '{$crit_escaped}'", 'email' => "email = '{$crit_escaped}'", 'privs' => "convert(privs, char) in ('" . join("','", do_list($crit_escaped)) . "')") : array('id' => "user_id in ('" . join("','", do_list($crit_escaped)) . "')", 'login' => "name like '%{$crit_escaped}%'", 'real_name' => "RealName like '%{$crit_escaped}%'", 'email' => "email like '%{$crit_escaped}%'", 'privs' => "convert(privs, char) in ('" . join("','", do_list($crit_escaped)) . "')");
            if (array_key_exists($search_method, $critsql)) {
                $criteria = $critsql[$search_method];
            } else {
                $search_method = '';
                $crit = '';
            }
        } else {
            $search_method = '';
            $crit = '';
        }
        $criteria .= callback_event('admin_criteria', 'author_list', 0, $criteria);
        $total = getCount('txp_users', $criteria);
        if ($total < 1) {
            if ($criteria != 1) {
                echo n . author_search_form($crit, $search_method) . graf(gTxt('no_results_found'), ' class="indicator"') . '</div>';
            }
            return;
        }
        $limit = max($author_list_pageby, 15);
        list($page, $offset, $numPages) = pager($total, $limit, $page);
        $use_multi_edit = has_privs('admin.edit') && safe_count('txp_users', '1=1') > 1;
        echo author_search_form($crit, $search_method) . '</div>';
        $rs = safe_rows_start('*, unix_timestamp(last_access) as last_login', 'txp_users', "{$criteria} order by {$sort_sql} limit {$offset}, {$limit}");
        if ($rs) {
            echo n . tag_start('div', array('id' => 'users_container', 'class' => 'txp-container')) . n . tag_start('form', array('action' => 'index.php', 'id' => 'users_form', 'class' => 'multi_edit_form', 'method' => 'post', 'name' => 'longform')) . n . tag_start('div', array('class' => 'txp-listtables')) . n . tag_start('table', array('class' => 'txp-list')) . n . tag_start('thead') . tr(($use_multi_edit ? hCell(fInput('checkbox', 'select_all', 0, '', '', '', '', '', 'select_all'), '', ' scope="col" title="' . gTxt('toggle_all_selected') . '" class="txp-list-col-multi-edit"') : hCell('', '', ' scope="col" class="txp-list-col-multi-edit"')) . column_head('login_name', 'name', 'admin', true, $switch_dir, '', '', ('name' == $sort ? "{$dir} " : '') . 'txp-list-col-login-name name') . column_head('real_name', 'RealName', 'admin', true, $switch_dir, '', '', ('RealName' == $sort ? "{$dir} " : '') . 'txp-list-col-real-name name') . column_head('email', 'email', 'admin', true, $switch_dir, '', '', ('email' == $sort ? "{$dir} " : '') . 'txp-list-col-email') . column_head('privileges', 'privs', 'admin', true, $switch_dir, '', '', ('privs' == $sort ? "{$dir} " : '') . 'txp-list-col-privs') . column_head('last_login', 'last_login', 'admin', true, $switch_dir, '', '', ('last_login' == $sort ? "{$dir} " : '') . 'txp-list-col-last-login date')) . n . tag_end('thead') . n . tag_start('tbody');
            while ($a = nextRow($rs)) {
                extract(doSpecial($a));
                echo tr(td((has_privs('admin.edit') and $txp_user != $a['name']) ? fInput('checkbox', 'selected[]', $a['name'], 'checkbox') : '', '', 'txp-list-col-multi-edit') . hCell(has_privs('admin.edit') ? eLink('admin', 'author_edit', 'user_id', $user_id, $name) : $name, '', ' scope="row" class="txp-list-col-login-name name"') . td($RealName, '', 'txp-list-col-real-name name') . td(href($email, 'mailto:' . $email), '', 'txp-list-col-email') . td(get_priv_level($privs), '', 'txp-list-col-privs') . td($last_login ? safe_strftime('%b&#160;%Y', $last_login) : '', '', 'txp-list-col-last-login date'));
            }
            echo n . tag_end('tbody') . n . tag_end('table') . n . tag_end('div') . ($use_multi_edit ? author_multiedit_form($page, $sort, $dir, $crit, $search_method) : '') . tInput() . n . tag_end('form') . n . tag_start('div', array('id' => 'users_navigation', 'class' => 'txp-navigation')) . pageby_form('admin', $author_list_pageby) . nav_form('admin', $page, $numPages, $sort, $dir, $crit, $search_method) . n . tag_end('div') . n . tag_end('div');
        }
    } else {
        echo n . tag_end('div');
    }
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:82,代码来源:txp_admin.php

示例8: author_list

function author_list($message = '')
{
    global $txp_user, $author_list_pageby;
    pagetop(gTxt('tab_site_admin'), $message);
    if (is_disabled('mail')) {
        echo tag(gTxt('warn_mail_unavailable'), 'p', ' class="alert-block warning" ');
    }
    echo '<h1 class="txp-heading">' . gTxt('tab_site_admin') . '</h1>';
    echo '<div id="users_control" class="txp-control-panel">';
    // Change password button
    echo '<p class="txp-buttons">';
    echo sLink('admin', 'new_pass_form', gTxt('change_password'));
    // Change email address button
    if (!has_privs('admin.edit')) {
        echo n . sLink('admin', 'change_email_form', gTxt('change_email_address'));
    }
    // User list
    if (has_privs('admin.list')) {
        extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));
        if ($sort === '') {
            $sort = get_pref('admin_sort_column', 'name');
        }
        if ($dir === '') {
            $dir = get_pref('admin_sort_dir', 'asc');
        }
        $dir = $dir == 'desc' ? 'desc' : 'asc';
        if (!in_array($sort, array('name', 'RealName', 'email', 'privs', 'last_login'))) {
            $sort = 'name';
        }
        $sort_sql = $sort . ' ' . $dir;
        set_pref('admin_sort_column', $sort, 'admin', 2, '', 0, PREF_PRIVATE);
        set_pref('admin_sort_dir', $dir, 'admin', 2, '', 0, PREF_PRIVATE);
        $switch_dir = $dir == 'desc' ? 'asc' : 'desc';
        $criteria = 1;
        if ($search_method and $crit != '') {
            $crit_escaped = doSlash(str_replace(array('\\', '%', '_', '\''), array('\\\\', '\\%', '\\_', '\\\''), $crit));
            $critsql = array('id' => "user_id in ('" . join("','", do_list($crit_escaped)) . "')", 'login' => "name like '%{$crit_escaped}%'", 'real_name' => "RealName like '%{$crit_escaped}%'", 'email' => "email like '%{$crit_escaped}%'", 'privs' => "privs in ('" . join("','", do_list($crit_escaped)) . "')");
            if (array_key_exists($search_method, $critsql)) {
                $criteria = $critsql[$search_method];
            } else {
                $search_method = '';
                $crit = '';
            }
        } else {
            $search_method = '';
            $crit = '';
        }
        $criteria .= callback_event('admin_criteria', 'author_list', 0, $criteria);
        $total = getCount('txp_users', $criteria);
        // New author button
        if (has_privs('admin.edit')) {
            echo n . sLink('admin', 'author_edit', gTxt('add_new_author'));
        }
        echo '</p>';
        // end txp-buttons
        if ($total < 1) {
            if ($criteria != 1) {
                echo n . author_search_form($crit, $search_method) . n . graf(gTxt('no_results_found'), ' class="indicator"') . '</div>';
            }
            return;
        }
        $limit = max($author_list_pageby, 15);
        list($page, $offset, $numPages) = pager($total, $limit, $page);
        $use_multi_edit = has_privs('admin.edit') && safe_count('txp_users', '1=1') > 1;
        echo author_search_form($crit, $search_method) . '</div>';
        $rs = safe_rows_start('*, unix_timestamp(last_access) as last_login', 'txp_users', "{$criteria} order by {$sort_sql} limit {$offset}, {$limit}");
        if ($rs) {
            echo n . '<div id="users_container" class="txp-container">';
            echo '<form action="index.php" id="users_form" class="multi_edit_form" method="post" name="longform">' . n . '<div class="txp-listtables">' . n . startTable('', '', 'txp-list') . n . '<thead>' . n . tr(n . ($use_multi_edit ? hCell(fInput('checkbox', 'select_all', 0, '', '', '', '', '', 'select_all'), '', ' title="' . gTxt('toggle_all_selected') . '" class="multi-edit"') : hCell('', '', ' class="multi-edit"')) . n . column_head('login_name', 'name', 'admin', true, $switch_dir, '', '', ('name' == $sort ? "{$dir} " : '') . 'name login-name') . n . column_head('real_name', 'RealName', 'admin', true, $switch_dir, '', '', ('RealName' == $sort ? "{$dir} " : '') . 'name real-name') . n . column_head('email', 'email', 'admin', true, $switch_dir, '', '', ('email' == $sort ? "{$dir} " : '') . 'email') . n . column_head('privileges', 'privs', 'admin', true, $switch_dir, '', '', ('privs' == $sort ? "{$dir} " : '') . 'privs') . n . column_head('last_login', 'last_login', 'admin', true, $switch_dir, '', '', ('last_login' == $sort ? "{$dir} " : '') . 'date last-login modified')) . n . '</thead>';
            echo '<tbody>';
            while ($a = nextRow($rs)) {
                extract(doSpecial($a));
                echo tr(td((has_privs('admin.edit') and $txp_user != $a['name']) ? fInput('checkbox', 'selected[]', $a['name'], 'checkbox') : '', '', 'multi-edit') . td(has_privs('admin.edit') ? eLink('admin', 'author_edit', 'user_id', $user_id, $name) : $name, '', 'name login-name') . td($RealName, '', 'name real-name') . td('<a href="mailto:' . $email . '">' . $email . '</a>', '', 'email') . td(get_priv_level($privs), '', 'privs') . td($last_login ? safe_strftime('%b&#160;%Y', $last_login) : '', '', 'date last-login modified'));
            }
            echo '</tbody>', n, endTable(), n, '</div>', n, $use_multi_edit ? author_multiedit_form($page, $sort, $dir, $crit, $search_method) : '', n, tInput(), n, '</form>', n, '<div id="users_navigation" class="txp-navigation">', n, nav_form('admin', $page, $numPages, $sort, $dir, $crit, $search_method), n, pageby_form('admin', $author_list_pageby), n, '</div>', n, '</div>';
        }
    } else {
        echo '</div>';
    }
}
开发者ID:balcides,项目名称:Cathartic_server,代码行数:80,代码来源:txp_admin.php

示例9: doDiagnostics

/**
 * Outputs a diagnostics report.
 *
 * This is the main panel.
 */
function doDiagnostics()
{
    global $prefs, $files, $txpcfg, $event, $step, $theme, $DB;
    extract(get_prefs());
    $urlparts = parse_url(hu);
    $mydomain = $urlparts['host'];
    $is_apache = stristr(serverSet('SERVER_SOFTWARE'), 'Apache') || is_callable('apache_get_version');
    $real_doc_root = isset($_SERVER['DOCUMENT_ROOT']) ? realpath($_SERVER['DOCUMENT_ROOT']) : '';
    // ini_get() returns string values passed via php_value as a string, not boolean.
    $is_register_globals = (strcasecmp(ini_get('register_globals'), 'on') === 0 or ini_get('register_globals') === '1');
    // Check for Textpattern updates, at most once every 24 hours.
    $now = time();
    $updateInfo = unserialize(get_pref('last_update_check', ''));
    if (!$updateInfo || $now > $updateInfo['when'] + 60 * 60 * 24) {
        $updates = checkUpdates();
        $updateInfo['msg'] = $updates ? gTxt($updates['msg'], array('{version}' => $updates['version'])) : '';
        $updateInfo['when'] = $now;
        set_pref('last_update_check', serialize($updateInfo), 'publish', PREF_HIDDEN, 'text_input');
    }
    $fail = array();
    if (!empty($updateInfo['msg'])) {
        $fail['textpattern_version_update'] = diag_msg_wrap($updateInfo['msg'], 'information');
    }
    if (!is_callable('version_compare') || version_compare(PHP_VERSION, REQUIRED_PHP_VERSION, '<')) {
        $fail['php_version_required'] = diag_msg_wrap(gTxt('php_version_required', array('{version}' => REQUIRED_PHP_VERSION)));
    }
    if (!isset($path_to_site)) {
        $fail['path_to_site_missing'] = diag_msg_wrap(gTxt('path_to_site_missing'), 'warning');
    }
    if (@gethostbyname($mydomain) === $mydomain) {
        $fail['dns_lookup_fails'] = diag_msg_wrap(gTxt('dns_lookup_fails') . cs . $mydomain, 'warning');
    }
    if (!@is_dir($path_to_site)) {
        $fail['path_to_site_inacc'] = diag_msg_wrap(gTxt('path_to_site_inacc') . cs . $path_to_site);
    }
    if (rtrim($siteurl, '/') != $siteurl) {
        $fail['site_trailing_slash'] = diag_msg_wrap(gTxt('site_trailing_slash') . cs . $path_to_site, 'warning');
    }
    if (!@is_file($path_to_site . "/index.php") || !@is_readable($path_to_site . "/index.php")) {
        $fail['index_inaccessible'] = diag_msg_wrap("{$path_to_site}/index.php " . gTxt('is_inaccessible'));
    }
    $not_readable = array();
    if (!@is_writable($path_to_site . '/' . $img_dir)) {
        $not_readable[] = diag_msg_wrap(str_replace('{dirtype}', gTxt('img_dir'), gTxt('dir_not_writable')) . ": {$path_to_site}/{$img_dir}", 'warning');
    }
    if (!@is_writable($file_base_path)) {
        $not_readable[] = diag_msg_wrap(str_replace('{dirtype}', gTxt('file_base_path'), gTxt('dir_not_writable')) . ": {$file_base_path}", 'warning');
    }
    if (!@is_writable($tempdir)) {
        $not_readable[] = diag_msg_wrap(str_replace('{dirtype}', gTxt('tempdir'), gTxt('dir_not_writable')) . ": {$tempdir}", 'warning');
    }
    if ($not_readable) {
        $fail['dir_not_writable'] = join(n, $not_readable);
    }
    if ($permlink_mode != 'messy' && !$is_apache) {
        $fail['cleanurl_only_apache'] = diag_msg_wrap(gTxt('cleanurl_only_apache'), 'information');
    }
    if ($permlink_mode != 'messy' and !@is_readable($path_to_site . '/.htaccess')) {
        $fail['htaccess_missing'] = diag_msg_wrap(gTxt('htaccess_missing'));
    }
    if ($permlink_mode != 'messy' and is_callable('apache_get_modules') and !apache_module('mod_rewrite')) {
        $fail['mod_rewrite_missing'] = diag_msg_wrap(gTxt('mod_rewrite_missing'));
    }
    if (!ini_get('file_uploads')) {
        $fail['file_uploads_disabled'] = diag_msg_wrap(gTxt('file_uploads_disabled'), 'information');
    }
    if (@is_dir(txpath . DS . 'setup')) {
        $fail['setup_still_exists'] = diag_msg_wrap(txpath . DS . "setup" . DS . ' ' . gTxt('still_exists'), 'warning');
    }
    if (empty($tempdir)) {
        $fail['no_temp_dir'] = diag_msg_wrap(gTxt('no_temp_dir'), 'warning');
    }
    if (is_disabled('mail')) {
        $fail['warn_mail_unavailable'] = diag_msg_wrap(gTxt('warn_mail_unavailable'), 'warning');
    }
    if ($is_register_globals) {
        $fail['warn_register_globals_or_update'] = diag_msg_wrap(gTxt('warn_register_globals_or_update'), 'warning');
    }
    if ($permlink_mode != 'messy') {
        $rs = safe_column("name", "txp_section", "1");
        foreach ($rs as $name) {
            if ($name and @file_exists($path_to_site . '/' . $name)) {
                $fail['old_placeholder_exists'] = diag_msg_wrap(gTxt('old_placeholder') . ": {$path_to_site}/{$name}");
            }
        }
    }
    $cs = check_file_integrity(INTEGRITY_REALPATH);
    if (!$cs) {
        $cs = array();
    }
    // Files that don't match their checksums.
    if ($modified_files = array_keys($cs, INTEGRITY_MODIFIED)) {
        $fail['modified_files'] = diag_msg_wrap(gTxt('modified_files') . cs . n . t . join(', ' . n . t, $modified_files), 'warning');
    }
    // Running development code in live mode is not recommended.
//.........这里部分代码省略.........
开发者ID:bgarrels,项目名称:textpattern,代码行数:101,代码来源:txp_diag.php

示例10: author_list

/**
 * The main panel listing all authors.
 *
 * @param string|array $message The activity message
 */
function author_list($message = '')
{
    global $event, $txp_user, $author_list_pageby, $levels;
    pagetop(gTxt('tab_site_admin'), $message);
    if (is_disabled('mail')) {
        echo graf(span(null, array('class' => 'ui-icon ui-icon-alert')) . ' ' . gTxt('warn_mail_unavailable'), array('class' => 'alert-block warning'));
    }
    $buttons = array();
    // Change password button.
    $buttons[] = sLink('admin', 'new_pass_form', gTxt('change_password'), 'txp-button');
    if (!has_privs('admin.edit')) {
        // Change email address button.
        $buttons[] = sLink('admin', 'change_email_form', gTxt('change_email_address'), 'txp-button');
    } else {
        // New author button.
        $buttons[] = sLink('admin', 'author_edit', gTxt('add_new_author'), 'txp-button');
    }
    // User list.
    if (has_privs('admin.list')) {
        extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));
        if ($sort === '') {
            $sort = get_pref('admin_sort_column', 'name');
        } else {
            if (!in_array($sort, array('name', 'RealName', 'email', 'privs', 'last_login'))) {
                $sort = 'name';
            }
            set_pref('admin_sort_column', $sort, 'admin', 2, '', 0, PREF_PRIVATE);
        }
        if ($dir === '') {
            $dir = get_pref('admin_sort_dir', 'asc');
        } else {
            $dir = $dir == 'desc' ? "desc" : "asc";
            set_pref('admin_sort_dir', $dir, 'admin', 2, '', 0, PREF_PRIVATE);
        }
        $sort_sql = $sort . ' ' . $dir;
        $switch_dir = $dir == 'desc' ? 'asc' : 'desc';
        $search = new Filter($event, array('login' => array('column' => 'txp_users.name', 'label' => gTxt('login_name')), 'RealName' => array('column' => 'txp_users.RealName', 'label' => gTxt('real_name')), 'email' => array('column' => 'txp_users.email', 'label' => gTxt('email')), 'privs' => array('column' => array('txp_users.privs'), 'label' => gTxt('privileges'), 'type' => 'boolean')));
        $search->setAliases('privs', $levels);
        list($criteria, $crit, $search_method) = $search->getFilter();
        $search_render_options = array('placeholder' => 'search_users');
        $total = getCount('txp_users', $criteria);
        echo n . tag(hed(gTxt('tab_site_admin'), 1, array('class' => 'txp-heading')), 'div', array('class' => 'txp-layout-2col-cell-1'));
        $searchBlock = n . tag($search->renderForm('author_list', $search_render_options), 'div', array('class' => 'txp-layout-2col-cell-2', 'id' => 'users_control'));
        $createBlock = array();
        $createBlock[] = n . tag(implode(n, $buttons), 'div', array('class' => 'txp-control-panel'));
        $contentBlockStart = n . tag_start('div', array('class' => 'txp-layout-1col', 'id' => 'users_container'));
        $createBlock = implode(n, $createBlock);
        if ($total < 1) {
            if ($criteria != 1) {
                echo $searchBlock . $contentBlockStart . $createBlock . graf(span(null, array('class' => 'ui-icon ui-icon-info')) . ' ' . gTxt('no_results_found'), array('class' => 'alert-block information')) . n . tag_end('div');
            }
            return;
        }
        $limit = max($author_list_pageby, 15);
        list($page, $offset, $numPages) = pager($total, $limit, $page);
        $use_multi_edit = has_privs('admin.edit') && ($total > 1 or safe_count('txp_users', "1 = 1") > 1);
        echo $searchBlock . $contentBlockStart . $createBlock;
        $rs = safe_rows_start("*, UNIX_TIMESTAMP(last_access) AS last_login", 'txp_users', "{$criteria} ORDER BY {$sort_sql} LIMIT {$offset}, {$limit}");
        if ($rs) {
            echo n . tag_start('form', array('class' => 'multi_edit_form', 'id' => 'users_form', 'name' => 'longform', 'method' => 'post', 'action' => 'index.php')) . n . tag_start('div', array('class' => 'txp-listtables')) . n . tag_start('table', array('class' => 'txp-list')) . n . tag_start('thead') . tr(($use_multi_edit ? hCell(fInput('checkbox', 'select_all', 0, '', '', '', '', '', 'select_all'), '', ' class="txp-list-col-multi-edit" scope="col" title="' . gTxt('toggle_all_selected') . '"') : hCell('', '', ' class="txp-list-col-multi-edit" scope="col"')) . column_head('login_name', 'name', 'admin', true, $switch_dir, '', '', ('name' == $sort ? "{$dir} " : '') . 'txp-list-col-login-name name') . column_head('real_name', 'RealName', 'admin', true, $switch_dir, '', '', ('RealName' == $sort ? "{$dir} " : '') . 'txp-list-col-real-name name') . column_head('email', 'email', 'admin', true, $switch_dir, '', '', ('email' == $sort ? "{$dir} " : '') . 'txp-list-col-email') . column_head('privileges', 'privs', 'admin', true, $switch_dir, '', '', ('privs' == $sort ? "{$dir} " : '') . 'txp-list-col-privs') . column_head('last_login', 'last_login', 'admin', true, $switch_dir, '', '', ('last_login' == $sort ? "{$dir} " : '') . 'txp-list-col-last-login date')) . n . tag_end('thead') . n . tag_start('tbody');
            while ($a = nextRow($rs)) {
                extract(doSpecial($a));
                echo tr(td((has_privs('admin.edit') and $txp_user != $a['name']) ? fInput('checkbox', 'selected[]', $a['name'], 'checkbox') : '', '', 'txp-list-col-multi-edit') . hCell(has_privs('admin.edit') ? eLink('admin', 'author_edit', 'user_id', $user_id, $name) : $name, '', ' class="txp-list-col-login-name name" scope="row"') . td($RealName, '', 'txp-list-col-real-name name') . td(href($email, 'mailto:' . $email), '', 'txp-list-col-email') . td(get_priv_level($privs), '', 'txp-list-col-privs') . td($last_login ? safe_strftime('%b&#160;%Y', $last_login) : '', '', 'txp-list-col-last-login date'));
            }
            echo n . tag_end('tbody') . n . tag_end('table') . n . tag_end('div') . ($use_multi_edit ? author_multiedit_form($page, $sort, $dir, $crit, $search_method) : '') . tInput() . n . tag_end('form') . n . tag_start('div', array('class' => 'txp-navigation', 'id' => 'users_navigation')) . pageby_form('admin', $author_list_pageby) . nav_form('admin', $page, $numPages, $sort, $dir, $crit, $search_method) . n . tag_end('div');
        }
        echo n . tag_end('div');
    } else {
        echo n . tag_start('div', array('class' => 'txp-layout-1col', 'id' => 'users_container')) . n . tag(implode(n, $buttons), 'div', array('class' => 'txp-control-panel')) . n . tag_end('div');
    }
}
开发者ID:scar45,项目名称:textpattern,代码行数:76,代码来源:txp_admin.php

示例11: query

 function query()
 {
     $args = func_get_args();
     $method = array_shift($args);
     $request = new IXR_Request($method, $args);
     $length = $request->getLength();
     $xml = $request->getXml();
     $r = "\r\n";
     $request = "POST {$this->path} HTTP/1.0{$r}";
     // Merged from WP #8145 - allow custom headers
     $this->headers['Host'] = $this->server;
     $this->headers['Content-Type'] = 'text/xml';
     $this->headers['User-Agent'] = $this->useragent;
     $this->headers['Content-Length'] = $length;
     // Accept gzipped response if zlib and if php4.3+ (fgets turned binary safe)
     if (extension_loaded('zlib') && preg_match('#^(4\\.[3-9])|([5-9])#', phpversion())) {
         $this->headers['Accept-Encoding'] = 'gzip';
     }
     foreach ($this->headers as $header => $value) {
         $request .= "{$header}: {$value}{$r}";
     }
     $request .= $r;
     $request .= $xml;
     // Now send the request
     if ($this->debug) {
         echo '<pre class="ixr_request">' . htmlspecialchars($request) . "\n</pre>\n\n";
     }
     if ($this->timeout) {
         $fp = !is_disabled('fsockopen') ? fsockopen($this->server, $this->port, $errno, $errstr, $this->timeout) : false;
     } else {
         $fp = !is_disabled('fsockopen') ? fsockopen($this->server, $this->port, $errno, $errstr) : false;
     }
     if (!$fp) {
         $this->error = new IXR_Error(-32300, 'transport error - could not open socket (' . $errstr . ')');
         return false;
     }
     fputs($fp, $request);
     $contents = '';
     $debugContents = '';
     $gotFirstLine = false;
     $gettingHeaders = true;
     $is_gzipped = false;
     while (!feof($fp)) {
         $line = fgets($fp, 4096);
         if (!$gotFirstLine) {
             // Check line for '200'
             if (strstr($line, '200') === false) {
                 $this->error = new IXR_Error(-32300, 'transport error - HTTP status code was not 200');
                 return false;
             }
             $gotFirstLine = true;
         }
         if ($gettingHeaders && trim($line) == '') {
             $gettingHeaders = false;
             continue;
         }
         if (!$gettingHeaders) {
             // We do a binary comparison of the first two bytes, see
             // rfc1952, to check wether the content is gzipped.
             if ($contents == '' && strncmp($line, "‹", 2) === 0) {
                 $is_gzipped = true;
             }
             // merged from WP #12559 - remove trim
             $contents .= $line;
         }
         if ($this->debug) {
             $debugContents .= $line;
         }
     }
     // if gzipped, strip the 10 byte header, and pass it to gzinflate (rfc1952)
     if ($is_gzipped) {
         $contents = gzinflate(substr($contents, 10));
         //simulate trim() for each line; don't know why, but it won't work otherwise
         $contents = preg_replace('#^[\\x20\\x09\\x0A\\x0D\\x00\\x0B]*(.*)[\\x20\\x09\\x0A\\x0D\\x00\\x0B]*$#m', '\\1', $contents);
     }
     if ($this->debug) {
         echo '<pre class="ixr_response">' . htmlspecialchars($debugContents) . "\n</pre>\n\n";
     }
     // Now parse what we've got back
     $this->message = new IXR_Message($contents);
     if (!$this->message->parse()) {
         // XML error
         $this->error = new IXR_Error(-32700, 'parse error. not well formed');
         return false;
     }
     // Is the message a fault?
     if ($this->message->messageType == 'fault') {
         $this->error = new IXR_Error($this->message->faultCode, $this->message->faultString);
         return false;
     }
     // Message must be OK
     return true;
 }
开发者ID:bgarrels,项目名称:textpattern,代码行数:93,代码来源:IXRClass.php

示例12: send

 /**
  * {@inheritdoc}
  */
 public function send()
 {
     if (is_disabled('mail')) {
         throw new Textpattern_Mail_Exception(gTxt('disabled_function', array('{name}' => 'mail')));
     }
     if (!$this->mail->from || !$this->mail->to) {
         throw new Textpattern_Mail_Exception(gTxt('from_or_to_address_missing'));
     }
     $headers = array();
     $headers['From'] = $this->encoded->from;
     if ($this->encoded->cc) {
         $headers['Cc'] = $this->encoded->cc;
     }
     if ($this->encoded->bcc) {
         $headers['Bcc'] = $this->encoded->bbc;
     }
     if ($this->encoded->replyTo) {
         $headers['Reply-to'] = $this->encoded->replyTo;
     }
     $headers += $this->encoded->headers;
     foreach ($headers as $name => &$value) {
         $value = $name . ': ' . $value;
     }
     $headers = join($this->separator, $headers) . $this->separator;
     if ($this->smtpFrom) {
         if (mail($this->encoded->to, $this->encoded->subject, $this->encoded->body, $headers, '-f' . $this->smtpFrom) === false) {
             throw new Textpattern_Mail_Exception(gTxt('sending_failed'));
         }
     }
     if (mail($this->encoded->to, $this->encoded->subject, $this->encoded->body, $headers) === false) {
         throw new Textpattern_Mail_Exception(gTxt('sending_failed'));
     }
     return $this;
 }
开发者ID:bgarrels,项目名称:textpattern,代码行数:37,代码来源:Mail.php

示例13: doDiagnostics

function doDiagnostics()
{
    global $prefs, $files, $txpcfg, $event, $step, $theme;
    extract(get_prefs());
    $urlparts = parse_url(hu);
    $mydomain = $urlparts['host'];
    $server_software = @$_SERVER['SERVER_SOFTWARE'] || @$_SERVER['HTTP_HOST'] ? @$_SERVER['SERVER_SOFTWARE'] ? @$_SERVER['SERVER_SOFTWARE'] : $_SERVER['HTTP_HOST'] : '';
    $is_apache = ($server_software and stristr($server_software, 'Apache')) or is_callable('apache_get_version');
    $real_doc_root = isset($_SERVER['DOCUMENT_ROOT']) ? realpath($_SERVER['DOCUMENT_ROOT']) : '';
    // ini_get() returns string values passed via php_value as a string, not boolean
    $is_register_globals = (strcasecmp(ini_get('register_globals'), 'on') === 0 or ini_get('register_globals') === '1');
    $fail = array('php_version_4_3_0_required' => (!is_callable('version_compare') or version_compare(PHP_VERSION, '4.3.0', '<')) ? gTxt('php_version_4_3_0_required') : '', 'path_to_site_missing' => !isset($path_to_site) ? gTxt('path_to_site_missing') : '', 'dns_lookup_fails' => @gethostbyname($mydomain) == $mydomain ? gTxt('dns_lookup_fails') . cs . $mydomain : '', 'path_to_site_inacc' => !@is_dir($path_to_site) ? gTxt('path_to_site_inacc') . cs . $path_to_site : '', 'site_trailing_slash' => rtrim($siteurl, '/') != $siteurl ? gTxt('site_trailing_slash') . cs . $path_to_site : '', 'index_inaccessible' => (!@is_file($path_to_site . "/index.php") or !@is_readable($path_to_site . "/index.php")) ? "{$path_to_site}/index.php " . gTxt('is_inaccessible') : '', 'dir_not_writable' => trim((!@is_writable($path_to_site . '/' . $img_dir) ? str_replace('{dirtype}', gTxt('img_dir'), gTxt('dir_not_writable')) . ": {$path_to_site}/{$img_dir}" . n : '') . (!@is_writable($file_base_path) ? str_replace('{dirtype}', gTxt('file_base_path'), gTxt('dir_not_writable')) . ": {$file_base_path}" . n : '') . (!@is_writable($tempdir) ? str_replace('{dirtype}', gTxt('tempdir'), gTxt('dir_not_writable')) . ": {$tempdir}" . n : '')), 'cleanurl_only_apache' => ($permlink_mode != 'messy' and !$is_apache) ? gTxt('cleanurl_only_apache') : '', 'htaccess_missing' => ($permlink_mode != 'messy' and !@is_readable($path_to_site . '/.htaccess')) ? gTxt('htaccess_missing') : '', 'mod_rewrite_missing' => ($permlink_mode != 'messy' and is_callable('apache_get_modules') and !apache_module('mod_rewrite')) ? gTxt('mod_rewrite_missing') : '', 'file_uploads_disabled' => !ini_get('file_uploads') ? gTxt('file_uploads_disabled') : '', 'setup_still_exists' => @is_dir(txpath . DS . 'setup') ? txpath . DS . "setup" . DS . ' ' . gTxt('still_exists') : '', 'no_temp_dir' => empty($tempdir) ? gTxt('no_temp_dir') : '', 'warn_mail_unavailable' => is_disabled('mail') ? gTxt('warn_mail_unavailable') : '', 'warn_register_globals_or_update' => $is_register_globals && (version_compare(phpversion(), '4.4.0', '<=') or version_compare(phpversion(), '5.0.0', '>=') and version_compare(phpversion(), '5.0.5', '<=')) ? gTxt('warn_register_globals_or_update') : '');
    if ($permlink_mode != 'messy') {
        $rs = safe_column("name", "txp_section", "1");
        foreach ($rs as $name) {
            if ($name and @file_exists($path_to_site . '/' . $name)) {
                $fail['old_placeholder_exists'] = gTxt('old_placeholder') . ": {$path_to_site}/{$name}";
            }
        }
    }
    $missing = array();
    foreach ($files as $f) {
        $realpath = realpath(txpath . $f);
        if (is_readable($realpath)) {
            $found[] = $realpath;
        } else {
            $missing[] = txpath . $f;
        }
    }
    $files = $found;
    unset($found);
    if ($missing) {
        $fail['missing_files'] = gTxt('missing_files') . cs . n . t . join(', ' . n . t, $missing);
    }
    foreach ($fail as $k => $v) {
        if (empty($v)) {
            unset($fail[$k]);
        }
    }
    # Find the highest revision number
    $file_revs = $file_md5 = array();
    $rev = 0;
    foreach ($files as $f) {
        $content = @file_get_contents($f);
        if ($content !== FALSE) {
            if (preg_match('/^\\$' . 'LastChangedRevision: (\\d+) \\$/m', $content, $match)) {
                $file_revs[$f] = $match[1];
                if ($match[1] > $rev) {
                    $rev = $match[1];
                }
            }
            $file_md5[$f] = md5(str_replace('$' . 'HeadURL: http:', '$' . 'HeadURL: https:', str_replace("\r\n", "\n", $content)));
        }
    }
    # Check revs & md5 against stable release, if possible
    $dev_files = $old_files = $modified_files = array();
    if ($cs = @file(txpath . '/checksums.txt')) {
        foreach ($cs as $c) {
            if (preg_match('@^(\\S+): r?(\\S+) \\((.*)\\)$@', trim($c), $m)) {
                list(, $file, $r, $md5) = $m;
                $file = realpath(txpath . $file);
                if (!empty($file_revs[$file]) and $r and $file_revs[$file] < $r) {
                    $old_files[] = $file;
                } elseif (!empty($file_revs[$file]) and $r and $file_revs[$file] > $r) {
                    $dev_files[] = $file;
                } elseif (!empty($file_md5[$file]) and $file_md5[$file] != $md5) {
                    $modified_files[] = $file;
                }
            }
        }
    }
    # files that haven't been updated
    if ($old_files) {
        $fail['old_files'] = gTxt('old_files') . cs . n . t . join(', ' . n . t, $old_files);
    }
    # files that don't match their checksums
    if ($modified_files) {
        $fail['modified_files'] = gTxt('modified_files') . cs . n . t . join(', ' . n . t, $modified_files);
    }
    # running development code in live mode is not recommended
    if ($dev_files and $production_status == 'live') {
        $fail['dev_version_live'] = gTxt('dev_version_live') . cs . n . t . join(', ' . n . t, $dev_files);
    }
    # anything might break if arbitrary functions are disabled
    if (ini_get('disable_functions')) {
        $disabled_funcs = array_map('trim', explode(',', ini_get('disable_functions')));
        # commonly disabled functions that we don't need
        $disabled_funcs = array_diff($disabled_funcs, array('imagefilltoborder', 'exec', 'system', 'dl', 'passthru', 'chown', 'shell_exec', 'popen', 'proc_open'));
        if ($disabled_funcs) {
            $fail['some_php_functions_disabled'] = gTxt('some_php_functions_disabled') . cs . join(', ', $disabled_funcs);
        }
    }
    # not sure about this one
    #if (strncmp(php_sapi_name(), 'cgi', 3) == 0 and ini_get('cgi.rfc2616_headers'))
    #	$fail['cgi_header_config'] = gTxt('cgi_header_config');
    $guess_site_url = $_SERVER['HTTP_HOST'] . preg_replace('#[/\\\\]$#', '', dirname(dirname($_SERVER['SCRIPT_NAME'])));
    if ($siteurl and strip_prefix($siteurl, 'www.') != strip_prefix($guess_site_url, 'www.')) {
        $fail['site_url_mismatch'] = gTxt('site_url_mismatch') . cs . $guess_site_url;
    }
    # test clean URL server vars
//.........这里部分代码省略.........
开发者ID:psic,项目名称:websites,代码行数:101,代码来源:txp_diag.php

示例14: actionError

 /**
  * Error printing.
  *
  * This is the action to handle external exceptions.
  */
 public function actionError()
 {
     function var_dump_to_string($var)
     {
         $output = "<pre>";
         _var_dump_to_string($var, $output);
         $output .= "</pre>";
         return $output;
     }
     function _var_dump_to_string($var, &$output, $prefix = "")
     {
         foreach ($var as $key => $value) {
             if (is_array($value)) {
                 $output .= $prefix . $key . ": \n";
                 _var_dump_to_string($value, $output, "  " . $prefix);
             } else {
                 $output .= $prefix . $key . ": " . $value . "\n";
             }
         }
     }
     function is_disabled($function)
     {
         $disabled_functions = explode(',', str_replace(" ", "", ini_get('disable_functions')));
         return in_array($function, $disabled_functions);
     }
     if ($error = Yii::app()->errorHandler->error) {
         if (Yii::app()->request->isAjaxRequest) {
             echo $error['message'];
         } else {
             $referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
             $userAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
             if ($error['code'] == '404') {
                 $request = Yii::app()->request->requestUri;
                 if (preg_match('/opportunity/', $request)) {
                     $request = preg_replace('/opportunity/', 'opportunities', $request);
                     $this->redirect($request);
                 }
                 if (empty($referer)) {
                     $this->render('errorDisplay', $error);
                     Yii::app()->end();
                 }
             }
             if (in_array($error['code'], array('403', '400', '503'))) {
                 $this->render('errorDisplay', $error);
                 Yii::app()->end();
             }
             $request = Yii::app()->request->requestUri;
             if (!is_disabled('phpinfo')) {
                 $info = $this->phpinfo_array(true);
             } else {
                 $info = '';
             }
             if (!empty(Yii::app()->settings->emailFromAddr)) {
                 $email = Yii::app()->settings->emailFromAddr;
             } else {
                 $email = "";
             }
             $get = var_dump_to_string($_GET);
             $post = var_dump_to_string($_POST);
             $phpversion = phpversion();
             $x2version = Yii::app()->params->version;
             unset($error['traces']);
             $error['trace'] = CHtml::encode($error['trace']);
             $phpInfoErrorReport = base64_encode(CJSON::encode(array_merge($error, array('request' => $request, 'phpinfo' => $info, 'referer' => $referer, 'get' => $get, 'post' => $post, 'phpversion' => $phpversion, 'x2version' => $x2version, 'adminEmail' => $email, 'user' => Yii::app()->user->getName(), 'isAdmin' => Yii::app()->params->isAdmin, 'userAgent' => $userAgent))));
             $errorReport = base64_encode(CJSON::encode(array_merge($error, array('request' => $request, 'referer' => $referer, 'get' => $get, 'post' => $post, 'phpversion' => $phpversion, 'x2version' => $x2version, 'adminEmail' => $email, 'user' => Yii::app()->user->getName(), 'isAdmin' => Yii::app()->params->isAdmin, 'userAgent' => $userAgent))));
             $this->render('error', array_merge($error, array('request' => $request, 'info' => $info, 'referer' => $referer, 'get' => $get, 'post' => $post, 'phpversion' => $phpversion, 'x2version' => $x2version, 'errorReport' => $errorReport, 'phpInfoErrorReport' => $phpInfoErrorReport)));
         }
     }
 }
开发者ID:shayanyi,项目名称:CRM,代码行数:74,代码来源:SiteController.php

示例15: getDbInfo

/**
 * Renders stage 1: database details panel.
 */
function getDbInfo()
{
    $lang = ps('lang');
    if ($lang) {
        $_SESSION['lang'] = $lang;
    }
    $GLOBALS['textarray'] = setup_load_lang($_SESSION['lang']);
    global $txpcfg;
    echo txp_setup_progress_meter(1), n . '<div class="txp-setup">';
    if (!isset($txpcfg['db'])) {
        @(include txpath . '/config.php');
    }
    if (!empty($txpcfg['db'])) {
        echo graf(span(null, array('class' => 'ui-icon ui-icon-alert')) . ' ' . setup_gTxt('already_installed', array('{txpath}' => txpath)), array('class' => 'alert-block warning')) . setup_back_button(__FUNCTION__) . n . '</div>';
        exit;
    }
    if (isset($_SESSION['siteurl'])) {
        $guess_siteurl = $_SESSION['siteurl'];
    } elseif (@$_SERVER['SCRIPT_NAME'] && (@$_SERVER['SERVER_NAME'] || @$_SERVER['HTTP_HOST'])) {
        $guess_siteurl = @$_SERVER['HTTP_HOST'] ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'];
        $guess_siteurl .= $GLOBALS['rel_siteurl'];
    } else {
        $guess_siteurl = 'mysite.com';
    }
    echo '<form class="prefs-form" method="post" action="' . txpspecialchars($_SERVER['PHP_SELF']) . '">' . hed(setup_gTxt('need_details'), 1) . hed('MySQL', 2) . graf(setup_gTxt('db_must_exist')) . inputLabel('setup_mysql_login', fInput('text', 'duser', isset($_SESSION['duser']) ? txpspecialchars($_SESSION['duser']) : '', '', '', '', INPUT_REGULAR, '', 'setup_mysql_login'), 'mysql_login', '', array('class' => 'txp-form-field')) . inputLabel('setup_mysql_pass', fInput('password', 'dpass', isset($_SESSION['dpass']) ? txpspecialchars($_SESSION['dpass']) : '', 'txp-maskable', '', '', INPUT_REGULAR, '', 'setup_mysql_pass') . n . tag(checkbox('unmask', 1, false, 0, 'show_password') . n . tag(gTxt('setup_show_password'), 'label', array('for' => 'show_password')), 'div', array('class' => 'show-password')), 'mysql_password', '', array('class' => 'txp-form-field')) . inputLabel('setup_mysql_server', fInput('text', 'dhost', isset($_SESSION['dhost']) ? txpspecialchars($_SESSION['dhost']) : 'localhost', '', '', '', INPUT_REGULAR, '', 'setup_mysql_server', '', true), 'mysql_server', '', array('class' => 'txp-form-field')) . inputLabel('setup_mysql_db', fInput('text', 'ddb', isset($_SESSION['ddb']) ? txpspecialchars($_SESSION['ddb']) : '', '', '', '', INPUT_REGULAR, '', 'setup_mysql_db', '', true), 'mysql_database', '', array('class' => 'txp-form-field')) . inputLabel('setup_table_prefix', fInput('text', 'dprefix', isset($_SESSION['dprefix']) ? txpspecialchars($_SESSION['dprefix']) : '', 'input-medium', '', '', INPUT_MEDIUM, '', 'setup_table_prefix'), 'table_prefix', 'table_prefix', array('class' => 'txp-form-field')) . hed(setup_gTxt('site_url'), 2) . graf(setup_gTxt('please_enter_url')) . inputLabel('setup_site_url', fInput('text', 'siteurl', txpspecialchars($guess_siteurl), '', '', '', INPUT_REGULAR, '', 'setup_site_url', '', true), 'http(s)://', 'siteurl', array('class' => 'txp-form-field'));
    if (is_disabled('mail')) {
        echo graf(span(null, array('class' => 'ui-icon ui-icon-alert')) . ' ' . setup_gTxt('warn_mail_unavailable'), array('class' => 'alert-block warning'));
    }
    echo graf(fInput('submit', 'Submit', setup_gTxt('next_step', '', 'raw'), 'publish'));
    echo sInput('printConfig') . n . '</form>' . n . '</div>';
}
开发者ID:scar45,项目名称:textpattern,代码行数:34,代码来源:index.php


注:本文中的is_disabled函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。