Server : Apache
System : Linux iZ2vcgyutqttsd1p850kl8Z 3.10.0-1160.92.1.el7.x86_64 #1 SMP Tue Jun 20 11:48:01 UTC 2023 x86_64
User : www ( 1000)
PHP Version : 5.6.40
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Directory :  /www/wwwroot/saimikebio.com/mobile/include/
Upload File :
Current Directory [ Writeable ] Root Directory [ Writeable ]


Current File : /www/wwwroot/saimikebio.com/mobile/include/cls_ecshop.php
<?php



/**

 * ECSHOP 基础类

 * ============================================================================

 * * 版权所有 2005-2012 上海商派网络科技有限公司,并保留所有权利。

 * 网站地址: http://www.ecshop.com;

 * ----------------------------------------------------------------------------

 * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和

 * 使用;不允许对程序代码以任何形式任何目的的再发布。

 * ============================================================================

 * $Author: liubo $

 * $Id: cls_ecshop.php 17217 2011-01-19 06:29:08Z liubo $

*/



if (!defined('IN_ECTOUCH'))

{

    die('Hacking attempt');

}



define('APPNAME', '商城');
define('VERSION', 'v3.6');
define('RELEASE', '20180312');


class ECS

{

    var $db_name = '';

    var $prefix  = 'ecs_';



    /**

     * 构造函数

     *

     * @access  public

     * @param   string      $ver        版本号

     *

     * @return  void

     */

    function ECS($db_name, $prefix)

    {

        $this->db_name = $db_name;

        $this->prefix  = $prefix;

    }



    /**

     * 将指定的表名加上前缀后返回

     *

     * @access  public

     * @param   string      $str        表名

     *

     * @return  string

     */

    function table($str)

    {

        return '`' . $this->db_name . '`.`' . $this->prefix . $str . '`';

    }



    /**

     * ECSHOP 密码编译方法;

     *

     * @access  public

     * @param   string      $pass       需要编译的原始密码

     *

     * @return  string

     */

    function compile_password($pass)

    {

        return md5($pass);

    }



    /**

     * 取得当前的域名

     *

     * @access  public

     *

     * @return  string      当前的域名

     */

    function get_domain()

    {

        /* 协议 */

        $protocol = $this->http();



        /* 域名或IP地址 */

        if (isset($_SERVER['HTTP_X_FORWARDED_HOST']))

        {

            $host = $_SERVER['HTTP_X_FORWARDED_HOST'];

        }

        elseif (isset($_SERVER['HTTP_HOST']))

        {

            $host = $_SERVER['HTTP_HOST'];

        }

        else

        {

            /* 端口 */

            if (isset($_SERVER['SERVER_PORT']))

            {

                $port = ':' . $_SERVER['SERVER_PORT'];



                if ((':80' == $port && 'http://' == $protocol) || (':443' == $port && 'https://' == $protocol))

                {

                    $port = '';

                }

            }

            else

            {

                $port = '';

            }



            if (isset($_SERVER['SERVER_NAME']))

            {

                $host = $_SERVER['SERVER_NAME'] . $port;

            }

            elseif (isset($_SERVER['SERVER_ADDR']))

            {

                $host = $_SERVER['SERVER_ADDR'] . $port;

            }

        }



        return $protocol . $host;

    }



    /**

     * 获得 ECSHOP 当前环境的 URL 地址

     *

     * @access  public

     *

     * @return  void

     */

    function url()

    {

        $curr = strpos(PHP_SELF, ADMIN_PATH . '/') !== false ?

                preg_replace('/(.*)(' . ADMIN_PATH . ')(\/?)(.)*/i', '\1', dirname(PHP_SELF)) :

                dirname(PHP_SELF);



        $root = str_replace('\\', '/', $curr);



        if (substr($root, -1) != '/')

        {

            $root .= '/';

        }



        return $this->get_domain() . $root;

    }



    /**

     * 获得 ECSHOP 当前环境的 HTTP 协议方式

     *

     * @access  public

     *

     * @return  void

     */

    function http()

    {

        return (isset($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) != 'off')) ? 'https://' : 'http://';

    }



    /**

     * 获得数据目录的路径

     *

     * @param int $sid

     *

     * @return string 路径

     */

    function data_dir($sid = 0)

    {

        if (empty($sid))

        {

            $s = 'data';

        }

        else

        {

            $s = 'user_files/';

            $s .= ceil($sid / 3000) . '/';

            $s .= $sid % 3000;

        }

        return $s;

    }



    /**

     * 获得图片的目录路径

     *

     * @param int $sid

     *

     * @return string 路径

     */

    function image_dir($sid = 0)

    {

        if (empty($sid))

        {

            $s = 'images';

        }

        else

        {

            $s = 'user_files/';

            $s .= ceil($sid / 3000) . '/';

            $s .= ($sid % 3000) . '/';

            $s .= 'images';

        }

        return $s;

    }



}



?>