public function process(\w2p_Core_CAppUI $AppUI, array $myArray) { if (!$this->object->bind($myArray)) { $AppUI->setMsg($this->object->getError(), UI_MSG_ERROR); $this->resultPath = $this->errorPath; return $AppUI; } /** * The nonce validation only throws a warning as of v3.1 so that we don't break anyone's forms. As of v4.0 * this validation will be turned on and any form processing using this controller will have to include * the __nonce field. See http://wiki.web2project.net/index.php?title=Security_Nonce for more details. */ if ('' != $AppUI->__nonce && $AppUI->__nonce != $myArray['__nonce']) { error_log("Your submission is missing the CSRF nonce. Please see http://wiki.web2project.net/index.php?title=Security_Nonce for details."); // $AppUI->setMsg("There was an error processing the form. Please submit again.", UI_MSG_ERROR); // $AppUI->holdObject($this->object); // $this->resultPath = $this->errorPath; // return $AppUI; } $action = $this->delete ? 'deleted' : 'stored'; $this->success = $this->delete ? $this->object->delete() : $this->object->store(); if ($this->success) { $AppUI->setMsg($this->prefix . ' ' . $action, UI_MSG_OK, true); $this->resultPath = $this->successPath; } else { $AppUI->holdObject($this->object); $AppUI->setMsg($this->object->getError(), UI_MSG_ERROR); $this->resultPath = $this->errorPath; } return $AppUI; }
public function loadExtras(array &$storage, w2p_Core_CAppUI $AppUI, $m, $type = 'tabs') { //Set up extra $type if (!isset($storage['all_' . $type][$m])) { // For some reason on some systems if you don't set this up // first you get recursive pointers to the all_$type array, creating // phantom tabs. if (!isset($storage['all_' . $type])) { $storage['all_' . $type] = array(); } $storage['all_' . $type][$m] = array(); $all_items =& $storage['all_' . $type][$m]; foreach ($AppUI->getActiveModules() as $dir => $notUsed) { if (!canAccess($dir)) { continue; } $loader = new w2p_FileSystem_Loader(); $modules_items = $loader->readFiles(W2P_BASE_DIR . '/modules/' . $dir . '/', '^' . $m . '_' . substr($type, 0, -1) . '.*\\.php'); foreach ($modules_items as $item) { // Get the name as the subextension // cut the module_tab. and the .php parts of the filename // (begining and end) $nameparts = explode('.', $item); $filename = substr($item, 0, -4); if (count($nameparts) > 3) { $file = $nameparts[1]; if (!isset($all_items[$file])) { $all_items[$file] = array(); } $tabArray =& $all_items[$file]; $name = $nameparts[2]; } else { $tabArray =& $all_items; $name = $nameparts[1]; } $tabArray[] = array('name' => ucfirst(str_replace('_', ' ', $name)), 'file' => W2P_BASE_DIR . '/modules/' . $dir . '/' . $filename, 'module' => $dir); } } } else { $all_items =& $storage['all_' . $type][$m]; } }
public function process(\w2p_Core_CAppUI $AppUI, array $myArray) { if (!canEdit('users')) { $this->resultPath = ACCESS_DENIED; return $AppUI; } $action = $this->delete ? 'deleted' : 'stored'; $this->success = $this->delete ? $this->object->del_acl((int) $myArray['permission_id']) : $this->object->addUserPermission(); if ($this->success) { $AppUI->setMsg($this->prefix . ' ' . $action, UI_MSG_OK, true); $this->resultPath = $this->successPath; $this->object->recalcPermissions(null, (int) $myArray['permission_user']); } else { $AppUI->setMsg($this->object->getError(), UI_MSG_ERROR); $this->resultPath = $this->errorPath; $AppUI->holdObject($this->object); } return $AppUI; }
<?php require_once 'base.php'; require_once W2P_BASE_DIR . '/includes/config.php'; require_once W2P_BASE_DIR . '/includes/main_functions.php'; require_once W2P_BASE_DIR . '/includes/db_adodb.php'; $AppUI = new w2p_Core_CAppUI(); $updatekey = w2PgetParam($_GET, 'updatekey', 0); $updatekey = preg_replace("/[^A-Za-z0-9]/", "", $updatekey); $contact_id = CContact::getContactByUpdatekey($updatekey); $company_id = intval(w2PgetParam($_REQUEST, 'company_id', 0)); $company_name = w2PgetParam($_REQUEST, 'company_name', null); // check permissions for this record if (!$contact_id) { echo $AppUI->_('You are not authorized to use this page. If you should be authorized please contact') . ' ' . $w2Pconfig['company_name'] . ' ' . $AppUI->_('to give you another valid link, thank you.'); exit; } // load the record data $msg = ''; $row = new CContact(); if (!$row->load($contact_id) && $contact_id > 0) { $AppUI->setMsg('Contact'); $AppUI->setMsg('invalidID', UI_MSG_ERROR, true); $AppUI->redirect(); } else { //TODO: replace with the proper canEdit() if ($row->contact_private && $row->contact_owner != $AppUI->user_id && $row->contact_owner && $contact_id != 0) { // check only owner can edit $AppUI->redirect(ACCESS_DENIED); } }
<?php /* $Id$ $URL$ */ require_once 'base.php'; require_once W2P_BASE_DIR . '/includes/config.php'; require_once W2P_BASE_DIR . '/includes/main_functions.php'; require_once W2P_BASE_DIR . '/includes/db_adodb.php'; require_once W2P_BASE_DIR . '/classes/ui.class.php'; $AppUI = new w2p_Core_CAppUI(); $updatekey = w2PgetParam($_POST, 'updatekey', 0); $contact_id = (int) CContact::getContactByUpdatekey($updatekey); if (!$contact_id) { echo $AppUI->_('You are not authorized to use this page. If you should be authorized please contact the sender to give you another valid link, thank you.'); exit; } $contact = new CContact(); if (!$contact->bind($_POST)) { $msg = $AppUI->_('There was an error recording your contact data, please contact the system administrator. Thank you very much.'); } else { $result = $contact->store(); if (is_array($result)) { $msg = $AppUI->_('There was an error recording your contact data, please contact the system administrator. Thank you very much.'); } else { $custom_fields = new w2p_Core_CustomFields('contacts', 'addedit', $contact->contact_id, 'edit', 1); $custom_fields->bind($_POST); $custom_fields->store($contact->contact_id); $contact->clearUpdateKey(); $msg = $AppUI->_('Your contact data has been recorded successfully. Your may now close your browser window. Thank you very much, ' . $contact->contact_first_name); } } ?>
<?php /* $Id$ $URL$ */ if (!isset($AppUI)) { $AppUI = new w2p_Core_CAppUI(); } require_once $AppUI->getLibraryClass('PEAR/BBCodeParser'); $bbparser = new HTML_BBCodeParser(); $filters = array('- Filters -'); if (isset($a) && $a == 'viewer') { array_push($filters, 'My Watched', 'Last 30 days'); } else { array_push($filters, 'My Forums', 'My Watched', 'My Projects', 'My Company', 'Inactive Projects'); } class CForum extends w2p_Core_BaseObject { public $forum_id = null; public $forum_project = null; public $forum_status = null; public $forum_owner = null; public $forum_name = null; public $forum_create_date = null; public $forum_last_date = null; public $forum_last_id = null; public $forum_message_count = null; public $forum_description = null; public $forum_moderated = null; public function __construct() { parent::__construct('forums', 'forum_id'); }
/** @deprecated */ function clash_cancel(w2p_Core_CAppUI $AppUI) { trigger_error(__FUNCTION__ . " has been deprecated in v3.2 and will be removed in v5.0. There is no replacement.", E_USER_NOTICE); $AppUI->redirect('m=events'); }
public function hook_cron() { if (w2PgetConfig('system_update_check', true)) { $lastCheck = w2PgetConfig('system_update_last_check', ''); $nowDate = new DateTime("now"); if ('' == $lastCheck) { $checkForUpdates = true; } else { $systemDate = new DateTime($lastCheck); $difference = 0; //$nowDate->diff($systemDate)->format('%d'); $checkForUpdates = $difference >= 7 ? true : false; } if ($checkForUpdates) { $AppUI = new w2p_Core_CAppUI(); $configList = array(); $moduleList = $AppUI->getLoadableModuleList(); foreach ($moduleList as $module) { $configList[$module['mod_directory']] = $module['mod_version']; } $configList['w2p_ver'] = $AppUI->getVersion(); $configList['php_ver'] = PHP_VERSION; $configList['database'] = $this->_w2Pconfig['dbtype']; $configList['server'] = $_SERVER['SERVER_SOFTWARE']; $configList['connector'] = php_sapi_name(); $configList['database_ver'] = mysql_get_client_info(); $libraries = array('tidy', 'json', 'libxml', 'mysql'); foreach ($libraries as $library) { $configList[$library . '_extver'] = phpversion($library); } if (function_exists('gd_info')) { $lib_version = gd_info(); $configList['gd_extver'] = $lib_version['GD Version']; } if (function_exists('curl_version')) { $lib_version = curl_version(); $configList['curl_extver'] = $lib_version['version']; } $request = new w2p_Utilities_HTTPRequest('http://stats.web2project.net'); $request->addParameters($configList); $result = $request->processRequest(); $data = json_decode($result); $q = new w2p_Database_Query(); $q->addTable('config'); if ('' == w2PgetConfig('available_version', '')) { $q->addInsert('config_name', 'available_version'); $q->addInsert('config_value', $data->w2p_ver); $q->addInsert('config_group', 'admin_system'); $q->addInsert('config_type', 'text'); } else { $q->addUpdate('config_value', $data->w2p_ver); $q->addWhere("config_name = 'available_version'"); } $q->exec(); $q->clear(); $q->addTable('config'); $q->addUpdate('config_value', date('Y-m-d H:i:s')); $q->addWhere("config_name = 'system_update_last_check'"); $q->exec(); } } }
global $w2p_performance_old_dbqueries; global $AppUI; require_once '../base.php'; require_once W2P_BASE_DIR . '/includes/main_functions.php'; require_once W2P_BASE_DIR . '/includes/config.php'; require_once W2P_BASE_DIR . '/includes/db_adodb.php'; /* * Need this to not get the annoying timezone warnings in tests. */ $defaultTZ = w2PgetConfig('system_timezone', 'UTC'); $defaultTZ = '' == $defaultTZ ? 'UTC' : $defaultTZ; date_default_timezone_set($defaultTZ); /* * Need this to test actions that require permissions. */ $AppUI = new w2p_Core_CAppUI(); $_POST['login'] = '******'; $_REQUEST['login'] = '******'; $AppUI->login('admin', 'passwd'); $AppUI->user_email = '*****@*****.**'; class CommonSetup extends PHPUnit_Framework_TestCase { protected $backupGlobals = false; protected $obj = null; protected $post_data = array(); protected $mockDB = null; protected $_AppUI = null; protected function setUp() { parent::setUp(); global $AppUI;
public function store(w2p_Core_CAppUI $AppUI) { $perms = $AppUI->acl(); $stored = false; $errorMsgArray = $this->check(); if (count($errorMsgArray) > 0) { return $errorMsgArray; } $q = new w2p_Database_Query(); $this->w2PTrimAll(); if ($this->planner_id && $perms->checkModuleItem('planner', 'edit', $this->planner_id)) { if ($msg = parent::store()) { return $msg; } $stored = true; } if (0 == $this->planner_id && $perms->checkModuleItem('planner', 'add')) { if ($msg = parent::store()) { return $msg; } $stored = true; } return $stored; }
<?php require_once 'base.php'; require_once W2P_BASE_DIR . '/includes/config.php'; require_once W2P_BASE_DIR . '/includes/main_functions.php'; require_once W2P_BASE_DIR . '/includes/db_adodb.php'; $AppUI = new w2p_Core_CAppUI(); if (w2PgetConfig('activate_external_user_creation') != 'true') { echo $AppUI->_('You should not access this file directly'); die; } $uistyle = 'web2project'; ?> <!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" xml:lang="en" lang="en"> <head> <title><?php echo $AppUI->_('New User Signup'); ?> </title> <meta http-equiv="Content-Type" content="text/html;charset=<?php echo 'UTF-8'; ?> " /> <meta http-equiv="Pragma" content="no-cache" /> <link rel="stylesheet" type="text/css" href="./style/common.css" media="all" charset="utf-8"/> <link rel="stylesheet" type="text/css" href="./style/<?php echo $uistyle; ?> /main.css" media="all" charset="utf-8"/>
<?php // Function to scan the event queue and execute any functions required. require_once 'base.php'; require_once W2P_BASE_DIR . '/includes/config.php'; require_once W2P_BASE_DIR . '/includes/main_functions.php'; require_once W2P_BASE_DIR . '/includes/db_adodb.php'; $defaultTZ = w2PgetConfig('system_timezone', 'UTC'); date_default_timezone_set($defaultTZ); $AppUI = new w2p_Core_CAppUI(); $AppUI->setUserLocale(); $queue = new w2p_System_EventQueue(); $queue->scan(); /* This is the first piece of a simple hook system to allow for regularly scheduled maintenance tasks to occur. This could be data validation and cleanup, sending email notifications, or workflow related tasks. */ $hooks = new w2p_System_HookHandler($AppUI); $hooks->process('cron');
<?php if (!defined('W2P_BASE_DIR')) { die('You should not access this file directly'); } require_once W2P_BASE_DIR . '/lib/captcha/Functions.php'; require_once W2P_BASE_DIR . '/style/' . $uistyle . '/overrides.php'; $AppUI = new w2p_Core_CAppUI(); /* Re-Generating variables for html form... */ $rnd = strtoupper(rnd_string()); $uid = urlencode(md5_encrypt($rnd)); $cid = md5_encrypt($rnd); $msg = w2PgetParam($_GET, 'msg', ''); switch ($msg) { case '': //No message, do nothing break; case 'data': $msg = "You didn't provide the correct Anti Spam Security ID or all required data. Please try again."; break; case 'spam': $msg = "You didn't provide the Anti Spam Security ID. Please try again."; break; case 'existing-user': $msg = 'The username you selected already exists, please select another or if that user name is yours request the password recovery through the dedicated link.'; break; case 'existing-email': $msg = 'The email you selected already exists, please select another or if that email is yours request the password recovery through the dedicated link.'; break;
<?php require_once 'base.php'; require_once W2P_BASE_DIR . '/includes/config.php'; require_once W2P_BASE_DIR . '/includes/main_functions.php'; require_once W2P_BASE_DIR . '/includes/db_adodb.php'; $AppUI = new w2p_Core_CAppUI(); if (w2PgetConfig('activate_external_user_creation') != 'true') { echo $AppUI->_('You should not access this file directly'); die; } $uistyle = $AppUI->getPref('UISTYLE') ? $AppUI->getPref('UISTYLE') : w2PgetConfig('host_style'); ?> <!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" xml:lang="en" lang="en"> <head> <title><?php echo $AppUI->_('New User Signup'); ?> </title> <meta http-equiv="Content-Type" content="text/html;charset=<?php echo 'UTF-8'; ?> " /> <meta http-equiv="Pragma" content="no-cache" /> <link rel="stylesheet" type="text/css" href="./style/common.css" media="all" charset="utf-8"/> <link rel="stylesheet" type="text/css" href="./style/<?php echo $uistyle; ?> /main.css" media="all" charset="utf-8"/>
<?php /* $Id$ $URL$ */ require_once 'base.php'; if (!defined('W2P_BASE_DIR')) { die('You should not access this file directly'); } require_once W2P_BASE_DIR . '/includes/config.php'; require_once W2P_BASE_DIR . '/includes/main_functions.php'; require_once W2P_BASE_DIR . '/includes/db_adodb.php'; $AppUI = new w2p_Core_CAppUI(); require_once $AppUI->getLibraryClass('captcha/Functions'); $defaultTZ = w2PgetConfig('system_timezone', 'Europe/London'); $defaultTZ = '' == $defaultTZ ? 'Europe/London' : $defaultTZ; date_default_timezone_set($defaultTZ); /* CAPTCHA control condition... */ $passed = false; if (strlen($_POST['spam_check']) > 0) { $cid = md5_decrypt($_POST['cid']); if ($cid == strtoupper($_POST['spam_check'])) { $passed = true; } else { echo "<script language='javascript'>\n alert('Error: You didn\\'t provide the correct Anti Spam Security ID or all required data. Please try again.');\n history.go(-1);\n\t </script>"; exit; } } else { echo "\n <script language='javascript'>\n alert('Error: You didn\\'t provide the Anti Spam Security ID. Please try again.');\n history.go(-1);\n </script>\n "; exit; }
/** * @deprecated */ public static function renderColumn(w2p_Core_CAppUI $AppUI, $fieldName, $row) { global $w2Pconfig; trigger_error("The static method renderColumn has been deprecated and will be removed by v4.0.", E_USER_NOTICE); $last_underscore = strrpos($fieldName, '_'); $suffix = $last_underscore !== false ? substr($fieldName, $last_underscore) : $fieldName; switch ($suffix) { case '_creator': case '_owner': $s .= w2PgetUsernameFromID($row[$fieldName]); break; case '_budget': $s = $w2Pconfig['currency_symbol']; $s .= formatCurrency($row[$fieldName], $AppUI->getPref('CURRENCYFORM')); break; case '_url': $s = w2p_url($row[$fieldName]); break; case '_date': $df = $AppUI->getPref('SHDATEFORMAT'); $myDate = intval($row[$fieldName]) ? new w2p_Utilities_Date($row[$fieldName]) : null; $s = $myDate ? $myDate->format($df) : '-'; break; default: $s = htmlspecialchars($row[$fieldName], ENT_QUOTES); } return '<td nowrap="nowrap">' . $s . '</td>'; }
<?php /** * @package web2project * @subpackage output * @version $Revision$ * * As of v3.0, this class has moved from the Calendar module to its own structure. * */ if (!isset($AppUI)) { $AppUI = new w2p_Core_CAppUI(); } require_once $AppUI->getLibraryClass('PEAR/Date'); /** * Displays a configuration month calendar * * All Date objects are based on the PEAR Date package */ class w2p_Output_MonthCalendar { /**#@+ * @var Date */ public $this_month; public $prev_month; public $next_month; public $prev_year; public $next_year; /**#@-*/ /**
function clash_suggest(w2p_Core_CAppUI $AppUI, $cal_sdf) { global $m, $a; $obj = new CEvent(); $obj->bind($_SESSION['add_event_post']); $start_date = new w2p_Utilities_Date($obj->event_start_date); $end_date = new w2p_Utilities_Date($obj->event_end_date); $df = $AppUI->getPref('SHDATEFORMAT'); $start_secs = $start_date->getTime(); $end_secs = $end_date->getTime(); $duration = (int) (($end_secs - $start_secs) / 60); $titleBlock = new w2p_Theme_TitleBlock('Suggest Alternative Event Time', 'myevo-appointments.png', $m, $m . '.' . $a); $titleBlock->show(); $calurl = W2P_BASE_URL . '/index.php?m=calendar&a=clash&event_id=' . $obj->event_id; $times = array(); $t = new w2p_Utilities_Date(); $t->setTime(0, 0, 0); if (!defined('LOCALE_TIME_FORMAT')) { define('LOCALE_TIME_FORMAT', '%I:%M %p'); } for ($m = 0; $m < 60; $m++) { $times[$t->format('%H%M%S')] = $t->format(LOCALE_TIME_FORMAT); $t->addSeconds(1800); } /* TODO: This needs to be refactored to use the core setDate_new function. */ ?> <script language="javascript" type="text/javascript"> function setDate( frm_name, f_date ) { fld_date = eval( 'document.' + frm_name + '.' + f_date ); fld_real_date = eval( 'document.' + frm_name + '.' + 'event_' + f_date ); if (fld_date.value.length>0) { if ((parseDate(fld_date.value))==null) { alert('The Date/Time you typed does not match your prefered format, please retype.'); fld_real_date.value = ''; fld_date.style.backgroundColor = 'red'; } else { fld_real_date.value = formatDate(parseDate(fld_date.value), 'yyyyMMdd'); fld_date.value = formatDate(parseDate(fld_date.value), '<?php echo $cal_sdf; ?> '); fld_date.style.backgroundColor = ''; } } else { fld_real_date.value = ''; } } function set_clash_action(action) { document.editFrm.clash_action.value = action; document.editFrm.submit(); } </script> <form name="editFrm" method="post" action="<?php echo $calurl . '&clash_action=process'; ?> " accept-charset="utf-8"> <table width='100%' class='std addedit'> <tr> <td width='50%' align='right'><?php echo $AppUI->_('Earliest Date'); ?> :</td> <td width='50%' align='left' nowrap="nowrap"> <input type="hidden" name="event_start_date" id="event_start_date" value="<?php echo $start_date ? $start_date->format(FMT_TIMESTAMP_DATE) : ''; ?> " /> <input type="text" name="start_date" id="start_date" onchange="setDate('editFrm', 'start_date');" value="<?php echo $start_date ? $start_date->format($df) : ''; ?> " class="text" /> <a href="javascript: void(0);" onclick="return showCalendar('start_date', '<?php echo $df; ?> ', 'editFrm', null, true)"> <img src="<?php echo w2PfindImage('calendar.gif'); ?> " width="24" height="12" alt="<?php echo $AppUI->_('Calendar'); ?> " border="0" /> </a> </td> </tr> <tr> <td width='50%' align='right'><?php echo $AppUI->_('Latest Date'); ?> :</td> <td width='50%' align='left' nowrap="nowrap"> <input type="hidden" name="event_end_date" id="event_end_date" value="<?php echo $end_date ? $end_date->format(FMT_TIMESTAMP_DATE) : ''; ?> " /> <input type="text" name="end_date" id="end_date" onchange="setDate('editFrm', 'end_date');" value="<?php echo $end_date ? $end_date->format($df) : ''; ?> " class="text" /> <a href="javascript: void(0);" onclick="return showCalendar('end_date', '<?php echo $df; ?> ', 'editFrm', null, true)"> <img src="<?php echo w2PfindImage('calendar.gif'); ?> " width="24" height="12" alt="<?php echo $AppUI->_('Calendar'); ?> " border="0" /> </a> </td> </tr> <tr> <td width='50%' align='right'><?php echo $AppUI->_('Earliest Start Time'); ?> :</td> <td width='50%' align='left'> <?php echo arraySelect($times, 'start_time', 'size="1" class="text"', $start_date->format('%H%M%S')); ?> </td> </tr> <tr> <td width='50%' align='right'><?php echo $AppUI->_('Latest Finish Time'); ?> :</td> <td width='50%' align='left'> <?php echo arraySelect($times, 'end_time', 'size="1" class="text"', $end_date->format('%H%M%S')); ?> </td> </tr> <tr> <td width='50%' align='right'><?php echo $AppUI->_('Duration'); ?> :</td> <td width='50%' align='left'> <input type="text" class="text" size="5" name="duration" value="<?php echo $duration; ?> " /> <?php echo $AppUI->_('minutes'); ?> </td> </tr> <tr> <td><input type="button" value="<?php echo $AppUI->_('cancel'); ?> " class="button" onclick="set_clash_action('cancel');" /></td> <td align="right"><input type="button" value="<?php echo $AppUI->_('submit'); ?> " class="button" onclick="set_clash_action('process')" /></td> </tr> </table> <input type='hidden' name='clash_action' value='cancel' /> </form> <?php }
<?php require_once 'base.php'; require_once W2P_BASE_DIR . '/includes/config.php'; require_once W2P_BASE_DIR . '/includes/main_functions.php'; require_once W2P_BASE_DIR . '/includes/db_adodb.php'; $AppUI = new w2p_Core_CAppUI(); $token = w2PgetParam($_GET, 'token', ''); $token = preg_replace("/[^A-Za-z0-9]/", "", $token); $format = w2PgetParam($_GET, 'format', 'ical'); $user = new CUser(); $userId = $user->getIdByToken($token); $AppUI->loadPrefs($userId); $AppUI->user_id = $userId; $AppUI->setUserLocale(); include W2P_BASE_DIR . '/locales/' . $AppUI->user_locale . '/locales.php'; include W2P_BASE_DIR . '/locales/core.php'; $defaultTZ = w2PgetConfig('system_timezone', 'UTC'); $defaultTZ = '' == $defaultTZ ? 'UTC' : $defaultTZ; date_default_timezone_set($defaultTZ); switch ($format) { //TODO: We only output in vCal, are there others we need to consider? case 'vcal': default: $format = 'vcal'; header('Content-Type: text/calendar'); header('Content-disposition: attachment; filename="calendar.ics"'); break; } if ($userId > 0) { $myTimezoneName = date('e');
<?php require_once 'base.php'; if (!defined('W2P_BASE_DIR')) { die('You should not access this file directly'); } require_once W2P_BASE_DIR . '/includes/config.php'; require_once W2P_BASE_DIR . '/includes/main_functions.php'; require_once W2P_BASE_DIR . '/includes/db_adodb.php'; require_once W2P_BASE_DIR . '/lib/captcha/Functions.php'; $AppUI = new w2p_Core_CAppUI(); $defaultTZ = w2PgetConfig('system_timezone', 'UTC'); $defaultTZ = '' == $defaultTZ ? 'UTC' : $defaultTZ; date_default_timezone_set($defaultTZ); /* CAPTCHA control condition... */ $passed = false; if (strlen($_POST['spam_check']) > 0) { $cid = md5_decrypt($_POST['cid']); if ($cid == strtoupper($_POST['spam_check'])) { $passed = true; } else { header('Location: newuser.php?msg=data'); } } else { header('Location: newuser.php?msg=spam'); } if (w2PgetConfig('activate_external_user_creation') != 'true') { die('You should not access this file directly'); }
/** * * @param w2p_Core_CAppUI $AppUI * @param CProject $project_id * * The point of this function is to create/update a task to represent a * subproject. * */ public static function storeTokenTask(w2p_Core_CAppUI $AppUI, $project_id) { $subProject = new CProject(); //TODO: We need to convert this from static to use ->overrideDatabase() for testing. $subProject->load($project_id); if ($subProject->project_parent > 0 && $subProject->project_id != $subProject->project_parent) { $q = new w2p_Database_Query(); $q->addTable('tasks'); $q->addQuery('MIN(task_start_date) AS min_task_start_date'); $q->addQuery('MAX(task_end_date) AS max_task_end_date'); $q->addWhere('task_project = ' . $subProject->project_id); $q->addWhere('task_status <> -1'); $projectDates = $q->loadList(); $q->clear(); $q->addTable('tasks'); $q->addQuery('task_id'); $q->addWhere('task_represents_project = ' . $subProject->project_id); $task_id = (int) $q->loadResult(); $task = new CTask(); //TODO: We need to convert this from static to use ->overrideDatabase() for testing. if ($task_id) { $task->load($task_id); } else { $task->task_description = $task->task_name; $task->task_priority = $subProject->project_priority; $task->task_project = $subProject->project_parent; $task->task_represents_project = $subProject->project_id; $task->task_owner = $AppUI->user_id; } $task->task_name = $AppUI->_('Subproject') . ': ' . $subProject->project_name; $task->task_duration_type = 1; $task->task_duration = $subProject->project_scheduled_hours; $task->task_start_date = $projectDates[0]['min_task_start_date']; $task->task_end_date = $projectDates[0]['max_task_end_date']; $task->task_percent_complete = $subProject->project_percent_complete; $task->store(); //TODO: we should do something with this store result? } }
public function __construct() { parent::__construct(); trigger_error("CAppUI has been deprecated in v3.0 and will be removed by v4.0. Please use w2p_Core_CAppUI instead.", E_USER_NOTICE); }
<?php /* $Id$ $URL$ */ require_once 'base.php'; require_once W2P_BASE_DIR . '/includes/config.php'; if (!isset($GLOBALS['OS_WIN'])) { $GLOBALS['OS_WIN'] = stristr(PHP_OS, "WIN") !== false; } // tweak for pathname consistence on windows machines require_once W2P_BASE_DIR . '/includes/main_functions.php'; require_once W2P_BASE_DIR . '/includes/db_adodb.php'; $AppUI = new w2p_Core_CAppUI(); $updatekey = w2PgetParam($_GET, 'updatekey', 0); $contact_id = CContact::getContactByUpdatekey($updatekey); $company_id = intval(w2PgetParam($_REQUEST, 'company_id', 0)); $company_name = w2PgetParam($_REQUEST, 'company_name', null); // check permissions for this record if (!$contact_id) { echo $AppUI->_('You are not authorized to use this page. If you should be authorized please contact') . ' ' . $w2Pconfig['company_name'] . ' ' . $AppUI->_('to give you another valid link, thank you.'); exit; } // load the record data $msg = ''; $row = new CContact(); if (!$row->load($contact_id) && $contact_id > 0) { $AppUI->setMsg('Contact'); $AppUI->setMsg('invalidID', UI_MSG_ERROR, true); $AppUI->redirect(); } else { if ($row->contact_private && $row->contact_owner != $AppUI->user_id && $row->contact_owner && $contact_id != 0) { // check only owner can edit