Example #1
1
 /**
  * 获取返回时的签名验证结果
  * @param $para_temp 通知返回来的参数数组
  * @param $sign 返回的签名结果
  * @return 签名验证结果
  */
 protected function getSignVeryfy($param, $sign)
 {
     //除去待签名参数数组中的空值和签名参数
     $param_filter = array();
     while (list($key, $val) = each($param)) {
         if ($key == "sign" || $key == "sign_type" || $val == "") {
             continue;
         } else {
             $param_filter[$key] = $param[$key];
         }
     }
     ksort($param_filter);
     reset($param_filter);
     //把数组所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串
     $prestr = "";
     while (list($key, $val) = each($param_filter)) {
         $prestr .= $key . "=" . $val . "&";
     }
     //去掉最后一个&字符
     $prestr = substr($prestr, 0, -1);
     $prestr = $prestr . $this->config['key'];
     $mysgin = md5($prestr);
     if ($mysgin == $sign) {
         return true;
     } else {
         return false;
     }
 }
function sanitize_uri()
{
    global $PATH_INFO, $SCRIPT_NAME, $REQUEST_URI;
    if (isset($PATH_INFO) && $PATH_INFO != "") {
        $SCRIPT_NAME = $PATH_INFO;
        $REQUEST_URI = "";
    }
    if ($REQUEST_URI == "") {
        //necessary for some IIS installations (CGI in particular)
        $get = httpallget();
        if (count($get) > 0) {
            $REQUEST_URI = $SCRIPT_NAME . "?";
            reset($get);
            $i = 0;
            while (list($key, $val) = each($get)) {
                if ($i > 0) {
                    $REQUEST_URI .= "&";
                }
                $REQUEST_URI .= "{$key}=" . URLEncode($val);
                $i++;
            }
        } else {
            $REQUEST_URI = $SCRIPT_NAME;
        }
        $_SERVER['REQUEST_URI'] = $REQUEST_URI;
    }
    $SCRIPT_NAME = substr($SCRIPT_NAME, strrpos($SCRIPT_NAME, "/") + 1);
    if (strpos($REQUEST_URI, "?")) {
        $REQUEST_URI = $SCRIPT_NAME . substr($REQUEST_URI, strpos($REQUEST_URI, "?"));
    } else {
        $REQUEST_URI = $SCRIPT_NAME;
    }
}
Example #3
0
 function next()
 {
     list($this->key, $this->current) = each($this->array);
     //		list($key, $current) = each($this->array);
     //		$this->key = $key;
     //		$this->current = $current;
 }
Example #4
0
function formulaire()
{
    $users = new usersMenus();
    $ldap = new clladp();
    $tpl = new templates();
    $page = CurrentPageName();
    if ($users->AsAnAdministratorGeneric) {
        $hash = $ldap->hash_get_ou(false);
    } else {
        $hash = $ldap->Hash_Get_ou_from_users($_SESSION["uid"], 1);
    }
    if (count($hash) == 1) {
        $org = $hash[0];
        $hash_groups = $ldap->hash_groups($org, 1);
        $hash_domains = $ldap->hash_get_domains_ou($org);
        $groups = Field_array_Hash($hash_groups, 'groupid', null, null, null, 0, "font-size:14px;padding:3px");
        $domains = Field_array_Hash($hash_domains, 'domain', null, null, null, 0, "font-size:14px;padding:3px");
    }
    $artica = new artica_general();
    $EnableVirtualDomainsInMailBoxes = $artica->EnableVirtualDomainsInMailBoxes;
    while (list($num, $ligne) = each($hash)) {
        $ous[$ligne] = $ligne;
    }
    $ou = Field_array_Hash($ous, 'organization', null, "ChangeFormValues()", null, 0, "font-size:14px;padding:3px");
    $form = "\n\t\n\t<input type='hidden' id='EnableVirtualDomainsInMailBoxes' value='{$EnableVirtualDomainsInMailBoxes}'>\n\t<table style='width:100%' class=form>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:14px'>{organization}:</td>\n\t\t\t<td>{$ou}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:14px'>{group}:</td>\n\t\t\t<td><span id='select_groups'>{$groups}</span>\n\t\t</tr>\n\t\t<tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:14px'>{firstname}:</td>\n\t\t\t<td>" . Field_text('firstname', null, 'width:120px;font-size:14px;padding:3px', null, 'ChangeFormValues()') . "</td>\n\t\t</tr>\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:14px'>{lastname}:</td>\n\t\t\t<td>" . Field_text('lastname', null, 'width:120px;font-size:14px;padding:3px', null, "ChangeFormValues()") . "</td>\n\t\t</tr>\t\t\n\t\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:14px'>{email}:</td>\n\t\t\t<td>" . Field_text('email', null, 'width:120px;font-size:14px;padding:3px', null, "ChangeFormValues()") . "@<span id='select_domain'>{$domains}</span></td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:14px'>{uid}:</td>\n\t\t\t<td>" . Field_text('login', null, 'width:120px;font-size:14px;padding:3px') . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:14px'>{password}:</td>\n\t\t\t<td>" . Field_password('password', null, "font-size:14px;padding:3px") . "</td>\n\t\t</tr>\t\n\t\t<tr><td colspan=2>&nbsp;</td></tr>\n\t\t<tr>\n\t\t\t<td colspan=2 align='right'><hr>" . button("{add}", "SaveAddUser()") . "\n\t\t\t\t\n\t\t\t</td>\n\t\t</tr>\n\t\t\n\t\t</table>\n\t";
    $html = "\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td valign='top' width=1%><div id='ffform'><img src='img/identity-add-96.png'></div></td>\n\t\t<td valign='top' width=99%><div>{$form}</div></td>\n\t</tr>\n\t</table>\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Example #5
0
 public function run($args)
 {
     global $connect, $dbprefix;
     $field = $args[0];
     $srid = $_SESSION['srid'];
     $sid = $_POST['sid'];
     $query = "SELECT {$field} FROM {$dbprefix}survey_{$sid} WHERE id = {$srid}";
     if (!($result = $connect->Execute($query))) {
         throw new Exception("Couldn't get question '{$field}' answer<br />" . $connect->ErrorMsg());
         //Checked
     }
     $row = $result->fetchRow();
     $value = $row[$field];
     $found = array_keys($args, $value);
     if (count($found)) {
         while ($e = each($found)) {
             if ($e['value'] % 2 != 0) {
                 // we check this, as only at odd indexes there are 'cases'
                 return $args[$e['value'] + 1];
             }
         }
         // returns value associated with found 'case'
     }
     // return empty string if none of cases matches user's answer
     return "";
 }
Example #6
0
 function dataInsert($table, $dataArray)
 {
     $fldArray = $dataArray;
     $i = 0;
     $j = 0;
     $sql .= "insert into `" . $table . "` (";
     while (list($key1, $value1) = each($fldArray)) {
         $sql .= "`" . $key1 . "`";
         $j++;
         if ($j != count($fldArray)) {
             $sql .= ",";
         }
         if ($j == count($fldArray)) {
             $sql .= ") VALUES (";
         }
     }
     while (list($key1, $value1) = each($dataArray)) {
         $sql .= "'" . $value1 . "'";
         $i++;
         if ($i != count($dataArray)) {
             $sql .= ",";
         }
         if ($i == count($dataArray)) {
             $sql .= ")";
         }
     }
     mysql_query($sql) or die(CHECK_QUERY . $sql);
     $id = mysql_insert_id();
     return $id;
 }
 /**
  * {@inheritdoc}
  */
 public function nextMail()
 {
     // Get the current mail spool row and update the internal pointer to the
     // next row.
     $return = each($this->mails);
     // If we're done, return false.
     if (!$return) {
         return FALSE;
     }
     $spool_data = $return['value'];
     // Store this spool row as processed.
     $this->processed[$spool_data->msid] = $spool_data;
     $entity = entity_load($spool_data->entity_type, $spool_data->entity_id);
     if (!$entity) {
         // If the entity load failed, set the processed status done and proceed with
         // the next mail.
         $this->processed[$spool_data->msid]->result = array('status' => SpoolStorageInterface::STATUS_DONE, 'error' => TRUE);
         return $this->nextMail();
     }
     if ($spool_data->data) {
         $subscriber = $spool_data->data;
     } else {
         $subscriber = simplenews_subscriber_load_by_mail($spool_data->mail);
     }
     if (!$subscriber) {
         // If loading the subscriber failed, set the processed status done and
         // proceed with the next mail.
         $this->processed[$spool_data->msid]->result = array('status' => SpoolStorageInterface::STATUS_DONE, 'error' => TRUE);
         return $this->nextMail();
     }
     $mail = new MailEntity($entity, $subscriber, \Drupal::service('simplenews.mail_cache'));
     // Set the langcode langcode.
     $this->processed[$spool_data->msid]->langcode = $mail->getEntity()->language()->getId();
     return $mail;
 }
Example #8
0
 public function populateData($search = false)
 {
     $tahun = $_SESSION['ta'];
     $dataobat = $_SESSION['currentPagePerpetualStock']['dataobat'];
     $idobat = $dataobat['idobat'];
     $str = "SELECT ks.idobat,ks.tanggal,ks.qty,dsb.idsatuan_obat AS pembelian_idsatuan,dsb.harga AS pembelian_harga,dsb.harga*ks.qty AS pembelian_jumlah,dsk.idsatuan_obat AS pengeluaran_idsatuan,dsk.harga AS pengeluaran_harga,dsk.harga*ks.qty AS pengeluaran_jumlah,ks.sisa_stock,ks.mode,ks.keterangan,ks.date_added FROM log_ks ks LEFT JOIN detail_sbbm dsb ON (ks.iddetail_sbbm=dsb.iddetail_sbbm) LEFT JOIN detail_sbbk dsk ON (ks.iddetail_sbbk=dsk.iddetail_sbbk) WHERE ks.idobat={$idobat} AND ks.tahun={$tahun} ORDER BY ks.date_added ASC";
     $this->DB->setFieldTable(array('idobat', 'tanggal', 'qty', 'pembelian_idsatuan', 'pembelian_harga', 'pembelian_jumlah', 'pengeluaran_idsatuan', 'pengeluaran_harga', 'pengeluaran_jumlah', 'sisa_stock', 'mode', 'keterangan'));
     $r = $this->DB->getRecord($str);
     $data = array();
     while (list($k, $v) = each($r)) {
         if ($v['mode'] == 'masuk') {
             $v['nama_satuan'] = $this->DMaster->getNamaSatuanObat($v['pembelian_idsatuan']);
             $v['uraian'] = $v['keterangan'];
             $v['harga'] = $v['pembelian_harga'];
             $v['pembelian_qty'] = $v['qty'];
             $v['saldo_jumlah'] = $v['harga'] * $v['sisa_stock'];
             $v['pengeluaran_qty'] = '-';
             $v['pengeluaran_jumlah'] = '-';
         } else {
             $v['nama_satuan'] = $this->DMaster->getNamaSatuanObat($v['pengeluaran_idsatuan']);
             $v['uraian'] = $v['keterangan'];
             $v['harga'] = $v['pengeluaran_harga'];
             $v['pengeluaran_qty'] = $v['qty'];
             $v['saldo_jumlah'] = $v['harga'] * $v['sisa_stock'];
             $v['pembelian_qty'] = '-';
             $v['pembelian_jumlah'] = '-';
         }
         $data[$k] = $v;
     }
     $this->RepeaterS->DataSource = $data;
     $this->RepeaterS->dataBind();
 }
Example #9
0
function logs()
{
    $f = explode("\n", @file_get_contents("ressources/logs/web/restart.squid"));
    while (list($num, $val) = each($f)) {
        echo "<div><code style='font-size:12px'>{$val}</code></div>";
    }
}
Example #10
0
    function foot($buttons = '')
    {
        if ($buttons) {
            if (!is_array($buttons)) {
                $tmp = $buttons;
                $buttons = array();
                $buttons[$tmp] = $tmp;
            }
            ?>
				<tr>
					<td align="right">&nbsp;</td>
					<td align="left">
				<?php 
            reset($buttons);
            while (list($name, $value) = each($buttons)) {
                ?>
					<input type="submit" name="<?php 
                echo $name;
                ?>
" value=" <?php 
                echo $value;
                ?>
 " />&nbsp;&nbsp;
					<?php 
            }
            ?>
					</td>
				</tr>
				<?php 
        }
        ?>
			</table>
			<?php 
    }
Example #11
0
function tabs()
{
    $tpl = new templates();
    $array["index"] = '{parameters}';
    $array["rules"] = '{rules}';
    $array["transparent"] = '{transparent_rules}';
    $array["events"] = '{events}';
    //$array["plugins"]='{squid_plugins}';
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql();
    $style = "style='font-size:22px'";
    $t = time();
    while (list($num, $ligne) = each($array)) {
        if ($num == "index") {
            $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"ss5.php\" {$style}><span>{$ligne}</span></a></li>\n");
            continue;
        }
        if ($num == "events") {
            $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"ss5.events.php\" {$style}><span>{$ligne}</span></a></li>\n");
            continue;
        }
        if ($num == "rules") {
            $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"ss5.rules.php\" {$style}><span>{$ligne}</span></a></li>\n");
            continue;
        }
        if ($num == "transparent") {
            $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"ss5.transparent.php\" {$style}><span>{$ligne}</span></a></li>\n");
            continue;
        }
        $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"{$page}?{$num}=yes\" {$style}><span>{$ligne}</span></a></li>\n");
    }
    echo build_artica_tabs($html, "ss5_main", 1490);
}
function postparse($verify = false, $subval = false)
{
    if ($subval) {
        $var = $_POST[$subval];
    } else {
        $var = $_POST;
    }
    reset($var);
    $sql = "";
    $keys = "";
    $vals = "";
    $i = 0;
    while (list($key, $val) = each($var)) {
        if ($verify === false || isset($verify[$key])) {
            if (is_array($val)) {
                $val = addslashes(serialize($val));
            }
            $sql .= ($i > 0 ? "," : "") . "{$key}='{$val}'";
            $keys .= ($i > 0 ? "," : "") . "{$key}";
            $vals .= ($i > 0 ? "," : "") . "'{$val}'";
            $i++;
        }
    }
    return array($sql, $keys, $vals);
}
 function show_screen($db_object, $common, $user_id, $default, $post_var)
 {
     while (list($kk, $vv) = @each($post_var)) {
         ${$kk} = $vv;
     }
     $xPath = $common->path;
     $returncontent = $xPath . "/templates/career/careergoals_usage.html";
     $returncontent = $common->return_file_content($db_object, $returncontent);
     $family = $common->prefix_table('family');
     $career_goals = $common->prefix_table('career_goals');
     $mysql = "select family_id,family_name from {$family}";
     $family_arr = $db_object->get_rsltset($mysql);
     preg_match("/<{careergoals_loopstart}>(.*?)<{careergoals_loopend}>/s", $returncontent, $matchold);
     $matchnew = $matchold[1];
     for ($i = 0; $i < count($family_arr); $i++) {
         $family_name = $family_arr[$i]['family_name'];
         $family_id = $family_arr[$i]['family_id'];
         $mysql = "select count(*) as cnt_fam from career_goals where \n\t\t\t(onelevel_low = '{$family_id}' or same_level = '{$family_id}' or onelevel_up = '{$family_id}' or twolevel_up = '{$family_id}')";
         $fam_cnt_arr = $db_object->get_a_line($mysql);
         $fam_cnt = $fam_cnt_arr['cnt_fam'];
         $str .= preg_replace("/<{(.*?)}>/e", "\$\$1", $matchnew);
     }
     $returncontent = preg_replace("/<{careergoals_loopstart}>(.*?)<{careergoals_loopend}>/s", $str, $returncontent);
     $returncontent = $common->direct_replace($db_object, $returncontent, $values);
     echo $returncontent;
 }
 function index($values = 0)
 {
     //echo "<p>notes.ui.index: values = "; _debug_array($values);
     if (!is_array($values)) {
         $values = array('nm' => $this->session_data);
     }
     if ($values['add'] || $values['cats'] || isset($values['nm']['rows'])) {
         $this->session_data = $values['nm'];
         unset($this->session_data['rows']);
         $this->save_sessiondata();
         if ($values['add']) {
             return $this->edit();
         } elseif ($values['cats']) {
             Header('Location: ' . $GLOBALS['phpgw']->link('/index.php?menuaction=preferences.uicategories.index&cats_app=et_notes&cats_level=True&global_cats=True'));
             $GLOBALS['phpgw']->common->phpgw_exit();
         } elseif (isset($values['nm']['rows']['view'])) {
             list($id) = each($values['nm']['rows']['view']);
             return $this->view($id);
         } elseif (isset($values['nm']['rows']['edit'])) {
             list($id) = each($values['nm']['rows']['edit']);
             return $this->edit($id);
         } elseif (isset($values['nm']['rows']['delete'])) {
             list($id) = each($values['nm']['rows']['delete']);
             return $this->delete($id);
         }
     }
     $this->tpl->read('et_notes.index');
     $values['nm']['options-filter'] = array('all' => 'Show all', 'public' => 'Only yours', 'private' => 'Private');
     $values['nm']['get_rows'] = 'et_notes.bo.get_rows';
     $values['nm']['no_filter2'] = True;
     $values['user'] = $GLOBALS['phpgw_info']['user']['fullname'];
     $this->tpl->exec('et_notes.ui.index', $values);
 }
 public function format($source)
 {
     $this->tkns = token_get_all($source);
     $this->code = '';
     while (list($index, $token) = each($this->tkns)) {
         list($id, $text) = $this->getToken($token);
         $this->ptr = $index;
         if (T_WHITESPACE == $id || T_VARIABLE == $id || T_INLINE_HTML == $id || T_COMMENT == $id || T_DOC_COMMENT == $id || T_CONSTANT_ENCAPSED_STRING == $id) {
             $this->appendCode($text);
             continue;
         }
         if (T_STRING == $id && $this->leftUsefulTokenIs([T_DOUBLE_COLON, T_OBJECT_OPERATOR])) {
             $this->appendCode($text);
             continue;
         }
         if (T_START_HEREDOC == $id) {
             $this->appendCode($text);
             $this->printUntil(ST_SEMI_COLON);
             continue;
         }
         if (ST_QUOTE == $id) {
             $this->appendCode($text);
             $this->printUntilTheEndOfString();
             continue;
         }
         $lcText = strtolower($text);
         if (('true' === $lcText || 'false' === $lcText || 'null' === $lcText) && !$this->leftUsefulTokenIs([T_NS_SEPARATOR, T_AS, T_CLASS, T_EXTENDS, T_IMPLEMENTS, T_INSTANCEOF, T_INTERFACE, T_NEW, T_NS_SEPARATOR, T_PAAMAYIM_NEKUDOTAYIM, T_USE, T_TRAIT, T_INSTEADOF, T_CONST]) && !$this->rightUsefulTokenIs([T_NS_SEPARATOR, T_AS, T_CLASS, T_EXTENDS, T_IMPLEMENTS, T_INSTANCEOF, T_INTERFACE, T_NEW, T_NS_SEPARATOR, T_PAAMAYIM_NEKUDOTAYIM, T_USE, T_TRAIT, T_INSTEADOF, T_CONST]) || isset(static::$reservedWords[$lcText])) {
             $text = $lcText;
         }
         $this->appendCode($text);
     }
     return $this->code;
 }
Example #16
0
function PageFetchmail_status()
{
    include_once 'ressources/class.fetchmail.inc';
    $tpl = new templates();
    $yum = new usersMenus();
    if ($yum->AsMailBoxAdministrator == false) {
        $html = $tpl->_ENGINE_parse_body("<h3>{not allowed}</H3>");
        return $html;
    }
    $status = new status(1);
    $stat = $status->fetchmail_satus();
    $html = $stat;
    if ($usersmenus->AutomaticConfig == false) {
        $html = $html . "<br><fieldset><legend>{apply config}</legend>\n\t\t\t\t\t<center><input type='button' value='{apply config}' OnClick=\"javascript:TreeFetchMailApplyConfig()\"></center>\n\t\t\t\t</fieldset>";
    }
    $fetch = new fetchmail();
    if (is_array($fetch->array_servers)) {
        $html = $html . "<fieldset>\n\t\t\t\t<legend>{servers_list}</legend>\n\t\t\t\t<center>\n\t\t\t\t<table style='width:90%;border:1px solid #CCCCCC'>\n\t\t\t\t<tr style='border-bottom:1px solid #CCCCCC'>\n\t\t\t\t\t<td colspan=2><strong>{servers_list}</td>\n\t\t\t\t\t<td align='center'><strong>{number_users}</strong></td>\n\t\t\t\t</tr>";
        while (list($num, $val) = each($fetch->array_servers)) {
            $html = $html . "<tr>\n\t\t\t\t\t<td width=1%><img src='img/webmin_on-22.gif'></td>\n\t\t\t\t\t<td><a href=\"javascript:TreeFetchmailShowServer('{$num}');\">{$num}</a></td>\n\t\t\t\t\t<td align='center'>" . count($val) . "</td>\n\t\t\t\t\t</tr>";
        }
        $html = $html . "</table></center></fieldset>";
    }
    return $tpl->_ENGINE_parse_body("<div id=status>{$html}</div>");
}
Example #17
0
 /**
  * Factory method that constructs the appropriate XML-RPC encoded type value
  *
  * @param mixed Value to be encode
  * @param string Explicit XML-RPC type as enumerated in the XML-RPC spec (defaults to automatically selected type)
  * @return mixed The encoded value
  */
 public static function createFromNative($value, $explicitType)
 {
     $type = strtolower($explicitType);
     $availableTypes = array('datetime', 'base64', 'struct');
     if (in_array($type, $availableTypes)) {
         if ($type == 'struct') {
             if (!is_array($value)) {
                 throw new XML_RPC2_Exception('With struct type, value has to be an array');
             }
             // Because of http://bugs.php.net/bug.php?id=21949
             // is some cases (structs with numeric indexes), we need to be able to force the "struct" type
             // (xmlrpc_set_type doesn't help for this, so we need this ugly hack)
             $new = array();
             while (list($k, $v) = each($value)) {
                 $new["xml_rpc2_ugly_struct_hack_{$k}"] = $v;
                 // with this "string" prefix, we are sure that the array will be seen as a "struct"
             }
             return $new;
         }
         $value2 = (string) $value;
         if (!xmlrpc_set_type($value2, $type)) {
             throw new XML_RPC2_Exception('Error returned from xmlrpc_set_type');
         }
         return $value2;
     }
     return $value;
 }
Example #18
0
function inject_form_variables(&$form_array, $arg1 = array(), $arg2 = array(), $arg3 = array(), $arg4 = array()) {
	$check_fields = array("value", "array", "friendly_name", "description", "sql", "sql_print", "form_id", "items");

	/* loop through each available field */
	while (list($field_name, $field_array) = each($form_array)) {
		/* loop through each sub-field that we are going to check for variables */
		foreach ($check_fields as $field_to_check) {
			if (isset($field_array[$field_to_check]) && (is_array($form_array[$field_name][$field_to_check]))) {
				/* if the field/sub-field combination is an array, resolve it recursively */
				$form_array[$field_name][$field_to_check] = inject_form_variables($form_array[$field_name][$field_to_check], $arg1);
			}elseif (isset($field_array[$field_to_check]) && (!is_array($field_array[$field_to_check])) && (ereg("\|(arg[123]):([a-zA-Z0-9_]*)\|", $field_array[$field_to_check], $matches))) {
				/* an empty field name in the variable means don't treat this as an array */
				if ($matches[2] == "") {
					if (is_array(${$matches[1]})) {
						/* the existing value is already an array, leave it alone */
						$form_array[$field_name][$field_to_check] = ${$matches[1]};
					}else{
						/* the existing value is probably a single variable */
						$form_array[$field_name][$field_to_check] = str_replace($matches[0], ${$matches[1]}, $field_array[$field_to_check]);
					}
				}else{
					/* copy the value down from the array/key specified in the variable */
					$form_array[$field_name][$field_to_check] = str_replace($matches[0], ((isset(${$matches[1]}{$matches[2]})) ? ${$matches[1]}{$matches[2]} : ""), $field_array[$field_to_check]);
				}
			}
		}
	}

	return $form_array;
}
Example #19
0
 function getInfo($servers, $timeout = 200, $output_type = 'parsed')
 {
     $this->svr_timeout = $timeout;
     if (!is_array($servers)) {
         $this->error('input data is not an array', 0);
     }
     /* process servers */
     while (list($this->svr_id, $server) = each($servers)) {
         /* get config */
         if (!$this->getConfig($server)) {
             continue;
         }
         /* communicate with server */
         if (($strings = $this->communicate()) !== FALSE) {
             /* check what to do with the returned strings */
             switch ($output_type) {
                 case 'parsed':
                     $svr_output = $this->parseData($strings);
                     break;
                 case 'raw':
                     $svr_output['strings'] = $strings;
                     break;
                 default:
                     $this->error('wrong output type specified', 0);
             }
         } else {
             $svr_output = '';
         }
         /* add some additional info */
         $svr_output = $this->customData($svr_output);
         /* put data into output array */
         $output[$this->svr_id] = $svr_output;
     }
     return $output;
 }
Example #20
0
 /** Returns an array. Element 0 - GD resource. Element 1 - width. Element 2 - height.
  * Returns FALSE on failure. The only one parameter $image can be an instance of this class,
  * a GD resource, an array(width, height) or path to image file.
  * @param mixed $image
  * @return array */
 protected function build_image($image)
 {
     if ($image instanceof gd) {
         $width = $image->get_width();
         $height = $image->get_height();
         $image = $image->get_image();
     } elseif (is_resource($image) && get_resource_type($image) == "gd") {
         $width = @imagesx($image);
         $height = @imagesy($image);
     } elseif (is_array($image)) {
         list($key, $width) = each($image);
         list($key, $height) = each($image);
         $image = imagecreatetruecolor($width, $height);
     } elseif (false !== (list($width, $height, $type) = @getimagesize($image))) {
         $image = $type == IMAGETYPE_GIF ? @imagecreatefromgif($image) : ($type == IMAGETYPE_WBMP ? @imagecreatefromwbmp($image) : ($type == IMAGETYPE_JPEG ? @imagecreatefromjpeg($image) : ($type == IMAGETYPE_JPEG2000 ? @imagecreatefromjpeg($image) : ($type == IMAGETYPE_PNG ? imagecreatefrompng($image) : ($type == IMAGETYPE_XBM ? @imagecreatefromxbm($image) : false)))));
         if ($type == IMAGETYPE_PNG) {
             imagealphablending($image, false);
         }
     }
     $return = is_resource($image) && get_resource_type($image) == "gd" && isset($width) && isset($height) && preg_match('/^[1-9][0-9]*$/', $width) !== false && preg_match('/^[1-9][0-9]*$/', $height) !== false ? array($image, $width, $height) : false;
     if ($return !== false && isset($type)) {
         $this->type = $type;
     }
     return $return;
 }
Example #21
0
 function parse($data_str, $query)
 {
     $items = array('name' => 'Domain Name (UTF-8):', 'created' => 'Record created on', 'expires' => 'Record expires on', 'changed' => 'Record last updated on', 'status' => 'Record status:', 'handle' => 'Record ID:');
     while (list($key, $val) = each($data_str['rawdata'])) {
         $val = trim($val);
         if ($val != '') {
             if ($val == 'Domain servers in listed order:') {
                 while (list($key, $val) = each($data_str['rawdata'])) {
                     $val = trim($val);
                     if ($val == '') {
                         break;
                     }
                     $r['regrinfo']['domain']['nserver'][] = $val;
                 }
                 break;
             }
             reset($items);
             while (list($field, $match) = each($items)) {
                 if (strstr($val, $match)) {
                     $r['regrinfo']['domain'][$field] = trim(substr($val, strlen($match)));
                     break;
                 }
             }
         }
     }
     if (isset($r['regrinfo']['domain'])) {
         $r['regrinfo']['registered'] = 'yes';
     } else {
         $r['regrinfo']['registered'] = 'no';
     }
     $r['regyinfo'] = array('whois' => 'whois.nic.nu', 'referrer' => 'http://www.nunames.nu', 'registrar' => '.NU Domain, Ltd');
     format_dates($r, 'dmy');
     return $r;
 }
function tabs()
{
    $uuid = $_GET["uuid"];
    $fontsize = 18;
    $tpl = new templates();
    $page = CurrentPageName();
    $array["RTT"] = "{realtime}";
    $array["WEEK"] = "{this_week}";
    $array["websites"] = "{websites}";
    while (list($num, $ligne) = each($array)) {
        if ($num == "RTT") {
            $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"squid.bandwidth.rtt.week.php?uuid={$uuid}&meta=1\" style='font-size:{$fontsize};font-weight:normal'><span>{$ligne}</span></a></li>\n");
            continue;
        }
        if ($num == "WEEK") {
            $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"squid.bandwidth.rttw.week.php?uuid={$uuid}&meta=1\" style='font-size:{$fontsize};font-weight:normal'><span>{$ligne}</span></a></li>\n");
            continue;
        }
        if ($num == "websites") {
            $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"squid.bandwidth.rweb.week.php?uuid={$uuid}&meta=1\" style='font-size:{$fontsize};font-weight:normal'><span>{$ligne}</span></a></li>\n");
            continue;
        }
        $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"{$page}?{$num}=yes\" style='font-size:{$fontsize};font-weight:normal'><span>{$ligne}</span></a></li>\n");
    }
    $html = build_artica_tabs($html, 'main_bandwidth_meta_tabs');
    echo $html;
}
Example #23
0
function countries_list()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $free = new freeweb($_GET["servername"]);
    $GEOIP = $free->Params["GEOIP"];
    $tables[] = "<table style='width:100%'><tr>";
    $t = 0;
    while (list($key, $line) = each($free->COUNTRIES_ISO)) {
        $line = trim($line);
        if ($line == null) {
            continue;
        }
        $t = $t + 1;
        if ($_GET["onlyS"] == 1) {
            if ($GEOIP[$line] != 1) {
                continue;
            }
        }
        //$js[]="";
        $content = "<td class=legend nowrap>{$key}</td><td>" . Field_checkbox("CT_{$line}", 1, $GEOIP[$line], "CheckAPGEO('{$line}')") . "</td>";
        $tables[] = $content;
        if ($t == 2) {
            $t = 0;
            $tables[] = "</tr><tr>";
        }
    }
    if ($t < 2) {
        for ($i = 0; $i <= $t; $i++) {
            $tables[] = "<td valign='top' width=1%>&nbsp;</td>";
        }
    }
    $tables[] = "</table>\n\t<script>\n\t\t\tvar x_CheckAPGEO=function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tif(results.length>3){alert(results);}\t\n\t\t\t\n\t\t}\t\n\t\n\t\n\t\tfunction CheckAPGEO(geo){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tif(document.getElementById('CT_'+geo).checked){XHR.appendData('value',1);}else{XHR.appendData('value',0);}\n\t\t\tXHR.appendData('servername','{$_GET["servername"]}');\t\t\t\n\t\t\tXHR.appendData('country',geo);\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_CheckAPGEO);\n\t\t}\n\t\n\t</script>\n\t";
    echo @implode("\n", $tables);
}
 function savedata()
 {
     global $filesystem;
     $top = '<?php' . "\nif (defined('VISCACHA_CORE') == false) { die('Error: Hacking Attempt'); }\n";
     $top .= '$' . $this->varname . ' = array();' . "\n";
     $cfg = array();
     while (list($key, $val) = each($this->data)) {
         if (is_array($val)) {
             foreach ($val as $key2 => $val2) {
                 if (isset($this->opt[$key][$key2]) && $this->opt[$key][$key2] == int || is_int($val2)) {
                     $val2 = intval($val2);
                 } else {
                     $val2 = $this->_prepareString($val2);
                 }
                 $cfg[] = '$' . $this->varname . "['{$key}']['{$key2}'] = {$val2};";
             }
         } else {
             if (isset($this->opt[$key]) && $this->opt[$key] == int || is_int($val)) {
                 $val = intval($val);
             } else {
                 $val = $this->_prepareString($val);
             }
             $cfg[] = '$' . $this->varname . "['{$key}'] = {$val};";
         }
     }
     natcasesort($cfg);
     $newdata = implode("\n", $cfg);
     $bottom = "\n" . '?>';
     $filesystem->file_put_contents($this->file, $top . $newdata . $bottom);
 }
 function objectInfo($object_array)
 {
     reset($object_array);
     while (list($key, $value) = each($object_array)) {
         $this->{$key} = olc_db_prepare_input($value);
     }
 }
Example #26
0
 public function format($source)
 {
     $this->tkns = token_get_all($source);
     $this->code = '';
     while (list($index, $token) = each($this->tkns)) {
         list($id, $text) = $this->getToken($token);
         $this->ptr = $index;
         switch ($id) {
             case T_IF:
                 if ($this->leftTokenIs([T_ELSE]) && !$this->leftTokenIs([T_OPEN_TAG, T_OPEN_TAG_WITH_ECHO])) {
                     $this->rtrimAndAppendCode($text);
                     break;
                 }
                 $this->appendCode($text);
                 break;
             case T_ELSEIF:
                 $this->appendCode(str_replace(' ', '', $text));
                 break;
             default:
                 $this->appendCode($text);
                 break;
         }
     }
     return $this->code;
 }
 public function format($source)
 {
     $this->tkns = token_get_all($source);
     $this->code = '';
     while (list($index, $token) = each($this->tkns)) {
         list($id, $text) = $this->getToken($token);
         $this->ptr = $index;
         switch ($id) {
             case T_TRAIT:
             case T_CLASS:
                 if ($this->leftUsefulTokenIs(T_DOUBLE_COLON)) {
                     $this->appendCode($text);
                     break;
                 }
                 $this->appendCode($text);
                 $this->printUntil(ST_CURLY_OPEN);
                 list(, $text) = $this->printAndStopAt(T_WHITESPACE);
                 if ($this->hasLn($text)) {
                     $text = substr(strrchr($text, 10), 0);
                 }
                 $this->appendCode($text);
                 break;
             default:
                 $this->appendCode($text);
                 break;
         }
     }
     return $this->code;
 }
 function display_array_content_style($arrayname, $method, $base_url)
 {
     $a = "";
     sort($arrayname);
     while (list($key, $value) = each($arrayname)) {
         if (is_array($value)) {
             $c = display_array_content($value, '');
             $d = ltrim($c, "0");
             $d = str_replace("-", "", $c);
             $a .= "<a id='modal_window_link' href='" . $base_url . "output/print.output.php?section=styles&amp;view=" . $c . "&amp;tb=true'>" . $d . "</a>";
         } else {
             $e = ltrim($value, "0");
             $e = str_replace("-", "", $value);
             $a .= "<a id='modal_window_link' href='" . $base_url . "output/print.output.php?section=styles&amp;view=" . $value . "&amp;tb=true'>" . $e . "</a>";
         }
         if ($method == "1") {
             $a .= "";
         }
         if ($method == "2") {
             $a .= "&nbsp;&nbsp;";
         }
         if ($method == "3") {
             $a .= ", ";
         }
     }
     $b = rtrim($a, "&nbsp;&nbsp;");
     $b = rtrim($b, "  ");
     return $b;
 }
 /**
  * Constructor
  *
  * @param  array $options Associative array of options
  * @return void
  */
 public function __construct(array $options = array())
 {
     while (list($name, $value) = each($options)) {
         $this->setOption($name, $value);
     }
     $this->setOption('automatic_serialization', true);
 }
Example #30
0
 function PostRequest($url, $referer, $_data, $addheader = null)
 {
     $data = null;
     while (list($n, $v) = each($_data)) {
         $data .= '&' . $n . '=' . rawurlencode($v);
     }
     $data = substr($data, 1);
     $url = parse_url($url);
     if ($url['scheme'] != 'http') {
         die("Only HTTP-Request are supported");
     }
     $host = $url['host'];
     $path = $url['path'];
     $fp = fsockopen($host, 80);
     fputs($fp, "POST {$path} HTTP/1.1\r\n");
     fputs($fp, "Host: {$host}\r\n");
     fputs($fp, "Referer: {$referer}\r\n");
     fputs($fp, "User-Agent: BotTool (http://testhh.pytalhost.com)\r\n");
     fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
     fputs($fp, "Content-length: " . strlen($data) . "\r\n");
     if ($addheader != '') {
         fputs($fp, $addheader);
     }
     fputs($fp, "Connection: close\r\n\r\n");
     fputs($fp, $data);
     $result = null;
     while (!feof($fp)) {
         $result .= fgets($fp, 128);
     }
     fclose($fp);
     $result = explode("\r\n\r\n", $result, 2);
     $header = isset($result[0]) ? $result[0] : '';
     $content = isset($result[1]) ? $result[1] : '';
     return array($header, $content);
 }