/** * 调用配置文件 * * @param string $path 文件夹路径 * @return array */ function C($string) { $array = getconfig(CONFIG_PATH); if (is_array($array)) { return $array[$string]; } else { throwexce('config not array!'); } }
public function getDbObject($classname) { $classfile = SYSTEM_DRIVER_PATH . '/' . $classname . '.php'; if (file_exists($classfile)) { include_once $classfile; if (!is_object($classname)) { return new DbPdo(getconfig('Dbconfig.php')); } } }
function runConsumer($topic) { $lockfile = '/tmp/mytest.lock'; $startTime = explode(' ', microtime()); $kmlCachePath = getconfig('kmlCachePath'); //本地缓存里存在数据则优先执行 $cacheFiles = getFileList('./cache/' . $topic); if (!empty($cacheFiles)) { sort($cacheFiles); foreach ($cacheFiles as $f) { $kmls = json_decode(file_get_contents($f)); $items = array_chunk($kmls, 25); foreach ($items as $item) { updataKml($item, $startTime, $f, 2, $topic); } } } // $i = 1; $f = ''; logs(date('h:i:s', time()) . $topic . ' start ...', 1, 'consumer', $topic); while ($da = kafka::getInstance()->get($topic)) { $starttime = explode(' ', microtime()); if (!empty($da->messageList)) { foreach ($da->messageList as $d) { $kmls[] = json_decode($d->message); } //$i++; //if($i > 10){ updataKml($kmls, $starttime, $f, 1, $topic); usleep(10); logs(date('H:i:s') . 'sleep 10', 1, 'consumer', $topic); $kmls = []; /* $i = 1; } }else{ if(!empty($kmls)){ updataKml($kmls,$starttime,$f,1, $topic); } break;*/ } else { unlink($lockfile); logs('success total time:' . getTime($startTime), 1, 'consumer', $topic); echo 'aa'; exit; } } logs('success total time:' . getTime($startTime), 1, 'consumer', $topic); unlink($lockfile); }
function runProducer() { $kmlPath = getconfig('kmlPath'); $xml_file = getFileList($kmlPath); $lockfile = '/tmp/producer.lock'; if (empty($xml_file)) { logs(date('Y-m-d h:i:m') . "XML source files downloaded from the FTP is empty."); unlink($lockfile); exit; } sort($xml_file); $startTime = explode(' ', microtime()); $totalNum = 0; $i = $n = 1; foreach ($xml_file as $f) { //解析文件生成数组 $data = paseXml($f); //XML格式检查 $res = isFormat($data, $f); if ($res === false) { continue; } //格式化 $kmldata = formatKmlData($data, $f); $i++; $fNum = count($kmldata); $totalNum += $fNum; //入队列 $kafkaTime = explode(' ', microtime()); $fileName = basename($f); insertKafka($kmldata, $fileName); logs($i . '>>>' . basename($f) . ',file count:' . $fNum . ',total:' . $totalNum . ',into kafka time:' . getTime($kafkaTime)); if ($n > 100) { usleep(200); $n = 1; } //备份文件: backFile($f); } logs('Total time:' . getTime($startTime)); //unlock(); //$lockfile = '/tmp/producer.lock'; unlink($lockfile); exit; }
public function index() { $data['ip'] = getip(); $data['ipint'] = ip2long($data['ip']); //echo $data['ip'] ; $data['dev_name'] = getconfig("./data/setting.inc.php", "dev_name", $type = "string"); $server = getconfig("./data/setting.inc.php", "monitor_url", $type = "string"); //echo $data['dev_name']; $data['dev_num'] = dev_num(); $sumary = request('summary'); $data['asc_mhs_5s'] = $sumary['SUMMARY']['MHS 5s']; //$data_array[0]; $data['asc_mhs_5m'] = $sumary['SUMMARY']['MHS 5m']; //$data_array[1]; $data['asc_mhs_15m'] = $sumary['SUMMARY']['MHS 15m']; //$data_array[2]; $data['asc_mhs_av'] = $sumary['SUMMARY']['MHS av']; $data['asc_last_share_time'] = $sumary['SUMMARY']['Last getwork']; $data['event_time'] = time(); //var_dump($sumary); //$url=$server."?ip=".$data['ip'].'&dev_name='.$data['dev_name'].'&ipint='.$data['ipint'].'&dev_num\='.$data['dev_num'].'\&asc_mhs_av\='.$data['asc_mhs_av'].'\&asc_mhs_5m\='.$data['asc_mhs_5m'].'\&asc_mhs_5s\='.$data['asc_mhs_5s'].'\&asc_mhs_15m\='.$data['asc_mhs_15m'].'\&asc_last_share_time\='.$data['asc_last_share_time'].'\&event_time\='.$data['event_time']; //echo $url; $miner_data['ip'] = $data['ip']; $miner_data['ipint'] = $data['ipint']; $miner_data['dev_name'] = $data['dev_name']; $miner_data['dev_num'] = $data['dev_num']; $miner_data['asc_mhs_5s'] = $data['asc_mhs_5s']; $miner_data['asc_mhs_5m'] = $data['asc_mhs_5m']; $miner_data['asc_mhs_15m'] = $data['asc_mhs_15m']; $miner_data['asc_mhs_av'] = $data['asc_mhs_av']; $miner_data['asc_last_share_time'] = $data['asc_last_share_time']; $miner_data['event_time'] = $data['event_time']; $miner_json = json_encode($miner_data); $url = $server . "index.php?c=home&m=getdata&data=" . $miner_json; //echo $this->curl->submit($server, $miner_data); //echo "dd";$url //$re=geturl($url); exec("sudo /usr/bin/lynx -source " . $url . " &", $command, $output); //exec('wget '.$url.' > /dev/null &') //echo $url; //var_dump($re) ;//$re; var_dump($command); //var_dump($output); }
function addKml($returndata, $kmls, $topic) { $result = formatKml($returndata, $kmls); $dsn = getconfig('dsn'); $user = getconfig('user'); $pwd = getconfig('pwd'); $table = getconfig('table'); $db = new PDO($dsn, $user, $pwd); $arr[] = ''; $sql = "INSERT INTO {$table} (`storeId`,`distribution`,`rtNum`,`kmlStatus`,`itno`,`qty`,`docTime`,`createTime`,`updateTime`,`kmlPath`) VALUES "; foreach ($result as $k => $arr) { $sql .= '("' . $arr['storeId'] . '","' . $arr['distribution'] . '","' . $arr['rtNum'] . '","' . $arr['kmlStatus'] . '","' . $arr['itno'] . '","' . $arr['qty'] . '","' . $arr['docTime'] . '","' . $arr['createTime'] . '","' . date('Y-m-d H:i:s', time()) . '","' . $arr['kmlPath'] . '"),'; } $sql = substr($sql, 0, strlen($sql) - 1); $row = $db->exec($sql); if (empty($lastId)) { logs('error insert into, SQL:' . $sql, 2, 'consumer', $topic); } return $row; }
private function __construct() { $GEN_DIR = realpath(dirname(__FILE__) . '/..') . '/gen-php'; $loader = new ThriftClassLoader(); $loader->registerNamespace('Thrift', __DIR__); $loader->registerDefinition('shared', $GEN_DIR); $loader->registerDefinition('tutorial', $GEN_DIR); $loader->register(); $kafkaUrl = getconfig('kafkaUrl'); $port = getconfig('kafkaPort'); $socket = new TSocket($kafkaUrl, $port); $transport = new TBufferedTransport($socket, 1024, 1024); $transport->open(); $protocol = new TBinaryProtocol($transport); $this->client = new \com\feiniu\kafka\thrift\service\KafkaService($protocol); $this->project = getconfig('kafkaProject'); $this->topic = getconfig('kafkaTopic'); $this->kafkakey = getconfig('kafkaKey'); $this->group = getconfig('kafkaGroup'); //$this->msg = getconfig(''); }
function getpassword() { if (!file_exists('./username.conf.php')) { echo 'Fatal error. Username is not set. Please set an username using the setusername command'; die; } require_once 'getconfig.php'; $handle = getconfig('username'); if (!file_exists('./password.conf.php')) { if (!file_exists('./publishserver.conf.php')) { echo 'publish server is not set, using server as a fallback.' . "\n"; $publishserver = getconfig('server'); } else { $publishserver = getconfig('publishserver'); } echo 'Please enter your password for user ' . $handle . ' on publishserver ' . $publishserver . "\n"; $input = fgets(STDIN); $input = trim($input); return $input; } else { return getconfig('password'); } }
function processfile($file, $password) { if (is_dir($file)) { $dirs = scandir($file); foreach ($dirs as $dir) { if ($dir[0] !== '.') { processfile($file . '/' . $dir, $password); } } } require_once './getconfig.php'; require_once './getpassword.php'; $handle = getconfig('username'); if (!file_exists('./publishserver.conf.php')) { echo 'publish server is not set, using server as a fallback.' . "\n"; $publishserver = getconfig('server'); } else { $publishserver = getconfig('publishserver'); } $local = filemtime('./' . $file); $remote = intval(file_get_contents($publishserver . '/?getmtime=' . urlencode($handle . '/' . $file))); if ($local > $remote) { $cfile = new CURLFile('./' . $file, mime_content_type('./' . $file)); $data = array('file' => $cfile, 'username' => $handle, 'password' => $password); echo 'uploading file ' . $file . "\n"; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $publishserver . '/?uploader=' . urlencode($handle . '/' . $file)); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $data); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); echo curl_exec($curl) . "\n"; curl_close($curl); } else { echo 'file ' . $file . ' do not need to be uploaded' . "\n"; } }
use Illuminate\Database\Capsule\Manager as Capsule; /** * Create a new Capsule to handle the Illuminate * Database package. * * @var Illuminate\Database\Capsule\Manager */ $capsule = new Capsule(); /** * Gets the configuration from the database * configuration file. * * @var array */ $config = getconfig('database'); /** * Sets the PDO Fetch Mode. */ $capsule->setFetchMode($config['fetch']); /** * Adds the configuration of the default * driver setting. */ $capsule->addConnection($config['connections'][$config['default']]); /** * Set the Capsule as a global to allow * the usage of static methods. */ $capsule->setAsGlobal(); /**
<?php if (file_exists('./singleseat.conf.php')) { unset($_GET['site']); require_once 'getconfig.php'; $_GET['ruehcram'] = getconfig('singleseat'); include './index.php'; } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"/> <title>ruehcram. Road, walks, travel diaries, tools, gear and software </title> <meta name="description" value="Discover new rides, build your gear, walk connected"/> </head> <body style="margin-left:8%;margin-right:8%;font-family:Sans;padding-left:2%;"> <h1>ruehcram</h1> <div style="float:left;width:24%;"> <h6>ruehcrams</h6> <?php $ruehcrams = scandir('./'); foreach ($ruehcrams as $ruehcram) { if ($ruehcram[0] !== '.' && is_dir($ruehcram) && file_exists($ruehcram . '/meta/title.txt')) { echo '<a href="?ruehcram=' . urlencode($ruehcram) . '">' . htmlentities($ruehcram) . '</a><br/>'; } } ?>
* a development enviroment. * * Production enviroments should be set by * your hosts configuration to prevent the * loading of the .env files on each * request. */ if (env('SLIM_MODE', 'development') === 'development') { (new Dotenv\Dotenv(ROOT_PATH))->load(); } /** * Create a new Slim application. * * @var Slim */ $app = new Slim(getconfig('slim')); /** * Set the name of the Slim application. */ $app->setName($app->config('name')); /** * Load all the active modules. */ $modules = glob(MODULES_PATH . '*.active.php'); foreach ($modules as $module) { require_once $module; } /** * Handle the application services. */ require_once 'services.php';
<?php if (!isset($_SERVER['HOME'])) { die; } if (isset($argv[0])) { echo 'setting publishserver name ' . $argv[0] . '...'; $argv[1] = $argv[0]; $argv[0] = 'publishserver'; include 'setconfig.php'; echo 'done' . "\n"; } else { include_once 'getconfig.php'; echo getconfig('publishserver') . "\n"; }
<?php if (!isset($_SERVER['HOME'])) { die; } if (isset($argv[0])) { echo 'setting server name ' . $argv[0] . '...'; $argv[1] = $argv[0]; $argv[0] = 'server'; include 'setconfig.php'; echo 'done' . "\n"; } else { include_once 'getconfig.php'; echo getconfig('server') . "\n"; }
<?php if (!isset($_SERVER['HOME'])) { die; } if (isset($argv[0])) { echo 'setting username for a single diary web install name ' . $argv[0] . '...'; $argv[1] = $argv[0]; $argv[0] = 'singleseat'; include 'setconfig.php'; echo 'done' . "\n"; } else { include_once 'getconfig.php'; echo getconfig('singleseat') . "\n"; }
$adminaction = "forum_boards"; } ################ if ($adminaction == "forum_newboard") { $query_str = $db->query_str("INSERT INTO {$tab['forum_board']} (parent_boardid,is_cat,board_name,board_password,board_comment,visible) VALUES ('{$form['parent_boardid']}','{$form['is_cat']}','{$form['board_name']}','{$form['board_password']}','{$form['board_comment']}','{$form['visible']}')"); $adminaction = "forum_boards"; } ################ if ($adminaction == "forum_save_mainconfig") { $db->query_str("DELETE FROM {$tab['config']} WHERE name='forum_show_threadspp'"); $db->query_str("DELETE FROM {$tab['config']} WHERE name='forum_show_postspp'"); $db->query_str("DELETE FROM {$tab['config']} WHERE name='forum_guestpost'"); $db->query_str("INSERT INTO {$tab['config']} (value,name) VALUES ('{$form['forum_show_threadspp']}','forum_show_threadspp')"); $db->query_str("INSERT INTO {$tab['config']} (value,name) VALUES ('{$form['forum_show_postspp']}','forum_show_postspp')"); $db->query_str("INSERT INTO {$tab['config']} (value,name) VALUES ('{$form['forum_guestpost']}','forum_guestpost')"); $config = getconfig(); $adminaction = "forum_config"; unset($form); } ################ if ($adminaction == "forum_config") { if ($config[forum_guestpost]) { $gpost[on] = " selected"; } else { $gpost[off] = " selected"; } eval("\$inc[action] = \"" . gettemplate("forum.admin.mainconfig") . "\";"); } ################ if ($adminaction == "forum_boards") { $catquery = $db->query_str("SELECT * FROM {$tab['forum_board']} WHERE is_cat='1' ORDER BY sort");
function formatKml($kmldata, $f) { $topicArr = explode(',', getconfig('kafkaTopic')); $hash = new Flexihash(); $hash->addTargets($topicArr); $msgs = []; if (!empty($kmldata)) { foreach ($kmldata as $k => $kml) { $msg = array('DIANHAO' => $kml['storeId'], 'FENPEI' => $kml['distribution'], 'RTHUOHAO' => $kml['rtNum'], 'CREATE_TIME' => $kml['createTime'], 'DOC_TIME' => $kml['docTime'], 'KML_FILE' => $f); $key = $hash->lookup($kml['storeId'] . $kml['rtNum']); $msgs[$key][] = $msg; } return $msgs; } }
function free_space() { $savedir = getconfig("savedir"); if (!$savedir) { $savedir = "/home"; } $df = diskfreespace($savedir); $size = intval($df / (1024 * 1024)); $recordtime = intval($size / 350); print "{$size} MB free =~ {$recordtime} hours free\n"; }
print "</select></td></tr>\n<tr>\n\t<td>Bitrate</td><td>:</td>"; $bitrate = getcodecconfig("bitrate"); print "\n\t<td>" . html_form::text_widget("bitrate") . "</td>\n</tr>\n<tr>\n\t<td>Crispness</td><td>:</td>"; $crispness = getcodecconfig("crispness"); print "\n\t<td>" . html_form::text_widget("crispness") . "</td>\n</tr>\n<tr>\n\t<td>Station Collector to Use</td><td>:</td><td><select name=\"collectorid\">"; print_select_collector(getconfig("collectorid")); print "</select></td></tr>"; ?> <tr><td>Minutes to Start Record Before and After</td><td>:</td> <?php $timetostart = getconfig("timetostart"); print "<td>" . html_form::text_widget("timetostart") . "</td>\n"; ?> <tr><td>Minutes to End Recording After the Program</td><td>:</td> <?php $timetoend = getconfig("timetoend"); print "<td>" . html_form::text_widget("timetoend") . "</td>\n"; ?> </td> </tr><tr> <TD COLSPAN=3 ALIGN=CENTER><INPUT TYPE=SUBMIT NAME=SUBMIT VALUE="Save"></TD> </TR> </TABLE> </table> </center> </FORM> <?php print_page_close(); ?>
public function setting2() { //echo 'dd'; //$var = updateconfig("./data/setting.inc.php", "kkk",'111');// //var_dump($var); @exec('sudo chmod 777 /usr/share/nginx/www/data/setting.inc.php'); $this->data['title'] = 'setting'; $this->form_validation->set_rules('dev_name', 'dev_name', 'trim|xss_clean'); $this->form_validation->set_rules('monitor_url', 'monitor_url', 'trim|xss_clean'); if ($this->form_validation->run()) { $device['dev_name'] = $this->input->post('dev_name', TRUE); //$device['dev_id'] =$this->input->post('dev_id', TRUE); //$device['lang'] =$this->input->post('lang', TRUE); //$device['timezone'] =$this->input->post('timezone', TRUE); $device['monitor_url'] = $this->input->post('monitor_url', TRUE); updateconfig("./data/setting.inc.php", "dev_name", $device['dev_name']); // //updateconfig("./data/setting.inc.php", "dev_id",$device['dev_id']);// //updateconfig("./data/setting.inc.php", "lang",$device['lang']);// //updateconfig("./data/setting.inc.php", "timezone",$device['timezone']);// updateconfig("./data/setting.inc.php", "monitor_url", $device['monitor_url']); // showmsg('Settings updated OK!'); } else { $this->data['dev_name'] = getconfig("./data/setting.inc.php", "dev_name", $type = "string"); //$this->data['dev_id'] = getconfig("./data/setting.inc.php", "dev_id", $type="string"); //$this->data['lang'] = getconfig("./data/setting.inc.php", "lang", $type="string"); //$this->data['timezone'] = getconfig("./data/setting.inc.php", "timezone", $type="string"); $this->data['monitor_url'] = getconfig("./data/setting.inc.php", "monitor_url", $type = "string"); $this->load->view('common/header', $this->data); $this->load->view('common/left'); $this->load->view('setting'); $this->load->view('common/footer'); } }
<?php echo getconfig("projectname");
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title><?php echo getconfig("hq"); ?> | <?php echo $title; ?> </title> <link href="<?php echo base_url('assets/css/bootstrap.min.css'); ?> " rel="stylesheet"> <link href="<?php echo base_url('assets/css/bootstrap-reset.css'); ?> " rel="stylesheet"> <!--external css--> <link href="<?php echo base_url('assets/assets/font-awesome/css/font-awesome.css'); ?> " rel="stylesheet" /> <!-- Custom styles for this template --> <link href="<?php echo base_url('assets/css/style.css'); ?> " rel="stylesheet"> <link href="<?php echo base_url('assets/css/style-responsive.css');
MAX task set to <?php echo $w; ?> <br> <br> <?php } else { if ($action == "setweekmin") { $w = (int) rt("w"); $sql = "update config set val={$w} where tag='weekmin'"; dbExec($sql); $sql = "update users set week={$w} where week < {$w}"; dbExec($sql); $sql = "update groups set week={$w} where week < {$w}"; dbExec($sql); getconfig(); ?> <br> MIN task set to <?php echo $w; ?> <br> <br> <?php } } } ?> </div>
list($sum_pday) = $db->query("SELECT SUM(traffic)/COUNT(*) FROM {$tab['traffic']}"); $sizeof_alltraffic = formatfsize($sum_alltraffic); $sizeof_perday = formatfsize($sum_pday); eval("\$inc[action] = \"" . gettemplate("admin.sworaconfig.traffic.main") . "\";"); } ##################### if ($adminaction == "auto_install_start") { if (is_file("./sections/" . $sectioninstall . "/auto_install.php")) { $thispath = "index.php?section=admin&adminaction=auto_install_start§ioninstall={$sectioninstall}"; @(include "./sections/" . $sectioninstall . "/auto_install.php"); } $isinstalled = $sectoinstall; } ########################### if ($adminaction == "mainconfig") { $form = getconfig(); if ($form[stylesetstatic]) { $selectstylesetstatic = " checked"; } else { $selectstylesetstatic = ""; } $ftpq = $db->query_str("SELECT * FROM {$tab['ftp']}"); while ($server = $db->fetch_array($ftpq)) { if ($config[avatar_ftpid] == $server[id]) { $selected = " selected"; } else { unset($selected); } eval("\$ftplist .= \"" . gettemplate("admin.sworaconfig.ftp.optionbit") . "\";"); } $dir = @dir($style[templates]);
public function importarscriptAction() { function getconfig() { // fixme: do it the synfony way $yfile = "../app/config/parameters.yml"; $parameters = file_get_contents($yfile); $linhas = explode("\n", $parameters); foreach ($linhas as $linha) { $dado = explode(": ", $linha); $config[] = $dado[1]; } return $config; } // Conexão com o banco $config = @getconfig(); $server = $config[2]; $port = $config[3]; $db = $config[4]; $user = $config[5]; $pass = $config[6]; error_log("11111111111111111111111111111111" . $config . " | " . $server . " | " . $db . " | " . $user . " | " . $pass); if ($server != 'null') { $dbcon = new PDOConnection("pgsql:host={$server};dbname={$db};port={$port}", $user, $pass); } else { $dbcon = new PDOConnection("pgsql:dbname={$db};port={$port}", $user, $pass); } function importar($dbcon, $tmpdir) { // Cria a query padrão de inclusão de dados $lista_tabelas = array("acao", "servidor_autenticacao", "local", "rede", "acao_excecao", "acao_rede", "so", "acao_so", "aplicativo", "aplicativo_rede", "aquisicao", "tipo_licenca", "software", "aquisicao_item", "computador", "descricao_coluna_computador", "grupo_usuario", "insucesso_instalacao", "usuario", "local_secundario", "log", "unid_organizacional_nivel1", "unid_organizacional_nivel1a", "unid_organizacional_nivel2", "patrimonio", "patrimonio_config_interface", "rede_grupo_ftp", "rede_versao_modulo", "software_estacao", "srcacic_chat", "srcacic_conexao", "srcacic_sessao", "srcacic_transf", "teste", "tipo_software", "tipo_uorg", "uorg", "usb_vendor", "usb_device", "usb_log"); echo "Limpando dados anteriores... "; foreach ($lista_tabelas as $tabela) { // Limpa as tabelas antes $dbcon->exec("truncate {$tabela} cascade"); } echo "feito.<br>"; foreach ($lista_tabelas as $tabela) { if (file_exists("{$tmpdir}/importacao/{$tabela}.csv")) { echo "Importando " . $tabela . "..."; // Copia do arquivo para a base $dbcon->exec("COPY {$tabela} FROM '{$tmpdir}/importacao/{$tabela}.csv' WITH DELIMITER AS ';' NULL AS '\\N' ESCAPE '\"' ENCODING 'ISO-8859-1' CSV"); echo " feito.<br>"; } } } function atualizar_seq($dbcon) { $lista_sequencias = array("aplicativo_id_aplicativo_seq", "aquisicao_id_aquisicao_seq", "class_property_id_class_property_seq", "class_property_type_id_class_property_type_seq", "classe_id_class_seq", "collect_def_class_id_collect_def_class_seq", "computador_coleta_historico_id_computador_coleta_historico_seq", "computador_coleta_id_computador_coleta_seq", "computador_id_computador_seq", "grupo_usuario_id_grupo_usuario_seq", "insucesso_instalacao_id_insucesso_instalacao_seq", "local_id_local_seq", "log_id_log_seq", "patrimonio_id_patrimonio_seq", "rede_grupo_ftp_id_ftp_seq", "rede_id_rede_seq", "rede_versao_modulo_id_rede_versao_modulo_seq", "servidor_autenticacao_id_servidor_autenticacao_seq", "so_id_so_seq", "software_id_software_seq", "srcacic_action_id_srcacic_action_seq", "srcacic_chat_id_srcacic_chat_seq", "srcacic_conexao_id_srcacic_conexao_seq", "srcacic_sessao_id_srcacic_sessao_seq", "srcacic_transf_id_srcacic_transf_seq", "teste_id_transacao_seq", "tipo_licenca_id_tipo_licenca_seq", "tipo_software_id_tipo_software_seq", "tipo_uorg_id_tipo_uorg_seq", "unid_organizacional_nivel1_id_unid_organizacional_nivel1_seq", "unid_organizacional_nivel1a_id_unid_organizacional_nivel1a_seq", "unid_organizacional_nivel2_id_unid_organizacional_nivel2_seq", "uorg_id_uorg_seq", "usb_log_id_usb_log_seq", "usuario_id_usuario_seq"); foreach ($lista_sequencias as $tabela) { // Atualiza as sequencias de auto-increment $dbcon->exec("SELECT nextval('{$tabela}')"); } } // Execuções echo "Iniciando importação...<br>"; $zipfile = "../src/Cacic/CommonBundle/Resources/data/importacao.zip"; $tmpdir = sys_get_temp_dir(); // Extrai os arquivos necessarios para a importação $zip = new ZipArchive(); $x = $zip->open($zipfile); echo "extraindo arquivo..."; if ($x === TRUE) { $zip->extractTo($tmpdir . '/importacao'); $zip->close(); echo " feito.<br>"; } else { die("<br>Erro na extração do arquivo: {$x}"); } // Importa os dados para o postgres $dbcon->exec("begin"); importar($dbcon, $tmpdir); $dbcon->exec("end"); atualizar_seq($dbcon); // Deleta os arquivos foreach (glob($tmpdir . '/importacao/*') as $filename) { unlink($filename); } rmdir($tmpdir . "/importacao"); // Fecha conexão com o banco $dbcon = null; return $this->redirect($this->generateUrl('cacic_migracao_cacic26')); }
use Slim\Views\TwigExtension; /** * Register the Twig package in the Slim * configuration. * * @var Slim\Views\Twig */ $view = $app->view(new Twig()); /** * Set the template directory where all of * the views are going to be resolved. */ $view->setTemplatesDirectory(VIEWS_PATH); /** * Gets the configuration from the database * configuration file. * * @var array */ $config = getconfig('template'); /** * Configurates the parser options. * * @var array */ $view->parserOptions = ['debug' => $config['debug']]; /** * Configurates the parser extensions. * @var array */ $view->parserExtensions = [new TwigExtension()];
<?php echo 'Creating account...'; require_once './getpassword.php'; $password = getpassword(); require_once 'getconfig.php'; $handle = getconfig('username'); if (!file_exists('./publishserver.conf.php')) { echo 'publish server is not set, using server as a fallback.' . "\n"; $publishserver = getconfig('server'); } else { $publishserver = getconfig('publishserver'); } $ch = curl_init($publishserver . '/?accountcreator=accountcreator'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, array('password' => $password, 'username' => $handle)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch) . "\n"; curl_close($ch);
?> <center> <table border=1><tr bgcolor="#006666"><td><center> <font color="#FFFFFF">Program Listing</font> </center></td></tr><tr bgcolor="#E0E0E0"><td> <table border=0> <tr> <td>Station</td><td>Program</td><td>Start</td><td>Stop</td><td>Record</td> </tr> <?php /* long query that shows every program of station $station (this shows no manual recorded programs (flag=0) */ $collectorid = getconfig("collectorid"); $query = "select station.sname,program.pname,DATE_FORMAT(start,'%H:%i'),DATE_FORMAT(stop,'%H:%i'),program.record,program.pid,program.sid,program.flag from program,station where (UNIX_TIMESTAMP(start) <= UNIX_TIMESTAMP(NOW())) and (UNIX_TIMESTAMP(NOW()) < UNIX_TIMESTAMP(stop)) and program.sid=station.sid and station.collectorid={$collectorid} ORDER BY station.sname"; if ($MOVIE == 1) { $query = "select station.sname,program.pname,DATE_FORMAT(start,'%H:%i'),DATE_FORMAT(stop,'%H:%i'),program.record,program.pid,program.sid,program.flag from program,station where (UNIX_TIMESTAMP(start) <= UNIX_TIMESTAMP(NOW())) and (UNIX_TIMESTAMP(NOW()) < UNIX_TIMESTAMP(stop)) and program.sid=station.sid and flag=3 and station.collectorid={$collectorid} order by station.sname"; } if ($MOVIE == 2) { $query = "select station.sname,program.pname,DATE_FORMAT(start,'%H:%i'),DATE_FORMAT(stop,'%H:%i'),program.record,program.pid,program.sid,program.flag from program,station where flag=3 and program.sid=station.sid and station.collectorid={$collectorid} order by station.sname,pid"; } $result = $sql->query($query); if (!$sql->results($result)) { print "\n\t\t<tr>\n\t\t\t<td colspan=4 align=center>\n\t\t\t\t<I>No programs currently listed.</I>\n\t\t\t</td>\n\t\t</tr>\n\t"; } else { while ($blah = $sql->fetch_array($result)) { print "\n\t\t\t<tr>\n\t\t\t\t<td><a href=\"show.php?station={$blah['6']}\">{$blah['0']}</a></td>\n\t\t\t\t"; if ($blah[7] == 3) { # flag 3 is set, it's a movie!