Commit 535db0dd authored by Raphael Wintrich's avatar Raphael Wintrich

hello foodsharing.de

parents

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

<?xml version="1.0" encoding="UTF-8"?>
<buildpath>
<buildpathentry kind="src" path=""/>
<buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>
</buildpath>
**/data/
/data/logg.txt
**/menus/
**/images/
#RewriteEngine on
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^([^?]*)$ /index.php?g_path=$1 [NC,L,QSA]
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>foodsharing</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.dltk.core.scriptbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.php.core.PHPNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
include_path=0;/foodsharing
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="php.component"/>
<fixed facet="php.core.component"/>
<installed facet="php.core.component" version="1"/>
<installed facet="php.component" version="5.4"/>
</faceted-project>
<?php
class ApiControl extends Control
{
public function __construct()
{
$this->model = new ApiModel();
$this->view = new ApiView();
parent::__construct();
}
public function index()
{
}
}
\ No newline at end of file
<?php
class ApiModel extends Model
{
public function getOrgaGroups()
{
return $this->q('SELECT id, name, parent_id FROM '.PREFIX.'bezirk WHERE type = 7 ORDER BY parent_id');
}
public function getMumbleUsers()
{
return $this->q('SELECT foodsaver_id, `name`, `sha` FROM '.PREFIX.'mumbleuser');
}
public function chatHistory($id)
{
return $this->q('
SELECT
fs.name AS `n`,
c.msg AS `m`,
UNIX_TIMESTAMP(c.time) AS t,
fs.photo AS p
FROM
fs_message c,
fs_foodsaver fs
WHERE
c.sender_id = fs.id
AND
(
( c.sender_id = '.(int)$id.'
AND
c.recip_id = '.(int)fsId().'
)
OR
(
c.sender_id = '.(int)fsId().'
AND
c.recip_id = '.(int)$id.'
)
)
ORDER BY c.`time` DESC
LIMIT 20');
}
public function allBaskets()
{
return $this->q('
SELECT
b.id AS i,
b.lat AS a,
b.lon AS o
FROM
fs_basket b
WHERE
b.status = 1
AND
b.fs_id = 0
');
}
public function nearBaskets($lat,$lon,$distance = 50)
{
return $this->q('
SELECT
b.id AS i,
b.lat AS a,
b.lon AS o,
(6371 * acos( cos( radians( '.$this->floatval($lat).' ) ) * cos( radians( b.lat ) ) * cos( radians( b.lon ) - radians( '.$this->floatval($lon).' ) ) + sin( radians( '.$this->floatval($lat).' ) ) * sin( radians( b.lat ) ) ))
AS d
FROM
fs_basket b
WHERE
b.status = 1
AND
b.fs_id = 0
HAVING
d <='.(int)$distance.'
');
}
public function setiosid($regid)
{
return $this->update('
UPDATE
'.PREFIX.'foodsaver
SET
`iosid` = '.$this->strval($regid).',
`last_mid` = NOW()
WHERE
`id` = '.(int)fsId().'
');
}
public function setgcm($regid)
{
return $this->update('
UPDATE
'.PREFIX.'foodsaver
SET
`gcm` = '.$this->strval($regid).',
`last_mid` = NOW()
WHERE
`id` = '.(int)fsId().'
');
}
public function getBasket($id)
{
$basket = $this->qRow('
SELECT
b.id,
b.description,
b.picture,
b.contact_type,
b.tel,
b.handy,
b.fs_id AS fsf_id,
b.foodsaver_id,
b.lat,
b.lon
FROM
'.PREFIX.'basket b
WHERE
b.id = '.(int)$id.'
');
if($basket['fsf_id'] == 0)
{
if($fs = $this->qRow('
SELECT
fs.name AS fs_name,
fs.photo AS fs_photo,
fs.id AS fs_id
FROM
'.PREFIX.'foodsaver fs
WHERE
fs.id = '.(int)$basket['foodsaver_id'].'
'))
{
$basket = array_merge($basket,$fs);
}
}
return $basket;
}
}
\ No newline at end of file
<?php
class ApiView extends View
{
}
\ No newline at end of file