Installation of a code of the exchange of references Installation of a code of the exchange of references
 

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]

Main Menu

Installation of a code of the exchange of references

Started by Trianon, March 06, 2013, 12:01:04 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Trianon

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.

Αndré

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.

Trianon

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/

Αndré

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
    $return = <<< EOT
and replace with
    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.

Trianon

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

Trianon

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.

Αndré

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:
    $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

Trianon

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

Αndré


Trianon

Вот пример.

Αndré

That screenshot doesn't help me. Please always speak English outside the language-specific boards.