예제 #1
0
파일: user.php 프로젝트: sd-studio/or
    function __construct($id)
    {
        $user = query2array("\r\n\t\t\tSELECT login, password, salt, name, email, descr, registered, last_login, status, image\r\n\t\t\tFROM cf_users\r\n\t\t\tWHERE id=:id", array('id' => $id));
        if (empty($user)) {
            throw new \Exception('Invalid user');
        }
        $this->id = (int) $id;
        $this->login = $user['login'];
        $this->password = $user['password'];
        $this->salt = $user['salt'];
        $this->name = $user['name'];
        $this->email = $user['email'];
        $this->descr = $user['descr'];
        $this->registered = $user['registered'];
        $this->last_login = $user['last_login'];
        $this->status = $user['status'];
        $this->image = $user['image'];
        $this->roles = query2arrays('
			SELECT cf_roles.id AS id, cf_roles.name, cf_roles.descr
			FROM cf_roles
			INNER JOIN cf_user_roles ON cf_roles.id = cf_user_roles.role_id
			WHERE cf_user_roles.user_id=:uid
			ORDER BY name', array('uid' => $this->id), false, 'id');
    }
예제 #2
0
파일: shop.php 프로젝트: sd-studio/sh
 private static function load_attributes($id, $categories)
 {
     if (empty($categories)) {
         return array();
     }
     return query2arrays("\r\n\t\t\tSELECT \r\n\t\t\t\tcf_attributes.id AS id,\r\n\t\t\t\tIFNULL(cf_attributes.code,cf_attributes.id) AS code,\r\n\t\t\t\tcf_attributes.name AS name,\r\n\t\t\t\tcf_attributes.type_id,\r\n\t\t\t\tv.attribute_value AS value\r\n\t\t\tFROM cf_attributes\r\n\t\t\tINNER JOIN cf_category_attributes ON cf_category_attributes.attribute_id = cf_attributes.id\r\n\t\t\tLEFT JOIN (SELECT * FROM cf_product_attributes WHERE product_id={$id}) v ON v.attribute_id = cf_attributes.id\r\n\t\t\tWHERE cf_category_attributes.page_id IN(" . implode(',', $categories) . ")\r\n\t\t\tORDER BY cf_category_attributes.sort_order\r\n\t\t", array(), false, 'code');
 }