Пример #1
0
 /**
  * Save a new, or update an existing ward member (singular)
  *
  * @param array $attributes
  *
  * @return bool|int
  */
 public function saveMember(array $attributes = [])
 {
     $this->first_name = $attributes['first_name'];
     $this->last_name = $attributes['last_name'];
     $this->spouse_name = $attributes['spouse_name'];
     $replaced = preg_replace('/[\\(\\)\\-\\s]/', '', $attributes['phone']);
     if (strlen($replaced) === 10) {
         $phone = '(' . $replaced[0] . $replaced[1] . $replaced[2] . ') ' . $replaced[3] . $replaced[4] . $replaced[5] . '-' . $replaced[6] . $replaced[7] . $replaced[8] . $replaced[9];
     } else {
         $phone = $attributes['phone'];
     }
     $this->phone = $phone;
     $this->email = $attributes['email'];
     if (!empty($attributes['password'])) {
         $password = trim($attributes['password']);
         $this->password = Hash::make($password);
     }
     if (!empty($attributes['ward_id'])) {
         $this->ward_id = $attributes['ward_id'];
     }
     if (!empty($attributes['quorum_id'])) {
         $this->quorum_id = $attributes['quorum_id'];
     }
     if (!empty($attributes['is_admin'])) {
         $this->is_admin = toBool($attributes['is_admin']);
     }
     if (isset($attributes['is_jr_comp'])) {
         $this->is_jr_comp = toBool($attributes['is_jr_comp']);
     }
     return parent::save();
 }
 /**
  * Save the basic configuration.
  */
 public function procAdvanced_MailerAdminInsertConfig()
 {
     // Get and validate the new configuration.
     $vars = Context::getRequestVars();
     if (!$vars->sender_name) {
         return new Object(-1, 'msg_advanced_mailer_sender_name_is_empty');
     }
     if (!$vars->sender_email) {
         return new Object(-1, 'msg_advanced_mailer_sender_email_is_empty');
     }
     if (!Mail::isVaildMailAddress($vars->sender_email)) {
         return new Object(-1, 'msg_advanced_mailer_sender_email_is_invalid');
     }
     if ($vars->reply_to && !Mail::isVaildMailAddress($vars->reply_to)) {
         return new Object(-1, 'msg_advanced_mailer_reply_to_is_invalid');
     }
     // Validate the sending method.
     $sending_methods = Rhymix\Framework\Mail::getSupportedDrivers();
     $sending_method = $vars->sending_method;
     if (!array_key_exists($sending_method, $sending_methods)) {
         return new Object(-1, 'msg_advanced_mailer_sending_method_is_invalid');
     }
     // Validate the configuration for the selected sending method.
     $sending_method_config = array();
     foreach ($sending_methods[$sending_method]['required'] as $conf_name) {
         $conf_value = $vars->{$sending_method . '_' . $conf_name} ?: null;
         if (!$conf_value) {
             return new Object(-1, 'msg_advanced_mailer_smtp_host_is_invalid');
         }
         $sending_method_config[$conf_name] = $conf_value;
     }
     // Update the current module's configuration.
     $config = $this->getConfig();
     $config->sender_name = $vars->sender_name;
     $config->sender_email = $vars->sender_email;
     $config->reply_to = $vars->reply_to;
     $config->force_sender = toBool($vars->force_sender);
     $config->log_sent_mail = toBool($vars->log_sent_mail);
     $config->log_errors = toBool($vars->log_errors);
     $output = getController('module')->insertModuleConfig('advanced_mailer', $config);
     if ($output->toBool()) {
         $this->setMessage('success_registed');
     } else {
         return $output;
     }
     // Update the webmaster's name and email in the member module.
     getController('module')->updateModuleConfig('member', (object) array('webmaster_name' => $config->sender_name, 'webmaster_email' => $config->sender_email));
     // Update system configuration.
     Rhymix\Framework\Config::set("mail.type", $sending_method);
     Rhymix\Framework\Config::set("mail.{$sending_method}", $sending_method_config);
     Rhymix\Framework\Config::save();
     if (Context::get('success_return_url')) {
         $this->setRedirectUrl(Context::get('success_return_url'));
     } else {
         $this->setRedirectUrl(getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdvanced_mailerAdminConfig'));
     }
 }
Пример #3
0
 /**
  * After mail send trigger.
  */
 public function triggerAfterMailSend($mail)
 {
     $config = $this->getConfig();
     if (toBool($config->log_sent_mail) || toBool($config->log_errors) && count($mail->errors)) {
         $obj = new \stdClass();
         $obj->mail_srl = getNextSequence();
         $obj->mail_from = '';
         $obj->mail_to = '';
         if ($real_sender = $mail->message->getFrom()) {
             foreach ($real_sender as $email => $name) {
                 $obj->mail_from .= (strval($name) !== '' ? "{$name} <{$email}>" : $email) . "\n";
             }
         }
         if ($real_to = $mail->message->getTo()) {
             foreach ($real_to as $email => $name) {
                 $obj->mail_to .= (strval($name) !== '' ? "{$name} <{$email}>" : $email) . "\n";
             }
         }
         if ($real_cc = $mail->message->getCc()) {
             foreach ($real_cc as $email => $name) {
                 $obj->mail_to .= (strval($name) !== '' ? "{$name} <{$email}>" : $email) . "\n";
             }
         }
         if ($real_bcc = $mail->message->getBcc()) {
             foreach ($real_bcc as $email => $name) {
                 $obj->mail_to .= (strval($name) !== '' ? "{$name} <{$email}>" : $email) . "\n";
             }
         }
         $obj->mail_from = trim($obj->mail_from);
         $obj->mail_to = trim($obj->mail_to);
         $obj->subject = $mail->message->getSubject();
         $obj->calling_script = $mail->getCaller();
         $obj->sending_method = strtolower(class_basename($mail->driver));
         $obj->status = !count($mail->errors) ? 'success' : 'error';
         $obj->errors = count($mail->errors) ? implode("\n", $mail->errors) : null;
         $output = executeQuery('advanced_mailer.insertLog', $obj);
         if (!$output->toBool()) {
             return $output;
         }
     }
 }
           function boolToChecked($group, $privacyKey) {
               global $privacyConfig;
               $boolValueStr = $privacyConfig[$group][$privacyKey];
               $bool = toBool($boolValueStr);
               return $bool ? "checked" : "";

           }
 } else {
     $resetString = "window.checkPasswordReset = false";
     if ($redirect_to_home !== true && empty($redirect_url)) {
         $durl = $self_url;
     } else {
         if ($redirect_to_home === true) {
             $durl = $baseurl;
         } else {
             $durl = $redirect_url;
         }
     }
     if (strtolower($_REQUEST["action"]) == "verifyemail") {
         if (!isset($_REQUEST["alternate"])) {
             $alternate = false;
         } else {
             $alternate = toBool($_REQUEST["alternate"]);
         }
         $skip = false;
         if (empty($_REQUEST["username"]) && $logged_in) {
             $uTemp = $user;
         } else {
             if (!empty($_REQUEST["username"])) {
                 $uTemp = new UserFunctions($_REQUEST["username"]);
             } else {
                 $skip = true;
             }
         }
         if (!$skip) {
             try {
                 $result = $uTemp->verifyEmail($_REQUEST["token"], $alternate);
             } catch (Exception $e) {
function verifyEmail($get)
{
    /***
     * Verify an email
     * An empty or bad verification code generates a new one to be saved in the temp column
     ***/
    if (!isset($get["alternate"])) {
        $get["alternate"] = false;
    } else {
        $get["alternate"] = toBool($get["alternate"]);
    }
    if (empty($get["username"])) {
        return array("status" => false, "error" => "INVALID_PARAMETERS", "human_error" => "This function needs the parameter 'username' specified.");
    }
    $u = new UserFunctions($get['username']);
    try {
        return $u->verifyEmail($get['token'], $get['alternate']);
    } catch (Exception $e) {
        return array("status" => false, "error" => $e->getMessage(), "human_error" => "Unable to send verification email");
    }
}
             foreach ($list as $project) {
               try {
                 $carto = json_decode(deEscape($project['carto_id']), true);
                 # Escaped or unescaped
                 $bpoly = empty($carto['bounding&#95;polygon']) ? $carto['bounding_polygon'] : $carto['bounding&#95;polygon'];
               } catch(Exception $e) {

               }
               if (empty($project['project_id']) || empty($project['locality'])) {
                  if(empty($bpoly["multibounds"])) continue;
               }
                 if (boolstr($project['public'])) {
                   $polyColor = '#ff7800';
                   # Depending on the type of data stored, it could be
                   # in paths or not
                   if(toBool($bpoly['paths']) === false && !empty($bpoly["multibounds"])) {
                     $bpoly['paths'] = is_array($bpoly["multibounds"]) ? $bpoly["multibounds"][0] : $bpoly["multibounds"];
                   }
                   $coords = empty($bpoly['paths']) ? $bpoly : $bpoly['paths'];
                 } else {
                   # Private
                     $polyColor = '#9C27B0'; # See https://github.com/AmphibiaWeb/amphibian-disease-tracker/issues/64
                     if(!empty($bpoly["multibounds"])) {
                       # Replace this with an approximation
                       $boringMultiBounds = array();
                       foreach($bpoly["multibounds"] as $polySet) {
                         # We want to get the four corners of each polySet
                         $polySetBoundingBox = array();
                         $north = -90;
                         $south = 90;
                         $west = 180;
 public function isSU()
 {
     try {
         $u = $this->getUser();
         return toBool($u["su_flag"]);
     } catch (Exception $e) {
         return false;
     }
 }
Пример #9
0
 public function setEngAttribute($value)
 {
     $this->attributes['eng'] = toBool($value);
 }
/**
 * Define the shortcode: [res_map] and its attributes
 */
function responsive_map_shortcode($atts)
{
    // Extract the attributes user gave in the shortcode
    $atts = shortcode_atts(array('width' => '', 'height' => '500px', 'maptype' => 'roadmap', 'zoom' => 14, 'address' => 'usa', 'description' => '', 'popup' => 'false', 'pancontrol' => 'false', 'zoomcontrol' => 'false', 'draggable' => 'true', 'scrollwheel' => 'false', 'typecontrol' => 'false', 'scalecontrol' => 'false', 'streetcontrol' => 'false', 'directionstext' => '', 'center' => '', 'icon' => 'green', 'color' => '', 'refresh' => 'false'), $atts);
    // Enque the neccessary jquery files
    wp_enqueue_script("jquery");
    wp_enqueue_script('geogooglemap');
    wp_enqueue_script('jquerygmap');
    // Generate an unique identifier for the map
    $mapid = rand();
    // Extract the map type
    $atts['maptype'] = strtoupper($atts['maptype']);
    // If width or height were specified in the shortcode, extract them too
    $dimensions = 'height:' . $atts['height'];
    if ($atts['width']) {
        $dimensions .= ';width:' . $atts['width'];
    }
    // If color is not set, show the default map style. If color is set to 'bw' show black&white map. Otherwise, if color given, set the map color to the given color.
    if (isset($atts['color']) && $atts['color'] == 'bw') {
        $style = '[ { "stylers": [ { "featureType": "all" }, { "saturation": -100 }, { "gamma": 0.50 }, {"lightness": 30 } ] } ]';
    } else {
        if (isset($atts['color']) && $atts['color'] == 'classic') {
            $style = '[]';
        } else {
            $style = '[ { "stylers": [ { "hue": "' . $atts['color'] . '" } ] } ]';
        }
    }
    // Clean the html code in the directionstext or set the default value if directionstext was not specified in the shortcode
    if (isset($atts['directionstext']) && strlen(trim($atts['directionstext'])) != 0) {
        $atts['directionstext'] = $atts['directionstext'];
    }
    // Extract the langitude and longitude for the map center
    if (trim($atts['center']) != "") {
        sscanf($atts['center'], '%f, %f', $lat, $long);
    } else {
        $lat = 'null';
        $long = 'null';
    }
    // Split the addresses and descriptions (by | delimiter) and build markers JSON list
    if ($atts['address'] != '') {
        $addresses = explode("|", $atts['address']);
        $descriptions = explode("|", $atts['description']);
        $icons = explode("|", $atts['icon']);
        // Build a marker for each address
        $markers = '[';
        for ($i = 0; $i < count($addresses); $i++) {
            $address = cleanHtml($addresses[$i]);
            // If multiple markers, hide popup, else show popup according to parameter from shortcode
            if (count($addresses) > 1) {
                $atts['popup'] = "no";
            }
            // if it's empty, set the default description equal to the the address
            if (isset($descriptions[$i]) && strlen(trim($descriptions[$i])) != 0) {
                $html = $descriptions[$i];
            } else {
                $html = $address;
            }
            // Add the directions link to the description
            $directions = 'http://maps.google.com/?daddr=' . urlencode($address);
            $html .= '<strong><br><a target=\'_blank\' href="' . $directions . '">' . $atts['directionstext'] . '</a></strong>';
            // Prepare the description html
            $html = cleanHtml($html);
            // Get the correct icon image based on icon color/url given in the shortcode
            $icon = getIcon($icons[$i]);
            // Extract the langitude and longitude for the map center
            $marker_latitude = null;
            $marker_longitude = null;
            if (trim($address) != "") {
                sscanf($address, '%f, %f', $marker_latitude, $marker_longitude);
            }
            // If more markers, add the neccessary "," delimiter between markers
            if ($i > 0) {
                $markers .= ",";
            }
            // Build markers list based on given address or latitude/longitude
            if ($marker_latitude == '' || $marker_longitude == '') {
                $markers .= '{
                    address: \'' . $address . '\', 
                    html:\'' . $html . '\',
                    popup: ' . toBool($atts['popup']) . ',
                    flat: true,
                    icon: {
                        image: \'' . $icon . '\',
                        iconsize: [50, 50],
                        iconanchor: null,
                        shadow: \'' . plugins_url('/includes/icons/shadow.png', __FILE__) . '\',
                        shadowsize: [50, 50],
                        shadowanchor: null}}';
            } else {
                $markers .= '{
                    latitude:' . $marker_latitude . ', 
                    longitude:' . $marker_longitude . ', 
                    html:"' . $html . '",
                    popup: ' . toBool($atts['popup']) . ',
                    flat: true,
                    icon: {
                        image: \'' . $icon . '\',
                        iconsize: [50, 50],
                        iconanchor: [0, 0],
                        infowindowanchor:[0,0],
                        shadow: \'' . plugins_url('/includes/icons/shadow.png', __FILE__) . '\',
                        shadowsize: [50, 50],
                        shadowanchor: null}}';
            }
        }
        $markers .= ']';
    }
    // Tell PHP to start output buffering
    ob_start();
    ?>
    <script type="text/javascript">
    jQuery(document).ready(function($) {
    var mapdiv = jQuery("#responsive_map_<?php 
    echo $mapid;
    ?>
");
    mapdiv.gMapResp({
      maptype: google.maps.MapTypeId.<?php 
    echo $atts['maptype'];
    ?>
,
      zoom: <?php 
    echo $atts['zoom'];
    ?>
,
      markers: <?php 
    echo $markers;
    ?>
,
      panControl: <?php 
    echo toBool($atts['pancontrol']);
    ?>
,
      zoomControl: <?php 
    echo toBool($atts['zoomcontrol']);
    ?>
,
      draggable: <?php 
    echo toBool($atts['draggable']);
    ?>
,
      scrollwheel: <?php 
    echo toBool($atts['scrollwheel']);
    ?>
,
      mapTypeControl: <?php 
    echo toBool($atts['typecontrol']);
    ?>
,
      scaleControl: <?php 
    echo toBool($atts['scalecontrol']);
    ?>
,
      streetViewControl: <?php 
    echo toBool($atts['streetcontrol']);
    ?>
,
      overviewMapControl: true,
      styles: <?php 
    echo $style;
    ?>
,
      latitude: <?php 
    echo $lat;
    ?>
,
      longitude: <?php 
    echo $long;
    ?>
     });
  });
  <?php 
    if (isset($atts['refresh']) && $atts['refresh'] == 'yes') {
        ?>
  window.onresize = function() {
        jQuery('.responsive-map').each(function(i, obj) {
            var gmap = jQuery(this).data('gmap').gmap;
            google.maps.event.trigger(gmap, 'resize');
            jQuery(this).gMapResp('fixAfterResize');
        });
  };
  <?php 
    }
    ?>
  </script>
  <div id="responsive_map_<?php 
    echo $mapid;
    ?>
" class="responsive-map" style="<?php 
    echo $dimensions;
    ?>
;"></div>
  <?php 
    return ob_get_clean();
}
Пример #11
0
 /**
  * Migrate from previous configuration format.
  */
 public function migrateConfig($config)
 {
     $systemconfig = array();
     if (isset($config->sending_method)) {
         $systemconfig['mail.type'] = $config->sending_method;
     } elseif (isset($config->send_type)) {
         $systemconfig['mail.type'] = $config->send_type;
     }
     if ($systemconfig['mail.type'] === 'mail') {
         $systemconfig['mail.type'] = 'mailfunction';
     }
     if (isset($config->username)) {
         if (in_array('username', $this->sending_methods[$config->sending_method]['conf'])) {
             $config->{$config->sending_method . '_username'} = $config->username;
         }
         unset($config->username);
     }
     if (isset($config->password)) {
         if (in_array('password', $this->sending_methods[$config->sending_method]['conf'])) {
             $config->{$config->sending_method . '_password'} = $config->password;
         }
         unset($config->password);
     }
     if (isset($config->domain)) {
         if (in_array('domain', $this->sending_methods[$config->sending_method]['conf'])) {
             $config->{$config->sending_method . '_domain'} = $config->domain;
         }
         unset($config->domain);
     }
     if (isset($config->api_key)) {
         if (in_array('api_key', $this->sending_methods[$config->sending_method]['conf'])) {
             $config->{$config->sending_method . '_api_key'} = $config->api_key;
         }
         unset($config->api_key);
     }
     if (isset($config->account_type)) {
         if (in_array('account_type', $this->sending_methods[$config->sending_method]['conf'])) {
             $config->{$config->sending_method . '_account_type'} = $config->account_type;
         }
         unset($config->account_type);
     }
     if (isset($config->aws_region)) {
         $config->ses_region = $config->aws_region;
         unset($config->aws_region);
     }
     if (isset($config->aws_access_key)) {
         $config->ses_access_key = $config->aws_access_key;
         unset($config->aws_access_key);
     }
     if (isset($config->aws_secret_key)) {
         $config->ses_secret_key = $config->aws_secret_key;
         unset($config->aws_secret_key);
     }
     $mail_drivers = Rhymix\Framework\Mail::getSupportedDrivers();
     foreach ($mail_drivers as $driver_name => $driver_definition) {
         foreach ($config as $key => $value) {
             if (strncmp($key, $driver_name . '_', strlen($driver_name) + 1) === 0) {
                 $subkey = substr($key, strlen($driver_name) + 1);
                 switch ($subkey) {
                     case 'host':
                     case 'port':
                     case 'security':
                         $systemconfig["mail.{$driver_name}.smtp_" . $subkey] = $value;
                         break;
                     case 'username':
                     case 'password':
                         $systemconfig["mail.{$driver_name}." . ($driver_name === 'smtp' ? 'smtp_' : 'api_') . substr($subkey, 0, 4)] = $value;
                         break;
                     case 'account_type':
                     case 'region':
                         $systemconfig["mail.{$driver_name}.api_type"] = $value;
                         break;
                     case 'access_key':
                         $systemconfig["mail.{$driver_name}.api_user"] = $value;
                         break;
                     case 'secret_key':
                         $systemconfig["mail.{$driver_name}.api_pass"] = $value;
                         break;
                     case 'domain':
                         $systemconfig["mail.{$driver_name}.api_domain"] = $value;
                         break;
                     case 'api_key':
                         $systemconfig["mail.{$driver_name}.api_token"] = $value;
                         break;
                     default:
                         break;
                 }
                 unset($config->{$key});
             }
         }
     }
     if (count($systemconfig)) {
         foreach ($systemconfig as $key => $value) {
             Rhymix\Framework\Config::set($key, $value);
         }
         Rhymix\Framework\Config::save();
     }
     unset($config->is_enabled);
     unset($config->sending_method);
     unset($config->send_type);
     $config->log_sent_mail = toBool($config->log_sent_mail);
     $config->log_errors = toBool($config->log_errors);
     $config->force_sender = toBool($config->force_sender);
     if (!isset($config->exceptions)) {
         $config->exceptions = array();
     }
     return $config;
 }
function advancedSearchProjectContains($get)
{
    /***
     * Similar to advancedSearchProject, but rather than requiring the
     * whole project is contained in the bounds, there only has to be
     * a nonzero amount of area of a project contained within bounds.
     ***/
    global $db;
    $searchParams = smart_decode64($get["q"], false);
    $search = array();
    $response = array("notices" => array());
    foreach ($searchParams as $col => $searchQuery) {
        if (checkColumnExists($col, false)) {
            if ($searchQuery["data"] != "*") {
                $searchQuery["data"] = $db->sanitize($searchQuery["data"]);
                $search[$col] = $searchQuery;
            }
        } else {
            $response["notices"][] = "'{$col}' is an invalid column and was ignored.";
        }
    }
    $response["search"] = $searchParams;
    $response['status'] = true;
    # The API hit returns data from these columns
    $returnCols = array("public", "project_id", "disease", "project_title", "bounding_box_n", "bounding_box_e", "bounding_box_w", "bounding_box_s", "disease_morbidity", "disease_mortality", "disease_samples", "disease_positive", "includes_anura", "includes_caudata", "includes_gymnophiona", "sampled_species", "carto_id");
    # For numerical comparisons, we have to allow a type specification
    $allowedSearchTypes = array("<", ">", "<=", ">=", "=");
    $loose = isset($get["loose"]) ? toBool($get["loose"]) : true;
    $boolean_type = "AND";
    $where_arr = array();
    foreach ($search as $col => $searchQuery) {
        $crit = $searchQuery["data"];
        $validSearchType = empty($searchQuery["search_type"]) ? true : in_array($searchQuery["search_type"], $allowedSearchTypes);
        if (!empty($searchQuery["search_type"]) && !$validSearchType) {
            $response["notices"][] = "'" . $searchQuery["search_type"] . "' isn't a valid search type";
        }
        if ($validSearchType && !is_numeric($crit)) {
            $response["notices"][] = "Search types may only be specified for numeric data ('" . $searchQuery["search_type"] . "' tried to be specified for '{$crit}')";
        }
        if (!$validSearchType || !is_numeric($crit)) {
            $where_arr[] = $loose ? 'LOWER(`' . $col . "`) LIKE '%" . $crit . "%'" : '`' . $col . "`='" . $crit . "'";
        } else {
            # The query is numeric AND we have a search type specified
            $where_arr[] = "`" . $col . "` " . $searchQuery["search_type"] . " " . $crit;
        }
    }
    $where = '(' . implode(' ' . strtoupper($boolean_type) . ' ', $where_arr) . ')';
    $query = "SELECT " . implode(",", $returnCols) . " FROM `" . $db->getTable() . "` WHERE {$where}";
    $response["query"] = $query;
    $db->invalidateLink();
    $r = mysqli_query($db->getLink(), $query);
    if ($r === false) {
        $response["status"] = false;
        $response["error"] = mysqli_error($db->getLink());
        $response["query"] = $query;
        returnAjax($response);
    }
    $queryResult = array();
    $baseRows = mysqli_num_rows($r);
    $boolCols = array("public", "includes_anura", "includes_caudata", "includes_gymnophiona");
    while ($row = mysqli_fetch_assoc($r)) {
        # Authenticate the project against the user
        if (checkProjectIdAuthorized($row["project_id"], true)) {
            # Clean up data types
            foreach ($row as $col => $val) {
                if (is_numeric($val)) {
                    if (in_array($col, $boolCols)) {
                        $row[$col] = toBool($val);
                    } else {
                        $row[$col] = floatval($val);
                    }
                }
                if ($col == "carto_id") {
                    $cartoObj = json_decode($val);
                    if (!is_array($cartoObj)) {
                        $cartoObj = $val;
                    } else {
                        foreach ($cartoObj as $k => $v) {
                            $nk = str_replace("&#95;", "_", $k);
                            try {
                                unset($cartoObj[$k]);
                            } catch (Exception $e) {
                                $response["notices"][] = $e->getMessage();
                            }
                            $cartoObj[$nk] = $v;
                        }
                    }
                    $row[$col] = $cartoObj;
                }
            }
            $queryResult[] = $row;
        }
    }
    $response['result'] = $queryResult;
    $response['count'] = sizeof($response['result']);
    $response['base_count'] = $baseRows;
    returnAjax($response);
}
Пример #13
0
 protected function evaluate()
 {
     $prop = $this->props;
     $np = Parser::NAMELESS_PROP;
     if (isset($prop->{$np})) {
         if ($prop->{$np}) {
             //      if ($prop->getComputed($np))
             return $this->getChildren();
         }
         return $this->getChildren('else');
     }
     $v = $prop->get('value');
     $not = $prop->not;
     if (exists($prop->matches)) {
         if (preg_match("%{$prop->matches}%", $v) xor $not) {
             return $this->getChildren();
         }
         return $this->getChildren('else');
     }
     if ($prop->case) {
         foreach ($prop->case as $param) {
             if ($v == $param->props->is) {
                 return $param->getChildren();
             }
         }
         return $this->getChildren('else');
     }
     if (toBool($v) xor $not) {
         return $this->getChildren();
     }
     return $this->getChildren('else');
 }
Пример #14
0
 function updateProfil()
 {
     $date = explode('/', $this->input->post('birth'));
     $jj = '00';
     $mm = '00';
     $aaaa = '0000';
     if (count($date) == 3) {
         $jj = intval($date[0]);
         $mm = intval($date[1]);
         $aaaa = intval($date[2]);
     }
     $data['mail'] = $this->input->post('mail');
     $data['birth'] = $aaaa . '/' . $mm . '/' . $jj;
     $data['sexe'] = toBool($this->input->post('sexe'));
     $data['urlWeb'] = $this->input->post('urlWeb');
     $data['description'] = $this->input->post('description');
     $data['address'] = $this->input->post('address');
     $data['postal'] = $this->input->post('postal');
     $data['city'] = $this->input->post('city');
     $data['country'] = $this->input->post('country');
     $data['firstName'] = $this->input->post('firstName');
     $data['lastName'] = $this->input->post('lastName');
     $data['idPSN'] = $this->input->post('idPSN');
     $data['idXboxlive'] = $this->input->post('idXboxlive');
     $data['onMap'] = $this->input->post('onMap');
     $data['mailNotif'] = toBool($this->input->post('mailNotif'));
     $data['chatboxFixed'] = toBool($this->input->post('chatboxFixed'));
     $this->session->set_userdata('chatboxFixed', $data['chatboxFixed']);
     if (in_array($this->input->post('color'), $this->colors)) {
         $data['color'] = $this->input->post('color');
     }
     if (trim($this->input->post('mdp1')) != '') {
         if ($this->input->post('mdp1') != $this->input->post('mdp2')) {
             $errors['success'] = 'Vos mot de passes ne sont pas identiques.';
         } else {
             $data['password'] = $this->input->post('mdp1');
         }
     }
     if (!isset($errors)) {
         $errors['callback'] = 'reload';
         $this->users->update($data);
     }
     echo json_encode($errors);
 }
Пример #15
0
 /**
  * Display a fatal error screen.
  * 
  * @param string $message
  * @return void
  */
 public static function displayErrorScreen($message)
 {
     // Do not display error screen in CLI.
     if (php_sapi_name() === 'cli') {
         return;
     }
     // Disable output buffering.
     while (ob_get_level()) {
         ob_end_clean();
     }
     // Localize the error title.
     $title = lang('msg_server_error');
     if ($title === 'msg_server_error') {
         $message = 'Server Error';
     }
     // Localize the error message.
     $display_error_message = ini_get('display_errors') || \Context::get('logged_info') && toBool(\Context::get('logged_info')->is_admin);
     $message = $display_error_message ? $message : lang('msg_server_error_see_log');
     if ($message === 'msg_server_error_see_log') {
         $message = 'Your server is configured to hide error messages. Please see your server\'s error log for details.';
     }
     // Display a generic error page.
     \Context::displayErrorPage($title, $message, 500);
 }