Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Undefined offset: 1 and username undefined variable  (Read 2145 times)

0 Members and 1 Guest are viewing this topic.

Niecher

  • LocalSupporter
  • Coppermine frequent poster
  • ***
  • Country: es
  • Offline Offline
  • Gender: Male
  • Posts: 191
Undefined offset: 1 and username undefined variable
« on: June 20, 2013, 01:29:01 pm »

In debug mode I get this notices:

Quote
/include/themes.inc.php
  • Notice line 1864: Undefined offset: 1
  • Notice line 1866: Undefined offset: 1
  • Notice line 1866: Undefined offset: 1
  • Notice line 1873: Undefined offset: 1

In the header section tabs:

Quote
    // Header for tabs
    $tabs .= $template['tab_header'];

    if ($CONFIG['tabs_dropdown']) {
        // Dropdown list for all pages
        preg_match('/cat=([\d]+)/', $template['page_link'], $matches);
        $tabs_dropdown_js = <<< EOT

I'm trying to fix it by adding the following code to define offset: 1

Quote
    // Header for tabs
    $tabs .= $template['tab_header'];

    if ($CONFIG['tabs_dropdown']) {
        // Dropdown list for all pages
        preg_match('/cat=([\d]+)/', $template['page_link'], $matches);

    if (!$matches) {
       // return as if {$matches[1]} is empty if no match
       return preg_replace('/cat=([\d]+)/', 'cat=""', $template['page_link']);
    }

        $tabs_dropdown_js = <<< EOT

but it seems that it does not work, I mean, the variable offset: 1 not shown in notices but the template is broken

any idea to define offset: 1?

Thanks in advance. :-\



other notices on file usermgr.php

Quote
  • Runtime Notice line 142: Non-static method Inspekt::makeSuperCage() should not be called statically
  • Notice line 198: Undefined variable: username
  • Runtime Notice line 331: Non-static method CPGPluginAPI::filter() should not be called statically
  • Notice line 342: Undefined variable: username
  • Notice line 343: Undefined variable: username
  • Notice line 350: Undefined variable: username
  • Notice line 351: Undefined variable: username
  • Notice line 355: Undefined variable: username
  • Notice line 356: Undefined variable: username
  • Notice line 360: Undefined variable: username
  • Notice line 361: Undefined variable: username
  • Notice line 368: Undefined variable: username
  • Notice line 369: Undefined variable: username
  • Notice line 373: Undefined variable: username
  • Notice line 374: Undefined variable: username
  • Runtime Notice line 700: Non-static method CPGPluginAPI::filter() should not be called statically

I solved define username variable by changing the following lines in usermgr.php:

Quote
183.    if ($search) {
184.        $username = '&amp;username='.$search; //<--- this one up to line 182.

Best Regards
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Undefined offset: 1 and username undefined variable
« Reply #1 on: August 13, 2013, 04:06:23 pm »

I'm sure there are a lot of code sections that create such notices. The second issue would be fixed by adding something like
Code: [Select]
$username = '';somewhere above
Code: [Select]
    if ($search) {
        $username = '&amp;username='.$search;
but as it doesn't affect Coppermine's functionality, we usually don't fix such notices. I hadn't looked at the first issue, but I assume it also doesn't affect anything than the debug notice output?
Logged

Niecher

  • LocalSupporter
  • Coppermine frequent poster
  • ***
  • Country: es
  • Offline Offline
  • Gender: Male
  • Posts: 191
Re: Undefined offset: 1 and username undefined variable
« Reply #2 on: August 14, 2013, 03:54:40 pm »

Thank you very much, Αndré.
Logged
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 20 queries.