- 
- 
+ 
+
+
+
+
+
+
+
+
+
+
+
+
+ " border="0" alt="" title="" />
+ " class="userlink">
+
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ">
+
+
+
+ |
+
+
+
+
+ ">
+
+
+
+ |
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
Index: trunk/kernel/admin/include/toolbar/advanced_view.php
===================================================================
diff -u -r4330 -r4524
--- trunk/kernel/admin/include/toolbar/advanced_view.php (.../advanced_view.php) (revision 4330)
+++ trunk/kernel/admin/include/toolbar/advanced_view.php (.../advanced_view.php) (revision 4524)
@@ -24,7 +24,14 @@
if( isset($_GET['SetTab']) ) $DefaultTab = $_GET["SetTab"];
+$application =& kApplication::Instance();
+$force_tab = $application->RecallVar('force_tab');
+if ($force_tab) {
+ $DefaultTab = $force_tab;
+ $application->RemoveVar('force_tab');
+}
+
// category list filtering stuff: begin
$CategoryView = $objConfig->Get("Category_View");
Index: trunk/kernel/admin_templates/img/globe.gif
===================================================================
diff -u -r1566 -r4524
Binary files differ
Index: trunk/core/units/users/users_event_handler.php
===================================================================
diff -u -r4490 -r4524
--- trunk/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 4490)
+++ trunk/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 4524)
@@ -920,6 +920,25 @@
$object->IgnoreValidation = true;
$object->SetFieldsFromHash($fields);
}
+
+ /**
+ * Sets persistant variable
+ *
+ * @param kEvent $event
+ */
+ function OnSetPersistantVariable(&$event)
+ {
+ $object =& $event->getObject();
+
+ $field = $this->Application->GetVar('field');
+ $value = $this->Application->GetVar('value');
+ $object->setPersistantVar($field, $value);
+
+ $force_tab = $this->Application->GetVar('SetTab');
+ if ($force_tab) {
+ $this->Application->StoreVar('force_tab', $force_tab);
+ }
+ }
}
?>
\ No newline at end of file
Index: trunk/core/units/statistics/statistics_config.php
===================================================================
diff -u
--- trunk/core/units/statistics/statistics_config.php (revision 0)
+++ trunk/core/units/statistics/statistics_config.php (revision 4524)
@@ -0,0 +1,65 @@
+ 'stat',
+ 'ItemClass' => Array('class' => 'kDBItem', 'file' => '', 'build_event' => 'OnItemBuild'),
+ 'ListClass' => Array('class' => 'kDBList', 'file' => '', 'build_event' => 'OnListBuild'),
+ 'EventHandlerClass' => Array('class' => 'StatisticsEventHandler', 'file' => 'statistics_event_handler.php', 'build_event' => 'OnBuild'),
+ 'TagProcessorClass' => Array('class' => 'StatisticsTagProcessor', 'file' => 'statistics_tag_processor.php', 'build_event' => 'OnBuild'),
+
+ 'AutoLoad' => true,
+
+ 'QueryString' => Array(
+ 1 => 'id',
+ 2 => 'page',
+ 3 => 'event',
+ 4 => 'mode',
+ ),
+
+ 'IDField' => 'StatItemId',
+
+ 'TitleField' => 'ListLabel',
+
+ 'TitlePresets' => Array(
+ 'statistics_list' => Array('prefixes' => Array('stat_List'), 'format' => "!la_title_Statistics! (#stat_recordcount#)"),
+ ),
+
+ 'TableName' => TABLE_PREFIX.'StatItem',
+
+ 'ListSQLs' => Array('' => 'SELECT %1$s.* %2$s FROM %1$s'),
+ 'ItemSQLs' => Array('' => 'SELECT %1$s.* %2$s FROM %1$s'),
+
+ 'ListSortings' => Array(
+ '' => Array(
+ 'Sorting' => Array('Priority' => 'asc'),
+ )
+ ),
+
+ 'Fields' => Array(
+ 'StatItemId' => Array(),
+ 'Module' => Array('type' => 'string','not_null' => '1','default' => ''),
+ 'ValueSQL' => Array('type' => 'string','default' => ''),
+ 'ResetSQL' => Array('type' => 'string','default' => ''),
+ 'ListLabel' => Array('type' => 'string','not_null' => '1','default' => ''),
+ 'Priority' => Array('type' => 'int','not_null' => '1','default' => '0'),
+ 'AdminSummary' => Array('type' => 'int','not_null' => '1','default' => '0'),
+ ),
+
+
+
+ 'Grids' => Array(
+ 'Default' => Array(
+ 'Icons' => Array('default' => 'icon16_custom.gif'),
+ 'Fields' => Array(
+ 'Login' => Array('title' => 'la_col_Username', 'data_block' => 'grid_checkbox_td'),
+ 'LastName' => Array( 'title'=>'la_col_LastName'),
+ 'FirstName' => Array( 'title'=>'la_col_FirstName'),
+ ),
+ ),
+
+
+ ),
+
+ );
+
+?>
\ No newline at end of file
Index: trunk/kernel/units/users/users_item.php
===================================================================
diff -u -r4065 -r4524
--- trunk/kernel/units/users/users_item.php (.../users_item.php) (revision 4065)
+++ trunk/kernel/units/users/users_item.php (.../users_item.php) (revision 4524)
@@ -15,11 +15,16 @@
{
$this->persistantVars[$var_name] = $var_value;
- $replace_hash = Array( 'PortalUserId' => $this->GetID(),
- 'VariableName' => $var_name,
- 'VariableValue' => $var_value
- );
- $this->Conn->doInsert($replace_hash, TABLE_PREFIX.'PersistantSessionData', 'REPLACE');
+ if ($this->GetID() > 0) {
+ $replace_hash = Array( 'PortalUserId' => $this->GetID(),
+ 'VariableName' => $var_name,
+ 'VariableValue' => $var_value
+ );
+ $this->Conn->doInsert($replace_hash, TABLE_PREFIX.'PersistantSessionData', 'REPLACE');
+ }
+ else {
+ $this->Application->StoreVar($var_name, $var_value);
+ }
}
function getPersistantVar($var_name)
Index: trunk/kernel/admin/include/summary/root.php
===================================================================
diff -u -r2432 -r4524
--- trunk/kernel/admin/include/summary/root.php (.../root.php) (revision 2432)
+++ trunk/kernel/admin/include/summary/root.php (.../root.php) (revision 4524)
@@ -207,7 +207,7 @@
- $pending_col_1
+$pending_col_1
|
Index: trunk/kernel/units/categories/categories_config.php
===================================================================
diff -u -r4471 -r4524
--- trunk/kernel/units/categories/categories_config.php (.../categories_config.php) (revision 4471)
+++ trunk/kernel/units/categories/categories_config.php (.../categories_config.php) (revision 4524)
@@ -23,6 +23,17 @@
'IDField' => 'CategoryId',
'TitleField' => 'Name', // field, used in bluebar when editing existing item
'ItemType' => 1, // used for custom fields only
+
+ 'StatisticsInfo' => Array(
+ 'pending' => Array(
+ 'icon' => 'icon16_cat_pending.gif',
+ 'label' => 'la_tab_Categories',
+ 'js_url' => "set_persistant_var('Category_View', 41, 'advanced_view', '#url#')",
+ 'url' => Array('t' => 'advanced_view', 'index_file' => 'advanced_view.php', 'SetTab' => 'category', 'pass' => 'm'),
+ 'status' => STATUS_PENDING,
+ ),
+ ),
+
'TableName' => TABLE_PREFIX.'Category',
'ViewMenuPhrase' => 'la_text_Categories',
Index: trunk/core/units/statistics/statistics_event_handler.php
===================================================================
diff -u
--- trunk/core/units/statistics/statistics_event_handler.php (revision 0)
+++ trunk/core/units/statistics/statistics_event_handler.php (revision 4524)
@@ -0,0 +1,19 @@
+Special == 'summary') {
+ $object =& $event->getObject();
+ $object->addFilter('summary_filter', '%1$s.AdminSummary = 1');
+ }
+ }
+ }
+
+?>
\ No newline at end of file
Index: trunk/core/units/users/users_config.php
===================================================================
diff -u -r4471 -r4524
--- trunk/core/units/users/users_config.php (.../users_config.php) (revision 4471)
+++ trunk/core/units/users/users_config.php (.../users_config.php) (revision 4524)
@@ -55,6 +55,16 @@
'ItemType' => 6, // used for custom fields only (on user's case)
+ 'StatisticsInfo' => Array(
+ 'pending' => Array(
+ 'icon' => 'icon16_user_pending.gif',
+ 'label' => 'la_Text_Users',
+ 'js_url' => "set_persistant_var('User_View', 4, 'users/users_list', '#url#')",
+ 'url' => Array('t' => 'users/users_list', 'index_file' => 'users/user_list.php', 'pass' => 'm'),
+ 'status' => STATUS_PENDING,
+ ),
+ ),
+
'TitlePresets' => Array(
'default' => Array( 'new_status_labels' => Array('u'=>'!la_title_Adding_User!'),
'edit_status_labels' => Array('u'=>'!la_title_Editing_User!'),
Index: trunk/core/units/admin/admin_tag_processor.php
===================================================================
diff -u -r4490 -r4524
--- trunk/core/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 4490)
+++ trunk/core/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 4524)
@@ -260,7 +260,7 @@
foreach ($section_data['children'] as $section_name) {
$params['section_name'] = $section_name;
$section_data =& $this->Tree[$section_name];
- $params['children_count'] = count($section_data['children']);
+ $params['children_count'] = isset($section_data['children']) ? count($section_data['children']) : 0;
$template = $section_data['url']['t'];
unset($section_data['url']['t']);
@@ -284,6 +284,20 @@
return preg_replace("/\r\n|\n/", '', $ret);
}
+
+ function ModuleInclude($params)
+ {
+ foreach ($params as $param_name => $param_value) {
+ $params[$param_name] = replaceModuleSection($param_value);
+ }
+
+ return $this->Application->ProcessParsedTag('m', 'ModuleInclude', $params);
+ }
+
+ function TodayDate($params)
+ {
+ return date($params['format']);
+ }
}
?>
\ No newline at end of file
Index: trunk/core/units/statistics/statistics_tag_processor.php
===================================================================
diff -u
--- trunk/core/units/statistics/statistics_tag_processor.php (revision 0)
+++ trunk/core/units/statistics/statistics_tag_processor.php (revision 4524)
@@ -0,0 +1,244 @@
+getObject($params);
+ $this->CurrentSQL = $object->GetDBField($params['field']);
+
+ // 1. replace prefix to actual one
+ $this->CurrentSQL = str_replace("<%prefix%>", TABLE_PREFIX, $this->CurrentSQL);
+
+ // 2. replace all pseudo-tags found in sql with their values
+ while ( ($tag = $this->FindTag()) != false ) {
+ $this->CurrentSQL = str_replace('<%'.$tag.'%>', $this->ProcessStatisticTag($tag), $this->CurrentSQL);
+ }
+
+ // 3. query sql and process gathered data
+ $values = $this->Conn->GetCol($this->CurrentSQL);
+ if (!$values) return '';
+ if (!$this->PostFormatting) return array_shift($values);
+
+
+ switch ($this->PostFormatting) {
+ case 'number':
+ // simple-specific postformatting
+ $lang =& $this->Application->recallObject('lang.current');
+ $value = $lang->formatNumber($value, $this->PostFormattingParams['precision']);
+ break;
+
+ case 'COUNT':
+ // extended postformatting
+ $value = count($values);
+ break;
+
+ case 'SUM':
+ $value = 0;
+ foreach ($values as $cur_value) {
+ $value += $cur_value;
+ }
+
+ if ($this->PostFormattingParams['format_as'] == 'file') {
+ $value = size($value);
+ }
+ break;
+
+ // other type of information (not from db)
+ case 'SysFileSize':
+ $value = size( dir_size(FULL_PATH.'/') );
+ break;
+
+ default: // simple-default postformatting
+ $value = adodb_date($this->PostFormatting, array_shift($values));
+ break;
+ }
+ $this->PostFormatting = false;
+ $this->PostFormattingParams = Array();
+
+
+ return $value;
+
+ }
+
+ function FindTag()
+ {
+ // finds tag in current sql & returns it if found, false otherwise
+ $tagOpen = '<%'; $tagClose = '%>'; $tagOpenLen = strlen($tagOpen);
+ $startPos = strpos($this->CurrentSQL, $tagOpen);
+ if( $startPos !== false )
+ {
+ $endPos = strpos($this->CurrentSQL, $tagClose, $startPos);
+ return ($endPos > $startPos) ? substr($this->CurrentSQL, $startPos + $tagOpenLen, $endPos - $startPos - $tagOpenLen) : false;
+ }
+ return false;
+ }
+
+ function ProcessStatisticTag($tag)
+ {
+ $tag = trim($tag);
+ if (isset($this->TagCache[$tag])) {
+ return $this->TagCache[$tag];
+ }
+
+ $object =& $this->getObject();
+
+ list($tag_name, $tag_params) = explode(' ', $tag, 2); // 1st - function, 2nd .. nth - params
+ preg_match_all('/([\${}a-zA-Z0-9_.-]+)=(["\']{1,1})(.*?)(? $val){
+ $tag_params[$val[1]] = str_replace(Array('\\' . $val[2], '+'), Array($val[2], ' '), $val[3]);
+ }
+
+ switch ($tag_name) {
+ case 'm:config':
+ // m:config name=""
+ return $this->Application->ConfigValue($tag_params['name']);
+ break;
+
+ case 'm:post_format':
+ // m:post_format field="" type="" precision="2"
+ $lang =& $this->Application->recallObject('lang.current');
+ switch ($tag_params['type']) {
+ case 'date':
+ $this->PostFormatting = $lang->GetDBField('DateFormat');
+ break;
+
+ case 'time':
+ $this->PostFormatting = $lang->GetDBField('TimeFormat');
+ break;
+
+ case 'currency':
+ $this->PostFormatting = 'number';
+ $this->PostFormattingParams['precision'] = $tag_params['precision'];
+ break;
+ }
+ return $tag_params['field'];
+ break;
+
+ case 'm:custom_action':
+ // m:custom_action sql="empty" action="SysFileSize"
+ $this->PostFormatting = $tag_params['action'];
+ return ($tag_params['sql'] == 'empty') ? 'SELECT 1' : $tag_params['sql'];
+ break;
+
+ case 'modules:get_current':
+ return $object->GetDBField('Module');
+ break;
+
+ case 'm:sql_action':
+ //m:sql_action sql="SHOW TABLES" action="COUNT" field="*"
+ $this->PostFormatting = $tag_params['action'];
+ $this->PostFormattingParams = $tag_params;
+ return $tag_params['sql'];
+ break;
+
+ case 'link:hit_count':
+ if ($tag_params['type'] == 'top') {// by now only top is supported
+ $top_links_count = $this->Application->ConfigValue('Link_TopCount');
+
+ $sql = 'SELECT Hits
+ FROM '.TABLE_PREFIX.'Link
+ ORDER BY Hits DESC LIMIT 0, '.$top_links_count;
+ return $this->getLastRecord($sql, 'Hits');
+ }
+ break;
+
+ case 'article:hit_count':
+ if ($tag_params['type'] == 'top') {// by now only top is supported
+ $top_articles_count = $this->Application->ConfigValue('News_VotesToHot');
+ $min_votes = $this->Application->ConfigValue('News_MinVotes');
+
+ $sql = 'SELECT CachedRating
+ FROM '.TABLE_PREFIX.'News
+ WHERE CachedVotesQty > '.$min_votes.'
+ ORDER BY CachedRating DESC LIMIT 0, '.$top_articles_count;
+ return $this->getLastRecord($sql, 'CachedRating');
+ }
+ break;
+
+ case 'topic:hit_count':
+ if ($tag_params['type'] == 'top') {// by now only top is supported
+ $top_posts_count = $this->Application->ConfigValue('Topic_PostsToPop');
+
+ $sql = 'SELECT Views
+ FROM '.TABLE_PREFIX.'Topic
+ ORDER BY Views DESC LIMIT 0, '.$top_posts_count;
+ return $this->getLastRecord($sql, 'Views');
+ }
+ break;
+
+
+ }
+ }
+
+ function getLastRecord($sql, $field)
+ {
+ $records = $this->Conn->GetCol($sql);
+ return count($records) ? array_pop($records) : 0;
+ }
+
+ /**
+ * Allows to get pending item count for prefix
+ *
+ * @param Array $params
+ * @return int
+ */
+ function CountPending($params)
+ {
+ $prefix = $params['prefix'];
+
+ $statistics_info = $this->Application->getUnitOption($prefix.'.pending', 'StatisticsInfo');
+ if (!$statistics_info) {
+ return 0;
+ }
+
+ $table = $this->Application->getUnitOption($prefix, 'TableName');
+ $status_field = array_shift( $this->Application->getUnitOption($prefix, 'StatusField') );
+ $sql = 'SELECT COUNT(*)
+ FROM '.$table.'
+ WHERE '.$status_field.' = '.$statistics_info['status'];
+ return $this->Conn->GetOne($sql);
+ }
+
+ function PrintPendingStatistics($params)
+ {
+ $sql = 'SELECT Prefix
+ FROM '.TABLE_PREFIX.'ItemTypes';
+ $prefixes = $this->Conn->GetCol($sql);
+
+ $block_params = Array('name' => $this->SelectParam($params, 'render_as,block') );
+
+ $ret = '';
+ foreach ($prefixes as $prefix) {
+ $block_params['prefix'] = $prefix;
+ $statistics_info = $this->Application->getUnitOption($prefix.'.pending', 'StatisticsInfo');
+ if (!$statistics_info) continue;
+
+ $template = $statistics_info['url']['t'];
+ unset($statistics_info['url']['t']);
+ $url = $this->Application->HREF($template, '', $statistics_info['url']);
+ if ($statistics_info['js_url'] != '#url#') {
+ $statistics_info['js_url'] = 'javascript:'.$statistics_info['js_url'];
+ }
+
+ $block_params['url'] = str_replace('#url#', $url, $statistics_info['js_url']);
+ $block_params['icon'] = $statistics_info['icon'];
+ $block_params['label'] = $statistics_info['label'];
+ $ret .= $this->Application->ParseBlock($block_params);
+
+ }
+ return $ret;
+ }
+
+ }
+
+
+?>
\ No newline at end of file
Index: trunk/kernel/admin_templates/sections_list.tpl
===================================================================
diff -u -r4490 -r4524
--- trunk/kernel/admin_templates/sections_list.tpl (.../sections_list.tpl) (revision 4490)
+++ trunk/kernel/admin_templates/sections_list.tpl (.../sections_list.tpl) (revision 4524)
@@ -2,7 +2,7 @@
-
+
@@ -45,9 +45,8 @@
| |