Cannot declare phptemplate_settings() - Drupal error when trying to configure template - php

There are two templates, whitejazz and a modified whitejazz (forumwhitejazz) - both are enabled.
I'm trying to configure the modified whitejazz, and I am getting this error - what does it mean?
Should I post anything else to help deduce this? I'm utterly stumped - my googling of this issue has not given me any solid leads.
This is in Drupal 6.25
Fatal error: Cannot redeclare phptemplate_settings() (previously declared in /home/domain/public_html/drupal-6.25/sites/all/themes/whitejazz/theme-settings.php:3) in /home/domain/public_html/drupal-6.25/sites/all/themes/forumwhitejazz/theme-settings.php on line 135

The problem is that function phptemplate_settings() was defined twice. This goes to fatal php error.
What I suggest to do is:
Create file theme-setting.php in root folder of forumwhitejazz template
There define function as in example and put there code settings.
Example:
function forumwhitejazz_settings($saved_settings) {
$form = array();
$form['forumwhitejazz_example'] = array(
'#type' => 'checkbox',
'#title' => t('Use this sample setting'),
'#default_value' => $saved_settings['forumwhitejazz_example'],
'#description' => t("This option doesn't do anything; it's just an example."),
);
return $form;
}

Related

Wordpress Plugin in error for user Pro

Hey can anyone explain to me why I get this error when I try to save the registration form.
Fatal error: Cannot unset string offsets in /home/wolf/public_html/wp-content/plugins/userpro/admin/admin-functions.php on line 252
Here is the line in question for the php.
/** List all groups **/
function userpro_admin_list_groups(){
global $userpro;
$output = null;
$groups = $userpro->groups;
unset($groups['register']);
unset($groups['edit']);
unset($groups['view']);
unset($groups['login']);
unset($groups['social']);
$array = array(
'register' => __('Registration Fields','userpro'),
'edit' => __('Edit Profile Fields','userpro'),
'login' => __('Login Fields','userpro'),
'social' => __('Social Fields','userpro')
);
IF anyone can shed some liht on this that would be great as far as i see theres nothing written wrong, and even the plugin maker is scrating his head on this....
the config for the php is 5.4
And the Apache is 2.4
Mysql is running 5.6

"Constant CRLF already defined" error when using php-resque with Laravel

I'm running php-resque together with Laravel 3 on Ubuntu 12.04.
Problem: When a job is enqueued in resque, I get the following error:
Unhandled Exception
Message:
Constant CRLF already defined
Location:
/var/www/dev/vendor/chrisboulton/php-resque/lib/Redisent/Redisent.php on line 10
What does the error mean and how can we solve it?
PHP
// Enqueue in Resque
$data = array(
'name' => $name,
'email' => $email,
'created_at' => DB::raw('NOW()')
);
Resque::enqueue('queue', 'exampleWorker', $data);
However when I try to enqueue a job using artisan, it works!
Task
class Queue_Task
{
public function run()
{
// Autoload composer vendors.
require path('composer').DS.'autoload.php';
$args = array('name' => 'John Smith');
Resque::enqueue('MyAppName', 'ExampleWorker', $args);
echo "Resque job queued.\n";
return;
}
}
Output
PHP Notice: Constant CRLF already defined in /var/www/dev/vendor/chrisboulton/php-resque/lib/Redisent/Redisent.php on line 10
Notice: Constant CRLF already defined in /var/www/dev/vendor/chrisboulton/php-resque/lib/Redisent/Redisent.php on line 10
Resque job queued.
It's a guess, but I'd say in /var/www/dev/vendor/chrisboulton/php-resque/lib/Redisent/Redisent.php there's a second define('CRLF', 'something') on line 10 that should probably be commented out if you want these two pieces of software to work together.

SugarCRM REST API set_relationship between Quote and ProductBundles

I am using SugarCRM Pro 6.5.5
I need to create a Quote and add Products to it with the REST API. All bundles > Prof the set_entry's work, and the set_relationship for ProductBoducts works fine. But, set_relationship for Quotes > ProductBundles does not work.
Here is my input for ProductBundles > Products: this works fine
{
"session":"5qklti658f0ooou135vt8fkbi4",
"module":"ProductBundles",
"module_id":"50b71673-b555-9d68-04c9-508ef9582f47",
"link_field_name":"products",
"related_ids":[
"a9615ab1-cd89-1549-f9b8-508f00c6fa84"
]
}
Here is my input for Quotes > ProductBundles: this does not work
{
"session":"jqodi1pu8u2l8basca1hhcbt27",
"module":"Quotes",
"module_id":"bc01a88a-35c9-25ed-dfac-508ef206a264",
"link_field_name":"product_bundles",
"related_ids":[
"50b71673-b555-9d68-04c9-508ef9582f47"
]
}
BUT it still returns:
{
"created":1,
"failed":0,
"deleted":0
}
But, no record is created in the product_bundle_quote table.
I have dug into the Sugar code a little, and found something interesting.
In service/core/SoapHelperWebService.php on line 735, is this:
$mod->$link_field_name->add($related_ids, $name_value_pair);
Which calls the add method in file data/Relationships/M2MRelationship.php on line 118. Interestingly, $lhsLinkName is NULL, which causes the method to return false. Here is a snippet:
public function add($lhs, $rhs, $additionalFields = array())
{
$lhsLinkName = $this->lhsLink;
$rhsLinkName = $this->rhsLink;
if (empty($lhs->$lhsLinkName) && !$lhs->load_relationship($lhsLinkName))
{
$lhsClass = get_class($lhs);
$GLOBALS['log']->fatal("could not load LHS $lhsLinkName in $lhsClass");
return false;
}
if (empty($rhs->$rhsLinkName) && !$rhs->load_relationship($rhsLinkName))
{
$rhsClass = get_class($rhs);
$GLOBALS['log']->fatal("could not load RHS $rhsLinkName in $rhsClass");
return false;
}
It returns FALSE in the first if() block, which means the record is never created.
Also, this shows up in my log:
[2139][1][FATAL] could not load LHS in ProductBundle
So yeah, I'm stuck here. I tried searching for everything I could, including the error, but I haven't found anything helpful.
This is a Sugar bug, which will be fixed in the 6.7 release. In the meantime, check out this forums post for the code fix.
http://forums.sugarcrm.com/f6/create-quote-line-items-web-service-api-83183/
This does turn out to be a Sugar Bug, but not the one in the other answer. It's actually related to this bug: Bug 32064. They were able to provide me with a custom module that I could upload and activate to address the issue before release 6.7 when this is slated to be addressed officially. You'll probably want to contact SugarCRM directly for this workaround, depending on your time frame.
I was having the same issue and in order to resolve that i added the below mentioned code in product bundles vardef and it's start working fine.
'quotes' =>
array (
'name' => 'quotes',
'type' => 'link',
'vname'=>'LBL_PRODUCT_BUNDLES',
'relationship' => 'product_bundle_quote',
'source'=>'non-db',
),
Thanks!
You have to link the quote to products too.
make sure in your quote vardef there's the following:
'products' =>
array (
'name' => 'products',
'type' => 'link',
'relationship' => 'quote_products',
'vname' => 'LBL_PRODUCTS',
'source'=>'non-db',
),
and in your webservice, set the relationship between quote and products
{
"session":$session_id,
"module":"Quotes",
"module_id":$quote_id,
"link_field_name":"products",
"related_ids":[
$product_id
]
}
It works for me.

Problems trying to use the Kohana pagination module

I have downloaded the Kohana Pagination module from Git and have been having some issues trying to use it.
I moved it into the modules folder and have updated my bootstrap to include the module...
'pagination' => MODPATH.'kohana-pagination',
I have the following code that loads some messages from a simple table with pagination...
public function action_index()
{
$content = View::factory('welcome')
->bind('messages', $messages)
->bind('pager_links', $pager_links);
$message = new Model_Message;
$message_count = $message->count_all();
$pagination = Pagination::factory(array(
'total_items' => $message_count,
'items_per_page' => 3,
));
$pager_links = $pagination->render();
$messages = $message->get_all($pagination->items_per_page, $pagination->offset);
$this->template->content = $content;
}
When I run load this in my browser, I get the following error message...
ErrorException [ Fatal Error ]: 1Call to undefined method Kohana::config()
MODPATH\kohana-pagination\classes\kohana\pagination.php [ 87 ]
82 * #return array config settings
83 */
84 public function config_group($group = 'default')
85 {
86 // Load the pagination config file
87 $config_file = Kohana::config('pagination');
88
89 // Initialize the $config array
90 $config['group'] = (string) $group;
91
92 // Recursively load requested config groups
{PHP internal call} ยป Kohana_Core::shutdown_handler()
If I remove the code relating to the pagination, the page loads the data fine from the database. Any pointers here would be great.
Update
Found this link: https://github.com/kloopko/kohana-pagination, on the back of Ikke, so cheers for the help folks.
Appears that the previously bundled pagination module has been removed, found the kohana-pagination module which has been updated to cater for 3.2.
Hope that helps someone else just starting out. :)
The issue is just the config system has changed for version 3.2. Most modules can be fixed by simply updating
$config_file = Kohana::config('pagination');
to
$config_file = Kohana::$config->load('pagination');
Let me update you the steps to resolve with Kohana paging.
Go to modules/pagination/classes/kohana/pagination.php
Change the
$config_file = Kohana::config('pagination');
to
$config_file = Kohana::$config->load('pagination');
in the same page at the line 199
change this line to
return URL::site(Request::current()->uri).URL::query(array($this->config['current_page']['key'] => $page));
to
return URL::site(Request::current()->uri()).URL::query(array($this->config['current_page']['key'] => $page));
Add uri braces.
This resolved my issue. thank you.

CakePHP: Custom Function in bootstrap that uses $ajax->link not working

Hello I have two questions:
(1) Is it best practice to create global custom functions in the bootstrap file? Is there a better place to store them?
(2) I am unable use the following line of code in my custom function located in my bootstrap.php file:
$url = $ajax->link ( 'Delete', array ('controller' => 'events', 'action' => 'delete', 22 ), array ('update' => 'event' ), 'Do you want to delete this event?' );
echo $url;
I receive the following error:
Notice (8): Undefined variable: ajax [APP\config\bootstrap.php, line 271]
Code
}
function testAjax () {
$url = $ajax->link ( 'Delete', array ('controller' => 'events', 'action' => 'delete', 22 ), array ('update' => 'event' ), 'Do you want to delete this event?' );
testAjax - APP\config\bootstrap.php, line 271
include - APP\views\event\queue.ctp, line 19
View::_render() - CORE\cake\libs\view\view.php, line 649
View::render() - CORE\cake\libs\view\view.php, line 372
Controller::render() - CORE\cake\libs\controller\controller.php, line 766
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 211
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 181
[main] - APP\webroot\index.php, line 91
However it works as intended if I place that same code in my view:
<a onclick=" event.returnValue = false; return false;" id="link1656170149" href="/shout/events/delete/22">Delete</a>
Please help :)
Thanks in advance!!
That depends: If it's a complete generic function that could be accessed from everywhere in your app, than yes. Otherwise I would place it in the parent-class from where you want to use it (app_model, app_controller)
$ajax is a helper class, that cannot be accessed from your bootstrap file. You would need to inculde the helper in the bootstrap, and that is the point from where it doesn't make sense to place the function there
Don't do it in bootstrap - no good place for that.
If You want to have this url on every page - put it in Your layout (http://book.cakephp.org/view/96/Layouts)

Categories