Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1246173
reviews.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Nov 21, 10:10 AM
Size
11 KB
Mime Type
text/x-php
Expires
Sun, Nov 23, 10:10 AM (1 d, 17 h)
Engine
blob
Format
Raw Data
Handle
807582
Attached To
rINP In-Portal
reviews.php
View Options
<?php
global
$objConfig
,
$objSections
,
$section
,
$rootURL
,
$adminURL
,
$admin
,
$imagesURL
,
$envar
,
$m_var_list_update
,
$objCatList
,
$homeURL
,
$upURL
,
$objSession
,
$DefaultTab
;
global
$CategoryFilter
,
$TotalItemCount
;
global
$Bit_All
,
$Bit_Pending
,
$Bit_Disabled
,
$Bit_New
,
$Bit_Pop
,
$Bit_Hot
,
$Bit_Ed
;
//global $hideSelectAll;
$m_tab_Categories_hide
=
isset
(
$DefaultTab
)
&&
(
$DefaultTab
==
'category'
)
?
0
:
1
;
/* bit place holders for category view menu */
$Bit_Active
=
64
;
$Bit_Pending
=
32
;
$Bit_Disabled
=
16
;
$Bit_New
=
8
;
$Bit_Pop
=
4
;
$Bit_Hot
=
2
;
$Bit_Ed
=
1
;
if
(
isset
(
$_GET
[
'SetTab'
])
)
$DefaultTab
=
$_GET
[
"SetTab"
];
// category list filtering stuff: begin
$CategoryView
=
$objConfig
->
Get
(
"Category_View"
);
if
(!
is_numeric
(
$CategoryView
))
{
$CategoryView
=
127
;
}
$Category_Sortfield
=
$objConfig
->
Get
(
"Category_Sortfield"
);
if
(
!
strlen
(
$Category_Sortfield
)
)
$Category_Sortfield
=
"Name"
;
$Category_Sortorder
=
$objConfig
->
Get
(
"Category_Sortorder"
);
if
(
!
strlen
(
$Category_Sortorder
)
)
$Category_Sortorder
=
"desc"
;
$Perpage_Category
=
(
int
)
$objConfig
->
Get
(
"Perpage_Category"
);
if
(!
$Perpage_Category
)
$Perpage_Category
=
"'all'"
;
if
(
$CategoryView
==
127
)
{
$Category_ShowAll
=
1
;
}
else
{
$Category_ShowAll
=
0
;
// FILTERING CODE V. 1.2
$where_clauses
=
Array
();
$q
=
''
;
//Group #1: Category Statuses (active,pending,disabled)
$Status
=
array
(-
1
);
if
(
$CategoryView
&
$Bit_Pending
)
$Status
[]
=
STATUS_PENDING
;
if
(
$CategoryView
&
$Bit_Active
)
$Status
[]
=
STATUS_ACTIVE
;
if
(
$CategoryView
&
$Bit_Disabled
)
$Status
[]
=
STATUS_DISABLED
;
if
(
count
(
$Status
)
)
$where_clauses
[]
=
'Status IN ('
.
implode
(
','
,
$Status
).
')'
;
//Group #2: Category Statistics (new,pick)
$Status
=
array
();
if
(!(
$CategoryView
&
$Bit_New
))
{
$cutoff
=
adodb_date
(
"U"
)
-
(
$objConfig
->
Get
(
"Category_DaysNew"
)
*
86400
);
if
(
$cutoff
>
0
)
$q
=
'CreatedOn > '
.
$cutoff
;
$q
.=
(!
empty
(
$q
)
?
' OR '
:
''
).
'NewItem = 1'
;
$Status
[]
=
"NOT ($q)"
;
}
if
(!(
$CategoryView
&
$Bit_Ed
))
$Status
[]
=
'NOT (EditorsPick = 1)'
;
if
(
count
(
$Status
)
)
$where_clauses
[]
=
'('
.
implode
(
') AND ('
,
$Status
).
')'
;
$CategoryFilter
=
count
(
$where_clauses
)
?
'('
.
implode
(
') AND ('
,
$where_clauses
).
')'
:
''
;
}
// category list filtering stuff: end
$OrderBy
=
$objCatList
->
QueryOrderByClause
(
TRUE
,
TRUE
,
TRUE
);
$objCatList
->
Clear
();
$IsSearch
=
FALSE
;
$list
=
$objSession
->
GetVariable
(
"m_adv_view_search"
);
$SearchQuery
=
$objCatList
->
AdminSearchWhereClause
(
$list
);
if
(
strlen
(
$SearchQuery
))
{
$SearchQuery
=
" ("
.
$SearchQuery
.
")"
.(
$CategoryFilter
?
'AND ('
.
$CategoryFilter
.
')'
:
''
);
$objCatList
->
LoadCategories
(
$SearchQuery
,
$OrderBy
,
false
,
'set_last'
);
$IsSearch
=
TRUE
;
}
else
$objCatList
->
LoadCategories
(
$CategoryFilter
,
$OrderBy
,
false
,
'set_last'
);
$TotalItemCount
+=
$objCatList
->
QueryItemCount
;
$CatTotal
=
TableCount
(
$objCatList
->
SourceTable
,
null
,
false
);
$mnuClearSearch
=
language
(
"la_SearchMenu_Clear"
);
$mnuNewSearch
=
language
(
"la_SearchMenu_New"
);
$mnuSearchCategory
=
language
(
"la_SearchMenu_Categories"
);
$lang_New
=
language
(
"la_Text_New"
);
$lang_Hot
=
language
(
"la_Text_Hot"
);
$lang_EdPick
=
language
(
"la_prompt_EditorsPick"
);
$lang_Pop
=
language
(
"la_Text_Pop"
);
$lang_Rating
=
language
(
"la_prompt_Rating"
);
$lang_Hits
=
language
(
"la_prompt_Hits"
);
$lang_Votes
=
language
(
"la_prompt_Votes"
);
$lang_Name
=
language
(
"la_prompt_Name"
);
$lang_Categories
=
language
(
"la_ItemTab_Categories"
);
$lang_Description
=
language
(
"la_prompt_Description"
);
$lang_MetaKeywords
=
language
(
"la_prompt_MetaKeywords"
);
$lang_SubSearch
=
language
(
"la_prompt_SubSearch"
);
$lang_Within
=
language
(
"la_Text_Within"
);
$lang_Current
=
language
(
"la_Text_Current"
);
$lang_Active
=
language
(
"la_Text_Active"
);
//$lang_SubCats = language("la_Text_SubCats");
//$lang_SubItems = language("la_Text_Subitems");
// View, Sort, Select, Per Page
$lang_View
=
language
(
'la_Text_View'
);
$lang_Sort
=
language
(
'la_Text_Sort'
);
$lang_PerPage
=
language
(
'la_prompt_PerPage'
);
$lang_Select
=
language
(
'la_Text_Select'
);
print
<<<END
<script language="JavaScript">
// global usage phrases
var lang_View = '$lang_View';
var lang_Sort = '$lang_Sort';
var lang_PerPage = '$lang_PerPage';
var lang_Select = '$lang_Select';
// local usage phrases
var default_tab = "$DefaultTab";
var Category_Sortfield = '$Category_Sortfield';
var Category_Sortorder = '$Category_Sortorder';
var Category_Perpage = $Perpage_Category;
var Category_ShowAll = $Category_ShowAll;
var CategoryView = $CategoryView;
//JS Language variables
var lang_New = "$lang_New";
var lang_Hot = "$lang_Hot";
var lang_EdPick = "$lang_EdPick";
var lang_Pop = "$lang_Pop";
var lang_Rating = "$lang_Rating";
var lang_Hits = "$lang_Hits";
var lang_Votes = "$lang_Votes";
var lang_Name = "$lang_Name";
var lang_Categories = "$lang_Categories";
var lang_Description = "$lang_Description";
var lang_MetaKeywords = "$lang_MetaKeywords";
var lang_SubSearch = "$lang_SubSearch";
var lang_Within="$lang_Within";
var lang_Current = "$lang_Current";
var lang_Active = "$lang_Active";
//var lang_SubCats = "$lang_SubCats";
//var lang_SubItems = "$lang_SubItems";
var hostname = '$rootURL';
var env = '$envar';
var actionlist = new Array();
// Common function for all "Advanced View" page
function InitPage()
{
addCommonActions();
initToolbar('mainToolBar', actionHandler);
initCheckBoxes(null, false);
// toggleMenu();
}
function AddButtonAction(actionname,actionval)
{
var item = new Array(actionname,actionval);
actionlist[actionlist.length] = item;
}
function actionHandler(button)
{
for(i=0; i<actionlist.length;i++)
{
a = actionlist[i];
if(button.action == a[0])
{
eval(a[1]);
break;
}
}
}
function addCommonActions()
{
AddButtonAction('edit',"check_submit('','edit');"); //edit
AddButtonAction('delete',"check_submit('$admin/reviews','delete');"); //delete
AddButtonAction('approve',"check_submit('$admin/reviews','approve');"); //approve
AddButtonAction('decline',"check_submit('$admin/reviews','decline');"); //decline
AddButtonAction('print',"window.print();"); //print ?
AddButtonAction('view',"toggleMenu(); window.FW_showMenu(window.cat_menu,getRealLeft(button) - ((document.all) ? 6 : -2),getRealTop(button)+32);");
}
function check_submit(page,actionValue)
{
if (actionValue.match(/delete$/))
if (!theMainScript.Confirm(lang_DeleteConfirm)) return;
var formname = '';
var action_prefix ='';
if (activeTab)
{
form_name = activeTab.id;
action_prefix = activeTab.getAttribute("ActionPrefix");
if(page.length == 0) page = activeTab.getAttribute("EditURL");
if ( action_prefix.match("k4:(.*)") )
{
act = RegExp.$1;
act = act.replace('$\$event$$', actionValue);
eval(act);
return;
}
}
var f = document.getElementsByName(form_name+'_form')[0];
if(f)
{
f.Action.value = action_prefix + actionValue;
f.action = '$rootURL' + page + '.php?'+ env;
f.submit();
}
}
function flip_current(field_suffix)
{
if(activeTab)
{
field = activeTab.getAttribute("tabTitle")+field_suffix;
return flip(eval(field));
}
}
function config_current(field_suffix,value)
{
if(activeTab)
{
field = activeTab.getAttribute("tabTitle")+field_suffix;
config_val(field,value);
}
}
function toggleMenu()
{
var prefix_special = activeTab.getAttribute('PrefixSpecial');
\$fw_menus[prefix_special+'_view_menu']();
window.cat_menu = \$Menus[prefix_special+'_view_menu'];
window.triedToWriteMenus = false;
window.cat_menu.writeMenus();
}
function toggleTabB(tabId, atm)
{
var hl = document.getElementById("hidden_line");
var activeTabId;
if (activeTab) activeTabId = activeTab.id;
if (activeTabId != tabId)
{
if (activeTab)
{
//alert('switching to tab');
toggleTab(tabId, true)
}
else
{
//alert('opening tab');
toggleTab(tabId, atm)
}
if (hl) hl.style.display = "none";
}
tab_hdr = document.getElementById('tab_headers');
if (!tab_hdr) return;
// process all module tabs
var active_str = '';
for (var i = 0; i < tabIDs.length; i++)
{
var tabHeader;
TDs = tab_hdr.getElementsByTagName("TD");
// find tab
for (var j = 0; j < TDs.length; j++)
if (TDs[j].getAttribute("tabHeaderOf") == tabIDs[i])
{
tabHeader = TDs[j];
break;
}
if (!tabHeader) continue;
var tab = document.getElementById(tabIDs[i]);
if (!tab) continue;
active_str = (tab.active) ? "tab_active" : "tab_inactive";
if (TDs[j].getAttribute("tabHeaderOf") == tabId) {
// module tab is selected
TabActive = tabId;
SetBackground('l_' + tabId, "$imagesURL/itemtabs/" + active_str + "_l.gif");
SetBackground('m_' + tabId, "$imagesURL/itemtabs/" + active_str + ".gif");
SetBackground('m1_' + tabId, "$imagesURL/itemtabs/" + active_str + ".gif");
SetBackground('r_' + tabId, "$imagesURL/itemtabs/" + active_str + "_r.gif");
}
else
{
// module tab is not selected
SetBackground('l_' +tabIDs[i], "$imagesURL/itemtabs/" + active_str + "_l.gif");
SetBackground('m_' + tabIDs[i], "$imagesURL/itemtabs/" + active_str + ".gif");
SetBackground('m1_' + tabIDs[i], "$imagesURL/itemtabs/" + active_str + ".gif");
SetBackground('r_' + tabIDs[i], "$imagesURL/itemtabs/" + active_str + "_r.gif");
}
var images = tabHeader.getElementsByTagName("IMG");
if (images.length < 1) continue;
images[0].src = "$imagesURL/itemtabs/" + ((tab.active) ? "divider_up" : "divider_empty") + ".gif";
}
}
function SetBackground(element_id, img_url)
{
// set background image of element specified by id
var el = document.getElementById(element_id);
el.style.backgroundImage = 'url('+img_url+')';
}
function initContextMenu()
{
window.contextMenu = new Menu("Context");
contextMenu.addMenuItem("Edit","check_submit('','edit');","");
contextMenu.addMenuItem("Delete","check_submit('admin/reviews','delete');","");
contextMenu.addMenuSeparator();
contextMenu.addMenuItem("Approve","check_submit('admin/reviews','approve');","");
contextMenu.addMenuItem("Decline","check_submit('admin/reviews','decline');","");
window.triedToWriteMenus = false;
window.contextMenu.writeMenus();
return true;
}
// Event Handling Stuff Cross-Browser
getEvent = window.Event
? function(e){return e}
: function() {return event}
getEventSrcElement = window.Event
? function(e){var targ=e.target;return targ.nodeType==1?targ:targ.parentNode}
: function() {return event.srcElement}
function getKeyCode(e){return e.charCode||e.keyCode}
function getKey(eMoz)
{
var e = getEvent(eMoz)
var keyCode = getKeyCode(e)
if(keyCode == 13)
{
var el = document.getElementById(TabActive+'_imgSearch');
if(typeof(el) != 'undefined') el.onclick();
}
}
</script>
END;
?>
Event Timeline
Log In to Comment