00001 <?php
00002
00003
00023 function ListAdd($needle, &$haystack)
00024 {
00025 $list = unserialize($haystack);
00026 if (!is_array($list))
00027 $list = array();
00028 if (in_array($needle, $list))
00029 return;
00030 $list[count($list)] = $needle;
00031 $haystack = serialize($list);
00032 }
00033
00041 function ListDel($needle, &$haystack)
00042 {
00043 $list = unserialize($haystack);
00044 if (!is_array($list))
00045 return;
00046 if (!in_array($needle, $list))
00047 return;
00048
00049 $key = array_search($needle, $list);
00050 unset($list[$key]);
00051 $haystack = serialize($list);
00052 }
00053
00065 function CallHooks()
00066 {
00067 $params = func_get_args();
00068 $hookname = array_shift($params);
00069
00070 $toCall = get_entry('hooks',$hookname);
00071 if ($toCall == '')
00072 return;
00073
00074 $hooks = unserialize($toCall);
00075 if (!is_array($hooks))
00076 return;
00077
00078 foreach ($hooks as $hook)
00079 {
00080 $hook .= "_$hookname";
00081 if (is_callable($hook))
00082 call_user_func_array($hook, $params);
00083 }
00084 }
00085
00093 function get_option($haystack, $needle)
00094 {
00095 $options = unserialize($haystack);
00096 if (!is_array($options))
00097 return '';
00098 if (!isset($options[$needle]))
00099 return '';
00100 return $options[$needle];
00101 }
00102
00113 function set_option(&$haystack, $needle, $value)
00114 {
00115 $options = unserialize($haystack);
00116 if (!is_array($options))
00117 $options = array();
00118 $options[$needle] = $value;
00119 $haystack = serialize($options);
00120 }
00121
00127 function is_standard_page()
00128 {
00129 $_REQUEST['pt'] == '' ? $pagetype = 'normal' : $pagetype = $_REQUEST['pt'];
00130
00131 $ns_pages = get_entry('config', 'ns_pages');
00132 $haystack = unserialize($ns_pages);
00133 if (!is_array($haystack))
00134 return true;
00135
00136 if (array_search($pagetype, $list))
00137 return false;
00138
00139 return true;
00140 }
00141
00151 function module_installed()
00152 {
00153 $style = get_entry('config', 'stylename');
00154 include "styles/$style/activate.inc.php";
00155 call_user_func("style_$style" . '_activate');
00156 }
00157 ?>