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' );
23 $GLOBALS[
'oAdmTemplate']->addJsTranslation(array(
24 '_adm_mbuilder_Sorry_could_not_insert_object',
25 '_adm_mbuilder_This_items_are_non_editable'
34 if(
ch_get(
'action') !==
false) {
39 header(
'Content-Type: text/html; charset=utf-8');
41 $aItem =
db_assoc_arr(
"SELECT * FROM `" .
$oMenu->sDbTable .
"` WHERE `ID` = $id", 0 );
47 case 'deactivate_item':
48 $res =
db_res(
"UPDATE `" .
$oMenu->sDbTable .
"` SET `Active`='0' WHERE `ID`=" . (
int)
ch_get(
'id') );
52 $id = (int)$_POST[
'id'];
58 $aItemFields = array(
'Name',
'Caption',
'Icon',
'Link',
'Script',
'Target');
61 foreach($aItemFields
as $field)
62 $aItem[$field] = isset($_POST[$field]) ? $_POST[$field] :
null;
65 if( (
int)$_POST[
'Visible_non'] )
67 if( (
int)$_POST[
'Visible_memb'] )
70 $aItem[
'Visible'] = implode(
',', $aVis );
71 $aItem[
'Target'] = $_POST[
'Target'] ==
'_blank' ?
'_blank' :
'';
83 $id = (int)$_POST[
'id'];
87 $aItem =
db_arr(
"SELECT `Deletable` FROM `" .
$oMenu->sDbTable .
"` WHERE `ID` = $id" );
90 }
else if( !(
int)$aItem[
'Deletable'] ) {
93 $res =
db_res(
"DELETE FROM `" .
$oMenu->sDbTable .
"` WHERE `ID` = $id" );
111 $sTopQuery =
"SELECT `ID`, `Name`, `Movable` FROM `" .
$oMenu->sDbTable .
"` WHERE `Active`='1' ORDER BY `Order`";
114 $sAllQuery =
"SELECT `ID`, `Name` FROM `" .
$oMenu->sDbTable .
"` WHERE `Clonable`='1' OR (`Clonable`='0' AND `Active`='0') ORDER BY `Name`";
118 <script type=\"text/javascript\">
119 topParentID = 'menu_app_wrapper';
120 parserUrl = '" .
$GLOBALS[
'site'][
'url_admin'] .
"bottom_menu_compose.php?';
123 allowAddToTop = true;
124 allowAddToCustom = false;
126 sendSystemOrder = false;
129 aCoords['startX'] = 6;
130 aCoords['startY'] = 24;
131 aCoords['width'] = 117;
132 aCoords['height'] = 28;
133 aCoords['diffX'] = 122;
134 aCoords['diffY'] = 32;
143 while(($aTopItem =
$rTopItems->fetch()) !==
false) {
147 aCustomItems[$iIndex] = {};";
153 while(($aAllItem =
$rAllItems->fetch()) !==
false) {
164 'css_name' => array(
'menu_compose.css',
'forms_adv.css'),
165 'js_name' => array(
'menu_compose.js',
'ChWsbMenu.js'),
166 'header' =>
_t(
'_adm_bmbuilder_page_title')
181 'form_attrs' => array(
182 'id' =>
'formItemEdit',
183 'name' =>
'formItemEdit',
184 'action' =>
$GLOBALS[
'site'][
'url_admin'] .
'bottom_menu_compose.php',
186 'enctype' =>
'multipart/form-data',
192 'caption' =>
_t(
'_adm_mbuilder_System_Name'),
193 'value' => $aItem[
'Name'],
199 'caption' =>
_t(
'_adm_mbuilder_Language_Key'),
200 'value' => $aItem[
'Caption'],
203 'LangCaption' => array(
205 'name' =>
'LangCaption',
206 'caption' =>
_t(
'_adm_mbuilder_Default_Name'),
207 'value' =>
_t( $aItem[
'Caption'] ),
213 'caption' =>
_t(
'_URL'),
220 'caption' =>
_t(
'_adm_mbuilder_script'),
227 'caption' =>
_t(
'_adm_mbuilder_icon'),
232 'type' =>
'radio_set',
234 'caption' =>
_t(
'_adm_mbuilder_Target_Window'),
235 'value' => $aItem[
'Target'] ==
'_blank' ?
'_blank' :
'_self',
237 '_self' =>
_t(
'_adm_mbuilder_Same'),
238 '_blank' =>
_t(
'_adm_mbuilder_New')
243 'type' =>
'checkbox_set',
245 'caption' =>
_t(
'_adm_mbuilder_Visible_for'),
248 'non' =>
_t(
'_Guest'),
249 'memb' =>
_t(
'_Member')
254 'type' =>
'input_set',
258 'value' =>
_t(
'_Save Changes'),
260 'onclick' =>
'javascript:saveItem(' . $aItem[
'ID'] .
');'
266 'value' =>
_t(
'_Delete'),
268 'onclick' =>
'javascript:deleteItem(' . $aItem[
'ID'] .
');'
275 foreach(
$aForm[
'inputs']
as $sKey => $aInput)
276 if(in_array($aInput[
'type'], array(
'text',
'checkbox')) && !$aItem[
'Editable'])
277 $aForm[
'inputs'][$sKey][
'attrs'][
'disabled'] =
"disabled";
279 if(strpos($aItem[
'Visible'],
'non') !==
false)
280 $aForm[
'inputs'][
'Visible'][
'value'][] =
'non';
281 if(strpos($aItem[
'Visible'],
'memb') !==
false)
282 $aForm[
'inputs'][
'Visible'][
'value'][] =
'memb';
285 return PopupBox(
'mmc_edit_popup',
_t(
'_adm_mbuilder_edit_item')
286 ,
$GLOBALS[
'oAdmTemplate']->parseHtmlByName(
'design_box_content.html'
287 , array(
'content' =>
$oForm->getCode() .
LoadingBox(
'formItemEditLoading'))));
301 $sourceActive =
db_value(
"SELECT `Active` FROM `" .
$oMenu->sDbTable .
"` WHERE `ID`=$source" );
302 if( !$sourceActive ) {
304 db_res(
"UPDATE `" .
$oMenu->sDbTable .
"` SET `Active`='1' WHERE `ID`=$source" );
308 db_res(
"INSERT INTO `" .
$oMenu->sDbTable .
"`(`Name`, `Caption`, `Icon`, `Link`, `Script`, `Target`, `Visible`, `Movable`, `Clonable`, `Editable`, `Deletable`)
309 SELECT `Caption`, `Name`, `Icon`, `Link`, `Script`, `Target`, `Visible`, `Movable`, '0', `Editable`, '1' FROM `" .
$oMenu->sDbTable .
"` WHERE `ID`=$source" );
314 db_res(
"INSERT INTO `" .
$oMenu->sDbTable .
"` (`Name`) VALUES ('NEW ITEM')" );
324 <div style=
"color:{$color};text-align:center;">{$text}</div>
339 $aOldItem =
db_arr(
"SELECT * FROM `" .
$oMenu->sDbTable .
"` WHERE `ID` = $id" );
342 return array(
'code' => 2,
'message' =>
_t(
'_adm_mbuilder_Item_not_found') );
345 if( (
int) $aOldItem[
'Editable'] != 1 ) {
346 return array(
'code' => 3,
'message' =>
_t(
'_adm_mbuilder_Item_is_non_editable') );
350 foreach( $aItem
as $field => $value )
353 $sQuerySet = substr( $sQuerySet, 1 );
355 $sQuery =
"UPDATE `" .
$oMenu->sDbTable .
"` SET $sQuerySet WHERE `ID` = $id";
359 return array(
'code' => 0,
'message' =>
_t(
'_Saved'),
'timer' => 3);
364 $key = preg_replace(
'|\{([^\}]+)\}|',
'', $key);
368 $langName =
getParam(
'lang_default' );
369 $langID =
db_value(
"SELECT `ID` FROM `sys_localization_languages` WHERE `Name` = '" .
process_db_input( $langName ) .
"'" );
373 db_res(
"UPDATE `sys_localization_strings` SET `String` = '" .
process_db_input( $string ) .
"' WHERE `IDKey`=$keyID AND `IDLanguage`=$langID" );
375 db_res(
"INSERT INTO `sys_localization_keys` SET `IDCategory` = 2, `Key` = '" .
process_db_input( $key ) .
"'" );
376 db_res(
"INSERT INTO `sys_localization_strings` SET `IDKey` = " .
db_last_id() .
", `IDLanguage` = $langID, `String` = '" .
process_db_input( $string ) .
"'" );
392 db_res(
"UPDATE `" .
$oMenu->sDbTable .
"` SET `Order`='0' WHERE 1");
394 $sTop = trim($sTop,
' ,');
395 $aTopIDs = explode(
',', $sTop);
397 foreach($aTopIDs
as $iOrd => $iID) {
398 $iID = trim($iID,
' ,');
404 db_res(
"UPDATE `" .
$oMenu->sDbTable .
"` SET `Order`='" . $iOrd .
"' 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)