CakePHP not reading URL parameters correctly - url

I have a link on a view like this
Save Playlist
However, when it is clicked I am redirected to
/playlists/add/video[]=0&video[]=4&video[]=1
and the output of $this->params['url'] is
Array ( [url] => playlists/add/video[]=0 [video] => Array ( [0] => 4 [1] => 1 ) )
instead of
Array ( [url] => playlists/add/ [video] => Array ( [0] => 0 [1] => 4 [2] => 1 ) )
I can't work out why the firs parameter is always read as part of the url, nor why the leading ? is removed

Try playlists/add?video -> playlists/add/?video
Or just write properly formatted URLs like
$this->Html->link('Save Playlist', array('controller' => 'playlists', 'action' => 'add', 'values[0]'=>3, 'values[1]'=>2, 'values[2]'=>23)); ?>

Related

Search list result null prevPageToken

I'm trying to get videos from my channel using search function. Response include only nextPageToken, but no prevPageToken. prevPageToken is null always, even if I'm listing other pages using nextPageToken. I use an access_token param from Google Oauth.
My request:
$searchResponse = $youtube->search->listSearch('snippet', array(
'forMine' => 'true',
'order' => 'date',
'pageToken' => $pageToken,
'type'=>'video',
'maxResults' => '10',
'q' => $searchQuery,
));
Result:
Google_Service_YouTube_SearchListResponse Object
(
[collection_key:protected] => items
[etag] => "XXX"
[eventId] =>
[itemsType:protected] => Google_Service_YouTube_SearchResult
[itemsDataType:protected] => array
[kind] => youtube#searchListResponse
[nextPageToken] => Cib3-ZrgSf____9uWHdEYVNIVnlOVQD_Af_-blh3RGFTSFZ5TlUAARAPIbmtEhE6-iWlOQAAAAC2H2UGSAFQAFoLCdIYcGeU2-YsEAJgyOjNygE=
[pageInfoType:protected] => Google_Service_YouTube_PageInfo
[pageInfoDataType:protected] =>
[prevPageToken] =>
[regionCode] =>
[tokenPaginationType:protected] => Google_Service_YouTube_TokenPagination
[tokenPaginationDataType:protected] =>
[visitorId] =>
[internal_gapi_mappings:protected] => Array
(
)
[modelData:protected] => Array
(
)
[processed:protected] => Array
(
)
[pageInfo] => Google_Service_YouTube_PageInfo Object
(
[resultsPerPage] => 5
[totalResults] => 55
[internal_gapi_mappings:protected] => Array
(
)
[modelData:protected] => Array
(
)
[processed:protected] => Array
(
)
)
Thank you for your ideas!
Petr
UPDATE
This problem is only if is set param forMine. But I need show only my videos...

'Serialization of 'SimpleXMLElement' is not allowed'

I've changed around the path structure for HybridAuth quite a bit, all of the HybridAuth files are in a login directory.
require_once('login/Auth.php');
$auth = new Hybrid_Auth(self::$settings['auth']);
Where self::$settings['auth'] is this json file
{
"debug": 1,
"database": {
"driver": "mysql",
"host": "localhost",
"port": 3306,
"name": "ws_db",
"username": "root",
"password": "",
"charset": "utf8"
},
"auth": {
"base_url": "http://localhost/login/process",
"providers": {
"Twitter": {
"enabled": true
},
"Google": {
"enabled": true,
"keys": {
"id": "",
"secret": ""
}
},
"Facebook": {
"enabled": true,
"keys": {
"id": "",
"secret": ""
},
"trustForwarded": false
},
"Steam": {
"enabled": true
}
},
"debug_mode": true,
"debug_file": "auth.txt"
}
}
I have not yet acquired keys for the providers I intended to use (is that possibly why this is happening?). I tried to login with Steam to test that it was working since it was the only provider that didn't require me to get keys.
$_SESSION['user'] = $auth->authenticate('Steam');
I was correctly redirected to a Steam login page however upon clicking Login I received the above error.
Fatal error: Uncaught exception 'Exception' with message 'Serialization of 'SimpleXMLElement' is not allowed' in login\Auth.php:153 Stack trace: #0 login\Auth.php(39): Hybrid_Auth::initialize(Array) #1 index.php(83): Hybrid_Auth->__construct(Array) #2 index.php(6): Site::main() #3 {main} thrown in login\Auth.php on line 153
I thought it possibly had something to do with this line:
Hybrid_Logger::debug( "Hybrid_Auth initialize. dump used config: ", serialize( $config ) );
because that is the only line that I see serializing something but commenting that out didn't seem to work. Line 83 in my index.php is the initialization of Hybrid_Auth.
$auth = new Hybrid_Auth(self::$settings['auth']);
I can't seem to figure out what is going wrong with this though. Since that line of code is run when attempting to login and only causes a problem when returning from the Steam authorization page.
Here is the information that was output into auth.txt, I removed some information.
(
[message:protected] => Serialization of 'SimpleXMLElement' is not allowed
[string:Exception:private] =>
[code:protected] => 0
[file:protected] => login\Storage.php
[line:protected] => 73
[trace:Exception:private] => Array
(
[0] => Array
(
[file] => login\Storage.php
[line] => 73
[function] => serialize
[args] => Array
(
[0] => Hybrid_User Object
(
[providerId] => Steam
[timestamp] => 1431707732
[profile] => Hybrid_User_Profile Object
(
[identifier] => ***************
[webSiteURL] =>
[profileURL] => http://steamcommunity.com/id/******/
[photoURL] =>
[displayName] => Renari
[description] => <span>profile information was here</span>
[firstName] => SimpleXMLElement Object
(
[0] => SimpleXMLElement Object
(
)
)
[lastName] =>
[gender] =>
[language] =>
[age] =>
[birthDay] =>
[birthMonth] =>
[birthYear] =>
[email] =>
[emailVerified] =>
[phone] =>
[address] =>
[country] =>
[region] => location information was here
[city] =>
[zip] =>
)
)
)
)
[1] => Array
(
[file] => login\Providers\Steam.php
[line] => 37
[function] => set
[class] => Hybrid_Storage
[type] => ->
[args] => Array
(
[0] => hauth_session.Steam.user
[1] => Hybrid_User Object
(
[providerId] => Steam
[timestamp] => 1431707732
[profile] => Hybrid_User_Profile Object
(
[identifier] => ***************
[webSiteURL] =>
[profileURL] => http://steamcommunity.com/id/******/
[photoURL] =>
[displayName] => ******
[description] => <span>profile information was here</span>
[firstName] => SimpleXMLElement Object
(
[0] => SimpleXMLElement Object
(
)
)
[lastName] =>
[gender] =>
[language] =>
[age] =>
[birthDay] =>
[birthMonth] =>
[birthYear] =>
[email] =>
[emailVerified] =>
[phone] =>
[address] =>
[country] =>
[region] => location information was here
[city] =>
[zip] =>
)
)
)
)
[2] => Array
(
[file] => login\Endpoint.php
[line] => 182
[function] => loginFinish
[class] => Hybrid_Providers_Steam
[type] => ->
[args] => Array
(
)
)
[3] => Array
(
[file] => login\Endpoint.php
[line] => 55
[function] => processAuthDone
[class] => Hybrid_Endpoint
[type] => ->
[args] => Array
(
)
)
[4] => Array
(
[file] => login\Endpoint.php
[line] => 71
[function] => __construct
[class] => Hybrid_Endpoint
[type] => ->
[args] => Array
(
[0] =>
)
)
[5] => Array
(
[file] => index.php
[line] => 90
[function] => process
[class] => Hybrid_Endpoint
[type] => ::
[args] => Array
(
)
)
[6] => Array
(
[file] => index.php
[line] => 6
[function] => main
[class] => Site
[type] => ::
[args] => Array
(
)
)
)
[previous:Exception:private] =>
)
This was an issue with the Steam provider and was fixed in a commit you can download the fixed steam provider from the github repo.

Highcharts no display even when there's data

As you can see the chart displays with yaxis and axis but the value for xaxis is not shown. My data looks like this,
Array
(
[series] => Array
(
[0] => Array
(
[answer_option_group_id] => 0
[name] => All
[data] => Array
(
[999] => 1
[172] => 1
[173] => 0
[174] => 77
[194] => 6
)
)
[174] => Array
(
[answer_option_group_id] => 174
[name] => Does Not Meet
[data] => Array
(
[1459dcb35a7888ab4ff3dd89c07d679e] => 7
[c424759c02fd0900e3ec7c58c745138c] => 1
[e789fa7486d59950d382b8c395de166a] => 2
[b6c632c0a07b9feaa1eefe547a1a6aa8] => 4
[2ecfa0fc3d3990a2ff30009bea9b8ae0] => 2
[b6a52c346ad6a9f4cc58ddfe3c83939e] => 8
[36894aa1fcc16e360813d1ef430bb8fa] => 6
[4284ce3f8523823a457602fe5997fcfa] => 5
[e45e137a7da3e3fe5dc3785d7d628e44] => 11
[fb9bd545acc9397e0c84a8ff5d1a3b92] => 3
[1bcace373da4bb1e821158e3a5fa80a4] => 7
[88928dea322b243c18082e23aa9bc7a4] => 1
[2e9cf454d6eb69e69e744fcc15287f49] => 3
[eaa42f3a7bf5e5f2ac3198d5f8d487a4] => 3
[690463148302dc63a0dfd327ab5253f9] => 1
[325795fe2d5f5a22136b2362ee863be4] => 4
[18bb150bdbf978e058b44ba52d836591] => 1
[418702f6d334d6531e9ac4883a690adb] => 7
[c1ebb58ebb59c5bc6bb87a567c763cfe] => 1
)
)
)
)
I used console.log() to check if I got the data right and the result looked like this,
["All", "Does Not Meet"]
[85, 77]
I tried this on having a jsfiddle and it worked but on my server it didn't. I also dont think this is about the including of scripts since it already displays the chart only that the values are not shown. Any help would be appreciated. Thanks.

how to get value from wsdl returned data in PHP?

Below is the data I'm getting from wsdl response... I need to get the separate value for example how to get the firstname from this array...Please anyone help me...
GetReportResponse Object ( [GetReportResult] => MBPeopleSearchRs_Type Object ( [MsgRsHdr] => MsgRsHdr_Type Object ( [RqUID] => {4DB2AD23-228A-465F-938D-BE072CED61C4} [Status] => Status_Type Object ( [StatusCode] => 0 [ServerStatusCode] => [Severity] => Info [StatusDesc] => OK [AdditionalStatus] => ) ) [Subject] => Subject Object ( [RefNum] => [PersonInfo] => PersonInfo_Type Object ( [PersonName] => PersonName_Type Object ( [LastName] => JANARDHANAN [FirstName] => SENTHINBABU [FullName] => [MiddleName] => [TitlePrefix] => [NameSuffix] => [Nickname] => [LegalName] => [MaidenName] => [OfficialTitle] => [Source] => MB [EffDt] => 2013-05-24 ) [ContactInfo] => ContactInfo_Type Object ( [ContactPref] => [PhoneNum] => [ContactName] => [EmailAddr] => [URL] => [PostAddr] => PostAddr_Type Object ( [PreDirection] => [Addr2] => [PostDirection] => N [Addr3] => [StreetType] => AVE [Addr4] => [StreetName] => LEXINGTON [Apt] => APT 4203 [StreetNum] => 4150 [Addr1] => [City] => SAINT PAUL [StateProv] => MN [PostalCode] => 55126-6131 [County] => RAMSEY
I suggest using a framework for this. CXF is a good choice if you write Java.
http://cxf.apache.org/
edit: since you work with php, take a look here: PHP SOAP client Tutorial/Recommendation?

composer autoload not working on production server

I've setup a project localy using composer to autoload my vendors and modules.
This is done on a Windows XP machine running Nginx.
When I sync everything to my production server, running LAMP, the autoloader stops working and every class i call its not found.
Since this is a shared host i cant run composer.phar update to try to refresh the classmap namespace.
Anyone knows what might be happening?
+INFO:
<?php
// autoload_namespaces.php generated by Composer
$vendorDir = dirname(__DIR__);
$baseDir = dirname(dirname($vendorDir));
return array(
'Zend\\' => $vendorDir . '/zendframework/zendframework/library/',
'ZendTest\\' => $vendorDir . '/zendframework/zendframework/tests/',
'Symfony\\Component\\Console' => $vendorDir . '/symfony/console/',
'Doctrine\\ORM' => $vendorDir . '/doctrine/orm/lib/',
'Doctrine\\DBAL' => $vendorDir . '/doctrine/dbal/lib/',
'Doctrine\\Common' => $vendorDir . '/doctrine/common/lib/',
'DoctrineORMModule\\' => $vendorDir . '/doctrine/doctrine-orm-module/src/',
'DoctrineORMModuleTest\\' => $vendorDir . '/doctrine/doctrine-orm-module/tests/',
'DoctrineModule\\' => $vendorDir . '/doctrine/doctrine-module/src/',
'DoctrineModuleTest\\' => $vendorDir . '/doctrine/doctrine-module/tests/',
'Application\\' => $baseDir . '/module/Application/src',
);
<?php
// autoload_classmap.php generated by Composer
$vendorDir = dirname(__DIR__);
$baseDir = dirname(dirname($vendorDir));
return array(
);
$loader returned:
Composer\Autoload\ClassLoader Object
(
[prefixes:Composer\Autoload\ClassLoader:private] => Array
(
[Zend\] => Array
(
[0] => /home/XXXX/public_html/vendor/zendframework/zendframework/library/
)
[ZendTest\] => Array
(
[0] => /home/XXXX/public_html/vendor/zendframework/zendframework/tests/
)
[Symfony\Component\Console] => Array
(
[0] => /home/XXXX/public_html/vendor/symfony/console/
)
[Doctrine\ORM] => Array
(
[0] => /home/XXXX/public_html/vendor/doctrine/orm/lib/
)
[Doctrine\DBAL] => Array
(
[0] => /home/XXXX/public_html/vendor/doctrine/dbal/lib/
)
[Doctrine\Common] => Array
(
[0] => /home/XXXX/public_html/vendor/doctrine/common/lib/
)
[DoctrineORMModule\] => Array
(
[0] => /home/XXXX/public_html/vendor/doctrine/doctrine-orm-module/src/
)
[DoctrineORMModuleTest\] => Array
(
[0] => /home/XXXX/public_html/vendor/doctrine/doctrine-orm-module/tests/
)
[DoctrineModule\] => Array
(
[0] => /home/XXXX/public_html/vendor/doctrine/doctrine-module/src/
)
[DoctrineModuleTest\] => Array
(
[0] => /home/XXXX/public_html/vendor/doctrine/doctrine-module/tests/
)
[Application\] => Array
(
[0] => /home/XXXX/public_html/module/Application/src
)
)
[fallbackDirs:Composer\Autoload\ClassLoader:private] => Array
(
)
[useIncludePath:Composer\Autoload\ClassLoader:private] =>
[classMap:Composer\Autoload\ClassLoader:private] => Array
(
)
)
++INFO:
spl_autoload_functions:
Array
(
[0] => Array
(
[0] => Composer\Autoload\ClassLoader Object
(
[prefixes:Composer\Autoload\ClassLoader:private] => Array
(
[Zend\] => Array
(
[0] => /home/XXXX/public_html/vendor/zendframework/zendframework/library/
)
[ZendTest\] => Array
(
[0] => /home/XXXX/public_html/vendor/zendframework/zendframework/tests/
)
[Symfony\Component\Console] => Array
(
[0] => /home/XXXX/public_html/vendor/symfony/console/
)
[Doctrine\ORM] => Array
(
[0] => /home/XXXX/public_html/vendor/doctrine/orm/lib/
)
[Doctrine\DBAL] => Array
(
[0] => /home/XXXX/public_html/vendor/doctrine/dbal/lib/
)
[Doctrine\Common] => Array
(
[0] => /home/XXXX/public_html/vendor/doctrine/common/lib/
)
[DoctrineORMModule\] => Array
(
[0] => /home/XXXX/public_html/vendor/doctrine/doctrine-orm-module/src/
)
[DoctrineORMModuleTest\] => Array
(
[0] => /home/XXXX/public_html/vendor/doctrine/doctrine-orm-module/tests/
)
[DoctrineModule\] => Array
(
[0] => /home/XXXX/public_html/vendor/doctrine/doctrine-module/src/
)
[DoctrineModuleTest\] => Array
(
[0] => /home/XXXX/public_html/vendor/doctrine/doctrine-module/tests/
)
[Application\] => Array
(
[0] => /home/XXXX/public_html/module/Application/src
)
)
[fallbackDirs:Composer\Autoload\ClassLoader:private] => Array
(
)
[useIncludePath:Composer\Autoload\ClassLoader:private] =>
[classMap:Composer\Autoload\ClassLoader:private] => Array
(
)
)
[1] => loadClass
)
)
The solutions was str replacing all the \ from the namespaces with / in all the modules autoloaders.
So,this:
public function getAutoloaderConfig() {
return array(
'Zend\Loader\StandardAutoloader' => array(
'namespaces' => array(
__NAMESPACE__ => __DIR__ . '/src/' . str_replace('\\', '/', __NAMESPACE__),
),
),
);
}
will get everything working as intended on a LAMP machine.

Resources