Example #1
0
 /**
  * Locate the usage of a symbol.
  *
  * @param integer $symid  The symbol id.
  * @param string $tag     The tag of the file.
  *
  * @return array  Nested hash with elements 'filename', and 'line'.
  */
 function getReference($symid, $tag = '')
 {
     $this->_connect();
     $query = 'SELECT filename, line FROM ' . 'luxor_usage, luxor_files WHERE ' . 'luxor_usage.fileid = luxor_files.fileid AND ' . 'luxor_usage.symid = ? AND ' . 'luxor_files.tag = ? AND ' . 'luxor_files.source = ?';
     $values = array((int) $symid, $tag, $this->_source);
     return $this->_db->getAll($query, $values, DB_FETCHMODE_ASSOC);
 }
Example #2
0
 function run($path)
 {
     $sql = 'SELECT * FROM {{forms}} WHERE path=\'' . $path . '\'';
     $form = DB::getRow($sql);
     $sql = 'SELECT * FROM {{forms_fields}} WHERE forms=' . $form['id'] . ' ORDER BY num';
     $fields = DB::getAll($sql);
     foreach ($fields as $item) {
         $item['required'] = $item['required'] == 1 ? 'required' : '';
         switch ($item['type']) {
             case 'string':
                 $text .= FormWidget::getString($item);
                 break;
             case 'text':
                 $text .= FormWidget::getText($item);
                 break;
             case 'select':
                 $text .= FormWidget::getSelect($item);
                 break;
             case 'radio':
                 $text .= FormWidget::getRadio($item);
                 break;
             case 'hidden':
                 $text .= FormWidget::getString($item);
                 break;
             case '':
                 break;
         }
     }
     return str_replace('{content}', $text, View::getWidget('form', $form));
 }
Example #3
0
    function setSearch()
    {
        $data = array();
        $sql = 'SELECT * FROM ' . BDPREFIX . 'tree WHERE visible=1 and path<>\'index\' and path<>\'search\' and path<>\'sitemap\' ORDER BY mdate DESC, cdate DESC';
        $list = DB::getAll($sql, '', 1);
        $sql = 'DELETE FROM {{search}}';
        DB::exec($sql);
        foreach ($list as $item) {
            $sql = 'SELECT * FROM {{data}} WHERE tree=' . $item['id'] . '';
            $datas = DB::getAll($sql);
            $temp = $item['id'] . ' ' . $item['name'] . ' ' . $item['seo_title'] . ' ' . $item['seo_keywords'] . ' ' . $item['seo_description'] . '  ';
            foreach ($datas as $item2) {
                $temp .= trim(htmlspecialchars(strip_tags($item2['value_string'] . ' ' . $item2['value_text']))) . ' ';
            }
            $item['search'] = $temp;
            $sql = '
				INSERT INTO {{search}}
				SET 
					name=\'' . mysql_real_escape_string($item['name']) . '\',
					tree=\'' . $item['id'] . '\',
					search=\'' . mysql_real_escape_string($item['search']) . '\',
					cdate=\'' . $item['mdate'] . '\'
		   ';
            DB::exec($sql);
        }
    }
Example #4
0
    function run($row)
    {
        $row['slideshowGroup'] = GalleryWidget::$slideshowGroup;
        GalleryWidget::$slideshowGroup++;
        $row['files'] = array();
        if (is_numeric($row['tree'])) {
            $sql = '
				SELECT id FROM {{data}}
				WHERE tree=' . $row['tree'] . ' AND path=\'' . $row['path'] . '\' AND type=\'gallery\'
			';
            $dataId = DB::getOne($sql);
            if ($dataId) {
                $sql = '
					SELECT id2 FROM {{relations}}
					WHERE modul1=\'data\' AND modul2=\'files\' AND id1=' . $dataId . '
				';
                $fileId = DB::getAll($sql, 'id2');
                if (count($fileId) > 0) {
                    $sql = '
						SELECT * FROM {{files}}
						WHERE id IN (' . implode(',', $fileId) . ')
						ORDER BY num
					';
                    $temp = DB::getAll($sql);
                    foreach ($temp as $item) {
                        $item['file'] = Funcs::getFileInfo($item['path']);
                        $row['files'][$item['mime']][] = $item;
                    }
                }
            }
        }
        GalleryWidget::$files = $row['files'];
        return View::getWidget('galleryWidget', $row);
    }
Example #5
0
    public static function getManagerList()
    {
        $data = array();
        $sql = '
			(
				SELECT {{tree}}.id, \'tree\' AS what, {{tree}}.mdate AS udate  FROM {{tree}}
				INNER JOIN {{catalog}} ON {{tree}}.id={{catalog}}.tree
				WHERE (({{catalog}}.rejected=\'\' AND {{tree}}.visible=0) OR ({{catalog}}.status=\'salereq\')) AND filecover<>\'\'
				ORDER BY {{tree}}.mdate DESC
			)UNION(
				SELECT id, \'orders\' AS what, cdate AS udate FROM {{orders}}
				WHERE status!=\'done\' AND  status!=\'cancel\'
				ORDER BY cdate DESC
			)
			ORDER BY udate DESC
			LIMIT 0,10
		';
        $list = DB::getAll($sql);
        foreach ($list as $item) {
            if ($item['what'] == 'tree') {
                $data[] = Catalog::getOne($item['id']);
            } elseif ($item['what'] == 'orders') {
                $data[] = Orders::getOne($item['id']);
            }
        }
        return $data;
    }
Example #6
0
 public function __construct()
 {
     if ($_GET['ref']) {
         $sql = 'SELECT iuser FROM {{iusers_options}} WHERE selfcode=\'' . $_GET['ref'] . '\'';
         $iuser = DB::getOne($sql);
         if ($iuser) {
             $_SESSION['referal'] = $iuser;
         }
     }
     $sql = 'SELECT * FROM {{tree}} WHERE parent=410 AND visible=1 ORDER BY num';
     $list = DB::getAll($sql);
     foreach ($list as $item) {
         $fields = Fields::getFieldsByTree($item['id'], 'wide');
         $item['pic'] = $fields['files_gal']['image'][0]['path'];
         $multi = Fields::getMultiFields($item['id']);
         foreach ($multi['color'] as $row) {
             $item['list'][$row] = Funcs::$referenceId['color'][$row]['name'];
         }
         Run::$colors[$item['id']] = $item;
     }
     //print '<pre>';print_r(Run::$colors);die;
     $sql = 'SELECT * FROM {{tree}} WHERE id=1';
     $row = DB::getRow($sql);
     Run::$socTitle = $row['seo_title'];
     Run::$socDescription = $row['seo_description'];
 }
Example #7
0
 /**
  * Returns all messages in the given time frame between two parties.
  *
  * @return array Returns messages array
  * @author  
  */
 public function GetMsgs()
 {
     global $_;
     try {
         $sth = DB::prep("SELECT TIME_FORMAT(m1.time, '%k:%i') as time,IF(m1.type = 'admin', m3.username, m2.nick) as user_nick, m1.to_user as admin, m1.user as user_id, m1.type, m1.msg\r\n             FROM messaging AS m1 \r\n             LEFT JOIN messaging_users AS m2 ON m1.user = m2.user_id \r\n             LEFT JOIN messaging_admin m3 ON m1.to_user = m3.id \r\n             WHERE m1.user = :curr_user\r\n             ORDER BY m1.time");
         $sth->bindParam(":curr_user", $_SESSION['visitor_chat_user'], PDO::PARAM_INT);
         $result = DB::getAll($sth);
         foreach ($result as $key => $val) {
             $keys = $key ? $key - 1 : $key;
             $result[$key]['before'] = $result[$keys]['user_id'];
             $result[$key]['admin_before'] = $result[$keys]['admin'];
             $result[$key]['type_before'] = $result[$keys]['type'];
             $result[$key]['msg'] = $this->UploadReplace($val['msg']);
             $result[$key]['msg'] = $this->makeClickableLinks($result[$key]['msg']);
             $result[$key]['msg'] = nl2br($result[$key]['msg']);
             $smiley = new Smiley();
             $actions = $smiley->ListSmiley();
             foreach ($actions as $val) {
                 $search[] = $val->sign;
                 $replace[] = '<img src="' . $_['MAIN_FOLDER'] . '/admin/images/smiley/' . $val->filename . '" />';
             }
             $result[$key]['msg'] = str_replace($search, $replace, $result[$key]['msg']);
             $result[$key]['msg'] = stripslashes($result[$key]['msg']);
         }
         $_SESSION['msg_update'] = time();
         return $result;
     } catch (Exception $e) {
         die($e->getMessage());
     }
 }
 /**
  * Return a 2D associative arrary
  * 
  * The returned array will be based upon the sql specified by $sql. This is 
  * basically a wrapper for the 
  * {@link http://pear.php.net/manual/en/package.database.db.db-common.getall.php DB_common::getAll}
  * method of the Pear DB module.
  * 
  * @param string $sql The SQL code to be executed
  * @return array
  * 
  */
 public function getAll($sql, $data = array())
 {
     $result = $this->conn->getAll($sql, $data, DB_FETCHMODE_ASSOC);
     self::logQuery();
     if (DB::isError($result)) {
         throw new LoggedException($result->getMessage() . ". SQL: {$sql}", $result->getCode(), self::module);
     }
     return $result;
 }
Example #9
0
 /**
  * Returns an array of groups in the messaging_groups table
  *
  * @return Object-Array Object array of messaging_groups table
  * @author Gregor Kuplenik, gregor.kuplenik@insis.si
  */
 public static function ListGroups()
 {
     try {
         $sth = DB::prep("SELECT *, CONCAT(groups,'-',banned,'-',history) as perm FROM messaging_groups");
         return DB::getAll($sth, null, PDO::FETCH_OBJ);
     } catch (Exception $e) {
         die($e->getCode());
     }
 }
Example #10
0
 /**
  * List banned Ips
  *
  * @return Object-Array
  * @author  
  */
 public static function ListBanned()
 {
     try {
         $sth = DB::prep("SELECT id, INET_NTOA(ip) as ip, host FROM messaging_ban");
         return DB::getAll($sth, null, PDO::FETCH_OBJ);
     } catch (Exception $e) {
         Exceptions::PrintOut($e);
     }
 }
Example #11
0
 public static function getList($region)
 {
     if ($region) {
         $sql = 'SELECT * FROM {{terminals}} WHERE region=' . $region . '';
         return DB::getAll($sql);
     } else {
         return array();
     }
 }
Example #12
0
    public static function getLanguage()
    {
        $sql = '
			SELECT DISTINCT {{lang}}.* FROM {{lang}} 
			INNER JOIN {{sites}} ON {{lang}}.id={{sites}}.lang
			ORDER BY {{sites}}.id
		';
        return DB::getAll($sql);
    }
Example #13
0
    public function getList()
    {
        $start = microtime(true);
        $data = array('list' => array(), 'categories' => array());
        $parentIds = array();
        $sql = '
			SELECT DISTINCT {{catalog}}.*, {{tree}}.* FROM {{catalog}}
			INNER JOIN {{tree}} ON {{catalog}}.tree={{tree}}.id
			WHERE {{catalog}}.market=1 AND {{catalog}}.price>0 AND {{tree}}.visible=1 AND available=1
			ORDER BY num
		';
        //print DB::prefix($sql);
        $catalog = DB::getPagi($sql);
        $fields = Fields::getReserveFieldsByModulePath($tab);
        $k = 1;
        $date_b = explode('.', Funcs::$conf['akcia']['date_begin']);
        $date_e = explode('.', Funcs::$conf['akcia']['date_end']);
        $date_b = mktime(0, 0, 0, $date_b[1], $date_b[0], $date_b[2]);
        $date_e = mktime(23, 59, 59, $date_e[1], $date_e[0], $date_e[2]);
        $today = mktime();
        $yes = 0;
        if ($today >= $date_b && $today <= $date_e) {
            $yes = 1;
        }
        foreach ($catalog as $i => $model) {
            $akcia = '0';
            //if ($yes==1)
            //$akcia=$model['akcia'];
            $data['list'][] = array('id' => $model['id'], 'parent' => $model['parent'], 'fields' => Fields::getFieldsByTree($model['tree'], 'wide'), 'name' => Market::clearInfo($model['name']), 'path' => Catalog::getPathToTree($model['tree']), 'available' => $model['available'], 'bid' => $model['bid'], 'akcia' => $akcia, 'cbid' => $model['cbid'], 'typePrefix' => $model['typePrefix'], 'vendor' => Funcs::$referenceId['vendor'][$model['vendor']]['name'], 'yandex_description' => Market::clearInfo($model['yandex_description']), 'price' => $model['price'], 'local_delivery_cost' => $model['price'] < 4000 ? '200' : '0', 'manufacturer_warranty' => $model['manufacturer_warranty']);
            $parentIds[] = $model['parent'];
            $k++;
            //echo $k.' Время выполнения скрипта '.(microtime(true) - $start).'<br />';
        }
        $parentIds = array_unique($parentIds);
        if (count($parentIds) > 0) {
            $sql = '
				SELECT * FROM {{tree}} WHERE id IN (' . implode(',', $parentIds) . ')
			';
            $list = DB::getAll($sql);
            $parentIds = array();
            foreach ($list as $item) {
                $data['categories'][] = array('id' => $item['id'], 'parent' => $item['parent'], 'name' => $item['name']);
                $parentIds[] = $item['parent'];
            }
            if (count($parentIds) > 0) {
                $sql = '
					SELECT * FROM {{tree}} WHERE id IN (' . implode(',', $parentIds) . ')
				';
                $list = DB::getAll($sql);
                foreach ($list as $item) {
                    $data['categories'][] = array('id' => $item['id'], 'name' => $item['name']);
                }
            }
        }
        return $data;
    }
Example #14
0
    public static function getBalanceHistoryPage($id, $page, $count)
    {
        $sql = 'SELECT * 
			FROM {{dealers_balance}}
			WHERE `dealer` =\'' . $id . '\'
			ORDER BY `cdate` DESC
			LIMIT ' . $count * ($page - 1) . ', ' . $count . '						
			';
        return DB::getAll($sql);
    }
Example #15
0
 public static function ListSmiley()
 {
     try {
         $sth = DB::prep("SELECT * FROM messaging_smiley");
         $result = DB::getAll($sth, null, PDO::FETCH_OBJ);
         return $result;
     } catch (Exception $e) {
         die($e->getMessage());
     }
 }
Example #16
0
 public static function getCities($id)
 {
     $data = array();
     $sql = 'SELECT DISTINCT name FROM {{regions}} WHERE visible=1 AND parent=' . $id . ' ORDER BY name';
     $list = DB::getAll($sql);
     foreach ($list as $item2) {
         $data[] = array('name' => $item2['name']);
     }
     return $data;
 }
Example #17
0
 public static function getSql()
 {
     $data['tables'] = array();
     $sql = 'SHOW TABLES';
     $list = DB::getAll($sql);
     foreach ($list as $item) {
         $data['tables'][] = end($item);
     }
     return $data;
 }
Example #18
0
 public static function getVendorName()
 {
     $data = array();
     $sql = 'SELECT id, name FROM {{tree}} WHERE parent=8 AND visible=1';
     $list = DB::getAll($sql);
     foreach ($list as $item) {
         $data[$item['id']] = $item['name'];
     }
     return $data;
 }
Example #19
0
    function allSite()
    {
        $data = array();
        //if(Funcs::$uri[0]=='catalog'){
        $sql = 'SELECT * FROM {{tree}} WHERE parent=2 AND visible=1 AND path<>\'catalogopt\' ORDER BY num';
        $list = DB::getAll($sql);
        foreach ($list as $i => $item) {
            $sub = array();
            $path = '/catalog/' . $item['path'] . '/';
            $sql = '
					SELECT {{tree}}.* FROM {{tree}}
					INNER JOIN {{relations}} ON {{relations}}.id1={{tree}}.id
					WHERE {{tree}}.parent=' . $item['id'] . ' AND {{tree}}.visible=1 
						AND {{relations}}.modul1=\'tree\' AND modul2=\'struct_catalog\'
					 ORDER BY {{tree}}.num
				';
            $list2 = DB::getAll($sql);
            $selected = '';
            if (Funcs::$uri[0] == 'catalog' && Funcs::$uri[1] == $item['path'] && Funcs::$uri[2] == '') {
                $selected = 'selected';
            }
            foreach ($list2 as $item2) {
                $selected2 = '';
                if (Funcs::$uri[0] == 'catalog' && Funcs::$uri[1] == $item['path'] && Funcs::$uri[2] == $item2['path']) {
                    $selected2 = 'selected';
                }
                $sub[] = array('id' => $item2['id'], 'name' => $item2['name'], 'path' => $path . $item2['path'] . '/', 'selected' => $selected2);
            }
            $data[] = array('id' => $item['id'], 'name' => $item['name'], 'path' => $path, 'sub' => $sub, 'selected' => $selected);
        }
        /*}else{
        			$sql='SELECT * FROM {{tree}} WHERE parent=1 AND id<>2 AND visible=1 AND menu=1 ORDER BY num';
        			$list=DB::getAll($sql);
        			foreach($list as $i=>$item){
        				$sub=array();
        				$path='/'.$item['path'].'/';
        				$sql='SELECT * FROM {{tree}} WHERE parent='.$item['id'].' AND visible=1 AND path<>\'thanks\' ORDER BY num';
        				$list2=DB::getAll($sql);
        				foreach($list2 as $item2){
        					$sub[]=array(
        						'id'=>$item2['id'],
        						'name'=>$item2['name'],
        						'path'=>$path.$item2['path'].'/',
        					);
        				}
        				$data[$i%4][]=array(
        					'id'=>$item['id'],
        					'name'=>$item['name'],
        					'path'=>$path,
        					'sub'=>$sub
        				);
        			}
        		}*/
        return $data;
    }
Example #20
0
 /**
  * Fetches a list of available gateways.
  *
  * @return array  An array of the available gateways.
  */
 function getGateways()
 {
     /* Get the gateways. */
     $sql = 'SELECT * FROM swoosh_gateways';
     Horde::log('SQL Query by Hylax_Storage_sql::_getGateways(): ' . $sql, 'DEBUG');
     $result = $this->_db->getAll($sql, DB_FETCHMODE_ASSOC);
     if (is_a($result, 'PEAR_Error')) {
         Horde::log($result, 'ERR');
     }
     return $result;
 }
Example #21
0
 public static function getRSS()
 {
     $data = array();
     $id = Tree::getIdTreeByModule('news');
     $sql = 'SELECT * FROM {{tree}} WHERE parent=' . $id . ' AND visible=1 ORDER BY udate DESC LIMIT 0,10';
     $list = DB::getAll($sql);
     foreach ($list as $item) {
         $field = Fields::getFieldsByTree($item['id']);
         $data[] = array('id' => $item['id'], 'name' => trim(strip_tags($item['name'])), 'preview' => strip_tags($field['preview']), 'path' => 'http:://' . $_SERVER['HTTP_HOST'] . '/about/news/' . $item['id'] . '/', 'udate' => date("D, d M Y H:i:s O", strtotime($item['udate'])));
     }
     return array('list' => $data);
 }
Example #22
0
    public function getinfoblock()
    {
        $data = array();
        $sql = '
			SELECT * FROM {{infoblock}} 
			WHERE parent=0 ORDER BY num
		';
        $list = DB::getAll($sql);
        foreach ($list as $item) {
            $data[] = array('name' => $item['name'], 'path' => '/' . Funcs::$cdir . '/infoblock/' . $item['id'] . '/', 'selected' => '/infoblock/' . $item['id'] . '/' == '/' . Funcs::$uri[1] . '/' . Funcs::$uri[2] . '/' ? 'selected' : '');
        }
        return $data;
    }
Example #23
0
    public static function getOne($id)
    {
        $sql = '
			SELECT {{dealers_stores}}.*, {{dealers_status}}.name as statusname
			FROM {{dealers_stores}}
			LEFT JOIN {{dealers_status}} ON {{dealers_stores}}.status = {{dealers_status}}.id
			WHERE {{dealers_stores}}.id=' . $id . '
		';
        $data = DB::getRow($sql);
        $sql = 'SELECT * FROM {{dealers_files}} WHERE store=' . $data['id'] . '';
        $files = DB::getAll($sql);
        $data['files'] = $files;
        return $data;
    }
Example #24
0
 public static function getList($only_active = false)
 {
     static $result;
     if (!empty($result)) {
         return $result;
     }
     $stmt = "SELECT\n                    hos.host_id,\n                    hos.host_name,\n                    hos.ip_address,\n                    cre.username\n                 FROM\n                    hosts hos\n                 LEFT JOIN \n                    credentials cre\n                 ON\n                    hos.credential_id = cre.credential_id \n                 WHERE\n                    hos.deleted = 0 ";
     // Before the correction, $only_active ALWAYS was equal to false,
     // because in the index.html never sent it with the GET method
     if (filter_var($only_active, FILTER_VALIDATE_BOOLEAN) === true) {
         $stmt .= " AND hos.active = 1";
     }
     $result = DB::getAll($stmt);
     return $result;
 }
Example #25
0
 /**
  * Returns all attributes for a given id or multiple ids.
  *
  * @param integer | array $id  The id to fetch or an array of ids.
  *
  * @return array  A hash of attributes, or a multi-level hash
  *                of ids => their attributes.
  */
 function getAttributes($id)
 {
     if (is_array($id)) {
         $query = sprintf('SELECT %1$s, attribute_name as name, attribute_key as "key", attribute_value as value FROM %2$s WHERE %1$s IN (%3$s)', $this->_params['id_column'], $this->_params['attribute_table'], implode(', ', $id));
         Horde::log('SQL Query by Hylax_SQL_Attributes::getAttributes(): ' . $query, 'DEBUG');
         $rows = $this->_db->getAll($query, DB_FETCHMODE_ASSOC);
         if (is_a($rows, 'PEAR_Error')) {
             return $rows;
         }
         $id_column = $this->_params['id_column'];
         $data = array();
         foreach ($rows as $row) {
             if (empty($data[$row[$id_column]])) {
                 $data[$row[$id_column]] = array();
             }
             $data[$row[$id_column]][] = array('name' => $row['name'], 'key' => $row['key'], 'value' => $row['value']);
         }
         return $data;
     } else {
         $query = sprintf('SELECT %1$s, attribute_name as name, attribute_key as "key", attribute_value as value FROM %2$s WHERE %1$s = %3$s', $this->_params['id_column'], $this->_params['attribute_table'], (int) $id);
         Horde::log('SQL Query by Hylax_SQL_Attributes::getAttributes(): ' . $query, 'DEBUG');
         return $this->_db->getAll($query, DB_FETCHMODE_ASSOC);
     }
 }
Example #26
0
 /**
  * Returns array of users currently online
  *
  * @return array User array
  * @author  
  */
 function Get()
 {
     global $_;
     try {
         $sth = DB::prep("SELECT g1.user_id,g1.nick as user_nick,g1.upload as upload, UNIX_TIMESTAMP(g2.time) as time\r\nFROM messaging_users g1\r\nLEFT JOIN\r\n(SELECT user,time FROM messaging WHERE type = 'user' ORDER BY id DESC) as g2 ON g1.user_id = g2.user\r\n GROUP BY g1.user_id ORDER BY g2.time DESC");
         $result = DB::getAll($sth);
         foreach ($result as $key => $value) {
             $_SESSION['msg_admin_update_' . $value['user_id']] = isset($_SESSION['msg_admin_update_' . $value['user_id']]) ? $_SESSION['msg_admin_update_' . $value['user_id']] : time();
             $result[$key]['new_msg'] = $result[$key]['time'] > $_SESSION['msg_admin_update_' . $value['user_id']] ? 1 : 0;
         }
         return $result;
     } catch (Exception $e) {
         die($e->getMessage());
     }
 }
Example #27
0
    function getSales()
    {
        $data = array();
        $sql = '
			SELECT {{catalog}}.tree FROM {{catalog}}
			INNER JOIN {{tree}} ON {{catalog}}.tree={{tree}}.id
			WHERE visible=1 AND {{catalog}}.price<{{catalog}}.oldprice
			ORDER BY RAND()	LIMIT 0,2
		';
        $list = DB::getAll($sql, 'tree');
        foreach ($list as $item) {
            $data[] = Catalog::getOne($item);
        }
        return $data;
    }
Example #28
0
 public static function getList($only_active = false)
 {
     static $result;
     if (!empty($result)) {
         return $result;
     }
     //Defect discovery and solution one:
     //to allow to show hosts with no user and credential must be changed
     //the sql instruction to left join
     $stmt = "SELECT\n                    hos.host_id,\n                    hos.host_name,\n                    hos.ip_address,\n                    cre.username\n                 FROM\n                    hosts hos left join\n                    credentials cre\n                    on hos.credential_id = cre.credential_id\n                 WHERE\n                    hos.deleted       = 0";
     if ($only_active === true) {
         $stmt .= " AND hos.active = 1";
     }
     $result = DB::getAll($stmt);
     return $result;
 }
Example #29
0
 function catalogOne($from, $to)
 {
     $data = array();
     $i = 0;
     $sql = 'SELECT * FROM model WHERE parent=\'' . $from . '\'';
     $items = DB::getAll($sql);
     foreach ($items as $item) {
         if (!$temp) {
             $data = array('parent' => $to, 'name' => $item['name'], 'seo_title' => $item['title'] == '' ? $item['name'] : $item['title'], 'seo_keywords' => $item['kw'] == '' ? $item['name'] : $item['kw'], 'seo_description' => $item['descr'] == '' ? $item['name'] : $item['descr'], 'description' => $item['small_descr'], 'fulltext' => $item['full_descr'], 'model' => $item['model'], 'market' => $item['market'], 'price' => $item['price'], 'visible' => $item['visible'], 'available' => $item['sale'], 'udate' => date('Y-m-d H:i'), 'path' => Funcs::Transliterate($item['name']), 'oldid' => $item['ID']);
             $id = site::setPage($data, $i);
             $i++;
         }
     }
     //print '<pre>';
     //print_r($data);
 }
Example #30
-1
 public static function export($author)
 {
     $sql = 'SELECT * FROM {{iusers}} WHERE author=' . $author . ' ORDER BY code';
     $list = DB::getAll($sql);
     header('Content-Type: text/html; charset=utf-8');
     header('P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"');
     header('Cache-Control: no-store, no-cache, must-revalidate');
     header('Cache-Control: post-check=0, pre-check=0', FALSE);
     header('Pragma: no-cache');
     header('Content-transfer-encoding: binary');
     header('Content-Disposition: attachment; filename=export.xls');
     header('Content-Type: application/octet-stream');
     $objPHPExcel = new PHPExcel();
     $objPHPExcel->getProperties()->setCreator("")->setLastModifiedBy("")->setTitle("Office 2007 XLSX")->setSubject("Office 2007 XLSX")->setDescription("Document for Office 2007 XLSX, generated using PHP classes.")->setKeywords("office 2007 openxml php")->setCategory("GBROS file");
     $sheet = $objPHPExcel->setActiveSheetIndex(0);
     $sheet->setCellValue('A1', 'ID');
     $sheet->setCellValue('B1', 'Имя');
     $sheet->setCellValue('C1', 'Баланс, руб.');
     $sheet->getColumnDimension('A')->setAutoSize(true);
     $sheet->getColumnDimension('B')->setAutoSize(true);
     $sheet->getColumnDimension('C')->setAutoSize(true);
     foreach ($list as $i => $item) {
         $sheet->setCellValue('A' . ($i + 2), $item['code']);
         $sheet->setCellValue('B' . ($i + 2), $item['name']);
         $sheet->setCellValue('C' . ($i + 2), $item['balance']);
         $objPHPExcel->getActiveSheet()->getStyle('A' . ($i + 1))->getAlignment()->setWrapText(true);
         $objPHPExcel->getActiveSheet()->getStyle('B' . ($i + 1))->getAlignment()->setWrapText(true);
         $objPHPExcel->getActiveSheet()->getStyle('C' . ($i + 1))->getAlignment()->setWrapText(true);
     }
     $objPHPExcel->getActiveSheet()->setTitle('Лист 1');
     $objPHPExcel->setActiveSheetIndex(0);
     $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
     $objWriter->save('php://output');
 }