/** * [_is_auth_success 验证权限是否成功] * @param [type] $auths [description] * @return boolean [description] */ private function _is_auth_success($auths) { $route = Common::get_route(); //需权限 if (array_key_exists($route, $auths)) { $user = isset($_SESSION[$this->login_in_session_name]) ? $_SESSION[$this->login_in_session_name] : NULL; $user_role = isset($user['role']) ? $user['role'] : NULL; //有权限 if (strstr($auths[$route], "|{$user_role}|")) { return TRUE; } else { //有登录权限 if (strstr($auths[$route], "|1|")) { //已登录 if (!empty($user)) { return TRUE; } else { $this->error->output('NOTLOGIN_ERROR', array('script' => 'swal({title: "请登录后再进行操作",type: "warning",showCancelButton: true,confirmButtonColor: "#DD6B55",confirmButtonText: "注册/登录",closeOnConfirm: false},function () {showsign();});')); } } //没有权限 $this->error->output('NOAUTH_ERROR', array('script' => 'window.location.href ="' . base_url() . '";')); } } else { return TRUE; } }
/** * Add all the routes in the router in parameter * @param $router Router */ public function generateRoute(Router $router) { foreach ($this->classes as $class) { $classMethods = get_class_methods($this->namespace . $class . 'Controller'); $rc = new \ReflectionClass($this->namespace . $class . 'Controller'); $parent = $rc->getParentClass(); $parent = get_class_methods($parent->name); $className = $this->namespace . $class . 'Controller'; foreach ($classMethods as $methodName) { if (in_array($methodName, $parent) || $methodName == 'index') { continue; } else { foreach (Router::getSupportedHttpMethods() as $httpMethod) { if (strstr($methodName, $httpMethod)) { continue 2; } if (in_array($methodName . $httpMethod, $classMethods)) { $router->add('/' . strtolower($class) . '/' . $methodName, new $className(), $methodName . $httpMethod, $httpMethod); unset($classMethods[$methodName . $httpMethod]); } } $router->add('/' . strtolower($class) . '/' . $methodName, new $className(), $methodName); } } $router->add('/' . strtolower($class), new $className(), 'index'); } }
/** * Prevent caching on dynamic pages. * * @access public * @return void */ public function init() { if (false === ($wc_page_uris = get_transient('woocommerce_cache_excluded_uris'))) { if (woocommerce_get_page_id('cart') < 1 || woocommerce_get_page_id('checkout') < 1 || woocommerce_get_page_id('myaccount') < 1) { return; } $wc_page_uris = array(); $cart_page = get_post(woocommerce_get_page_id('cart')); $checkout_page = get_post(woocommerce_get_page_id('checkout')); $account_page = get_post(woocommerce_get_page_id('myaccount')); $wc_page_uris[] = '/' . $cart_page->post_name; $wc_page_uris[] = '/' . $checkout_page->post_name; $wc_page_uris[] = '/' . $account_page->post_name; $wc_page_uris[] = 'p=' . $cart_page->ID; $wc_page_uris[] = 'p=' . $checkout_page->ID; $wc_page_uris[] = 'p=' . $account_page->ID; set_transient('woocommerce_cache_excluded_uris', $wc_page_uris); } if (is_array($wc_page_uris)) { foreach ($wc_page_uris as $uri) { if (strstr($_SERVER['REQUEST_URI'], $uri)) { $this->nocache(); break; } } } }
/** * Merge a table name and a column name if possible * * @param $table * @param $column * @return mixed */ function table_column($table, $column) { if (is_string($column) === false || strstr($column, '.') !== false) { return $column; } return \DB::raw('`' . $table . '`' . '.' . ($column != '*' ? '`' . $column . '`' : $column)); }
/** * Sets GET and POST into local properties */ public function __construct(&$conf = false) { // parse vars from URI if (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']) { $qrystr = str_replace('r=', '', filter_var($_SERVER['QUERY_STRING'])); if (!strstr($qrystr, 'exe/')) { $this->parseUri($qrystr); } else { $key = explode('/', $qrystr); if (isset($key[1])) { $this->_exe = $key[1]; } } unset($qrystr); } // vars from GET if ($_GET) { while (list($key, $value) = each($_GET)) { if ($key != 'r') { $this->{$key} = $value; } } } // vars from POST if ($_POST) { while (list($key, $value) = each($_POST)) { $this->{$key} = $value; } } // vars from FILES if ($_FILES) { $this->setFiles($conf); } }
/** * Generates a 'checkbox' element. * * @access public * * @param string|array $name If a string, the element name. If an * array, all other parameters are ignored, and the array elements * are extracted in place of added parameters. * @param mixed $value The element value. * @param array $attribs Attributes for the element tag. * @return string The element XHTML. */ public function formCheckbox($name, $value = null, $attribs = null, array $checkedOptions = null) { $info = $this->_getInfo($name, $value, $attribs); extract($info); // name, id, value, attribs, options, listsep, disable $checked = false; if (isset($attribs['checked']) && $attribs['checked']) { $checked = true; unset($attribs['checked']); } elseif (isset($attribs['checked'])) { $checked = false; unset($attribs['checked']); } $checkedOptions = self::determineCheckboxInfo($value, $checked, $checkedOptions); // is the element disabled? $disabled = ''; if ($disable) { $disabled = ' disabled="disabled"'; } // build the element $xhtml = ''; if (!$disable && !strstr($name, '[]') && (empty($attribs['disableHidden']) || !$attribs['disableHidden'])) { $xhtml = $this->_hidden($name, $checkedOptions['uncheckedValue']); } if (array_key_exists('disableHidden', $attribs)) { unset($attribs['disableHidden']); } $xhtml .= '<input type="checkbox"' . ' name="' . $this->view->escape($name) . '"' . ' id="' . $this->view->escape($id) . '"' . ' value="' . $this->view->escape($checkedOptions['checkedValue']) . '"' . $checkedOptions['checkedString'] . $disabled . $this->_htmlAttribs($attribs) . $this->getClosingBracket(); return $xhtml; }
/** * Assumes that value is not *, and creates an array of valid numbers that * the string represents. Returns an array. */ function expand_ranges($str) { if (strstr($str, ",")) { $arParts = explode(',', $str); foreach ($arParts as $part) { if (strstr($part, '-')) { $arRange = explode('-', $part); for ($i = $arRange[0]; $i <= $arRange[1]; $i++) { $ret[] = $i; } } else { $ret[] = $part; } } } elseif (strstr($str, '-')) { $arRange = explode('-', $str); for ($i = $arRange[0]; $i <= $arRange[1]; $i++) { $ret[] = $i; } } else { $ret[] = $str; } $ret = array_unique($ret); sort($ret); return $ret; }
public function beforeFilter() { $this->controller = $this->_registry->getController(); if (!strstr($this->request->contentType(), 'multipart/form-data')) { $this->request->data = $this->request->input('json_decode', true); } }
/** * attempt to build up a request from what was passed to the server */ public static function from_request($http_method = NULL, $http_url = NULL, $parameters = NULL) { $scheme = !isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != "on" ? 'http' : 'https'; @$http_url or $http_url = $scheme . '://' . $_SERVER['HTTP_HOST'] . ':' . $_SERVER['SERVER_PORT'] . $_SERVER['REQUEST_URI']; @$http_method or $http_method = $_SERVER['REQUEST_METHOD']; // We weren't handed any parameters, so let's find the ones relevant to // this request. // If you run XML-RPC or similar you should use this to provide your own // parsed parameter-list if (!$parameters) { // Find request headers $request_headers = OAuthUtil::get_headers(); // Parse the query-string to find GET parameters $parameters = OAuthUtil::parse_parameters($_SERVER['QUERY_STRING']); // It's a POST request of the proper content-type, so parse POST // parameters and add those overriding any duplicates from GET if ($http_method == "POST" && @strstr($request_headers["Content-Type"], "application/x-www-form-urlencoded")) { $post_data = OAuthUtil::parse_parameters(file_get_contents(self::$POST_INPUT)); $parameters = array_merge($parameters, $post_data); } // We have a Authorization-header with OAuth data. Parse the header // and add those overriding any duplicates from GET or POST if (@substr($request_headers['Authorization'], 0, 6) == "OAuth ") { $header_parameters = OAuthUtil::split_header($request_headers['Authorization']); $parameters = array_merge($parameters, $header_parameters); } } return new OAuthRequest($http_method, $http_url, $parameters); }
/** * Forge a new object based on a request. * @param RequestInterface $request * @return Response */ public static function forge(RequestInterface $request) { $headerSize = $request->getInfo(CURLINFO_HEADER_SIZE); $response = $request->getRawResponse(); $content = strlen($response) === $headerSize ? '' : substr($response, $headerSize); $rawHeaders = rtrim(substr($response, 0, $headerSize)); $headers = array(); foreach (preg_split('/(\\r?\\n)/', $rawHeaders) as $header) { if ($header) { $headers[] = $header; } else { $headers = array(); } } $headerBag = array(); $info = $request->getInfo(); $status = explode(' ', $headers[0]); $status = explode('/', $status[0]); unset($headers[0]); foreach ($headers as $header) { list($key, $value) = explode(': ', $header); $headerBag[trim($key)] = trim($value); } $response = new static($content, $info['http_code'], $headerBag); $response->setProtocolVersion($status[1]); $response->setCharset(substr(strstr($response->headers->get('Content-Type'), '='), 1)); return $response; }
function confirm_success($ALERT) { global $PAGE, $this_page, $THEUSER; $this_page = 'alertconfirmsucceeded'; $criteria = $ALERT->criteria_pretty(true); $email = $ALERT->email(); $extra = null; $PAGE->page_start(); $PAGE->stripe_start(); ?> <p>Your alert has been confirmed.</p> <p>You will now receive email alerts for the following criteria:</p> <ul><?php echo $criteria; ?> </ul> <p>This is normally the day after, but could conceivably be later due to issues at our or parliament.uk's end.</p> <?php $extra = alert_confirmation_advert(array('email' => $email, 'pid' => strstr($ALERT->criteria(), 'speaker:'))); if ($extra) { $extra = "advert={$extra}"; } $PAGE->stripe_end(); $PAGE->page_end($extra); }
static function getParams(&$params) { $params->def('url', ''); $params->def('scrolling', 'auto'); $params->def('height', '200'); $params->def('height_auto', '0'); $params->def('width', '100%'); $params->def('add', '1'); $params->def('name', 'wrapper'); $url = $params->get('url'); if ($params->get('add')) { // adds 'http://' if none is set if (substr($url, 0, 1) == '/') { // relative url in component. use server http_host. $url = 'http://' . $_SERVER['HTTP_HOST'] . $url; } elseif (!strstr($url, 'http') && !strstr($url, 'https')) { $url = 'http://' . $url; } else { $url = $url; } } // auto height control if ($params->def('height_auto')) { $load = 'onload="iFrameHeight()"'; } else { $load = ''; } $params->set('load', $load); $params->set('url', $url); return $params; }
public function testReports() { $reports = FannieAPI::listModules('FannieReportPage', true); $config = FannieConfig::factory(); $logger = new FannieLogger(); $op_db = $config->get('OP_DB'); $dbc = FannieDB::get($op_db); $dbc->throwOnFailure(true); foreach ($reports as $report_class) { $obj = new $report_class(); $obj->setConfig($config); $obj->setLogger($logger); $dbc->selectDB($op_db); $obj->setConnection($dbc); $pre = $obj->preprocess(); $this->assertInternalType('boolean', $pre); $auth = $obj->checkAuth(); $this->assertInternalType('boolean', $pre); $html_form = $obj->form_content(); $this->assertNotEquals(0, strlen($html_form), 'Report form is empty for ' . $report_class); $form = new \COREPOS\common\mvc\ValueContainer(); foreach ($obj->requiredFields() as $field) { if (strstr($field, 'date')) { $form->{$field} = date('Y-m-d'); } else { $form->{$field} = 1; } } $obj->setForm($form); $preamble = $obj->report_description_content(); $this->assertInternalType('array', $preamble, 'Report did not return description content ' . $report_class); $results = $obj->fetch_report_data(); $this->assertInternalType('array', $results, 'Report did not return results ' . $report_class); } }
function getRemoteInfo() { $proxy = ""; $IP = ""; if (isset($_SERVER)) { if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) { $IP = $_SERVER["HTTP_X_FORWARDED_FOR"]; $proxy = $_SERVER["REMOTE_ADDR"]; } elseif (isset($_SERVER["HTTP_CLIENT_IP"])) { $IP = $_SERVER["HTTP_CLIENT_IP"]; } else { $IP = $_SERVER["REMOTE_ADDR"]; } } else { if (getenv('HTTP_X_FORWARDED_FOR')) { $IP = getenv('HTTP_X_FORWARDED_FOR'); $proxy = getenv('REMOTE_ADDR'); } elseif (getenv('HTTP_CLIENT_IP')) { $IP = getenv('HTTP_CLIENT_IP'); } else { $IP = getenv('REMOTE_ADDR'); } } if (strstr($IP, ',')) { $ips = explode(',', $IP); $IP = $ips[0]; } $RemoteInfo[0] = $IP; $RemoteInfo[1] = @GetHostByAddr($IP); $RemoteInfo[2] = $proxy; return $RemoteInfo; }
protected function _login($user) { $this->session->set_userdata((array) $user); //update login time $this->db->where('id', $user->ID); $this->db->update('user', array('last_login' => time())); // send them back to where they came from, either the referer if they // have one, or the flashdata $referer = $this->input->server('HTTP_REFERER'); // Only allow the referrer to be on this site - this prevents a loop // to Twitter after login, and other possible phishing attacks $base = $this->config->item('base_url'); if (substr($referer, 0, strlen($base)) != $base) { $referer = $base; } $to = $this->session->flashdata('url_after_login') ? $this->session->flashdata('url_after_login') : $referer; // List different routes we don't want to reroute to $bad_routes = $this->non_forward_urls; foreach ($bad_routes as $route) { if (strstr($to, $route)) { redirect('user/main'); } } // our $to is good, so redirect redirect($to); }
function theme_user($data) { include_once "theme.inc.php"; $content = ''; foreach ($data as $r) { if (strstr($r['source'], '<')) { $source = str_replace("<a ", '<a class="left microblog-item-position"', $r['source']); } else { $source = '<a class="left microblog-item-position">' . $r['source'] . '</a>'; } $content .= '<div class="item" id="' . $r['tweet_id'] . '"> <div class="item-delete"> <a class="right"></a> </div> <div class="left item-pic"> <img alt="" width="50" height="50" src="' . $r['profile_image_url'] . '"> </div> <div class="left item-content"> <div class="item-blog"> <a class="item-blog-name" target="_blank" href="' . BASE_URL . 'profile/' . $r['post_screenname'] . '">' . $r['post_screenname'] . '</a>:' . $r['content'] . ' </div> <div class="item-other"> <span class="left item-time">' . time_tran($r['post_datetime']) . '</span>' . $source . ' <a class="right item-control last delete"> 删除</a> </div> </div> <div class="clear"> </div> </div>'; } echo $content; }
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 get_network() { $lines = file('/etc/network/interfaces'); foreach ($lines as $line_num => $line) { $address = strstr($line, 'address'); if ($address) { $address_arr = explode(" ", $address); if ($address_arr['1'] != 'ether') { $ipdata['ip_adress'] = $address_arr['1']; } } //mask $Mask = strstr($line, 'netmask'); if ($Mask) { $Mask_arr = explode(" ", $Mask); $ipdata['mask'] = $Mask_arr['1']; } //gateway $gateway = strstr($line, 'gateway'); if ($gateway) { $gateway_arr = explode(" ", $gateway); $ipdata['gateway_id'] = $gateway_arr['1']; //echo $gateway_id; } $macaddr = strstr($line, 'hwaddress'); if ($macaddr) { $mac_arr = explode(" ", $macaddr); $ipdata['mac'] = end($mac_arr); } } return $ipdata; }
/** * Checks a table name to see if it is a metadata table. A metadata table * always ends in '__metadata'. * @param string $tablename The name of the table to check. * @returns boolean */ function isMetadataTable($tablename = null) { if (!isset($tablename)) { $tablename = $this->tablename; } return strstr($tablename, '__metadata') == '__metadata'; }
/** * dijit.form.CheckBox * * @param int $id * @param string $content * @param array $params Parameters to use for dijit creation * @param array $attribs HTML attributes * @param array $checkedOptions Should contain either two items, or the keys checkedValue and uncheckedValue * @return string */ public function checkBox($id, $value = null, array $params = array(), array $attribs = array(), array $checkedOptions = null) { // Prepare the checkbox options require_once 'Zend/View/Helper/FormCheckbox.php'; $checked = false; if (isset($attribs['checked']) && $attribs['checked']) { $checked = true; } elseif (isset($attribs['checked'])) { $checked = false; } $checkboxInfo = Zend_View_Helper_FormCheckbox::determineCheckboxInfo($value, $checked, $checkedOptions); $attribs['checked'] = $checkboxInfo['checked']; if (!array_key_exists('id', $attribs)) { $attribs['id'] = $id; } $attribs = $this->_prepareDijit($attribs, $params, 'element'); // strip options so they don't show up in markup if (array_key_exists('options', $attribs)) { unset($attribs['options']); } // and now we create it: $html = ''; if (!strstr($id, '[]')) { // hidden element for unchecked value $html .= $this->_renderHiddenElement($id, $checkboxInfo['uncheckedValue']); } // and final element $html .= $this->_createFormElement($id, $checkboxInfo['checkedValue'], $params, $attribs); return $html; }
/** * Generate SQL from Rule * @param string $rule Rule to generate SQL for * @return string */ function GenSQL($rule) { $tmp = explode(" ", $rule); $tables = array(); foreach ($tmp as $opt) { if (strstr($opt, '%') && strstr($opt, '.')) { $tmpp = explode(".", $opt, 2); $tmpp[0] = str_replace("%", "", $tmpp[0]); $tables[] = mres(str_replace("(", "", $tmpp[0])); $rule = str_replace($opt, $tmpp[0] . '.' . $tmpp[1], $rule); } } $tables = array_unique($tables); $x = sizeof($tables); $i = 0; $join = ""; while ($i < $x) { if (isset($tables[$i + 1])) { $join .= $tables[$i] . ".device_id = " . $tables[$i + 1] . ".device_id && "; } $i++; } $sql = "SELECT * FROM " . implode(",", $tables) . " WHERE (" . $join . "" . str_replace("(", "", $tables[0]) . ".device_id = ?) && (" . str_replace(array("%", "@", "!~", "~"), array("", "%", "NOT LIKE", "LIKE"), $rule) . ")"; return $sql; }
public function getData(array $inputs) { $this->db->select('sales_payments.payment_type, count(*) AS count, SUM(payment_amount) AS payment_amount', false); $this->db->from('sales_payments'); $this->db->join('sales', 'sales.sale_id=sales_payments.sale_id'); $this->db->where('date(sale_time) BETWEEN "' . $inputs['start_date'] . '" AND "' . $inputs['end_date'] . '"'); if ($inputs['sale_type'] == 'sales') { $this->db->where('payment_amount > 0'); } elseif ($inputs['sale_type'] == 'returns') { $this->db->where('payment_amount < 0'); } $this->db->group_by("payment_type"); $payments = $this->db->get()->result_array(); // consider Gift Card as only one type of payment and do not show "Gift Card: 1, Gift Card: 2, etc." in the total $gift_card_count = 0; $gift_card_amount = 0; foreach ($payments as $key => $payment) { if (strstr($payment['payment_type'], $this->lang->line('sales_giftcard')) != FALSE) { $gift_card_count += $payment['count']; $gift_card_amount += $payment['payment_amount']; unset($payments[$key]); } } if ($gift_card_count > 0 && $gift_card_amount > 0) { $payments[] = array('payment_type' => $this->lang->line('sales_giftcard'), 'count' => $gift_card_count, 'payment_amount' => $gift_card_amount); } return $payments; }
function zen_check_quantity($which) { global $db; $which_query = $db->Execute("select sesskey, value\r\n from " . TABLE_SESSIONS . "\r\n where sesskey= '" . $which . "'"); $who_query = $db->Execute("select session_id, time_entry, time_last_click, host_address, user_agent\r\n from " . TABLE_WHOS_ONLINE . "\r\n where session_id='" . $which . "'"); // longer than 2 minutes light color $xx_mins_ago_long = time() - WHOIS_TIMER_INACTIVE; switch (true) { case $which_query->RecordCount() == 0: if ($who_query->fields['time_last_click'] < $xx_mins_ago_long) { return zen_image(DIR_WS_IMAGES . 'icon_status_red_light.gif'); } else { return zen_image(DIR_WS_IMAGES . 'icon_status_red.gif'); } break; case strstr($which_query->fields['value'], '"contents";a:0:'): if ($who_query->fields['time_last_click'] < $xx_mins_ago_long) { return zen_image(DIR_WS_IMAGES . 'icon_status_red_light.gif'); } else { return zen_image(DIR_WS_IMAGES . 'icon_status_red.gif'); } break; case !strstr($which_query->fields['value'], '"contents";a:0:'): if ($who_query->fields['time_last_click'] < $xx_mins_ago_long) { return zen_image(DIR_WS_IMAGES . 'icon_status_yellow.gif'); } else { return zen_image(DIR_WS_IMAGES . 'icon_status_green.gif'); } break; } }
function ewic_popup_content() { if (strstr($_SERVER['REQUEST_URI'], 'wp-admin/post-new.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/post.php')) { if (get_post_type(get_the_ID()) != 'easyimageslider') { // START GENERATE POPUP CONTENT ?> <div id="ewicmodal" style="display:none;"> <div id="tinyform" style="width: 550px;"> <form method="post"> <div class="ewic_input" id="ewictinymce_select_slider_div"> <label class="label_option" for="ewictinymce_select_slider">Slider</label> <select class="ewic_select" name="ewictinymce_select_slider" id="ewictinymce_select_slider"> <option id="selectslider" type="text" value="select">- Select Slider -</option> </select> <div class="clearfix"></div> </div> <div class="ewic_button"> <input type="button" value="Insert Shortcode" name="ewic_insert_scrt" id="ewic_insert_scrt" class="button-secondary" /> <div class="clearfix"></div> </div> </form> </div> </div> <?php } } //END }
function run($b, $debug = false) { $browser = Config::$BROWSERS[$b]; $host = $debug ? 'localhost' : $browser[0]; $path = $debug ? 'C:\\Documents and Settings\\shenlixia01\\Local Settings\\Application Data\\Google\\Chrome\\Application\\chrome.exe' : $browser[1]; $browserSet = array_key_exists('browserSet', $_GET) ? "^&browserSet=" . $_GET['browserSet'] : ''; $url = "http://" . $_SERVER['SERVER_ADDR'] . ($debug ? "" : ":8089") . substr($_SERVER['PHP_SELF'], 0, -11) . "/list.php?batchrun=true^&browser={$b}" . $browserSet; if (!array_key_exists("ci", $_GET)) { $url .= "^&mail=true"; } if (array_key_exists("filter", $_GET)) { $filterR = array_key_exists($b, $_GET) ? $_GET[$b] : $_GET['filter']; if (strstr($b, 'main') || strstr($b, 'supp')) { $url .= "^&filterRun={$filterR}^&filter={$_GET['filter']}"; } else { $url .= "^&filterRun={$_GET['filter']}^&filter={$_GET['filter']}"; } } // if( $b!='ie6') { if (array_key_exists('cov', $_GET)) { $url .= "^&cov={$_GET['cov']}"; } // } // else // $url .= "^&cov=true"; print $url; if ($b == 'baidu') { $url = "--'{$url}'"; } require_once 'lib/Staf.php'; $result = Staf::process_start($path, $url, $host); return $result; }
/** * * add filter for Site option defaults * */ public static function default_site_options() { //global add_site_option('backwpup_version', '0.0.0'); //job default add_site_option('backwpup_jobs', array()); //general add_site_option('backwpup_cfg_showadminbar', 1); add_site_option('backwpup_cfg_showfoldersize', 0); add_site_option('backwpup_cfg_protectfolders', 1); //job $max_execution_time = 0; if (strstr(PHP_SAPI, 'cgi')) { $max_execution_time = (int) ini_get('max_execution_time'); } add_site_option('backwpup_cfg_jobmaxexecutiontime', $max_execution_time); add_site_option('backwpup_cfg_jobziparchivemethod', ''); add_site_option('backwpup_cfg_jobstepretry', 3); add_site_option('backwpup_cfg_jobrunauthkey', substr(md5(BackWPup::get_plugin_data('hash')), 11, 8)); add_site_option('backwpup_cfg_loglevel', 'normal_translated'); add_site_option('backwpup_cfg_jobwaittimems', 0); add_site_option('backwpup_cfg_jobdooutput', 0); //Logs add_site_option('backwpup_cfg_maxlogs', 30); add_site_option('backwpup_cfg_gzlogs', 0); $upload_dir = wp_upload_dir(); $logs_dir = trailingslashit(str_replace('\\', '/', $upload_dir['basedir'])) . 'backwpup-' . BackWPup::get_plugin_data('hash') . '-logs/'; $content_path = trailingslashit(str_replace('\\', '/', WP_CONTENT_DIR)); $logs_dir = str_replace($content_path, '', $logs_dir); add_site_option('backwpup_cfg_logfolder', $logs_dir); //Network Auth add_site_option('backwpup_cfg_httpauthuser', ''); add_site_option('backwpup_cfg_httpauthpassword', ''); }
public function generate_menu($pos = 0, $parent_id = null) { $this->processed[$pos] = true; if ($this->hasChild($this->menu[$pos])) { if (!isset($html)) { $html = null; } $mother_node = $this->menu[$pos]; $children = $this->generate_menu($pos + 1, $mother_node['Menu']['id']); $html .= '<li class="treeview">' . $this->Html->link(__d('dkmadmin', $mother_node['Menu']['name']), $mother_node['Menu']['link']) . '<ul class="treeview-menu">' . $children; } else { if (!isset($html)) { $html = null; } if (strstr($this->menu[$pos]['Menu']['link'], $this->urlActive)) { $html .= '<li class="active">' . $this->Html->link(__d('dkmadmin', $this->menu[$pos]['Menu']['name']), $this->menu[$pos]['Menu']['link']) . '</li>'; } else { $html .= '<li>' . $this->Html->link(__d('dkmadmin', $this->menu[$pos]['Menu']['name']), $this->menu[$pos]['Menu']['link']) . '</li>'; } if (isset($this->menu[$pos + 1])) { if ($this->menu[$pos + 1]['Menu']['parent_id'] != $parent_id) { $html .= '</ul></li>'; } else { $html .= '</li>'; } } else { $html .= '</ul></li>'; } } if (isset($this->menu[$pos + 1]) && !isset($this->processed[$pos + 1])) { $html .= $this->generate_menu($pos + 1, $this->menu[$pos + 1]['Menu']['parent_id']); } return $html; }
function shopObject() { parent::modelFactory(); if (!$this->typeName) { $this->typeName = substr(strstr(get_class($this), '_'), 1); } }
public function testMovePage() { $newPage = "mypage99"; $displayName = "Mypage99"; $this->open($this->getUrl() . '/index.php?title=Main_Page&action=edit'); $this->type("searchInput", $newPage); $this->click("searchGoButton"); $this->waitForPageToLoad("30000"); $this->click("link=" . $displayName); $this->waitForPageToLoad("60000"); $this->type("wpTextbox1", $newPage . " text"); $this->click("wpSave"); $this->waitForPageToLoad("60000"); // Verify link 'Move' available $this->assertTrue($this->isElementPresent("link=Move")); $this->click("link=Move"); $this->waitForPageToLoad("30000"); // Verify correct page name displayed under 'Move Page' field $this->assertEquals($displayName, $this->getText("//table[@id='mw-movepage-table']/tbody/tr[1]/td[2]/strong/a")); $movePageName = $this->getText("//table[@id='mw-movepage-table']/tbody/tr[1]/td[2]/strong/a"); // Verify 'To new title' field has current page name as the default name $newTitle = $this->getValue("wpNewTitle"); $correct = strstr($movePageName, $newTitle); $this->assertEquals($correct, true); $this->type("wpNewTitle", $displayName); $this->click("wpMove"); $this->waitForPageToLoad("30000"); // Verify warning message for the same source and destination titles $this->assertEquals("Source and destination titles are the same; cannot move a page over itself.", $this->getText("//div[@id='bodyContent']/p[4]/strong")); // Verify warning message for the blank title $this->type("wpNewTitle", ""); $this->click("wpMove"); $this->waitForPageToLoad("30000"); // Verify warning message for the blank title $this->assertEquals("The requested page title was invalid, empty, or an incorrectly linked inter-language or inter-wiki title. It may contain one or more characters which cannot be used in titles.", $this->getText("//div[@id='bodyContent']/p[4]/strong")); // Verify warning messages for the invalid titles $this->type("wpNewTitle", "# < > [ ] | { }"); $this->click("wpMove"); $this->waitForPageToLoad("30000"); $this->assertEquals("The requested page title was invalid, empty, or an incorrectly linked inter-language or inter-wiki title. It may contain one or more characters which cannot be used in titles.", $this->getText("//div[@id='bodyContent']/p[4]/strong")); $this->type("wpNewTitle", $displayName . "move"); $this->click("wpMove"); $this->waitForPageToLoad("30000"); // Verify move success message displayed correctly $this->assertEquals("\"" . $displayName . "\" has been moved to \"" . $displayName . "move" . "\"", $this->getText("//div[@id='bodyContent']/p[1]/b")); $this->type("searchInput", $newPage . "move"); $this->click("searchGoButton"); $this->waitForPageToLoad("30000"); // Verify search using new page name $this->assertEquals($displayName . "move", $this->getText("firstHeading")); $this->type("searchInput", $newPage); $this->click("searchGoButton"); $this->waitForPageToLoad("30000"); // Verify search using old page name $redirectPageName = $this->getText("//*[@id='contentSub']"); $this->assertEquals("(Redirected from " . $displayName . ")", $redirectPageName); // newpage delete $this->deletePage($newPage . "move"); $this->deletePage($newPage); }
function track_error_info($error_text) { if (strstr($error_text, "Could not run query")) { track_error($error_text); exit; } if (strstr($error_text, "Download data not found")) { track_error($error_text); exit; } if (strstr($error_text, "Error parameters list")) { track_error($error_text); exit; } if (strstr($error_text, "Could not connect")) { track_error($error_text); exit; } if (strstr($error_text, "Could not select db")) { track_error($error_text); exit; } if (strstr($error_text, "Could not decrement downloads")) { track_error($error_text); exit; } if (strstr($error_text, "Could not run option value query")) { track_error($error_text); exit; } if (strstr($error_text, "Could not get option value 'max_downloads'")) { track_error($error_text); exit; } }