PHP sizeof Examples

PHP sizeof - 30 examples found. These are the top rated real world PHP examples of sizeof extracted from open source projects. You can rate examples to help us improve the quality of examples.
 /**
  * Unmarshal return value from a specified node
  *
  * @param   xml.Node node
  * @return  webservices.uddi.BusinessList
  * @see     xp://webservices.uddi.UDDICommand#unmarshalFrom
  * @throws  lang.FormatException in case of an unexpected response
  */
 public function unmarshalFrom($node)
 {
     if (0 != strcasecmp($node->name, 'businessList')) {
         throw new \lang\FormatException('Expected "businessList", got "' . $node->name . '"');
     }
     // Create business list object from XML representation
     with($list = new BusinessList(), $children = $node->nodeAt(0)->getChildren());
     $list->setOperator($node->getAttribute('operator'));
     $list->setTruncated(0 == strcasecmp('true', $node->getAttribute('truncated')));
     for ($i = 0, $s = sizeof($children); $i < $s; $i++) {
         $b = new Business($children[$i]->getAttribute('businessKey'));
         for ($j = 0, $t = sizeof($children[$i]->getChildren()); $j < $s; $j++) {
             switch ($children[$i]->nodeAt($j)->name) {
                 case 'name':
                     $b->names[] = $children[$i]->nodeAt($j)->getContent();
                     break;
                 case 'description':
                     $b->description = $children[$i]->nodeAt($j)->getContent();
                     break;
             }
         }
         $list->items[] = $b;
     }
     return $list;
 }
 /** Function builds one dimentional category tree based on given array
  *
  * @param array $all_categories
  * @param int $parent_id
  * @param string $path
  * @return array
  */
 private function _buildCategoryTree($all_categories = array(), $parent_id = 0, $path = '')
 {
     $output = array();
     foreach ($all_categories as $category) {
         if ($parent_id != $category['parent_id']) {
             continue;
         }
         $category['path'] = $path ? $path . '_' . $category['category_id'] : $category['category_id'];
         $category['parents'] = explode("_", $category['path']);
         $category['level'] = sizeof($category['parents']) - 1;
         //digin' level
         if ($category['category_id'] == $this->category_id) {
             //mark root
             $this->selected_root_id = $category['parents'][0];
         }
         $output[] = $category;
         $output = array_merge($output, $this->_buildCategoryTree($all_categories, $category['category_id'], $category['path']));
     }
     if ($parent_id == 0) {
         $this->data['all_categories'] = $output;
         //place result into memory for future usage (for menu. see below)
         // cut list and expand only selected tree branch
         $cutted_tree = array();
         foreach ($output as $category) {
             if ($category['parent_id'] != 0 && !in_array($this->selected_root_id, $category['parents'])) {
                 continue;
             }
             $category['href'] = $this->html->getSEOURL('product/category', '&path=' . $category['path'], '&encode');
             $cutted_tree[] = $category;
         }
         return $cutted_tree;
     } else {
         return $output;
     }
 }
Example #3
1
 private static function listCommands()
 {
     $commands = array();
     $dir = __DIR__;
     if ($handle = opendir($dir)) {
         while (false !== ($entry = readdir($handle))) {
             if ($entry != "." && $entry != ".." && $entry != "base.php") {
                 $s1 = explode("cli_", $entry);
                 $s2 = explode(".php", $s1[1]);
                 if (sizeof($s2) == 2) {
                     require_once "{$dir}/{$entry}";
                     $command = $s2[0];
                     $className = "cli_{$command}";
                     $class = new $className();
                     if (is_a($class, "cliCommand")) {
                         $commands[] = $command;
                     }
                 }
             }
         }
         closedir($handle);
     }
     sort($commands);
     return implode(" ", $commands);
 }
Example #4
1
 function clsRecordchange_passwordchangepwd1($RelativePath, &$Parent)
 {
     global $FileName;
     global $CCSLocales;
     global $DefaultDateFormat;
     $this->Visible = true;
     $this->Parent =& $Parent;
     $this->RelativePath = $RelativePath;
     $this->Errors = new clsErrors();
     $this->ErrorBlock = "Record changepwd1/Error";
     $this->DataSource = new clschange_passwordchangepwd1DataSource($this);
     $this->ds =& $this->DataSource;
     $this->UpdateAllowed = true;
     $this->ReadAllowed = true;
     if ($this->Visible) {
         $this->ComponentName = "changepwd1";
         $this->Attributes = new clsAttributes($this->ComponentName . ":");
         $CCSForm = explode(":", CCGetFromGet("ccsForm", ""), 2);
         if (sizeof($CCSForm) == 1) {
             $CCSForm[1] = "";
         }
         list($FormName, $FormMethod) = $CCSForm;
         $this->EditMode = $FormMethod == "Edit";
         $this->FormEnctype = "application/x-www-form-urlencoded";
         $this->FormSubmitted = $FormName == $this->ComponentName;
         $Method = $this->FormSubmitted ? ccsPost : ccsGet;
         $this->oldpwd = new clsControl(ccsTextBox, "oldpwd", "Old Password", ccsText, "", CCGetRequestParam("oldpwd", $Method, NULL), $this);
         $this->oldpwd->Required = true;
         $this->newpwd = new clsControl(ccsTextBox, "newpwd", "New Password", ccsText, "", CCGetRequestParam("newpwd", $Method, NULL), $this);
         $this->newpwd->Required = true;
         $this->confirmpwd = new clsControl(ccsTextBox, "confirmpwd", "Confirm Password", ccsText, "", CCGetRequestParam("confirmpwd", $Method, NULL), $this);
         $this->confirmpwd->Required = true;
         $this->Button1 = new clsButton("Button1", $Method, $this);
     }
 }
 function clsRecordt_rep_bphtb_registrationSearch($RelativePath, &$Parent)
 {
     global $FileName;
     global $CCSLocales;
     global $DefaultDateFormat;
     $this->Visible = true;
     $this->Parent =& $Parent;
     $this->RelativePath = $RelativePath;
     $this->Errors = new clsErrors();
     $this->ErrorBlock = "Record t_rep_bphtb_registrationSearch/Error";
     $this->ReadAllowed = true;
     if ($this->Visible) {
         $this->ComponentName = "t_rep_bphtb_registrationSearch";
         $this->Attributes = new clsAttributes($this->ComponentName . ":");
         $CCSForm = explode(":", CCGetFromGet("ccsForm", ""), 2);
         if (sizeof($CCSForm) == 1) {
             $CCSForm[1] = "";
         }
         list($FormName, $FormMethod) = $CCSForm;
         $this->FormEnctype = "application/x-www-form-urlencoded";
         $this->FormSubmitted = $FormName == $this->ComponentName;
         $Method = $this->FormSubmitted ? ccsPost : ccsGet;
         $this->wp_name =& new clsControl(ccsTextBox, "wp_name", "wp_name", ccsDate, array("dd", "-", "mm", "-", "yyyy"), CCGetRequestParam("wp_name", $Method, NULL), $this);
         $this->Button_DoSearch =& new clsButton("Button_DoSearch", $Method, $this);
         $this->t_bphtb_registration_id =& new clsControl(ccsHidden, "t_bphtb_registration_id", "t_bphtb_registration_id", ccsText, "", CCGetRequestParam("t_bphtb_registration_id", $Method, NULL), $this);
     }
 }
 /**
  * {@inheritdoc}
  */
 public function prepare_form($request, $template, $user, $row, &$error)
 {
     $avatar_list = $this->get_avatar_list($user);
     $category = $request->variable('avatar_local_cat', key($avatar_list));
     foreach ($avatar_list as $cat => $null) {
         if (!empty($avatar_list[$cat])) {
             $template->assign_block_vars('avatar_local_cats', array('NAME' => $cat, 'SELECTED' => $cat == $category));
         }
         if ($cat != $category) {
             unset($avatar_list[$cat]);
         }
     }
     if (!empty($avatar_list[$category])) {
         $template->assign_vars(array('AVATAR_LOCAL_SHOW' => true));
         $table_cols = isset($row['avatar_gallery_cols']) ? $row['avatar_gallery_cols'] : 4;
         $row_count = $col_count = $avatar_pos = 0;
         $avatar_count = sizeof($avatar_list[$category]);
         reset($avatar_list[$category]);
         while ($avatar_pos < $avatar_count) {
             $img = current($avatar_list[$category]);
             next($avatar_list[$category]);
             if ($col_count == 0) {
                 ++$row_count;
                 $template->assign_block_vars('avatar_local_row', array());
             }
             $template->assign_block_vars('avatar_local_row.avatar_local_col', array('AVATAR_IMAGE' => $this->phpbb_root_path . $this->config['avatar_gallery_path'] . '/' . $img['file'], 'AVATAR_NAME' => $img['name'], 'AVATAR_FILE' => $img['filename'], 'CHECKED' => $img['file'] === $row['avatar']));
             $template->assign_block_vars('avatar_local_row.avatar_local_option', array('AVATAR_FILE' => $img['filename'], 'S_OPTIONS_AVATAR' => $img['filename'], 'CHECKED' => $img['file'] === $row['avatar']));
             $col_count = ($col_count + 1) % $table_cols;
             ++$avatar_pos;
         }
     }
     return true;
 }
 public static function createFromArray($a = array())
 {
     if (sizeof($a) === 0) {
         throw new FoursquareException('not an array');
     }
     return new FoursquarePhoto($a);
 }
Example #8
1
 function run()
 {
     add_action('w3tc_dashboard_setup', array(&$this, 'wp_dashboard_setup'));
     add_action('w3tc_network_dashboard_setup', array(&$this, 'wp_dashboard_setup'));
     // Configure authorize and have_zone
     $this->_setup($this->_config);
     /**
      * Retry setup with main blog
      */
     if (w3_is_network() && is_network_admin() && !$this->authorized) {
         $this->_config = new W3_Config(false, 1);
         $this->_setup($this->_config);
     }
     if (w3_is_network()) {
         $conig_admin = w3_instance('W3_ConfigAdmin');
         $this->_sealed = $conig_admin->get_boolean('cdn.configuration_sealed');
     }
     if ($this->have_zone && $this->authorized && isset($_GET['page']) && strpos($_GET['page'], 'w3tc_dashboard') !== false) {
         w3_require_once(W3TC_LIB_NETDNA_DIR . '/NetDNA.php');
         w3_require_once(W3TC_LIB_NETDNA_DIR . '/NetDNAPresentation.php');
         $authorization_key = $this->_config->get_string('cdn.maxcdn.authorization_key');
         $alias = $consumerkey = $consumersecret = '';
         $keys = explode('+', $authorization_key);
         if (sizeof($keys) == 3) {
             list($alias, $consumerkey, $consumersecret) = $keys;
         }
         $this->api = new NetDNA($alias, $consumerkey, $consumersecret);
         add_action('admin_head', array(&$this, 'admin_head'));
     }
 }
Example #9
1
/**
 * aangepaste parseData functie die overweg kan met 1 rij ipv een array met daarin een array
 *
 * @param unknown_type $data
 * @return unknown
 */
function parseData($data)
{
    $result = array();
    $result['gebruikersnaam'] = $data["uid"][0];
    $result['voornaam'] = $data["ugentpreferredgivenname"][0];
    $result['achternaam'] = $data["ugentpreferredsn"][0];
    $result['email'] = $data["mail"][0];
    $kot = $data["ugentdormpostaladdress"][0];
    if ($kot != "") {
        $kot = explode("\$", $kot);
        if (strpos(" " . $kot[0], "HOME")) {
            //VUILE LDAP HACK :(
            $kot[0] = $kot[0] == "HOME BERTHA DE VRIES" ? "HOME BERTHA DE VRIESE" : $kot[0];
            $home = Home::getHome("ldapNaam", $kot[0]);
            $result['homeId'] = $home->getId();
            $result['home'] = $home->getLangeNaam();
            $temp = explode(":", $kot[1]);
            if (sizeof($temp) > 1) {
                $result['kamer'] = $temp[1];
            } else {
                $temp = explode("(", $kot[1]);
                $temp = explode(")", $temp[1]);
                if (sizeof($temp) > 1) {
                    $result['kamer'] = $home->getKamerPrefix() . "." . $temp[0];
                } else {
                    $temp = explode("K. ", $kot[1]);
                    $result['kamer'] = $home->getKamerPrefix() . "." . converteer($temp[0]);
                    //er wordt nog een oud kamernummer gebruikt
                }
            }
        }
    }
    return $result;
}
Example #10
1
function convertToCurrency($uang)
{
    $number = (string) $uang;
    $numberLength = strlen($number);
    $numberArray = array();
    $currencyArray = array();
    $currency = "";
    for ($i = 0; $i < $numberLength; $i++) {
        array_push($numberArray, $number[$i]);
    }
    $j = $numberLength - 1;
    $k = $numberLength - 1;
    for ($i = 0; $i <= $j; $i++) {
        $currencyArray[$i] = $numberArray[$k];
        $k--;
    }
    $count = 0;
    for ($i = 0; $i < sizeof($currencyArray); $i++) {
        if ($count % 3 == 0 && $count != 0) {
            $currency = $currency . ".";
        }
        $currency = $currency . $currencyArray[$i];
        $count++;
    }
    return strrev($currency);
}
 function listbox($name, $data, $selected_value, $attributes = null)
 {
     $_attributes = array('value_key' => 'id', 'label_key' => 'name');
     if ($attributes) {
         if (array_key_exists('value_key', $attributes)) {
             $_attributes['value_key'] = $attributes['value_key'];
         }
         if (array_key_exists('label_key', $attributes)) {
             $_attributes['label_key'] = $attributes['label_key'];
         }
     }
     $valueKey = $_attributes['value_key'];
     $labelKey = $_attributes['label_key'];
     $open_select = sprintf('<select name="%s" id="list_%s">', $name, $name);
     $select_data = "";
     if ($data && sizeof($data) > 0) {
         $select_data .= sprintf('<option value="">--</option>');
         foreach ($data as $item) {
             if ($item->{$valueKey} == $selected_value) {
                 $select_data .= sprintf('<option value="%s" selected>%s</option>', $item->{$valueKey}, $item->{$labelKey});
             } else {
                 $select_data .= sprintf('<option value="%s">%s</option>', $item->{$valueKey}, $item->{$labelKey});
             }
         }
     }
     $close_select = '</select>';
     return $open_select . $select_data . $close_select;
 }
Example #12
1
 public function calculate_shipping()
 {
     /** @var \jigoshop_tax $_tax */
     $_tax = $this->get_tax();
     $this->shipping_total = 0;
     $this->shipping_tax = 0;
     if ($this->type == 'order') {
         // Shipping for whole order
         $this->shipping_total = $this->cost + $this->get_fee($this->fee, jigoshop_cart::$cart_contents_total);
         $this->shipping_total = $this->shipping_total < 0 ? 0 : $this->shipping_total;
         // fix flat rate taxes for now. This is old and deprecated, but need to think about how to utilize the total_shipping_tax_amount yet
         if (Jigoshop_Base::get_options()->get('jigoshop_calc_taxes') == 'yes' && $this->tax_status == 'taxable') {
             $this->shipping_tax = $this->calculate_shipping_tax($this->shipping_total);
         }
     } else {
         // Shipping per item
         if (sizeof(jigoshop_cart::$cart_contents) > 0) {
             foreach (jigoshop_cart::$cart_contents as $item_id => $values) {
                 /** @var jigoshop_product $_product */
                 $_product = $values['data'];
                 if ($_product->exists() && $values['quantity'] > 0 && !$_product->is_type('downloadable')) {
                     $item_shipping_price = ($this->cost + $this->get_fee($this->fee, $_product->get_price())) * $values['quantity'];
                     $this->shipping_total = $this->shipping_total + $item_shipping_price;
                     //TODO: need to figure out how to handle per item shipping with discounts that apply to shipping as well
                     // * currently not working. Will need to fix
                     if ($_product->is_shipping_taxable() && $this->tax_status == 'taxable') {
                         $_tax->calculate_shipping_tax($item_shipping_price, $this->id, $_product->get_tax_classes());
                     }
                 }
             }
             $this->shipping_tax = $_tax->get_total_shipping_tax_amount();
         }
     }
 }
Example #13
1
function ajoutLieu()
{
    require 'connect.php';
    $requete = $bdd->query("SELECT \n\t\t\t\t\t\t\t\tVILID\n\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t\tcommune");
    $villes = $requete->fetchAll();
    $requete->closeCursor();
    $requete = $bdd->prepare("SELECT \n\t\t\t\t\t\t\t\tLIEUID\n\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t\tLIEU\n\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\tLIEUID=:lieuId\n\t\t\t\t\t\t\t\tAND\n\t\t\t\t\t\t\t\tVILID=:ville\n\t\t\t\t\t\t\t\tAND\n\t\t\t\t\t\t\t\tLIEUNOM=:nom");
    $requeteSeconde = $bdd->prepare("INSERT INTO LIEU\n\t\t\t\t\t\t\t\t\t\t(LIEUID,\n\t\t\t\t\t\t\t\t\t\tVILID,\n\t\t\t\t\t\t\t\t\t\tLIEUNOM,\n\t\t\t\t\t\t\t\t\t\tLIEUCOORDGPS)\n\t\t\t\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t\t\t\t\t(:lieuId,\n\t\t\t\t\t\t\t\t\t\t:ville,\n\t\t\t\t\t\t\t\t\t\t:nom,\n\t\t\t\t\t\t\t\t\t\t:gps)");
    for ($i = 0; $i < 100; $i++) {
        echo $lieuId = $i;
        echo $ville = $villes[rand(0, sizeof($villes) - 1)]['VILID'];
        $lieuT = file('./generateurLieu.txt');
        $lieu = array(trim($lieuT[rand(0, 93)]), trim($lieuT[rand(0, 93)]));
        $lieu = implode("-", $lieu);
        echo $nom = $lieu;
        echo $gps = rand(0, 5000);
        echo "<br />";
        $requete->execute(array("ville" => $ville, "nom" => $nom));
        if ($requete->fetch() == false) {
            $requeteSeconde->execute(array("lieuId" => $lieuId, "ville" => $ville, "nom" => $nom, "gps" => $gps));
        } else {
            $i--;
        }
    }
    $requete->closeCursor();
    $requeteSeconde->closeCursor();
}
 public function getTablaUsuarios()
 {
     //get de los usuarioes
     $usuarios = $this->UsuariosDAO->getUsuarios();
     //valida si hay usuarioes
     if ($usuarios) {
         for ($a = 0; $a < sizeof($usuarios); $a++) {
             $id = $usuarios[$a]["pkID"];
             $alias = $usuarios[$a]["alias"];
             $nombres = $usuarios[$a]["nombres"];
             $apellidos = $usuarios[$a]["apellidos"];
             $numero_cc = $usuarios[$a]["numero_cc"];
             $nom_tipo = $usuarios[$a]["nom_tipo"];
             echo '
                      <tr>
                          <td>' . $id . '</td>
                          <td>' . $alias . '</td>                                 
                          <td>' . $nombres . '</td>
                          <td>' . $apellidos . '</td>
                          <td>' . $numero_cc . '</td>
                          <td>' . $nom_tipo . '</td>
                       <td>
                           <button id="btn_editar" name="edita_usuario" type="button" class="btn btn-primary" data-toggle="modal" data-target="#frm_modal_usuario" data-id-usuario = "' . $id . '" ><span class="glyphicon glyphicon-pencil"></span>&nbspEditar</button>
                        <br><br>    
                           <button id="btn_eliminar" name="elimina_usuario" type="button" class="btn btn-danger" data-id-usuario = "' . $id . '" ><span class="glyphicon glyphicon-remove"></span>&nbspEliminar</button>
                       </td>
                   </tr>';
         }
     } else {
         echo "<tr>\n\t               <td></td>\n\t               <td></td>\n\t               <td></td>\t\t               \t\t                                            \n\t           </tr>\n\t           <h3>En este momento no hay usuarioes creadas.</h3>";
     }
 }
function wsOnMessage($clientID, $message, $messageLength, $binary)
{
    global $Server;
    $ip = long2ip($Server->wsClients[$clientID][6]);
    // check if message length is 0
    if ($messageLength == 0) {
        $Server->wsClose($clientID);
        return;
    }
    //The speaker is the only person in the room. Don't let them feel lonely.
    if (sizeof($Server->wsClients) == 1) {
        $Server->wsSend($clientID, "There isn't anyone else in the room, but I'll still listen to you. --Your Trusty Server");
    } else {
        //Send the message to everyone but the person who said it
        foreach ($Server->wsClients as $id => $client) {
            if ($id != $clientID) {
                $Server->wsSend($id, "{$message}");
            }
        }
    }
    //and to arduino forst decoding mesage and sending only one byte
    if ("{$message}" == "arduino1") {
        `mode com4: BAUD=9600 PARITY=N data=8 stop=1 xon=off`;
        $fp = fopen("com4", "w+");
        fwrite($fp, chr(0x1));
        fclose($fp);
    }
}
Example #16
0
 /** 
  * _struct_to_array($values, &$i) 
  * 
  * This is adds the contents of the return xml into the array for easier processing. 
  * Recursive, Static 
  * 
  * @access    private 
  * @param    array  $values this is the xml data in an array 
  * @param    int    $i  this is the current location in the array 
  * @return    Array 
  */
 function _struct_to_array($values, &$i)
 {
     $child = array();
     if (isset($values[$i]['value'])) {
         array_push($child, $values[$i]['value']);
     }
     while ($i++ < count($values)) {
         switch ($values[$i]['type']) {
             case 'cdata':
                 array_push($child, $values[$i]['value']);
                 break;
             case 'complete':
                 $name = $values[$i]['tag'];
                 if (!empty($name)) {
                     $child[$name] = is_null($values[$i]['value']) ? '' : $values[$i]['value'];
                     //$child[$name]= ($values[$i]['value'])?($values[$i]['value']):'';
                     if (isset($values[$i]['attributes'])) {
                         $child[$name] = $values[$i]['attributes'];
                     }
                 }
                 break;
             case 'open':
                 $name = $values[$i]['tag'];
                 $size = isset($child[$name]) ? sizeof($child[$name]) : 0;
                 $child[$name][$size] = $this->_struct_to_array($values, $i);
                 break;
             case 'close':
                 return $child;
                 break;
         }
     }
     return $child;
 }
Example #17
0
 /**
  * TuiyoControllerResources::inc()
  * @param string $identifier
  * @param string $type
  * @param string $size
  * @return
  */
 public function inc($identifier = '', $type = '', $size = '')
 {
     $itemStore = array();
     $resource =& $this;
     if (!$resource instanceof self) {
         $resource = self::getInstance();
     }
     //Tuiyo TakeOver
     JRequest::setVar('format', 'stream');
     JRequest::setVar('tmpl', 'component');
     $data = JRequest::getVar("data", null);
     $segments = explode('.', trim($data));
     $count = sizeof($segments);
     //Methods
     $validMethods = array("avatar" => "_getAvatar", "audio" => "_getAudio", "doc" => "_getDocument");
     if ($count > 0) {
         if (array_key_exists($segments[0], $validMethods)) {
             $type = $segments[0];
             $args = $segments;
             //Get the file and return it;
             call_user_method($validMethods[$type], $resource, $args);
         }
     }
     jexit(0);
 }
Example #18
0
/**
 * Returns an array of found directories
 *
 * This function checks every found directory if they match either $uid or $gid, if they do
 * the found directory is valid. It uses recursive function calls to find subdirectories. Due
 * to the recursive behauviour this function may consume much memory.
 *
 * @param  string   path       The path to start searching in
 * @param  integer  uid        The uid which must match the found directories
 * @param  integer  gid        The gid which must match the found direcotries
 * @param  array    _fileList  recursive transport array !for internal use only!
 * @return array    Array of found valid pathes
 *
 * @author Martin Burchert  <martin.burchert@syscp.de>
 * @author Manuel Bernhardt <manuel.bernhardt@syscp.de>
 */
function findDirs($path, $uid, $gid)
{
    $list = array($path);
    $_fileList = array();
    while (sizeof($list) > 0) {
        $path = array_pop($list);
        $path = makeCorrectDir($path);
        $dh = opendir($path);
        if ($dh === false) {
            standard_error('cannotreaddir', $path);
            return null;
        } else {
            while (false !== ($file = @readdir($dh))) {
                if ($file == '.' && (fileowner($path . '/' . $file) == $uid || filegroup($path . '/' . $file) == $gid)) {
                    $_fileList[] = makeCorrectDir($path);
                }
                if (is_dir($path . '/' . $file) && $file != '..' && $file != '.') {
                    array_push($list, $path . '/' . $file);
                }
            }
            @closedir($dh);
        }
    }
    return $_fileList;
}
Example #19
0
function GetEvents($date = NULL, $userid = 0, $customerid = 0)
{
    global $DB, $AUTH;
    $list = $DB->GetAll('SELECT events.id AS id, title, description, begintime, endtime, closed, note, events.type,' . $DB->Concat('UPPER(c.lastname)', "' '", 'c.name') . ' AS customername, ' . $DB->Concat('c.city', "', '", 'c.address') . ' AS customerlocation,
		 nodes.location AS nodelocation,
		 (SELECT contact FROM customercontacts WHERE customerid = c.id
			AND (customercontacts.type & ?) > 0 AND (customercontacts.type & ?) <> ?  ORDER BY id LIMIT 1) AS customerphone
		 FROM events LEFT JOIN customerview c ON (customerid = c.id) LEFT JOIN nodes ON (nodeid = nodes.id)
		 WHERE date = ? AND (private = 0 OR (private = 1 AND userid = ?)) ' . ($customerid ? 'AND customerid = ' . intval($customerid) : '') . ' ORDER BY begintime', array(CONTACT_MOBILE | CONTACT_FAX | CONTACT_LANDLINE, CONTACT_DISABLED, CONTACT_DISABLED, $date, $AUTH->id));
    if ($list) {
        foreach ($list as $idx => $row) {
            $list[$idx]['userlist'] = $DB->GetAll('SELECT userid AS id, users.name
								    FROM eventassignments, users
								    WHERE userid = users.id AND eventid = ? ', array($row['id']));
            if ($userid && sizeof($list[$idx]['userlist'])) {
                foreach ($list[$idx]['userlist'] as $user) {
                    if ($user['id'] == $userid) {
                        $list2[] = $list[$idx];
                        break;
                    }
                }
            }
        }
    }
    if ($userid) {
        return $list2;
    } else {
        return $list;
    }
}
 /**
  * Parses the requested route to fetch
  * - the resource (databox, basket, record etc ..)
  * - general action (list, add, search)
  * - the action (setstatus, setname etc..)
  * - the aspect (collections, related, content etc..)
  *
  * @param ApiLog   $log
  * @param Request  $request
  * @param Response $response
  */
 private function setDetails(ApiLog $log, Request $request, Response $response)
 {
     $chunks = explode('/', trim($request->getPathInfo(), '/'));
     if (false === $response->isOk() || sizeof($chunks) === 0) {
         return;
     }
     switch ($chunks[0]) {
         case ApiLog::DATABOXES_RESOURCE:
             $this->hydrateDataboxes($log, $chunks);
             break;
         case ApiLog::RECORDS_RESOURCE:
             $this->hydrateRecords($log, $chunks);
             break;
         case ApiLog::BASKETS_RESOURCE:
             $this->hydrateBaskets($log, $chunks);
             break;
         case ApiLog::FEEDS_RESOURCE:
             $this->hydrateFeeds($log, $chunks);
             break;
         case ApiLog::QUARANTINE_RESOURCE:
             $this->hydrateQuarantine($log, $chunks);
             break;
         case ApiLog::STORIES_RESOURCE:
             $this->hydrateStories($log, $chunks);
             break;
         case ApiLog::MONITOR_RESOURCE:
             $this->hydrateMonitor($log, $chunks);
             break;
     }
 }
Example #21
0
 /**
  * Create additional xml index file with links to other xml files (if number of them more than 1)
  */
 public function createIndexSitemapFile()
 {
     if (sizeof($this->filenamesForIndexSitemap) > 1) {
         $io = new Varien_Io_File();
         $io->setAllowCreateFolders(true);
         $io->open(array('path' => $this->getPath()));
         $fileToCreate = Mage::helper('ascurl')->insertStringToFilename($this->getSitemapFilename(), '_index');
         if ($io->fileExists($fileToCreate) && !$io->isWriteable($fileToCreate)) {
             Mage::throwException(Mage::helper('sitemap')->__('File "%s" cannot be saved. Please, make sure the directory "%s" is writeable by web server.', $fileToCreate, $this->getPath()));
         }
         $io->streamOpen($fileToCreate);
         $io->streamWrite('<?xml version="1.0" encoding="UTF-8"?>' . "\n");
         $io->streamWrite('<sitemapindex ' . self::URLSET . '>');
         $storeId = $this->getStoreId();
         $baseUrl = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
         $date = Mage::getSingleton('core/date')->gmtDate('Y-m-d');
         $path = $this->getSitemapPath();
         $fullPath = preg_replace('/(?<=[^:])\\/{2,}/', '/', $baseUrl . $path);
         foreach ($this->filenamesForIndexSitemap as $item) {
             $xml = sprintf('<sitemap><loc>%s</loc><lastmod>%s</lastmod></sitemap>', htmlspecialchars($fullPath . $item), $date);
             $io->streamWrite($xml);
         }
         $io->streamWrite('</sitemapindex>');
         $io->streamClose();
     }
 }
 function clsRecordt_laporan_daftar_bphtb($RelativePath, &$Parent)
 {
     global $FileName;
     global $CCSLocales;
     global $DefaultDateFormat;
     $this->Visible = true;
     $this->Parent =& $Parent;
     $this->RelativePath = $RelativePath;
     $this->Errors = new clsErrors();
     $this->ErrorBlock = "Record t_laporan_daftar_bphtb/Error";
     $this->ReadAllowed = true;
     if ($this->Visible) {
         $this->ComponentName = "t_laporan_daftar_bphtb";
         $this->Attributes = new clsAttributes($this->ComponentName . ":");
         $CCSForm = explode(":", CCGetFromGet("ccsForm", ""), 2);
         if (sizeof($CCSForm) == 1) {
             $CCSForm[1] = "";
         }
         list($FormName, $FormMethod) = $CCSForm;
         $this->FormEnctype = "application/x-www-form-urlencoded";
         $this->FormSubmitted = $FormName == $this->ComponentName;
         $Method = $this->FormSubmitted ? ccsPost : ccsGet;
         $this->Button1 =& new clsButton("Button1", $Method, $this);
         $this->date_start_laporan =& new clsControl(ccsTextBox, "date_start_laporan", "date_start_laporan", ccsText, "", CCGetRequestParam("date_start_laporan", $Method, NULL), $this);
         $this->date_start_laporan->Required = true;
         $this->DatePicker_date_start_laporan1 =& new clsDatePicker("DatePicker_date_start_laporan1", "t_laporan_daftar_bphtb", "date_start_laporan", $this);
         $this->date_end_laporan =& new clsControl(ccsTextBox, "date_end_laporan", "date_end_laporan", ccsText, "", CCGetRequestParam("date_end_laporan", $Method, NULL), $this);
         $this->date_end_laporan->Required = true;
         $this->DatePicker_end_start_laporan1 =& new clsDatePicker("DatePicker_end_start_laporan1", "t_laporan_daftar_bphtb", "date_end_laporan", $this);
         $this->cetak_laporan =& new clsControl(ccsHidden, "cetak_laporan", "cetak_laporan", ccsText, "", CCGetRequestParam("cetak_laporan", $Method, NULL), $this);
     }
 }
Example #23
0
	function service($text)
	{
		$text = str_replace("\\\"","\"",$text);
		$token = explode(",",$text);
		$last_token = $token[sizeof($token)-1];
		$last_token = trim($last_token);
		$items = array();		
		$result = mysql_query("select firstName, lastName, email from employees where CONCAT(firstName,' ',lastName,' ', email) like '%$last_token%' order by email;");
		
		while($row = mysql_fetch_assoc($result))
		{

			$text = '"'.$row["firstName"]." ".$row["lastName"].'"'."<".$row["email"].">";
			$text_array = $token;
			$text_array[sizeof($text_array)-1] = $text;
			$text = join(",",$text_array);			
			
			$html = '"'.$row["firstName"]." ".$row["lastName"].'"'."[".$row["email"]."]";
			$html = preg_replace("/".$last_token."/i","<b>$last_token</b>",$html);
			$html = str_replace("[","&lt;",$html);
			$html = str_replace("]","&gt;",$html);
			
			$item = array("text"=>$text,"html"=>$html);
			array_push($items,$item);
		}
		return $items;
	}
 /**
  * Get tail dependencies
  *
  * @param		string		entity
  * @param		string		target release
  * @param		array		ids
  * @return		array		array of array with keys "component", entity", "ids"
  */
 function getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
 {
     if ($a_entity == "glo") {
         $deps = array();
         include_once "./Services/Taxonomy/classes/class.ilObjTaxonomy.php";
         $tax_ids = array();
         foreach ($a_ids as $id) {
             $t_ids = ilObjTaxonomy::getUsageOfObject($id);
             if (count($t_ids) > 0) {
                 $tax_ids[$t_ids[0]] = $t_ids[0];
             }
         }
         if (sizeof($tax_ids)) {
             $deps[] = array("component" => "Services/Taxonomy", "entity" => "tax", "ids" => $tax_ids);
         }
         $advmd_ids = array();
         foreach ($a_ids as $id) {
             $rec_ids = $this->getActiveAdvMDRecords($id);
             if (sizeof($rec_ids)) {
                 foreach ($rec_ids as $rec_id) {
                     $advmd_ids[] = $id . ":" . $rec_id;
                 }
             }
         }
         if (sizeof($advmd_ids)) {
             $deps[] = array("component" => "Services/AdvancedMetaData", "entity" => "advmd", "ids" => $advmd_ids);
         }
         return $deps;
     }
     return array();
 }
Example #25
0
 public function f_DEPURARINPUT($a_array)
 {
     $data = array();
     $data = $a_array;
     $c = 0;
     //primerar validacion
     for ($i = 0; $i < sizeof($data); $i++) {
         if ($data[$i] == "") {
         } else {
             //echo '</br>,la informaciĆ²n es adecuada, espere un momneto mientras se realiza su pedido.. <br>';
             $c++;
         }
     }
     if ($c == sizeof($data)) {
         return true;
     } else {
         echo '<div class="alert alert-danger" style="font-size:15px;">Recuerde que todos los campos deben ser llenados.</div>';
         //echo '</br>Recuerde que todos los campos deben estar llenos y no vacios, revise los siguientes campos por favor. <br>';
         for ($i = 0; $i < sizeof($data); $i++) {
             if ($data[$i] == "") {
                 //echo "Casillero: (".($i+1).")<br>";
                 echo '<div class="alert alert-danger" style="font-size:15px;">Casillero  ' . ('' . ($i + 1) . '') . '</div>';
             } else {
                 //echo '</br>,la informaciĆ²n es adecuada, espere un momneto mientras se realiza su pedido.. <br>';
                 $c++;
             }
         }
         return false;
     }
 }
 public function validateArraySize($attribute, $value, $parameters)
 {
     if (!is_array($value)) {
         return false;
     }
     return sizeof($value) == $parameters[0];
 }
 protected function _getLastOpenDir()
 {
     $index = sizeof($this->open_dirs) - 1;
     if (isset($this->open_dirs[$index])) {
         return $this->open_dirs[$index]['dir'];
     }
 }
Example #28
0
File: Util.php Project: rexmac/zf2
 /** Find the greatest key that is less than or equal to a given upper
  * bound, and return the value associated with that key.
  *
  * @param integer|null $maximumKey The upper bound for keys. If null, the
  *        maxiumum valued key will be found.
  * @param array $collection An two-dimensional array of key/value pairs
  *        to search through.
  * @returns mixed The value corresponding to the located key.
  * @throws \Zend\GData\App\Exception Thrown if $collection is empty.
  */
 public static function findGreatestBoundedValue($maximumKey, $collection)
 {
     $found = false;
     $foundKey = $maximumKey;
     // Sanity check: Make sure that the collection isn't empty
     if (sizeof($collection) == 0) {
         throw new Exception("Empty namespace collection encountered.");
     }
     if ($maximumKey === null) {
         // If the key is null, then we return the maximum available
         $keys = array_keys($collection);
         sort($keys);
         $found = true;
         $foundKey = end($keys);
     } else {
         // Otherwise, we optimistically guess that the current version
         // will have a matching namespce. If that fails, we decrement the
         // version until we find a match.
         while (!$found && $foundKey >= 0) {
             if (array_key_exists($foundKey, $collection)) {
                 $found = true;
             } else {
                 $foundKey--;
             }
         }
     }
     // Guard: A namespace wasn't found. Either none were registered, or
     // the current protcol version is lower than the maximum namespace.
     if (!$found) {
         throw new Exception("Namespace compatible with current protocol not found.");
     }
     return $foundKey;
 }
 /**
  * Create the migration
  *
  * @param  string $name
  * @return bool
  */
 protected function createMigration()
 {
     //Create the migration
     $app = app();
     $migrationFiles = array($this->laravel->path . "/database/migrations/*_create_cities_table.php" => 'cities::generators.migration');
     $seconds = 0;
     foreach ($migrationFiles as $migrationFile => $outputFile) {
         if (sizeof(glob($migrationFile)) == 0) {
             $migrationFile = str_replace('*', date('Y_m_d_His', strtotime('+' . $seconds . ' seconds')), $migrationFile);
             $fs = fopen($migrationFile, 'x');
             if ($fs) {
                 $output = "<?php\n\n" . $app['view']->make($outputFile)->with('table', 'cities')->render();
                 fwrite($fs, $output);
                 fclose($fs);
             } else {
                 return false;
             }
             $seconds++;
         }
     }
     //Create the seeder
     $seeder_file = $this->laravel->path . "/database/seeds/CitiesSeeder.php";
     $output = "<?php\n\n" . $app['view']->make('cities::generators.seeder')->render();
     if (!file_exists($seeder_file)) {
         $fs = fopen($seeder_file, 'x');
         if ($fs) {
             fwrite($fs, $output);
             fclose($fs);
         } else {
             return false;
         }
     }
     return true;
 }
 function __construct()
 {
     $count = getInput("count");
     $email = getInput("email");
     $password = getInput("password");
     $x = 0;
     while ($x < $count) {
         $first_name = $this->names[mt_rand(0, sizeof($this->names) - 1)];
         $last_name = $this->surnames[mt_rand(0, sizeof($this->surnames) - 1)];
         $user = new User();
         $user->password = md5($password);
         $user->random = true;
         $user->verified = "true";
         $user->profile_type = "default";
         $user->access_id = "system";
         $user->first_name = $first_name;
         $user->last_name = $last_name;
         $user->email = "tester" . $x . "@" . $email;
         $user->full_name = $first_name . " " . $last_name;
         $user->save();
         $x++;
     }
     new SystemMessage("Random users have been generated");
     forward();
 }