function arrtolower($_arr) { foreach ($_arr as $k => $v) { if (is_array($v)) { arrtolower($v); } $_arr[$k] = strtolower($v); } return $_arr; }
/** * 返回未安装的APP名 * @author MaWei (http://www.phpyrb.com) * @date 2014-10-8 下午5:42:38 */ function getUninstallAppName() { //检测app安装目录里的APP $file = getDirFile(C('INSTALLAPP_APP')); $file = arrtolower($file); //已安装的APP $is_exsit = $this->getAppList(); $is_exsit = arr2to1($is_exsit, 'app_name'); //取差集 $unexsit = array_diff($file, $is_exsit); return $unexsit; }
function getArray($BaseDN, $Filter = false, $ADAttributes, $Sort = array('name'), $SortType = "ASC", $WithoutSizeLimit = false) { if (!$Filter) { $Filter = self::getEmptyFilter(); } $ADAttributes = arrtolower($ADAttributes); $SizeOf = sizeof($ADAttributes); if ($Entries = self::getEntriesWithoutSizeLimit($BaseDN, $Filter, $ADAttributes, $WithoutSizeLimit)) { //Сортировка //----------------------------------------------------------------------------- if (is_array($Sort)) { for ($i = 0, $d = 0; $i < $Entries['count']; $i++) { foreach ($Sort as $key => $val) { if (is_array($val)) { $d = ""; foreach ($val as $key1 => $val1) { if (is_array($val1)) { foreach ($val1 as $key2 => $val2) { switch ($val2) { case 'order_replace': $d .= $key2; $LastVal[$key - 1] = str_replace($key1, $d, $LastVal[$key - 1]); //!!!! Возможно деяние должно быть другим break; } } } switch ($val1) { case 'ad_def_full_name': $LastVal[$key - 1] = preg_replace("/([ёA-zА-я-]+[\\s]{1}[ёA-zА-я]{1}.)[\\s]{1}([ёA-zА-я-]+)/u", "\\2 \\1", $LastVal[$key - 1]); break; case 'order_replace': //$d.=" "; //$LastVal[$key-1]=str_replace($key1, $d, $LastVal[$key-1]); //!!!! Возможно деяние должно быть другим $LastVal[$key - 1] = " " . str_replace($key1, "", $LastVal[$key - 1]); break; /*default: $LastVal[$key-1]=iconv($GLOBALS['CHARSET_DATA'], $GLOBALS['CHARSET_APP'], $LastVal[$key-1]);*/ } } } else { $LastVal[$key] = iconv($GLOBALS['CHARSET_DATA'], $GLOBALS['CHARSET_APP'], $Entries[$i][$val][0]); } if ($key > 0) { @($ArrSorted[$i] .= " " . $LastVal[$key - 1]); } } if (!is_array($val)) { @($ArrSorted[$i] .= " " . $LastVal[$key]); } //echo $ArrSorted[$i]."<br>"; } if (is_array(@$ArrSorted)) { asort($ArrSorted); $AS = array_keys($ArrSorted); if (strtolower($SortType) == "desc") { $AS = array_reverse($AS); } } /*foreach($ArrSorted AS $key=>$value) { echo "".$value."<br/>"; }*/ } //----------------------------------------------------------------------------- for ($i = 0; $i < @$Entries[count]; $i++) { for ($j = 0; $j < $SizeOf; $j++) { if (is_array($Sort)) { @($Value = iconv($GLOBALS['CHARSET_DATA'], $GLOBALS['CHARSET_APP'], $Entries[$AS[$i]][$ADAttributes[$j]][0])); //echo $Value."<br>"; } else { $Value = iconv($GLOBALS['CHARSET_DATA'], $GLOBALS['CHARSET_APP'], $Entries[$i][$ADAttributes[$j]][0]); } $RA[$ADAttributes[$j]][$i] = $Value; } unset($Value); //echo "<br>"; } } if (@is_array($RA)) { return $RA; } else { return false; } }