Exemple #1
0
function save_website($datas)
{
    global $templatesList;
    load_lib();
    //Etape 1 : sauvegarde du site
    require_once MODELS . DS . 'website.php';
    $websiteModel = new Website();
    $templateId = $datas['template_id'];
    $template = $templatesList[$templateId];
    $datas['tpl_layout'] = $template['layout'];
    $datas['tpl_code'] = $template['code'];
    $datas['search_engine_position'] = 'header';
    $datas['created_by'] = 1;
    $datas['modified_by'] = 1;
    $datas['online'] = 1;
    $websiteModel->save($datas);
    define('CURRENT_WEBSITE_ID', $websiteModel->id);
    //Etape 2 : sauvegarde du menu racine
    require_once MODELS . DS . 'category.php';
    $categoryModel = new Category();
    unset($categoryModel->searches_params);
    ////////////////////////////////////////////////////////
    //   INITIALISATION DE LA CATEGORIE PARENTE DU SITE   //
    $categorie = array('parent_id' => 0, 'type' => 3, 'name' => 'Racine Site ' . $websiteModel->id, 'slug' => 'racine-site-' . $websiteModel->id, 'online' => 1, 'redirect_category_id' => 0, 'display_contact_form' => 0, 'website_id' => $websiteModel->id);
    $categoryModel->save($categorie);
    return $websiteModel->id + $categoryModel->id;
}
Exemple #2
0
function send_mail($to, $title, $content)
{
    load_lib("Mailer");
    $mail = new PHPMailer();
    $mail->IsSMTP();
    $mail->CharSet = "utf-8";
    $mail->Host = "smtp.163.com";
    // 您的企业邮局域名
    $mail->SMTPAuth = true;
    // 启用SMTP验证功能
    $mail->Username = "******";
    // 邮局用户名(请填写完整的email地址)
    $mail->Password = "";
    // 邮局密码
    $mail->Port = 25;
    $mail->From = "*****@*****.**";
    //邮件发送者email地址
    $mail->FromName = "Xssing";
    $mail->AddAddress($to, $_COOKIE['xing_name']);
    //收件人地址,可以替换成任何想要接收邮件的email信箱,格式是AddAddress("收件人email","收件人姓名")
    //$mail->AddReplyTo("", "");
    $mail->IsHTML(true);
    $mail->Subject = $title;
    $mail->Body = $content;
    return $mail->Send();
}
Exemple #3
0
 /**
  * 依据$product_type产生一个Product类
  */
 public function newProduct($product_type)
 {
     $className = $product_type . 'Product';
     $lib = 'pub:' . $className;
     load_lib($lib);
     $className[0] = strtoupper($className[0]);
     return new $className();
 }
 /**
  *
  * @param string $fullName
  *        	Namespace And ClassName
  * @throws \classes\trouble\exception\core\ClassNotFoundException
  */
 public function includeByClassName($fullName)
 {
     try {
         load_lib($fullName);
         if (!class_exists($fullName) && !interface_exists($fullName)) {
             header('Content-type: text/plain; charset=utf-8');
             debug_print_backtrace();
             echo "not found script file name or conflict: {$fullName}";
         }
     } catch (PHPScriptNotFoundException $ex) {
         throw new ClassNotFoundException($fullName);
     }
 }
Exemple #5
0
 public function step1()
 {
     if ($this->getInstallVersion() == VHMS_VERSION) {
         die("已经升级过了.");
     }
     load_lib("pub:db");
     $db = db_connect('default');
     $sqlfile = dirname(__FILE__) . '/upgrade.sql';
     apicall('install', 'executeSql', array($db, $sqlfile));
     apicall('product', 'flushVhostProduct');
     //$db->exec("ALTER TABLE `vhost` DROP INDEX `name` , ADD UNIQUE `name` ( `name` ) ");
     if (!apicall('install', 'writeVersion')) {
         die("未能写入版本信息");
     }
     die("成功升级,<a href='?c=session&a=loginForm'>登录</a>");
 }
Exemple #6
0
function the_user()
{
    if (isset($_COOKIE[User_LoginKey])) {
        $getcookie = myDecrypt($_COOKIE[User_LoginKey], UserLogin_CryptKey);
        //var_export($getcookie);
        //var_export($_COOKIE[User_LoginKey]);
        load_lib("user", "userinfo");
        $userinfo = new userinfo();
        //这儿必须要 对象化,不然unserialize,提示错误
        $userinfo = unserialize($getcookie);
        if ($userinfo && $userinfo->user_name != "" && $userinfo->user_loginIP == IP()) {
            //判断cookie的合法性
            return $userinfo;
        }
        return false;
    }
    return false;
}
function type_url($path = '', $file_type = 'js', $cache = TRUE)
{
    switch ($file_type) {
        case 'js':
            $item_config = 'script_url';
            break;
        case 'css':
            $item_config = 'style_url';
            break;
        default:
            $item_config = 'script_url';
            break;
    }
    if ($cache) {
        $key_type = 'md5';
        $region = 'config';
        $path_info = pathinfo($path);
        $key = implode('_', array($file_type, $path_info['filename'], $key_type));
        //1. 取静态变量
        $config = get_config();
        if (isset($config[$key])) {
            $value = $config[$key];
            return config_item($item_config) . $path_info['dirname'] . '/' . $path_info['filename'] . '-' . $value . 't.' . $path_info['extension'];
        }
        //2. 取local yac缓存
        load_lib('cache_common:yac_library');
        $value = get_instance()->yac_library->get($region, $key);
        if ($value) {
            $value = substr($value, 0, 10);
            $config[$key] = $value;
            return config_item($item_config) . $path_info['dirname'] . '/' . $path_info['filename'] . '-' . $value . 'y.' . $path_info['extension'];
        }
        //3. 取memcache 缓存
        load_lib('cache_common:memcached_library');
        $value = get_instance()->memcached_library->get($region, $key);
        if ($value) {
            $value = substr($value, 0, 10);
            $config[$key] = $value;
            return config_item($item_config) . $path_info['dirname'] . '/' . $path_info['filename'] . '-' . $value . 'm.' . $path_info['extension'];
        }
    }
    return config_item($item_config) . $path;
}
Exemple #8
0
 public function makeDbProduct($node)
 {
     $node_cfg = $GLOBALS['node_cfg'][$node];
     if (!is_array($node_cfg)) {
         return trigger_error('没有节点' . $node . '的配置文件,请更新配置文件');
     }
     load_lib('pub:dbProduct');
     $db_type = 'mysql';
     //		if(!$db_type){
     //			return trigger_error('该节点数据库类型出错!');
     //		}
     $className = $db_type . "DbProduct";
     load_lib('pub:' . $className);
     $className[0] = strtoupper($className[0]);
     $db = new $className();
     if (!$db->connect($node_cfg)) {
         //return trigger_error('不能连接节点数据库');
         return false;
     }
     return $db;
 }
Exemple #9
0
 function index()
 {
     $uid = $_GET['u'];
     $i = $_GET['i'];
     if ($uid) {
         $project = new ProjectModel();
         $pid = $project->url_to_pid($uid);
         if ($pid) {
             load_lib('Browser');
             $ip = get_client_ip();
             $type = htmlentities(Browser::get_client_browser());
             $os = htmlentities(Browser::get_clinet_os());
             $browser = new BrowserModel($ip, $type, $os, $pid);
             if ($browser->bid) {
             } else {
                 // 注册
                 $browser->reg();
                 //发送邮件
             }
             if (!$browser->bid) {
                 exit;
             }
             // 退出处理
             //上线部分完毕
             include view_file();
         } else {
             header("Location:?m=xing");
         }
     } else {
         if ($i) {
             //邀请码注册
             header("Location:?m=user&a=reg&i=" . $i);
         } else {
             header("Location:?m=xing");
         }
     }
 }
Exemple #10
0
 /**
  * 创建实例的方法
  * @param string $p_sType
  * @param string $p_sProduct
  * @return object
  */
 public static function create($p_sType, $p_sProduct = 'default_producer')
 {
     $p_sType = strtolower($p_sType);
     $sKey = $p_sType . '_' . $p_sProduct;
     if (isset(self::$instances[$sKey])) {
         return self::$instances[$sKey];
     }
     if (!in_array($p_sType, array('producer', 'consumer'))) {
         bll_rabbitmq_logger::create(array('type' => 'create', 'error' => '[rabbitmq_factory] invalid rabbitmq type:' . $p_sType));
         return false;
     }
     $sClassPath = '/bll/rabbitmq/' . $p_sType;
     $sClassName = path_to_classname($sClassPath, '');
     if (!class_exists($sClassName)) {
         load_lib($sClassPath);
     }
     try {
         self::$instances[$sKey] = new $sClassName($p_sProduct);
         return self::$instances[$sKey];
     } catch (Exception $e) {
         bll_rabbitmq_logger::create(array('type' => 'create', 'error' => '[rabbitmq_factory] Class:' . $sClassName . ' init failed'));
         return false;
     }
 }
Exemple #11
0
<?php

load_lib('array');
load_class('c_db_manager');
/**
 * абстрактный класс для получения данных из таблиц
 */
abstract class a_data
{
    public $fields = null;
    //перекрываем запрошенные поля
    public $res;
    //все строки результата
    public $res_first;
    //только первая строка результата
    public $enable;
    //=true если запрос вернул результат
    public $count;
    //если в запросе $is_calck_count=true, то количество записей будет здесь
    /**
     * db
     *
     * @var c_db
     */
    public $db;
    public $is_debug = false;
    public $is_use_SQL_CALC_FOUND_ROWS = false;
    function __construct($db_id)
    {
        global $o_db_man;
        $this->res = array();
Exemple #12
0
 public function check_connect($host, $port, $dbname, $user, $passwd)
 {
     load_lib('pub:db');
     return db_connectx('mysql', $host, $port, $dbname, $user, $passwd);
 }
Exemple #13
0
 public function sellForm()
 {
     if (getRole('user') == "") {
         header("Location: ?c=session&a=loginForm");
         die;
     }
     $product = explode('_', $_REQUEST['product']);
     $username = getRole('user');
     switch ($product[0]) {
         case 'vhost':
             $product_info = daocall('vhostproduct', 'getProduct', array($product[1]));
             if (!$product_info || intval($product_info['pause_flag']) != 0) {
                 return trigger_error('虚拟主机产品ID错误');
             }
             $userinfo = daocall('user', 'getUser', array($username));
             if ($userinfo['agent_id'] > 0) {
                 $arr['agent_id'] = $userinfo['agent_id'];
                 $arr['product_type'] = 0;
                 $arr['product_id'] = $product[1];
                 $agentinfo = daocall('agentprice', 'getAgentprice', array($arr));
                 if ($agentinfo && $agentinfo[0]['price'] > 0) {
                     $product_info['price'] = $agentinfo[0]['price'];
                 }
             }
             $try_day = daocall('setting', 'get', array('try_day'));
             if ($try_day <= 0 || $try_day == null) {
                 $try_day = '3';
             }
             $this->_tpl->assign('try_day', $try_day);
             load_lib('pub:whm');
             $subtempletes = apicall('nodes', 'listSubTemplete', array($product_info['node'], $product_info['templete']));
             $this->_tpl->assign('subtempletes', $subtempletes);
             $this->_tpl->assign('product', $product_info);
             return $this->_tpl->fetch('vhostproduct/sell.html');
             break;
         default:
             return trigger_error('产品类型错误');
     }
 }
Exemple #14
0
 /**
  * Создаём условие IN для SQL-запроса
  *
  * @param string $param_name - имя параметра
  * @param array $in_values - массив значений
  * @param string $word - IN
  * @return string
  */
 public function make_in($param_name, $in_values = array(), $word = 'IN')
 {
     if (!empty($in_values)) {
         load_lib('array');
         $in_values = make_array($in_values);
         foreach ($in_values as $key => $itm) {
             $in_values[$key] = $this->tosql($itm);
         }
         $res = implode(',', $in_values);
         $res = " {$param_name} {$word} ({$res}) ";
     } else {
         $res = '';
     }
     return $res;
 }
Exemple #15
0
<?php

/**
 * Работа с XML
 * Реализует преобразования
 *   XML    ->  c_xml
 *   array  ->  c_xml
 *   c_xml ->  XML
 *   c_xml ->  array
 *   c_xml ->  String
 *   c_xml ->  dump
 * Реализует поиск по xPath
 */
load_lib('array');
load_lib('str');
class c_xml_node
{
    /**
     * =true когда загрузка успешна
     * @var boolean
     */
    public $isLoaded = false;
    public $is_normalize_upper = null;
    protected $name = '';
    protected $value = '';
    protected $attributes = array();
    /**
     * @var $childNodes array of c_xml_node
     */
    protected $childNodes = array();
    protected $childNodesByName = array();
Exemple #16
0
 public function __construct()
 {
     load_lib('pub:whm');
     parent::__construct();
 }
Exemple #17
0
<?php

header('Content-type: text/html; charset=utf-8');
mb_http_output("UTF-8");
//mb_http_input("UTF-8");
mb_language("uni");
//=utf-8
mb_internal_encoding("UTF-8");
load_class('c_session');
load_lib('utils');
load_class('c_global');
load_class('c_user');
load_class('c_cache');
/*Begin создаём сесию*/
global $o_session;
$o_session = new c_session();
/*End создаём сесию*/
/*Begin создаём глобальные константы*/
global $o_global, $site_root;
$o_global = new c_global(dirname(__FILE__) . '/', $site_root);
/*End создаём глобальные константы*/
/*Begin main functions*/
function load_class($class_name)
{
    global $engine_root;
    include_once $engine_root . 'classes/' . $class_name . '.php';
}
function load_lib($lib_name)
{
    global $engine_root;
    include_once $engine_root . 'lib/' . $lib_name . '.php';
Exemple #18
0
define('PUBLIC_JS', PUBLIC_URL . '/js');
define('PUBLIC_CSS', PUBLIC_URL . '/css');
define('PUBLIC_FONTS', PUBLIC_URL . '/fonts');
//========================== functions
function load_file($path, $once = true)
{
    // $ds = (DS == '/')? DS : '\\';
    $ds = DS;
    $new_path = str_replace('/', $ds, $path);
    $require_path = ROOT . DS . stripslashes($new_path);
    if ($once) {
        require_once $require_path;
    } else {
        require $require_path;
    }
}
function load_lib($path)
{
    $new_path = 'lib/' . stripslashes($path);
    load_file($new_path);
}
function load_inc($path)
{
    $new_path = 'inc/' . stripslashes($path);
    load_file($new_path);
}
//====================== require classess
load_lib('AltoRouter/AltoRouter.php');
load_lib('functions.php');
load_lib('WordsApp.php');
Exemple #19
0
<?php

use classes\model\html\JavaScriptElement;
load_lib('func/request');
/**
 * 페이지 리다이렉트
 * @param stgring $location
 */
function response_redirect($location)
{
    if (headers_sent()) {
        echo "<script type='text/javascript'>location.href='{$location}'</script>";
    } else {
        header("location: {$location}");
    }
}
/**
 * 경고 메시지 출력뒤 페이지 이동
 * @param unknown $msg
 * @param string $location
 */
function response_alert_redirect($msg, $location = null)
{
    header("Content-Type: text/html; charset=UTF-8");
    $content = "";
    $script = new JavaScriptElement();
    $content = "alert('" . addslashes($msg) . "');";
    if (!is_null($location)) {
        $content .= "location.href = '" . addslashes($location) . "';";
    }
    $script->setContent($content);
Exemple #20
0
<?php

load_lib('/sms/sdk/nusoap');
class Client
{
    /**
     * 网关地址
     */
    var $url;
    /**
     * 序列号,请通过亿美销售人员获取
     */
    var $serialNumber;
    /**
     * 密码,请通过亿美销售人员获取
     */
    var $password;
    /**
     * 登录后所持有的SESSION KEY,即可通过login方法时创建
     */
    var $sessionKey;
    /**
     * webservice客户端
     */
    var $soap;
    /**
     * 默认命名空间
     */
    var $namespace = 'http://sdkhttp.eucp.b2m.cn/';
    /**
     * 往外发送的内容的编码,默认为 GBK
Exemple #21
0
function send_mail($to, $title, $content)
{
    load_lib("Mailer");
    $mail = new PHPMailer();
    $mail->IsSMTP();
    $mail->CharSet = "utf-8";
    $mail->Host = "smtp.163.com";
    $mail->SMTPAuth = true;
    $mail->Username = "******";
    $mail->Password = "";
    $mail->Port = 25;
    $mail->From = "*****@*****.**";
    $mail->FromName = "Xssing";
    $mail->AddAddress($to, $_COOKIE['xing_name']);
    $mail->IsHTML(true);
    $mail->Subject = $title;
    $mail->Body = $content;
    return $mail->Send();
}
Exemple #22
0
<?php

load_lib('/bll/rabbitmq/base');
/**
 * @filename consumer.php
 * RabbitMQ消费者
 * 
 * @project hf-code
 * @package app-service
 * @author Randy Hong <*****@*****.**>
 * @created at 14-8-1
 */
/**
 * Class bll_rabbitmq_consumer
 * RabbitMQ消费者类
 * @package app-service-bll-rabbitmq
 * @Author Randy Hong <*****@*****.**>
 * @Update 2014-08-04
 */
class bll_rabbitmq_consumer extends bll_rabbitmq_base
{
    /**
     * 构造方法,继承父类
     * 初始化连接
     * @param string $p_sKey 配置
     */
    public function __construct($p_sKey)
    {
        parent::__construct($p_sKey);
        $this->init($this->sExchangeName, $this->sQueueName, $this->sRoutingKey, $this->bDurable);
    }
Exemple #23
0
 function __construct()
 {
     load_lib("pub:db");
 }
Exemple #24
0
 function __construct()
 {
     load_lib('pub:whm');
 }
Exemple #25
0
Fichier : ui.php Projet : 1upon0/ui
/**
* include this in the lib: class auto{const load=0;public static function testSuite(){optional tests for debug mode}public static function init(){init code}}
* call this to load a lib: \ui\lib_name\auto::load;
*/
spl_autoload_register(function ($class) {
    $l = strlen(__NAMESPACE__) + 1;
    if (substr($class, 0, $l) != __NAMESPACE__) {
        //namespace must start with ui\
        return;
    }
    $lib = substr($class, $l, strrpos($class, '\\') - $l);
    if (!$lib) {
        return;
    }
    echo "loading {$lib}";
    load_lib($lib);
});
function load_php($file)
{
    if (file_exists($file)) {
        include $file;
        return true;
    }
    return false;
}
function config($key = false, $val = NULL, $set = false)
{
    static $config = NULL;
    if (!$config) {
        $config = array();
        include global_var('app_dir') . 'inc/config.php';
<?php

namespace classes\trouble\printer;

use classes\lang\StringBuilder;
use classes\trouble\exception\core\WarningException;
load_lib('func/base.array');
/**
 * Perminator Class
 */
class XMLExceptionPrinter implements IExceptionPrinter
{
    const XML_WRAPPER = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<XMLExceptionPrinter ver="0.1">
\t<TraceException>
%s
\t</TraceException>
\t<TraceCallStack>
\t\t%s
\t</TraceCallStack>
</XMLExceptionPrinter>
XML;
    const EXCEPTIONS_WRAPPER_FORMAT = <<<XML
<Exception type="%s">
\t<Message><![CDATA[%s]]></Message>
\t<File><![CDATA[%s]]></File>
\t<Code>%s</Code>
\t<Line>%s</Line>
\t<ExceptionStacks>
\t\t%s