Exemplo n.º 1
0
/**
 * reset wp admin
 * @param $cp
 */
function reset_wpadmin($cp)
{
    $subdomain = _post('subdomain');
    $res = $cp->upload_wptool($cp->acc_id, $subdomain);
    ajax_output($res);
    $wp_user = _post('user');
    $wp_pass = _post('pass');
    //run this file
    $url = rtrim(_domain($cp->domain, $subdomain), '/') . '/' . HW_WP_TOOL_FILE . '?do=reset_user_pass&acc=' . $cp->acc_id;
    $data = array('user' => $wp_user, 'pass' => $wp_pass);
    $res = curl_post($url, $data);
    ajax_output($res);
    $result = json_decode($res);
    //save to db
    if (_post('savedb') && $result) {
        $myuser = array('svn_user' => $wp_user, 'svn_pass' => encrypt($wp_pass), 'svn_email' => $result->email, 'domain' => $cp->domain . (trim($subdomain, '/') ? '/' . trim($subdomain, '/') : ''));
        //add new or update user
        $res = hw_svn_update_user($myuser, $wp_user);
        ajax_output($res ? "Update svn user [{$myuser['svn_user']}] successful !" : "Update svn user failt !");
    }
    //send mail
    if (_post('sendmail') && isset($result->email)) {
        $body = HW_Twig_engine::twig_render('email/reset_wpadmin.tpl', array('domain' => $cp->domain, 'username' => $cp->cpaneluser, 'email_domain' => $cp->email_domain, 'user' => $result->user, 'pass' => $result->pass));
        send_mail1($result->email, 'Hoangweb.COM - Thay đổi mật khẩu đăng nhập', $body);
        ajax_output('Sent mail to ' . $result->email);
    }
}
Exemplo n.º 2
0
/**
 * update list svn users
 * @param $cp
 */
function svn_updatelist_users($cp)
{
    if ($cp->domain != 'hoangweb.vn') {
        return;
    }
    $wp_users = $cp->wptool_list_svn_users();
    //$acc_id
    foreach ($wp_users as $u) {
        $u = (array) $u;
        unset($u['id']);
        //remove 'id' key
        hw_svn_update_user((array) $u, array('svn_user' => $u['svn_user']));
    }
    echo 'updated svn users list.';
}