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: Installation of a code of the exchange of references  (Read 4889 times)

0 Members and 1 Guest are viewing this topic.

Trianon

  • Coppermine newbie
  • Offline Offline
  • Posts: 18
Installation of a code of the exchange of references
« on: March 06, 2013, 12:01:04 pm »

How to install code exchange links. For example, it is proposed to insert the following code.

<?php
   define('LINKFEED_USER', '123');
   require_once($_SERVER['DOCUMENT_ROOT'].'/'.LINKFEED_USER.'/linkfeed.php');
   $linkfeed = new LinkfeedClient();
   echo $linkfeed->return_links();
?>

Where to insert this code. In what files are what codes to insert.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Installation of a code of the exchange of references
« Reply #1 on: March 06, 2013, 03:31:41 pm »

Where do you want to display that links? On which pages? All? At which location exactly? A link to your gallery will help, a screenshot where you have marked the location, too.
Logged

Trianon

  • Coppermine newbie
  • Offline Offline
  • Posts: 18
Re: Installation of a code of the exchange of references
« Reply #2 on: March 07, 2013, 08:15:53 am »

The exchange sets off references only not more deeply than the third level. It is necessary to place at the very bottom of page.
http://www.fillumenistika.ru/albom-gallery/
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Installation of a code of the exchange of references
« Reply #3 on: March 07, 2013, 10:34:54 am »

What exactly do you mean with "third level"?

To add the content right before the Coppermine footer, copy the function theme_credits from themes/sample/theme.php to your theme's theme.php file, if it doesn't exist. Then, find
Code: [Select]
    $return = <<< EOTand replace with
Code: [Select]
    define('LINKFEED_USER', '123');
    require_once($_SERVER['DOCUMENT_ROOT'].'/'.LINKFEED_USER.'/linkfeed.php');
    $linkfeed = new LinkfeedClient();
    $return = $linkfeed->return_links();
    $return .= <<< EOT

This maybe won't work, as the superglobals are cleared by Inspekt by default. Please let me know if it works as expected.
Logged

Trianon

  • Coppermine newbie
  • Offline Offline
  • Posts: 18
Re: Installation of a code of the exchange of references
« Reply #4 on: March 07, 2013, 11:35:07 am »

Taken from themes/sample/theme.php and paste into your file theme.php:


/******************************************************************************
** Section <<<$template_no_img_to_display>>> - END
******************************************************************************/

// Function for writing a pagefooter
function pagefooter()
{
    //global $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_SERVER_VARS;
    global $USER, $USER_DATA, $CONFIG, $time_start, $query_stats, $queries;
    global $template_footer;

    $custom_footer = cpg_get_custom_include($CONFIG['custom_footer_path']);

    if ($CONFIG['debug_mode']==1 || ($CONFIG['debug_mode']==2 && GALLERY_ADMIN_MODE)) {
        cpg_debug_output();
    }

    $template_vars = array(
        '{GAL_NAME}' => $CONFIG['gallery_name'],
        '{GAL_DESCRIPTION}' => $CONFIG['gallery_description'],
        '{SYS_MENU}' => theme_main_menu('sys_menu'),
        '{SUB_MENU}' => theme_main_menu('sub_menu'),
        '{ADMIN_MENU}' => theme_admin_mode_menu(),
        '{CUSTOM_HEADER}' => $custom_header,
        '{JAVASCRIPT}' => theme_javascript_head(),
        '{CUSTOM_FOOTER}' => $custom_footer,
        '{VANITY}' => (defined('THEME_IS_XHTML10_TRANSITIONAL')) ? theme_vanity() : '',
        '{CREDITS}' => theme_credits(),
    );

    echo template_eval($template_footer, $template_vars);
}
/******************************************************************************
** Section <<<pagefooter>>> - END
******************************************************************************/

/******************************************************************************
** Section <<<pagefooter_mini>>> - START
******************************************************************************/
function pagefooter_mini()
{
    echo <<< EOT

    </body>
</html>

EOT;
}
/******************************************************************************
** Section <<<pagefooter_mini>>> - END
******************************************************************************/

/******************************************************************************
** Section <<<theme_javascript_head>>> - START
******************************************************************************/
// Function for the JavaScript inside the <head>-section
function theme_javascript_head()
{
    global $JS, $LINEBREAK;

    $return = '';

    // Check if we have any variables being set using set_js_vars function
    if (!empty($JS['vars'])) {
        // Convert the $JS['vars'] array to json object string
        $json_vars = json_encode($JS['vars']);
        // Output the json object
        $return = <<< EOT
<script type="text/javascript">
/* <![CDATA[ */
    var js_vars = $json_vars;
/* ]]> */
</script>

EOT;
    }

    // Check if we have any js includes
    if (!empty($JS['includes'])) {
        // Bring the jquery core library to the very top of the list
        if (in_array('js/jquery-1.3.2.js', $JS['includes']) == TRUE) {
            $key = array_search('js/jquery-1.3.2.js', $JS['includes']);
            unset($JS['includes'][$key]);
            array_unshift($JS['includes'], 'js/jquery-1.3.2.js');
        }
        $JS['includes'] = CPGPluginAPI::filter('javascript_includes',$JS['includes']);
        // Include all the files which were set using js_include() function
        foreach ($JS['includes'] as $js_file) {
            $return .= js_include($js_file, true) . $LINEBREAK;
        }
    }

    return $return;
}
/******************************************************************************
** Section <<<theme_javascript_head>>> - END
******************************************************************************/

Works. But replacing

$return = <<< EOT
----------------------
1102 <?php
define('LINKFEED_USER', '123');
require_once($_SERVER['DOCUMENT_ROOT'].'/'.LINKFEED_USER.'/linkfeed.php');
$linkfeed = new LinkfeedClient();
$return = $linkfeed->return_links();
$return = <<< EOT?>

Parse error: syntax error, unexpected '<' in /albom-gallery/themes/curve/theme.php on line 1102.

But replacing
$return = <<< EOT
----------------------
define('LINKFEED_USER', '123');
1103 require_once($_SERVER['DOCUMENT_ROOT'].'/'.LINKFEED_USER.'/linkfeed.php');
$linkfeed = new LinkfeedClient();
$return = $linkfeed->return_links();
$return = <<< EOT

Fatal error: require_once() [function.require]: Failed opening required '/123/linkfeed.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /albom-gallery/themes/curve/theme.php on line 1103
Logged

Trianon

  • Coppermine newbie
  • Offline Offline
  • Posts: 18
Re: Installation of a code of the exchange of references
« Reply #5 on: March 07, 2013, 01:17:31 pm »

The levels at which you can place links.
1 - home page.
2 - go to the main page
3 - go to go to the main page.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Installation of a code of the exchange of references
« Reply #6 on: March 07, 2013, 05:26:43 pm »

I still don't get what you are talking about regarding the levels. I also don't get what you try to say with the post above your last post. As far as I can see you haven't added the function theme_credits, but some other stuff. However, try this updated code:
Code: [Select]
    $superCage = Inspekt::makeSuperCage();
    define('LINKFEED_USER', '123');
    require_once($superCage->server->getRaw('DOCUMENT_ROOT').'/'.LINKFEED_USER.'/linkfeed.php');
    $linkfeed = new LinkfeedClient();
    $return = $linkfeed->return_links();
    $return .= <<< EOT
Logged

Trianon

  • Coppermine newbie
  • Offline Offline
  • Posts: 18
Re: Installation of a code of the exchange of references
« Reply #7 on: March 08, 2013, 12:31:46 pm »

Your last option works, an error page is not to be. But the market says that the code on the page no.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Installation of a code of the exchange of references
« Reply #8 on: March 08, 2013, 02:19:46 pm »

the market says that the code on the page no.
What?
Logged

Trianon

  • Coppermine newbie
  • Offline Offline
  • Posts: 18
Re: Installation of a code of the exchange of references
« Reply #9 on: March 08, 2013, 08:15:23 pm »

Вот пример.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Installation of a code of the exchange of references
« Reply #10 on: March 09, 2013, 08:08:14 pm »

That screenshot doesn't help me. Please always speak English outside the language-specific boards.
Logged
Pages: [1]   Go Up
 

Page created in 0.024 seconds with 20 queries.