function update($p) { $permSet = array(); if (!empty($p['pm'])) { foreach ($p['pm'] as $k => $v) { $permSet[$k] = $v == 'on' ? true : cInt($v); } } $this->id = isPostor('id'); $this->acr = cInt(isPostor('acr', 0)); $this->acw = cInt(isPostor('acw', 0)); if (!isset($permSet['esv.def']) && !isset($permSet['ews.def'])) { $permSet['esv.def'] = true; } if ($this->id == 1) { $this->acr = 99; $this->acw = 99; $adm = array('esv.def' => issetor($permSet['esv.def'], false), 'ews.def' => issetor($permSet['ews.def'], false)); $permSet = $adm; } $this->name = trim(isPostor('name')); $this->desc = isPostor('desc'); $this->props["pm"] = $permSet; if (empty($this->name)) { gzClient::begin()->eAlert("Error:!Name is not empty...")->send(); } $data = array('userg_name' => $this->name, 'userg_description' => $this->desc, 'userg_acr' => $this->acr, 'userg_acw' => $this->acw, 'rec_update' => NOW, 'userg_props' => json_encode($this->props)); if (empty($this->id)) { $data['rec_update'] = NOW; $data['rec_create'] = NOW; g::DB()->aInsert($data, 'sg_user_group'); } else { g::DB()->aUpdate($data, 'sg_user_group', 'userg_id', $this->id); g::cacheSet('UGROUP' . $this->id, $this); } //gzData::uGroupInfo(true); gzClient::begin()->redirect("cpanel.usergroup")->endSend(); }
?> <?php /*funciones*/ function cInt() { $i = 10; return $i; } function cString() { $cadena = "hola mundo"; return $cadena; } function cFloat() { $decimales = 3.141595; return $decimales; } function cDatos($datos, $i) { for ($j = 0; $j < $i; $j++) { echo $datos . " " . $j . "<br/>"; } } echo "funcion que regresa entero: " . cInt() . "<br/>"; echo "funcion que regresa cadena: " . cString() . "<br/>"; echo "funcion que regresa números con decimales: " . cFloat() . "<br/>"; echo "funcion que no regresa nada y recibe argumentos: <br/>"; cDatos("hola mundo", 5); echo "<br/><br/>";