config file cannot be included directly'); } //if (LOCAL_MODE) { // Settings for local midas server do not edit here // database settings //$ARR_CFGS["db_host"] = 'localhost'; //$ARR_CFGS["db_name"] = 'khopadi_khopadi'; //$ARR_CFGS["db_user"] = 'khopadi_khopadi'; // $ARR_CFGS["db_pass"] = 'bagesh_123'; //define('SITE_SUB_PATH', ''); //} else { // Settings for live server edit whenever shifting site to different server // database settings // Path for site // database settings $ARR_CFGS["db_host"] = 'localhost'; $ARR_CFGS["db_name"] = 'seowemrv_zaicacin'; $ARR_CFGS["db_user"] = 'seowemrv_zaic'; $ARR_CFGS["db_pass"] = 'fTvmt%g^Me%p'; // Path for site define('SITE_SUB_PATH', ''); //} define('SITE_WS_PATH', 'http://'.$_SERVER['HTTP_HOST'].SITE_SUB_PATH); define('ADMIN_DIR', 'zaic-admin123'); define('ADMIN_WS_PATH', SITE_WS_PATH.'/'.ADMIN_DIR); define('ADMIN_SUB_PATH', SITE_SUB_PATH.'/'.ADMIN_DIR); define('ADMIN_FS_PATH', SITE_FS_PATH.'/'.ADMIN_DIR); define('THUMB_CACHE_DIR', 'thumb_cache'); define('PLUGINS_DIR', 'includes/plugins'); define('MODULES_DIR', 'modules'); define('UP_FILES_FS_PATH', SITE_FS_PATH.'/uploaded_files'); define('UP_FILES_WS_PATH', SITE_WS_PATH.'/uploaded_files'); define('DEFAULT_START_YEAR', 2006); define('DEFAULT_END_YEAR', date('Y')+10); define('SITE_NAME', ''); define('TEST_MODE', false); define('DEF_PAGE_SIZE', 25); define('ADMIN_DIR', 'admin'); ?> 0) { $str_dropdown = ""; } return $str_dropdown; } // array_dropdown: Updated 31 may 2006 function array_dropdown( $arr, $sel_value='', $name='', $extra='', $choose_one='', $arr_skip= array()) { $combo=" $value \n"; $j++; } } } $j--; // echo "$cols-($j%$cols)=".$cols-($j%$cols); // echo "
($j%$cols)=".($j%$cols); for($x = $j % $cols;$x < 4;$x++) { if ($x != 3) { $checkstr .= " \n"; } else { $checkstr .= " \n"; } } $checkstr .= ""; } return $checkstr; } // array_radios: Updated 8 may 2008 function array_radios($arr_tmp, $name, $checksel = '', $cols, $apply_width =true, $style = '', $tableattr = '', $missit='') { if ($style != "") { $style = "class='" . $style . "'"; } $colwidth = 100 / $cols; $colwidth = round($colwidth, 2); $j = 1; /* $arr_tmp['Any']="Any"; if($checksel==''){ $checksel=Array("Any"); } */ foreach($arr_tmp as $key => $value) { $tochecked = ""; if ($checksel == $key) { $tochecked = "checked"; } if ($key != $missit) { if ($value != "") { if ($j == 1) { $checkstr .= "\n"; } else if (($j % $cols) == 1) { $checkstr .= "\n"; } $checkstr .= ''; $j++; } } } $j--; // echo "$cols-($j%$cols)=".$cols-($j%$cols); // echo "
($j%$cols)=".($j%$cols); for($x = $j % $cols;$x < 4;$x++) { if ($x != 3) { $checkstr .= "\n"; } else { $checkstr .= "\n"; } } $checkstr .= "
'.$value.'   
"; return $checkstr; } // date_dropdown: Updated 31 may 2006 function date_dropdown($pre, $selected_date = '', $start_year='', $end_year = '',$extrmm) { $cur_date = date("Y-m-d"); $cur_date_day = substr($cur_date, 8, 2); $cur_date_month = substr($cur_date, 5, 2); $cur_date_year = substr($cur_date, 0, 4); if ($selected_date != '') { $selected_date_day = substr($selected_date, 8, 2); $selected_date_month = substr($selected_date, 5, 2); $selected_date_year = substr($selected_date, 0, 4); } $date_dropdown .= month_dropdown($pre . "month", $selected_date_month,$extrmm); $date_dropdown .= day_dropdown($pre . "day", $selected_date_day,$extrmm); // echo($pre . "year: ". $selected_date_year); $date_dropdown .= year_dropdown($pre . "year", $selected_date_year, $start_year, $end_year,$extrmm); return $date_dropdown; } // month_dropdown: Updated 31 may 2006 function month_dropdown($name, $selected_date_month = '', $extra='') { global $ARR_MONTHS; $date_dropdown = " "; return $date_dropdown; } // day_dropdown: Updated 31 may 2006 function day_dropdown($name, $selected_date_day = '', $extra='') { $date_dropdown .= ""; return $date_dropdown; } // year_dropdown: Updated 7 may 2008 function year_dropdown($name, $selected_date_year = '', $start_year ='', $end_year ='', $extra='') { if ($start_year == '') { $start_year = date('Y')-12; } if ($end_year == '') { $end_year = date('Y')-100; } if($start_year<$end_year ) { $tmp = $start_year; $start_year = $end_year; $end_year = $tmp; } $date_dropdown .= ""; return $date_dropdown; } // time_dropdown: Updated 31 may 2006 function time_dropdown($pre, $selected_time = '') { // echo("
selected_time:$selected_time"); if ($selected_time != '' && $selected_time != ':') { $selected_hour = substr($selected_time, 0, 2); $selected_minute = substr($selected_time, 3, 2); /* if($selected_hour >11){ $selected_ampm = "PM"; $selected_hour -= 12; }else{ $selected_ampm = "AM"; } if($selected_hour==0){ $selected_hour = 12; } */ } $str .= hour_dropdown($pre, $selected_hour); $str .= ':'; $str .= minute_dropdown($pre, $selected_minute); return $str; // echo "
$selected_hour, $selected_minute $selected_ampm
"; } // hour_dropdown: Updated 31 may 2006 function hour_dropdown($pre, $selected_hour ) { $str .= ""; return $str; } // minute_dropdown: Updated 31 may 2006 function minute_dropdown($pre, $selected_minute ) { $str .= ""; return $str; } // ampm_dropdown: Updated 31 may 2006 function ampm_dropdown($pre, $selected_ampm) { $str .= "'."\n"; } return $s; } // array_radios: Updated 7 may 2008 function _array_radios($arr, $sel_value = '', $name = '', $cols = 3, $apply_width= true, $style='', $extra = '') { if ($style != "") { $style = "class='" . $style . "'"; } $colwidth = 100 / $cols; $colwidth = round($colwidth, 2); $j = 1; /* $arr_tmp['Any']="Any"; if($checksel==''){ $checksel=Array("Any"); } */ foreach($arr as $key => $value) { $tochecked = ""; if (is_array($sel_value) && in_array($key, $sel_value)) { $tochecked = "checked"; } if ($key != $missit) { if ($value != "") { if ($j == 1) { $checkstr .= "\n"; } else if (($j % $cols) == 1 || $cols==1) { $checkstr .= "\n"; } $checkstr .= ''; $j++; } } } $j--; // echo "$cols-($j%$cols)=".$cols-($j%$cols); // echo "
($j%$cols)=".($j%$cols); for($x = $j % $cols;$x < 4;$x++) { if ($x != 3) { $checkstr .= "\n"; } else { $checkstr .= "\n"; } } $checkstr .= "
'.$value.'   
"; return $checkstr; } // pagesize_dropdown: Updated 31 may 2006 function pagesize_dropdown($name, $value) { $arr = array('10'=>'10','25'=>'25','50'=>'50','100'=>'100'); $m = $_GET; unset($m['pagesize']); return array_dropdown($arr, $value , $name, ' onchange="location.href=\''.$_SERVER['PHP_SELF'].qry_str($m).'&pagesize=\'+this.value" '); } function qry_str_to_hidden($str) { $fields=''; if(substr($str,0,1)=='?') { $str = substr($str,1); } $arr = explode('&', $str); foreach($arr as $pair) { list($name, $value) = explode('=',$pair); if($name!='') { $fields.=''; } } return $fields; } function enum_dropdown($table, $column, $name, $sel_value='', $extra='', $choose_one='', $arr_skip= array()) { $arr = enum_to_array($table, $column); return array_dropdown( $arr, $sel_value, $name, $extra, $choose_one, $arr_skip); } function recursive_dropdown( $id_column, $name_column, $parent_id_column, $order_column, $table, $where, $name , $sel_value, $skip, $extra='', $choose_one='', $parent_id=0, $level=0) //function recursive_drop_down( $name, $sel_value, $skip, $extra='', $choose_one='', $page_parent_id=0, $level=0) { $level++; $sql = "select $id_column, $name_column from $table where $parent_id_column='$parent_id' and $id_column!='$skip'"; if($where!='') { $sql .= " and $where "; } $sql .= " order by $order_column "; //echo("
sql: $sql"); $result = db_query($sql); if(mysql_num_rows($result)) { if($level==1) { $str_dropdown.=""; //} } // ms_form_value: Updated 31 may 2006 function ms_form_value($var) { return is_array($var) ? array_map('ms_form_value', $var) : htmlspecialchars(stripslashes(trim($var))); } // ms_display_value: Updated 31 may 2006 function ms_display_value($var) { return is_array($var) ? array_map('ms_display_value', $var) : nl2br(htmlspecialchars(stripslashes(trim($var)))); } // ms_stripslashes: Updated 31 may 2006 function ms_stripslashes($var) { return is_array($var) ? array_map('ms_stripslashes', $var) : stripslashes(trim($var)); } // ms_addslashes: Updated 31 may 2006 function ms_addslashes($var) { return is_array($var) ? array_map('ms_addslashes', $var) : addslashes(trim($var)); } // ms_trim: Updated 31 may 2006 function ms_trim($var) { return is_array($var) ? array_map('ms_trim', $var) : trim($var); } // is_image_valid: Updated 31 may 2006 function is_image_valid($file_name) { global $ARR_VALID_IMG_EXTS; $ext = file_ext($file_name); if (in_array($ext, $ARR_VALID_IMG_EXTS)) { return true; } else { return false; } } // getmicrotime: Updated 31 may 2006 function getmicrotime() { list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec); } // file_ext: Updated 31 may 2006 function file_ext($file_name) { $path_parts = pathinfo($file_name); $ext = strtolower($path_parts["extension"]); return $ext; } // blank_filter: Updated 31 may 2006 function blank_filter($var) { $var = trim($var); return ($var != '' && $var != ' '); } // apply_filter: Updated 25 sep 2006 function apply_filter($sql, $field, $field_filter, $column) { if ($field!='') { if ($field_filter == "=" || $field_filter == "") { $sql = $sql . " and $column = '$field' "; } else if ($field_filter == "like") { $sql = $sql . " and $column like '%$field%' "; } else if ($field_filter == "starts_with") { $sql = $sql . " and $column like '$field%' "; } else if ($field_filter == "ends_with") { $sql = $sql . " and $column like '%$field' "; } else if ($field_filter == "not_contains") { $sql = $sql . " and $column not like '%$field%' "; } else if ($field_filter == ">") { $sql = $sql . " and $column > '$field' "; } else if ($field_filter == "<") { $sql = $sql . " and $column < '$field' "; } else if ($field_filter == "!=") { $sql = $sql . " and $column != '$field' "; } } return $sql; } // filter_dropdown: Updated 17 July 2006 // Should replace older version function function filter_dropdown($name = 'filter', $sel_value) { $arr = array( "like" => 'Contains', '=' => 'Is', "starts_with" => 'Starts with', "ends_with" => 'Ends with', "!=" => 'Is not' , "not_contains" => 'Not contains'); return array_dropdown($arr, $sel_value, $name); } // make_url: Updated 31 may 2006 function make_url($url) { $parsed_url = parse_url($url); if ($parsed_url['scheme'] == '') { return 'http://' . $url; } else { return $url; } } // date_to_mysql: Updated 31 may 2006 function date_to_mysql($date) { list($month, $day, $year) = explode('/', $date); return "$year-$month-$day"; } // export_delimited_file: Updated 31 may 2006 function export_delimited_file($sql, $arr_columns, $file_name='', $arr_substitutes='', $arr_tpls='' ){ //session_cache_limiter('public'); //header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); //header("Content-Type: application/force-download"); if($file_name=='') { $file_name = time().'.txt'; } header("Content-type: application/txt"); header("Content-Disposition: attachment; filename=$file_name"); $arr_db_cols= array_keys($arr_columns); $arr_headers= array_values($arr_columns); //ms_print_r($arr_columns); //ms_print_r($arr_db_cols); //ms_print_r($arr_headers); //ms_print_r($arr_headers); //ms_print_r($arr_headers); $str_columns = implode(',', $arr_db_cols); $sql= "select ".$str_columns." $sql" ; $result= db_query($sql); $num_cols = count($arr_columns); //$i=0; foreach($arr_headers as $header){ //$i++; echo $header."\t"; //if($i!=$num_cols){ // echo "\t"; //} } while($line=mysql_fetch_array($result, MYSQL_ASSOC)) { echo "\r\n"; //echo("
"); foreach($line as $key => $value){ $value=str_replace("\n","",$value); $value=str_replace("\r","",$value); $value=str_replace("\t","",$value); if(is_array($arr_substitutes[$key])){ $value = $arr_substitutes[$key][$value]; } if(isset($arr_tpls[$key])){ $code = str_replace('{1}', $value, $arr_tpls[$key]); //echo ("\$value = $code;"); //echo("
"); eval ("\$value = $code;"); } echo $value."\t"; } } } // checkpoint: Updated 2 sep 2006 // to check how much time is lapsed before first call of this function function checkpoint($from_start = false) { global $PREV_CHECKPOINT; if($PREV_CHECKPOINT==''){ $PREV_CHECKPOINT = SCRIPT_START_TIME; } $cur_microtime = getmicrotime(); if($from_start) { return round($cur_microtime - SCRIPT_START_TIME,4); } else { $time_taken = $cur_microtime - $PREV_CHECKPOINT; $PREV_CHECKPOINT = $cur_microtime; return round($time_taken,4); } } // readable_col_name: Updated 31 may 2006 function readable_col_name($str) { return ucwords( str_replace('_', ' ', strtolower($str) ) ); } // ms_echo: Updated 31 may 2006 function ms_echo($str) { if(LOCAL_MODE){ echo($str); } } // get_qry_str: Updated 31 may 2006 function get_qry_str($over_write_key = array(), $over_write_value = array()) { global $_GET; $m = $_GET; if (is_array($over_write_key)) { $i = 0; foreach($over_write_key as $key) { $m[$key] = $over_write_value[$i]; $i++; } } else { $m[$over_write_key] = $over_write_value; } $qry_str = qry_str($m); return $qry_str; } // qry_str: Updated 23 feb 2008 function qry_str($arr, $skip = '') { $s = "?"; $i = 0; foreach($arr as $key => $value) { if (is_array($skip)) { // echo("
key:$key"); if(!in_array($key, $skip)) { if (is_array($value)) { foreach($value as $value2) { $i==0?$i=1:$s.='&'; if($value2=='0' || $value2!='') { $s .= $key . '[]=' . $value2; } } } else { $i==0?$i=1:$s.='&'; if($value=='0' || $value!='') { $s .= "$key=$value"; } } } } else { if ($key != $skip) { if (is_array($value)) { foreach($value as $value2) { $i==0?$i=1:$s.='&'; if($value2=='0' || $value2!='') { $s .= $key . '[]=' . $value2; } } } else { $i==0?$i=1:$s.='&'; if($value=='0' || $value!='') { $s .= "$key=$value"; } } } } } return $s; } // sort_arrows: Updated 31 may 2006 function sort_arrows($column) { return ' '; } // select_option: Updated 31 may 2006 function select_option($s, $s1) { if ($s == $s1) { echo " selected "; } } // ----------------------------------------------------- // is_post_back: Updated 31 may 2006 function is_post_back(){ if(count($_POST)>0) { return true; } else { return false; } /* $cur_page = $_SERVER['REQUEST_URI']; $q_pos = strpos($cur_page, '?'); if($q_pos!==false) { $cur_page = substr($cur_page, 0 , $q_pos); } $parsed_url = parse_url($_SERVER['HTTP_REFERER']); $referer = $parsed_url['path']; //echo "
referer: ".$referer; //echo "
cur_page: ".$cur_page; if(strtolower($_SERVER['REQUEST_METHOD'])=='post' && $referer == $cur_page) { return true; } else { return false; } */ } // ms_parse_keywords: Updated 31 may 2006 // Temporary function. Need to be made more elegant or replace with regular expression function ms_parse_keywords($keywords) { $arr_keywords = array(); $dq_end =true; $sp_end = true; for ($i=0;$icur_token:$cur_token, cur_keyword:$cur_keyword, dq_start:$dq_start, dq_end:$dq_end, sp_start:$sp_start, sp_end:$sp_end,"; $cur_token = $keywords[$i]; if($cur_token=='"') { if($dq_start) { $dq_end = true; $dq_start = false; $arr_keywords[] = $cur_keyword; $cur_keyword = ''; } else if($dq_end) { $dq_end = false; $dq_start = true; $sp_start = false; } else { $dq_end = false; $dq_start = true; } } else if($cur_token==' ') { if($sp_start || $dq_end) { $sp_end = true; $sp_start = false; $arr_keywords[] = $cur_keyword; $cur_keyword = ''; } else if($sp_end && !$dq_start) { $sp_end = false; $sp_start = true; } else if($dq_start) { $cur_keyword .= $cur_token; } } else { $cur_keyword .= $cur_token; } } $arr_keywords[] =$cur_keyword; return $arr_keywords; } // sql_to_assoc_array: Updated 1 aug 2006 function sql_to_assoc_array($sql) { $arr = array(); $result = db_query($sql); while ($line = mysql_fetch_array($result)) { $line = ms_form_value($line); $arr[$line[0]] = $line[1]; } return $arr; } // sql_to_index_array: Updated 1 aug 2006 function sql_to_index_array($sql) { $arr = array(); $result = db_query($sql); while ($line = mysql_fetch_array($result)) { $line = ms_form_value($line); $arr[] = $line[0]; } return $arr; } // sql_to_array: Updated 1 aug 2006 function sql_to_array($sql) { $arr = array(); $result = db_query($sql); while ($line = mysql_fetch_array($result)) { $line = ms_form_value($line); array_push($arr, $line); } return $arr; } // get_unique_file_name: Updated 2 aug 2006 function get_unique_file_name($file_name) { return str_shuffle(md5(uniqid(rand(), true))) . '.' . file_ext($file_name); } // enum_to_array: Updated 14 sep 2006 function enum_to_array($table, $column) { $result = db_query("show fields from $table"); while ($line_raw = mysql_fetch_assoc($result)) { $line = ms_display_value($line_raw); if($line['Field']==$column) { $Type = $line['Type']; $Type = substr($Type,6,-2); $arr_tmp = explode("','", $Type); foreach($arr_tmp as $val) { $arr[$val]=$val; } return $arr; } } } function absolute_to_fs($path) { $path = str_replace(SITE_SUB_PATH , '' , str_replace('\\', '/', $path)); return SITE_FS_PATH.'/'.$path; } function fs_to_absolute($path) { return str_replace(SITE_FS_PATH , SITE_SUB_PATH, str_replace('\\', '/', $path)); } function get_absolute_dir($file) { return fs_to_absolute(dirname($file)); } function make_field($field_info) { $type = $field_info['type']; $name = $field_info['name']; $sel_value = $field_info['sel_value']; $values = $field_info['values']; $extra = $field_info['extra']; if($type=='select' || $type=='radio' || $type=='checkbox') { $arr_tmp = split("\n", $values); $arr_values = array(); foreach($arr_tmp as $row) { list($key, $value) = explode("|", $row); $arr_values[$key] = $value; } } $str = ''; switch($type) { case 'textfield': $str = ''; break; case 'password': $str = ''; break; case 'textarea': $str = ''; break; case 'select': if(is_array($arr_values)) { $str = ''; } break; case 'list': if(is_array($arr_values)) { $str = ''; } break; case 'radio': if(is_array($arr_values)) { foreach($arr_values as $key => $value) { $str .= ' '.$value; } } break; case 'checkbox': if(is_array($arr_values)) { foreach($arr_values as $key => $value) { $str .= ' '.$value; } } break; case 'hidden': $str = ''; break; case 'function': $function = str_replace('{1}', $name, $values); $function = str_replace('{v}', $extra, $function); //echo("$function"); $str = eval('echo '.$function); break; } return $str; } function file_size_format($file_size) { if($file_size>1024*1024*1024) { return round($file_size/(1024*1024*1024), 2).' GB'; } else if($file_size>1024*1024) { return round($file_size/(1024*1024), 2).' MB'; } else if($file_size>1024) { return round($file_size/1024, 2).' KB'; } else { return round($file_size, 2).' bytes'; } } function file_absolute_path($file) { return fs_to_absolute(dirname($file)); } function load_plugin($name) { global $ARR_LOADED_PLUGINS; $dir = SITE_FS_PATH.'/'.PLUGINS_DIR.'/'.$name; if(file_exists($dir.'/midas_plugin.php')) { require_once($dir.'/midas_plugin.php'); $ARR_LOADED_PLUGINS[] = $name; $ARR_PLUGINS_INFO[$name] = array('version'=>$plugin_version); } else { //trigger_error("
Cannot load plugin: $name
", E_USER_ERROR); } } function load_module($name) { global $ARR_LOADED_MODULES; $dir = SITE_FS_PATH.'/'.MODULES_DIR.'/'.$name; if(file_exists($dir.'/midas_module.php')) { require_once($dir.'/midas_module.php'); $ARR_LOADED_MODULES[] = $name; $ARR_LOADED_MODULES[$name] = $module_version; } else { //trigger_error("
Cannot load module: $name
", E_USER_ERROR); } } function plugin_loaded($name) { global $ARR_LOADED_PLUGINS; if(in_array($name, $ARR_LOADED_PLUGINS)) { return true; } return false; } function plugin_fs_path($name='') { global $CURRENT_PLUGIN; if($name=='') { $name = $CURRENT_PLUGIN; } return SITE_FS_PATH.'/'.PLUGINS_DIR.'/'.$name; } function plugin_ws_path($name='') { global $CURRENT_PLUGIN; if($name=='') { $name = $CURRENT_PLUGIN; } return SITE_WS_PATH.'/'.PLUGINS_DIR.'/'.$name; } function plugin_sub_path($name='') { global $CURRENT_PLUGIN; if($name=='') { $name = $CURRENT_PLUGIN; } return SITE_SUB_PATH.'/'.PLUGINS_DIR.'/'.$name; } function plugin_admin_sub_path($name='') { global $CURRENT_PLUGIN; if($name=='') { $name = $CURRENT_PLUGIN; } return SITE_SUB_PATH.'/'.PLUGINS_DIR.'/'.$name.'/'.ADMIN_DIR; } function plugin_admin_fs_path($name='') { global $CURRENT_PLUGIN; if($name=='') { $name = $CURRENT_PLUGIN; } return SITE_FS_PATH.'/'.PLUGINS_DIR.'/'.$name.'/'.ADMIN_DIR; } function current_sub_path() { global $CURRENT_SUB_PATH; return $CURRENT_SUB_PATH; } function module_loaded($name) { global $ARR_LOADED_MODULES; if(in_array($name, $ARR_LOADED_MODULES)) { return true; } return false; } function module_fs_path($name='') { global $CURRENT_MODULE; if($name=='') { $name = $CURRENT_MODULE; } return SITE_FS_PATH.'/'.MODULES_DIR.'/'.$name; } function module_ws_path($name='') { global $CURRENT_MODULE; if($name=='') { $name = $CURRENT_MODULE; } return SITE_WS_PATH.'/'.MODULES_DIR.'/'.$name; } function module_sub_path($name='') { global $CURRENT_MODULE; if($name=='') { $name = $CURRENT_MODULE; } return SITE_SUB_PATH.'/'.MODULES_DIR.'/'.$name; } function module_admin_sub_path($name='') { global $CURRENT_MODULE; if($name=='') { $name = $CURRENT_MODULE; } return SITE_SUB_PATH.'/'.MODULES_DIR.'/'.$name.'/'.ADMIN_DIR; } function module_admin_fs_path($name='') { global $CURRENT_MODULE; if($name=='') { $name = $CURRENT_MODULE; } return SITE_FS_PATH.'/'.MODULES_DIR.'/'.$name.'/'.ADMIN_DIR; } function array_to_admin_nav($array) { $string = ''; foreach($array as $href => $label){ $string .= '
  • '.$label.'
  • '; } return $string; } function array_index_to_assoc($array) { $array_new = array(); foreach($array as $value){ $array_new[$value] = $value; } } ?>