Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Problems with making admin section for my plugin  (Read 4372 times)

0 Members and 1 Guest are viewing this topic.

bakerman

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Problems with making admin section for my plugin
« on: April 08, 2013, 11:07:29 pm »

Hello

I am working on a new e-commerce solution for coppermine, and for that i have build a quick'n'dirty plugin which works pretty well.... (will post a version, once i cleaned up the code, and made the installer correct)

I do however want to add some different admin pages, and i made a button for it allright, but it does not load as a part of the admin interface, it loads the files directly.
Even though i use the link index.php?file=basket/albumsettings

the code i have is

albumsettings.php

<?php
/**************************************************
  Coppermine 1.5.x Plugin - basket
  *************************************************
  Copyright (c) 2013 Martin Bech
  *************************************************
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 3 of the License, or
  (at your option) any later version.
  ********************************************
  $Revision: 7119 $
  $LastChangedBy: Martin Bech $
  $Date: 2010-01-24 21:39:28 +0100 (So, 24. Jan 2010) $
  **************************************************/
 
define('IN_COPPERMINE', true);

require_once 'include/picmgmt.inc.php';
require_once './plugins/basket/initialize.inc.php';

$scriptname = 'index.php?file=basket/albumsettings';

if (!GALLERY_ADMIN_MODE) {
    cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);
}

echo "<hr>".$basket_config['allowchoosefree'].$CONFIG['lang']."<hr>";
?>

and in initialize.php i have

<?php
function basket_language() {
    global $CONFIG, $lang_plugin_basket;
    require "./plugins/basket/lang/english.php";
    if ($CONFIG['lang'] != 'english' && file_exists("./plugins/basket/lang/{$CONFIG['lang']}.php")) {
        require "./plugins/basket/lang/{$CONFIG['lang']}.php";
    }
   
     $return['language'] = $lang_plugin_basket;
}
?>

My config has the following

<?php
/**************************************************
  Coppermine Plugin - Basket
  *************************************************
  Copyright (c) 2013 Martin Bech
  *************************************************
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License version 3
  as published by the Free Software Foundation.
***************************************************/
require_once "./plugins/basket/initialize.inc.php";
$name='basket';
$description='E-commerce solution for photographers v2';
$author='Martin Bech';
$version='0.2';
$plugin_cpg_version = array('min' => '1.5');
$basket_config['allowchoosefree'] = true;
$basket_config['alowchoosefreeamount'] = 1;
$basket_config['defaultpricegroup'] = 1;


?>

My second problem is,,, how can i use my configuration settings from my configuration.php within my admin pages?

it seems that i cant use $basket_config[] even if i define it as GLOBAL.....

Would appreciate a bit of help, so i hopefully soon can present my new e-commerce plugin to all of you.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Problems with making admin section for my plugin
« Reply #1 on: April 09, 2013, 12:32:23 pm »

Try to include/require the configuration.php file, though it's not recommended. Why don't you store configuration values in Coppermine's config database table?
Logged
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 19 queries.