Sitemap »  Show posts from    to     

Icy Phoenix


General Support - Sitemap



MWE_001 [ Sun 21 Aug, 2016 07:11 ]
Post subject: Sitemap
I am kind of anxious to get my sitemap working properly. B UT, there is an error that I mentioned before but I did it in my posting here and there days so I will ask this one again in the proper place which is right here for all to see in General support.

If I go to sitemap.php I get this

Code: [Hide] [Select]
[Icy Phoenix Debug] PHP Notice: in file /sitemap.php on line 270: include(ALBUM_MOD_PATHalbum_common.php): failed to open stream: No such file or directory
[Icy Phoenix Debug] PHP Notice: in file /sitemap.php on line 270: include(ALBUM_MOD_PATHalbum_common.php): failed to open stream: No such file or directory
[Icy Phoenix Debug] PHP Notice: in file /sitemap.php on line 270: include(): Failed opening 'ALBUM_MOD_PATHalbum_common.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php:/usr/local/php55/lib/php')


Here is the line in question:
Code: [Hide] [Select]
include(ALBUM_MOD_PATH . 'album_common.' . PHP_EXT);


Is this line a mistake? As we all know, there is no longer a Album_Mod folder where the album_common.php once used to live.

If I remove this bit of code the sitemap.php will work as it is supposed to.

Code: [Hide] [Select]
// MG SITEMAP - ALBUM - BEGIN
if (isset($cms_config_layouts['album']['view']) && ($cms_config_layouts['album']['view'] == AUTH_ALL))
{
// Get general album information
include(ALBUM_MOD_PATH . 'album_common.' . PHP_EXT);
$album_user_id = ALBUM_PUBLIC_GALLERY;
//$album_user_id = ALBUM_ROOT_CATEGORY;
$catrows = array ();
$options = ALBUM_READ_ALL_CATEGORIES|ALBUM_AUTH_VIEW;
$catrows = album_read_tree($album_user_id, $options);
album_read_tree($album_user_id);
$allowed_cat = ''; // For Recent Public Pics below
for ($i = 0; $i < sizeof($catrows); $i++)
{
$allowed_cat .= ($allowed_cat == '') ? $catrows[$i]['cat_id'] : ',' . $catrows[$i]['cat_id'];
}

if($config['sitemap_sort'] == 'ASC')
{
$order = 'DESC';
}
else
{
$order = 'ASC';
}
$sql = "SELECT pic_id FROM " . ALBUM_TABLE . "
WHERE pic_cat_id IN (" . $allowed_cat . ")
ORDER BY pic_id $order LIMIT 1";
$result = $db->sql_query($sql);
$result = $db->sql_fetchrow($result);
$lastid = $result['pic_id'];

//only get a limited number of pics per query (default 250) to keep server load down in case of large boards
while($lastpic != $lastid)
{
$result = '';
//Newest pics first
if(is_numeric($lastpic) && $config['sitemap_sort'] == 'ASC')
{
$lastpic++;
$wheresql = "AND p.pic_id >= $lastpic";
}
//Oldest pics first
elseif(is_numeric($lastpic))
{
$lastpic--;
$wheresql = "AND p.pic_id <= $lastpic";
}
else
{
$wheresql = "";
}

$sql = "SELECT p.pic_id, p.pic_title, p.pic_desc, p.pic_user_id, p.pic_time, p.pic_lock
FROM " . ALBUM_TABLE . " AS p
WHERE p.pic_cat_id IN (" . $allowed_cat . ") $wheresql
ORDER BY p.pic_id " . $config['sitemap_sort'] . "
LIMIT " . $config['sitemap_topic_limit'];
$result = $db->sql_query($sql);

while ($row = $db->sql_fetchrow($result))
{
$pic_priority = $config['sitemap_default_priority'];
$pic_change = 'never';
if (($config['url_rw'] == '1') || (($config['url_rw_guests'] == '1') && ($user->data['user_id'] == ANONYMOUS)))
{
$url = $server_url . str_replace ('--', '-', make_url_friendly($row['pic_title']) . '-asp' . $row['pic_id'] . '.html');
}
else
{
$url = $server_url . 'album_showpage.' . PHP_EXT . '?pic_id=' . $row['pic_id'];
}
$xml_sitemap_body .= '
<url>
<loc>' . $url . '</loc>
<lastmod>' . gmdate('Y-m-d\TH:i:s' . '+00:00', $row['pic_time']) . '</lastmod>
<changefreq>' . $pic_change . '</changefreq>
<priority>' . $pic_priority . '</priority>
</url>';
$lastpic = $row['pic_id'];
}
$db->sql_freeresult();
}
}
// MG SITEMAP - ALBUM - END


That really seems like overkill to remove that much code no?


Mighty Gorgon [ Sun 28 Aug, 2016 11:01 ]
Post subject: Re: Sitemap
Hi Ray,
you spotted another bug, thank you for reporting.

Here is the fix (please confirm if it works):

OPEN sitemap.php
FIND
Code: [Hide] [Select]
if (isset($cms_config_layouts['album']['view']) && ($cms_config_layouts['album']['view'] == AUTH_ALL))
{
// Get general album information
include(ALBUM_MOD_PATH . 'album_common.' . PHP_EXT);
$album_user_id = ALBUM_PUBLIC_GALLERY;
//$album_user_id = ALBUM_ROOT_CATEGORY;
$catrows = array ();
$options = ALBUM_READ_ALL_CATEGORIES|ALBUM_AUTH_VIEW;
$catrows = album_read_tree($album_user_id, $options);
album_read_tree($album_user_id);
$allowed_cat = ''; // For Recent Public Pics below
for ($i = 0; $i < sizeof($catrows); $i++)
{
$allowed_cat .= ($allowed_cat == '') ? $catrows[$i]['cat_id'] : ',' . $catrows[$i]['cat_id'];
}

if($config['sitemap_sort'] == 'ASC')
{
$order = 'DESC';
}
else
{
$order = 'ASC';
}
$sql = "SELECT pic_id FROM " . ALBUM_TABLE . "
WHERE pic_cat_id IN (" . $allowed_cat . ")
ORDER BY pic_id $order LIMIT 1";
$result = $db->sql_query($sql);
$result = $db->sql_fetchrow($result);
$lastid = $result['pic_id'];

//only get a limited number of pics per query (default 250) to keep server load down in case of large boards
while($lastpic != $lastid)
{
$result = '';
//Newest pics first
if(is_numeric($lastpic) && $config['sitemap_sort'] == 'ASC')
{
$lastpic++;
$wheresql = "AND p.pic_id >= $lastpic";
}
//Oldest pics first
elseif(is_numeric($lastpic))
{
$lastpic--;
$wheresql = "AND p.pic_id <= $lastpic";
}
else
{
$wheresql = "";
}

$sql = "SELECT p.pic_id, p.pic_title, p.pic_desc, p.pic_user_id, p.pic_time, p.pic_lock
FROM " . ALBUM_TABLE . " AS p
WHERE p.pic_cat_id IN (" . $allowed_cat . ") $wheresql
ORDER BY p.pic_id " . $config['sitemap_sort'] . "
LIMIT " . $config['sitemap_topic_limit'];
$result = $db->sql_query($sql);

while ($row = $db->sql_fetchrow($result))
{
$pic_priority = $config['sitemap_default_priority'];
$pic_change = 'never';
if (($config['url_rw'] == '1') || (($config['url_rw_guests'] == '1') && ($user->data['user_id'] == ANONYMOUS)))
{
$url = $server_url . str_replace ('--', '-', make_url_friendly($row['pic_title']) . '-asp' . $row['pic_id'] . '.html');
}
else
{
$url = $server_url . 'album_showpage.' . PHP_EXT . '?pic_id=' . $row['pic_id'];
}
$xml_sitemap_body .= '
<url>
<loc>' . $url . '</loc>
<lastmod>' . gmdate('Y-m-d\TH:i:s' . '+00:00', $row['pic_time']) . '</lastmod>
<changefreq>' . $pic_change . '</changefreq>
<priority>' . $pic_priority . '</priority>
</url>';
$lastpic = $row['pic_id'];
}
$db->sql_freeresult();
}
}

REPLACE WITH
Code: [Hide] [Select]
$plugin_name = 'album';
if (!empty($config['plugins'][$plugin_name]['enabled']))
{
include(IP_ROOT_PATH . PLUGINS_PATH . $config['plugins'][$plugin_name]['dir'] . 'common.' . PHP_EXT);
if (isset($cms_config_layouts['album']['view']) && ($cms_config_layouts['album']['view'] == AUTH_ALL))
{
// Get general album information
include(ALBUM_MOD_PATH . 'album_common.' . PHP_EXT);
$album_user_id = ALBUM_PUBLIC_GALLERY;
//$album_user_id = ALBUM_ROOT_CATEGORY;
$catrows = array ();
$options = ALBUM_READ_ALL_CATEGORIES|ALBUM_AUTH_VIEW;
$catrows = album_read_tree($album_user_id, $options);
album_read_tree($album_user_id);
$allowed_cat = ''; // For Recent Public Pics below
for ($i = 0; $i < sizeof($catrows); $i++)
{
$allowed_cat .= ($allowed_cat == '') ? $catrows[$i]['cat_id'] : ',' . $catrows[$i]['cat_id'];
}

if($config['sitemap_sort'] == 'ASC')
{
$order = 'DESC';
}
else
{
$order = 'ASC';
}
$sql = "SELECT pic_id FROM " . ALBUM_TABLE . "
WHERE pic_cat_id IN (" . $allowed_cat . ")
ORDER BY pic_id $order LIMIT 1";
$result = $db->sql_query($sql);
$result = $db->sql_fetchrow($result);
$lastid = $result['pic_id'];

//only get a limited number of pics per query (default 250) to keep server load down in case of large boards
while($lastpic != $lastid)
{
$result = '';
//Newest pics first
if(is_numeric($lastpic) && $config['sitemap_sort'] == 'ASC')
{
$lastpic++;
$wheresql = "AND p.pic_id >= $lastpic";
}
//Oldest pics first
elseif(is_numeric($lastpic))
{
$lastpic--;
$wheresql = "AND p.pic_id <= $lastpic";
}
else
{
$wheresql = "";
}

$sql = "SELECT p.pic_id, p.pic_title, p.pic_desc, p.pic_user_id, p.pic_time, p.pic_lock
FROM " . ALBUM_TABLE . " AS p
WHERE p.pic_cat_id IN (" . $allowed_cat . ") $wheresql
ORDER BY p.pic_id " . $config['sitemap_sort'] . "
LIMIT " . $config['sitemap_topic_limit'];
$result = $db->sql_query($sql);

while ($row = $db->sql_fetchrow($result))
{
$pic_priority = $config['sitemap_default_priority'];
$pic_change = 'never';
if (($config['url_rw'] == '1') || (($config['url_rw_guests'] == '1') && ($user->data['user_id'] == ANONYMOUS)))
{
$url = $server_url . str_replace ('--', '-', make_url_friendly($row['pic_title']) . '-asp' . $row['pic_id'] . '.html');
}
else
{
$url = $server_url . 'album_showpage.' . PHP_EXT . '?pic_id=' . $row['pic_id'];
}
$xml_sitemap_body .= '
<url>
<loc>' . $url . '</loc>
<lastmod>' . gmdate('Y-m-d\TH:i:s' . '+00:00', $row['pic_time']) . '</lastmod>
<changefreq>' . $pic_change . '</changefreq>
<priority>' . $pic_priority . '</priority>
</url>';
$lastpic = $row['pic_id'];
}
$db->sql_freeresult();
}
}
}


MWE_001 [ Sun 28 Aug, 2016 22:30 ]
Post subject: Re: FIXED Sitemap
XML Parsing Error: junk after document element
Location: http://xxxxxxxxxxx/xxxxxxxxxxpers/sitemap.php
Line Number 1, Column 38:<b>[Icy Phoenix Debug] PHP Notice</b>: in file <b>/sitemap.php</b> on line <b>274</b>: <b>include(./plugins/album/includes/album_common.php): failed to open stream: No such file or directory</b><br />
-------------------------------------^


I did go and confirm I do not have that file in my album plugin includes folder.Just in case I had a corrupt download file, I went to the downloads and grabbed a fresh copy of album plugin today and confirmed as well that file is not there.




Powered by Icy Phoenix