本文整理汇总了PHP中config_option函数的典型用法代码示例。如果您正苦于以下问题:PHP config_option函数的具体用法?PHP config_option怎么用?PHP config_option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了config_option函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rebuild
public function rebuild($start_date = null, $end_date = null)
{
if (!$start_date) {
$start_date = config_option('last_sharing_table_rebuild');
}
if ($start_date instanceof DateTimeValue) {
$start_date = $start_date->toMySQL();
}
if ($end_date instanceof DateTimeValue) {
$end_date = $end_date->toMySQL();
}
if ($end_date) {
$end_cond = "AND updated_on <= '{$end_date}'";
}
try {
$object_ids = Objects::instance()->findAll(array('id' => true, "conditions" => "updated_on >= '{$start_date}' {$end_cond}"));
$obj_count = 0;
DB::beginWork();
foreach ($object_ids as $id) {
$obj = Objects::findObject($id);
if ($obj instanceof ContentDataObject) {
$obj->addToSharingTable();
$obj_count++;
}
}
set_config_option('last_sharing_table_rebuild', DateTimeValueLib::now()->toMySQL());
DB::commit();
} catch (Exception $e) {
DB::rollback();
Logger::log("Failed to rebuild sharing table: " . $e->getMessage() . "\nTrace: " . $e->getTraceAsString());
}
return $obj_count;
}
示例2: loadPanels
private function loadPanels($options)
{
if (!$this->panels) {
$contact_pg_ids = ContactPermissionGroups::getPermissionGroupIdsByContactCSV(logged_user()->getId(), false);
$this->panels = array();
$sql = "\r\n\t\t\t\tSELECT * FROM " . TABLE_PREFIX . "tab_panels \r\n\t\t\t\tWHERE \r\n\t\t\t\t\tenabled = 1 AND\t\t\t\t\t\r\n\t\t\t\t\t( \t\r\n\t\t\t\t\t\tplugin_id IS NULL OR plugin_id=0 OR\r\n\t\t\t\t\t\tplugin_id IN (SELECT id FROM " . TABLE_PREFIX . "plugins WHERE is_installed = 1 AND is_activated = 1) \r\n\t\t\t\t\t)\r\n\t\t\t\t\tAND id IN (SELECT tab_panel_id FROM " . TABLE_PREFIX . "tab_panel_permissions WHERE permission_group_id IN ({$contact_pg_ids}))\r\n\t\t\t\tORDER BY ordering ASC ";
$res = DB::execute($sql);
while ($row = $res->fetchRow()) {
$object = array("title" => lang($row['title']), "id" => $row['id'], "quickAddTitle" => lang($row['default_controller']), "refreshOnWorkspaceChange" => (bool) $row['refresh_on_context_change'], "defaultController" => $row['default_controller'], "defaultContent" => array("type" => "url", "data" => get_url($row['default_controller'], $row['default_action'])), "enabled" => $row['enabled'], "type" => $row['type'], "tabTip" => lang($row['title']));
if (config_option('show_tab_icons')) {
$object["iconCls"] = $row['icon_cls'];
}
if ($row['initial_controller'] && $row['initial_action']) {
$object["initialContent"] = array("type" => "url", "data" => get_url($row['initial_controller'], $row['initial_action']));
}
if ($row['id'] == 'more-panel' && config_option('getting_started_step') >= 99) {
$object['closable'] = true;
if (!user_config_option('settings_closed')) {
$this->panels[] = $object;
}
} else {
$this->panels[] = $object;
}
}
}
return $this->panels;
}
示例3: index
/**
* Show dashboard index page
*
* @param void
* @return null
*/
function index()
{
trace(__FILE__, 'index() - begin');
$logged_user = logged_user();
$active_projects = $logged_user->getActiveProjects();
$activity_log = null;
$projects_activity_log = array();
if (is_array($active_projects) && count($active_projects)) {
$include_private = $logged_user->isMemberOfOwnerCompany();
$include_silent = $logged_user->isAdministrator();
$project_ids = array();
foreach ($active_projects as $active_project) {
$project_ids[] = $active_project->getId();
$temp_project_logs = ApplicationLogs::getProjectLogs($active_project, $include_private, $include_silent, config_option('dashboard_project_logs_count', 7));
if (isset($temp_project_logs) && is_array($temp_project_logs) && count($temp_project_logs)) {
$projects_activity_log[$temp_project_logs[0]->getCreatedOn()->getTimestamp()] = $temp_project_logs;
}
krsort($projects_activity_log);
}
// if
$activity_log = ApplicationLogs::getOverallLogs($include_private, $include_silent, $project_ids, config_option('dashboard_logs_count', 15));
}
// if
trace(__FILE__, 'index() - tpl_assign...');
tpl_assign('today_milestones', $logged_user->getTodayMilestones());
tpl_assign('late_milestones', $logged_user->getLateMilestones());
tpl_assign('active_projects', $active_projects);
tpl_assign('activity_log', $activity_log);
tpl_assign('projects_activity_log', $projects_activity_log);
// Sidebar
tpl_assign('online_users', Users::getWhoIsOnline());
tpl_assign('my_projects', $active_projects);
$this->setSidebar(get_template_path('index_sidebar', 'dashboard'));
trace(__FILE__, 'index() - end');
}
示例4: time_activate
/**
* If you need an activation routine run from the admin panel
* use the following pattern for the function:
*
* <name_of_plugin>_activate
*
* This is good for creation of database tables etc.
*/
function time_activate() {
$tp = TABLE_PREFIX;
$cs = 'character set '.config_option('character_set', 'utf8');
$co = 'collate '.config_option('collate', 'utf8_unicode_ci');
$sql = "
CREATE TABLE IF NOT EXISTS `{$tp}project_times` (
`id` int(10) unsigned NOT NULL auto_increment,
`project_id` int(10) unsigned default NULL,
`task_list_id` int(11) default NULL,
`task_id` int(11) default NULL,
`name` varchar(100) $cs $co default NULL,
`description` text $cs $co default NULL,
`done_date` datetime NOT NULL default '0000-00-00 00:00:00',
`hours` float(4,2) NOT NULL default '0.00',
`is_billable` tinyint(1) unsigned NOT NULL default '1',
`assigned_to_company_id` smallint(10) NOT NULL default '0',
`assigned_to_user_id` int(10) unsigned NOT NULL default '0',
`is_private` tinyint(1) unsigned NOT NULL default '0',
`is_closed` tinyint(1) unsigned NOT NULL default '0',
`created_on` datetime NOT NULL default '0000-00-00 00:00:00',
`created_by_id` int(10) unsigned default NULL,
`updated_on` datetime NOT NULL default '0000-00-00 00:00:00',
`updated_by_id` int(10) unsigned default NULL,
PRIMARY KEY (`id`),
KEY `project_id` (`project_id`),
KEY `done_date` (`done_date`),
KEY `created_on` (`created_on`)
);
";
// create table
DB::execute($sql);
// TODO insert config options
// TODO insert permission options
}
示例5: purge_trash
function purge_trash()
{
Env::useHelper("permissions");
$days = config_option("days_on_trash", 0);
$count = 0;
if ($days > 0) {
$date = DateTimeValueLib::now()->add("d", -$days);
$objects = Objects::findAll(array("conditions" => array("`trashed_by_id` > 0 AND `trashed_on` < ?", $date), "limit" => 100));
foreach ($objects as $object) {
$concrete_object = Objects::findObject($object->getId());
if (!$concrete_object instanceof ContentDataObject) {
continue;
}
if ($concrete_object instanceof MailContent && $concrete_object->getIsDeleted() > 0) {
continue;
}
try {
DB::beginWork();
if ($concrete_object instanceof MailContent) {
$concrete_object->delete(false);
} else {
$concrete_object->delete();
}
ApplicationLogs::createLog($concrete_object, ApplicationLogs::ACTION_DELETE);
DB::commit();
$count++;
} catch (Exception $e) {
DB::rollback();
Logger::log("Error delting object in purge_trash: " . $e->getMessage(), Logger::ERROR);
}
}
}
return $count;
}
示例6: list_all
function list_all()
{
ajx_current("empty");
// Get all variables from request
$start = array_var($_GET, 'start', 0);
$limit = array_var($_GET, 'limit', config_option('files_per_page'));
$order = array_var($_GET, 'sort');
$order_dir = array_var($_GET, 'dir');
$tag = array_var($_GET, 'tag');
$action = array_var($_GET, 'action');
$attributes = array("ids" => explode(',', array_var($_GET, 'ids')), "types" => explode(',', array_var($_GET, 'types')), "tag" => array_var($_GET, 'tagTag'), "accountId" => array_var($_GET, 'account_id'), "moveTo" => array_var($_GET, 'moveTo'), "mantainWs" => array_var($_GET, 'mantainWs'));
//Resolve actions to perform
$actionMessage = array();
if (isset($action)) {
$actionMessage = $this->resolveAction($action, $attributes);
if ($actionMessage["errorCode"] == 0) {
flash_success($actionMessage["errorMessage"]);
} else {
flash_error($actionMessage["errorMessage"]);
}
}
// Get all emails and messages to display
$project = active_project();
list($messages, $pagination) = ProjectMessages::getMessages($tag, $project, $start, $limit, $order, $order_dir);
$total = $pagination->getTotalItems();
// Prepare response object
$object = $this->prepareObject($messages, $start, $limit, $total);
ajx_extra_data($object);
tpl_assign("listing", $object);
}
示例7: index
/**
* Show dashboard index page
*
* @param void
* @return null
*/
function index()
{
$logged_user = logged_user();
$active_projects = $logged_user->getActiveProjects();
$activity_log = null;
if (is_array($active_projects) && count($active_projects)) {
$include_private = $logged_user->isMemberOfOwnerCompany();
$include_silent = $logged_user->isAdministrator();
$project_ids = array();
foreach ($active_projects as $active_project) {
$project_ids[] = $active_project->getId();
}
// if
$activity_log = ApplicationLogs::getOverallLogs($include_private, $include_silent, $project_ids, config_option('dashboard_logs_count', 15));
}
// if
tpl_assign('today_milestones', $logged_user->getTodayMilestones());
tpl_assign('late_milestones', $logged_user->getLateMilestones());
tpl_assign('active_projects', $active_projects);
tpl_assign('activity_log', $activity_log);
// Sidebar
tpl_assign('online_users', Users::getWhoIsOnline());
tpl_assign('my_projects', $active_projects);
$this->setSidebar(get_template_path('index_sidebar', 'dashboard'));
}
示例8: check
/**
* Check if there is a new version of application available
*
* @param boolean $force When forced check will always construct the versions feed object
* try to fech the data and check for a new version. Version feed object is also returned
* @return VersionFeed In case of error this function will return false
*/
static function check($force = true)
{
$allow_url_fopen = strtolower(ini_get('allow_url_fopen'));
if (function_exists('simplexml_load_file') && ($allow_url_fopen == '1' || $allow_url_fopen == 'on')) {
// Execute once a day, if not forced check if we need to execute it now
if (!$force) {
if (config_option('upgrade_last_check_new_version', false)) {
return true;
// already have it checked and already have a new version
}
// if
$last_check = config_option('upgrade_last_check_datetime');
if ($last_check instanceof DateTimeValue && $last_check->getTimestamp() + 86400 > DateTimeValueLib::now()->getTimestamp()) {
return true;
// checked in the last day
}
// if
}
// if
try {
$versions_feed = new VersionsFeed();
set_config_option('upgrade_last_check_datetime', DateTimeValueLib::now());
set_config_option('upgrade_last_check_new_version', $versions_feed->hasNewVersions(product_version()));
return $force ? $versions_feed : true;
} catch (Exception $e) {
return false;
}
// try
} else {
set_config_option('upgrade_check_enabled', false);
return false;
}
// if
}
示例9: getWebpages
function getWebpages($project, $tag = '', $page = 1, $webpages_per_page = 10, $orderBy = 'title', $orderDir = 'ASC', $archived = false)
{
$orderDir = strtoupper($orderDir);
if ($orderDir != "ASC" && $orderDir != "DESC") {
$orderDir = "ASC";
}
if ($page < 0) {
$page = 1;
}
//$conditions = logged_user()->isMemberOfOwnerCompany() ? '' : ' `is_private` = 0';
if ($tag == '' || $tag == null) {
$tagstr = "1=1";
} else {
$tagstr = "(SELECT count(*) FROM `" . TABLE_PREFIX . "tags` WHERE `" . TABLE_PREFIX . "project_webpages`.`id` = `" . TABLE_PREFIX . "tags`.`rel_object_id` AND `" . TABLE_PREFIX . "tags`.`tag` = " . DB::escape($tag) . " AND `" . TABLE_PREFIX . "tags`.`rel_object_manager` = 'ProjectWebpages' ) > 0 ";
}
$permission_str = ' AND (' . permissions_sql_for_listings(ProjectWebpages::instance(), ACCESS_LEVEL_READ, logged_user()) . ')';
if ($project instanceof Project) {
$pids = $project->getAllSubWorkspacesCSV(true);
$project_str = " AND " . self::getWorkspaceString($pids);
} else {
$project_str = "";
}
if ($archived) {
$archived_cond = " AND `archived_by_id` <> 0";
} else {
$archived_cond = " AND `archived_by_id` = 0";
}
$conditions = $tagstr . $permission_str . $project_str . $archived_cond;
return ProjectWebpages::paginate(array("conditions" => $conditions, 'order' => DB::escapeField($orderBy) . " {$orderDir}"), config_option('files_per_page', 10), $page);
// paginate
}
示例10: add
/**
* Show and process add milestone form
*
* @access public
* @param void
* @return null
*/
function add()
{
$this->setTemplate('add_milestone');
if (!ProjectMilestone::canAdd(logged_user(), active_project())) {
flash_error(lang('no access permissions'));
$this->redirectToReferer(get_url('milestone'));
}
// if
$milestone_data = array_var($_POST, 'milestone');
if (!is_array($milestone_data)) {
$milestone_data = array('due_date' => DateTimeValueLib::now(), 'is_private' => config_option('default_private', false));
// array
}
// if
$milestone = new ProjectMilestone();
tpl_assign('milestone_data', $milestone_data);
tpl_assign('milestone', $milestone);
if (is_array(array_var($_POST, 'milestone'))) {
if (isset($_POST['milestone_due_date'])) {
$milestone_data['due_date'] = DateTimeValueLib::makeFromString($_POST['milestone_due_date']);
} else {
$milestone_data['due_date'] = DateTimeValueLib::make(0, 0, 0, array_var($_POST, 'milestone_due_date_month', 1), array_var($_POST, 'milestone_due_date_day', 1), array_var($_POST, 'milestone_due_date_year', 1970));
}
$assigned_to = explode(':', array_var($milestone_data, 'assigned_to', ''));
$milestone->setFromAttributes($milestone_data);
if (!logged_user()->isMemberOfOwnerCompany()) {
$milestone->setIsPrivate(false);
}
$milestone->setProjectId(active_project()->getId());
$milestone->setAssignedToCompanyId(array_var($assigned_to, 0, 0));
$milestone->setAssignedToUserId(array_var($assigned_to, 1, 0));
try {
DB::beginWork();
$milestone->save();
if (plugin_active('tags')) {
$milestone->setTagsFromCSV(array_var($milestone_data, 'tags'));
}
ApplicationLogs::createLog($milestone, active_project(), ApplicationLogs::ACTION_ADD);
DB::commit();
// Send notification
try {
if (array_var($milestone_data, 'send_notification') == 'checked') {
Notifier::milestoneAssigned($milestone);
// send notification
}
// if
} catch (Exception $e) {
}
// try
flash_success(lang('success add milestone', $milestone->getName()));
$this->redirectTo('milestone');
} catch (Exception $e) {
DB::rollback();
tpl_assign('error', $e);
}
// try
}
// if
}
示例11: send_password_expiration_reminders
function send_password_expiration_reminders()
{
$password_expiration_notification = config_option('password_expiration_notification', 0);
if ($password_expiration_notification > 0) {
_log("Sending password expiration reminders...");
$count = UserPasswords::sendPasswordExpirationReminders();
_log("{$count} password expiration reminders sent.");
}
}
示例12: reminders_activate
function reminders_activate()
{
$tp = TABLE_PREFIX;
$cs = 'character set ' . config_option('character_set', 'utf8');
$co = 'collate ' . config_option('collation', 'utf8_unicode_ci');
$sql = "\nCREATE TABLE IF NOT EXISTS `{$tp}reminders` (\n `user_id` int(10) unsigned NOT NULL default '0',\n `reminders_enabled` boolean,\n `summarized_by` ENUM('all', 'project', 'milestone', 'task list', 'task') NOT NULL,\n `days_in_future` int unsigned not null default '0',\n `include_everyone` boolean,\n `reminder_days` SET('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'),\n `reports_enabled` boolean,\n `reports_summarized_by` boolean,\n `reports_include` boolean,\n `reports_activity` boolean,\n `report_day` ENUM('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'), \n PRIMARY KEY (`user_id`)\n) ENGINE=InnoDB DEFAULT CHARSET=" . DB_CHARSET;
// create table
DB::execute($sql);
}
示例13: getDueReminders
function getDueReminders($type = null)
{
if (isset($type)) {
$extra = ' AND `type` = ' . DB::escape($type);
} else {
$extra = "";
}
return ObjectReminders::findAll(array('conditions' => array("`date` > '0000-00-00 00:00:00' AND `date` < ?" . $extra, DateTimeValueLib::now()), 'limit' => config_option('cron reminder limit', 100)));
}
示例14: tags_activate
/**
* If you need an activation routine run from the admin panel
* use the following pattern for the function:
*
* <name_of_plugin>_activate
*
* This is good for creation of database tables etc.
*/
function tags_activate()
{
$tp = TABLE_PREFIX;
$cs = 'character set ' . config_option('character_set', 'utf8');
$co = 'collate ' . config_option('collation', 'utf8_unicode_ci');
$sql = "\nCREATE TABLE IF NOT EXISTS `{$tp}tags` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `project_id` int(10) unsigned NOT NULL default '0',\n `tag` varchar(50) {$cs} {$co} NOT NULL default '',\n `rel_object_id` int(10) unsigned NOT NULL default '0',\n `rel_object_manager` varchar(50) {$cs} {$co} NOT NULL default '',\n `created_on` datetime default NULL,\n `created_by_id` int(10) unsigned NOT NULL default '0',\n `is_private` tinyint(1) NOT NULL default '0',\n PRIMARY KEY (`id`),\n KEY `project_id` (`project_id`),\n KEY `tag` (`tag`),\n KEY `object_id` (`rel_object_id`,`rel_object_manager`)\n);\n";
// create table
DB::execute($sql);
}
示例15: form_activate
/**
* If you need an activation routine run from the admin panel
* use the following pattern for the function:
*
* <name_of_plugin>_activate
*
* This is good for creation of database tables etc.
*/
function form_activate()
{
$tp = TABLE_PREFIX;
$cs = 'character set ' . config_option('character_set', 'utf8');
$co = 'collate ' . config_option('collation', 'utf8_unicode_ci');
$sql = "\nCREATE TABLE IF NOT EXISTS `{$tp}project_forms` (\n `id` smallint(5) unsigned NOT NULL auto_increment,\n `project_id` int(10) unsigned NOT NULL default '0',\n `name` varchar(50) NOT NULL default '',\n `description` text {$cs} {$co} NOT NULL,\n `success_message` text {$cs} {$co} NOT NULL,\n `action` enum('add_comment','add_task') {$cs} {$co} NOT NULL default 'add_comment',\n `in_object_id` int(10) unsigned NOT NULL default '0',\n `created_on` datetime default NULL,\n `created_by_id` int(10) unsigned NOT NULL default '0',\n `updated_on` datetime NOT NULL default '0000-00-00 00:00:00',\n `updated_by_id` int(10) unsigned NOT NULL default '0',\n `is_visible` tinyint(1) unsigned NOT NULL default '0',\n `is_enabled` tinyint(1) unsigned NOT NULL default '0',\n `order` smallint(6) NOT NULL default '0',\n PRIMARY KEY (`id`)\n) TYPE=InnoDB DEFAULT CHARSET=" . DB_CHARSET;
// create table wiki_pages
DB::execute($sql);
}