2006-12-02 04:36:16 +00:00
< ? php
/*
2008-12-20 21:48:06 +00:00
* e107 website system
*
2012-11-27 21:13:34 -08:00
* Copyright ( C ) 2008 - 2013 e107 Inc ( e107 . org )
2008-12-20 21:48:06 +00:00
* Released under the terms and conditions of the
* GNU General Public License ( http :// www . gnu . org / licenses / gpl . txt )
*
* Plugin Administration - gsitemap
*
2006-12-02 04:36:16 +00:00
*/
require_once ( " ../../class2.php " );
2008-12-20 21:48:06 +00:00
if ( ! getperms ( " P " ) || ! plugInstalled ( 'gsitemap' ))
{
header ( " location: " . e_BASE . " index.php " );
exit ();
}
2006-12-02 04:36:16 +00:00
require_once ( e_ADMIN . " auth.php " );
require_once ( e_HANDLER . " userclass_class.php " );
2012-11-27 21:13:34 -08:00
e107 :: lan ( 'gsitemap' , e_LANGUAGE . " _admin_gsitemap.php " );
2006-12-02 04:36:16 +00:00
2012-11-27 21:13:34 -08:00
$gsm = new gsitemap ;
2006-12-02 04:36:16 +00:00
class gsitemap
{
var $message ;
var $freq_list = array ();
function gsitemap ()
{
/* constructor */
2012-11-27 21:13:34 -08:00
$mes = e107 :: getMessage ();
2013-02-25 00:59:26 -08:00
2006-12-02 04:36:16 +00:00
$this -> freq_list = array
(
" always " => GSLAN_11 ,
" hourly " => GSLAN_12 ,
" daily " => GSLAN_13 ,
" weekly " => GSLAN_14 ,
" monthly " => GSLAN_15 ,
" yearly " => GSLAN_16 ,
2013-02-25 00:59:26 -08:00
" never " => LAN_NEVER
2006-12-02 04:36:16 +00:00
);
if ( isset ( $_POST [ 'edit' ]))
{
$this -> editSme ();
}
if ( isset ( $_POST [ 'delete' ]))
{
$this -> deleteSme ();
}
if ( isset ( $_POST [ 'add_link' ]))
{
$this -> addLink ();
}
if ( isset ( $_POST [ 'import_links' ]))
{
$this -> importLink ();
}
if ( $this -> message )
{
2012-11-27 21:13:34 -08:00
$mes -> addSuccess ( $this -> message );
// echo "<br /><div style='text-align:center'><b>".$this -> message."</b></div><br />";
2006-12-02 04:36:16 +00:00
}
if ( e_QUERY == " new " )
{
$this -> doForm ();
}
else if ( e_QUERY == " import " )
{
$this -> importSme ();
}
else if ( e_QUERY == " instructions " )
{
$this -> instructions ();
}
2012-12-08 15:52:40 +01:00
else if ( ! vartrue ( $_POST [ 'edit' ]))
2006-12-02 04:36:16 +00:00
{
$this -> showList ();
}
}
function showList ()
{
2013-02-25 00:59:26 -08:00
2012-11-27 21:13:34 -08:00
$mes = e107 :: getMessage ();
$sql = e107 :: getDb ();
$ns = e107 :: getRender ();
$tp = e107 :: getParser ();
$frm = e107 :: getForm ();
2006-12-02 04:36:16 +00:00
$gen = new convert ;
2013-02-25 00:59:26 -08:00
$count = $sql -> select ( " gsitemap " , " * " , " gsitemap_id !=0 ORDER BY gsitemap_order ASC " );
2006-12-02 04:36:16 +00:00
if ( ! $count )
{
2012-12-08 15:52:40 +01:00
$text = "
2006-12-02 04:36:16 +00:00
< form action = '".e_SELF."?import' id = 'import' method = 'post' >
2012-11-27 21:13:34 -08:00
" .GSLAN_39. " < br />< br /> "
. $frm -> admin_button ( 'import' , LAN_YES , 'submit' ) . "
2006-12-02 04:36:16 +00:00
</ form > " ;
2012-11-27 21:13:34 -08:00
$mes -> addInfo ( $text );
2015-01-31 01:09:25 -08:00
$ns -> tablerender ( GSLAN_24 , $mes -> render ());
2013-02-25 00:59:26 -08:00
return ;
2006-12-02 04:36:16 +00:00
}
else
{
2012-11-27 21:13:34 -08:00
$text = "
2006-12-02 04:36:16 +00:00
< form action = '".e_SELF."' id = 'display' method = 'post' >
2012-11-26 14:41:32 -08:00
< table class = 'table adminlist' >
2009-07-01 05:10:23 +00:00
< colgroup span = '2' >
< col style = 'width:5%' />
< col style = 'width:10%' />
2009-07-17 07:53:13 +00:00
< col style = 'width:35%' />
2009-07-01 05:10:23 +00:00
< col style = 'width:20%' />
< col style = 'width:10%' />
< col style = 'width:10%' />
2009-07-17 07:53:13 +00:00
< col style = 'width:10%' />
2009-07-01 05:10:23 +00:00
</ colgroup >
< thead >
< tr class = 'first last' >
< th style = 'text-align: center;' > Id </ th >
2013-02-25 00:59:26 -08:00
< th > " .LAN_NAME. " </ th >
< th > " .LAN_URL. " </ th >
2009-07-01 05:10:23 +00:00
< th style = 'text-align: center' > " .GSLAN_27. " </ th >
< th style = 'text-align: center' > " .GSLAN_28. " </ th >
< th style = 'text-align: center' > " .GSLAN_9. " </ th >
< th style = 'text-align: center' > " .LAN_OPTIONS. " </ th >
</ tr >
</ thead >
< tbody >
2006-12-02 04:36:16 +00:00
" ;
$glArray = $sql -> db_getList ();
foreach ( $glArray as $row2 )
{
$datestamp = $gen -> convert_date ( $row2 [ 'gsitemap_lastmod' ], " short " );
2012-12-08 15:52:40 +01:00
$rowStyle = ( vartrue ( $rowStyle ) == " odd " ) ? " even " : " odd " ;
2006-12-02 04:36:16 +00:00
2009-07-01 05:10:23 +00:00
$text .= " <tr class=' { $rowStyle } '>
< td style = '; text-align: center;' > " . $row2['gsitemap_id'] . " </ td >
< td > " . $tp->toHTML ( $row2['gsitemap_name'] , " " , " defs " ). " </ td >
< td > " . $row2['gsitemap_url'] . " </ td >
< td style = '; text-align: center;' > " . $datestamp . " </ td >
< td style = '; text-align: center;' > " . $this->freq_list [( $row2['gsitemap_freq'] )]. " </ td >
< td style = '; text-align: center;' > " . $row2['gsitemap_priority'] . " </ td >
2006-12-02 04:36:16 +00:00
2009-07-01 05:10:23 +00:00
< td class = 'center' style = 'white-space:nowrap' >
2006-12-02 04:36:16 +00:00
< div >
2014-01-23 04:38:48 -08:00
< button class = 'btn btn-default' type = 'submit' name = 'edit[{$row2[' gsitemap_id ']}]' value = 'edit' src = '".ADMIN_EDIT_ICON_PATH."' alt = '".LAN_EDIT."' title = '".LAN_EDIT."' style = 'border:0px' />
< button class = 'btn btn-default action delete' type = 'submit' name = 'delete[{$row2[' gsitemap_id ']}]' value = 'del' data - confirm = '".$tp->toJS(LAN_CONFIRMDEL." [".$row2[' gsitemap_name ']."]")."' title = '".LAN_DELETE."' > " .ADMIN_DELETE_ICON. " </ button >
2006-12-02 04:36:16 +00:00
</ div >
</ td >
</ tr >
" ;
}
}
2012-11-27 21:13:34 -08:00
$text .= " </tbody></table> \n </form> " ;
$ns -> tablerender ( GSLAN_24 , $mes -> render () . $text );
2006-12-02 04:36:16 +00:00
}
function editSme ()
{
2012-11-27 21:13:34 -08:00
$sql = e107 :: getDb ();
$tp = e107 :: getParser ();
2006-12-02 04:36:16 +00:00
$e_idt = array_keys ( $_POST [ 'edit' ]);
2013-02-25 00:59:26 -08:00
if ( $sql -> select ( " gsitemap " , " * " , " gsitemap_id=' " . $e_idt [ 0 ] . " ' " ))
2006-12-02 04:36:16 +00:00
{
$foo = $sql -> db_Fetch ();
$foo [ 'gsitemap_name' ] = $tp -> toFORM ( $foo [ 'gsitemap_name' ]);
$foo [ 'gsitemap_url' ] = $tp -> toFORM ( $foo [ 'gsitemap_url' ]);
$this -> doForm ( $foo );
}
}
2008-12-20 21:48:06 +00:00
2006-12-02 04:36:16 +00:00
function doForm ( $editArray = FALSE )
{
2012-11-27 21:13:34 -08:00
$frm = e107 :: getForm ();
$sql = e107 :: getDb ();
$ns = e107 :: getRender ();
$mes = e107 :: getMessage ();
2013-02-25 00:59:26 -08:00
$count = $sql -> select ( " gsitemap " , " * " , " gsitemap_id !=0 ORDER BY gsitemap_id ASC " );
2012-11-27 21:13:34 -08:00
2006-12-02 04:36:16 +00:00
$text = "
< form action = '".e_SELF."' id = 'form' method = 'post' >
2012-11-27 21:13:34 -08:00
< table class = 'table adminform' >
2013-03-04 13:08:52 +01:00
< colgroup span = '2' >
< col class = 'col-label' />
< col class = 'col-control' />
</ colgroup >
2006-12-02 04:36:16 +00:00
< tr >
2013-03-04 13:08:52 +01:00
< td > " .LAN_NAME. " </ td >
< td > " . $frm->text ('gsitemap_name', $editArray['gsitemap_name'] , '100', array('class' => 'tbox input-text span3')). " </ td >
2006-12-02 04:36:16 +00:00
</ tr >
< tr >
2013-03-04 13:08:52 +01:00
< td > " .LAN_URL. " </ td >
< td > " . $frm->text ('gsitemap_url', $editArray['gsitemap_url'] , '100', array('class' => 'tbox input-text span3')). "
< input class = 'tbox' type = 'hidden' name = 'gsitemap_lastmod' size = '40' value = '".time()."' maxlength = '100' /></ td >
2006-12-02 04:36:16 +00:00
</ tr >
< tr >
2013-03-04 13:08:52 +01:00
< td > " .GSLAN_10. " </ td >
< td >
< select class = 'tbox' name = 'gsitemap_freq' > \n " ;
foreach ( $this -> freq_list as $k => $fq )
{
$sel = ( $editArray [ 'gsitemap_freq' ] == $k ) ? " selected='selected' " : " " ;
$text .= " <option value=' $k ' $sel > " . $fq . " </option> \n " ;
}
2006-12-02 04:36:16 +00:00
2013-03-04 13:08:52 +01:00
$text .= " </select>
</ td >
2006-12-02 04:36:16 +00:00
</ tr >
< tr >
2013-03-04 13:08:52 +01:00
< td > " .GSLAN_9. " </ td >
< td >
< select class = 'tbox' name = 'gsitemap_priority' > \n " ;
2006-12-02 04:36:16 +00:00
2013-03-04 13:08:52 +01:00
for ( $i = 0.1 ; $i < 1.0 ; $i = $i + 0.1 )
{
$sel = ( $editArray [ 'gsitemap_priority' ] == number_format ( $i , 1 )) ? " selected='selected' " : " " ;
$text .= " <option value=' " . number_format ( $i , 1 ) . " ' $sel > " . number_format ( $i , 1 ) . " </option> \n " ;
};
2006-12-02 04:36:16 +00:00
2013-03-04 13:08:52 +01:00
$text .= " </select></td>
2006-12-02 04:36:16 +00:00
</ tr >
< tr >
2013-03-04 13:08:52 +01:00
< td > " .LAN_ORDER. " </ td >
< td >< select name = 'gsitemap_order' class = 'tbox' > " ;
2006-12-02 04:36:16 +00:00
2013-03-04 13:08:52 +01:00
for ( $i = 0 ; $i < $count ; $i ++ ){
$text .= $editArray [ 'gsitemap_order' ] == $i ? " <option value=' " . $i . " ' selected='selected'> " . $i . " </option> " : " <option value=' " . $i . " '> " . $i . " </option> " ;
}
$text .= " </select>
2006-12-02 04:36:16 +00:00
</ td >
</ tr >
< tr >
2013-03-04 13:08:52 +01:00
< td > " .LAN_VISIBILITY. " </ td >
< td > " .r_userclass( " gsitemap_active " , $editArray['gsitemap_active'] , 'off', " nobody , public , guest , member , admin , classes , language " ). " </ td >
2006-12-02 04:36:16 +00:00
</ tr >
2012-11-27 21:13:34 -08:00
</ table >
< div class = 'buttons-bar center' > " ;
2006-12-02 04:36:16 +00:00
if ( is_array ( $editArray ))
{
2012-11-27 21:13:34 -08:00
$text .= $frm -> admin_button ( 'add_link' , LAN_UPDATE , 'update' ) . "
2006-12-02 04:36:16 +00:00
< input type = 'hidden' name = 'gsitemap_id' value = '".$editArray[' gsitemap_id ']."' /> " ;
}
else
{
2012-11-27 21:13:34 -08:00
$text .= $frm -> admin_button ( 'add_link' , LAN_CREATE , 'create' );
2006-12-02 04:36:16 +00:00
}
2012-11-27 21:13:34 -08:00
$text .= " </div>
2006-12-02 04:36:16 +00:00
</ form >
" ;
2012-11-27 21:13:34 -08:00
$ns -> tablerender ( GSLAN_29 , $mes -> render () . $text );
2006-12-02 04:36:16 +00:00
}
2008-12-20 21:48:06 +00:00
2006-12-02 04:36:16 +00:00
function addLink ()
{
2012-11-27 21:13:34 -08:00
$log = e107 :: getAdminLog ();
$sql = e107 :: getDb ();
$tp = e107 :: getParser ();
2008-12-20 21:48:06 +00:00
$gmap = array (
'gsitemap_name' => $tp -> toDB ( $_POST [ 'gsitemap_name' ]),
'gsitemap_url' => $tp -> toDB ( $_POST [ 'gsitemap_url' ]),
'gsitemap_priority' => $_POST [ 'gsitemap_priority' ],
'gsitemap_lastmod' => $_POST [ 'gsitemap_lastmod' ],
'gsitemap_freq' => $_POST [ 'gsitemap_freq' ],
'gsitemap_order' => $_POST [ 'gsitemap_order' ],
'gsitemap_active' => $_POST [ 'gsitemap_active' ]
);
2006-12-02 04:36:16 +00:00
if ( isset ( $_POST [ 'gsitemap_id' ]))
{
2008-12-20 21:48:06 +00:00
$this -> message = $sql -> db_UpdateArray ( " gsitemap " , $gmap , ' WHERE gsitemap_id= ' . intval ( $_POST [ 'gsitemap_id' ])) ? LAN_UPDATED : LAN_UPDATED_FAILED ;
2012-11-27 21:13:34 -08:00
$log -> logArrayAll ( 'GSMAP_04' , $gmap );
2006-12-02 04:36:16 +00:00
}
else
{
2008-12-20 21:48:06 +00:00
$gmap [ 'gsitemap_img' ] = $_POST [ 'gsitemap_img' ];
$gmap [ 'gsitemap_cat' ] = $_POST [ 'gsitemap_cat' ];
$this -> message = ( $sql -> db_Insert ( 'gsitemap' , $gmap )) ? LAN_CREATED : LAN_CREATED_FAILED ;
2012-11-27 21:13:34 -08:00
$log -> logArrayAll ( 'GSMAP_03' , $gmap );
2006-12-02 04:36:16 +00:00
}
}
function deleteSme ()
{
2012-11-27 21:13:34 -08:00
$log = e107 :: getAdminLog ();
$sql = e107 :: getDb ();
2006-12-02 04:36:16 +00:00
$d_idt = array_keys ( $_POST [ 'delete' ]);
$this -> message = ( $sql -> db_Delete ( " gsitemap " , " gsitemap_id=' " . $d_idt [ 0 ] . " ' " )) ? LAN_DELETED : LAN_DELETED_FAILED ;
2012-11-27 21:13:34 -08:00
$log -> log_event ( 'GSMAP_02' , $this -> message . ': ' . $d_idt [ 0 ], E_LOG_INFORMATIVE , '' );
2006-12-02 04:36:16 +00:00
}
2008-12-20 21:48:06 +00:00
// Import site links
2006-12-02 04:36:16 +00:00
function importSme ()
{
2012-11-27 21:13:34 -08:00
global $PLUGINS_DIRECTORY ;
$ns = e107 :: getRender ();
$sql = e107 :: getDb ();
$sql2 = e107 :: getDb ( 'sql2' );
$frm = e107 :: getForm ();
$mes = e107 :: getMessage ();
2015-01-28 11:42:29 -08:00
$existing = array ();
$sql -> select ( " gsitemap " , " * " );
while ( $row = $sql -> fetch ())
{
$existing [] = $row [ 'gsitemap_name' ];
}
2012-11-27 21:13:34 -08:00
2006-12-02 04:36:16 +00:00
$importArray = array ();
/* sitelinks ... */
2013-02-25 00:59:26 -08:00
$sql -> select ( " links " , " * " , " ORDER BY link_order ASC " , " no-where " );
2006-12-02 04:36:16 +00:00
$nfArray = $sql -> db_getList ();
foreach ( $nfArray as $row )
{
2015-01-28 11:42:29 -08:00
if ( ! in_array ( $row [ 'link_name' ], $existing ))
2006-12-02 04:36:16 +00:00
{
$importArray [] = array ( 'name' => $row [ 'link_name' ], 'url' => $row [ 'link_url' ], 'type' => GSLAN_1 );
}
}
/* custom pages ... */
2015-01-28 11:42:29 -08:00
$query = " SELECT p.page_id, p.page_title, p.page_sef, p.page_chapter, ch.chapter_sef as chapter_sef, b.chapter_sef as book_sef FROM #page as p
LEFT JOIN #page_chapters as ch ON p.page_chapter = ch.chapter_id
LEFT JOIN #page_chapters as b ON ch.chapter_parent = b.chapter_id
WHERE page_title != '' ORDER BY page_datestamp ASC " ;
$data = $sql -> retrieve ( $query , true );
foreach ( $data as $row )
2006-12-02 04:36:16 +00:00
{
2015-01-28 11:42:29 -08:00
if ( ! in_array ( $row [ 'page_title' ], $existing ))
2006-12-02 04:36:16 +00:00
{
2015-01-28 11:42:29 -08:00
$route = ( $row [ 'page_chapter' ] == 0 ) ? " page/view/other " : " page/view/index " ;
$importArray [] = array ( 'name' => $row [ 'page_title' ], 'url' => e107 :: getUrl () -> create ( $route , $row , array ( 'full' => 1 , 'allow' => 'page_sef,page_title,page_id, chapter_sef, book_sef' )), 'type' => " Page " );
2006-12-02 04:36:16 +00:00
}
}
/* forums ... */
2008-12-20 21:48:06 +00:00
if ( plugInstalled ( 'forum' ))
{
2013-02-25 00:59:26 -08:00
$sql -> select ( " forum " , " * " , " forum_parent!='0' ORDER BY forum_order ASC " );
2008-12-20 21:48:06 +00:00
$nfArray = $sql -> db_getList ();
foreach ( $nfArray as $row )
2006-12-02 04:36:16 +00:00
{
2015-01-28 11:42:29 -08:00
if ( ! in_array ( $row [ 'forum_name' ], $existing ))
2008-12-20 21:48:06 +00:00
{
2013-04-28 15:33:17 +03:00
$importArray [] = array ( 'name' => $row [ 'forum_name' ], 'url' => e107 :: getUrl () -> create ( 'forum/forum/view' , $row [ 'forum_id' ]), 'type' => " Forum " );
2008-12-20 21:48:06 +00:00
}
2006-12-02 04:36:16 +00:00
}
}
2013-04-28 15:33:17 +03:00
/* DEPRECATED content pages ...
2008-12-20 21:48:06 +00:00
if ( plugInstalled ( 'content' ))
{
2013-02-25 00:59:26 -08:00
$sql -> select ( " pcontent " , " content_id, content_heading " , " LEFT(content_parent,1) = '0' ORDER BY content_heading " );
2008-12-20 21:48:06 +00:00
$nfArray = $sql -> db_getList ();
foreach ( $nfArray as $row )
2006-12-02 04:36:16 +00:00
{
2013-02-25 00:59:26 -08:00
$sql2 -> select ( " pcontent " , " content_id, content_heading " , " content_parent = ' " . $row [ 'content_id' ] . " ' AND content_refer != 'sa' ORDER BY content_heading " );
2008-12-20 21:48:06 +00:00
$nfArray2 = $sql2 -> db_getList ();
foreach ( $nfArray2 as $row2 )
2006-12-02 04:36:16 +00:00
{
2013-02-25 00:59:26 -08:00
if ( ! $sql -> select ( " gsitemap " , " * " , " gsitemap_name=' " . $row2 [ 'content_heading' ] . " ' " ))
2008-12-20 21:48:06 +00:00
{
$importArray [] = array ( 'name' => $row2 [ 'content_heading' ], 'url' => $PLUGINS_DIRECTORY . " content/content.php?content. " . $row2 [ 'content_id' ], 'type' => $row [ 'content_heading' ]);
}
2006-12-02 04:36:16 +00:00
}
}
}
2013-04-28 15:33:17 +03:00
*/
2006-12-02 04:36:16 +00:00
$text = "
< form action = '".e_SELF."' id = 'form' method = 'post' >
2012-11-27 21:13:34 -08:00
< table class = 'table adminlist' >
< colgroup >
< col class = 'center' style = 'width:5%;' />
< col style = 'width:15%' />
< col style = 'width:40%' />
< col style = 'width:40%' />
</ colgroup >
< thead >
2013-03-04 13:08:52 +01:00
< tr >
< td > " .GSLAN_2. " </ td >
< td > " .LAN_TYPE. " </ td >
< td > " .LAN_NAME. " </ td >
< td > " .LAN_URL. " </ td >
2006-12-02 04:36:16 +00:00
</ tr >
2012-11-27 21:13:34 -08:00
</ thead >
< tbody >
2006-12-02 04:36:16 +00:00
" ;
foreach ( $importArray as $ia )
{
$text .= "
< tr >
2013-03-04 13:08:52 +01:00
< td >< input type = 'checkbox' name = 'importid[]' value = '".$ia[' name ']."^".$ia[' url ']."^".$ia[' type ']."' /></ td >
< td > " . $ia['type'] . " </ td >
< td > " . $ia['name'] . " </ td >
< td >< span class = 'smalltext' > " .str_replace(SITEURL, " " , $ia['url'] ). " </ span ></ td >
2006-12-02 04:36:16 +00:00
</ tr >
" ;
}
$text .= "
< tr >
2012-11-27 21:13:34 -08:00
< td colspan = '4' class = 'center' >
2006-12-02 04:36:16 +00:00
< div > " .GSLAN_8. " & nbsp ; " .GSLAN_9. " :& nbsp ; < select class = 'tbox' name = 'import_priority' > \n " ;
2008-12-20 21:48:06 +00:00
for ( $i = 0.1 ; $i < 1.0 ; $i = $i + 0.1 )
{
2012-12-08 15:52:40 +01:00
$sel = ( vartrue ( $editArray [ 'gsitemap_priority' ]) == number_format ( $i , 1 )) ? " selected='selected' " : " " ;
2006-12-02 04:36:16 +00:00
$text .= " <option value=' " . number_format ( $i , 1 ) . " ' $sel > " . number_format ( $i , 1 ) . " </option> \n " ;
};
$text .= " </select> " . GSLAN_10 . "
< select class = 'tbox' name = 'import_freq' > \n " ;
2008-12-20 21:48:06 +00:00
foreach ( $this -> freq_list as $k => $fq )
{
2012-12-08 15:52:40 +01:00
$sel = ( vartrue ( $editArray [ 'gsitemap_freq' ]) == $k ) ? " selected='selected' " : " " ;
2008-12-20 21:48:06 +00:00
$text .= " <option value=' { $k } ' { $sel } > { $fq } </option> \n " ;
2006-12-02 04:36:16 +00:00
}
$text .= " </select> <br /><br />
</ div >
2012-11-27 21:13:34 -08:00
2006-12-02 04:36:16 +00:00
</ td >
</ tr >
2012-11-27 21:13:34 -08:00
</ tbody >
2006-12-02 04:36:16 +00:00
</ table >
2012-11-27 21:13:34 -08:00
< div class = 'buttons-bar center' >
" .
$frm -> admin_button ( 'import_links' , GSLAN_18 , 'submit' ) . "
</ div >
2006-12-02 04:36:16 +00:00
</ form >
" ;
2012-11-27 21:13:34 -08:00
$ns -> tablerender ( GSLAN_7 , $mes -> render () . $text );
2006-12-02 04:36:16 +00:00
}
2008-12-20 21:48:06 +00:00
2006-12-02 04:36:16 +00:00
function importLink ()
{
2012-11-27 21:13:34 -08:00
$sql = e107 :: getDb ();
$tp = e107 :: getParser ();
$log = e107 :: getAdminLog ();
2006-12-02 04:36:16 +00:00
foreach ( $_POST [ 'importid' ] as $import )
{
list ( $name , $url , $type ) = explode ( " ^ " , $import );
$name = $tp -> toDB ( $name );
$url = $tp -> toDB ( $url );
$sql -> db_Insert ( " gsitemap " , " 0, ' $name ', ' $url ', ' " . time () . " ', ' " . $_POST [ 'import_freq' ] . " ', ' " . $_POST [ 'import_priority' ] . " ', ' $type ', '0', '', '0' " );
}
$this -> message = count ( $_POST [ 'importid' ]) . " link(s) imported. " ;
2012-11-27 21:13:34 -08:00
$log -> log_event ( 'GSMAP_01' , $this -> message , E_LOG_INFORMATIVE , '' );
2006-12-02 04:36:16 +00:00
}
2008-12-20 21:48:06 +00:00
2006-12-02 04:36:16 +00:00
function instructions ()
{
2012-11-27 21:13:34 -08:00
$mes = e107 :: getMessage ();
$ns = e107 :: getRender ();
2010-07-24 01:22:31 +00:00
$LINK_1 = " https://www.google.com/accounts/ServiceLogin?service=sitemaps " ;
$LINK_2 = " http://www.google.com/support/webmasters/?hl=en " ;
$srch [ 0 ] = " [URL] " ;
$repl [ 0 ] = " <a href=' " . $LINK_1 . " '> " . $LINK_1 . " </a> " ;
$srch [ 1 ] = " [URL2] " ;
$repl [ 1 ] = " <blockquote><b> " . SITEURL . " gsitemap.php</b></blockquote> " ;
$srch [ 2 ] = " [ " ;
$repl [ 2 ] = " <a href=' " . e_ADMIN . " prefs.php'> " ;
$srch [ 3 ] = " ] " ;
$repl [ 3 ] = " </a> " ;
2006-12-02 04:36:16 +00:00
$text = " <b> " . GSLAN_33 . " </b><br /><br />
< ul >
2013-03-04 13:08:52 +01:00
< li > " .GSLAN_34. " </ li >
< li > " .GSLAN_35. " </ li >
< li > " .GSLAN_36. " </ li >
< li > " .str_replace( $srch , $repl ,GSLAN_37). " </ li >
< li > " .str_replace( " [ URL ] " , " < a href = '".$LINK_2."' > " . $LINK_2 . " </ a > " ,GSLAN_38). " </ li >
2006-12-02 04:36:16 +00:00
< ul >
" ;
2012-11-27 21:13:34 -08:00
$ns -> tablerender ( GSLAN_32 , $mes -> render () . $text );
2006-12-02 04:36:16 +00:00
}
}
require_once ( e_ADMIN . " footer.php " );
2008-12-20 21:48:06 +00:00
function admin_config_adminmenu ()
{
2006-12-02 04:36:16 +00:00
$action = ( e_QUERY ) ? e_QUERY : " list " ;
$var [ 'list' ][ 'text' ] = GSLAN_20 ;
$var [ 'list' ][ 'link' ] = e_SELF ;
$var [ 'list' ][ 'perm' ] = " 7 " ;
$var [ 'instructions' ][ 'text' ] = GSLAN_21 ;
$var [ 'instructions' ][ 'link' ] = e_SELF . " ?instructions " ;
$var [ 'instructions' ][ 'perm' ] = " 7 " ;
$var [ 'new' ][ 'text' ] = GSLAN_22 ;
$var [ 'new' ][ 'link' ] = e_SELF . " ?new " ;
$var [ 'new' ][ 'perm' ] = " 7 " ;
$var [ 'import' ][ 'text' ] = GSLAN_23 ;
$var [ 'import' ][ 'link' ] = e_SELF . " ?import " ;
$var [ 'import' ][ 'perm' ] = " 0 " ;
2012-11-27 21:13:34 -08:00
2015-01-31 01:09:25 -08:00
show_admin_menu ( LAN_PLUGIN_GSITEMAP_NAME , $action , $var );
2006-12-02 04:36:16 +00:00
}
?>