本文整理汇总了PHP中common类的典型用法代码示例。如果您正苦于以下问题:PHP common类的具体用法?PHP common怎么用?PHP common使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了common类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upgrade
function upgrade()
{
require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "common.class.php";
require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "settings.class.php";
$common = new common();
$settings = new settings();
try {
// Set proper permissions on the SQLite file.
if ($settings::db_driver == "sqlite") {
chmod($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "data" . DIRECTORY_SEPARATOR . "portal.sqlite", 0666);
}
// Update the version and patch settings..
$common->updateSetting("version", "2.0.2");
$common->updateSetting("patch", "");
// The upgrade process completed successfully.
$results['success'] = TRUE;
$results['message'] = "Upgrade to v2.0.2 successful.";
return $results;
} catch (Exception $e) {
// Something went wrong during this upgrade process.
$results['success'] = FALSE;
$results['message'] = $e->getMessage();
return $results;
}
}
示例2: display
function display(&$pageData)
{
$common = new common($this);
// Check if the portal is installed or needs upgraded.
$thisVersion = "2.5.0";
if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/classes/settings.class.php")) {
header("Location: /install/install.php");
} elseif ($common->getSetting("version") != $thisVersion) {
header("Location: /install/upgrade.php");
}
// The Base URL of this page (needed for Plane Finder client link)
$pageData['baseurl'] = $common->getBaseUrl();
// Load the master template along with required data for the master template..
$master = $this->readTemplate('master.tpl');
require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "links.class.php";
$links = new links();
$pageData['links'] = $links->getAllLinks();
// Load the template for the requested page.
$page = $this->readTemplate($common->removeExtension($_SERVER["SCRIPT_NAME"]) . '.tpl');
$output = $this->mergeAreas($master, $page);
$output = $this->mergeSettings($output);
$output = $this->mergePageData($output, $pageData);
$output = $this->processIfs($output, $pageData);
$output = $this->processForeach($output, $pageData);
$output = $this->processFors($output, $pageData);
$output = $this->processWhiles($output, $pageData);
$output = $this->removeComments($output);
// Insert page ID mainly used to mark an active navigation link when using Bootstrap.
$output = str_replace("{template:pageId}", $common->removeExtension($_SERVER["SCRIPT_NAME"]) . "-link", $output);
echo $output;
}
示例3: getOrganizations
private function getOrganizations()
{
// Common functions
$common = new common();
// Ldap Connections
$ldap = $common->ldapConnect($this->ldap_host, $this->ldap_root_dn, $this->ldap_root_pw);
if ($ldap) {
$filter = "objectClass=organizationalUnit";
$justthese = array("ou");
$search = ldap_list($ldap, $this->ldap_context, $filter, $justthese);
$entry = ldap_get_entries($ldap, $search);
}
if ($entry['count'] > 0) {
foreach ($entry as $tmp) {
if ($tmp['ou'][0] != "") {
$result_ou[] = $tmp['ou'][0];
}
}
} else {
$result_ou[] = $this->ldap_context;
}
natcasesort($result_ou);
ldap_close($ldap);
return $result_ou ? $result_ou : '';
}
示例4: getVisibleFlights
function getVisibleFlights()
{
require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "settings.class.php";
require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "common.class.php";
$settings = new settings();
$common = new common();
// Get all flights to be notified about from the flightNotifications.xml file.
$lookingFor = array();
if ($settings::db_driver == "xml") {
// XML
$savedFlights = simplexml_load_file($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "data" . DIRECTORY_SEPARATOR . "flightNotifications.xml");
foreach ($savedFlights as $savedFlight) {
$lookingFor[] = array($savedFlight);
}
} else {
// PDO
$dbh = $common->pdoOpen();
$sql = "SELECT flight, lastMessageCount FROM " . $settings::db_prefix . "flightNotifications";
$sth = $dbh->prepare($sql);
$sth->execute();
$lookingFor = $sth->fetchAll();
$sth = NULL;
$dbh = NULL;
}
// Check dump1090-mutability's aircraft JSON output to see if the flight is visible.
$visibleFlights = array();
$url = "http://localhost/dump1090/data/aircraft.json";
$json = file_get_contents($url);
$data = json_decode($json, true);
foreach ($data['aircraft'] as $aircraft) {
if (array_key_exists('flight', $aircraft)) {
$visibleFlights[] = strtoupper(trim($aircraft['flight']));
}
}
$foundFlights = array();
$foundFlights['tracking'] = '';
foreach ($lookingFor as $flight) {
if (strpos($flight[0], "%") !== false) {
$searchFor = str_replace("%", "", $flight[0]);
foreach ($visibleFlights as $visible) {
// Still needs to be modified to send data using the new format as done below.
if (strpos(strtolower($visible), strtolower($searchFor)) !== false) {
$foundFlights[] = $visible;
}
}
} else {
if (in_array($flight[0], $visibleFlights)) {
$thisFlight['flight'] = $flight[0];
$thisFlight['lastMessageCount'] = $flight[1];
$foundFlights['tracking'][] = $thisFlight;
}
}
}
return json_decode(json_encode((array) $foundFlights), true);
}
示例5: photo
function photo()
{
$objConfig = new config();
$objCommon = new common();
$this->domainPath = "http://" . $_SERVER['HTTP_HOST'] . "/";
$this->fullPath = $_SERVER['DOCUMENT_ROOT'] . "/";
$this->uploadDir = $_SERVER['DOCUMENT_ROOT'] . "/userimages/";
$this->imageQuality = $objCommon->getConfigValue("imageQuality");
$this->error = "";
$this->mysql = new mysql();
}
示例6: upgrade
function upgrade()
{
require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "common.class.php";
require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "settings.class.php";
$common = new common();
$settings = new settings();
try {
// Add the positions.aircraft column if the portal is using MySQL or SQLite database.
if ($settings::db_driver == "mysql") {
// Check to see if the column already exists.
$dbh = $common->pdoOpen();
if (count($dbh->query("SHOW COLUMNS FROM `" . $settings::db_prefix . "positions` LIKE 'aircraft'")->fetchAll()) == 0) {
// Add the column if it does not exist.
$sql = "ALTER TABLE " . $settings::db_prefix . "positions ADD COLUMN aircraft BIGINT";
$sth = $dbh->prepare($sql);
$sth->execute();
$sth = NULL;
}
$dbh = NULL;
}
if ($settings::db_driver == "sqlite") {
// Check to see if the column already exists.
$dbh = $common->pdoOpen();
$columns = $dbh->query("pragma table_info(positions)")->fetchArray(SQLITE3_ASSOC);
$columnExists = FALSE;
foreach ($columns as $column) {
if ($column['name'] == 'lastSeen') {
$columnExists = TRUE;
}
}
// Add the column if it does not exist.
if (!$columnExists) {
$sql = "ALTER TABLE " . $settings::db_prefix . "positionss ADD COLUMN aircraft BIGINT";
$sth = $dbh->prepare($sql);
$sth->execute();
$sth = NULL;
}
$dbh = NULL;
}
// Update the version and patch settings..
$common->updateSetting("version", "2.1.0");
$common->updateSetting("patch", "");
// The upgrade process completed successfully.
$results['success'] = TRUE;
$results['message'] = "Upgrade to v2.1.0 successful.";
return $results;
} catch (Exception $e) {
// Something went wrong during this upgrade process.
$results['success'] = FALSE;
$results['message'] = $e->getMessage();
return $results;
}
}
示例7: pageContent
function pageContent()
{
$common = new common();
global $posts, $pageLinks, $previewLength;
?>
<div class="container">
<h1>Blog Posts</h1>
<hr />
<?php
foreach ($posts as $post) {
?>
<h2><a href="post.php?title=<?php
echo urlencode($post['title']);
?>
"><?php
echo $post['title'];
?>
</a></h2>
<p>Posted <strong><?php
echo date_format(date_create($post['date']), "F jS, Y");
?>
</strong> by <strong><?php
echo $post['author'];
?>
</strong>.</p>
<div><?php
echo substr($common->removeHtmlTags($post['contents']), 0, $previewLength);
?>
</div>
<?php
}
?>
<ul class="pagination">
<?php
$i = 1;
while ($i <= $pageLinks) {
?>
<li><a href="?page=<?php
echo $i;
?>
"><?php
echo $i;
?>
</a></li>
<?php
$i++;
}
?>
</ul>
</div>
<?php
}
示例8: upgrade
function upgrade()
{
require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "common.class.php";
require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "settings.class.php";
$common = new common();
$settings = new settings();
try {
// Change tables containing datetime data to datetime.
if ($settings::db_driver != "mysql") {
$dbh = $common->pdoOpen();
$sql = "ALTER TABLE " . $settings::db_prefix . "aircraft MODIFY firstSeen DATETIME NOT NULL";
$sth = $dbh->prepare($sql);
$sth->execute();
$sth = NULL;
$sql = "ALTER TABLE adsb_aircraft MODIFY lastSeen DATETIME NOT NULL";
$sth = $dbh->prepare($sql);
$sth->execute();
$sth = NULL;
$sql = "ALTER TABLE adsb_blogPosts MODIFY date DATETIME NOT NULL";
$sth = $dbh->prepare($sql);
$sth->execute();
$sth = NULL;
$sql = "ALTER TABLE adsb_flights MODIFY firstSeen DATETIME NOT NULL";
$sth = $dbh->prepare($sql);
$sth->execute();
$sth = NULL;
$sql = "ALTER TABLE adsb_flights MODIFY firstSeen DATETIME NOT NULL";
$sth = $dbh->prepare($sql);
$sth->execute();
$sth = NULL;
$sql = "ALTER TABLE adsb_positions MODIFY time DATETIME NOT NULL";
$sth = $dbh->prepare($sql);
$sth->execute();
$sth = NULL;
$dbh = NULL;
}
// Add timezone setting.
$common->addSetting("timeZone", date_default_timezone_get());
// update the version and patch settings.
$common->updateSetting("version", "2.0.1");
$common->updateSetting("patch", "");
// The upgrade process completed successfully.
$results['success'] = TRUE;
$results['message'] = "Upgrade to v2.0.1 successful.";
return $results;
} catch (Exception $e) {
// Something went wrong during this upgrade process.
$results['success'] = FALSE;
$results['message'] = $e->getMessage();
return $results;
}
}
示例9: photo
function photo($files)
{
$objConfig = new config();
$objCommon = new common();
$this->domainPath = $objConfig->get_domain_path();
$this->fullPath = $objConfig->get_full_domain_path();
$this->uploadDir = $objConfig->get_upload_dir();
$this->imageQuality = $objCommon->getConfigValue("imageQuality");
$this->files = $files;
$this->description = "";
$this->fileType = "";
$this->title = "";
$this->tags = "";
}
示例10: BlogSearch
function BlogSearch($args)
{
global $addonPathData;
$this->Init();
$search_obj = $args[0];
$label = common::GetLabelIndex('special_blog');
$full_path = $addonPathData . '/index.php';
// config of installed addon to get to know how many post files are
if (!file_exists($full_path)) {
return;
}
require $full_path;
$fileIndexMax = floor($blogData['post_index'] / 20);
// '20' I found in SimpleBlogCommon.php function GetPostFile (line 62)
for ($fileIndex = 0; $fileIndex <= $fileIndexMax; $fileIndex++) {
$postFile = $addonPathData . '/posts_' . $fileIndex . '.php';
if (!file_exists($postFile)) {
continue;
}
require $postFile;
foreach ($posts as $id => $post) {
$title = $label . ': ' . str_replace('_', ' ', $post['title']);
$content = str_replace('_', ' ', $post['title']) . ' ' . $post['content'];
SimpleBlogCommon::UrlQuery($id, $url, $query);
$search_obj->FindString($content, $title, $url, $query);
}
$posts = array();
}
}
示例11: init
/**
* initialize page elements
*
*/
function init()
{
global $locate, $config;
$objResponse = new xajaxResponse();
$objResponse->addAssign("divNav", "innerHTML", common::generateManageNav($skin, $_SESSION['curuser']['country'], $_SESSION['curuser']['language']));
$objResponse->addAssign("divCopyright", "innerHTML", common::generateCopyright($skin));
$objResponse->addScript("xajax_showGrid(0," . ROWSXPAGE . ",'','','')");
$objResponse->addAssign("btnContact", "value", $locate->Translate("contact"));
$objResponse->addAssign("btnNote", "value", $locate->Translate("note"));
$objResponse->addAssign("btnCustomerLead", "value", $locate->Translate("customer_leads"));
if ($config['system']['customer_leads'] == 'default_move' || $config['system']['customer_leads'] == 'move') {
$objResponse->addAssign("customerLeadAction", "innerHTML", "<input type=\"button\" onclick=\"xajax_customerLeadsAction('" . $config['system']['customer_leads'] . "',xajax.getFormValues('delGrid'),xajax.getFormValues('searchForm'));\" id=\"btnCustomerlead\" name=\"btnCustomerlead\" value=\"" . $locate->Translate("move_to_customerleads") . "\">");
} else {
if ($config['system']['customer_leads'] == 'default_copy' || $config['system']['customer_leads'] == 'copy') {
$objResponse->addAssign("customerLeadAction", "innerHTML", "<input type=\"button\" onclick=\"xajax_customerLeadsAction('" . $config['system']['customer_leads'] . "',xajax.getFormValues('delGrid'),xajax.getFormValues('searchForm'));\" id=\"btnCustomerlead\" name=\"btnCustomerlead\" value=\"" . $locate->Translate("copy_to_customerleads") . "\">");
} else {
$objResponse->addAssign("customerLeadAction", "innerHTML", "");
}
}
//*******
$objResponse->addAssign("by", "value", $locate->Translate("by"));
//搜索条件
$objResponse->addAssign("search", "value", $locate->Translate("search"));
//搜索内容
//*******
return $objResponse;
}
示例12: _load_agent_file
private function _load_agent_file()
{
$user_agents = common::get_config('user_agents');
// obullo changes ..
$return = FALSE;
if (isset($user_agents['platforms'])) {
$this->platforms =& $user_agents['platforms'];
unset($user_agents['platforms']);
$return = TRUE;
}
if (isset($user_agents['browsers'])) {
$this->browsers =& $user_agents['browsers'];
unset($user_agents['browsers']);
$return = TRUE;
}
if (isset($user_agents['mobiles'])) {
$this->mobiles =& $user_agents['mobiles'];
unset($user_agents['mobiles']);
$return = TRUE;
}
if (isset($user_agents['robots'])) {
$this->robots =& $user_agents['robots'];
unset($robots);
$return = TRUE;
}
return $return;
}
示例13: init
/**
* function to init import page
*
*
* @return $objResponse
*
*/
function init($fileName)
{
global $locate, $config;
$objResponse = new xajaxResponse();
$file_list = getExistfilelist();
$objResponse->addAssign('filelist', 'innerHTML', '');
$objResponse->addScript("addOption('filelist','0','" . $locate->Translate('select a existent file') . "');");
foreach ($file_list as $file) {
$objResponse->addScript("addOption('filelist','" . $file['fileid'] . "','" . $file['originalname'] . "');");
}
$tableList = "<select name='sltTable' id='sltTable' onchange='selectTable(this.value);' >\n\t\t\t\t\t\t\t\t\t\t\t<option value=''>" . $locate->Translate("selecttable") . "</option>\n\t\t\t\t\t\t\t\t\t\t\t<option value='customer'>customer</option>\n\t\t\t\t\t\t\t\t\t\t\t<option value='contact'>contact</option>\n\t\t\t\t\t\t\t\t\t\t\t<option value='diallist'>diallist</option>\n\t\t\t\t\t\t\t\t\t\t</select>";
$objResponse->addAssign("divTables", "innerHTML", $tableList);
$objResponse->addAssign("divNav", "innerHTML", common::generateManageNav($skin, $_SESSION['curuser']['country'], $_SESSION['curuser']['language']));
$objResponse->addAssign("divGrid", "innerHTML", '');
//$objResponse->addScript("xajax_showDivMainRight(document.getElementById('hidFileName').value);");
//$objResponse->loadXML(showDivMainRight($fileName));
//$objResponse->addAssign("divDiallistImport", "innerHTML", '');
$objResponse->addAssign("divCopyright", "innerHTML", common::generateCopyright($skin));
if ($_SESSION['curuser']['usertype'] == 'admin') {
// add all group
$res = astercrm::getGroups();
while ($row = $res->fetchRow()) {
$objResponse->addScript("addOption('groupid','" . $row['groupid'] . "','" . $row['groupname'] . "');");
}
} else {
// add self
$objResponse->addScript("addOption('groupid','" . $_SESSION['curuser']['groupid'] . "','" . $_SESSION['curuser']['group']['groupname'] . "');");
}
$objResponse->addScript("setCampaign();");
$objResponse->loadXML(showDivMainRight($fileName));
return $objResponse;
}
示例14: ShowCategory
function ShowCategory()
{
$this->showing_category = $this->catindex;
$catname = $this->categories[$this->catindex];
//paginate
$per_page = SimpleBlogCommon::$data['per_page'];
$page = 0;
if (isset($_GET['page']) && is_numeric($_GET['page'])) {
$page = (int) $_GET['page'];
}
$start = $page * $per_page;
$include_drafts = common::LoggedIn();
$show_posts = $this->WhichCatPosts($start, $per_page, $include_drafts);
$this->ShowPosts($show_posts);
//pagination links
echo '<p class="blog_nav_links">';
if ($page > 0) {
$html = SimpleBlogCommon::CategoryLink($this->catindex, $catname, '%s', 'page=' . ($page - 1), 'class="blog_newer"');
echo gpOutput::GetAddonText('Newer Entries', $html);
echo ' ';
}
if (($page + 1) * $per_page < $this->total_posts) {
$html = SimpleBlogCommon::CategoryLink($this->catindex, $catname, '%s', 'page=' . ($page + 1), 'class="blog_older"');
echo gpOutput::GetAddonText('Older Entries', $html);
}
echo '</p>';
}
示例15: _set_routing
private function _set_routing()
{
if (common::config_item('enable_query_strings') === TRUE and isset($_GET[config_item('controller_trigger')])) {
$this->query_string = TRUE;
$this->set_directory(trim($this->uri->_filter_uri($_GET[config_item('directory_trigger')])));
$this->set_class(trim($this->uri->_filter_uri($_GET[config_item('controller_trigger')])));
if (isset($_GET[config_item('function_trigger')])) {
$this->set_method(trim($this->uri->_filter_uri($_GET[config_item('function_trigger')])));
}
return;
}
$this->default_controller = (!isset($this->routes['default_controller']) or $this->routes['default_controller'] == '') ? FALSE : strtolower($this->routes['default_controller']);
$this->uri->_fetch_uri_string();
if ($this->uri->uri_string == '') {
if ($this->default_controller === FALSE) {
throw new Exception("Unable to determine what should be displayed. A default route has not been specified in the routing file.");
}
$segments = $this->_validate_request(explode('/', $this->default_controller));
$this->set_class($segments[1]);
$this->set_method($this->routes['index_method']);
// index
$this->uri->rsegments = $segments;
$this->uri->_reindex_segments();
//log_message('debug', "No URI present. Default controller set.");
return;
}
unset($this->routes['default_controller']);
$this->uri->_remove_url_suffix();
$this->uri->_explode_segments();
$this->_parse_routes();
$this->uri->_reindex_segments();
}