Go to the documentation of this file.
8 define (
'CH_SECURITY_EXCEPTIONS',
true);
13 require_once(
'../inc/header.inc.php' );
14 require_once( CH_DIRECTORY_PATH_INC .
'profiles.inc.php' );
15 require_once( CH_DIRECTORY_PATH_INC .
'design.inc.php' );
16 require_once( CH_DIRECTORY_PATH_INC .
'admin_design.inc.php' );
17 require_once( CH_DIRECTORY_PATH_INC .
'utils.inc.php' );
18 require_once( CH_DIRECTORY_PATH_INC .
'languages.inc.php' );
25 $GLOBALS[
'oAdmTemplate']->addJsTranslation(array(
26 '_adm_mbuilder_Sorry_could_not_insert_object',
27 '_adm_mbuilder_This_items_are_non_editable'
33 'top' => array (
'title' =>
'_top',
'href' =>
'member_menu_compose.php?menu_position=top'),
34 'top_extra' => array (
'title' =>
'_top_extra',
'href' =>
'member_menu_compose.php?menu_position=top_extra'),
42 if (isset(
$_GET[
'menu_position'])) {
44 if ($sValue ==
$_GET[
'menu_position']) {
53 if(
ch_get(
'action') !==
false) {
58 header(
'Content-Type: text/html; charset=utf-8');
60 $aItem =
db_assoc_arr(
"SELECT * FROM `sys_menu_member` WHERE `ID` = $id", 0 );
67 case 'deactivate_item':
68 $res =
db_res(
"UPDATE `sys_menu_member` SET `Active`='0' WHERE `ID`=" . (
int)
ch_get(
'id') );
72 $id = (int)$_POST[
'id'];
76 $aItemFields = array(
'Name',
'Caption',
'Link',
'Target',
'Icon',
'Script' );
79 foreach( $aItemFields
as $field ) {
80 $aItem[$field] = ( isset($_POST[$field]) ) ? $_POST[$field] :
null ;
83 if ( !$aItem[
'Icon'] ) {
84 $aItem[
'Icon'] =
'member_menu_default.png';
90 $res[
'message'] =
MsgBox($res[
'message']);
91 echo json_encode($res);
97 $id = (int)$_POST[
'id'];
101 $aItem =
db_arr(
"SELECT `Deletable` FROM `sys_menu_member` WHERE `ID` = $id" );
104 }
else if( !(
int)$aItem[
'Deletable'] ) {
107 $res =
db_res(
"DELETE FROM `sys_menu_member` WHERE `ID` = $id" );
127 $sTopQuery =
"SELECT `ID`, `Name`, `Movable` FROM `sys_menu_member` WHERE `Active`='1' AND `Position`='{$sMenuSection}' AND `Type`<>'linked_item' ORDER BY `Order`";
130 $sAllQuery =
"SELECT `ID`, `Name` FROM `sys_menu_member` WHERE `Type`<>'linked_item' AND (`Clonable`='1' OR (`Clonable`='0' AND `Active`='0')) ORDER BY `Name`";
135 <script type=\"text/javascript\">
136 topParentID = 'menu_app_wrapper';
137 parserUrl = '" .
$GLOBALS[
'site'][
'url_admin'] .
"member_menu_compose.php?menu_position={$sMenuSection}';
140 allowAddToTop = true;
141 allowAddToCustom = false;
143 sendSystemOrder = false;
146 aCoords['startX'] = 6;
147 aCoords['startY'] = 24;
148 aCoords['width'] = 117;
149 aCoords['height'] = 28;
150 aCoords['diffX'] = 122;
151 aCoords['diffY'] = 32;
160 while(($aTopItem =
$rTopItems->fetch()) !==
false) {
164 aCustomItems[$iIndex] = {};";
170 while(($aAllItem =
$rAllItems->fetch()) !==
false) {
181 'css_name' => array(
'menu_compose.css',
'forms_adv.css'),
182 'js_name' => array(
'menu_compose.js',
'ChWsbMenu.js'),
183 'header' =>
_t(
'_mmbuilder_page_title')
199 'form_attrs' => array(
200 'id' =>
'formItemEdit',
201 'name' =>
'formItemEdit',
202 'action' =>
$GLOBALS[
'site'][
'url_admin'] .
'member_menu_compose.php',
204 'enctype' =>
'multipart/form-data',
210 'caption' =>
_t(
'_adm_mbuilder_System_Name'),
211 'value' => $aItem[
'Name'],
217 'caption' =>
_t(
'_adm_mbuilder_Language_Key'),
218 'value' => $aItem[
'Caption'],
221 'LangCaption' => array(
223 'name' =>
'LangCaption',
224 'caption' =>
_t(
'_adm_mbuilder_Default_Name'),
225 'value' =>
_t( $aItem[
'Caption'] ),
231 'caption' =>
_t(
'_URL'),
238 'caption' =>
_t(
'_adm_mbuilder_script'),
245 'caption' =>
_t(
'_adm_mbuilder_icon'),
250 'type' =>
'radio_set',
252 'caption' =>
_t(
'_adm_mbuilder_Target_Window'),
253 'value' => $aItem[
'Target'] ==
'_blank' ?
'_blank' :
'_self',
255 '_self' =>
_t(
'_adm_mbuilder_Same'),
256 '_blank' =>
_t(
'_adm_mbuilder_New')
261 'type' =>
'input_set',
265 'value' =>
_t(
'_Save Changes'),
267 'onclick' =>
'javascript:saveItem(' . $aItem[
'ID'] .
');'
273 'value' =>
_t(
'_Delete'),
275 'onclick' =>
'javascript:deleteItem(' . $aItem[
'ID'] .
');'
282 foreach(
$aForm[
'inputs']
as $sKey => $aInput)
283 if(in_array($aInput[
'type'], array(
'text',
'checkbox')) && !$aItem[
'Editable'])
284 $aForm[
'inputs'][$sKey][
'attrs'][
'disabled'] =
"disabled";
286 if(strpos($aItem[
'Visible'],
'non') !==
false)
287 $aForm[
'inputs'][
'Visible'][
'value'][] =
'non';
288 if(strpos($aItem[
'Visible'],
'memb') !==
false)
289 $aForm[
'inputs'][
'Visible'][
'value'][] =
'memb';
292 return PopupBox(
'mmc_edit_popup',
_t(
'_adm_mbuilder_edit_item')
293 ,
$GLOBALS[
'oAdmTemplate']->parseHtmlByName(
'design_box_content.html'
294 , array(
'content' =>
$oForm->getCode() .
LoadingBox(
'formItemEditLoading'))));
308 $sourceActive =
db_value(
"SELECT `Active` FROM `sys_menu_member` WHERE `ID`=$source" );
309 if( !$sourceActive ) {
311 db_res(
"UPDATE `sys_menu_member` SET `Active`='1', `Position`='$type' WHERE `ID`=$source" );
315 db_res(
"INSERT INTO `sys_menu_member`
316 (`Caption`, `Name`, `Icon`, `Link`, `Script`, `Eval`, `PopupMenu`, `Movable`, `Clonable`, `Editable`, `Deletable`, `Target`, `Position`, `Type`, `Bubble`, `Description`)
317 SELECT `Caption`, `Name`, `Icon`, `Link`, `Script`, `Eval`, `PopupMenu`, `Movable`, '0', `Editable`, '1', `Target`, `Position`, `Type`, `Bubble`, `Description`
318 FROM `sys_menu_member`
319 WHERE `ID`=$source" );
324 db_res(
"INSERT INTO `sys_menu_member` ( `Name`, `Position` ) VALUES ( 'NEW ITEM', '$type' )" );
334 <div style=
"color:{$color};text-align:center;">{$text}</div>
349 $aOldItem =
db_arr(
"SELECT * FROM `sys_menu_member` WHERE `ID` = $id" );
352 return array(
'code' => 2,
'message' =>
_t(
'_adm_mbuilder_Item_not_found') );
355 if( (
int) $aOldItem[
'Editable'] != 1 ) {
356 return array(
'code' => 3,
'message' =>
_t(
'_adm_mbuilder_Item_is_non_editable') );
360 foreach( $aItem
as $field => $value )
363 $sQuerySet = substr( $sQuerySet, 1 );
365 $sQuery =
"UPDATE `sys_menu_member` SET $sQuerySet WHERE `ID` = $id";
371 return array(
'code' => 0,
'message' =>
_t(
'_Saved'),
'timer' => 3);
377 $key = preg_replace(
'|\{([^\}]+)\}|',
'', $key);
382 $langName =
getParam(
'lang_default' );
383 $langID =
db_value(
"SELECT `ID` FROM `sys_localization_languages` WHERE `Name` = '" .
process_db_input( $langName ) .
"'" );
387 db_res(
"UPDATE `sys_localization_strings` SET `String` = '" .
process_db_input( $string ) .
"' WHERE `IDKey`=$keyID AND `IDLanguage`=$langID" );
389 db_res(
"INSERT INTO `sys_localization_keys` SET `IDCategory` = 2, `Key` = '" .
process_db_input( $key ) .
"'" );
390 db_res(
"INSERT INTO `sys_localization_strings` SET `IDKey` = " .
db_last_id() .
", `IDLanguage` = $langID, `String` = '" .
process_db_input( $string ) .
"'" );
404 db_res(
"UPDATE `sys_menu_member` SET `Order` = 0 WHERE `Position` = '{$sMenuSection}' " );
406 $sTop = trim( $sTop,
' ,' );
407 $aTopIDs = explode(
',', $sTop );
409 foreach( $aTopIDs
as $iOrd => $iID ) {
410 $iID = trim( $iID,
' ,' );
416 db_res(
"UPDATE `sys_menu_member` SET `Order` = $iOrd, `Position` = '{$sMenuSection}' WHERE `ID` = $iID" );
process_db_input($sText, $iStripTags=0)
</code > Be careful enabling this directive if you have a redirector script that does not use the< code > Location</code > HTTP header
db_assoc_arr($query, $bindings=[])
MsgBox($sText, $iTimer=0)
ch_js_string($mixedInput, $iQuoteType=CH_ESCAPE_STR_AUTO)
compileLanguage($langID=0)
ch_import($sClassName, $aModule=array())
DesignBoxAdmin($sTitle, $sContent, $mixedTopItems='', $sBottomItems='', $iIndex=1)
db_arr($query, $bindings=[])
getParam($sParamName, $bUseCache=true)
htmlspecialchars_adv($string)
PageCodeAdmin($oTemplate=null)
_t($key, $arg0="", $arg1="", $arg2="")
member_auth($member=0, $error_handle=true, $bAjx=false)
db_affected_rows($oStmt=null)
const CH_ESCAPE_STR_APOS
escape apostrophes only, for js strings enclosed in apostrophes, for use in
db_res($query, $bindings=[])
PopupBox($sName, $sTitle, $sContent, $aActions=array())
db_value($query, $bindings=[], $error_checking=true, $index=0)