本文整理汇总了PHP中w2PgetConfig函数的典型用法代码示例。如果您正苦于以下问题:PHP w2PgetConfig函数的具体用法?PHP w2PgetConfig怎么用?PHP w2PgetConfig使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了w2PgetConfig函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getEventLinks
/**
* Sub-function to collect events within a period
* @param Date the starting date of the period
* @param Date the ending date of the period
* @param array by-ref an array of links to append new items to
* @param int the length to truncate entries by
* @author Andrew Eddie <eddieajau@users.sourceforge.net>
*/
function getEventLinks($startPeriod, $endPeriod, &$links, $strMaxLen, $minical = false)
{
global $event_filter;
$events = CEvent::getEventsForPeriod($startPeriod, $endPeriod, $event_filter);
$cwd = explode(',', w2PgetConfig('cal_working_days'));
// assemble the links for the events
foreach ($events as $row) {
$start = new CDate($row['event_start_date']);
$end = new CDate($row['event_end_date']);
$date = $start;
for ($i = 0, $i_cmp = $start->dateDiff($end); $i <= $i_cmp; $i++) {
// the link
// optionally do not show events on non-working days
if ($row['event_cwd'] && in_array($date->getDayOfWeek(), $cwd) || !$row['event_cwd']) {
if ($minical) {
$link = array();
} else {
$url = '?m=calendar&a=view&event_id=' . $row['event_id'];
$link['href'] = '';
$link['alt'] = '';
$link['text'] = w2PtoolTip($row['event_title'], getEventTooltip($row['event_id']), true) . w2PshowImage('event' . $row['event_type'] . '.png', 16, 16, '', '', 'calendar') . '</a> ' . '<a href="' . $url . '"><span class="event">' . $row['event_title'] . '</span></a>' . w2PendTip();
}
$links[$date->format(FMT_TIMESTAMP_DATE)][] = $link;
}
$date = $date->getNextDay();
}
}
}
示例2: testW2PgetConfig
public function testW2PgetConfig()
{
global $w2Pconfig;
$this->assertEquals('web2project.net', w2PgetConfig('site_domain'));
$this->assertEquals(null, w2PgetConfig('NotGonnaBeThere'));
$this->assertEquals('Some Default', w2PgetConfig('NotGonnaBeThere', 'Some Default'));
}
示例3: db_connect
function db_connect($host = 'localhost', $dbname, $user = 'root', $passwd = '', $persist = false)
{
global $db, $ADODB_FETCH_MODE;
switch (strtolower(trim(w2PgetConfig('dbtype')))) {
case 'oci8':
case 'oracle':
if ($persist) {
$db->PConnect($host, $user, $passwd, $dbname) or die('FATAL ERROR: Connection to database server failed');
} else {
$db->Connect($host, $user, $passwd, $dbname) or die('FATAL ERROR: Connection to database server failed');
}
if (!defined('ADODB_ASSOC_CASE')) {
define('ADODB_ASSOC_CASE', 0);
}
break;
default:
//mySQL
if ($persist) {
$db->PConnect($host, $user, $passwd, $dbname) or die('FATAL ERROR: Connection to database server failed');
} else {
$db->Connect($host, $user, $passwd, $dbname) or die('FATAL ERROR: Connection to database server failed');
}
}
$ADODB_FETCH_MODE = ADODB_FETCH_BOTH;
}
示例4: __construct
/**
* Object constructor to set table and key field
*
* Can be overloaded/supplemented by the child class
* @param string $table name of the table in the db schema relating to child class
* @param string $key name of the primary key field in the table
*/
public function __construct($table, $key)
{
$this->_tbl = $table;
$this->_tbl_key = $key;
$this->_tbl_prefix = w2PgetConfig('dbprefix', '');
$this->_query = new DBQuery();
}
示例5: index
/**
* parse file for indexing
* @todo convert to using the FileSystem methods
*/
public function index(CFile $file)
{
/* Workaround for indexing large files:
** Based on the value defined in config data,
** files with file_size greater than specified limit
** are not indexed for searching.
** Negative value :<=> no filesize limit
*/
$index_max_file_size = w2PgetConfig('index_max_file_size', 0);
if ($file->file_size > 0 && ($index_max_file_size < 0 || (int) $file->file_size <= $index_max_file_size * 1024)) {
// get the parser application
$parser = w2PgetConfig('parser_' . $file->file_type);
if (!$parser) {
$parser = w2PgetConfig('parser_default');
}
if (!$parser) {
return false;
}
// buffer the file
$file->_filepath = W2P_BASE_DIR . '/files/' . $file->file_project . '/' . $file->file_real_filename;
if (file_exists($file->_filepath)) {
$fp = fopen($file->_filepath, 'rb');
$x = fread($fp, $file->file_size);
fclose($fp);
$ignore = w2PgetSysVal('FileIndexIgnoreWords');
$ignore = $ignore['FileIndexIgnoreWords'];
$ignore = explode(',', $ignore);
$x = strtolower($x);
$x = preg_replace("/[^A-Za-z0-9 ]/", "", $x);
foreach ($ignore as $ignoreWord) {
$x = str_replace(" {$ignoreWord} ", ' ', $x);
}
$x = str_replace(' ', ' ', $x);
$words = explode(' ', $x);
foreach ($words as $index => $word) {
if ('' == trim($word)) {
continue;
}
$q = $this->query;
$q->addTable('files_index');
$q->addInsert('file_id', $file->file_id);
$q->addInsert('word', $word);
$q->addInsert('word_placement', $index);
$q->exec();
$q->clear();
}
} else {
//TODO: if the file doesn't exist.. should we delete the db record?
}
}
$file->file_indexed = 1;
$file->store();
return count($words);
}
示例6: __construct
/**
* Object constructor to set table and key field
*
* Can be overloaded/supplemented by the child class
* @param string $table name of the table in the db schema relating to child class
* @param string $key name of the primary key field in the table
* @param (OPTIONAL) string $module name as stored in the 'mod_directory' of the 'modules' table, and the 'value' field of the 'gacl_axo' table.
* It is used for permission checking in situations where the table name is different from the module folder name.
* For compatibility sake this variable is set equal to the $table if not set as failsafe.
*/
public function __construct($table, $key, $module = '')
{
$this->_tbl = $table;
$this->_tbl_key = $key;
if ($module) {
$this->_tbl_module = $module;
} else {
$this->_tbl_module = $table;
}
$this->_tbl_prefix = w2PgetConfig('dbprefix', '');
$this->_query = new w2p_Database_Query();
}
示例7: connect
public function connect($host = 'localhost', $dbname, $user = 'root', $passwd = '', $persist = false)
{
global $ADODB_FETCH_MODE;
switch (strtolower(trim(w2PgetConfig('dbtype')))) {
default:
//mySQL
if ($persist) {
$this->db->PConnect($host, $user, $passwd, $dbname) or die('FATAL ERROR: Connection to database server failed');
} else {
$this->db->Connect($host, $user, $passwd, $dbname) or die('FATAL ERROR: Connection to database server failed');
}
}
$ADODB_FETCH_MODE = ADODB_FETCH_BOTH;
}
示例8: __construct
/**
* Constructor
* @param string The base URL query string to prefix tab links
* @param string The base path to prefix the include file
* @param int The active tab
* @param string Optional javascript method to be used to execute tabs.
* Must support 2 arguments, currently active tab, new tab to activate.
*/
public function __construct($baseHRef = '', $baseInc = '', $active = 0, $javascript = null)
{
global $AppUI, $currentTabId, $currentTabName, $m, $a;
$this->_AppUI = $AppUI;
$this->currentTabId = $currentTabId;
$this->currentTabName = $currentTabName;
$this->m = $m;
$this->a = $a;
$this->tabs = array();
$this->active = $active;
$this->baseHRef = $baseHRef ? $baseHRef . '&' : '?';
$this->javascript = $javascript;
$this->baseInc = $baseInc;
$this->_uistyle = $this->_AppUI->getPref('UISTYLE') ? $this->_AppUI->getPref('UISTYLE') : w2PgetConfig('host_style');
if (!$this->_uistyle) {
$this->_uistyle = 'web2project';
}
}
示例9: sendNewPass
function sendNewPass()
{
global $AppUI;
$_live_site = w2PgetConfig('base_url');
$_sitename = w2PgetConfig('company_name');
// ensure no malicous sql gets past
$checkusername = trim(w2PgetParam($_POST, 'checkusername', ''));
$checkusername = db_escape($checkusername);
$confirmEmail = trim(w2PgetParam($_POST, 'checkemail', ''));
$confirmEmail = strtolower(db_escape($confirmEmail));
$q = new DBQuery();
$q->addTable('users');
$q->addJoin('contacts', '', 'user_contact = contact_id', 'inner');
$q->addQuery('user_id');
$q->addWhere('user_username = \'' . $checkusername . '\'');
$q->addWhere('LOWER(contact_email) = \'' . $confirmEmail . '\'');
if (!($user_id = $q->loadResult()) || !$checkusername || !$confirmEmail) {
$AppUI->setMsg('Invalid username or email.', UI_MSG_ERROR);
$AppUI->redirect();
}
$newpass = makePass();
$message = $AppUI->_('sendpass0', UI_OUTPUT_RAW) . ' ' . $checkusername . ' ' . $AppUI->_('sendpass1', UI_OUTPUT_RAW) . ' ' . $_live_site . ' ' . $AppUI->_('sendpass2', UI_OUTPUT_RAW) . ' ' . $newpass . ' ' . $AppUI->_('sendpass3', UI_OUTPUT_RAW);
$subject = $_sitename . ' :: ' . $AppUI->_('sendpass4', UI_OUTPUT_RAW) . ' - ' . $checkusername;
$m = new Mail();
// create the mail
$m->To($confirmEmail);
$m->Subject($subject);
$m->Body($message, isset($GLOBALS['locale_char_set']) ? $GLOBALS['locale_char_set'] : '');
// set the body
$m->Send();
// send the mail
$newpass = md5($newpass);
$q->addTable('users');
$q->addUpdate('user_password', $newpass);
$q->addWhere('user_id=' . $user_id);
$cur = $q->exec();
if (!$cur) {
die('SQL error' . $database->stderr(true));
} else {
$AppUI->setMsg('New User Password created and emailed to you');
$AppUI->redirect();
}
}
示例10: calcDuration
function calcDuration($start_date, $start_hour, $start_minute, $end_date, $end_hour, $end_minute, $duration_type)
{
$year = substr($start_date, 0, 4);
$month = substr($start_date, 4, 2);
$day = substr($start_date, 6, 2);
$startDate = new w2p_Utilities_Date($year . '-' . $month . '-' . $day);
$startDate->setTime($start_hour, $start_minute);
$year = substr($end_date, 0, 4);
$month = substr($end_date, 4, 2);
$day = substr($end_date, 6, 2);
$endDate = new w2p_Utilities_Date($year . '-' . $month . '-' . $day);
$endDate->setTime($end_hour, $end_minute);
$duration = $startDate->calcDuration($endDate);
if (intval($duration_type) == 24) {
$workHours = intval(w2PgetConfig('daily_working_hours'));
$duration = $duration / $workHours;
}
$response = new xajaxResponse();
$response->assign('task_duration', 'value', $duration);
return $response;
}
示例11: isset
<?php
echo '</a>';
?>
</table>
</td>
</tr>
<tr id="files" <?php
echo isset($view_options[0]['pd_option_view_files']) ? $view_options[0]['pd_option_view_files'] ? 'style="visibility:visible;display:"' : 'style="visibility:collapse;display:none"' : 'style="visibility:visible;display:"';
?>
>
<td colspan="2" class="hilite">
<?php
//Permission check here
$canViewFiles = $perms->checkModule('files', 'view');
if ($canViewFiles) {
require w2PgetConfig('root_dir') . '/modules/projectdesigner/vw_files.php';
} else {
echo $AppUI->_('You do not have permission to view files');
}
?>
</td>
</tr>
</table>
<div style="display:none;">
<table class="tbl">
<tr><td id="td_sample"> </td></tr>
</table>
</div>
<script language="javascript">
var original_bgc = getStyle('td_sample', 'background-color', 'backgroundColor');
</script>
示例12: foreach
$titleBlock->addCrumb('?m=system&a=addeditpref', 'default user preferences');
$titleBlock->show();
// prepare the automated form fields based on db system configuration data
$output = null;
$last_group = '';
foreach ($rs as $c) {
$tooltip = $AppUI->_($c['config_name'] . '_tooltip');
// extraparse the checkboxes and the select lists
$extra = '';
$value = '';
switch ($c['config_type']) {
case 'select':
// Build the select list.
if ($c['config_name'] == 'system_timezone') {
$timezones = w2PgetSysVal('Timezones');
$entry = arraySelect($timezones, 'w2Pcfg[system_timezone]', 'class=text size=1', w2PgetConfig('system_timezone'), true);
} else {
$entry = '<select class="text" name="w2Pcfg[' . $c['config_name'] . ']">';
// Find the detail relating to this entry.
$children = $w2Pcfg->getChildren($c['config_id']);
foreach ($children as $child) {
$entry .= '<option value="' . $child['config_list_name'] . '"';
if ($child['config_list_name'] == $c['config_value']) {
$entry .= ' selected="selected"';
}
$entry .= '>' . $AppUI->_($child['config_list_name'] . '_item_title') . '</option>';
}
$entry .= '</select>';
}
break;
case 'checkbox':
示例13: w2PgetConfig
</table>
<table align="center" border="0" width="700" cellpadding="0" cellspacing="0" class="">
<tr>
<td style="padding-top:10px;padding-bottom:10px;" align="left" valign="top" class="txt"><h1>New Signup to web2Project!</h1>
Please enter the info below to create a new signup.</td>
</tr>
</table>
<form name="editFrm" action="./do_user_aed.php" method="post" accept-charset="utf-8">
<input type="hidden" name="user_id" value="0" />
<input type="hidden" name="contact_id" value="0" />
<input type="hidden" name="username_min_len" value="<?php
echo w2PgetConfig('username_min_len');
?>
)" />
<input type="hidden" name="password_min_len" value="<?php
echo w2PgetConfig('password_min_len');
?>
)" />
<input type="hidden" name="cid" value="<?php
echo $cid;
?>
" />
<table style="border-style:none;" align="center" border="0" width="700" cellpadding="0" cellspacing="0" class="std">
<tr><td colspan="5"><?php
echo styleRenderBoxTop();
?>
</td></tr>
<tr>
<td align="right" width="230">* <?php
echo $AppUI->_('Login Name');
示例14: w2PgetUsersHashList
$user_list = w2PgetUsersHashList();
if ($log_userfilter != 0) {
$user_list = array($log_userfilter => $user_list[$log_userfilter]);
}
$ss = "'" . $start_date->format(FMT_DATETIME_MYSQL) . "'";
$se = "'" . $end_date->format(FMT_DATETIME_MYSQL) . "'";
$and = false;
$where = false;
$q = new w2p_Database_Query();
$q->addTable('tasks', 't');
$q->addQuery('t.*');
$q->addJoin('projects', '', 'projects.project_id = task_project', 'inner');
$q->addJoin('project_departments', '', 'project_departments.project_id = projects.project_id');
$q->addJoin('departments', '', 'department_id = dept_id');
$q->addWhere('project_active = 1');
if (($template_status = w2PgetConfig('template_projects_status_id')) != '') {
$q->addWhere('project_status <> ' . (int) $template_status);
}
if ($use_period) {
$q->addWhere('( (task_start_date >= ' . $ss . ' AND task_start_date <= ' . $se . ') OR ' . '(task_end_date <= ' . $se . ' AND task_end_date >= ' . $ss . ') )');
}
if ($project_id != 0) {
$q->addWhere('task_project=' . $project_id);
}
$proj = new CProject();
$obj = new CTask();
$allowedProjects = $proj->getAllowedSQL($AppUI->user_id, 'task_project');
$allowedTasks = $obj->getAllowedSQL($AppUI->user_id);
if (count($allowedProjects)) {
$q->addWhere(implode(' AND ', $allowedProjects));
}
示例15: array
$q->clear();
$q->addQuery('ut.user_id, u.user_username');
$q->addQuery('ut.perc_assignment');
$q->addQuery('CONCAT(contact_first_name, \' \',contact_last_name) AS assignee, contact_email');
$q->addTable('user_tasks', 'ut');
$q->addJoin('users', 'u', 'u.user_id = ut.user_id', 'inner');
$q->addJoin('contacts', 'c', 'u.user_contact = c.contact_id', 'inner');
$q->addWhere('ut.task_id = ' . (int) $row['task_id']);
$q->addOrder('perc_assignment desc, contact_first_name, contact_last_name');
$assigned_users = array();
$row['task_assigned_users'] = $q->loadList();
//pull the final task row into array
$projects[$row['task_project']]['tasks'][] = $row;
}
}
$showEditCheckbox = isset($canEdit) && $canEdit && w2PgetConfig('direct_edit_assignment') ? true : false;
global $history_active;
$history_active = !empty($mods['history']) && canView('history');
?>
<script language="javascript" type="text/javascript">
function toggle_users(id){
var element = document.getElementById(id);
element.style.display = (element.style.display == '' || element.style.display == "none") ? "inline" : "none";
}
<?php
// security improvement:
// some javascript functions may not appear on client side in case of user not having write permissions
// else users would be able to arbitrarily run 'bad' functions
if (isset($canEdit) && $canEdit && $w2Pconfig['direct_edit_assignment']) {