Ejemplo n.º 1
0
 public function __construct($attributes)
 {
     parent::__construct($attributes);
     $this->attributes['session_name'] = session_name();
     $this->attributes['session_id'] = session_id();
     $this->attributes['file_types'] = array('jpg', 'png', 'gif', 'swf');
     if (!isset($this->attributes['file_source'])) {
         $this->attributes['file_source'] = 'upload/';
     }
     $this->attributes['file_types_description'] = \WellCommerce\Translation::get('TXT_FILE_TYPES_IMAGE');
     $this->attributes['upload_url'] = App::getURLAdressWithAdminPane() . 'files/add/' . base64_encode($this->attributes['file_source']);
     $this->attributes['load_handler'] = 'xajax_LoadFiles_' . $this->_id;
     App::getRegistry()->xajaxInterface->registerFunction(array('LoadFiles_' . $this->_id, $this, 'LoadFiles'));
     $this->attributes['delete_handler'] = 'xajax_DeleteFile_' . $this->_id;
     App::getRegistry()->xajaxInterface->registerFunction(array('deleteFile_' . $this->_id, $this, 'deleteFile'));
     $this->attributes['type_icons'] = array('cdup' => DESIGNPATH . '_images_panel/icons/filetypes/cdup.png', 'unknown' => DESIGNPATH . '_images_panel/icons/filetypes/unknown.png', 'directory' => DESIGNPATH . '_images_panel/icons/filetypes/directory.png', 'gif' => DESIGNPATH . '_images_panel/icons/filetypes/image.png', 'png' => DESIGNPATH . '_images_panel/icons/filetypes/image.png', 'jpg' => DESIGNPATH . '_images_panel/icons/filetypes/image.png', 'bmp' => DESIGNPATH . '_images_panel/icons/filetypes/image.png', 'txt' => DESIGNPATH . '_images_panel/icons/filetypes/text.png', 'doc' => DESIGNPATH . '_images_panel/icons/filetypes/text.png', 'rtf' => DESIGNPATH . '_images_panel/icons/filetypes/text.png', 'odt' => DESIGNPATH . '_images_panel/icons/filetypes/text.png', 'htm' => DESIGNPATH . '_images_panel/icons/filetypes/document.png', 'html' => DESIGNPATH . '_images_panel/icons/filetypes/document.png', 'php' => DESIGNPATH . '_images_panel/icons/filetypes/document.png');
 }
Ejemplo n.º 2
0
    public function search($phrase)
    {
        $phrase = strtolower($phrase);
        $sql = '
			SELECT 
				O.idorder, 
				O.adddate,
				AES_DECRYPT(OC.surname,:encryptionkey) AS surname,
				AES_DECRYPT(OC.firstname,:encryptionkey) AS firstname,
				AES_DECRYPT(OC.email,:encryptionkey) AS email
			FROM `order` O
			LEFT JOIN orderclientdata OC ON OC.orderid=O.idorder
			WHERE 
				O.idorder = :id OR
				CONVERT(LOWER(AES_DECRYPT(OC.surname,:encryptionkey)) USING utf8) LIKE :phrase OR
				CONVERT(LOWER(AES_DECRYPT(OC.firstname,:encryptionkey)) USING utf8) LIKE :phrase OR
				CONVERT(LOWER(AES_DECRYPT(OC.email,:encryptionkey)) USING utf8) LIKE :phrase
			ORDER BY O.adddate DESC
			LIMIT 10
			';
        $stmt = Db::getInstance()->prepare($sql);
        $stmt->bindValue('id', $phrase);
        $stmt->bindValue('phrase', '%' . $phrase . '%');
        $stmt->bindValue('encryptionkey', Session::getActiveEncryptionKeyValue());
        $stmt->execute();
        $Data = array();
        while ($rs = $stmt->fetch()) {
            $url = App::getURLAdressWithAdminPane() . 'order/edit/' . $rs['idorder'];
            $str = '#' . $rs['idorder'] . ': ' . $rs['firstname'] . ' ' . $rs['surname'] . ' (' . $rs['email'] . ') z dnia ' . $rs['adddate'];
            $str = $this->highlight($phrase, $str);
            $str = '<li><a href="' . $url . '">' . $str . '</a></li>';
            $Data['orders'][] = $str;
        }
        $sql = '
			SELECT 
				OC.clientid, 
				AES_DECRYPT(OC.surname,:encryptionkey) AS surname,
				AES_DECRYPT(OC.firstname,:encryptionkey) AS firstname,
				AES_DECRYPT(OC.email,:encryptionkey) AS email
			FROM clientdata OC
			WHERE 
				CONVERT(LOWER(AES_DECRYPT(OC.surname,:encryptionkey)) USING utf8) LIKE :phrase OR
				CONVERT(LOWER(AES_DECRYPT(OC.firstname,:encryptionkey)) USING utf8) LIKE :phrase OR
				CONVERT(LOWER(AES_DECRYPT(OC.email,:encryptionkey)) USING utf8) LIKE :phrase
			LIMIT 10
			';
        $stmt = Db::getInstance()->prepare($sql);
        $stmt->bindValue('id', $phrase);
        $stmt->bindValue('phrase', '%' . $phrase . '%');
        $stmt->bindValue('encryptionkey', Session::getActiveEncryptionKeyValue());
        $stmt->execute();
        while ($rs = $stmt->fetch()) {
            $url = App::getURLAdressWithAdminPane() . 'client/edit/' . $rs['clientid'];
            $str = $rs['firstname'] . ' ' . $rs['surname'] . ' (' . $rs['email'] . ')';
            $str = $this->highlight($phrase, $str);
            $str = '<li><a href="' . $url . '">' . $str . '</a></li>';
            $Data['clients'][] = $str;
        }
        $sql = '
			SELECT 
				PT.productid,
				PT.name,
				P.ean,
				P.delivelercode
			FROM product P
			LEFT JOIN producttranslation PT ON PT.productid = P.idproduct AND PT.languageid = :languageid
			WHERE 
				PT.name LIKE :phrase OR
				P.ean LIKE :phrase OR
				P.delivelercode LIKE :phrase
			LIMIT 20
			';
        $stmt = Db::getInstance()->prepare($sql);
        $stmt->bindValue('id', $phrase);
        $stmt->bindValue('phrase', '%' . $phrase . '%');
        $stmt->bindValue('languageid', Helper::getLanguageId());
        $stmt->execute();
        while ($rs = $stmt->fetch()) {
            $url = App::getURLAdressWithAdminPane() . 'product/edit/' . $rs['productid'];
            $str = $rs['name'];
            if ($rs['ean'] != '') {
                $str .= ', EAN: ' . $rs['ean'];
            }
            $str = $this->highlight($phrase, $str);
            $str = '<li><a href="' . $url . '">' . $str . '</a></li>';
            $Data['products'][] = $str;
        }
        return $Data;
    }