本文整理汇总了PHP中array_sort_key函数的典型用法代码示例。如果您正苦于以下问题:PHP array_sort_key函数的具体用法?PHP array_sort_key怎么用?PHP array_sort_key使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了array_sort_key函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: zfs_zpool_get_status
function zfs_zpool_get_status()
{
global $config;
array_sort_key($config['zfs']['pools']['pool'], "name");
array_sort_key($config['zfs']['vdevices']['vdevice'], "name");
$a_pool = $config['zfs']['pools']['pool'];
$a_vdevice = $config['zfs']['vdevices']['vdevice'];
// Get zpool status informations
$cmd = "zpool status -v";
if (isset($_GET['pool'])) {
$cmd .= " {$_GET['pool']}";
}
mwexec2($cmd, $rawdata);
return implode("\n", $rawdata);
}
示例2: TORT
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
require "auth.inc";
require "guiconfig.inc";
$uuid = $_GET['uuid'];
if (isset($_POST['uuid'])) {
$uuid = $_POST['uuid'];
}
$pgtitle = array(gettext("Network"), gettext("Interface Management"), gettext("Link Aggregation and Failover"), isset($uuid) ? gettext("Edit") : gettext("Add"));
if (!is_array($config['vinterfaces']['lagg'])) {
$config['vinterfaces']['lagg'] = array();
}
$a_lagg =& $config['vinterfaces']['lagg'];
array_sort_key($a_lagg, "if");
if (isset($uuid) && FALSE !== ($cnid = array_search_ex($uuid, $a_lagg, "uuid"))) {
$pconfig['enable'] = isset($a_lagg[$cnid]['enable']);
$pconfig['uuid'] = $a_lagg[$cnid]['uuid'];
$pconfig['if'] = $a_lagg[$cnid]['if'];
$pconfig['laggproto'] = $a_lagg[$cnid]['laggproto'];
$pconfig['laggport'] = $a_lagg[$cnid]['laggport'];
$pconfig['desc'] = $a_lagg[$cnid]['desc'];
} else {
$pconfig['enable'] = true;
$pconfig['uuid'] = uuid();
$pconfig['if'] = "lagg" . get_nextlagg_id();
$pconfig['laggproto'] = "failover";
$pconfig['laggport'] = array();
$pconfig['desc'] = "";
}
示例3: array
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the NAS4Free Project.
*/
require "auth.inc";
require "guiconfig.inc";
if (isset($_GET['uuid'])) {
$uuid = $_GET['uuid'];
}
if (isset($_POST['uuid'])) {
$uuid = $_POST['uuid'];
}
$pgtitle = array(gettext("Disks"), gettext("Management"), gettext("iSCSI Initiator"), isset($uuid) ? gettext("Edit") : gettext("Add"));
if (!isset($config['iscsiinit']['vdisk']) || !is_array($config['iscsiinit']['vdisk'])) {
$config['iscsiinit']['vdisk'] = array();
}
array_sort_key($config['iscsiinit']['vdisk'], "name");
$a_iscsiinit =& $config['iscsiinit']['vdisk'];
if (isset($uuid) && FALSE !== ($cnid = array_search_ex($uuid, $a_iscsiinit, "uuid"))) {
$pconfig['uuid'] = $a_iscsiinit[$cnid]['uuid'];
$pconfig['name'] = $a_iscsiinit[$cnid]['name'];
$pconfig['targetname'] = $a_iscsiinit[$cnid]['targetname'];
$pconfig['targetaddress'] = $a_iscsiinit[$cnid]['targetaddress'];
$pconfig['initiatorname'] = $a_iscsiinit[$cnid]['initiatorname'];
} else {
$pconfig['uuid'] = uuid();
$pconfig['name'] = "";
$pconfig['targetname'] = "";
$pconfig['targetaddress'] = "";
$pconfig['initiatorname'] = "iqn.2012-03.org.nas4free:nas4free";
}
if (isset($config['iscsitarget']['nodebase']) && !empty($config['iscsitarget']['nodebase'])) {
示例4: updatenotify_process
if (!file_exists($d_sysrebootreqd_path)) {
// Process notifications
$retval = updatenotify_process("raid_gvinum", "gvinum_process_updatenotification");
}
$savemsg = get_std_save_message($retval);
if ($retval == 0) {
updatenotify_delete("raid_gvinum");
}
header("Location: disks_raid_gvinum.php");
exit;
}
}
if (!is_array($config['gvinum']['vdisk'])) {
$config['gvinum']['vdisk'] = array();
}
array_sort_key($config['gvinum']['vdisk'], "name");
$a_raid =& $config['gvinum']['vdisk'];
if ($_GET['act'] === "del") {
unset($errormsg);
if ($a_raid[$_GET['id']]) {
// Check if disk is mounted.
if (0 == disks_ismounted_ex($a_raid[$_GET['id']]['devicespecialfile'], "devicespecialfile")) {
updatenotify_set("raid_gvinum", UPDATENOTIFY_MODE_DIRTY, $a_raid[$_GET['id']]['uuid']);
header("Location: disks_raid_gvinum.php");
exit;
} else {
$errormsg = sprintf(gettext("The RAID volume is currently mounted! Remove the <a href='%s'>mount point</a> first before proceeding."), "disks_mount.php");
}
}
}
function gvinum_process_updatenotification($mode, $data)
示例5: array
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the NAS4Free Project.
*/
require "auth.inc";
require "guiconfig.inc";
$pgtitle = array(gettext("Services"), gettext("NFS"));
if (!isset($config['nfsd']['share']) || !is_array($config['nfsd']['share'])) {
$config['nfsd']['share'] = array();
}
array_sort_key($config['nfsd']['share'], "path");
$a_share =& $config['nfsd']['share'];
$pconfig['enable'] = isset($config['nfsd']['enable']);
$pconfig['v4enable'] = isset($config['nfsd']['v4enable']);
$pconfig['numproc'] = $config['nfsd']['numproc'];
if ($_POST) {
unset($input_errors);
$pconfig = $_POST;
if (isset($_POST['enable']) && $_POST['enable']) {
$reqdfields = explode(" ", "numproc");
$reqdfieldsn = array(gettext("Number of servers"));
$reqdfieldst = explode(" ", "numeric");
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
do_input_validation_type($_POST, $reqdfields, $reqdfieldsn, $reqdfieldst, $input_errors);
}
if (empty($input_errors)) {
示例6: config_unlock
config_unlock();
}
$savemsg = get_std_save_message($retval);
if ($retval == 0) {
if (get_hast_role() != 'secondary') {
$savemsg .= "<br>";
$savemsg .= sprintf(gettext("The reloading request has been sent to the daemon. You can see the result by <a href=\"%s\">Log</a>."), "diag_log.php?log=2");
}
updatenotify_delete("iscsitarget_ig");
}
}
}
if (!isset($config['iscsitarget']['initiatorgroup']) || !is_array($config['iscsitarget']['initiatorgroup'])) {
$config['iscsitarget']['initiatorgroup'] = array();
}
array_sort_key($config['iscsitarget']['initiatorgroup'], "tag");
$a_iscsitarget_ig =& $config['iscsitarget']['initiatorgroup'];
if (!isset($config['iscsitarget']['target']) || !is_array($config['iscsitarget']['target'])) {
$config['iscsitarget']['target'] = array();
}
if (isset($_GET['act']) && $_GET['act'] === "del") {
$index = array_search_ex($_GET['uuid'], $config['iscsitarget']['initiatorgroup'], "uuid");
if ($index !== false) {
$ig = $config['iscsitarget']['initiatorgroup'][$index];
foreach ($config['iscsitarget']['target'] as $target) {
if (isset($target['pgigmap'])) {
foreach ($target['pgigmap'] as $pgigmap) {
if ($pgigmap['igtag'] == $ig['tag']) {
$input_errors[] = gettext("This tag is used.");
}
}
示例7: TORT
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
require "auth.inc";
require "guiconfig.inc";
$uuid = $_GET['uuid'];
if (isset($_POST['uuid'])) {
$uuid = $_POST['uuid'];
}
$pgtitle = array(gettext("Network"), gettext("Static routes"), isset($uuid) ? gettext("Edit") : gettext("Add"));
if (!is_array($config['staticroutes']['route'])) {
$config['staticroutes']['route'] = array();
}
array_sort_key($config['staticroutes']['route'], "network");
$a_routes =& $config['staticroutes']['route'];
if (isset($uuid) && FALSE !== ($cnid = array_search_ex($uuid, $a_routes, "uuid"))) {
$pconfig['uuid'] = $a_routes[$cnid]['uuid'];
$pconfig['interface'] = $a_routes[$cnid]['interface'];
list($pconfig['network'], $pconfig['network_subnet']) = explode('/', $a_routes[$cnid]['network']);
$pconfig['gateway'] = $a_routes[$cnid]['gateway'];
$pconfig['descr'] = $a_routes[$cnid]['descr'];
} else {
$pconfig['uuid'] = uuid();
$pconfig['gateway'] = "";
$pconfig['descr'] = "";
}
if ($_POST) {
unset($input_errors);
$pconfig = $_POST;
示例8: TORT
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
require "auth.inc";
require "guiconfig.inc";
$id = $_GET['id'];
if (isset($_POST['id'])) {
$id = $_POST['id'];
}
$pgtitle = array(gettext("Disks"), gettext("Software RAID"), gettext("RAID1"), isset($id) ? gettext("Edit") : gettext("Add"));
if (!is_array($config['gmirror']['vdisk'])) {
$config['gmirror']['vdisk'] = array();
}
array_sort_key($config['gmirror']['vdisk'], "name");
$a_raid =& $config['gmirror']['vdisk'];
$all_raid = get_conf_sraid_disks_list();
$a_disk = get_conf_disks_filtered_ex("fstype", "softraid");
if (!sizeof($a_disk)) {
$nodisk_errors[] = gettext("You must add disks first.");
}
if (isset($id) && $a_raid[$id]) {
$pconfig['uuid'] = $a_raid[$id]['uuid'];
$pconfig['name'] = $a_raid[$id]['name'];
$pconfig['devicespecialfile'] = $a_raid[$id]['devicespecialfile'];
$pconfig['type'] = $a_raid[$id]['type'];
$pconfig['balance'] = $a_raid[$id]['balance'];
$pconfig['device'] = $a_raid[$id]['device'];
}
if ($_POST) {
示例9: array
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the NAS4Free Project.
*/
require "auth.inc";
require "guiconfig.inc";
require "zfs.inc";
$pgtitle = array(gettext("Disks"), gettext("ZFS"), gettext("Datasets"), gettext("Dataset"));
if (!isset($config['zfs']['datasets']['dataset']) || !is_array($config['zfs']['datasets']['dataset'])) {
$config['zfs']['datasets']['dataset'] = array();
}
array_sort_key($config['zfs']['datasets']['dataset'], "name");
$a_dataset =& $config['zfs']['datasets']['dataset'];
if ($_POST) {
$pconfig = $_POST;
if (isset($_POST['apply']) && $_POST['apply']) {
$retval = 0;
if (!file_exists($d_sysrebootreqd_path)) {
// Process notifications
$retval |= updatenotify_process("zfsdataset", "zfsdataset_process_updatenotification");
}
$savemsg = get_std_save_message($retval);
if ($retval == 0) {
updatenotify_delete("zfsdataset");
}
header("Location: disks_zfs_dataset.php");
exit;
示例10: DAMAGES
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
require "auth.inc";
require "guiconfig.inc";
$pgtitle = array(gettext("Disks"), gettext("Mount Point"), gettext("Fsck"));
if (!is_array($config['mounts']['mount'])) {
$config['mounts']['mount'] = array();
}
array_sort_key($config['mounts']['mount'], "devicespecialfile");
$a_mount = $config['mounts']['mount'];
if ($_POST) {
unset($input_errors);
unset($errormsg);
unset($do_action);
// Input validation
$reqdfields = explode(" ", "disk");
$reqdfieldsn = array(gettext("Disk"));
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
if (!$input_errors) {
$do_action = true;
$disk = $_POST['disk'];
$umount = $_POST['umount'] ? true : false;
}
}
示例11: array
$MAX_AUTHUSERS = 4;
$GROW_AUTHUSERS = 4;
if (!isset($config['iscsitarget']['authgroup']) || !is_array($config['iscsitarget']['authgroup'])) {
$config['iscsitarget']['authgroup'] = array();
}
array_sort_key($config['iscsitarget']['authgroup'], "tag");
$a_iscsitarget_ag =& $config['iscsitarget']['authgroup'];
if (isset($uuid) && FALSE !== ($cnid = array_search_ex($uuid, $a_iscsitarget_ag, "uuid"))) {
$pconfig['uuid'] = $a_iscsitarget_ag[$cnid]['uuid'];
$pconfig['tag'] = $a_iscsitarget_ag[$cnid]['tag'];
$pconfig['comment'] = $a_iscsitarget_ag[$cnid]['comment'];
$i = 1;
if (!isset($a_iscsitarget_ag[$cnid]['agauth']) || !is_array($a_iscsitarget_ag[$cnid]['agauth'])) {
$a_iscsitarget_ag[$cnid]['agauth'] = array();
}
array_sort_key($a_iscsitarget_ag[$cnid]['agauth'], "authuser");
foreach ($a_iscsitarget_ag[$cnid]['agauth'] as $agauth) {
$pconfig["user{$i}"] = $agauth['authuser'];
$pconfig["secret{$i}"] = $agauth['authsecret'];
$pconfig["secret2{$i}"] = $pconfig["secret{$i}"];
$pconfig["muser{$i}"] = $agauth['authmuser'];
$pconfig["msecret{$i}"] = $agauth['authmsecret'];
$pconfig["msecret2{$i}"] = $pconfig["msecret{$i}"];
$i++;
}
while ($i > $MAX_AUTHUSERS) {
$MAX_AUTHUSERS += $GROW_AUTHUSERS;
}
} else {
// Find next unused tag.
$tag = 1;
示例12: config_unlock
config_unlock();
}
$savemsg = get_std_save_message($retval);
if ($retval == 0) {
if (get_hast_role() != 'secondary') {
$savemsg .= "<br>";
$savemsg .= sprintf(gettext("The reloading request has been sent to the daemon. You can see the result by <a href=\"%s\">Log</a>."), "diag_log.php?log=2");
}
updatenotify_delete("iscsitarget_pg");
}
}
}
if (!isset($config['iscsitarget']['portalgroup']) || !is_array($config['iscsitarget']['portalgroup'])) {
$config['iscsitarget']['portalgroup'] = array();
}
array_sort_key($config['iscsitarget']['portalgroup'], "tag");
$a_iscsitarget_pg =& $config['iscsitarget']['portalgroup'];
if (!isset($config['iscsitarget']['target']) || !is_array($config['iscsitarget']['target'])) {
$config['iscsitarget']['target'] = array();
}
if (isset($_GET['act']) && $_GET['act'] === "del") {
$index = array_search_ex($_GET['uuid'], $config['iscsitarget']['portalgroup'], "uuid");
if ($index !== false) {
$pg = $config['iscsitarget']['portalgroup'][$index];
foreach ($config['iscsitarget']['target'] as $target) {
if (isset($target['pgigmap'])) {
foreach ($target['pgigmap'] as $pgigmap) {
if ($pgigmap['pgtag'] == $pg['tag']) {
$input_errors[] = gettext("This tag is used.");
}
}
示例13: gettext
?>
</td>
<td width="25%" class="listhdrr"><?php
echo gettext("Comment");
?>
</td>
<td width="10%" class="list"></td>
</tr>
<?php
foreach ($config['iscsitarget']['authgroup'] as $ag) {
?>
<?php
if (!isset($ag['agauth']) || !is_array($ag['agauth'])) {
$ag['agauth'] = array();
}
array_sort_key($ag['agauth'], "authuser");
?>
<?php
$notificationmode = updatenotify_get_mode("iscsitarget_ag", $ag['uuid']);
?>
<tr>
<td class="listlr"><?php
echo htmlspecialchars($ag['tag']);
?>
</td>
<td class="listr">
<?php
if (count($ag['agauth']) == 0) {
echo " ";
}
?>
示例14: array
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the NAS4Free Project.
*/
require "auth.inc";
require "guiconfig.inc";
$pgtitle = array(gettext("Disks"), gettext("Software RAID"), gettext("RAID5"), gettext("Tools"));
if (!isset($config['graid5']['vdisk']) || !is_array($config['graid5']['vdisk'])) {
$config['graid5']['vdisk'] = array();
}
array_sort_key($config['graid5']['vdisk'], "name");
$a_raid =& $config['graid5']['vdisk'];
if ($_POST) {
unset($input_errors);
unset($do_action);
/* input validation */
$reqdfields = explode(" ", "action raid disk");
$reqdfieldsn = array(gettext("Command"), gettext("Volume Name"), gettext("Disk"));
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
if (empty($input_errors)) {
$do_action = true;
$action = $_POST['action'];
$raid = $_POST['raid'];
$disk = $_POST['disk'];
}
}
示例15: array
echo $pool['name'];
?>
": {
<?php
$result = array();
foreach ($pool['vdevice'] as $vdevicev) {
$index = array_search_ex($vdevicev, $a_vdevice, "name");
$vdevice = $a_vdevice[$index];
foreach ($vdevice['device'] as $devicev) {
$a_disk = get_conf_disks_filtered_ex("fstype", "zfs");
$index = array_search_ex($devicev, $a_disk, "devicespecialfile");
$result[] = $a_disk[$index];
}
}
$i = 0;
array_sort_key($result, "name");
foreach ($result as $disk) {
$checked = "";
if (is_array($pconfig['device'])) {
foreach ($pconfig['device'] as $devicev) {
if ($devicev === $disk['name']) {
$checked = " checked=\"checked\"";
break;
}
}
} else {
if ($pconfig['device'] === $disk['name']) {
$checked = " checked=\"checked\"";
}
}
?>