2006-12-02 04:36:16 +00:00
< ? php
/*
2008-12-29 15:23:06 +00:00
* e107 website system
*
2010-01-04 21:35:38 +00:00
* Copyright ( C ) 2008 - 2010 e107 Inc ( e107 . org )
2008-12-29 15:23:06 +00:00
* Released under the terms and conditions of the
* GNU General Public License ( http :// www . gnu . org / licenses / gpl . txt )
*
* Custom Menus / Pages Administration
*
2011-12-09 02:08:04 +00:00
* $URL $
* $Id $
2008-12-29 15:23:06 +00:00
*
2006-12-02 04:36:16 +00:00
*/
2010-01-04 21:35:38 +00:00
/**
2010-04-17 03:17:48 +00:00
*
2010-01-04 21:35:38 +00:00
* @ package e107
* @ subpackage admin
2010-02-10 18:18:01 +00:00
* @ version $Revision $
* @ author $Author $
2006-12-02 04:36:16 +00:00
2010-01-04 21:35:38 +00:00
* Admin - related functions for custom page and menu creation
*/
require_once ( '../class2.php' );
2012-06-07 00:33:10 +00:00
if ( ! getperms ( " 5|J " )) { header ( 'location:' . e_ADMIN . 'admin.php' ); exit ; }
2006-12-02 04:36:16 +00:00
2012-08-11 11:15:05 +00:00
e107 :: css ( 'inline' , "
. e - wysiwyg { height : 400 px }
" );
2009-08-28 16:11:02 +00:00
include_lan ( e_LANGUAGEDIR . e_LANGUAGE . '/admin/lan_' . e_PAGE );
2006-12-02 04:36:16 +00:00
$e_sub_cat = 'custom' ;
2010-01-04 21:35:38 +00:00
require_once ( e_HANDLER . 'userclass_class.php' );
require_once ( e_HANDLER . 'message_handler.php' );
require_once ( e_HANDLER . 'form_handler.php' );
2008-12-29 15:23:06 +00:00
$frm = new e_form ( true );
2012-04-19 03:53:58 +00:00
$emessage = eMessage :: getInstance ();
2012-05-31 06:07:33 +00:00
2012-04-19 03:53:58 +00:00
// $page = new page;
2008-12-29 15:23:06 +00:00
2012-04-19 03:53:58 +00:00
/*
2006-12-02 04:36:16 +00:00
if ( e_QUERY )
{
$tmp = explode ( " . " , e_QUERY );
$action = $tmp [ 0 ];
2008-12-29 15:23:06 +00:00
$sub_action = varset ( $tmp [ 1 ]);
$id = intval ( varset ( $tmp [ 2 ], 0 ));
$from = intval ( varset ( $tmp [ 3 ], 0 ));
2006-12-02 04:36:16 +00:00
}
2012-04-19 03:53:58 +00:00
*/
2006-12-02 04:36:16 +00:00
2012-04-19 03:53:58 +00:00
/*
2009-11-19 12:36:22 +00:00
if ( isset ( $_POST [ 'delete' ]) || varset ( $_POST [ 'etrigger_delete' ]))
2006-12-02 04:36:16 +00:00
{
2009-11-19 12:36:22 +00:00
if ( $_POST [ 'etrigger_delete' ])
{
2010-04-17 03:17:48 +00:00
$delArray = array_keys ( $_POST [ 'etrigger_delete' ]);
2009-11-19 12:36:22 +00:00
}
else
{
$delArray = array_keys ( $_POST [ 'delete' ]);
}
2010-04-17 03:17:48 +00:00
2009-11-19 12:36:22 +00:00
foreach ( $delArray as $pid )
2006-12-02 04:36:16 +00:00
{
2008-12-29 15:23:06 +00:00
$page -> delete_page ( $pid );
2006-12-02 04:36:16 +00:00
}
}
2012-04-19 03:53:58 +00:00
*/
2006-12-02 04:36:16 +00:00
2012-04-19 03:53:58 +00:00
/*
2006-12-02 04:36:16 +00:00
if ( ! e_QUERY )
{
2010-01-04 21:35:38 +00:00
if ( getperms ( '5' ))
2009-08-05 14:22:15 +00:00
{
$page -> showExistingPages ();
}
else
{
$page -> showExistingPages ( 'menus' );
}
2006-12-02 04:36:16 +00:00
}
2010-01-04 21:35:38 +00:00
elseif ( varset ( $_GET [ 'action' ], '' ) == 'edit' )
2009-11-19 12:36:22 +00:00
{
$action = 'create' ;
$sub_action = 'edit' ;
2009-11-25 11:54:53 +00:00
$id = intval ( $_GET [ 'id' ]);
$mod = ( vartrue ( $_GET [ 'menus' ])) ? 'menus' : " " ;
2010-04-17 03:17:48 +00:00
$page -> createPage ( $mod );
2009-11-25 11:01:12 +00:00
}
elseif ( vartrue ( $_GET [ 'menus' ]))
{
2010-04-17 03:17:48 +00:00
$page -> menusPage ();
2009-11-19 12:36:22 +00:00
}
2006-12-02 04:36:16 +00:00
else
{
2010-01-04 21:35:38 +00:00
$function = $action . 'Page' ;
2008-12-29 15:23:06 +00:00
$page -> $function ();
2006-12-02 04:36:16 +00:00
}
2012-04-19 03:53:58 +00:00
*/
class page_admin extends e_admin_dispatcher
{
protected $modes = array (
2012-05-22 04:38:28 +00:00
'page' => array (
2012-04-19 03:53:58 +00:00
'controller' => 'page_admin_ui' ,
'path' => null ,
'ui' => 'page_admin_form_ui' ,
'uipath' => null
2012-05-22 04:38:28 +00:00
),
'menu' => array (
'controller' => 'page_admin_ui' ,
'path' => null ,
'ui' => 'page_admin_form_ui' ,
'uipath' => null
2012-05-31 06:07:33 +00:00
),
'dialog' => array (
'controller' => 'page_admin_ui' ,
'path' => null ,
'ui' => 'page_admin_form_ui' ,
'uipath' => null
)
2012-04-19 03:53:58 +00:00
);
2012-05-22 04:38:28 +00:00
2012-04-19 03:53:58 +00:00
protected $adminMenu = array (
2012-05-22 04:38:28 +00:00
'page/list' => array ( 'caption' => CUSLAN_48 , 'perm' => '5' ),
'menu/list' => array ( 'caption' => CUSLAN_49 , 'perm' => 'J' ),
'page/create' => array ( 'caption' => CUSLAN_12 , 'perm' => '5' ),
'menu/create' => array ( 'caption' => CUSLAN_31 , 'perm' => 'J' ),
'page/options' => array ( 'caption' => LAN_OPTIONS , 'perm' => '0' )
2012-04-19 03:53:58 +00:00
);
protected $adminMenuAliases = array (
2012-05-22 04:38:28 +00:00
'page/edit' => 'page/list' ,
'menu/edit' => 'menu/list'
2012-04-19 03:53:58 +00:00
);
protected $menuTitle = 'Custom Pages' ;
}
class page_admin_form_ui extends e_admin_form_ui
{
2012-04-22 06:19:21 +00:00
function page_title ( $curVal , $mode , $parm )
2012-04-19 03:53:58 +00:00
{
2012-04-29 08:51:03 +00:00
if ( $mode == 'read' )
2012-04-22 06:19:21 +00:00
{
2012-04-29 08:51:03 +00:00
$id = $this -> getController () -> getListModel () -> get ( 'page_id' );
return " <a href=' " . e_BASE . " page.php? " . $id . " ' > " . $curVal . " </a> " ;
2012-04-22 06:19:21 +00:00
}
if ( $mode == 'write' )
{
return ;
}
if ( $mode == 'filter' )
2012-04-19 03:53:58 +00:00
{
2012-04-22 06:19:21 +00:00
return ;
2012-04-19 03:53:58 +00:00
}
2012-04-22 06:19:21 +00:00
if ( $mode == 'batch' )
{
return ;
}
}
2012-04-19 03:53:58 +00:00
}
class page_admin_ui extends e_admin_ui
{
protected $pluginTitle = ADLAN_42 ;
protected $pluginName = 'core' ;
protected $table = " page " ;
protected $listQry = " SELECT p.*,u.user_id,u.user_name FROM #page AS p LEFT JOIN #user AS u ON p.page_author = u.user_id WHERE p.page_theme = '' " ; // without any Order or Limit.
//protected $editQry = "SELECT * FROM #comments WHERE comment_id = {ID}";
protected $pid = " page_id " ;
protected $listOrder = 'p.page_id desc' ;
protected $perPage = 10 ;
protected $batchDelete = true ;
protected $batchCopy = true ;
protected $fields = array (
'checkboxes' => array ( 'title' => '' , 'type' => null , 'width' => '5%' , 'forced' => TRUE , 'thclass' => 'center' , 'class' => 'center' ),
'page_id' => array ( 'title' => 'ID' , 'width' => '5%' , 'forced' => TRUE ),
2012-07-15 03:01:30 +00:00
'page_title' => array ( 'title' => LAN_TITLE , 'type' => 'text' , 'width' => 'auto' , 'readParms' => 'link={e_BASE}page.php?[id]&dialog=1' ),
2012-04-19 03:53:58 +00:00
'page_theme' => array ( 'title' => CUSLAN_2 , 'type' => 'text' , 'width' => 'auto' , 'nolist' => true ),
'page_template' => array ( 'title' => 'Template' , 'type' => 'text' , 'width' => 'auto' ),
'page_author' => array ( 'title' => LAN_AUTHOR , 'type' => 'user' , 'width' => 'auto' , 'thclass' => 'left' ),
'page_datestamp' => array ( 'title' => LAN_DATE , 'type' => 'datestamp' , 'width' => 'auto' ),
'page_class' => array ( 'title' => LAN_USERCLASS , 'type' => 'userclass' , 'width' => 'auto' , 'filter' => true , 'batch' => true ),
'page_rating_flag' => array ( 'title' => LAN_RATING , 'type' => 'boolean' , 'width' => '10%' , 'thclass' => 'center' , 'class' => 'center' ),
'page_comment_flag' => array ( 'title' => ADLAN_114 , 'type' => 'boolean' , 'width' => '10%' , 'thclass' => 'center' , 'class' => 'center' ),
// 'page_password' => array('title'=> LAN_USER_05, 'type' => 'text', 'width' => 'auto'),
// 'page_ip_restrict' => array('title'=> LAN_USER_07, 'type' => 'text', 'width' => 'auto'), // Avatar
'options' => array ( 'title' => LAN_OPTIONS , 'type' => null , 'forced' => TRUE , 'width' => '10%' , 'thclass' => 'center last' , 'class' => 'center' )
);
protected $fieldpref = array ( " page_id " , " page_title " , " page_template " , " page_author " , " page_class " );
function init ()
{
2012-07-22 11:14:29 +00:00
if ( varset ( $_GET [ 'mode' ]) == 'dialog' && varset ( $_GET [ 'action' ]) == 'dialog' ) // New Page bbcode in tabs.
{
$this -> dialogPage ();
}
2012-05-31 06:07:33 +00:00
if ( $this -> getQuery ( 'iframe' ) == 1 )
{
$this -> getResponse () -> setIframeMod ();
}
2012-05-22 04:38:28 +00:00
//FIXME - mode not retained after using drop-down 'filter' or 'search'.
if ( $_GET [ 'mode' ] == 'menu' )
2012-04-19 03:53:58 +00:00
{
$this -> listQry = " SELECT p.*,u.user_id,u.user_name FROM #page AS p LEFT JOIN #user AS u ON p.page_author = u.user_id WHERE p.page_theme != '' " ; // without any Order or Limit.
}
if ( isset ( $_POST [ 'uploadfiles' ]))
{
$this -> uploadPage ();
$id = intval ( varset ( $_POST [ 'pe_id' ], 0 ));
$sub_action = ( $_POST [ 'pe_id' ]) ? " edit " : " " ;
$this -> createPage ( $_POST [ 'mode' ]);
}
if ( isset ( $_POST [ 'saveOptions' ]))
{
$this -> saveSettings ();
}
if ( isset ( $_POST [ 'submitPage' ]))
{
$this -> submitPage ();
}
if ( isset ( $_POST [ 'submitMenu' ]))
{
$this -> submitPage ( " " , TRUE );
}
if ( isset ( $_POST [ 'updateMenu' ]))
{
$this -> submitPage ( $_POST [ 'pe_id' ], TRUE );
}
if ( isset ( $_POST [ 'updatePage' ]))
{
$this -> submitPage ( $_POST [ 'pe_id' ]);
}
}
// Create Menu Page.
function createemPage ()
{
if ( ! getperms ( " J " )){ return ; }
$this -> createPage ( 'menu' );
}
2012-05-31 06:07:33 +00:00
function dialogPage () // FIXME - remove table-rendering when using 'return' ??
{
2012-07-22 11:14:29 +00:00
$count = varset ( $_GET [ 'count' ]);
2012-05-31 06:07:33 +00:00
$frm = e107 :: getForm ();
2012-08-11 05:00:50 +00:00
$text = " <fieldset id='page_ { $count } '> \n " ;
2012-05-31 06:07:33 +00:00
$text .= " <div>Title: " . $frm -> text ( 'page_subtitle[]' , '' , 250 ) . " </div> \n " ;
2012-08-11 05:00:50 +00:00
$text .= $frm -> bbarea ( 'data_' . ( intval ( $count )), '' , 'page' , 'page' , 'large' );
2012-05-31 06:07:33 +00:00
$text .= " </fieldset> " ;
2012-08-11 05:00:50 +00:00
// $text .= 'name='.$nm."<br />page=".$page."<br />help_mode=". $help_mod."<br />htlp_tagid=".$help_tagid."<br />size=".$size;
2012-05-31 06:07:33 +00:00
echo $text ;
exit ;
// return $text;
2012-07-23 02:25:17 +00:00
/*
< div class = 'bbcode large' >
*/
2012-05-31 06:07:33 +00:00
}
2012-04-19 03:53:58 +00:00
// Create Page Page.
function createPage ( $mode = FALSE )
{
/* mode: FALSE == page, mode: TRUE == menu */
2012-05-22 04:38:28 +00:00
if ( $_GET [ 'mode' ] == 'menu' )
{
$mode = TRUE ;
}
2012-04-19 03:53:58 +00:00
global $e107 , $e_userclass , $e_event ;
$frm = e107 :: getForm ();
$sql = e107 :: getDb ();
$tp = e107 :: getParser ();
$ns = e107 :: getRender ();
$mes = e107 :: getMessage ();
$id = intval ( $_GET [ 'id' ]);
$sub_action = $_GET [ 'action' ];
$edit = ( $sub_action == 'edit' );
$caption = ( ! $mode ? ( $edit ? CUSLAN_23 : CUSLAN_24 ) : ( $edit ? CUSLAN_25 : CUSLAN_26 ));
2012-05-22 04:38:28 +00:00
if ( $_GET [ 'action' ] == " edit " && ! isset ( $_POST [ 'preview' ]) && ! isset ( $_POST [ 'submit' ]))
2012-04-19 03:53:58 +00:00
{
//$url = e107::getUrl()->sc('page/view', $row, 'allow=page_id,page_title,page_sef');
//$query = "SELECT p.*,l.link_name,m.menu_name FROM #page AS p
$query = " SELECT p.* FROM #page AS p
LEFT JOIN #menus AS m ON m.menu_path='{$id}' WHERE p.page_id ='{$id}' LIMIT 1";
// FIXME - extremely bad
//LEFT JOIN #links AS l ON l.link_url='".$url."'
if ( $sql -> db_Select_gen ( $query ))
{
$row = $sql -> db_Fetch ();
$page_class = $row [ 'page_class' ];
$page_password = $row [ 'page_password' ];
$page_title = $tp -> toForm ( $row [ 'page_title' ]);
$page_rating_flag = $row [ 'page_rating_flag' ];
$page_comment_flag = $row [ 'page_comment_flag' ];
$page_display_authordate_flag = $row [ 'page_author' ];
$page_link = varset ( $row [ 'link_name' ], '' );
$data = $tp -> toForm ( $row [ 'page_text' ]);
$edit = TRUE ;
// $menu_name = $tp->toForm($row['menu_name']);
$menu_name = $tp -> toForm ( $row [ 'page_theme' ]);
}
}
else
{
$menu_name = '' ;
$page_title = '' ;
$data = '' ;
}
$e_qry = ( $mode ) ? 'menus=1' : '' ;
$text = "
< form method = 'post' action = '".e_SELF."?".$e_qry."' id = 'dataform' enctype = 'multipart/form-data' >
< fieldset id = 'core-cpage-create-general' >
< legend " .( $mode ? " class = 'e-hideme' " : " " ). " > " .CUSLAN_47. " </ legend >
2012-05-13 05:26:11 +00:00
< table class = 'adminedit' >
< colgroup >
2012-04-19 03:53:58 +00:00
< col class = 'col-label' />
< col class = 'col-control' />
</ colgroup >
< tbody >
" ;
if ( $mode ) // menu mode.
{
$text .= "
< tr >
< td > " .CUSLAN_7. " </ td >
< td > " . $frm->text ('menu_name', $menu_name , 50). " </ td >
</ tr >
" ;
}
else
{
// fixed - last parameter (allinfo) should be false as getLayout method is returning non-usable formatted array
$templates = e107 :: getLayouts ( '' , 'page' , 'front' , '' , false , false );
$text .= "
< tr >
< td > Template </ td >
< td > " . $frm->selectbox ('page_template', $templates , $row['page_template'] ) . " </ td >
</ tr >
" ;
}
$text .= "
< tr >
< td > " .CUSLAN_8. " </ td >
< td > " . $frm->text ('page_title', $page_title , 250). " </ td >
</ tr >
" ;
if ( ! $mode )
{
$text .= "
< tr >
< td > " .CUSLAN_3. " </ td >
< td > " . $frm->text ('page_sef', $row['page_sef'] , 250). " </ td >
</ tr >
" ;
$text .= "
< tr >
< td > " .CUSLAN_32. " </ td >
< td > " . $frm->text ('page_metakeys', $row['page_metakeys'] , 250). " </ td >
</ tr >
" ;
$text .= "
< tr >
< td > " .CUSLAN_11. " </ td >
2012-05-29 08:39:19 +00:00
< td > " . $frm->textarea ('page_metadscr', $row['page_metadscr'] , 1, 80, array(), 200). " </ td >
2012-04-19 03:53:58 +00:00
</ tr >
" ;
}
$text .= "
< tr >
< td > " .CUSLAN_9. " </ td >
< td >
" ;
2012-05-29 08:56:08 +00:00
$text .= " <div id='tab-container' class='admintabs e-tabs'> " ;
2012-05-29 08:39:19 +00:00
$data = $tp -> toForm ( $data , FALSE , TRUE ); // Make sure we convert HTML tags to entities
2012-04-19 03:53:58 +00:00
2012-05-29 08:39:19 +00:00
$textareaValue = ( strstr ( $data , " [img]http " ) ? $data : str_replace ( " [img]../ " , " [img] " , $data ));
2012-04-19 03:53:58 +00:00
2012-07-09 01:54:43 +00:00
$text .= $this -> bbareaMulti ( 'data' , $textareaValue , 'page' , 'page' , 'large' );
2012-05-29 08:56:08 +00:00
$text .= " </div> " ;
2012-05-31 06:07:33 +00:00
2012-05-29 08:39:19 +00:00
// $text .= $frm->bbarea('data', $textareaValue, 'page','help','large');
2012-04-19 03:53:58 +00:00
2012-05-31 06:07:33 +00:00
2012-04-19 03:53:58 +00:00
// $text .= "<textarea class='e-wysiwyg tbox' tabindex='".$frm->getNext()."' id='data' name='data' cols='80'{$insertjs}>".(strstr($data, "[img]http") ? $data : str_replace("[img]../", "[img]", $data))."</textarea>";
// <br />".display_help('cpage-help', 'cpage')."
2012-05-22 04:38:28 +00:00
/*
2012-04-19 03:53:58 +00:00
$text .= " </td>
</ tr >
< tr >
< td class = 'label' > " .LAN_UPLOAD_IMAGES. " </ td >
< td class = 'control' > " . $tp->parseTemplate ( " { UPLOADFILE = " .e_IMAGE. " custom / } " ). " </ td >
</ tr >
" ;
2012-05-22 04:38:28 +00:00
*/
2012-04-19 03:53:58 +00:00
if ( ! $mode )
{
$text .= "
</ tbody >
</ table >
</ fieldset >
< fieldset id = 'core-cpage-create-options' >
< legend > " .LAN_OPTIONS. " </ legend >
2012-05-13 05:26:11 +00:00
< table class = 'adminedit options' >
< colgroup >
2012-04-19 03:53:58 +00:00
< col class = 'col-label' />
< col class = 'col-control' />
</ colgroup >
< tbody >
< tr >
< td class = 'label' > " .CUSLAN_10. " </ td >
< td class = 'control' >
" . $frm->radio_switch ('page_rating_flag', $page_rating_flag ). "
</ td >
</ tr >
< tr >
< td class = 'label' > " .CUSLAN_13. " </ td >
< td class = 'control' >
" . $frm->radio_switch ('page_comment_flag', $page_comment_flag ). "
</ td >
</ tr >
< tr >
< td class = 'label' > " .CUSLAN_41. " </ td >
< td class = 'control' >
" . $frm->radio_switch ('page_display_authordate_flag', $page_display_authordate_flag ). "
</ td >
</ tr >
< tr >
< td class = 'label' > " .CUSLAN_14. " </ td >
< td class = 'control' >
" . $frm->text ('page_password', $page_password , 50). "
< div class = 'field-help' > " .CUSLAN_15. " </ div >
</ td >
</ tr >
< tr >
< td class = 'label' > " .CUSLAN_18. " </ td >
< td class = 'control' >
" . $e_userclass->uc_dropdown ('page_class', $page_class , 'public,guest,nobody,member,main,admin,classes', " tabindex = '".$frm->getNext()."' " ). "
</ td >
</ tr >
" ;
/*
< tr >
< td class = 'label' > " .CUSLAN_16. " </ td >
< td class = 'control' >
" . $frm->text ('page_link', $page_link , 50). "
< div class = 'field-help' > " .CUSLAN_17. " </ div >
</ td >
</ tr >
**/
//triggerHook
$data = array ( 'method' => 'form' , 'table' => 'page' , 'id' => $id , 'plugin' => 'page' , 'function' => 'createPage' );
$hooks = $e_event -> triggerHook ( $data );
if ( ! empty ( $hooks ))
{
$text .= "
</ tbody >
</ table >
</ fieldset >
< fieldset id = 'core-cpage-create-hooks' >
< legend > " .LAN_HOOKS. " </ legend >
2012-05-13 05:26:11 +00:00
< table class = 'adminedit options' >
< colgroup >
2012-04-19 03:53:58 +00:00
< col class = 'col-label' />
< col class = 'col-control' />
</ colgroup >
< tbody > " ;
foreach ( $hooks as $hook )
{
if ( ! empty ( $hook ))
{
$text .= "
< tr >
< td class = 'label' > " . $hook['caption'] . " </ td >
< td class = 'control' > " . $hook['text'] . " </ td >
</ tr > " ;
}
}
}
}
$text .= "
</ tbody >
</ table >
< div class = 'buttons-bar center' >
" .
( ! $mode ?
( $edit ? $frm -> admin_button ( 'updatePage' , CUSLAN_19 , 'update' ) . " <input type='hidden' name='pe_id' value=' { $id } ' /> " : $frm -> admin_button ( 'submitPage' , CUSLAN_20 , 'create' )) :
( $edit ? $frm -> admin_button ( 'updateMenu' , CUSLAN_21 , 'update' ) . " <input type='hidden' name='pe_id' value=' { $id } ' /> " : $frm -> admin_button ( 'submitMenu' , CUSLAN_22 , 'create' )))
. "
< input type = 'hidden' name = 'mode' value = '{$mode}' />
</ div >
</ fieldset >
</ form >
" ;
// $ns->tablerender($caption, $text);
echo $mes -> render () . $text ;
}
2012-05-29 08:39:19 +00:00
// bbarea($name, $value, $help_mod = '', $help_tagid='', $size = 'large', $counter = false)
function bbareaMulti ( $name , $textareaValue , $help_mod = '' , $help_tagid = '' , $size = 'large' , $counter = false )
{
2012-07-09 01:54:43 +00:00
// $name = $name."[]";
2012-05-29 08:39:19 +00:00
$frm = e107 :: getForm ();
if ( ! $textareaValue )
{
$textareaValue = " [newpage] " ;
}
if ( preg_match_all ( " / \ [newpage=?(.*?) \ ]/si " , $textareaValue , $pt ))
{
}
$pages = preg_split ( " / \ [newpage(.*?) \ ]/si " , $textareaValue , - 1 , PREG_SPLIT_NO_EMPTY );
2012-08-11 05:00:50 +00:00
$c = 1 ;
2012-05-29 08:39:19 +00:00
$titles [ 0 ] = " " ;
2012-08-11 05:00:50 +00:00
2012-05-29 08:56:08 +00:00
$text .= " <ul class='e-tabs'> " ;
2012-05-29 08:39:19 +00:00
foreach ( $pages as $page )
{
$id = " #page_ " . $c ;
2012-08-11 05:00:50 +00:00
$pageCap = " Page " . ( $c );
2012-08-11 11:15:05 +00:00
$text .= " <li><a href=' { $id } ' > { $pageCap } </a></li> " ;
2012-05-29 08:39:19 +00:00
$c ++ ;
}
$text .= " </ul> " ;
2012-08-11 05:00:50 +00:00
$c = 1 ;
foreach ( $pages as $curval )
2012-05-29 08:39:19 +00:00
{
2012-08-11 05:00:50 +00:00
$titles [] = isset ( $pt [ 1 ][( $c - 1 )]) ? $pt [ 1 ][( $c - 1 )] : " " ;
2012-05-29 08:39:19 +00:00
$id = " page_ " . $c ;
2012-07-09 01:54:43 +00:00
$nm = $name . " _ " . $c ;
2012-05-29 08:56:08 +00:00
$text .= " <fieldset id=' { $id } '> \n " ;
2012-08-11 05:00:50 +00:00
$text .= " <div>Title: " . $frm -> text ( 'page_subtitle[' . $c . ']' , $titles [( $c )], 250 ) . " </div> \n " ;
$text .= $frm -> bbarea ( $nm , $curval , $help_mod , $help_tagid , $size , $counter );
2012-08-11 11:15:05 +00:00
2012-05-29 08:56:08 +00:00
$text .= " </fieldset> " ;
2012-08-11 11:15:05 +00:00
2012-08-11 05:00:50 +00:00
// $text .= 'name='.$nm."<br />page=".$page."<br />help_mode=". $help_mod."<br />htlp_tagid=".$help_tagid."<br />size=".$size;
2012-05-29 08:39:19 +00:00
$c ++ ;
}
2012-08-11 11:15:05 +00:00
$text .= " <button class='e-bb e-tabs-add' data-target=' $name ' data-url=' " . e_SELF . " ?mode=dialog&action=dialog&iframe=1' data-function='add' href='#' data-bbcode=''><span>New Page</span></button> " ;
2012-08-11 05:00:50 +00:00
$text .= " <input type='hidden' id='e-tab-count' value=' " . count ( $pages ) . " ' /> " ;
2012-05-29 08:39:19 +00:00
return $text ;
}
2012-04-19 03:53:58 +00:00
function optionsPage ()
{
global $e107 , $pref ;
$ns = e107 :: getRender ();
$mes = e107 :: getMessage ();
$frm = e107 :: getForm ();
$sql = e107 :: getDb ();
$tp = e107 :: getParser ();
if ( ! isset ( $pref [ 'pageCookieExpire' ])) $pref [ 'pageCookieExpire' ] = 84600 ;
//XXX Lan - Options
$text = "
< form method = 'post' action = '".e_SELF."?".e_QUERY."' >
< fieldset id = 'core-cpage-options' >
< legend class = 'e-hideme' > " .LAN_OPTIONS. " </ legend >
2012-05-13 05:26:11 +00:00
< table class = 'adminform' >
< colgroup >
2012-04-19 03:53:58 +00:00
< col class = 'col-label' />
< col class = 'col-control' />
</ colgroup >
< tbody >
< tr >
< td class = 'label' > " .CUSLAN_29. " </ td >
< td class = 'control' >
" . $frm->radio_switch ('listPages', $pref['listPages'] ). "
</ td >
</ tr >
< tr >
< td class = 'label' > " .CUSLAN_30. " </ td >
< td class = 'control' >
" . $frm->text ('pageCookieExpire', $pref['pageCookieExpire'] , 10). "
</ td >
</ tr >
</ tbody >
</ table >
< div class = 'buttons-bar center' >
" . $frm->admin_button ('saveOptions', CUSLAN_40, 'submit'). "
</ div >
</ fieldset >
</ form >
" ;
//$ns->tablerender(LAN_OPTIONS, $mes->render().$text);
echo $mes -> render () . $text ;
}
function saveSettings ()
{
global $pref , $admin_log , $emessage ;
$temp [ 'listPages' ] = $_POST [ 'listPages' ];
$temp [ 'pageCookieExpire' ] = $_POST [ 'pageCookieExpire' ];
if ( $admin_log -> logArrayDiffs ( $temp , $pref , 'CPAGE_04' ))
{
save_prefs (); // Only save if changes
$emessage -> add ( LAN_SETSAVED , E_MESSAGE_SUCCESS );
}
else
{
$emessage -> add ( LAN_NOCHANGE_NOTSAVED );
}
}
// Write new/edited page/menu to the DB
// $mode - zero for new page, page id for existing
// $type = FALSE for page, TRUE for menu
function submitPage ( $mode = FALSE , $type = FALSE )
{
global $e107cache , $admin_log , $e_event ;
$frm = e107 :: getForm ();
$sql = e107 :: getDb ();
$tp = e107 :: getParser ();
$ns = e107 :: getRender ();
$mes = e107 :: getMessage ();
$page_title = $tp -> toDB ( $_POST [ 'page_title' ]);
2012-05-29 08:39:19 +00:00
2012-08-11 05:00:50 +00:00
// print_a($_POST);
2012-07-09 01:54:43 +00:00
2012-05-29 08:39:19 +00:00
// if(is_array($_POST['data']) && is_array($_POST['subtitle']))
2012-07-09 01:54:43 +00:00
$newData = " " ;
foreach ( $_POST as $k => $v )
2012-05-29 08:39:19 +00:00
{
2012-07-23 02:25:17 +00:00
if ( substr ( $k , 0 , 4 ) == 'data' && trim ( $v ) != '' )
2012-05-29 08:39:19 +00:00
{
2012-07-09 01:54:43 +00:00
list ( $tm , $key ) = explode ( " _ " , $k );
2012-05-29 08:39:19 +00:00
$newData .= " [newpage= " . $_POST [ 'page_subtitle' ][ $key ] . " ] \n " ;
2012-07-09 01:54:43 +00:00
$newData .= $v . " \n \n " ;
2012-05-29 08:39:19 +00:00
}
2012-07-09 01:54:43 +00:00
2012-05-29 08:39:19 +00:00
// return;
}
2012-07-22 11:14:29 +00:00
2012-07-23 02:25:17 +00:00
// echo nl2br($newData);
2012-08-11 05:00:50 +00:00
// return;
2012-05-29 08:39:19 +00:00
$page_text = $tp -> toDB ( $newData );
2012-04-19 03:53:58 +00:00
$pauthor = ( $_POST [ 'page_display_authordate_flag' ] ? USERID : 0 ); // Ideally, this check should be done in the front-end.
$update = 0 ; // Make sure some updates happen
$page_sef = '' ;
$page_metad = '' ;
$page_metak = '' ;
if ( ! $type )
{
if ( ! empty ( $_POST [ 'page_sef' ]))
{
$page_sef = eHelper :: secureSef ( $_POST [ 'page_sef' ]);
}
if ( empty ( $page_sef ))
{
$page_sef = eHelper :: title2sef ( $_POST [ 'page_title' ]);
}
if ( ! empty ( $_POST [ 'page_metadscr' ]))
{
$page_metad = $tp -> toDB ( eHelper :: formatMetaDescription ( $_POST [ 'page_metadscr' ]));
}
if ( ! empty ( $_POST [ 'page_metakeys' ]))
{
$page_metak = eHelper :: formatMetaKeys ( $_POST [ 'page_metakeys' ]);
}
}
if ( ! $type && ( ! $page_title || ! $page_sef ))
{
e107 :: getMessage () -> addError ( CUSLAN_34 , 'default' , true );
e107 :: getRedirect () -> redirect ( e_ADMIN_ABS . 'cpage.php' );
}
2012-08-12 09:35:27 +00:00
if ( ! $type && $sql -> db_Count ( 'page' , '(page_id)' , ( $mode ? " page_id<> { $mode } AND " : '' ) . " page_sef!=' { $page_sef } ' " ))
2012-04-19 03:53:58 +00:00
{
e107 :: getMessage () -> addError ( CUSLAN_34 , 'default' , true );
e107 :: getRedirect () -> redirect ( e_ADMIN_ABS . 'cpage.php' );
}
if ( $type && empty ( $_POST [ 'menu_name' ]))
{
e107 :: getMessage () -> addError ( CUSLAN_36 , 'default' , true );
e107 :: getRedirect () -> redirect ( e_ADMIN_ABS . 'cpage.php' );
}
if ( $mode )
{ // Saving existing page/menu after edit
// Don't think $_POST['page_ip_restrict'] is ever set.
$menuname = ( $type && vartrue ( $_POST [ 'menu_name' ]) ? " , page_theme = ' " . $tp -> toDB ( $_POST [ 'menu_name' ]) . " ' " : " " );
$status = $sql -> db_Update ( " page " , " page_title=' { $page_title } ', page_sef=' { $page_sef } ', page_metakeys=' { $page_metak } ', page_metadscr=' { $page_metad } ', page_text=' { $page_text } ', page_datestamp=' " . time () . " ', page_author=' { $pauthor } ', page_rating_flag=' " . intval ( $_POST [ 'page_rating_flag' ]) . " ', page_comment_flag=' " . intval ( $_POST [ 'page_comment_flag' ]) . " ', page_password=' " . $_POST [ 'page_password' ] . " ', page_class=' " . $_POST [ 'page_class' ] . " ', page_ip_restrict=' " . varset ( $_POST [ 'page_ip_restrict' ], '' ) . " ', page_template=' " . $_POST [ 'page_template' ] . " ' { $menuname } WHERE page_id=' { $mode } ' " ) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR ;
if ( $status == E_MESSAGE_SUCCESS ) $update ++ ;
$mes -> add ( $message , $status );
$admin_log -> log_event ( 'CPAGE_02' , $mode . '[!br!]' . $page_title . '[!br!]' . $pauthor , E_LOG_INFORMATIVE , '' );
$e107cache -> clear ( " page_ { $mode } " );
$e107cache -> clear ( " page-t_ { $mode } " );
$data = array ( 'method' => 'update' , 'table' => 'page' , 'id' => $mode , 'plugin' => 'page' , 'function' => 'submitPage' );
$this -> message = $e_event -> triggerHook ( $data );
if ( $type )
{
$menu_name = $tp -> toDB ( $_POST [ 'menu_name' ]); // not to be confused with menu-caption.
// Need to check whether menu already in table, else we can't distinguish between a failed update and no update needed
if ( $sql -> db_Select ( 'menus' , 'menu_name' , " `menu_path` = ' { $mode } ' " ))
{ // Updating existing entry
if ( $sql -> db_Update ( 'menus' , " menu_name=' { $menu_name } ' WHERE menu_path=' { $mode } ' " ) !== FALSE )
{
$update ++ ;
}
}
}
//$url = e107::getUrl()->sc('page/view', array('name' => $tp->post_toForm($_POST['page_title']), 'id' => $mode));
/*
2012-05-29 08:39:19 +00:00
// Prevent links being updated in another language unless the table is present.
if ((( $pref [ 'sitelanguage' ] != $sql -> mySQLlanguage ) && ( $sql -> mySQLlanguage != '' )) && ( $sql -> db_IsLang ( " links " ) == 'links' ))
{
//echo "DISABLED LINK CREATION";
//echo ' Sitelan='.$pref['sitelanguage'];
//echo " Dblang=".$sql->mySQLlanguage;
//echo " Links=".$sql->db_IsLang("links");
return ;
}
2012-04-19 03:53:58 +00:00
if ( $_POST [ 'page_link' ])
{
// FIXME extremely ugly, just join on created link ID by new field page_link
if ( $sql -> db_Select ( " links " , " link_id " , " link_url=' " . $url . " ' && link_name!=' " . $tp -> toDB ( $_POST [ 'page_link' ]) . " ' " ))
{
$sql -> db_Update ( " links " , " link_name=' " . $tp -> toDB ( $_POST [ 'page_link' ]) . " ' WHERE link_url=' " . $url . " ' " );
$update ++ ;
$e107cache -> clear ( " sitelinks " );
}
else if ( ! $sql -> db_Select ( " links " , " link_id " , " link_url=' " . $url . " ' " ))
{
$sql -> db_Insert ( " links " , " 0, ' " . $tp -> toDB ( $_POST [ 'page_link' ]) . " ', ' " . $url . " ', '', '', 1, 0, 0, 0, " . $_POST [ 'page_class' ]);
$update ++ ;
$e107cache -> clear ( " sitelinks " );
}
} else {
if ( $sql -> db_Select ( " links " , " link_id " , " link_url=' " . $url . " ' " ))
{
$sql -> db_Delete ( " links " , " link_url=' " . $url . " ' " );
$update ++ ;
$e107cache -> clear ( " sitelinks " );
}
} */
2012-05-27 10:42:16 +00:00
$mes = e107 :: getMessage ();
$mes -> autoMessage ( $update , 'update' , LAN_UPDATED , false , false ); // Display result of update
2012-04-19 03:53:58 +00:00
}
else
{ // New page/menu
$menuname = ( $type ? $tp -> toDB ( $_POST [ 'menu_name' ]) : " " );
$addMsg = ( $type ? CUSLAN_51 : CUSLAN_27 );
$info = array (
'page_title' => $page_title ,
'page_sef' => $page_sef ,
'page_metakeys' => $page_metak ,
'page_metadscr' => $page_metad ,
'page_text' => $page_text ,
'page_author' => $pauthor ,
'page_datestamp' => time (),
'page_rating_flag' => varset ( $_POST [ 'page_rating_flag' ], 0 ),
'page_comment_flag' => varset ( $_POST [ 'page_comment_flag' ], '' ),
'page_password' => varset ( $_POST [ 'page_password' ], '' ),
'page_class' => varset ( $_POST [ 'page_class' ], e_UC_PUBLIC ),
'page_ip_restrict' => '' ,
'page_theme' => $menuname ,
'page_template' => varset ( $_POST [ 'page_template' ], '' )
);
2012-05-27 10:42:16 +00:00
$pid = e107 :: getMessage () -> autoMessage ( $sql -> db_Insert ( 'page' , $info ), 'insert' , $addMsg , LAN_CREATED_FAILED , false );
2012-04-19 03:53:58 +00:00
$admin_log -> log_event ( 'CPAGE_01' , $menuname . '[!br!]' . $page_title . '[!br!]' . $pauthor , E_LOG_INFORMATIVE , '' );
if ( $type )
{
$info = array (
'menu_name' => $menuname ,
'menu_location' => 0 ,
'menu_order' => 0 ,
'menu_class' => '0' ,
'menu_pages' => '' ,
'menu_path' => $pid ,
);
2012-05-27 10:42:16 +00:00
e107 :: getMessage () -> autoMessage ( $sql -> db_Insert ( 'menus' , $info ), 'insert' , CUSLAN_52 , LAN_CREATED_FAILED , false );
2012-04-19 03:53:58 +00:00
}
/* if ( vartrue ( $_POST [ 'page_link' ]))
{
//$link = 'page.php?'.$pid;
$url = e107 :: getUrl () -> sc ( 'page/view' , array ( 'name' => $tp -> post_toForm ( $_POST [ 'page_title' ]), 'id' => $pid ));
if ( ! $sql -> db_Select ( " links " , " link_id " , " link_name=' " . $tp -> toDB ( $_POST [ 'page_link' ]) . " ' " ))
{
$linkname = $tp -> toDB ( $_POST [ 'page_link' ]);
$sql -> db_Insert ( " links " , " 0, ' { $linkname } ', ' { $url } ', '', '', 1, 0, 0, 0, " . $_POST [ 'page_class' ]);
$e107cache -> clear ( " sitelinks " );
}
} */
$data = array ( 'method' => 'create' , 'table' => 'page' , 'id' => $pid , 'plugin' => 'page' , 'function' => 'submitPage' );
$this -> message = $e_event -> triggerHook ( $data );
}
}
function uploadPage ()
{
global $pref ;
$pref [ 'upload_storagetype' ] = " 1 " ;
require_once ( e_HANDLER . " upload_handler.php " );
$uploaded = file_upload ( e_IMAGE . " custom/ " );
}
}
2012-04-22 06:19:21 +00:00
2012-04-19 03:53:58 +00:00
2012-05-23 13:59:12 +00:00
new page_admin ();
require_once ( 'auth.php' );
2012-04-19 03:53:58 +00:00
e107 :: getAdminUI () -> runPage ();
2006-12-02 04:36:16 +00:00
2010-01-04 21:35:38 +00:00
require_once ( e_ADMIN . 'footer.php' );
2006-12-02 04:36:16 +00:00
2012-04-19 03:53:58 +00:00
2011-12-09 02:08:04 +00:00
// FIXME - add page link to sitelinks is completely disabled as current implementation is not reliable (+ is obsolete and generates sql error)
2006-12-02 04:36:16 +00:00
class page
{
2009-07-08 10:31:53 +00:00
var $fields ;
2012-04-19 03:53:58 +00:00
// DEPRECATED
2009-07-08 10:31:53 +00:00
function page ()
{
global $pref , $user_pref , $admin_log ;
2009-11-05 17:32:19 +00:00
if ( isset ( $_POST [ 'etrigger_ecolumns' ]))
2009-07-08 10:31:53 +00:00
{
$user_pref [ 'admin_cpage_columns' ] = $_POST [ 'e-columns' ];
save_prefs ( 'user' );
}
$this -> fieldpref = ( varset ( $user_pref [ 'admin_cpage_columns' ])) ? $user_pref [ 'admin_cpage_columns' ] : array ( " page_id " , " page_title " , " page_theme " ); ;
$this -> fields = array (
2010-01-03 12:14:06 +00:00
'page_id' => array ( 'title' => 'ID' , 'width' => '5%' , 'forced' => TRUE ),
2012-06-09 04:44:11 +00:00
'page_title' => array ( 'title' => LAN_TITLE , 'type' => 'text' , 'width' => 'auto' ),
2009-11-19 12:36:22 +00:00
'page_theme' => array ( 'title' => CUSLAN_2 , 'type' => 'text' , 'width' => 'auto' , 'nolist' => true ),
'page_template' => array ( 'title' => 'Template' , 'type' => 'text' , 'width' => 'auto' ),
2010-04-17 03:17:48 +00:00
'page_author' => array ( 'title' => LAN_AUTHOR , 'type' => 'text' , 'width' => 'auto' , 'thclass' => 'left' ),
'page_datestamp' => array ( 'title' => LAN_DATE , 'type' => 'datestamp' , 'width' => 'auto' ),
2012-04-19 03:53:58 +00:00
'page_class' => array ( 'title' => LAN_USERCLASS , 'type' => 'userclass' , 'width' => 'auto' , 'filter' => true , 'batch' => true ,),
2010-04-17 03:17:48 +00:00
'page_rating_flag' => array ( 'title' => LAN_RATING , 'type' => 'boolean' , 'width' => '10%' , 'thclass' => 'center' , 'class' => 'center' ),
'page_comment_flag' => array ( 'title' => ADLAN_114 , 'type' => 'boolean' , 'width' => '10%' , 'thclass' => 'center' , 'class' => 'center' ),
2009-11-19 12:36:22 +00:00
// 'page_password' => array('title'=> LAN_USER_05, 'type' => 'text', 'width' => 'auto'),
2009-07-08 10:31:53 +00:00
// 'page_ip_restrict' => array('title'=> LAN_USER_07, 'type' => 'text', 'width' => 'auto'), // Avatar
2009-11-19 12:36:22 +00:00
'options' => array ( 'title' => LAN_OPTIONS , 'forced' => TRUE , 'width' => '10%' , 'thclass' => 'center last' , 'class' => 'center' )
2009-07-08 10:31:53 +00:00
);
// $this->fieldpref = array("page_id","page_title","page_author","page_class");
}
// --------------------------------------------------------------------------
2012-04-19 03:53:58 +00:00
// DEPRECATED
/*
2009-08-05 14:22:15 +00:00
function menusPage ()
2006-12-02 04:36:16 +00:00
{
2009-08-05 14:22:15 +00:00
if ( ! getperms ( " J " )){ return ; }
return $this -> showExistingPages ( 'menus' );
}
2012-04-19 03:53:58 +00:00
**/
2008-12-29 15:23:06 +00:00
2009-08-05 14:22:15 +00:00
// --------------------------------------------------------------------------
2012-04-19 03:53:58 +00:00
/*
2009-08-05 14:22:15 +00:00
function showExistingPages ( $mode = FALSE )
{
global $sql , $e107 , $emessage , $frm , $pref ;
2009-07-08 10:31:53 +00:00
2009-08-05 14:22:15 +00:00
$text = " <form method='post' action=' " . e_SELF . " ? " . e_QUERY . " '>
2009-07-08 10:31:53 +00:00
< fieldset id = 'core-cpage-list' >
< legend class = 'e-hideme' > " .CUSLAN_5. " </ legend >
2012-05-13 05:26:11 +00:00
< table class = 'adminlist' > " .
2009-07-17 07:53:13 +00:00
$frm -> colGroup ( $this -> fields , $this -> fieldpref ) .
$frm -> thead ( $this -> fields , $this -> fieldpref ) .
" <tbody> " ;
2008-12-29 15:23:06 +00:00
2009-08-05 14:22:15 +00:00
if ( $mode == 'menus' )
{
$qry = " page_theme !='' " ;
$caption = CUSLAN_50 ;
}
else
{
if ( ! getperms ( " 5 " )){ return ; }
$qry = " page_theme ='' " ;
$caption = CUSLAN_5 ;
}
if ( ! $sql -> db_Select ( " page " , " * " , $qry . " ORDER BY page_datestamp DESC " ))
2006-12-02 04:36:16 +00:00
{
2008-12-29 15:23:06 +00:00
$text .= "
< tr >
< td colspan = '4' class = 'center middle' >
" .CUSLAN_42. "
</ td >
</ tr >
" ;
2006-12-02 04:36:16 +00:00
}
else
{
2008-12-29 15:23:06 +00:00
$pages = $sql -> db_getList ( 'ALL' , FALSE , FALSE );
2006-12-02 04:36:16 +00:00
foreach ( $pages as $pge )
{
2010-04-11 07:52:45 +00:00
$title_text = $pge [ 'page_title' ] ? $pge [ 'page_title' ] : ( $pge [ 'page_theme' ] ? CUSLAN_43 . $pge [ 'page_theme' ] : CUSLAN_44 );
2011-12-09 02:08:04 +00:00
$pge [ 'page_title' ] = " <a href=' " . ( $pge [ 'page_theme' ] ? e_ADMIN . " menus.php " : e107 :: getUrl () -> create ( 'page/view' , $pge , 'allow=page_id,page_sef' )) . " '> { $title_text } </a> " ;
2009-11-19 12:36:22 +00:00
$authorData = get_user_data ( $pge [ 'page_author' ]);
2010-01-03 12:14:06 +00:00
$pge [ 'page_author' ] = varset ( $authorData [ 'user_name' ], '?' );
2009-07-08 10:31:53 +00:00
2009-11-19 12:36:22 +00:00
$text .= $frm -> renderTableRow ( $this -> fields , $this -> fieldpref , $pge , 'page_id' );
2006-12-02 04:36:16 +00:00
}
}
$text .= "
2008-12-29 15:23:06 +00:00
</ tbody >
</ table >
</ fieldset >
</ form >
" ;
2006-12-02 04:36:16 +00:00
2009-08-05 14:22:15 +00:00
$e107 -> ns -> tablerender ( $caption , $emessage -> render () . $text );
2006-12-02 04:36:16 +00:00
}
2012-04-19 03:53:58 +00:00
*/
2008-12-06 16:40:37 +00:00
2010-04-17 03:17:48 +00:00
2006-12-02 04:36:16 +00:00
2008-12-29 15:23:06 +00:00
2006-12-02 04:36:16 +00:00
2012-04-19 03:53:58 +00:00
// DEPRECATED
function delete_page ( $del_id )
2006-12-02 04:36:16 +00:00
{
2012-04-19 03:53:58 +00:00
return ;
2011-12-09 02:08:04 +00:00
2008-12-29 20:51:24 +00:00
global $sql , $e107cache , $admin_log , $e_event ;
2011-12-09 02:08:04 +00:00
//if(!$sql->db_Select('page', '*', "page_id={$del_id}")) return;
//$row = $sql->db_Fetch();
2008-12-29 15:23:06 +00:00
admin_update ( $sql -> db_Delete ( " page " , " page_id=' { $del_id } ' " ), 'delete' , CUSLAN_28 , false , false );
2010-04-17 03:17:48 +00:00
$sql -> db_Delete ( 'menus' , " menu_path=' $del_id ' " );
$e107cache -> clear_sys ( 'menus_' );
2008-12-06 16:40:37 +00:00
$admin_log -> log_event ( 'CPAGE_03' , 'ID: ' . $del_id , E_LOG_INFORMATIVE , '' );
2011-12-09 02:08:04 +00:00
/* $url = e107 :: getUrl () -> sc ( 'page/view' , $row , 'allow=page_id,page_title,page_sef' );
if ( $row [ 'page_theme' ] && $sql -> db_Select ( 'links' , 'link_id' , " link_url=' " . $url . " ' " ))
2006-12-02 04:36:16 +00:00
{
2011-12-09 02:08:04 +00:00
$tmp = $sql -> db_Fetch ();
$sql -> db_Delete ( 'links' , " link_id= " . $tmp [ 'link_id' ]);
2010-04-17 03:17:48 +00:00
$e107cache -> clear ( 'sitelinks' );
2006-12-02 04:36:16 +00:00
}
2011-12-09 02:08:04 +00:00
*/
2008-12-29 20:51:24 +00:00
$data = array ( 'method' => 'delete' , 'table' => 'page' , 'id' => $del_id , 'plugin' => 'page' , 'function' => 'delete_page' );
$this -> message = $e_event -> triggerHook ( $data );
2006-12-02 04:36:16 +00:00
}
2012-04-19 03:53:58 +00:00
/*
2006-12-02 04:36:16 +00:00
function saveSettings ()
{
2008-12-29 15:23:06 +00:00
global $pref , $admin_log , $emessage ;
2008-12-06 16:40:37 +00:00
$temp [ 'listPages' ] = $_POST [ 'listPages' ];
$temp [ 'pageCookieExpire' ] = $_POST [ 'pageCookieExpire' ];
if ( $admin_log -> logArrayDiffs ( $temp , $pref , 'CPAGE_04' ))
{
save_prefs (); // Only save if changes
2011-04-21 21:30:30 +00:00
$emessage -> add ( LAN_SETSAVED , E_MESSAGE_SUCCESS );
2008-12-06 16:40:37 +00:00
}
else
{
2011-04-21 21:30:30 +00:00
$emessage -> add ( LAN_NOCHANGE_NOTSAVED );
2008-12-06 16:40:37 +00:00
}
2006-12-02 04:36:16 +00:00
}
2008-12-06 16:40:37 +00:00
2006-12-02 04:36:16 +00:00
function show_options ( $action )
{
if ( $action == " " )
{
2009-08-05 14:22:15 +00:00
$action = ( getperms ( '5' )) ? " pages " : " menus " ;
2006-12-02 04:36:16 +00:00
}
2010-04-17 03:17:48 +00:00
2009-11-25 11:01:12 +00:00
if ( vartrue ( $_GET [ 'menus' ]))
{
$action = " menus " ;
}
2010-04-17 03:17:48 +00:00
2009-08-05 14:22:15 +00:00
$var [ 'pages' ][ 'text' ] = CUSLAN_48 ;
$var [ 'pages' ][ 'link' ] = e_SELF ;
$var [ 'pages' ][ 'perm' ] = 5 ;
$var [ 'menus' ][ 'text' ] = CUSLAN_49 ;
2009-11-25 11:01:12 +00:00
$var [ 'menus' ][ 'link' ] = e_SELF . " ?menus=1 " ;
2009-08-05 14:22:15 +00:00
$var [ 'menus' ][ 'perm' ] = " J " ;
2006-12-02 04:36:16 +00:00
$var [ 'create' ][ 'text' ] = CUSLAN_12 ;
$var [ 'create' ][ 'link' ] = e_SELF . " ?create " ;
2009-08-05 14:22:15 +00:00
$var [ 'create' ][ 'perm' ] = 5 ;
2006-12-02 04:36:16 +00:00
$var [ 'createm' ][ 'text' ] = CUSLAN_31 ;
$var [ 'createm' ][ 'link' ] = e_SELF . " ?createm " ;
2009-08-05 14:22:15 +00:00
$var [ 'createm' ][ 'perm' ] = " J " ;
2006-12-02 04:36:16 +00:00
$var [ 'options' ][ 'text' ] = LAN_OPTIONS ;
$var [ 'options' ][ 'link' ] = e_SELF . " ?options " ;
2009-08-05 14:22:15 +00:00
$var [ 'options' ][ 'perm' ] = " 0 " ;
2006-12-02 04:36:16 +00:00
2008-12-29 15:23:06 +00:00
e_admin_menu ( CUSLAN_33 , $action , $var );
2006-12-02 04:36:16 +00:00
}
2012-04-19 03:53:58 +00:00
*/
2006-12-02 04:36:16 +00:00
}
2012-05-23 13:59:12 +00:00
/*
2008-12-29 15:23:06 +00:00
function cpage_adminmenu ()
2008-12-06 16:40:37 +00:00
{
2006-12-02 04:36:16 +00:00
global $page ;
global $action ;
2012-05-23 13:59:12 +00:00
// $page->show_options($action);
2006-12-02 04:36:16 +00:00
}
2012-05-23 13:59:12 +00:00
*/
2006-12-02 04:36:16 +00:00
2007-09-02 11:44:00 +00:00
?>