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


PHP runlog函数代码示例

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


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

示例1: checkuser

 function checkuser($a, $p, $ajax = false)
 {
     //验证用户 账号/密码
     self::$Rs = iCMS_DB::getRow("SELECT * FROM `#iCMS@__members` WHERE `username`='{$a}' AND `password`='{$p}'");
     if (empty(self::$Rs)) {
         //记录
         $a && runlog('user.login', 'username=' . $a . '&password=' . $_POST['password']);
         if ($ajax) {
             return false;
         }
         self::LoginPage();
     } else {
         self::$uId = self::$Rs->uid;
         self::$Rs->info && (self::$Rs->info = unserialize(self::$Rs->info));
         self::$group = iCMS_DB::getRow("SELECT * FROM `#iCMS@__group` WHERE `gid`='{self::{$Rs->groupid}}'");
         //用户组
         self::$power = explode(',', self::merge(self::$group->power, self::$Rs->power));
         $cpower = self::merge(self::$group->cpower, self::$Rs->cpower);
         self::$cpower = empty($cpower) ? array(0) : explode(',', $cpower);
         self::$nickname = empty(self::$Rs->nickname) ? self::$Rs->username : self::$Rs->nickname;
         if ($ajax) {
             return true;
         }
     }
 }
开发者ID:idreamsoft,项目名称:iCMS5.0,代码行数:25,代码来源:user.class.php

示例2: runcron

function runcron($cronid = 0)
{
    global $_SGLOBAL, $_SCONFIG, $_SBLOCK, $_TPL, $_SCOOKIE, $_SN, $space;
    $where = $cronid ? "cronid='{$cronid}'" : "available>'0' AND nextrun<='{$_SGLOBAL['timestamp']}'";
    $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('cron') . " WHERE {$where} ORDER BY nextrun LIMIT 1");
    //只运行一个
    if ($cron = $_SGLOBAL['db']->fetch_array($query)) {
        $lockfile = S_ROOT . './data/runcron_' . $cron['cronid'] . '.lock';
        $cronfile = S_ROOT . './source/cron/' . $cron['filename'];
        if (is_writable($lockfile)) {
            $locktime = filemtime($lockfile);
            if ($locktime > $_SGLOBAL['timestamp'] - 600) {
                //10分钟
                return NULL;
            }
        } else {
            @touch($lockfile);
        }
        @set_time_limit(1000);
        @ignore_user_abort(TRUE);
        cronnextrun($cron);
        if (!@(include $cronfile)) {
            runlog('CRON', $cron['name'] . ' : Cron script(' . $cron['filename'] . ') not found or syntax error', 0);
        }
        @unlink($lockfile);
    }
    //更新config
    cron_config();
}
开发者ID:NaturalWill,项目名称:UCQA,代码行数:29,代码来源:function_cron.php

示例3: getforeignpicpath

function getforeignpicpath($filename, $name1, $name2, $mkdir = false)
{
    global $_SGLOBAL, $_SC;
    $filepath = "foreign" . $filename;
    //$name1 = gmdate('Ym');
    //$name2 = gmdate('j');
    chdir(dirname(dirname(dirname(__FILE__))));
    //change the current dir to ihome dir.
    if ($mkdir) {
        $newfilename = $_SC['attachdir'] . './' . $name1;
        if (!is_dir($newfilename)) {
            if (!@mkdir($newfilename)) {
                runlog('error', "DIR: {$newfilename} can not make");
                return $filepath;
            }
        }
        $newfilename .= '/' . $name2;
        if (!is_dir($newfilename)) {
            if (!@mkdir($newfilename)) {
                runlog('error', "DIR: {$newfilename} can not make");
                return $name1 . '/' . $filepath;
            }
        }
    }
    return $name1 . '/' . $name2 . '/' . $filepath;
}
开发者ID:shiyake,项目名称:php-ihome,代码行数:26,代码来源:function_mobileapi.php

示例4: wx_sendMsg

 public function wx_sendMsg($data)
 {
     if (!getglobal('setting/CorpID') || !getglobal('setting/CorpSecret')) {
         return false;
     }
     $user = C::t('user')->fetch($data['uid']);
     if (!$user['wechat_userid'] || $user['wechat_status'] != 1) {
         C::t('notification')->update($data['id'], array('wx_new' => $data['wx_new'] + 1));
         return false;
     }
     $agentid = 0;
     if ($data['from_idtype'] == 'app' && $data['from_id'] && ($wxapp = C::t('wx_app')->fetch($data['from_id']))) {
         if ($wxapp['agentid'] && $wxapp['status'] < 1) {
             $agentid = $wxapp['agentid'];
         }
     }
     $wx = new qyWechat(array('appid' => getglobal('setting/CorpID'), 'appsecret' => getglobal('setting/CorpSecret')));
     $msg = array("touser" => "dzz-" . $data['uid'], "safe" => 0, "agentid" => $agentid, "msgtype" => "news", "news" => array("articles" => array(array("title" => $data['title'], "description" => getstr($data['wx_note'], 0, 0, 0, 0, -1), "url" => $wx->getOauthRedirect(getglobal('siteurl') . 'index.php?mod=system&op=wxredirect&url=' . dzzencode($data['redirecturl']))))));
     if ($ret = $wx->sendMessage($msg)) {
         C::t('notification')->update($data['id'], array('wx_new' => 0));
         return true;
     } else {
         C::t('notification')->update($data['id'], array('wx_new' => $data['wx_new'] + 1));
         $message = 'wx_notification:errCode:' . $wx->errCode . ';errMsg:' . $wx->errMsg;
         runlog('wxlog', $message);
         return false;
     }
 }
开发者ID:druphliu,项目名称:dzzoffice,代码行数:28,代码来源:dzz_notification.php

示例5: capi_jpush

function capi_jpush($uidarr, $message, $title = null, $extras = null)
{
    $client = new JPush(JPUSH_APP_KEY, JPUSH_MASTER_SECRET);
    try {
        $result = $client->push()->setPlatform(array('ios', 'android'))->addAlias($uidarr)->setNotificationAlert($message)->addAndroidNotification($message, $title, 1, $extras)->addIosNotification($message, JPUSH_IOS_SOUND, '+1', true, null, $extras)->send();
        if (D_BUG) {
            runlog('jpush', 'Push Success:' . json_encode($result));
        }
    } catch (APIRequestException $e) {
        /*
        echo 'Push Fail.' . $br;
        echo 'Http Code : ' . $e->httpCode . $br;
        echo 'code : ' . $e->code . $br;
        echo 'Error Message : ' . $e->message . $br;
        echo 'Response JSON : ' . $e->json . $br;
        echo 'rateLimitLimit : ' . $e->rateLimitLimit . $br;
        echo 'rateLimitRemaining : ' . $e->rateLimitRemaining . $br;
        echo 'rateLimitReset : ' . $e->rateLimitReset . $br;
        */
        if (D_BUG) {
            runlog('jpush', 'Push Fail:' . json_encode(array('error' => $e)));
        }
    } catch (APIConnectionException $e) {
        /*
        echo 'Push Fail: ' . $br;
        echo 'Error Message: ' . $e->getMessage() . $br;
        //response timeout means your request has probably be received by JPUsh Server,please check that whether need to be pushed again.
        echo 'IsResponseTimeout: ' . $e->isResponseTimeout . $br;
        */
        if (D_BUG) {
            runlog('jpush', 'Push Fail:' . json_encode(array('ErrorMessage' => $e->getMessage(), 'IsResponseTimeout' => $e->isResponseTimeout)));
        }
    }
    //echo $br . '-------------' . $br;
}
开发者ID:NaturalWill,项目名称:UCQA,代码行数:35,代码来源:function_jpush.php

示例6: sftp_connect

function sftp_connect()
{
    global $_SGLOBAL;
    @set_time_limit(0);
    $func = $_SGLOBAL['setting']['ftpssl'] && function_exists('ftp_ssl_connect') ? 'ftp_ssl_connect' : 'ftp_connect';
    if ($func == 'ftp_connect' && !function_exists('ftp_connect')) {
        runlog('FTP', "FTP NOT SUPPORTED.", 0);
    }
    if ($ftpconnid = @$func($_SGLOBAL['setting']['ftphost'], intval($_SGLOBAL['setting']['ftpport']), 20)) {
        if ($_SGLOBAL['setting']['ftptimeout'] && function_exists('ftp_set_option')) {
            @ftp_set_option($ftpconnid, FTP_TIMEOUT_SEC, $_SGLOBAL['setting']['ftptimeout']);
        }
        if (sftp_login($ftpconnid, $_SGLOBAL['setting']['ftpuser'], $_SGLOBAL['setting']['ftppassword'])) {
            if ($_SGLOBAL['setting']['ftppasv']) {
                sftp_pasv($ftpconnid, TRUE);
            }
            if (sftp_chdir($ftpconnid, $_SGLOBAL['setting']['ftpdir'])) {
                return $ftpconnid;
            } else {
                runlog('FTP', "CHDIR '{$_SGLOBAL[setting][ftpdir]}' ERROR.", 0);
            }
        } else {
            runlog('FTP', '530 NOT LOGGED IN.', 0);
        }
    } else {
        runlog('FTP', "COULDN'T CONNECT TO {$_SGLOBAL[setting][ftphost]}:{$_SGLOBAL[setting][ftpport]}.", 0);
    }
    sftp_close($ftpconnid);
    return -1;
}
开发者ID:NaturalWill,项目名称:UCQA,代码行数:30,代码来源:function_ftp.php

示例7: checkuser

 function checkuser($a, $p)
 {
     //验证用户 账号/密码
     $this->user = $this->db->getRow("SELECT * FROM `#iCMS@__members` WHERE `username`='{$a}' AND `password`='{$p}'");
     if (empty($this->user)) {
         //记录
         $a && runlog('user.login', 'username=' . $a . '&password=' . $_POST['password']);
         $this->LoginPage();
     } else {
         $this->uId = $this->user->uid;
         $this->user->info && ($this->user->info = unserialize($this->user->info));
         $this->group = $this->db->getRow("SELECT * FROM `#iCMS@__group` WHERE `gid`='{$this->user->groupid}'");
         //用户组
         $this->power = explode(',', $this->merge($this->group->power, $this->user->power));
         $cpower = $this->merge($this->group->cpower, $this->user->cpower);
         $this->cpower = empty($cpower) ? array(0) : explode(',', $cpower);
     }
 }
开发者ID:jonycookie,项目名称:projectm2,代码行数:18,代码来源:user.class.php

示例8: checkadmin

 function checkadmin($a, $p, $Ret = false)
 {
     //验证用户 账号/密码
     self::$Rs = iCMS_DB::getRow("SELECT * FROM `#iCMS@__admin` WHERE `username`='{$a}' AND `password`='{$p}'");
     if (empty(self::$Rs)) {
         //记录
         $a && runlog('login', 'username=' . $a . '&password=' . $_POST['password']);
         return $Ret ? 'Bad' : self::LoginPage();
     } else {
         self::$uId = self::$Rs->uid;
         self::$Rs->info && (self::$Rs->info = unserialize(self::$Rs->info));
         self::$group = iCMS_DB::getRow("SELECT * FROM `#iCMS@__group` WHERE `gid`='" . self::$Rs->groupid . "'");
         //用户组
         self::$power = explode(',', self::merge(self::$group->power, self::$Rs->power));
         $cpower = self::merge(self::$group->cpower, self::$Rs->cpower);
         self::$cpower = empty($cpower) ? array(0) : explode(',', $cpower);
         self::$Rs->groupid == "1" && (self::$cpower = NULL);
     }
 }
开发者ID:idreamsoft,项目名称:iCMS5.0,代码行数:19,代码来源:admin.class.php

示例9: sendMessage

 public static function sendMessage($uid, $title, $content, $msgType, $extra = null, $mask = 3, $jpushAk = null, $jpushSk = null)
 {
     global $_G;
     $tmp = Utils::readLocalAkSk2();
     if (!isset($tmp['app_key']) || !isset($tmp['app_secret'])) {
         return false;
     }
     $ak = $tmp['app_key'];
     $sk = $tmp['app_secret'];
     $appInfo = self::getAppInfo($ak, $sk);
     if (!isset($appInfo['app_id'])) {
         return false;
     }
     $appId = $appInfo['app_id'];
     $alias = sprintf('%020lu%020lu', $appId, $uid);
     $params = array('alias' => $alias, 'mask' => $mask, 'message_type' => $msgType, 'title' => $title, 'content' => $content);
     if (is_array($extra)) {
         $params['extra'] = BIGAPPJSON::encode($extra);
     }
     if (!is_null($jpushAk) && !is_null($jpushSk)) {
         $params['jpush_app_key'] = $jpushAk;
         $params['jpush_master_secret'] = $jpushSk;
     }
     $url = BigAppConf::$pushUrl;
     $obj = new BkSvr($ak, $sk, 30);
     $ret = $obj->getInfo($url, $params, false, false);
     if (!is_array($ret)) {
         runlog('bigapp', 'send message failed, invalid return [ ret: ' . $ret . ' ]');
         return false;
     }
     if (0 != $ret['error_code']) {
         runlog('bigapp', 'send message failed, error code is not 0 [ ret: ' . BIGAPPJSON::encode($ret) . ' ]');
         return $ret;
     }
     return true;
 }
开发者ID:Mushan3420,项目名称:BigApp-PHP7,代码行数:36,代码来源:pushmsg.inc.php

示例10: libfile

            if ($_GET['sendemail']) {
                if (!function_exists('sendmail')) {
                    include libfile('function/mail');
                }
                foreach (array('delete', 'validate', 'invalidate') as $o) {
                    foreach ($moderation[$o] as $uid) {
                        if (isset($members[$uid])) {
                            $member = $members[$uid];
                            $member['regdate'] = dgmdate($member['regdate']);
                            $member['submitdate'] = dgmdate($member['submitdate']);
                            $member['moddate'] = dgmdate(TIMESTAMP);
                            $member['operation'] = $o;
                            $member['remark'] = $_GET['remark'][$uid] ? dhtmlspecialchars($_GET['remark'][$uid]) : $lang['none'];
                            $moderate_member_message = lang('email', 'moderate_member_message', array('username' => $member['username'], 'bbname' => $_G['setting']['bbname'], 'regdate' => $member['regdate'], 'submitdate' => $member['submitdate'], 'submittimes' => $member['submittimes'], 'message' => $member['message'], 'modresult' => lang('email', 'moderate_member_' . $member['operation']), 'moddate' => $member['moddate'], 'adminusername' => $_G['member']['username'], 'remark' => $member['remark'], 'siteurl' => $_G['siteurl']));
                            if (!sendmail("{$member['username']} <{$member['email']}>", lang('email', 'moderate_member_subject'), $moderate_member_message)) {
                                runlog('sendmail', "{$member['email']} sendmail failed.");
                            }
                        }
                    }
                }
            }
        }
        cpmsg('moderate_members_op_succeed', "action=moderate&operation=members&page={$page}", 'succeed', array('numvalidated' => $numvalidated, 'numinvalidated' => $numinvalidated, 'numdeleted' => $numdeleted));
    }
} elseif ($do == 'del') {
    if (!submitcheck('prunesubmit', 1)) {
        shownav('user', 'nav_modmembers');
        showsubmenu('nav_moderate_users', array(array('nav_moderate_users_mod', 'moderate&operation=members&do=mod', 0), array('clean', 'moderate&operation=members&do=del', 1)));
        showtips('moderate_members_tips');
        showformheader('moderate&operation=members&do=del');
        showtableheader('moderate_members_prune');
开发者ID:softhui,项目名称:discuz,代码行数:31,代码来源:moderate_member.php

示例11: foreach

    $html = "<tr class='myportal'>\n\t\t\t\t\t  <td valign='top'><input class='myportal_enable' type='checkbox' name='new_check' checked disabled/></td>\n\t\t\t\t\t  <td><input type='text' class='txt myportal_sort' style='width:20px' value='1' disabled/></td>\n\t\t\t\t\t  <input type='hidden' class='myportal_id'  value='0'/>\n\t\t\t\t\t  <td>" . $lang['portal_home'] . "</td>\n\t\t\t\t\t  <td><input type='text'  class='txt myportal_title' style='width:100px' value='" . $lang['portal_home_title'] . "'/></td>\n\t\t\t\t\t</tr>";
    if (!empty($portalcategory)) {
        foreach ($portalcategory as $cat) {
            if ($cat['closed'] != 1) {
                $enable = $sort = 0;
                $title = $cat['catname'];
                if (isset($setting['portal']) && !empty($setting['portal'])) {
                    foreach ($setting['portal'] as $category) {
                        if ($category['id'] == $cat['catid']) {
                            $sort = isset($category['sort']) ? $category['sort'] : 10;
                            $enable = isset($category['enable']) ? $category['enable'] : 0;
                            if (isset($category['title'])) {
                                $title = Utils::converGbkString($category['title']);
                            }
                            break;
                        }
                    }
                }
                $html .= "<tr class='myportal'>\n\t\t\t\t\t\t\t\t\t\t  <td valign='top'><input class='myportal_enable' type='checkbox' " . ($enable == 1 ? "checked" : "") . "/></td>\n\t\t\t\t\t\t\t\t\t\t  <td><input type='text' class='txt myportal_sort' style='width:20px' value='" . $sort . "'/></td>\n\t\t\t\t\t\t\t\t\t\t  <input type='hidden' class='myportal_id'  value='" . $cat['catid'] . "'/>\n\t\t\t\t\t\t\t\t\t\t  <td>" . $cat['catname'] . "</td>\n\t\t\t\t\t\t\t\t\t\t  <td><input type='text' class='txt myportal_title' style='width:100px' value='" . $title . "'/></td>\n\t\t\t\t\t\t\t\t\t  </tr>";
            }
        }
    }
    $tplVars['html'] = $html;
}
if (isset($_GET['debug']) && $_GET['debug'] == '1') {
    echo json_encode($params);
    exit;
}
Utils::loadTemplate(dirname(__FILE__) . '/view/' . $tpl, $params, $tplVars);
runlog('bigapp', "show {$tpl} page succ");
开发者ID:Mushan3420,项目名称:BigApp-PHP7,代码行数:30,代码来源:myhome.inc.php

示例12: notifymembers


//.........这里部分代码省略.........
    if (!function_exists('sendmail')) {
        include libfile('function/mail');
    }
    if ($_GET['notifymember'] && in_array($_GET['notifymembers'], array('pm', 'notice', 'email', 'mobile'))) {
        $uids = searchmembers($search_condition, $pertask, $current);
        require_once libfile('function/discuzcode');
        $message = in_array($_GET['notifymembers'], array('email', 'notice')) && $_GET['posttype'] ? discuzcode($message, 1, 0, 1, '', '', '', 1) : discuzcode($message, 1, 0);
        $pmuids = array();
        if ($_GET['notifymembers'] == 'pm') {
            $membernum = countmembers($search_condition, $urladd);
            $gpmid = $_GET['gpmid'];
            if (!$gpmid) {
                $pmdata = array('authorid' => $_G['uid'], 'author' => !$_GET['system'] ? $_G['member']['username'] : '', 'dateline' => TIMESTAMP, 'message' => ($subject ? '<b>' . $subject . '</b><br /> &nbsp; ' : '') . $message . $addmsg, 'numbers' => $membernum);
                $gpmid = C::t('common_grouppm')->insert($pmdata, true);
            }
            $urladd .= '&gpmid=' . $gpmid;
        }
        $members = C::t('common_member')->fetch_all($uids);
        if ($_GET['notifymembers'] == 'mobile') {
            $toUids = array_keys($members);
            if ($_G['setting']['cloud_status'] && !empty($toUids)) {
                try {
                    $noticeService = Cloud::loadClass('Service_Client_Notification');
                    $fromType = $_GET['system'] ? 1 : 2;
                    $noticeService->addSiteMasterUserNotify($toUids, $subject, $message, $_G['uid'], $_G['username'], $fromType, TIMESTAMP);
                } catch (Cloud_Service_Client_RestfulException $e) {
                    cpmsg('[' . $e->getCode() . ']' . $e->getMessage(), '', 'error');
                }
            }
        } else {
            foreach ($members as $member) {
                if ($_GET['notifymembers'] == 'pm') {
                    C::t('common_member_grouppm')->insert(array('uid' => $member['uid'], 'gpmid' => $gpmid, 'status' => 0), false, true);
                    $newpm = setstatus(2, 1, $member['newpm']);
                    C::t('common_member')->update($member['uid'], array('newpm' => $newpm));
                } elseif ($_GET['notifymembers'] == 'notice') {
                    notification_add($member['uid'], 'system', 'system_notice', array('subject' => $subject, 'message' => $message . $addmsg, 'from_id' => 0, 'from_idtype' => 'sendnotice'), 1);
                } elseif ($_GET['notifymembers'] == 'email') {
                    if (!sendmail("{$member['username']} <{$member['email']}>", $subject, $message . $addmsg)) {
                        runlog('sendmail', "{$member['email']} sendmail failed.");
                    }
                }
                $log = array();
                if ($_GET['updatecredittype'] == 0) {
                    foreach ($setarr as $key => $val) {
                        if (empty($val)) {
                            continue;
                        }
                        $val = intval($val);
                        $id = intval($key);
                        $id = !$id && substr($key, 0, -1) == 'extcredits' ? intval(substr($key, -1, 1)) : $id;
                        if (0 < $id && $id < 9) {
                            $log['extcredits' . $id] = $val;
                        }
                    }
                    $logtype = 'RPR';
                } else {
                    foreach ($setarr as $val) {
                        if (empty($val)) {
                            continue;
                        }
                        $id = intval($val);
                        $id = !$id && substr($val, 0, -1) == 'extcredits' ? intval(substr($val, -1, 1)) : $id;
                        if (0 < $id && $id < 9) {
                            $log['extcredits' . $id] = '-1';
                        }
                    }
                    $logtype = 'RPZ';
                }
                include_once libfile('function/credit');
                credit_log($member['uid'], $logtype, $member['uid'], $log);
                $continue = TRUE;
            }
        }
    }
    $newsletter_detail = array();
    if ($continue) {
        $next = $current + $pertask;
        $newsletter_detail = array('uid' => $_G['uid'], 'current' => $current, 'next' => $next, 'search_condition' => serialize($search_condition), 'action' => "action=members&operation={$operation}&{$operation}submit=yes&current={$next}&pertask={$pertask}&system={$_GET['system']}&posttype={$_GET['posttype']}&notifymember={$_GET['notifymember']}&notifymembers=" . rawurlencode($_GET['notifymembers']) . $urladd);
        save_newsletter('newsletter_detail', $newsletter_detail);
        $logaddurl = '';
        foreach ($setarr as $k => $v) {
            if ($_GET['updatecredittype'] == 0) {
                $logaddurl .= '&' . $k . '=' . $v;
            } else {
                $logaddurl .= '&' . $v . '=-1';
            }
        }
        $logaddurl .= '&updatecredittype=' . $_GET['updatecredittype'];
        cpmsg("{$lang['members_newsletter_send']}: " . cplang('members_newsletter_processing', array('current' => $current, 'next' => $next, 'search_condition' => serialize($search_condition))), "action=members&operation={$operation}&{$operation}submit=yes&current={$next}&pertask={$pertask}&system={$_GET['system']}&posttype={$_GET['posttype']}&notifymember={$_GET['notifymember']}&notifymembers=" . rawurlencode($_GET['notifymembers']) . $urladd . $logaddurl, 'loadingform');
    } else {
        del_newsletter('newsletter_detail');
        if ($operation == 'reward' && $_GET['notifymembers'] == 'pm') {
            $message = '';
        } else {
            $message = '_notify';
        }
        cpmsg('members' . ($operation ? '_' . $operation : '') . $message . '_succeed', '', 'succeed');
    }
}
开发者ID:MCHacker,项目名称:discuz-docker,代码行数:101,代码来源:admincp_members.php

示例13: sendmail

function sendmail($toemail, $subject, $message, $from = '')
{
    global $_G;
    if (!is_array($_G['setting']['mail'])) {
        $_G['setting']['mail'] = dunserialize($_G['setting']['mail']);
    }
    $_G['setting']['mail']['server'] = $_G['setting']['mail']['port'] = $_G['setting']['mail']['auth'] = $_G['setting']['mail']['from'] = $_G['setting']['mail']['auth_username'] = $_G['setting']['mail']['auth_password'] = '';
    if ($_G['setting']['mail']['mailsend'] != 1) {
        $smtpnum = count($_G['setting']['mail']['smtp']);
        if ($smtpnum) {
            $rid = rand(0, $smtpnum - 1);
            $smtp = $_G['setting']['mail']['smtp'][$rid];
            $_G['setting']['mail']['server'] = $smtp['server'];
            $_G['setting']['mail']['port'] = $smtp['port'];
            $_G['setting']['mail']['auth'] = $smtp['auth'] ? 1 : 0;
            $_G['setting']['mail']['from'] = $smtp['from'];
            $_G['setting']['mail']['auth_username'] = $smtp['auth_username'];
            $_G['setting']['mail']['auth_password'] = $smtp['auth_password'];
        }
    }
    $message = preg_replace("/href\\=\"(?!(http|https)\\:\\/\\/)(.+?)\"/i", 'href="' . $_G['siteurl'] . '\\2"', $message);
    $message = <<<EOT
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset={$_G['charset']}">
<title>{$subject}</title>
</head>
<body>
{$subject}<br />
{$message}
</body>
</html>
EOT;
    $maildelimiter = $_G['setting']['mail']['maildelimiter'] == 1 ? "\r\n" : ($_G['setting']['mail']['maildelimiter'] == 2 ? "\r" : "\n");
    $mailusername = isset($_G['setting']['mail']['mailusername']) ? $_G['setting']['mail']['mailusername'] : 1;
    $_G['setting']['mail']['port'] = $_G['setting']['mail']['port'] ? $_G['setting']['mail']['port'] : 25;
    $_G['setting']['mail']['mailsend'] = $_G['setting']['mail']['mailsend'] ? $_G['setting']['mail']['mailsend'] : 1;
    if ($_G['setting']['mail']['mailsend'] == 3) {
        $email_from = empty($from) ? $_G['setting']['adminemail'] : $from;
    } else {
        $email_from = $from == '' ? '=?' . CHARSET . '?B?' . base64_encode($_G['setting']['sitename']) . "?= <" . $_G['setting']['adminemail'] . ">" : (preg_match('/^(.+?) \\<(.+?)\\>$/', $from, $mats) ? '=?' . CHARSET . '?B?' . base64_encode($mats[1]) . "?= <{$mats['2']}>" : $from);
    }
    $email_to = preg_match('/^(.+?) \\<(.+?)\\>$/', $toemail, $mats) ? $mailusername ? '=?' . CHARSET . '?B?' . base64_encode($mats[1]) . "?= <{$mats['2']}>" : $mats[2] : $toemail;
    $email_subject = '=?' . CHARSET . '?B?' . base64_encode(preg_replace("/[\r|\n]/", '', '[' . $_G['setting']['sitename'] . '] ' . $subject)) . '?=';
    $email_message = chunk_split(base64_encode(str_replace("\n", "\r\n", str_replace("\r", "\n", str_replace("\r\n", "\n", str_replace("\n\r", "\r", $message))))));
    $host = $_SERVER['HTTP_HOST'];
    $version = $_G['setting']['version'];
    $headers = "From: {$email_from}{$maildelimiter}X-Priority: 3{$maildelimiter}X-Mailer: {$host} {$version} {$maildelimiter}MIME-Version: 1.0{$maildelimiter}Content-type: text/html; charset=" . CHARSET . "{$maildelimiter}Content-Transfer-Encoding: base64{$maildelimiter}";
    if ($_G['setting']['mail']['mailsend'] == 1) {
        if (function_exists('mail') && @mail($email_to, $email_subject, $email_message, $headers)) {
            return true;
        }
        return false;
    } elseif ($_G['setting']['mail']['mailsend'] == 2) {
        if (!($fp = fsocketopen($_G['setting']['mail']['server'], $_G['setting']['mail']['port'], $errno, $errstr, 30))) {
            runlog('SMTP', "({$_G[setting][mail][server]}:{$_G[setting][mail][port]}) CONNECT - Unable to connect to the SMTP server", 0);
            return false;
        }
        stream_set_blocking($fp, true);
        $lastmessage = fgets($fp, 512);
        if (substr($lastmessage, 0, 3) != '220') {
            runlog('SMTP', "{$_G[setting][mail][server]}:{$_G[setting][mail][port]} CONNECT - {$lastmessage}", 0);
            return false;
        }
        fputs($fp, ($_G['setting']['mail']['auth'] ? 'EHLO' : 'HELO') . " uchome\r\n");
        $lastmessage = fgets($fp, 512);
        if (substr($lastmessage, 0, 3) != 220 && substr($lastmessage, 0, 3) != 250) {
            runlog('SMTP', "({$_G[setting][mail][server]}:{$_G[setting][mail][port]}) HELO/EHLO - {$lastmessage}", 0);
            return false;
        }
        while (1) {
            if (substr($lastmessage, 3, 1) != '-' || empty($lastmessage)) {
                break;
            }
            $lastmessage = fgets($fp, 512);
        }
        if ($_G['setting']['mail']['auth']) {
            fputs($fp, "AUTH LOGIN\r\n");
            $lastmessage = fgets($fp, 512);
            if (substr($lastmessage, 0, 3) != 334) {
                runlog('SMTP', "({$_G[setting][mail][server]}:{$_G[setting][mail][port]}) AUTH LOGIN - {$lastmessage}", 0);
                return false;
            }
            fputs($fp, base64_encode($_G['setting']['mail']['auth_username']) . "\r\n");
            $lastmessage = fgets($fp, 512);
            if (substr($lastmessage, 0, 3) != 334) {
                runlog('SMTP', "({$_G[setting][mail][server]}:{$_G[setting][mail][port]}) USERNAME - {$lastmessage}", 0);
                return false;
            }
            fputs($fp, base64_encode($_G['setting']['mail']['auth_password']) . "\r\n");
            $lastmessage = fgets($fp, 512);
            if (substr($lastmessage, 0, 3) != 235) {
                runlog('SMTP', "({$_G[setting][mail][server]}:{$_G[setting][mail][port]}) PASSWORD - {$lastmessage}", 0);
                return false;
            }
            $email_from = $_G['setting']['mail']['from'];
        }
        fputs($fp, "MAIL FROM: <" . preg_replace("/.*\\<(.+?)\\>.*/", "\\1", $email_from) . ">\r\n");
        $lastmessage = fgets($fp, 512);
        if (substr($lastmessage, 0, 3) != 250) {
//.........这里部分代码省略.........
开发者ID:MCHacker,项目名称:discuz-docker,代码行数:101,代码来源:function_mail.php

示例14: foreach

foreach ($params as &$item) {
    $item = str_replace("#u", "\\u", $item);
}
if (!$params["iosurl"]) {
    $params["iosurl"] = "";
}
if (!$params["appdesc"]) {
    $params["appdesc"] = "";
}
$params["ajaxurl"] = rtrim($_G['siteurl'], '/') . '/plugin.php?id=bigapp:mobileapi';
$params["mobileurl"] = rtrim($_G['siteurl'], '/') . '/plugin.php?id=bigapp:mobile';
$imgUrl = rtrim($_G['siteurl'], '/') . '/' . BigAppConf::$upfileUrl . '&key=' . urlencode('mobile_app_image_s');
$tplVars = array("plugin_path" => rtrim($_G['siteurl'], '/') . '/source/plugin/bigapp', "imgUrl" => $imgUrl);
///////////////////////////////////
updatecache('setting');
if (isset($_G['setting']['bigapp_pcset'])) {
    $_G['setting']['bigapp_pcset'] = unserialize($_G['setting']['bigapp_pcset']);
}
$params["ajaxurl2"] = rtrim($_G['siteurl'], '/') . '/plugin.php?id=bigapp:pcset&inajax=1';
$params["moburl_switch"] = 0;
$params["moburl"] = "";
if (isset($_G['setting']['bigapp_pcset']['moburl_switch'])) {
    $params["moburl_switch"] = $_G['setting']['bigapp_pcset']['moburl_switch'];
}
if (isset($_G['setting']['bigapp_pcset']['moburl'])) {
    $params["moburl"] = $_G['setting']['bigapp_pcset']['moburl'];
}
///////////////////////////////////
Utils::loadTemplate(FILE_PATH . '/view/mobileset.tpl', $params, $tplVars);
runlog('bigapp', 'show release page succ');
// vim600: sw=4 ts=4 fdm=marker syn=php
开发者ID:Mushan3420,项目名称:BigApp-PHP7,代码行数:31,代码来源:mobileset.inc.php

示例15: swritefile

function swritefile($filename, $writetext, $openmod = 'w')
{
    if (@($fp = fopen($filename, $openmod))) {
        flock($fp, 2);
        fwrite($fp, $writetext);
        fclose($fp);
        return true;
    } else {
        runlog('error', "File: {$filename} write error.");
        return false;
    }
}
开发者ID:NaturalWill,项目名称:UCQA,代码行数:12,代码来源:function_common.php


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