Exemplo n.º 1
5
function sshiconn($cmd, $pass, $ip, $sshp = 22)
{
    $ip = $_REQUEST['ip'];
    $pass = $_REQUEST['pass'];
    $sshp = $_REQUEST['sshp'];
    if (!isset($_REQUEST['sshp'])) {
        $sshp = '22';
    }
    $connection = ssh2_connect($ip, $sshp);
    if (!$connection) {
        throw new Exception("fail: unable to establish connection\nPlease IP or if server is on and connected");
    }
    $pass_success = ssh2_auth_password($connection, 'root', $pass);
    if (!$pass_success) {
        throw new Exception("fail: unable to establish connection\nPlease Check your password");
    }
    $stream = ssh2_exec($connection, $cmd);
    $errorStream = ssh2_fetch_stream($stream, SSH2_STREAM_STDERR);
    stream_set_blocking($errorStream, true);
    stream_set_blocking($stream, true);
    print_r($cmd);
    $output = stream_get_contents($stream);
    fclose($stream);
    fclose($errorStream);
    ssh2_exec($connection, 'exit');
    unset($connection);
    return $output;
}
Exemplo n.º 2
3
Arquivo: lib.php Projeto: winiceo/job
function dump($var, $echo = true, $label = null, $strict = true)
{
    $label = $label === null ? '' : rtrim($label) . ' ';
    if (!$strict) {
        if (ini_get('html_errors')) {
            $output = print_r($var, true);
            $output = "<pre>" . $label . htmlspecialchars($output, ENT_QUOTES) . "</pre>";
        } else {
            $output = $label . " : " . print_r($var, true);
        }
    } else {
        ob_start();
        var_dump($var);
        $output = ob_get_clean();
        if (!extension_loaded('xdebug')) {
            $output = preg_replace("/\\]\\=\\>\n(\\s+)/m", "] => ", $output);
            $output = '<pre>' . $label . htmlspecialchars($output, ENT_QUOTES, "GB2312") . '</pre>';
        }
    }
    if ($echo) {
        echo $output;
        return null;
    } else {
        return $output;
    }
}
 /**
  * convert objects with user data to ldap data array
  * 
  * @param Tinebase_Model_FullUser  $_user
  * @param array                    $_ldapData  the data to be written to ldap
  */
 protected function _group2ldap(Tinebase_Model_Group $_group, array &$_ldapData)
 {
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' ENCRYPT ' . print_r($_ldapData, true));
     }
     if (isset($_ldapData['objectclass'])) {
         $_ldapData['objectclass'] = array_unique(array_merge($_ldapData['objectclass'], $this->_requiredObjectClass));
     }
     if (isset($_ldapData['gidnumber'])) {
         $gidNumber = $_ldapData['gidnumber'];
     } else {
         $gidNumber = $this->_getGidNumber($_group->getId());
     }
     // when we try to add a group, $_group has no id which leads to Tinebase_Exception_InvalidArgument in $this->_getGroupMetaData
     try {
         $metaData = $this->_getGroupMetaData($_group);
     } catch (Tinebase_Exception_InvalidArgument $teia) {
         $metaData = array();
     }
     if (!isset($metaData['sambasid'])) {
         $_ldapData['sambasid'] = $this->_options[Tinebase_Group_Ldap::PLUGIN_SAMBA]['sid'] . '-' . (2 * $gidNumber + 1001);
         $_ldapData['sambagrouptype'] = 2;
     }
     $_ldapData['displayname'] = $_group->name;
 }
Exemplo n.º 4
1
 public function facebook()
 {
     $user = Socialize::with('facebook')->user();
     // Do your stuff with user data.
     print_r($user);
     die;
 }
Exemplo n.º 5
1
function search_ac_init(&$a)
{
    if (!local_channel()) {
        killme();
    }
    $start = x($_REQUEST, 'start') ? $_REQUEST['start'] : 0;
    $count = x($_REQUEST, 'count') ? $_REQUEST['count'] : 100;
    $search = x($_REQUEST, 'search') ? $_REQUEST['search'] : "";
    if (x($_REQUEST, 'query') && strlen($_REQUEST['query'])) {
        $search = $_REQUEST['query'];
    }
    // Priority to people searches
    if ($search) {
        $people_sql_extra = protect_sprintf(" AND `xchan_name` LIKE '%" . dbesc($search) . "%' ");
        $tag_sql_extra = protect_sprintf(" AND term LIKE '%" . dbesc($search) . "%' ");
    }
    $r = q("SELECT `abook_id`, `xchan_name`, `xchan_photo_s`, `xchan_url`, `xchan_addr` FROM `abook` left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d \n\t\t{$people_sql_extra}\n\t\tORDER BY `xchan_name` ASC ", intval(local_channel()));
    $results = array();
    if ($r) {
        foreach ($r as $g) {
            $results[] = array("photo" => $g['xchan_photo_s'], "name" => '@' . $g['xchan_name'], "id" => $g['abook_id'], "link" => $g['xchan_url'], "label" => '', "nick" => '');
        }
    }
    $r = q("select distinct term, tid, url from term where type in ( %d, %d ) {$tag_sql_extra} group by term order by term asc", intval(TERM_HASHTAG), intval(TERM_COMMUNITYTAG));
    if (count($r)) {
        foreach ($r as $g) {
            $results[] = array("photo" => $a->get_baseurl() . '/images/hashtag.png', "name" => '#' . $g['term'], "id" => $g['tid'], "link" => $g['url'], "label" => '', "nick" => '');
        }
    }
    header("content-type: application/json");
    $o = array('start' => $start, 'count' => $count, 'items' => $results);
    echo json_encode($o);
    logger('search_ac: ' . print_r($x, true));
    killme();
}
Exemplo n.º 6
1
 /**
  * @param string $url
  * @param string $method
  * @param string $body
  *
  * @return FhirResponse
  */
 public function request($url, $method = 'GET', $body = null)
 {
     $server_name = null;
     foreach ($this->servers as $name => $server) {
         if (substr($url, 0, strlen($server['base_url']))) {
             $server_name = $name;
             break;
         }
     }
     $this->applyServerConfig($server_name ? $this->servers[$server_name] : array());
     $this->http_client->setUri($url);
     $this->http_client->setMethod($method);
     if ($body) {
         $this->http_client->setRawData($body, 'application/xml+fhir; charset=utf-8');
     }
     $response = $this->http_client->request();
     $this->http_client->resetParameters();
     if ($body = $response->getBody()) {
         $use_errors = libxml_use_internal_errors(true);
         $value = Yii::app()->fhirMarshal->parseXml($body);
         $errors = libxml_get_errors();
         libxml_use_internal_errors($use_errors);
         if ($errors) {
             throw new Exception("Error parsing XML response from {$method} to {$url}: " . print_r($errors, true));
         }
     } else {
         $value = null;
     }
     return new FhirResponse($response->getStatus(), $value);
 }
Exemplo n.º 7
1
 function get_all_taxa()
 {
     require_library('connectors/INBioAPI');
     $func = new INBioAPI();
     $paths = $func->extract_archive_file($this->dwca_file, "meta.xml");
     $archive_path = $paths['archive_path'];
     $temp_dir = $paths['temp_dir'];
     $harvester = new ContentArchiveReader(NULL, $archive_path);
     $tables = $harvester->tables;
     if (!($this->fields["taxa"] = $tables["http://rs.tdwg.org/dwc/terms/taxon"][0]->fields)) {
         debug("Invalid archive file. Program will terminate.");
         return false;
     }
     self::build_taxa_rank_array($harvester->process_row_type('http://rs.tdwg.org/dwc/terms/Taxon'));
     self::create_instances_from_taxon_object($harvester->process_row_type('http://rs.tdwg.org/dwc/terms/Taxon'));
     self::get_objects($harvester->process_row_type('http://eol.org/schema/media/Document'));
     self::get_references($harvester->process_row_type('http://rs.gbif.org/terms/1.0/Reference'));
     self::get_agents($harvester->process_row_type('http://eol.org/schema/agent/Agent'));
     self::get_vernaculars($harvester->process_row_type('http://rs.gbif.org/terms/1.0/VernacularName'));
     $this->archive_builder->finalize(TRUE);
     // remove temp dir
     recursive_rmdir($temp_dir);
     echo "\n temporary directory removed: " . $temp_dir;
     print_r($this->debug);
 }
Exemplo n.º 8
1
 /**
  * @param $data
  */
 public static function print_r($data)
 {
     echo "<pre>";
     print_r($data);
     echo "</pre>";
     return;
 }
Exemplo n.º 9
1
 public static function createSymbolicLink($rootDir = null)
 {
     IS_MULTI_MODULES || exit('please set is_multi_modules => true');
     $deper = Request::isCli() ? PHP_EOL : '<br />';
     echo "{$deper}**************************create link start!*********************{$deper}";
     echo '|' . str_pad('', 64, ' ', STR_PAD_BOTH) . '|';
     is_null($rootDir) && ($rootDir = ROOT_PATH . DIRECTORY_SEPARATOR . 'web');
     is_dir($rootDir) || mkdir($rootDir, true, 0700);
     //modules_static_path_name
     // 递归遍历目录
     $dirIterator = new \DirectoryIterator(APP_MODULES_PATH);
     foreach ($dirIterator as $file) {
         if (!$file->isDot() && $file->isDir()) {
             $resourceDir = $file->getPathName() . DIRECTORY_SEPARATOR . Config::get('modules_static_path_name');
             if (is_dir($resourceDir)) {
                 $distDir = ROOT_PATH . DIRECTORY_SEPARATOR . 'web' . DIRECTORY_SEPARATOR . $file->getFilename();
                 $cmd = Request::operatingSystem() ? "mklink /d {$distDir} {$resourceDir}" : "ln -s {$resourceDir} {$distDir}";
                 exec($cmd, $result);
                 $tip = "create link Application [{$file->getFilename()}] result : [" . (is_dir($distDir) ? 'true' : 'false') . "]";
                 $tip = str_pad($tip, 64, ' ', STR_PAD_BOTH);
                 print_r($deper . '|' . $tip . '|');
             }
         }
     }
     echo $deper . '|' . str_pad('', 64, ' ', STR_PAD_BOTH) . '|';
     echo "{$deper}****************************create link end!**********************{$deper}";
 }
 /**
  * A failure occurred.
  *
  * @param  PHPUnit_Framework_Test				 $test
  * @param  PHPUnit_Framework_AssertionFailedError $e
  * @param  float								  $time
  */
 public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
 {
     $this->write('fail: ' . $e->getMessage());
     $trace = current(PHPUnit_Util_Filter::getFilteredStacktrace($e, FALSE));
     $this->write('trace: ' . print_r($trace, 1));
     $this->currentTestPass = FALSE;
 }
Exemplo n.º 11
0
function printTest()
{
    //Tracert HP817ACF
    //$handle = printer_open() ;// Gets the default printer and prints to it.
    //$handle = printer_open('\\\\192.168.1.247\\HP817ACF');
    $handle = printer_open('HP Deskjet 3540 series (Network)');
    // Gets the printer by name, to get printer name, go to devices and printers option, select a printer on the network , you will see the name on top
    //HP Deskjet 3540 series (Network)
    print_r($handle);
    printer_start_doc($handle, "My Document");
    printer_start_page($handle);
    $font = printer_create_font("Arial", 72, 48, 400, false, false, false, 0);
    printer_select_font($handle, $font);
    printer_draw_text($handle, "test", 10, 10);
    printer_delete_font($font);
    printer_end_page($handle);
    printer_end_doc($handle);
    printer_close($handle);
    //$fh = fopen("filename.ext", "rb");
    // $content = fread($fh, filesize("filename.ext"));
    //fclose($fh);
    /*printer_set_option($handle, PRINTER_MODE, "text");
    printer_write($handle, "TEXT To print");
    printer_close($handle);
    
    */
}
 /**
  * Constructor
  *
  * @param array  $options An array of arrays of IMAP options
  * @param string $username
  * @param string $password
  */
 public function __construct(array $options = array(), $username = null, $password = null)
 {
     if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
         Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . print_r($options, true));
     }
     parent::__construct($options, $username, $password);
 }
Exemplo n.º 13
0
 /**
  * 编辑角色
  */
 public function role_editAct()
 {
     if (IS_POST) {
         $id = intval(I("post.id"));
         if ($id == 1) {
             $this->error("超级管理员角色不能被修改!");
         }
         $data = D("Role")->create();
         if ($data) {
             if (D("Role")->save($data) !== false) {
                 $this->success("修改成功!", UC('Rbac/index'));
             } else {
                 $this->error("修改失败!" . D("Role")->getlastsql() . print_r($data, true));
             }
         } else {
             $this->error(D("Role")->getError());
         }
     } else {
         $id = intval(I("get.id"));
         if (!$id) {
             $this->error("非法操作!");
         }
         if ($id == 1) {
             $this->error("超级管理员角色不能被修改!");
         }
         $data = D("Role")->field('id, status, remark, name')->where(array("id" => $id))->find();
         if (!$data) {
             $this->error("该角色不存在!");
         }
         $this->assign("headline", "编辑角色");
         $this->assign("action_name", ACTION_NAME);
         $this->assign("info", $data);
         $this->display("Rbac:role_oper");
     }
 }
Exemplo n.º 14
0
 /**
  * Handle a POST request for this map save ressource
  * @param Request request
  * @return Response
  */
 function post($request)
 {
     $response = new Response($request);
     if (isset($_POST['map'])) {
         // Remove those slashes
         if (get_magic_quotes_gpc()) {
             $map = stripslashes($_POST['map']);
         } else {
             $map = $_POST['map'];
         }
         $map_obj = json_decode($map);
         $geocacheManager = GeocacheManager::getInstance();
         $geocaches = $geocacheManager->parseGeocaches($map_obj->{"geocaches"});
         foreach ($geocaches as $geocache) {
             $geocache->save();
         }
         $ownWaypoints = $geocacheManager->parseOwnWaypoints($map_obj->{"costumMarkers"});
         foreach ($ownWaypoints as $ownWaypoint) {
             $ownWaypoint->save();
         }
         $response->code = Response::OK;
         $response->addHeader('Content-type', 'text/plain');
         $response->body = print_r($map, true);
     } else {
         $response->code = Response::BADREQUEST;
     }
     return $response;
 }
Exemplo n.º 15
0
function neat_r($arr, $return = false)
{
    $out = array();
    $oldtab = "    ";
    $newtab = "  ";
    $lines = explode("\n", print_r($arr, true));
    foreach ($lines as $line) {
        if (substr($line, -5) != "Array") {
            $line = preg_replace("/^(\\s*)\\[[0-9]+\\] => /", "\$1", $line, 1);
        }
        foreach (array("Array" => "", "[" => "", "]" => "", " =>" => ":") as $old => $new) {
            $out = str_replace($old, $new, $out);
        }
        if (in_array(trim($line), array("Array", "(", ")", ""))) {
            continue;
        }
        $indent = "\n";
        $indents = floor((substr_count($line, $oldtab) - 1) / 2);
        if ($indents > 0) {
            for ($i = 0; $i < $indents; $i++) {
                $indent .= $newtab;
            }
        }
        $out[] = $indent . trim($line);
    }
    $out = implode("<br/>", $out) . "\n";
    if ($return == true) {
        return $out;
    }
    echo $out;
}
Exemplo n.º 16
0
/**
 * Smarty {json} plugin
 *
 * Type:       function
 * Name:       json
 * Date:       Apr 12, 2009
 * Purpose:    Read JSON from file, decode and assign data to Smarty template variable
 * Syntax:     {json file="filename.json"}: 'file' is a required parameter (URL)
 *             Predefined additional parameters:
 *             - assign="data": assign all JSON data to template variable $data
 *             - obj2obj [ Boolean | default:false ]:
 *               decodes JSON objects as either PHP associative arrays or PHP objects
 *             - debug [ Boolean | default:false ]: print decoded data in template
 *             Variable parameters:
 *             {json file="filename.json" home="homepage" lang="languages"}:
 *               assign (JSONdata)["homepage"] to template variable $home
 *               and (JSONdata)["languages"] to $lang,
 *               compare to: {config_load file="filename.conf" section="homepage"}
 * Install:    Drop into the plugin directory
 * @link       http://jlix.net/extensions/smarty/json
 * @author     Sander Aarts <smarty at jlix dot net>
 * @copyright  2009 Sander Aarts
 * @license    LGPL License
 * @version    1.0.1
 * @param      array
 * @param      Smarty
 */
function smarty_function_json($params, &$smarty)
{
    if (!is_callable('json_decode')) {
        $smarty->_trigger_fatal_error("{json} requires json_decode() function (PHP 5.2.0+)");
    }
    if (empty($params['file'])) {
        $smarty->_trigger_fatal_error("{json} parameter 'file' must not be empty");
    }
    if (isset($params['assign'], $params[$params['assign']])) {
        $smarty->_trigger_fatal_error("{json} parameter 'assign' conflicts with a variable assign parameter (both refer to the same variable)");
    }
    $assoc = $params['obj2obj'] == true ? false : true;
    $json = trim(file_get_contents($params['file']));
    $data = json_decode($json, $assoc);
    if ($params['debug'] == true) {
        echo "<pre>";
        print_r($data);
        echo "</pre>";
    }
    unset($params['file'], $params['obj2obj'], $params['debug']);
    $assign = array();
    foreach ($params as $key => $value) {
        if ($key === 'assign') {
            $assign[$value] = $data;
        } else {
            $assign[$key] = $assoc ? $data[$value] : $data->{$value};
        }
    }
    if (count($assign) > 0) {
        $smarty->assign($assign);
    } else {
        return $data;
    }
}
Exemplo n.º 17
0
function checkTokenESB($token)
{
    global $debugar;
    if ($debugar) {
        echo 'checkTokenESB(): checking token "' . $token . '".<br />' . "\n";
    }
    if (!isset($token)) {
        if ($debugar) {
            echo 'checkTokenESB(): KO, empty token.<br />' . "\n";
        }
        $token = isset($_REQUEST['token']) ? $_REQUEST['token'] : null;
    }
    if ($token == NULL) {
        if ($debugar) {
            echo 'checkTokenESB(): KO, null token.<br />' . "\n";
        }
        $output[] = array('errorNumber' => 1, 'errorText' => 'Identification token is required');
        echo json_encode($output);
        die;
    } else {
        // Check credentials in EBS
        // http://esb.exactls.com/collage/cas/user?token=ST-114-vC2Gb1k1vDGgxlkoefFm-cas01.example.org
        // If the token is invalid, file_get_contents raises an error.
        $credentials = getUserCredentials($token);
        if ($debugar) {
            echo 'checkTokenESB(): downloaded credentials: "' . print_r($credentials, TRUE) . '".<br />' . "\n";
        }
        return $credentials;
    }
}
Exemplo n.º 18
0
 public function wait()
 {
     $data['current'] = array('data_back' => '', 'user_manage' => '', 'user_data' => '', 'teacher_data' => '', 'add_teacher' => '', 'classify_manage' => '', 'all_classify' => '', 'course_manage' => 'current', 'required_course' => 'current', 'elective_course' => '', 'skill_course' => '', 'video_manage' => '', 'all_video' => '', 'upload_video' => '', 'order_manage' => '', 'all_order' => '', 'account_data' => '', 'feedback_manage' => '', 'all_feedback' => '', 'comment_manage' => '', 'all_comment' => '', 'link_manage' => '', 'all_link' => '', 'add_link' => '', 'activity_manage' => '', 'add_activity' => '', 'all_activity' => '');
     $page_config['perpage'] = 9;
     //每页条数
     $page_config['part'] = 2;
     //当前页前后链接数量
     $page_config['url'] = '/admin/required/check';
     //url
     $page_config['seg'] = 4;
     //参数取 index.php之后的段数,默认为3,即index.php/control/function/18 这种形式
     $page_config['nowindex'] = $this->uri->segment($page_config['seg']) ? $this->uri->segment($page_config['seg']) : 1;
     //当前页
     $this->load->library('mypage_class');
     $page_config['total'] = count($this->required_model->query_by_check());
     // file_put_contents("/home/tanxu/www/data.txt", $page_config['total']);
     $this->mypage_class->initialize($page_config);
     if ((int) $page_config['nowindex'] == 1) {
         $data['check'] = $this->required_model->get_num_course(0, (int) $page_config['perpage'], 0);
         file_put_contents("/home/tanxu/www/data.txt", print_r($data['check'], true));
     } else {
         $firstcount = ((int) $page_config['nowindex'] - 1) * (int) $page_config['perpage'];
         $data['check'] = $this->required_model->get_num_course(0, (int) $page_config['perpage'], $firstcount);
     }
     $this->load->view('admin/admin_header.html', $data);
     $this->load->view('admin/admin_required_check.html');
 }
Exemplo n.º 19
0
 public function getAllUser()
 {
     $allUser = array();
     $doc = new DOMDocument();
     print_r(XML_DB_PATH);
     $doc->load(XML_DB_PATH);
     $users = $doc->getElementsByTagName("user");
     foreach ($users as $user) {
         $usernames = $user->getElementsByTagName("username");
         $username = $usernames->item(0)->nodeValue;
         $passwords = $user->getElementsByTagName("password");
         $password = $passwords->item(0)->nodeValue;
         //			$userids = $user->getElementsByTagName( "userid" );
         //			$userid = $userids->item(0)->nodeValue;
         $userid = $user->getAttribute("userid");
         $userroles = $user->getElementsByTagName("userrole");
         $userrole = $userroles->item(0)->nodeValue;
         $controlblocks = $user->getElementsByTagName("controlblock");
         $controlblock = $controlblocks->item(0)->nodeValue;
         $names = $user->getElementsByTagName("name");
         $name = $names->item(0)->nodeValue;
         $temp = new stdClass();
         $temp->userid = $userid;
         $temp->username = $username;
         $temp->password = $password;
         $temp->userrole = $userrole;
         $temp->controlblock = $controlblock;
         $temp->name = $name;
         $allUser[count($allUser)] = $temp;
     }
     return $allUser;
 }
Exemplo n.º 20
0
 /**
  * Fetches hashed data from db and put into instance
  */
 private function __save()
 {
     $class = $this->class;
     $database = new database($class::$database);
     if ($this->get_attributes()) {
         $columns = "(`{$class::$entity_id_column}`, `{$class::$key_column}`, `{$class::$value_column}`, `date_added`, `date_updated`)";
         $placeholders = $values = $duplicate_keys = array();
         foreach ($this->get_attributes() as $key => $value) {
             $placeholders[] = "(%d, %s, %s, NOW(), NOW())";
             $values[] = $this->entity_id;
             $values[] = $key;
             $values[] = $value;
             $duplicate_keys[] = "`{$class::$value_column}` = VALUES(`{$class::$value_column}`)";
         }
         $duplicate_keys[] = '`date_updated` = VALUES(`date_updated`)';
         $database->query("INSERT INTO {$class::$table} {$columns} VALUES " . implode(', ', $placeholders) . " ON DUPLICATE KEY UPDATE " . implode(', ', $duplicate_keys), $values);
     }
     if ($unset_keys = array_diff($this->original_keys, array_keys($this->get_attributes()))) {
         // we unset something
         print_r(array($this->entity_id, $unset_keys));
         database::enable_log();
         $database->query("DELETE FROM {$class::$table} WHERE `{$class::$entity_id_column}` = %d AND `{$class::$key_column}` IN (%s)", array($this->entity_id, $unset_keys));
     }
     return true;
 }
Exemplo n.º 21
0
function suche($wort, $kat)
{
    if ($kat == '') {
        $kat = 0;
    }
    $f = fopen("/tmp/x", "w");
    fputs($f, $wort . " " . $kat . "\n");
    $treffer = suchWDB($wort, $kat);
    fputs($f, print_r($treffer, true) . "\n");
    $notfound = "";
    $rc = array('msg' => '', 'cnt' => 0, 'data' => '');
    if (count($treffer) == 0) {
        $rc['msg'] = $wort . ' not found';
        echo json_encode($rc);
    } else {
        if (count($treffer) == 1) {
            $data = getWContent($treffer[0]['id']);
            mkcontent($data);
            fclose($f);
        } else {
            $rc['cnt'] = count($treffer);
            $rc['data'] = $treffer;
            echo json_encode($rc);
        }
    }
}
Exemplo n.º 22
0
function print_rre($x, $label = "DEBUG")
{
    print "<PRE>{$label}<br>";
    print_r($x);
    print "</PRE>";
    die;
}
Exemplo n.º 23
0
 function gameStatus()
 {
     $homepage = file_get_contents('http://bsx.jlparry.com/status');
     $xml = simplexml_load_string($homepage);
     print_r($xml);
     return $xml;
 }
Exemplo n.º 24
0
 public function indexAction()
 {
     $userInfo = $this->session->get('userInfo');
     echo '<pre>';
     print_r($userInfo);
     return $this->render('Admin/View/index.html.twig');
 }
Exemplo n.º 25
0
 function get_shippers($add_blank = false, $status = 'Active')
 {
     $query = "SELECT id, name FROM {$this->table_name} where deleted=0 ";
     if ($status == 'Active') {
         $query .= " and status='Active' ";
     } elseif ($status == 'Inactive') {
         $query .= " and status='Inactive' ";
     } elseif ($status == 'All') {
     }
     $query .= " order by list_order asc";
     $result = $this->db->query($query, false);
     $GLOBALS['log']->debug("get_shippers: result is " . print_r($result, true));
     $list = array();
     if ($add_blank) {
         $list[''] = '';
     }
     //if($this->db->getRowCount($result) > 0){
     // We have some data.
     while (($row = $this->db->fetchByAssoc($result)) != null) {
         //while ($row = $this->db->fetchByAssoc($result)) {
         $list[$row['id']] = $row['name'];
         $GLOBALS['log']->debug("row id is:" . $row['id']);
         $GLOBALS['log']->debug("row name is:" . $row['name']);
     }
     //}
     return $list;
 }
 /**
  * Test that email template configuration file matches the format
  *
  * @param string $file
  * @dataProvider fileFormatDataProvider
  */
 public function testFileFormat($file)
 {
     $schemaFile = BP . '/app/code/Magento/Email/etc/email_templates.xsd';
     $dom = new \Magento\Framework\Config\Dom(file_get_contents($file));
     $result = $dom->validate($schemaFile, $errors);
     $this->assertTrue($result, print_r($errors, true));
 }
Exemplo n.º 27
0
 protected function make()
 {
     $objPlayerName = $this->get_data('PlayerName');
     for ($sex = 0; $sex < 2; $sex++) {
         if ($objPlayerName->get_name_num($sex) > $this->checkNum) {
             continue;
         }
         $lNameList = $this->get_lname();
         if (empty($lNameList)) {
             echo "null last namelist\n";
             continue;
         }
         $sNameList = $this->get_sname($sex);
         if (empty($sNameList)) {
             echo "null sec namelist\n";
             continue;
         }
         print_r($lNameList) . "\n";
         print_r($sNameList) . "\n";
         if (empty($lNameList)) {
             echo "null last namelist\n";
             continue;
         }
         foreach ($lNameList as $lid => $lname) {
             foreach ($sNameList as $sid => $sname) {
                 $objPlayerName->add_name($sex, $lname . $sname, $lid, $sid);
             }
         }
     }
     $this->lNameList = array();
 }
 public function __construct(Request $request, Response $response, $message = "", $code = 0, \Exception $previous = null)
 {
     if (false == $message) {
         $message = sprintf("The response is not success.\n Response: %s", print_r($response->toArray(), true));
     }
     parent::__construct($request, $response, $message, $code, $previous);
 }
Exemplo n.º 29
0
 /**
  * license the app
  * 
  */
 public static function license($activationKey, $productToken)
 {
     $url = 'https://ls.amazonaws.com/';
     $client = new Varien_Http_Client($url);
     $client->setMethod(Zend_Http_Client::GET);
     $client->setParameterGet("Action", "ActivateDesktopProduct");
     $client->setParameterGet("ActivationKey", $activationKey);
     $client->setParameterGet("ProductToken", $productToken);
     $response = $client->request();
     if ($response->isSuccessful()) {
         $body = $response->getRawBody();
         $xml = new SimpleXMLElement($body);
         $result = array();
         $result["access"] = $xml->ActivateDesktopProductResult->AWSAccessKeyId;
         $result["secret"] = $xml->ActivateDesktopProductResult->SecretAccessKey;
         $result["usertoken"] = $xml->ActivateDesktopProductResult->UserToken;
         // uncomment to debug raw submission response
         //Mage::log("result=" . print_r($result,true));
         return $result;
     } else {
         Mage::log("Activation failed to URL: " . $url . ", HTTP response code was not 200");
         Mage::log("Raw response: " . print_r($response, true));
         return false;
     }
 }
 /**
  * @param string $class
  * @param array  $constraints
  * @param array  $config
  */
 protected function assertConstraintsConfiguration($class, $constraints, array $config)
 {
     $constraint = $this->getInstanceOf($class, $constraints);
     foreach ($config as $name => $value) {
         $this->assertEquals($value, $constraint->{$name}, sprintf('Expecting property "%s" of constraint "%s" to be "%s", but got "%s"', $name, $class, print_r($value, true), print_r($constraint->{$name}, true)));
     }
 }