This commit is contained in:
Romain Neutron
2012-01-25 18:45:28 +01:00
parent 4a65e2af8a
commit fc1a0abb19
9 changed files with 375 additions and 488 deletions

View File

@@ -74,7 +74,6 @@ return call_user_func(
{
/* @var $twig \Twig_Environment */
$twig = $app['Core']->getTwig();
// var_dump($twig->getLoader()->getPaths());
$browser = \Browser::getInstance();
if (!$browser->isMobile())

View File

@@ -2,7 +2,16 @@
class geonames
{
protected static $NamesFromId = array();
protected static $CountryFromId = array();
protected static $CountryCodeFromId = array();
protected static $GeonameFromIp = array();
protected static $Searches = array();
public function name_from_id($geonameid)
{
$registry = registry::get_instance();

View File

@@ -25,26 +25,37 @@ class http_query
*/
public static function getHttpCodeFromUrl($url)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_HEADER, true);
if (!is_scalar($url))
return null;
curl_exec($ch);
$result = (int) curl_getinfo($ch, CURLINFO_HTTP_CODE);
if (trim($url) === '')
return null;
curl_close($ch);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_HEADER, true);
return $result;
curl_exec($ch);
$result = (int) curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
return $result;
}
public static function getHttpHeaders($url)
{
if (!is_scalar($url))
return null;
if (trim($url) === '')
return null;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
@@ -69,24 +80,30 @@ class http_query
* @param array $post_data
* @return string
*/
public static function getUrl($url, $post_data=false)
public static function getUrl($url, $post_data = false)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
if (!is_scalar($url))
return null;
if ($post_data)
{
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
}
if (trim($url) === '')
return null;
$result = (curl_exec($ch));
curl_close($ch);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
if ($post_data)
{
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
}
$result = (curl_exec($ch));
curl_close($ch);
return $result;
}

View File

@@ -70,7 +70,6 @@ class module_report_sqldownload extends module_report_sql implements module_repo
$this->sql .= $this->filter->getOrderFilter() ? : '';
// var_dump(str_replace(array_keys($this->params), array_values($this->params), $this->sql), $this->sql, $this->params);
$stmt = $this->connbas->prepare($this->sql);
$stmt->execute($this->params);
$this->total_row = $stmt->rowCount();

View File

@@ -1056,7 +1056,6 @@ class system_file extends SplFileObject
{
$value = $base64_encoded ? base64_decode($li->item($ili)->nodeValue) : $li->item($ili)->nodeValue;
$utf8value = trim($this->guessCharset($value));
var_dump($utf8value);
$tfields[$src][] = $utf8value;
}
}
@@ -1132,12 +1131,15 @@ class system_file extends SplFileObject
$tmpval[] = $val;
}
foreach ($tmpval as $val)
{
$ret[] = array(
'meta_struct_id' => $meta->get_id(),
'meta_id' => null,
'value' => $tmpval
'value' => $val
);
}
}
$statBit = null;

View File

@@ -1154,7 +1154,6 @@ class ApiYamlApplication extends PhraseanetWebTestCaseAbstract
*
* @todo
*/
// var_dump($record["technical_informations"]);
$this->assertTrue(is_array($record["technical_informations"]));

View File

@@ -38,8 +38,7 @@ class Bridge_AccountSettingsTest extends PhraseanetPHPUnitAuthenticatedAbstract
}
catch (Exception $e)
{
var_dump($e->getMessage());
$this->fail();
$this->fail($e->getMessage());
}
}

View File

@@ -108,17 +108,6 @@ class EntityBasketTest extends PhraseanetPHPUnitAuthenticatedAbstract
$date = $this->basket->getUpdated();
$this->assertInstanceOf('\DateTime', $date);
// sleep(5);
// $this->basket->setName('hello COCOCOCO');
// $this->basket->setDescription('44WDFDFOLSDF');
// $this->em->persist($this->basket);
// $this->em->flush();
// var_dump($this->basket->getId());
// $basket = $this->em->getRepository('\Entities\Basket')->find($this->basket->getId());
// $dateUpdated = $basket->getUpdated();
// var_dump($date->format(DATE_ATOM), $dateUpdated->format(DATE_ATOM));
// $this->assertGreaterThan($dateUpdated, $date);
// $this->assertGreaterThan($dateUpdated, $this->basket->getCreated());
}
public function testGetElements()