global $save_qry; if ($save_qry) { $qry = $session->data['veraproperties_qry']; } else { $session->data['veraproperties_qry'] = $qry; } if (!$qry) { $qry = "1"; } // FIELDS ORDER global $sortby_veraproperties; if (!$sortby_veraproperties) { $sortby_veraproperties = $session->data['veraproperties_sort']; } else { if ($session->data['veraproperties_sort'] == $sortby_veraproperties) { if (Is_Integer(strpos($sortby_veraproperties, ' DESC'))) { $sortby_veraproperties = str_replace(' DESC', '', $sortby_veraproperties); } else { $sortby_veraproperties = $sortby_veraproperties . " DESC"; } } $session->data['veraproperties_sort'] = $sortby_veraproperties; } if (!$sortby_veraproperties) { $sortby_veraproperties = "TITLE"; } $out['SORTBY'] = $sortby_veraproperties; // SEARCH RESULTS $res = SQLSelect("SELECT * FROM veraproperties WHERE {$qry} ORDER BY " . $sortby_veraproperties); if ($res[0]['ID']) { colorizeArray($res);
global $save_qry; if ($save_qry) { $qry = $session->data['system_errors_qry']; } else { $session->data['system_errors_qry'] = $qry; } if (!$qry) { $qry = "1"; } // FIELDS ORDER global $sortby_system_errors; if (!$sortby_system_errors) { $sortby_system_errors = $session->data['system_errors_sort']; } else { if ($session->data['system_errors_sort'] == $sortby_system_errors) { if (Is_Integer(strpos($sortby_system_errors, ' DESC'))) { $sortby_system_errors = str_replace(' DESC', '', $sortby_system_errors); } else { $sortby_system_errors = $sortby_system_errors . " DESC"; } } $session->data['system_errors_sort'] = $sortby_system_errors; } $sortby_system_errors = "ACTIVE DESC, LATEST_UPDATE DESC, CODE"; $out['SORTBY'] = $sortby_system_errors; // SEARCH RESULTS $res = SQLSelect("SELECT * FROM system_errors WHERE {$qry} ORDER BY " . $sortby_system_errors); if ($res[0]['ID']) { colorizeArray($res); $total = count($res); for ($i = 0; $i < $total; $i++) {
global $save_qry; if ($save_qry) { $qry = $session->data['elements_qry']; } else { $session->data['elements_qry'] = $qry; } if (!$qry) { $qry = "1"; } // FIELDS ORDER global $sortby_elements; if (!$sortby_elements) { $sortby_elements = $session->data['elements_sort']; } else { if ($session->data['elements_sort'] == $sortby_elements) { if (Is_Integer(strpos($sortby_elements, ' DESC'))) { $sortby_elements = str_replace(' DESC', '', $sortby_elements); } else { $sortby_elements = $sortby_elements . " DESC"; } } $session->data['elements_sort'] = $sortby_elements; } if (!$sortby_elements) { $sortby_elements = "TITLE"; } $out['SORTBY'] = $sortby_elements; // SEARCH RESULTS $res = SQLSelect("SELECT * FROM elements WHERE {$qry} ORDER BY " . $sortby_elements); if ($res[0]['ID']) { colorizeArray($res);
if ($ok) { if ($rec['ID']) { SQLUpdate($table_name, $rec); // update } else { $new_rec=1; $rec['ID']=SQLInsert($table_name, $rec); // adding new record } //updating 'ICON' (image) global $icon; global $icon_name; global $delete_icon; if ($icon!="" && file_exists($icon) && (!$delete_icon)) { $filename=strtolower(basename($icon_name)); $ext=strtolower(end(explode(".",basename($icon_name)))); if ( (filesize($icon)<=(0*1024) || 0==0) && (Is_Integer(strpos('gif jpg png', $ext))) ) { $filename=$rec["ID"]."_icon_".time().".".$ext; if ($rec["ICON"]!='') { @Unlink(ROOT.'./cms/calendar/'.$rec["ICON"]); } Copy($icon, ROOT.'./cms/calendar/'.$filename); $rec["ICON"]=$filename; SQLUpdate($table_name, $rec); } } elseif ($delete_icon) { @Unlink(ROOT.'./cms/calendar/'.$rec["ICON"]); $rec["ICON"]=''; SQLUpdate($table_name, $rec); } $out['OK']=1;
global $save_qry; if ($save_qry) { $qry = $session->data['patterns_qry']; } else { $session->data['patterns_qry'] = $qry; } if (!$qry) { $qry = "1"; } // FIELDS ORDER global $sortby_patterns; if (!$sortby_patterns) { $sortby_patterns = $session->data['patterns_sort']; } else { if ($session->data['patterns_sort'] == $sortby_patterns) { if (Is_Integer(strpos($sortby_patterns, ' DESC'))) { $sortby_patterns = str_replace(' DESC', '', $sortby_patterns); } else { $sortby_patterns = $sortby_patterns . " DESC"; } } $session->data['patterns_sort'] = $sortby_patterns; } $sortby_patterns = "PRIORITY DESC, TITLE"; // SEARCH RESULTS $res = SQLSelect("SELECT * FROM patterns WHERE {$qry} ORDER BY " . $sortby_patterns); if ($res[0]['ID']) { //colorizeArray($res); $total = count($res); for ($i = 0; $i < $total; $i++) { // some action for every record if required
function Crypt_Decode1($String, $Key = HOST_ID) { /****************************************************************************/ $__args_types = array('string', 'string'); #----------------------------------------------------------------------------- $__args__ = Func_Get_Args(); eval(FUNCTION_INIT); /****************************************************************************/ $String = Base64_Decode($String); #----------------------------------------------------------------------------- if (empty($String)) { return $String; } #----------------------------------------------------------------------------- if (Extension_Loaded('mcrypt')) { #--------------------------------------------------------------------------- $Module = @MCrypt_Module_Open(MCRYPT_DES, '', MCRYPT_MODE_ECB, ''); if (!Is_Resource($Module)) { return ERROR | @Trigger_Error('[Crypt_Decode]: не удалось открыть дескриптор'); } #------------------------------------------------------------------------- $Iv = @MCrypt_Create_Iv(MCrypt_Enc_Get_Iv_Size($Module), MCRYPT_RAND); if (!$Iv) { return ERROR | @Trigger_Error('[Crypt_Decode]: не удалось создать IV'); } #------------------------------------------------------------------------- $Key = SubStr($Key, 0, MCrypt_Enc_Get_Key_Size($Module)); Debug(SPrintF("[Crypt_Decode1]: Decode Key = %s", $Key)); #------------------------------------------------------------------------- $IsInit = @MCrypt_Generic_Init($Module, $Key, $Iv); if (!Is_Integer($IsInit)) { return ERROR | @Trigger_Error('[Crypt_Decode]: не удалось инициализовать модуль дешифрования'); } #------------------------------------------------------------------------------- } #--------------------------------------------------------------------------- $String = @MDecrypt_Generic($Module, $String); if (!Is_String($String)) { return ERROR | @Trigger_Error('[Crypt_Decode]: не удалось дешифровать данные'); } #--------------------------------------------------------------------------- MCrypt_Generic_DeInit($Module); #--------------------------------------------------------------------------- $String = Trim($String); #--------------------------------------------------------------------------- return $String; #------------------------------------------------------------------------------- }
global $save_qry; if ($save_qry) { $qry = $session->data['gpsdevices_qry']; } else { $session->data['gpsdevices_qry'] = $qry; } if (!$qry) { $qry = "1"; } // FIELDS ORDER global $sortby_gpsdevices; if (!$sortby_gpsdevices) { $sortby_gpsdevices = $session->data['gpsdevices_sort']; } else { if ($session->data['gpsdevices_sort'] == $sortby_gpsdevices) { if (Is_Integer(strpos($sortby_gpsdevices, ' DESC'))) { $sortby_gpsdevices = str_replace(' DESC', '', $sortby_gpsdevices); } else { $sortby_gpsdevices = $sortby_gpsdevices . " DESC"; } } $session->data['gpsdevices_sort'] = $sortby_gpsdevices; } if (!$sortby_gpsdevices) { $sortby_gpsdevices = "TITLE"; } $out['SORTBY'] = $sortby_gpsdevices; // SEARCH RESULTS $res = SQLSelect("SELECT * FROM gpsdevices WHERE {$qry} ORDER BY " . $sortby_gpsdevices); if ($res[0]['ID']) { colorizeArray($res);
global $save_qry; if ($save_qry) { $qry = $session->data['blockly_code_qry']; } else { $session->data['blockly_code_qry'] = $qry; } if (!$qry) { $qry = "1"; } // FIELDS ORDER global $sortby_blockly_code; if (!$sortby_blockly_code) { $sortby_blockly_code = $session->data['blockly_code_sort']; } else { if ($session->data['blockly_code_sort'] == $sortby_blockly_code) { if (Is_Integer(strpos($sortby_blockly_code, ' DESC'))) { $sortby_blockly_code = str_replace(' DESC', '', $sortby_blockly_code); } else { $sortby_blockly_code = $sortby_blockly_code . " DESC"; } } $session->data['blockly_code_sort'] = $sortby_blockly_code; } if (!$sortby_blockly_code) { $sortby_blockly_code = "ID DESC"; } $out['SORTBY'] = $sortby_blockly_code; // SEARCH RESULTS $res = SQLSelect("SELECT * FROM blockly_code WHERE {$qry} ORDER BY " . $sortby_blockly_code); if ($res[0]['ID']) { paging($res, 50, $out);
global $save_qry; if ($save_qry) { $qry = $session->data['zwave_properties_qry']; } else { $session->data['zwave_properties_qry'] = $qry; } if (!$qry) { $qry = "1"; } // FIELDS ORDER global $sortby_zwave_properties; if (!$sortby_zwave_properties) { $sortby_zwave_properties = $session->data['zwave_properties_sort']; } else { if ($session->data['zwave_properties_sort'] == $sortby_zwave_properties) { if (Is_Integer(strpos($sortby_zwave_properties, ' DESC'))) { $sortby_zwave_properties = str_replace(' DESC', '', $sortby_zwave_properties); } else { $sortby_zwave_properties = $sortby_zwave_properties . " DESC"; } } $session->data['zwave_properties_sort'] = $sortby_zwave_properties; } if (!$sortby_zwave_properties) { $sortby_zwave_properties = "TITLE"; } $out['SORTBY'] = $sortby_zwave_properties; // SEARCH RESULTS $res = SQLSelect("SELECT * FROM zwave_properties WHERE {$qry} ORDER BY " . $sortby_zwave_properties); if ($res[0]['ID']) { colorizeArray($res);
global $save_qry; if ($save_qry) { $qry = $session->data['readit_urls_qry']; } else { $session->data['readit_urls_qry'] = $qry; } if (!$qry) { $qry = "1"; } // FIELDS ORDER global $sortby_readit_urls; if (!$sortby_readit_urls) { $sortby_readit_urls = $session->data['readit_urls_sort']; } else { if ($session->data['readit_urls_sort'] == $sortby_readit_urls) { if (Is_Integer(strpos($sortby_readit_urls, ' DESC'))) { $sortby_readit_urls = str_replace(' DESC', '', $sortby_readit_urls); } else { $sortby_readit_urls = $sortby_readit_urls . " DESC"; } } $session->data['readit_urls_sort'] = $sortby_readit_urls; } if (!$sortby_readit_urls) { $sortby_readit_urls = "ID DESC"; } $out['SORTBY'] = $sortby_readit_urls; // SEARCH RESULTS $res = SQLSelect("SELECT * FROM readit_urls WHERE {$qry} ORDER BY " . $sortby_readit_urls); if ($res[0]['ID']) { paging($res, 50, $out);
<?php global $session; global $name; if ($name != '') { $qry .= " AND TITLE LIKE '%" . DBSafe($name) . "%'"; $out['TITLE'] = $name; } // FIELDS ORDER global $sortby_event; if (!$sortby_event) { $sortby_event = $session->data['telegram_sort_event']; } else { if ($session->data['telegram_sort_event'] == $sortby_event) { if (Is_Integer(strpos($sortby_event, ' DESC'))) { $sortby_event = str_replace(' DESC', '', $sortby_event); } else { $sortby_event = $sortby_event . " DESC"; } } $session->data['telegram_sort_event'] = $sortby_event; } if (!$sortby_event) { $sortby_event = "TITLE"; } $out['SORTBY'] = $sortby_event; // SEARCH RESULTS $res = SQLSelect("SELECT * FROM tlg_event ORDER BY " . $sortby_event); if ($res[0]['ID']) { paging($res, 20, $out); // search result paging
global $save_qry; if ($save_qry) { $qry = $session->data['scenes_qry']; } else { $session->data['scenes_qry'] = $qry; } if (!$qry) { $qry = "1"; } // FIELDS ORDER global $sortby_scenes; if (!$sortby_scenes) { $sortby_scenes = $session->data['scenes_sort']; } else { if ($session->data['scenes_sort'] == $sortby_scenes) { if (Is_Integer(strpos($sortby_scenes, ' DESC'))) { $sortby_scenes = str_replace(' DESC', '', $sortby_scenes); } else { $sortby_scenes = $sortby_scenes . " DESC"; } } $session->data['scenes_sort'] = $sortby_scenes; } if (!$sortby_scenes) { $sortby_scenes = "PRIORITY DESC, TITLE"; } $out['SORTBY'] = $sortby_scenes; // SEARCH RESULTS $res = SQLSelect("SELECT * FROM scenes WHERE {$qry} ORDER BY " . $sortby_scenes); if ($this->action != 'admin') { $total = count($res);
global $save_qry; if ($save_qry) { $qry = $session->data['watchesmenu_qry']; } else { $session->data['watchesmenu_qry'] = $qry; } if (!$qry) { $qry = "1"; } // FIELDS ORDER global $sortby_watchesmenu; if (!$sortby_watchesmenu) { $sortby_watchesmenu = $session->data['watchesmenu_sort']; } else { if ($session->data['watchesmenu_sort'] == $sortby_watchesmenu) { if (Is_Integer(strpos($sortby_watchesmenu, ' DESC'))) { $sortby_watchesmenu = str_replace(' DESC', '', $sortby_watchesmenu); } else { $sortby_watchesmenu = $sortby_watchesmenu . " DESC"; } } $session->data['watchesmenu_sort'] = $sortby_watchesmenu; } if (!$sortby_watchesmenu) { $sortby_watchesmenu = "PRIORITY DESC, TITLE"; } $out['SORTBY'] = $sortby_watchesmenu; // SEARCH RESULTS $res = SQLSelect("SELECT * FROM watchesmenu WHERE {$qry} ORDER BY " . $sortby_watchesmenu); if ($res[0]['ID']) { colorizeArray($res);
global $save_qry; if ($save_qry) { $qry = $session->data['gpslocations_qry']; } else { $session->data['gpslocations_qry'] = $qry; } if (!$qry) { $qry = "1"; } // FIELDS ORDER global $sortby_gpslocations; if (!$sortby_gpslocations) { $sortby_gpslocations = $session->data['gpslocations_sort']; } else { if ($session->data['gpslocations_sort'] == $sortby_gpslocations) { if (Is_Integer(strpos($sortby_gpslocations, ' DESC'))) { $sortby_gpslocations = str_replace(' DESC', '', $sortby_gpslocations); } else { $sortby_gpslocations = $sortby_gpslocations . " DESC"; } } $session->data['gpslocations_sort'] = $sortby_gpslocations; } if (!$sortby_gpslocations) { $sortby_gpslocations = "TITLE"; } $out['SORTBY'] = $sortby_gpslocations; // SEARCH RESULTS $res = SQLSelect("SELECT * FROM gpslocations WHERE {$qry} ORDER BY " . $sortby_gpslocations); if ($res[0]['ID']) { colorizeArray($res);
global $save_qry; if ($save_qry) { $qry = $session->data['gpslog_qry']; } else { $session->data['gpslog_qry'] = $qry; } if (!$qry) { $qry = "1"; } // FIELDS ORDER global $sortby_gpslog; if (!$sortby_gpslog) { $sortby_gpslog = $session->data['gpslog_sort']; } else { if ($session->data['gpslog_sort'] == $sortby_gpslog) { if (Is_Integer(strpos($sortby_gpslog, ' DESC'))) { $sortby_gpslog = str_replace(' DESC', '', $sortby_gpslog); } else { $sortby_gpslog = $sortby_gpslog . " DESC"; } } $session->data['gpslog_sort'] = $sortby_gpslog; } if (!$sortby_gpslog) { $sortby_gpslog = "gpslog.ID DESC"; } $out['SORTBY'] = $sortby_gpslog; // SEARCH RESULTS $res = SQLSelect("SELECT gpslog.*, gpsdevices.TITLE as DEVICE_TITLE, gpslocations.TITLE as LOCATION_TITLE FROM gpslog LEFT JOIN gpsdevices ON gpsdevices.ID=gpslog.DEVICE_ID LEFT JOIN gpslocations ON gpslocations.ID=gpslog.LOCATION_ID WHERE {$qry} ORDER BY " . $sortby_gpslog); if ($res[0]['ID']) { paging($res, 50, $out);
global $save_qry; if ($save_qry) { $qry = $session->data['ru101_stations_qry']; } else { $session->data['ru101_stations_qry'] = $qry; } if (!$qry) { $qry = "1"; } // FIELDS ORDER global $sortby_ru101_stations; if (!$sortby_ru101_stations) { $sortby_ru101_stations = $session->data['ru101_stations_sort']; } else { if ($session->data['ru101_stations_sort'] == $sortby_ru101_stations) { if (Is_Integer(strpos($sortby_ru101_stations, ' DESC'))) { $sortby_ru101_stations = str_replace(' DESC', '', $sortby_ru101_stations); } else { $sortby_ru101_stations = $sortby_ru101_stations . " DESC"; } } $session->data['ru101_stations_sort'] = $sortby_ru101_stations; } if (!$sortby_ru101_stations) { $sortby_ru101_stations = "ID DESC"; } $out['SORTBY'] = $sortby_ru101_stations; // SEARCH RESULTS $res = SQLSelect("SELECT * FROM ru101_stations WHERE {$qry} ORDER BY " . $sortby_ru101_stations); if ($res[0]['ID']) { if ($this->action == 'admin') {
global $save_qry; if ($save_qry) { $qry = $session->data['calendar_categories_qry']; } else { $session->data['calendar_categories_qry'] = $qry; } if (!$qry) { $qry = "1"; } // FIELDS ORDER global $sortby_calendar_categories; if (!$sortby_calendar_categories) { $sortby_calendar_categories = $session->data['calendar_categories_sort']; } else { if ($session->data['calendar_categories_sort'] == $sortby_calendar_categories) { if (Is_Integer(strpos($sortby_calendar_categories, ' DESC'))) { $sortby_calendar_categories = str_replace(' DESC', '', $sortby_calendar_categories); } else { $sortby_calendar_categories = $sortby_calendar_categories . " DESC"; } } $session->data['calendar_categories_sort'] = $sortby_calendar_categories; } if (!$sortby_calendar_categories) { $sortby_calendar_categories = "PRIORITY DESC, TITLE"; } $out['SORTBY'] = $sortby_calendar_categories; // SEARCH RESULTS $res = SQLSelect("SELECT * FROM calendar_categories WHERE {$qry} ORDER BY " . $sortby_calendar_categories); if ($res[0]['ID']) { colorizeArray($res);
} // QUERY READY global $save_qry; if ($save_qry) { $qry=$session->data['elm_states_qry']; } else { $session->data['elm_states_qry']=$qry; } if (!$qry) $qry="1"; // FIELDS ORDER global $sortby_elm_states; if (!$sortby_elm_states) { $sortby_elm_states=$session->data['elm_states_sort']; } else { if ($session->data['elm_states_sort']==$sortby_elm_states) { if (Is_Integer(strpos($sortby_elm_states, ' DESC'))) { $sortby_elm_states=str_replace(' DESC', '', $sortby_elm_states); } else { $sortby_elm_states=$sortby_elm_states." DESC"; } } $session->data['elm_states_sort']=$sortby_elm_states; } if (!$sortby_elm_states) $sortby_elm_states="TITLE"; $out['SORTBY']=$sortby_elm_states; // SEARCH RESULTS $res=SQLSelect("SELECT * FROM elm_states WHERE $qry ORDER BY ".$sortby_elm_states); if ($res[0]['ID']) { $total=count($res); for($i=0;$i<$total;$i++) { // some action for every record if required
if ($nid != '') { $qry .= " AND USER_ID LIKE '%" . DBSafe($nid) . "%'"; $out['USER_ID'] = $nid; } global $name; if ($name != '') { $qry .= " AND NAME LIKE '%" . DBSafe($name) . "%'"; $out['NAME'] = $name; } // FIELDS ORDER global $sortby_user; if (!$sortby_user) { $sortby_user = $session->data['tlg_user_sort']; } else { if ($session->data['tlg_user_sort'] == $sortby_user) { if (Is_Integer(strpos($sortby_user, ' DESC'))) { $sortby_user = str_replace(' DESC', '', $sortby_user); } else { $sortby_user = $sortby_user . " DESC"; } } $session->data['tlg_user_sort'] = $sortby_user; } if (!$sortby_user) { $sortby_user = "******"; } $out['SORTBY'] = $sortby_user; // SEARCH RESULTS $res = SQLSelect("SELECT * FROM tlg_user ORDER BY " . $sortby_user); if ($res[0]['ID']) { paging($res, 20, $out);
global $save_qry; if ($save_qry) { $qry = $session->data['myblocks_categories_qry']; } else { $session->data['myblocks_categories_qry'] = $qry; } if (!$qry) { $qry = "1"; } // FIELDS ORDER global $sortby_myblocks_categories; if (!$sortby_myblocks_categories) { $sortby_myblocks_categories = $session->data['myblocks_categories_sort']; } else { if ($session->data['myblocks_categories_sort'] == $sortby_myblocks_categories) { if (Is_Integer(strpos($sortby_myblocks_categories, ' DESC'))) { $sortby_myblocks_categories = str_replace(' DESC', '', $sortby_myblocks_categories); } else { $sortby_myblocks_categories = $sortby_myblocks_categories . " DESC"; } } $session->data['myblocks_categories_sort'] = $sortby_myblocks_categories; } if (!$sortby_myblocks_categories) { $sortby_myblocks_categories = "ID DESC"; } $out['SORTBY'] = $sortby_myblocks_categories; // SEARCH RESULTS $res = SQLSelect("SELECT * FROM myblocks_categories WHERE {$qry} ORDER BY " . $sortby_myblocks_categories); if ($res[0]['ID']) { paging($res, 50, $out);
global $save_qry; if ($save_qry) { $qry = $session->data['security_rules_qry']; } else { $session->data['security_rules_qry'] = $qry; } if (!$qry) { $qry = "1"; } // FIELDS ORDER global $sortby_security_rules; if (!$sortby_security_rules) { $sortby_security_rules = $session->data['security_rules_sort']; } else { if ($session->data['security_rules_sort'] == $sortby_security_rules) { if (Is_Integer(strpos($sortby_security_rules, ' DESC'))) { $sortby_security_rules = str_replace(' DESC', '', $sortby_security_rules); } else { $sortby_security_rules = $sortby_security_rules . " DESC"; } } $session->data['security_rules_sort'] = $sortby_security_rules; } if (!$sortby_security_rules) { $sortby_security_rules = "ID DESC"; } $out['SORTBY'] = $sortby_security_rules; // SEARCH RESULTS $res = SQLSelect("SELECT * FROM security_rules WHERE {$qry} ORDER BY " . $sortby_security_rules); if ($this->single_rec) { $total_res = count($res);
if ($rec['ID']) { SQLUpdate($table_name, $rec); // update } else { $new_rec = 1; $rec['ID'] = SQLInsert($table_name, $rec); // adding new record } //updating 'IMAGE' (image) global $image; global $image_name; global $delete_image; if ($image != "" && file_exists($image) && !$delete_image) { $filename = strtolower(basename($image_name)); $ext = strtolower(end(explode(".", basename($image_name)))); if ((filesize($image) <= 0 * 1024 || 0 == 0) && Is_Integer(strpos('gif jpg png', $ext))) { $filename = $rec["ID"] . "_image_" . time() . "." . $ext; if ($rec["IMAGE"] != '') { @Unlink(ROOT . './cms/products//' . $rec["IMAGE"]); } Copy($image, ROOT . './cms/products//' . $filename); $rec["IMAGE"] = $filename; SQLUpdate($table_name, $rec); } } elseif ($delete_image) { @Unlink(ROOT . './cms/products//' . $rec["IMAGE"]); $rec["IMAGE"] = ''; SQLUpdate($table_name, $rec); } $out['OK'] = 1; } else {
/** * Parsing links to maintain modules structure and data * * Used to maintain framework structure by saving modules data * in query strings and hidden fields * Usage: * following will be changed * [#link param1=value1#] * <a href="?param1=value1¶m2=value2&..."> * <a href="?(module:{param1=value1, param2=value2, ...})¶m1=value1¶m2=value2&..."> * (note: to prevent link modification use <a href="?...<!-- modified -->">) * </form> (note: to prevent "</form>" changing use "</form><!-- modified -->" construction) * * @access private */ function parseLinks($result) { global $PHP_SELF; global $md; if (!IsSet($_SERVER['PHP_SELF'])) { $_SERVER['PHP_SELF']=$PHP_SELF; } if ($md!=$this->name) { $param_str=$this->saveParams(); } elseif (IsSet($this->owner)) { $param_str=$this->owner->saveParams(); } // a href links like <a href="?param=value"> if ((preg_match_all('/="\?(.*?)"/is', $result, $matches, PREG_PATTERN_ORDER))) { for($i=0;$i<count($matches[1]);$i++) { $link=$matches[1][$i]; if (!Is_Integer(strpos($link, '<!-- modified -->'))) { // skip custom links if (preg_match('/^\((.+?)\)(.*)$/', $link, $matches1)) { $other=$matches1[2]; $res_str=$this->codeParams($matches1[1]); $result=str_replace($matches[0][$i], '="'.$_SERVER['PHP_SELF'].'?pd='.$res_str.$other.'"', $result); } elseif (strpos($link, "md=")!==0) { $result=str_replace($matches[0][$i], '="'.$_SERVER['PHP_SELF'].'?pd='.$param_str.'&md='.$this->name.'&inst='.$this->instance.'&'.$link.'"', $result); // links } else { $result=str_replace('action="?', 'action="'.$_SERVER['PHP_SELF'].'"', $result); // forms } } else { // remove modified param $link=str_replace('<!-- modified -->', '', $link); $result=str_replace($matches[0][$i], '="'.$link.'"', $result); } } } // form hidden params if (preg_match_all('/\<input([^\<\>]+?)(value="\((.*?)\)")([^\<\>]*?)\>/is', $result, $matches, PREG_PATTERN_ORDER)) { for($i=0;$i<count($matches[3]);$i++) { if (strpos($matches[1][$i], 'type="hidden"') !== false || strpos($matches[4][$i], 'type="hidden"') !== false) { $res_str=$this->codeParams($matches[3][$i]); $result=str_replace($matches[2][$i], 'value="'.$res_str.'"', $result); } } } // form hidden params /* if (preg_match_all('/value="\((.*?)\)"/is', $result, $matches, PREG_PATTERN_ORDER)) { for($i=0;$i<count($matches[1]);$i++) { $res_str=$this->codeParams($matches[1][$i]); $result=str_replace($matches[0][$i], 'value="'.$res_str.'"', $result); } } */ // [#link ...#] if (preg_match_all('/\[#link (.*?)#\]/is', $result, $matches, PREG_PATTERN_ORDER)) { for($i=0;$i<count($matches[1]);$i++) { $link=$matches[1][$i]; if (preg_match('/^\((.+?)\)(.*)$/', $link, $matches1)) { $other=$matches1[2]; $res_str=$this->codeParams($matches1[1]); $result=str_replace($matches[0][$i], $_SERVER['PHP_SELF'].'?pd='.$res_str.$other, $result); } elseif (strpos($link, "md=")!==0) { $result=str_replace($matches[0][$i], $_SERVER['PHP_SELF'].'?pd='.$param_str.'&md='.$this->name.'&inst='.$this->instance.'&'.$link, $result); // links } } } // form hidden variables (exclude </form><!-- modified -->) $result=preg_replace("/<\/form>(?!<!-- modified -->)/is", "<input type=\"hidden\" name=\"pd\" value=\"$param_str\">\n<input type=\"hidden\" name=\"md\" value=\"".$this->name."\">\n<input type=\"hidden\" name=\"inst\" value=\"".$this->instance."\">\n</FORM><!-- modified -->", $result); // forms return $result; }
/** * [#inc ...#] tag parsing * * @access private * @param string $res template strings * @param array $hash data params * @param string $dir current template directory (for correct [#inc ...#] tags parsing) */ function parseIncludes(&$res, &$hash, $dir) { if (preg_match_all('/\[#inc (.*?)#\]/', $res, $matches, PREG_PATTERN_ORDER)) { $count_matches_0=count($matches[0]); for($i=0;$i<$count_matches_0;$i++) { $raw=$matches[1][$i]; if (Is_Integer(strpos($raw, '="'))) { // inc file parameters $new_hash=$hash; preg_match_all('/(\w+?)="(.*?)"/', $raw, $matches1, PREG_PATTERN_ORDER); $count_matches1_0=count($matches1[0]); for($k=0;$k<$count_matches1_0;$k++) { $new_hash[$matches1[1][$k]]=$matches1[2][$k]; $raw=str_replace($matches1[0][$k], '', $raw); } } else { $new_hash=&$hash; } $file_name=$dir.trim($raw); if (!file_exists($file_name)) { $res=str_replace($matches[0][$i], "<!-- Cannot find file $file_name -->", $res); } else { $new_root=dirname($file_name)."/"; if ((Defined("DEBUG_TEMPLATES")) && !Is_Integer(StrPos($file_name, ".js"))) { $id="block".(int)rand(0, 100000); $res=str_replace($matches[0][$i], "<div name=\"$file_name\" onMouseOver=\"dmo(event)\" onMouseOut=\"dmu(event)\" style=\"margin:0px\">".$this->parse($this->loadfile($file_name)."</div>", $new_hash, $new_root), $res); } else { $res=str_replace($matches[0][$i], $this->parse($this->loadfile($file_name), $new_hash, $new_root), $res); } } } } return $res; }
function run() { // running current module global $mode; global $name; $rep_ext = ""; if (preg_match('/\\.dev/is', $_SERVER['HTTP_HOST'])) { $rep_ext = '.dev'; } if (preg_match('/\\.jbk/is', $_SERVER['HTTP_HOST'])) { $rep_ext = '.jbk'; } if (preg_match('/\\.bk/is', $_SERVER['HTTP_HOST'])) { $rep_ext = '.bk'; } if ($rep_ext) { $out['LOCAL_PROJECT'] = 1; $out['REP_EXT'] = $rep_ext; $out['HOST'] = $_SERVER['HTTP_HOST']; $out['DOCUMENT_ROOT'] = dirname($_SERVER['SCRIPT_FILENAME']); } if ($mode == "edit") { global $mode2; $rec = SQLSelectOne("SELECT * FROM project_modules WHERE NAME='" . $name . "'"); $rec['NAME'] = $name; if ($mode2 == "update") { global $title; global $category; $rec['TITLE'] = $title; $rec['CATEGORY'] = $category; SQLUpdate("project_modules", $rec); $this->redirect("?name={$name}&mode=edit"); } elseif ($mode2 == "show") { if ($rec['HIDDEN']) { $rec['HIDDEN'] = 0; } else { $rec['HIDDEN'] = 1; } SQLUpdate('project_modules', $rec); $this->redirect("?"); } elseif ($mode2 == "install") { $rec = SQLSelectOne("SELECT * FROM project_modules WHERE NAME='" . $name . "'"); SQLExec("DELETE FROM project_modules WHERE NAME='" . $name . "'"); @unlink(DIR_MODULES . $name . "/installed"); include_once DIR_MODULES . $name . "/" . $name . ".class.php"; $obj = "\$object{$i}"; $code .= "{$obj}=new " . $name . ";\n"; @eval($code); // add module to control access global $session; $user = SQLSelectOne("SELECT * FROM admin_users WHERE LOGIN='******'"); if ($user['ID'] && !Is_Integer(strpos($user["ACCESS"], $name))) { if ($user["ACCESS"] != '') { $user["ACCESS"] .= ",{$name}"; } else { $user["ACCESS"] = $name; } SQLUpdate('admin_users', $user); } SQLExec("UPDATE project_modules SET HIDDEN='" . (int) $rec['HIDDEN'] . "' WHERE NAME='" . $name . "'"); // redirect to edit $this->redirect("?name={$name}&mode=edit"); } elseif ($mode2 == 'uninstall') { SQLExec("DELETE FROM project_modules WHERE NAME='" . $name . "'"); @unlink(DIR_MODULES . $name . "/installed"); if (file_exists(DIR_MODULES . $name . "/" . $name . ".class.php")) { include_once DIR_MODULES . $name . "/" . $name . ".class.php"; $obj = "\$object{$i}"; $code .= "{$obj}=new " . $name . ";\n"; $code .= "{$obj}" . "->uninstall();"; eval($code); } if ($out['LOCAL_PROJECT']) { $this->redirect("?mode=repository_uninstall&module={$name}"); } else { $this->redirect("?"); } } outHash($rec, $out); } if ($mode == 'repository_uninstall') { global $module; $out['MODULE'] = $module; } $out["MODE"] = $mode; $this->getModulesList(); $lst = $this->modules; for ($i = 0; $i < count($lst); $i++) { $rec = SQLSelectOne("SELECT *, DATE_FORMAT(ADDED, '%M %d, %Y (%H:%i)') as DAT FROM project_modules WHERE NAME='" . $lst[$i]['FILENAME'] . "'"); if (isset($rec['ID'])) { outHash($rec, $lst[$i]); } } $out["MODULES"] = $lst; $this->data = $out; $p = new parser(DIR_TEMPLATES . $this->name . "/" . $this->name . ".html", $this->data, $this); $this->result = $p->result; }
} // QUERY READY global $save_qry; if ($save_qry) { $qry=$session->data['calendar_events_qry']; } else { $session->data['calendar_events_qry']=$qry; } if (!$qry) $qry="1"; // FIELDS ORDER global $sortby_calendar_events; if (!$sortby_calendar_events) { $sortby_calendar_events=$session->data['calendar_events_sort']; } else { if ($session->data['calendar_events_sort']==$sortby_calendar_events) { if (Is_Integer(strpos($sortby_calendar_events, ' DESC'))) { $sortby_calendar_events=str_replace(' DESC', '', $sortby_calendar_events); } else { $sortby_calendar_events=$sortby_calendar_events." DESC"; } } $session->data['calendar_events_sort']=$sortby_calendar_events; } if (!$sortby_calendar_events) $sortby_calendar_events="ID DESC"; $out['SORTBY']=$sortby_calendar_events; // SEARCH RESULTS $res=SQLSelect("SELECT * FROM calendar_events WHERE $qry ORDER BY ".$sortby_calendar_events); if ($res[0]['ID']) { paging($res, 50, $out); // search result paging colorizeArray($res); $total=count($res);
global $save_qry; if ($save_qry) { $qry = $session->data['commands_qry']; } else { $session->data['commands_qry'] = $qry; } if (!$qry) { $qry = "1"; } // FIELDS ORDER global $sortby; if (!$sortby) { $sortby = $session->data['commands_sort']; } else { if ($session->data['commands_sort'] == $sortby) { if (Is_Integer(strpos($sortby, ' DESC'))) { $sortby = str_replace(' DESC', '', $sortby); } else { $sortby = $sortby . " DESC"; } } $session->data['commands_sort'] = $sortby; } $sortby = "PRIORITY DESC, TITLE"; $out['SORTBY'] = $sortby; // SEARCH RESULTS $res = SQLSelect("SELECT * FROM commands WHERE {$qry} ORDER BY {$sortby}"); if ($res[0]['ID']) { if ($this->action != 'admin') { $dynamic_res = array(); $total = count($res);
/** * [#inc ...#] tag parsing * * @access private * @param string $res template strings * @param array $hash data params * @param string $dir current template directory (for correct [#inc ...#] tags parsing) */ function parseIncludes(&$res, &$hash, $dir) { if (preg_match_all('/\\[#inc (.*?)#\\]/', $res, $matches, PREG_PATTERN_ORDER)) { $count_matches_0 = count($matches[0]); for ($i = 0; $i < $count_matches_0; $i++) { $raw = $matches[1][$i]; if (Is_Integer(strpos($raw, '="'))) { // inc file parameters $new_hash = $hash; preg_match_all('/(\\w+?)="(.*?)"/', $raw, $matches1, PREG_PATTERN_ORDER); $count_matches1_0 = count($matches1[0]); for ($k = 0; $k < $count_matches1_0; $k++) { $new_hash[$matches1[1][$k]] = $matches1[2][$k]; $raw = str_replace($matches1[0][$k], '', $raw); } } else { $new_hash =& $hash; } $file_name = $dir . trim($raw); $new_root = dirname($file_name) . "/"; if (defined('ALTERNATIVE_TEMPLATES')) { $alt_path = str_replace('templates/', ALTERNATIVE_TEMPLATES . '/', $file_name); if (file_exists($alt_path)) { $file_name = $alt_path; } } if (!file_exists($file_name)) { $res = str_replace($matches[0][$i], "<!-- Cannot find file {$file_name} -->", $res); } else { if (Defined("DEBUG_MODE") && !Is_Integer(StrPos($file_name, ".js"))) { $id = "block" . (int) rand(0, 100000); //$res=str_replace($matches[0][$i], "<!-- begin of file $file_name -->".$this->parse($this->loadfile($file_name)."<!-- end of file $file_name -->", $new_hash, $new_root), $res); $res = str_replace($matches[0][$i], "" . $this->parse($this->loadfile($file_name) . "", $new_hash, $new_root), $res); } else { $res = str_replace($matches[0][$i], $this->parse($this->loadfile($file_name), $new_hash, $new_root), $res); } } } } return $res; }
global $save_qry; if ($save_qry) { $qry = $session->data['veradevices_qry']; } else { $session->data['veradevices_qry'] = $qry; } if (!$qry) { $qry = "1"; } // FIELDS ORDER global $sortby_veradevices; if (!$sortby_veradevices) { $sortby_veradevices = $session->data['veradevices_sort']; } else { if ($session->data['veradevices_sort'] == $sortby_veradevices) { if (Is_Integer(strpos($sortby_veradevices, ' DESC'))) { $sortby_veradevices = str_replace(' DESC', '', $sortby_veradevices); } else { $sortby_veradevices = $sortby_veradevices . " DESC"; } } $session->data['veradevices_sort'] = $sortby_veradevices; } if (!$sortby_veradevices) { $sortby_veradevices = "TITLE"; } $out['SORTBY'] = $sortby_veradevices; // SEARCH RESULTS $res = SQLSelect("SELECT * FROM veradevices WHERE {$qry} ORDER BY " . $sortby_veradevices); if ($res[0]['ID']) { colorizeArray($res);
global $save_qry; if ($save_qry) { $qry = $session->data['ru101_categories_qry']; } else { $session->data['ru101_categories_qry'] = $qry; } if (!$qry) { $qry = "1"; } // FIELDS ORDER global $sortby_ru101_categories; if (!$sortby_ru101_categories) { $sortby_ru101_categories = $session->data['ru101_categories_sort']; } else { if ($session->data['ru101_categories_sort'] == $sortby_ru101_categories) { if (Is_Integer(strpos($sortby_ru101_categories, ' DESC'))) { $sortby_ru101_categories = str_replace(' DESC', '', $sortby_ru101_categories); } else { $sortby_ru101_categories = $sortby_ru101_categories . " DESC"; } } $session->data['ru101_categories_sort'] = $sortby_ru101_categories; } if (!$sortby_ru101_categories) { $sortby_ru101_categories = "ID DESC"; } $out['SORTBY'] = $sortby_ru101_categories; // SEARCH RESULTS $res = SQLSelect("SELECT * FROM ru101_categories WHERE {$qry} ORDER BY " . $sortby_ru101_categories); if ($res[0]['ID']) { paging($res, 50, $out);