function renderFileName($fN) { global $input; $f = pathinfo($input . $fN); out($f['basename'], "Rendered", "Rendering", "\r"); renderFile($f['basename']); out($f['basename'] . ' as ' . $f['filename'] . '.html', "Rendered"); }
function renderFilesInFolder($dir) { $files = preg_grep('/^([^.])/', scandir($dir)); sort($files); echo '<div class="sg-section-group">'; foreach ($files as $file) { $path = $dir . '/' . $file; if (is_dir($path)) { renderTitleFromPath($path, 'h1'); renderFilesInFolder($path); } else { renderFile($path); } } echo '</div>'; }
function renderFilesInFolder($dir) { $files = scandir($dir); sort($files); echo '<div class="sg-section-group">'; foreach ($files as $file) { if ($file != '.' && $file != '..') { $path = $dir . '/' . $file; if (is_dir($path)) { renderTitleFromPath($path, 'h1'); renderFilesInFolder($path); } else { renderFile($path); } } } echo '</div>'; }
$info[] = isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : ''; $info[] = '<a href="http://www.yiiframework.com/">Yii Framework</a>/' . getYiiVersion(); $info[] = @strftime('%Y-%m-%d %H:%M', time()); return implode(' ', $info); } function renderFile($_file_, $_params_ = array()) { extract($_params_); require $_file_; } $result = 1; // 1: all pass, 0: fail, -1: pass with warnings foreach ($requirements as $i => $requirement) { if ($requirement[1] && !$requirement[2]) { $result = 0; } else { if ($result > 0 && !$requirement[1] && !$requirement[2]) { $result = -1; } } if ($requirement[4] === '') { $requirements[$i][4] = ' '; } } $lang = getPreferredLanguage(); $viewFile = dirname(__FILE__) . "/views/{$lang}/index.php"; if (!is_file($viewFile)) { $viewFile = dirname(__FILE__) . '/views/index.php'; } renderFile($viewFile, array('requirements' => $requirements, 'result' => $result, 'serverInfo' => getServerInfo()));
} else { list($result, $info, $target, $con) = getDBCon($dbhost, $port, $dbuser, $dbpwd); // db con check if (!$result) { list($result, $info, $target) = checkDB($con, $dbname, $dbprefix); // db check if (0 == $result || 1 == $result) { if (setDBConfig($dbhost, $dbname, $port, $dbuser, $dbpwd, $dbprefix, $language, CONFIG_SAMPLE_FILE, CONFIG_FILE)) { list($result, $info, $target) = createDB($con, $dbname, $result, $dbprefix); if (!$result) { file_put_contents('install.lock', ''); } } } else { if (2 == $result) { setDBConfig($dbhost, $dbname, $port, $dbuser, $dbpwd, $dbprefix, $language, CONFIG_SAMPLE_FILE, CONFIG_FILE); } } @mysql_close($con); } } echo json_encode(array('result' => $result, 'info' => $info, 'target' => $target)); break; case INSTALLED: $viewFile = $viewDir . 'install.php'; renderFile($viewFile); break; default: echo "Error URL"; exit; }
} else { if ($requestPath === "/") { $dbxClient = getClient(); if ($dbxClient === false) { header("Location: " . getPath("dropbox-auth-start")); exit; } $path = "/"; if (isset($_GET['path'])) { $path = $_GET['path']; } $entry = $dbxClient->getMetadataWithChildren($path); if ($entry['is_dir']) { echo renderFolder($entry); } else { echo renderFile($entry); } } else { if ($requestPath == "/download") { $dbxClient = getClient(); if ($dbxClient === false) { header("Location: " . getPath("dropbox-auth-start")); exit; } if (!isset($_GET['path'])) { header("Location: " . getPath("")); exit; } $path = $_GET['path']; $fd = tmpfile(); $metadata = $dbxClient->getFile($path, $fd);
<?php define('DS', DIRECTORY_SEPARATOR); define('PATH_ROOT', dirname(__FILE__) . DS); require PATH_ROOT . 'inc' . DS . 'common.inc.php'; $step = (int) $_GET['step']; if ($step >= 1 && $step <= 3) { $file = 'step' . $step . '.php'; } else { $file = 'index.php'; } $viewFile = PATH_ROOT . 'views' . DS . $file; $data = array('step' => $step); switch ($step) { case 1: require PATH_ROOT . 'inc' . DS . 'step1.php'; $data['result'] = $result; $data['requirements'] = $requirements; break; case 2: require PATH_ROOT . 'inc' . DS . 'step2.php'; break; case 3: break; default: break; } renderFile($viewFile, $data);
private function paymentCompletedSuccessfully() { //subscription payed successfully lats store transaction information in db //lets find previous transaction by profile id $tran = $this->findPreviousTransaction(); $queryInsert = 'insert into transaction (userid, username, propertyid, propertyname, pp_PROFILEID, PROFILESTATUS, CORRELATIONID, edt, payerid) values' . '(' . $tran->userid . ', ' . $tran->username . ', ' . $tran->propertyid . ', ' . $tran->propertyname . ', ' . $_POST['recurring_payment_id'] . ', ' . $_POST['profile_status'] . ', ' . $_POST['ipn_track_id'] . ', ' . date('Y-m-d h:i:s') . ', ' . $_POST['payer_id'] . ')'; $result = $this->mysqli->query($queryInsert); if (!$result) { die('query: ' . $queryInsert . ' errors: ' . $this->mysqli->error); } $queryUpdateRenewalDate = 'select properties where id=' . $tran->propertyid . ' LIMIT 1'; $resultProp = $this->mysqli->query($queryUpdateRenewalDate); if (!$resultProp) { die('query: ' . $resultProp . ' errors: ' . $this->mysqli->error); } $property = $resultProp->fetch_object(); if ($property) { $nowDate = new DateTime(); $nowDate->setTimestamp(strtotime('+1 year')); $queryUserLink = 'SELECT * FROM user2property WHERE propertyId = ' . $property->id . ' AND access=5 LIMIT 1'; $resultUserLink = $this->mysqli->query($queryUserLink); $userLink = $resultUserLink->fetch_object(); if ($userLink) { $queryUserObj = 'SELECT * FROM users WHERE id=' . $userLink->userId . ' LIMIT 1'; $resultUserObj = $this->mysqli->query($queryUserObj); if ($resultUserObj) { $user = $resultUserObj->fetch_object(); $bodyMsg = $this - renderFile(dirname(__FILE__) . '/protected/commands/trial/emails/renewalnotification.php', array('fullname' => $user->firstname . " " . $user->lastname, 'propertyName' => $property->property_name, 'renewDate' => $nowDate->format('F j, Y')), true); $this->mail->ClearAddresses(); $this->mail->Subject = "SharedKey.com - Renewal Notification"; $this->mail->MsgHTML($bodyMsg); $this->mail->AddAddress($user->email, $user->firstname . " " . $user->lastname); if (!$this->mail->Send()) { throw new Exception("Can't sent Renew Notification"); } } } } //information stored }