feat(pkg): reconcile Phoca Download to live (Cadline delta)
Reconcile to live bytes. Diff vs pristine = Cadline modifications (trial-download flow, Hungarian routes, DB query — ~10 files per audit) + line-endings/install files. Signed-off-by: LÁZÁR Imre <imre@illusion.hu> Assisted-by: claude-code@claude-opus-4-8
This commit is contained in:
parent
d324fb4a5e
commit
61b652afd0
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<access component="com_phocadownload">
|
||||||
|
<section name="component">
|
||||||
|
<action name="core.admin" title="JAction_Admin" description="JAction_Admin_Component_Desc" />
|
||||||
|
<action name="core.manage" title="JAction_Manage" description="JAction_Manage_Component_Desc" />
|
||||||
|
<action name="core.create" title="JAction_Create" description="JAction_Create_Component_Desc" />
|
||||||
|
<action name="core.delete" title="JAction_Delete" description="JAction_Delete_Component_Desc" />
|
||||||
|
<action name="core.edit" title="JAction_Edit" description="JAction_Edit_Component_Desc" />
|
||||||
|
<action name="core.edit.state" title="JACTION_EDITSTATE" description="JAction_EditState_Component_Desc" />
|
||||||
|
</section>
|
||||||
|
|
||||||
|
</access>
|
||||||
@ -0,0 +1,550 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<config>
|
||||||
|
<fields addfieldpath="/administrator/components/com_phocadownload/models/fields">
|
||||||
|
<fieldset name="display" label="COM_PHOCADOWNLOAD_CONFIG_HEAD_DISPLAY_LABEL">
|
||||||
|
|
||||||
|
<field name="phocahead1" type="phocahead" default="COM_PHOCADOWNLOAD_CONFIG_CATEGORY_CATEGORIES_VIEW_LABEL" label="" description=""/>
|
||||||
|
|
||||||
|
<field name="filename_or_name" type="list" default="filenametitle" label="COM_PHOCADOWNLOAD_FIELD_FILENAME_OR_NAME_LABEL" description="COM_PHOCADOWNLOAD_FIELD_FILENAME_OR_NAME_LABEL_DESC">
|
||||||
|
<option value="filename">COM_PHOCADOWNLOAD_FILENAME</option>
|
||||||
|
<option value="title">COM_PHOCADOWNLOAD_TITLE</option>
|
||||||
|
<option value="filenametitle">COM_PHOCADOWNLOAD_FILENAME_AND_TITLE</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<field name="display_downloads" type="list" default="0" label="COM_PHOCADOWNLOAD_FIELD_DISPLAY_DOWNLOADS_LABEL" description="COM_PHOCADOWNLOAD_FIELD_DISPLAY_DOWNLOADS_DESC">
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_YES</option>
|
||||||
|
<option value="0">COM_PHOCADOWNLOAD_NO</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field name="display_description" type="list" default="3" label="COM_PHOCADOWNLOAD_FIELD_DISPLAY_DESCRIPTION_LABEL" description="COM_PHOCADOWNLOAD_FIELD_DISPLAY_DESCRIPTION_DESC">
|
||||||
|
<option value="0">COM_PHOCADOWNLOAD_NONE</option>
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_TOP</option>
|
||||||
|
<option value="2">COM_PHOCADOWNLOAD_BOTTOM</option>
|
||||||
|
<option value="3">COM_PHOCADOWNLOAD_OVERLIB</option>
|
||||||
|
<option value="4">COM_PHOCADOWNLOAD_TOP_AND_OVERLIB</option>
|
||||||
|
<option value="5">COM_PHOCADOWNLOAD_BOTTOM_AND_OVERLIB</option>
|
||||||
|
<option value="6">COM_PHOCADOWNLOAD_TOP_WITH_DETAIL_AND_OVERLIB</option>
|
||||||
|
<option value="7">COM_PHOCADOWNLOAD_BOTTOM_WITH_DETAIL_AND_OVERLIB</option>
|
||||||
|
<option value="8">COM_PHOCADOWNLOAD_OVERLIB_WIDTH_DETAIL</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field name="display_main_cat_desc" type="list" default="0" label="COM_PHOCADOWNLOAD_FIELD_DISPLAY_MAIN_CAT_DESC_LABEL" description="COM_PHOCADOWNLOAD_FIELD_DISPLAY_MAIN_CAT_DESC_DESC">
|
||||||
|
<option value="0">COM_PHOCADOWNLOAD_NO</option>
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_YES</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field name="display_detail" type="list" default="1" label="COM_PHOCADOWNLOAD_FIELD_DISPLAY_DETAIL_BUTTON_LABEL" description="COM_PHOCADOWNLOAD_FIELD_DISPLAY_DETAIL_BUTTON_DESC">
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_YES_OVERLIB</option>
|
||||||
|
<option value="2">COM_PHOCADOWNLOAD_YES_MODAL</option>
|
||||||
|
<option value="0">COM_PHOCADOWNLOAD_NO</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field name="display_new" default="0" size="10" type="text" label="COM_PHOCADOWNLOAD_FIELD_DISPLAY_NEW_ICON_LABEL" description="COM_PHOCADOWNLOAD_FIELD_DISPLAY_NEW_ICON_DESC" />
|
||||||
|
|
||||||
|
<field name="display_hot" default="0" size="10" type="text" label="COM_PHOCADOWNLOAD_FIELD_DISPLAY_HOT_ICON_LABEL" description="COM_PHOCADOWNLOAD_FIELD_DISPLAY_HOT_ICON_DESC" />
|
||||||
|
|
||||||
|
<field name="display_most_download" type="list" default="1" label="COM_PHOCADOWNLOAD_FIELD_DISPLAY_MOST_DOWNLOAD_FILES_LABEL" description="COM_PHOCADOWNLOAD_FIELD_DISPLAY_MOST_DOWNLOAD_FILES_DESC">
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_YES</option>
|
||||||
|
<option value="0">COM_PHOCADOWNLOAD_NO</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field name="display_file_view" type="list" default="0" label="COM_PHOCADOWNLOAD_FIELD_DISPLAY_FILE_VIEW_LABEL" description="COM_PHOCADOWNLOAD_FIELD_DISPLAY_FILE_VIEW_DESC">
|
||||||
|
<option value="0">COM_PHOCADOWNLOAD_NO</option>
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_YES</option>
|
||||||
|
<option value="2">COM_PHOCADOWNLOAD_YES_ONLY_MODALBOX</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field name="display_date_type" type="list" default="0" label="COM_PHOCADOWNLOAD_FIELD_DISPLAY_DATE_TYPE_LABEL" description="COM_PHOCADOWNLOAD_FIELD_DISPLAY_DATE_TYPE_DESC">
|
||||||
|
<option value="0">COM_PHOCADOWNLOAD_DATABASE_TIME</option>
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_FILE_FILEMTIME</option>
|
||||||
|
<option value="2">COM_PHOCADOWNLOAD_FILE_FILECTIME</option>
|
||||||
|
<option value="3">COM_PHOCADOWNLOAD_FILE_FILEATIME</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field name="download_external_link" type="list" default="_self" label="COM_PHOCADOWNLOAD_FIELD_EXTERNAL_DOWNLOAD_LINK_LABEL" description="COM_PHOCADOWNLOAD_FIELD_EXTERNAL_DOWNLOAD_LINK_DESC">
|
||||||
|
<option value="_self">COM_PHOCADOWNLOAD_SELF</option>
|
||||||
|
<option value="_blank">COM_PHOCADOWNLOAD_BLANK</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
|
||||||
|
<field name="download_metadesc" type="textarea" label="COM_PHOCADOWNLOAD_FIELD_METADESC_LABEL" description="COM_PHOCADOWNLOAD_FIELD_METADESC_DESC" rows="2" cols="26" default="" />
|
||||||
|
|
||||||
|
<field name="download_metakey" type="textarea" label="COM_PHOCADOWNLOAD_FIELD_METAKEY_LABEL" description="COM_PHOCADOWNLOAD_FIELD_METAKEY_DESC" rows="2" cols="26" default="" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<field name="category_ordering" type="list" default="1" label="COM_PHOCADOWNLOAD_FIELD_CATEGORY_ORDERING_LABEL" description="COM_PHOCADOWNLOAD_FIELD_CATEGORY_ORDERING_DESC">
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_ORDERING_ASC</option>
|
||||||
|
<option value="2">COM_PHOCADOWNLOAD_ORDERING_DESC</option>
|
||||||
|
<option value="3">COM_PHOCADOWNLOAD_TITLE_ASC</option>
|
||||||
|
<option value="4">COM_PHOCADOWNLOAD_TITLE_DESC</option>
|
||||||
|
<option value="5">COM_PHOCADOWNLOAD_DATE_ASC</option>
|
||||||
|
<option value="6">COM_PHOCADOWNLOAD_DATE_DESC</option>
|
||||||
|
<option value="7">COM_PHOCADOWNLOAD_ID_ASC</option>
|
||||||
|
<option value="8">COM_PHOCADOWNLOAD_ID_DESC</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field name="file_ordering" type="list" default="1" label="COM_PHOCADOWNLOAD_FIELD_FILE_ORDERING_LABEL" description="COM_PHOCADOWNLOAD_FIELD_FILE_ORDERING_DESC">
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_ORDERING_ASC</option>
|
||||||
|
<option value="2">COM_PHOCADOWNLOAD_ORDERING_DESC</option>
|
||||||
|
<option value="3">COM_PHOCADOWNLOAD_TITLE_ASC</option>
|
||||||
|
<option value="4">COM_PHOCADOWNLOAD_TITLE_DESC</option>
|
||||||
|
<option value="5">COM_PHOCADOWNLOAD_DATE_ASC</option>
|
||||||
|
<option value="6">COM_PHOCADOWNLOAD_DATE_DESC</option>
|
||||||
|
<option value="7">COM_PHOCADOWNLOAD_ID_ASC</option>
|
||||||
|
<option value="8">COM_PHOCADOWNLOAD_ID_DESC</option>
|
||||||
|
<option value="11">COM_PHOCADOWNLOAD_FILENAME_ASC</option>
|
||||||
|
<option value="12">COM_PHOCADOWNLOAD_FILENAME_DESC</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
|
||||||
|
<field name="default_pagination" default="20" size="18" type="text" label="COM_PHOCADOWNLOAD_FIELD_DEFAULT_VALUE_PAGINATION_LABEL" description="COM_PHOCADOWNLOAD_FIELD_DEFAULT_VALUE_PAGINATION_DESC" />
|
||||||
|
|
||||||
|
<field name="pagination" default="5,10,15,20,50" size="18" type="text" label="COM_PHOCADOWNLOAD_FIELD_CATEGORY_VIEW_PAGINATION_LABEL" description="COM_PHOCADOWNLOAD_FIELD_CATEGORY_VIEW_PAGINATION_DESC" />
|
||||||
|
|
||||||
|
|
||||||
|
<field name="display_num_doc_secs" type="list" default="0" label="COM_PHOCADOWNLOAD_FIELD_DISPLAY_NUM_FILES_CATEGORIES_VIEW_LABEL" description="COM_PHOCADOWNLOAD_FIELD_DISPLAY_NUM_FILES_CATEGORIES_VIEW_DESC">
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_YES</option>
|
||||||
|
<option value="0">COM_PHOCADOWNLOAD_NO</option>
|
||||||
|
</field>
|
||||||
|
<field name="display_num_doc_secs_header" type="list" default="1" label="COM_PHOCADOWNLOAD_FIELD_DISPLAY_NUM_FILES_CATEGORIES_VIEW_HEADER_LABEL" description="COM_PHOCADOWNLOAD_FIELD_DISPLAY_NUM_FILES_CATEGORIES_VIEW_HEADER_DESC">
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_YES</option>
|
||||||
|
<option value="0">COM_PHOCADOWNLOAD_NO</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field name="display_up_icon" type="list" default="1" label="COM_PHOCADOWNLOAD_FIELD_DISPLAY_UP_ICON_LABEL" description="COM_PHOCADOWNLOAD_FIELD_DISPLAY_UP_ICON_DESC">
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_YES</option>
|
||||||
|
<option value="0">COM_PHOCADOWNLOAD_NO</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field name="display_mirror_links" type="list" default="0" label="COM_PHOCADOWNLOAD_FIELD_DISPLAY_MIRROR_LINKS_LABEL" description="COM_PHOCADOWNLOAD_FIELD_DISPLAY_MIRROR_LINKS_DESC">
|
||||||
|
<option value="0">COM_PHOCADOWNLOAD_NO</option>
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_YES_CATEGORY_VIEW</option>
|
||||||
|
<option value="2">COM_PHOCADOWNLOAD_YES_FILE_VIEW</option>
|
||||||
|
<option value="3">COM_PHOCADOWNLOAD_YES_CATEGORY_FILE_VIEW</option>
|
||||||
|
<option value="4">COM_PHOCADOWNLOAD_YES_CATEGORY_VIEW_BUTTON</option>
|
||||||
|
<option value="5">COM_PHOCADOWNLOAD_YES_FILE_VIEW_BUTTON</option>
|
||||||
|
<option value="6">COM_PHOCADOWNLOAD_YES_CATEGORY_FILE_VIEW_BUTTON</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field name="display_report_link" type="list" default="0" label="COM_PHOCADOWNLOAD_FIELD_DISPLAY_REPORT_LINK_LABEL" description="COM_PHOCADOWNLOAD_FIELD_DISPLAY_REPORT_LINK_DESC">
|
||||||
|
<option value="0">COM_PHOCADOWNLOAD_NO</option>
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_YES_CATEGORY_VIEW</option>
|
||||||
|
<option value="2">COM_PHOCADOWNLOAD_YES_FILE_VIEW</option>
|
||||||
|
<option value="3">COM_PHOCADOWNLOAD_YES_CATEGORY_FILE_VIEW</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<field name="report_link_guestbook_id" default="" size="10" type="text" label="COM_PHOCADOWNLOAD_FIELD_REPORT_LINK_GUESTBOOK_ID_LABEL" description="COM_PHOCADOWNLOAD_FIELD_REPORT_LINK_GUESTBOOK_ID_DESC" />
|
||||||
|
|
||||||
|
<field name="tags_links" type="list" default="0" label="COM_PHOCADOWNLOAD_FIELD_TAGS_LINKS_LABEL" description="COM_PHOCADOWNLOAD_FIELD_TAGS_LINKS_DESC">
|
||||||
|
<option value="0">COM_PHOCADOWNLOAD_NO</option>
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_EXTERNAL_LINK</option>
|
||||||
|
<option value="2">COM_PHOCADOWNLOAD_CATEGORY_LINK</option>
|
||||||
|
<option value="3">COM_PHOCADOWNLOAD_SEARCH_OUTCOME</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field name="display_tags_links" type="list" default="0" label="COM_PHOCADOWNLOAD_FIELD_DISPLAY_TAGS_LINKS_LABEL" description="COM_PHOCADOWNLOAD_FIELD_DISPLAY_TAGS_LINKS_DESC">
|
||||||
|
<option value="0">COM_PHOCADOWNLOAD_NO</option>
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_YES_CATEGORY_VIEW</option>
|
||||||
|
<option value="2">COM_PHOCADOWNLOAD_YES_FILE_VIEW</option>
|
||||||
|
<option value="3">COM_PHOCADOWNLOAD_YES_CATEGORY_FILE_VIEW</option>
|
||||||
|
<option value="4">COM_PHOCADOWNLOAD_YES_CATEGORY_VIEW_TITLE_SUFFIX</option>
|
||||||
|
<option value="5">COM_PHOCADOWNLOAD_YES_FILE_VIEW_TITLE_SUFFIX</option>
|
||||||
|
<option value="6">COM_PHOCADOWNLOAD_YES_CATEGORY_FILE_VIEW_TITLE_SUFFIX</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field name="phocahead4" type="phocahead" default="COM_PHOCADOWNLOAD_FILE_VIEW_LABEL" label="" description=""/>
|
||||||
|
|
||||||
|
<field name="license_box_height" default="300" size="10" type="text" label="COM_PHOCADOWNLOAD_FIELD_LICENSE_BOX_HEIGHT_LABEL" description="COM_PHOCADOWNLOAD_FIELD_LICENSE_BOX_HEIGHT_DESC" />
|
||||||
|
|
||||||
|
<field name="phocahead2" type="phocahead" default="COM_PHOCADOWNLOAD_CONFIG_COMMENTS_SETTINGS_LABEL" label="" description=""/>
|
||||||
|
|
||||||
|
<field name="display_category_comments" type="list" default="0" label="COM_PHOCADOWNLOAD_FIELD_DISPLAY_CATEGORY_COMMENTS_LABEL" description="COM_PHOCADOWNLOAD_FIELD_DISPLAY_CATEGORY_COMMENTS_DESC">
|
||||||
|
<option value="0">COM_PHOCADOWNLOAD_NO</option>
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_JCOMMENTS</option>
|
||||||
|
<option value="2">COM_PHOCADOWNLOAD_FACEBOOK</option>
|
||||||
|
</field>
|
||||||
|
<field name="display_file_comments" type="list" default="0" label="COM_PHOCADOWNLOAD_FIELD_DISPLAY_FILE_COMMENTS_LABEL" description="COM_PHOCADOWNLOAD_FIELD_DISPLAY_FILE_COMMENTS_DESC">
|
||||||
|
<option value="0">COM_PHOCADOWNLOAD_NO</option>
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_JCOMMENTS</option>
|
||||||
|
<option value="2">COM_PHOCADOWNLOAD_FACEBOOK</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field name="fb_comment_app_id" default="" size="18" type="phocaselectfbuser" label="COM_PHOCADOWNLOAD_FIELD_FB_COMMENT_APP_ID_LABEL" description="COM_PHOCADOWNLOAD_FIELD_FB_COMMENT_APP_ID_DESC" />
|
||||||
|
|
||||||
|
<field name="fb_comment_width" default="550" size="6" type="text" label="COM_PHOCADOWNLOAD_FACEBOOK_COMMENTS_WIDTH_LABEL" description="COM_PHOCADOWNLOAD_FACEBOOK_COMMENTS_WIDTH_DESC" />
|
||||||
|
<field name="fb_comment_lang" type="text" size="30" default="en_US" label="COM_PHOCADOWNLOAD_FACEBOOK_FIELD_COMMENT_LANG_LABEL" description="COM_PHOCADOWNLOAD_FACEBOOK_FIELD_COMMENT_LANG_DESC" />
|
||||||
|
<field name="fb_comment_count" type="text" size="6" default="" label="COM_PHOCADOWNLOAD_FACEBOOK_FIELD_COMMENT_COUNT_LABEL" description="COM_PHOCADOWNLOAD_FACEBOOK_FIELD_COMMENT_COUNT_DESC" />
|
||||||
|
|
||||||
|
<field name="phocahead7" type="phocahead" default="COM_PHOCADOWNLOAD_CONFIG_RATING_SETTINGS_LABEL" label="" description=""/>
|
||||||
|
|
||||||
|
<field name="display_rating_file" type="list" default="0" label="COM_PHOCADOWNLOAD_FIELD_DISPLAY_RATING_FILE_LABEL" description="COM_PHOCADOWNLOAD_FIELD_DISPLAY_RATING_FILE_DESC">
|
||||||
|
<option value="0">COM_PHOCADOWNLOAD_NO</option>
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_YES_CATEGORY_VIEW</option>
|
||||||
|
<option value="2">COM_PHOCADOWNLOAD_YES_FILE_VIEW</option>
|
||||||
|
<option value="3">COM_PHOCADOWNLOAD_YES_CATEGORY_FILE_VIEW</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
|
||||||
|
<field name="phocahead3" type="phocahead" default="COM_PHOCADOWNLOAD_CONFIG_THEME_SETTINGS_LABEL" label="" description=""/>
|
||||||
|
|
||||||
|
<field name="file_icon_size" type="list" default="16" label="COM_PHOCADOWNLOAD_FIELD_FILE_ICON_SIZE_LABEL" description="COM_PHOCADOWNLOAD_FIELD_FILE_ICON_SIZE_DESC">
|
||||||
|
<option value="16">16px</option>
|
||||||
|
<option value="32">32px</option>
|
||||||
|
<option value="48">48px</option>
|
||||||
|
<option value="64">64px</option>
|
||||||
|
</field>
|
||||||
|
<field name="file_icon_size_md" type="list" default="16" label="COM_PHOCADOWNLOAD_FIELD_FILE_ICON_SIZE_MD_LABEL" description="COM_PHOCADOWNLOAD_FIELD_FILE_ICON_SIZE_MD_DESC">
|
||||||
|
<option value="16">16px</option>
|
||||||
|
<option value="32">32px</option>
|
||||||
|
<option value="48">48px</option>
|
||||||
|
<option value="64">64px</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field name="file_icon_mime" type="list" default="1" label="COM_PHOCADOWNLOAD_FIELD_FILE_ICON_MIME_LABEL" description="COM_PHOCADOWNLOAD_FIELD_FILE_ICON_MIME_DESC">
|
||||||
|
<option value="0">COM_PHOCADOWNLOAD_NO</option>
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_YES</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<field name="display_specific_layout" type="list" default="0" label="COM_PHOCADOWNLOAD_DISPLAY_SPEC_LAYOUT_LABEL" description="COM_PHOCADOWNLOAD_DISPLAY_SPEC_LAYOUT_DESC">
|
||||||
|
<option value="0">COM_PHOCADOWNLOAD_NO</option>
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_YES</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field name="display_bootstrap3_layout" type="list" default="0" label="COM_PHOCADOWNLOAD_DISPLAY_BOOTSTRAP3_LAYOUT_LABEL" description="COM_PHOCADOWNLOAD_DISPLAY_BOOTSTRAP3_LAYOUT_DESC">
|
||||||
|
<option value="0">COM_PHOCADOWNLOAD_NO</option>
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_YES</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<field name="phocahead5" type="phocahead" default="COM_PHOCADOWNLOAD_PLAY_SETTINGS_LABEL" label="" description=""/>
|
||||||
|
<field name="display_play" type="list" default="0" label="COM_PHOCADOWNLOAD_FIELD_DISPLAY_PLAY_BUTTON_LABEL" description="COM_PHOCADOWNLOAD_FIELD_DISPLAY_PLAY_BUTTON_DESC">
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_YES</option>
|
||||||
|
<option value="0">COM_PHOCADOWNLOAD_NO</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field name="player_width" default="328" size="10" type="text" label="COM_PHOCADOWNLOAD_FIELD_PLAYER_WIDTH_LABEL" description="COM_PHOCADOWNLOAD_FIELD_PLAYER_WIDTH_DESC" />
|
||||||
|
<field name="player_height" default="200" size="10" type="text" label="COM_PHOCADOWNLOAD_FIELD_PLAYER_HEIGHT_LABEL" description="COM_PHOCADOWNLOAD_FIELD_PLAYER_HEIGHT_DESC" />
|
||||||
|
<field name="player_mp3_height" default="30" size="10" type="text" label="COM_PHOCADOWNLOAD_FIELD_PLAYER_MP3_HEIGHT_LABEL" description="COM_PHOCADOWNLOAD_FIELD_PLAYER_MP3_HEIGHT_DESC" />
|
||||||
|
|
||||||
|
<field name="play_popup_window" type="list" default="0" label="COM_PHOCADOWNLOAD_FIELD_PLAY_POPUP_WINDOW_LABEL" description="COM_PHOCADOWNLOAD_FIELD_PLAY_POPUP_WINDOW_DESC">
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_STANDARD_POPUP_WINDOW</option>
|
||||||
|
<option value="0">COM_PHOCADOWNLOAD_MODAL_BOX</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field name="html5_play" type="list" default="0" label="COM_PHOCADOWNLOAD_FIELD_HTML5_AUDIO_VIDEO_LABEL" description="COM_PHOCADOWNLOAD_FIELD_HTML5_AUDIO_VIDEO_DESC">
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_YES</option>
|
||||||
|
<option value="0">COM_PHOCADOWNLOAD_NO</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
|
||||||
|
<field name="phocahead6" type="phocahead" default="COM_PHOCADOWNLOAD_PREVIEW_SETTINGS_LABEL" label="" description=""/>
|
||||||
|
<field name="display_preview" type="list" default="0" label="COM_PHOCADOWNLOAD_FIELD_DISPLAY_PREVIEW_BUTTON_LABEL" description="COM_PHOCADOWNLOAD_FIELD_DISPLAY_PREVIEW_BUTTON_DESC">
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_YES</option>
|
||||||
|
<option value="0">COM_PHOCADOWNLOAD_NO</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field name="preview_width" default="640" size="10" type="text" label="COM_PHOCADOWNLOAD_FIELD_PREVIEW_WIDTH_LABEL" description="COM_PHOCADOWNLOAD_FIELD_PREVIEW_WIDTH_DESC" />
|
||||||
|
<field name="preview_height" default="480" size="10" type="text" label="COM_PHOCADOWNLOAD_FIELD_PREVIEW_HEIGHT_LABEL" description="COM_PHOCADOWNLOAD_FIELD_PREVIEW_HEIGHT_DESC" />
|
||||||
|
|
||||||
|
<field name="preview_popup_window" type="list" default="0" label="COM_PHOCADOWNLOAD_FIELD_PREVIEW_POPUP_WINDOW_LABEL" description="COM_PHOCADOWNLOAD_FIELD_PREVIEW_POPUP_WINDOW_DESC">
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_STANDARD_POPUP_WINDOW</option>
|
||||||
|
<option value="0">COM_PHOCADOWNLOAD_MODAL_BOX</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field name="youtube_height_cv" default="240" size="10" type="text" label="COM_PHOCADOWNLOAD_FIELD_VIDEO_HEIGHT_CV_LABEL" description="COM_PHOCADOWNLOAD_FIELD_VIDEO_HEIGHT_CV_DESC" />
|
||||||
|
<field name="youtube_width_cv" default="320" size="10" type="text" label="COM_PHOCADOWNLOAD_FIELD_VIDEO_WIDTH_CV_LABEL" description="COM_PHOCADOWNLOAD_FIELD_VIDEO_WIDTH_CV_DESC" />
|
||||||
|
|
||||||
|
<field name="youtube_height_dv" default="360" size="10" type="text" label="COM_PHOCADOWNLOAD_FIELD_VIDEO_HEIGHT_DV_LABEL" description="COM_PHOCADOWNLOAD_FIELD_VIDEO_HEIGHT_DV_DESC" />
|
||||||
|
<field name="youtube_width_dv" default="480" size="10" type="text" label="COM_PHOCADOWNLOAD_FIELD_VIDEO_WIDTH_DV_LABEL" description="COM_PHOCADOWNLOAD_FIELD_VIDEO_WIDTH_DV_DESC" />
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset name="user_download" label="COM_PHOCADOWNLOAD_CONFIG_HEAD_DOWNLOADS_LABEL">
|
||||||
|
|
||||||
|
<field name="ignore_file_types_check" default="2" type="list" label="COM_PHOCADOWNLOAD_IGNORE_FILE_TYPES_CHECK_LABEL" description="COM_PHOCADOWNLOAD_IGNORE_FILE_TYPES_CHECK_DESC" >
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_YES_UPLOAD_PARAM</option>
|
||||||
|
<option value="2">COM_PHOCADOWNLOAD_YES_UPLOAD_PARAM_ADMIN</option>
|
||||||
|
<option value="3">COM_PHOCADOWNLOAD_YES_DOWNLOAD_PARAM</option>
|
||||||
|
<option value="4">COM_PHOCADOWNLOAD_YES_DOWNLOAD_UPLOAD_PARAM</option>
|
||||||
|
<option value="5">COM_PHOCADOWNLOAD_YES_DOWNLOAD_UPLOAD_PARAM_ADMIN</option>
|
||||||
|
<option value="0">COM_PHOCADOWNLOAD_NO</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field name="allowed_file_types_download" default="{hqx=application/mac-binhex40}
|
||||||
|
{cpt=application/mac-compactpro}
|
||||||
|
{csv=text/x-comma-separated-values}
|
||||||
|
{bin=application/macbinary}
|
||||||
|
{dms=application/octet-stream}
|
||||||
|
{lha=application/octet-stream}
|
||||||
|
{lzh=application/octet-stream}
|
||||||
|
{exe=application/octet-stream}
|
||||||
|
{class=application/octet-stream}
|
||||||
|
{psd=application/x-photoshop}
|
||||||
|
{so=application/octet-stream}
|
||||||
|
{sea=application/octet-stream}
|
||||||
|
{dll=application/octet-stream}
|
||||||
|
{oda=application/oda}
|
||||||
|
{pdf=application/pdf}
|
||||||
|
{ai=application/postscript}
|
||||||
|
{eps=application/postscript}
|
||||||
|
{ps=application/postscript}
|
||||||
|
{smi=application/smil}
|
||||||
|
{smil=application/smil}
|
||||||
|
{mif=application/vnd.mif}
|
||||||
|
{xls=application/vnd.ms-excel}
|
||||||
|
{ppt=application/powerpoint}
|
||||||
|
{wbxml=application/wbxml}
|
||||||
|
{wmlc=application/wmlc}
|
||||||
|
{dcr=application/x-director}
|
||||||
|
{dir=application/x-director}
|
||||||
|
{dxr=application/x-director}
|
||||||
|
{dvi=application/x-dvi}
|
||||||
|
{gtar=application/x-gtar}
|
||||||
|
{gz=application/x-gzip}
|
||||||
|
{php=application/x-httpd-php}
|
||||||
|
{php4=application/x-httpd-php}
|
||||||
|
{php3=application/x-httpd-php}
|
||||||
|
{phtml=application/x-httpd-php}
|
||||||
|
{phps=application/x-httpd-php-source}
|
||||||
|
{js=application/x-javascript}
|
||||||
|
{swf=application/x-shockwave-flash}
|
||||||
|
{sit=application/x-stuffit}
|
||||||
|
{tar=application/x-tar}
|
||||||
|
{tgz=application/x-tar}
|
||||||
|
{xhtml=application/xhtml+xml}
|
||||||
|
{xht=application/xhtml+xml}
|
||||||
|
{zip=application/x-zip}
|
||||||
|
{mid=audio/midi}
|
||||||
|
{midi=audio/midi}
|
||||||
|
{mpga=audio/mpeg}
|
||||||
|
{mp2=audio/mpeg}
|
||||||
|
{mp3=audio/mpeg}
|
||||||
|
{aif=audio/x-aiff}
|
||||||
|
{aiff=audio/x-aiff}
|
||||||
|
{aifc=audio/x-aiff}
|
||||||
|
{ram=audio/x-pn-realaudio}
|
||||||
|
{rm=audio/x-pn-realaudio}
|
||||||
|
{rpm=audio/x-pn-realaudio-plugin}
|
||||||
|
{ra=audio/x-realaudio}
|
||||||
|
{rv=video/vnd.rn-realvideo}
|
||||||
|
{wav=audio/x-wav}
|
||||||
|
{bmp=image/bmp}
|
||||||
|
{gif=image/gif}
|
||||||
|
{jpeg=image/jpeg}
|
||||||
|
{jpg=image/jpeg}
|
||||||
|
{jpe=image/jpeg}
|
||||||
|
{png=image/png}
|
||||||
|
{tiff=image/tiff}
|
||||||
|
{tif=image/tiff}
|
||||||
|
{css=text/css}
|
||||||
|
{html=text/html}
|
||||||
|
{htm=text/html}
|
||||||
|
{shtml=text/html}
|
||||||
|
{txt=text/plain}
|
||||||
|
{text=text/plain}
|
||||||
|
{log=text/plain}
|
||||||
|
{rtx=text/richtext}
|
||||||
|
{rtf=text/rtf}
|
||||||
|
{xml=text/xml}
|
||||||
|
{xsl=text/xml}
|
||||||
|
{mpeg=video/mpeg}
|
||||||
|
{mpg=video/mpeg}
|
||||||
|
{mpe=video/mpeg}
|
||||||
|
{qt=video/quicktime}
|
||||||
|
{mov=video/quicktime}
|
||||||
|
{avi=video/x-msvideo}
|
||||||
|
{flv=video/x-flv}
|
||||||
|
{movie=video/x-sgi-movie}
|
||||||
|
{doc=application/msword}
|
||||||
|
{xl=application/excel}
|
||||||
|
{eml=message/rfc822}
|
||||||
|
{pptx=application/vnd.openxmlformats-officedocument.presentationml.presentation}
|
||||||
|
{xlsx=application/vnd.openxmlformats-officedocument.spreadsheetml.sheet}
|
||||||
|
{docx=application/vnd.openxmlformats-officedocument.wordprocessingml.document}
|
||||||
|
{rar=application/x-rar-compressed}
|
||||||
|
{odb=application/vnd.oasis.opendocument.database}
|
||||||
|
{odc=application/vnd.oasis.opendocument.chart}
|
||||||
|
{odf=application/vnd.oasis.opendocument.formula}
|
||||||
|
{odg=application/vnd.oasis.opendocument.graphics}
|
||||||
|
{odi=application/vnd.oasis.opendocument.image}
|
||||||
|
{odm=application/vnd.oasis.opendocument.text-master}
|
||||||
|
{odp=application/vnd.oasis.opendocument.presentation}
|
||||||
|
{ods=application/vnd.oasis.opendocument.spreadsheet}
|
||||||
|
{odt=application/vnd.oasis.opendocument.text}
|
||||||
|
{sxc=application/vnd.sun.xml.calc}
|
||||||
|
{sxd=application/vnd.sun.xml.draw}
|
||||||
|
{sxg=application/vnd.sun.xml.writer.global}
|
||||||
|
{sxi=application/vnd.sun.xml.impress}
|
||||||
|
{sxm=application/vnd.sun.xml.math}
|
||||||
|
{sxw=application/vnd.sun.xml.writer}
|
||||||
|
{ogv=video/ogg}
|
||||||
|
{ogg=audio/ogg}
|
||||||
|
{mp4=video/mp4}
|
||||||
|
{mp4=application/octet-stream}" rows="8" cols="35" type="textarea" label="COM_PHOCADOWNLOAD_FIELD_ALLOWED_FILE_TYPES_DOWNLOAD_LABEL" description="COM_PHOCADOWNLOAD_FIELD_ALLOWED_FILE_TYPES_DOWNLOAD_DESC" />
|
||||||
|
|
||||||
|
<field name="allowed_file_types_upload" default="{pdf=application/pdf}
|
||||||
|
{ppt=application/powerpoint}
|
||||||
|
{gz=application/x-gzip}
|
||||||
|
{tar=application/x-tar}
|
||||||
|
{tgz=application/x-tar}
|
||||||
|
{zip=application/x-zip}
|
||||||
|
{bmp=image/bmp}
|
||||||
|
{gif=image/gif}
|
||||||
|
{jpeg=image/jpeg}
|
||||||
|
{jpg=image/jpeg}
|
||||||
|
{jpe=image/jpeg}
|
||||||
|
{png=image/png}
|
||||||
|
{tiff=image/tiff}
|
||||||
|
{tif=image/tiff}
|
||||||
|
{txt=text/plain}
|
||||||
|
{mpeg=video/mpeg}
|
||||||
|
{mpg=video/mpeg}
|
||||||
|
{mpe=video/mpeg}
|
||||||
|
{qt=video/quicktime}
|
||||||
|
{mov=video/quicktime}
|
||||||
|
{avi=video/x-msvideo}
|
||||||
|
{flv=video/x-flv}
|
||||||
|
{doc=application/msword}
|
||||||
|
{ogv=video/ogg}
|
||||||
|
{ogg=audio/ogg}
|
||||||
|
{mp4=video/mp4}
|
||||||
|
{mp4=application/octet-stream}" rows="8" cols="35" type="textarea" label="COM_PHOCADOWNLOAD_FIELD_ALLOWED_FILE_TYPES_UPLOAD_LABEL" description="COM_PHOCADOWNLOAD_FIELD_ALLOWED_FILE_TYPES_UPLOAD_DESC" />
|
||||||
|
|
||||||
|
<field name="disallowed_file_types_download" default="" rows="2" cols="35" type="textarea" label="COM_PHOCADOWNLOAD_FIELD_DISALLOWED_FILE_TYPES_DOWNLOAD_LABEL" description="COM_PHOCADOWNLOAD_FIELD_DISALLOWED_FILE_TYPES_DOWNLOAD_DESC" />
|
||||||
|
|
||||||
|
<field name="disallowed_file_types_upload" default="" rows="2" cols="35" type="textarea" label="COM_PHOCADOWNLOAD_FIELD_DISALLOWED_FILE_TYPES_UPLOAD_LABEL" description="COM_PHOCADOWNLOAD_FIELD_DISALLOWED_FILE_TYPES_UPLOAD_DESC" />
|
||||||
|
|
||||||
|
<field name="send_mail_download" type="user" section="com_phocadownload" default="0" label="COM_PHOCADOWNLOAD_FIELD_SEND_EMAIL_DOWNLOAD_LABEL" description="COM_PHOCADOWNLOAD_FIELD_SEND_EMAIL_DOWNLOAD_DESC" />
|
||||||
|
|
||||||
|
<field name="user_files_max_count_download" type="text" size="20" default="0" label="COM_PHOCADOWNLOAD_FIELD_MAX_COUNT_USER_DOWNLOADS_LABEL" description="COM_PHOCADOWNLOAD_FIELD_MAX_COUNT_USER_DOWNLOADS_DESC" />
|
||||||
|
|
||||||
|
<field name="enable_token_download" type="list" default="0" label="COM_PHOCADOWNLOAD_FIELD_ENABLE_TOKEN_DOWNLOAD_LABEL" description="COM_PHOCADOWNLOAD_FIELD_ENABLE_TOKEN_DOWNLOAD_DESC">
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_YES</option>
|
||||||
|
<option value="0">COM_PHOCADOWNLOAD_NO</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field name="token_files_max_count_download" type="text" size="20" default="0" label="COM_PHOCADOWNLOAD_FIELD_MAX_COUNT_TOKEN_DOWNLOADS_LABEL" description="COM_PHOCADOWNLOAD_FIELD_MAX_COUNT_TOKEN_DOWNLOADS_DESC" />
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset name="user_upload" label="COM_PHOCADOWNLOAD_CONFIG_HEAD_UPLOADS_LABEL">
|
||||||
|
<field name="enable_user_cp" type="list" default="0" label="COM_PHOCADOWNLOAD_FIELD_USER_UPLOAD_ENABLE_LABEL" description="COM_PHOCADOWNLOAD_FIELD_USER_UPLOAD_ENABLE_DESC">
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_YES</option>
|
||||||
|
<option value="0">COM_PHOCADOWNLOAD_NO</option>
|
||||||
|
</field>
|
||||||
|
<field name="user_files_max_count" type="text" size="20" default="5" label="COM_PHOCADOWNLOAD_FIELD_MAX_COUNT_USER_FILES_LABEL" description="COM_PHOCADOWNLOAD_FIELD_MAX_COUNT_USER_FILES_DESC" />
|
||||||
|
|
||||||
|
<field name="user_files_max_size" type="text" size="20" default="20971520" label="COM_PHOCADOWNLOAD_FIELD_MAX_SIZE_USER_FILES_LABEL" description="COM_PHOCADOWNLOAD_FIELD_MAX_SIZE_USER_FILES_DESC" />
|
||||||
|
|
||||||
|
<field name="user_file_upload_size" type="text" size="20" default="3145728" label="COM_PHOCADOWNLOAD_FIELD_USER_FILE_UPLOAD_SIZE_LABEL" description="COM_PHOCADOWNLOAD_FIELD_USER_FILE_UPLOAD_SIZE_DESC" />
|
||||||
|
|
||||||
|
<field name="enable_user_upload_approve" type="list" default="0" label="COM_PHOCADOWNLOAD_FIELD_ENABLE_APPROVE_USERFILE_LABEL" description="COM_PHOCADOWNLOAD_FIELD_ENABLE_APPROVE_USERFILE_DESC">
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_YES</option>
|
||||||
|
<option value="0">COM_PHOCADOWNLOAD_NO</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field name="user_ucp_lang" type="list" default="0" label="COM_PHOCADOWNLOAD_FIELD_USER_UCP_LANG_LABEL" description="COM_PHOCADOWNLOAD_FIELD_USER_UCP_LANG_DESC">
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_ALL</option>
|
||||||
|
<option value="2">COM_PHOCADOWNLOAD_USER_LANG</option>
|
||||||
|
<option value="3">COM_PHOCADOWNLOAD_SITE_LANG</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field name="send_mail_upload" type="user" section="com_phocadownload" default="0" label="COM_PHOCADOWNLOAD_FIELD_SEND_EMAIL_UPLOAD_LABEL" description="COM_PHOCADOWNLOAD_FIELD_SEND_EMAIL_UPLOAD_DESC" />
|
||||||
|
|
||||||
|
<field name="overwrite_existing_files" default="0" type="list" label="COM_PHOCADOWNLOAD_FIELD_OVERWRITE_EXISTING_FILES_LABEL" description="COM_PHOCADOWNLOAD_FIELD_OVERWRITE_EXISTING_FILES_DESC" >
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_YES</option>
|
||||||
|
<option value="0">COM_PHOCADOWNLOAD_NO</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field name="pap_copy" default="0" type="list" label="COM_PHOCADOWNLOAD_FIELD_PLAY_OR_PREVIEW_COPY_LABEL" description="COM_PHOCADOWNLOAD_FIELD_PLAY_OR_PREVIEW_COPY_DESC" >
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_YES_FRONTEND</option>
|
||||||
|
<option value="2">COM_PHOCADOWNLOAD_YES_BACKEND</option>
|
||||||
|
<option value="3">COM_PHOCADOWNLOAD_YES_FRONTEND_BACKEND</option>
|
||||||
|
<option value="0">COM_PHOCADOWNLOAD_NO</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field name="upload_maxsize" type="text" size="20" default="3145728" label="COM_PHOCADOWNLOAD_FIELD_UPLOAD_MAX_SIZE_ADMIN_LABEL" description="COM_PHOCADOWNLOAD_FIELD_UPLOAD_MAX_SIZE_ADMIN_DESC" />
|
||||||
|
<field name="enable_multiple_upload_admin" type="list" default="1" label="COM_PHOCADOWNLOAD_FIELD_ENABLE_MU_ADMIN_LABEL" description="COM_PHOCADOWNLOAD_FIELD_ENABLE_MU_ADMIN_DESC">
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_YES</option>
|
||||||
|
<option value="0">COM_PHOCADOWNLOAD_NO</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field name="multiple_upload_method" type="list" default="4" label="COM_PHOCADOWNLOAD_FIELD_MULTIPLE_UPLOAD_METHOD_LABEL" description="COM_PHOCADOWNLOAD_FIELD_MULTIPLE_UPLOAD_METHOD_DESC">
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_FLASH_UPLOADER</option>
|
||||||
|
<option value="2">COM_PHOCADOWNLOAD_GEARS_UPLOADER</option>
|
||||||
|
<option value="3">COM_PHOCADOWNLOAD_SILVERLIGHT_UPLOADER</option>
|
||||||
|
<option value="4">COM_PHOCADOWNLOAD_HTML5_UPLOADER</option>
|
||||||
|
<option value="5">COM_PHOCADOWNLOAD_BROWSERPLUS_UPLOADER</option>
|
||||||
|
<option value="6">COM_PHOCADOWNLOAD_HTML4_UPLOADER</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset name="general" label="COM_PHOCADOWNLOAD_CONFIG_HEAD_GENERAL_LABEL">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<field name="enable_user_statistics" default="1" type="list" label="COM_PHOCADOWNLOAD_FIELD_ENABLE_USER_STAT_LABEL" description="COM_PHOCADOWNLOAD_FIELD_ENABLE_USER_STAT_DESC" >
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_YES</option>
|
||||||
|
<option value="0">COM_PHOCADOWNLOAD_NO</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field name="enable_logging" default="0" type="list" label="COM_PHOCADOWNLOAD_FIELD_ENABLE_LOGGING_LABEL" description="COM_PHOCADOWNLOAD_FIELD_ENABLE_LOGGING_DESC" >
|
||||||
|
<option value="0">COM_PHOCADOWNLOAD_NO</option>
|
||||||
|
<option value="2">COM_PHOCADOWNLOAD_YES_UPLOADS_ONLY</option>
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_YES_DOWNLOADS_ONLY</option>
|
||||||
|
<option value="3">COM_PHOCADOWNLOAD_YES_UPLOADS_DOWNLOADS</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
|
||||||
|
<field name="delete_existing_files" default="0" type="list" label="COM_PHOCADOWNLOAD_FIELD_DELETE_EXISTING_FILES_LABEL" description="COM_PHOCADOWNLOAD_FIELD_DELETE_EXISTING_FILES_DESC" >
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_YES</option>
|
||||||
|
<option value="0">COM_PHOCADOWNLOAD_NO</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field name="description" default="" type="editor" class="inputbox" label="COM_PHOCADOWNLOAD_FIELD_DESCRIPTION_LABEL" description="COM_PHOCADOWNLOAD_FIELD_DESCRIPTION_DESC" filter="safehtml" />
|
||||||
|
|
||||||
|
|
||||||
|
<field name="registered_access_level" type="phocaaccesslevel" label="COM_PHOCADOWNLOAD_FIELD_REGISTERED_ACCESS_LEVEL_LABEL" description="COM_PHOCADOWNLOAD_FIELD_REGISTERED_ACCESS_LEVEL_DESC" multiple="true" size="10" >
|
||||||
|
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field name="phocaheadexpert1" type="phocaheadexpert" default="COM_PHOCADOWNLOAD_EXPERTS_ONLY_LABEL" label="" description=""/>
|
||||||
|
|
||||||
|
<field name="download_folder" default="phocadownload" size="40" type="text" label="COM_PHOCADOWNLOAD_FIELD_DOWNLOAD_FOLDER_LABEL" description="COM_PHOCADOWNLOAD_FIELD_DOWNLOAD_FOLDER_DESC" />
|
||||||
|
<field name="download_folder_pap" default="phocadownloadpap" size="40" type="text" label="COM_PHOCADOWNLOAD_FIELD_DOWNLOAD_FOLDER_PAP_LABEL" description="COM_PHOCADOWNLOAD_FIELD_DOWNLOAD_FOLDER_PAP_DESC" />
|
||||||
|
|
||||||
|
<field name="absolute_path" default="" size="40" type="text" label="COM_PHOCADOWNLOAD_FIELD_ABSOLUTE_PATH_LABEL" description="COM_PHOCADOWNLOAD_FIELD_ABSOLUTE_PATH_DESC" />
|
||||||
|
|
||||||
|
<field name="enable_plugin_query" type="list" default="0" label="COM_PHOCADOWNLOAD_FIELD_ENABLE_PLUGIN_QUERY_LABEL" description="COM_PHOCADOWNLOAD_FIELD_ENABLE_PLUGIN_QUERY_DESC">
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_YES</option>
|
||||||
|
<option value="0">COM_PHOCADOWNLOAD_NO</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
|
||||||
|
<field name="enable_cache" type="list" default="0" label="COM_PHOCADOWNLOAD_FIELD_ENABLE_CACHE_LABEL" description="COM_PHOCADOWNLOAD_FIELD_ENABLE_CACHE_DESC">
|
||||||
|
<option value="1">COM_PHOCADOWNLOAD_YES</option>
|
||||||
|
<option value="0">COM_PHOCADOWNLOAD_NO</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field name="bt_cat_col_left" default="" size="40" type="text" label="COM_PHOCADOWNLOAD_FIELD_COLUMN_SIZE_CATEGORY_VIEW_LABEL" description="COM_PHOCADOWNLOAD_FIELD_COLUMN_SIZE_CATEGORY_VIEW_DESC" />
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
|
||||||
|
<fieldset name="permissions" description="JCONFIG_PERMISSIONS_DESC" label="JCONFIG_PERMISSIONS_LABEL">
|
||||||
|
<field name="rules" type="rules" component="com_phocadownload" filter="rules" label="COM_PHOCADOWNLOAD_FIELD_JCONFIG_PERMISSIONS_LABEL" section="component" description="COM_PHOCADOWNLOAD_FIELD_JCONFIG_PERMISSIONS_DESC"/>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
</fields>
|
||||||
|
</config>
|
||||||
@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
/* @package Joomla
|
||||||
|
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
* @extension Phoca Extension
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
jimport('joomla.application.component.controller');
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$option = $app->input->get('option');
|
||||||
|
|
||||||
|
$l['cp'] = array('COM_PHOCADOWNLOAD_CONTROL_PANEL', '');
|
||||||
|
$l['f'] = array('COM_PHOCADOWNLOAD_FILES', 'phocadownloadfiles');
|
||||||
|
$l['c'] = array('COM_PHOCADOWNLOAD_CATEGORIES', 'phocadownloadcats');
|
||||||
|
$l['l'] = array('COM_PHOCADOWNLOAD_LICENSES', 'phocadownloadlics');
|
||||||
|
$l['st'] = array('COM_PHOCADOWNLOAD_STATISTICS', 'phocadownloadstat');
|
||||||
|
$l['d'] = array('COM_PHOCADOWNLOAD_DOWNLOADS', 'phocadownloaddownloads');
|
||||||
|
$l['u'] = array('COM_PHOCADOWNLOAD_UPLOADS', 'phocadownloaduploads');
|
||||||
|
$l['fr'] = array('COM_PHOCADOWNLOAD_FILE_RATING', 'phocadownloadrafile');
|
||||||
|
$l['t'] = array('COM_PHOCADOWNLOAD_TAGS', 'phocadownloadtags');
|
||||||
|
$l['ly'] = array('COM_PHOCADOWNLOAD_LAYOUT', 'phocadownloadlayouts');
|
||||||
|
$l['sty'] = array('COM_PHOCADOWNLOAD_STYLES', 'phocadownloadstyles');
|
||||||
|
$l['log'] = array('COM_PHOCADOWNLOAD_LOGGING', 'phocadownloadlogs');
|
||||||
|
$l['in'] = array('COM_PHOCADOWNLOAD_INFO', 'phocadownloadinfo');
|
||||||
|
|
||||||
|
// Submenu view
|
||||||
|
//$view = JRequest::getVar( 'view', '', '', 'string', JREQUEST_ALLOWRAW );
|
||||||
|
//$layout = JRequest::getVar( 'layout', '', '', 'string', JREQUEST_ALLOWRAW );
|
||||||
|
$view = JFactory::getApplication()->input->get('view');
|
||||||
|
$layout = JFactory::getApplication()->input->get('layout');
|
||||||
|
|
||||||
|
if ($layout == 'edit') {
|
||||||
|
} else {
|
||||||
|
foreach ($l as $k => $v) {
|
||||||
|
|
||||||
|
if ($v[1] == '') {
|
||||||
|
$link = 'index.php?option='.$option;
|
||||||
|
} else {
|
||||||
|
$link = 'index.php?option='.$option.'&view=';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($view == $v[1]) {
|
||||||
|
JHtmlSidebar::addEntry(JText::_($v[0]), $link.$v[1], true );
|
||||||
|
} else {
|
||||||
|
JHtmlSidebar::addEntry(JText::_($v[0]), $link.$v[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class PhocadownloadCpController extends JControllerLegacy {
|
||||||
|
function display($cachable = false, $urlparams = array()) {
|
||||||
|
parent::display($cachable , $urlparams);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* @package Joomla.Framework
|
||||||
|
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*
|
||||||
|
* @component Phoca Component
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
|
||||||
|
*/
|
||||||
|
defined('_JEXEC') or die();
|
||||||
|
jimport('joomla.application.component.controllerform');
|
||||||
|
|
||||||
|
class PhocaDownloadCpControllerPhocaDownloadcat extends JControllerForm
|
||||||
|
{
|
||||||
|
protected $option = 'com_phocadownload';
|
||||||
|
|
||||||
|
function __construct($config=array()) {
|
||||||
|
parent::__construct($config);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function allowAdd($data = array()) {
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$allow = null;
|
||||||
|
$allow = $user->authorise('core.create', 'com_phocadownload');
|
||||||
|
if ($allow === null) {
|
||||||
|
return parent::allowAdd($data);
|
||||||
|
} else {
|
||||||
|
return $allow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function allowEdit($data = array(), $key = 'id') {
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$allow = null;
|
||||||
|
$allow = $user->authorise('core.edit', 'com_phocadownload');
|
||||||
|
if ($allow === null) {
|
||||||
|
return parent::allowEdit($data, $key);
|
||||||
|
} else {
|
||||||
|
return $allow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function batch($model = null) {
|
||||||
|
JRequest::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||||
|
|
||||||
|
// Set the model
|
||||||
|
$model = $this->getModel('phocadownloadcat', '', array());
|
||||||
|
|
||||||
|
// Preset the redirect
|
||||||
|
$this->setRedirect(JRoute::_('index.php?option=com_phocadownload&view=phocadownloadcats'.$this->getRedirectToListAppend(), false));
|
||||||
|
|
||||||
|
return parent::batch($model);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
/* @package Joomla
|
||||||
|
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
* @extension Phoca Extension
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
jimport('joomla.application.component.controlleradmin');
|
||||||
|
|
||||||
|
class PhocaDownloadCpControllerPhocaDownloadcats extends JControllerAdmin
|
||||||
|
{
|
||||||
|
protected $option = 'com_phocadownload';
|
||||||
|
|
||||||
|
public function __construct($config = array())
|
||||||
|
{
|
||||||
|
parent::__construct($config);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function &getModel($name = 'PhocaDownloadcat', $prefix = 'PhocaDownloadCpModel', $config = array())
|
||||||
|
{
|
||||||
|
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
|
||||||
|
return $model;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function saveOrderAjax() {
|
||||||
|
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||||
|
$pks = $this->input->post->get('cid', array(), 'array');
|
||||||
|
$order = $this->input->post->get('order', array(), 'array');
|
||||||
|
JArrayHelper::toInteger($pks);
|
||||||
|
JArrayHelper::toInteger($order);
|
||||||
|
$model = $this->getModel();
|
||||||
|
$return = $model->saveorder($pks, $order);
|
||||||
|
if ($return) { echo "1";}
|
||||||
|
JFactory::getApplication()->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
/* @package Joomla
|
||||||
|
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
* @extension Phoca Extension
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die();
|
||||||
|
jimport('joomla.application.component.controllerform');
|
||||||
|
|
||||||
|
class PhocaDownloadCpControllerPhocaDownloadDownloads extends JControllerForm
|
||||||
|
{
|
||||||
|
protected $option = 'com_phocadownload';
|
||||||
|
|
||||||
|
public function &getModel($name = 'PhocaDownloadDownloads', $prefix = 'PhocaDownloadCpModel')
|
||||||
|
{
|
||||||
|
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
|
||||||
|
return $model;
|
||||||
|
}
|
||||||
|
|
||||||
|
function cancel($key = NULL) {
|
||||||
|
$model = $this->getModel( 'phocadownload' );
|
||||||
|
$this->setRedirect( 'index.php?option=com_phocadownload&view=phocadownloaddownloads' );
|
||||||
|
}
|
||||||
|
|
||||||
|
function reset() {
|
||||||
|
|
||||||
|
$post = JRequest::get('post');
|
||||||
|
$cid = JRequest::getVar( 'cid', array(0), 'post', 'array' );
|
||||||
|
$idFile = JRequest::getVar( 'idfile', 0, 'post', 'int' );
|
||||||
|
|
||||||
|
$model = $this->getModel( 'phocadownloaddownloads' );
|
||||||
|
|
||||||
|
if ($model->reset($cid)) {
|
||||||
|
$msg = JText::_( 'COM_PHOCADOWNLOAD_SUCCESS_RESET_USER_STAT' );
|
||||||
|
} else {
|
||||||
|
$msg = JText::_( 'COM_PHOCADOWNLOAD_ERROR_RESET_USER_STAT' );
|
||||||
|
}
|
||||||
|
|
||||||
|
$link = 'index.php?option=com_phocadownload&view=phocadownloaddownloads&id='.(int)$idFile;
|
||||||
|
$this->setRedirect($link, $msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,79 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* @package Joomla.Framework
|
||||||
|
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*
|
||||||
|
* @component Phoca Component
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
defined('_JEXEC') or die();
|
||||||
|
jimport('joomla.application.component.controllerform');
|
||||||
|
|
||||||
|
class PhocaDownloadCpControllerPhocaDownloadFile extends JControllerForm
|
||||||
|
{
|
||||||
|
protected $option = 'com_phocadownload';
|
||||||
|
|
||||||
|
function __construct($config=array()) {
|
||||||
|
|
||||||
|
parent::__construct($config);
|
||||||
|
|
||||||
|
$task = JRequest::getVar('task');
|
||||||
|
if ((string)$task == 'addtext') {
|
||||||
|
JRequest::setVar('task','add');
|
||||||
|
JRequest::setVar('layout','edit_text');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function allowAdd($data = array()) {
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$allow = null;
|
||||||
|
$allow = $user->authorise('core.create', 'com_phocadownload');
|
||||||
|
if ($allow === null) {
|
||||||
|
return parent::allowAdd($data);
|
||||||
|
} else {
|
||||||
|
return $allow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function allowEdit($data = array(), $key = 'id') {
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$allow = null;
|
||||||
|
$allow = $user->authorise('core.edit', 'com_phocadownload');
|
||||||
|
if ($allow === null) {
|
||||||
|
return parent::allowEdit($data, $key);
|
||||||
|
} else {
|
||||||
|
return $allow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function batch($model = null) {
|
||||||
|
JRequest::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||||
|
|
||||||
|
// Set the model
|
||||||
|
$model = $this->getModel('phocadownloadfile', '', array());
|
||||||
|
|
||||||
|
// Preset the redirect
|
||||||
|
$this->setRedirect(JRoute::_('index.php?option=com_phocadownload&view=phocadownloadfiles'.$this->getRedirectToListAppend(), false));
|
||||||
|
|
||||||
|
return parent::batch($model);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
function copyquick() {
|
||||||
|
$cid = JRequest::getVar( 'cid', array(0), 'post', 'array' );
|
||||||
|
$model = $this->getModel( 'phocadownloadfile' );
|
||||||
|
if ($model->copyQuick($cid)) {
|
||||||
|
$msg = JText::_( 'COM_PHOCADOWNLOAD_SUCCESS_COPY_FILE' );
|
||||||
|
} else {
|
||||||
|
$msg = JText::_( 'COM_PHOCADOWNLOAD_ERROR_COPY_FILE' );
|
||||||
|
}
|
||||||
|
$link = 'index.php?option=com_phocadownload&view=phocadownloadfiles';
|
||||||
|
$this->setRedirect($link, $msg);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,81 @@
|
|||||||
|
<?php
|
||||||
|
/* @package Joomla
|
||||||
|
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
* @extension Phoca Extension
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
jimport('joomla.application.component.controlleradmin');
|
||||||
|
|
||||||
|
class PhocaDownloadCpControllerPhocaDownloadFiles extends JControllerAdmin
|
||||||
|
{
|
||||||
|
protected $option = 'com_phocadownload';
|
||||||
|
|
||||||
|
public function __construct($config = array())
|
||||||
|
{
|
||||||
|
parent::__construct($config);
|
||||||
|
$this->registerTask('disapprove', 'approve');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function &getModel($name = 'PhocaDownloadFile', $prefix = 'PhocaDownloadCpModel', $config = array())
|
||||||
|
{
|
||||||
|
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
|
||||||
|
return $model;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function approve()
|
||||||
|
{
|
||||||
|
// Check for request forgeries
|
||||||
|
JRequest::checkToken() or die(JText::_('JINVALID_TOKEN'));
|
||||||
|
|
||||||
|
// Get items to publish from the request.
|
||||||
|
$cid = JRequest::getVar('cid', array(), '', 'array');
|
||||||
|
$data = array('approve' => 1, 'disapprove' => 0);
|
||||||
|
$task = $this->getTask();
|
||||||
|
$value = JArrayHelper::getValue($data, $task, 0, 'int');
|
||||||
|
|
||||||
|
if (empty($cid)) {
|
||||||
|
JError::raiseWarning(500, JText::_($this->text_prefix.'_NO_ITEM_SELECTED'));
|
||||||
|
} else {
|
||||||
|
// Get the model.
|
||||||
|
$model = $this->getModel();
|
||||||
|
|
||||||
|
// Make sure the item ids are integers
|
||||||
|
JArrayHelper::toInteger($cid);
|
||||||
|
|
||||||
|
// Publish the items.
|
||||||
|
|
||||||
|
if (!$model->approve($cid, $value)) {
|
||||||
|
JError::raiseWarning(500, $model->getError());
|
||||||
|
} else {
|
||||||
|
if ($value == 1) {
|
||||||
|
$ntext = $this->text_prefix.'_N_ITEMS_APPROVED';
|
||||||
|
} else if ($value == 0) {
|
||||||
|
$ntext = $this->text_prefix.'_N_ITEMS_DISAPPROVED';
|
||||||
|
}
|
||||||
|
$this->setMessage(JText::plural($ntext, count($cid)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->setRedirect(JRoute::_('index.php?option='.$this->option.'&view='.$this->view_list, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function saveOrderAjax() {
|
||||||
|
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||||
|
$pks = $this->input->post->get('cid', array(), 'array');
|
||||||
|
$order = $this->input->post->get('order', array(), 'array');
|
||||||
|
JArrayHelper::toInteger($pks);
|
||||||
|
JArrayHelper::toInteger($order);
|
||||||
|
$model = $this->getModel();
|
||||||
|
$return = $model->saveorder($pks, $order);
|
||||||
|
if ($return) { echo "1";}
|
||||||
|
JFactory::getApplication()->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* @package Joomla 1.5
|
||||||
|
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
*
|
||||||
|
* @component Phoca Component
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Check to ensure this file is included in Joomla!
|
||||||
|
defined('_JEXEC') or die();
|
||||||
|
|
||||||
|
class PhocaDownloadCpControllerPhocaDownloadinfo extends PhocaDownloadCpController
|
||||||
|
{
|
||||||
|
function __construct() {
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
function cancel($key = NULL) {
|
||||||
|
$this->setRedirect( 'index.php?option=com_phocadownload' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,993 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* @package Joomla.Framework
|
||||||
|
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*
|
||||||
|
* @component Phoca Component
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
|
||||||
|
*/
|
||||||
|
defined('_JEXEC') or die();
|
||||||
|
|
||||||
|
class PhocaDownloadCpControllerPhocaDownloadinstall extends PhocaDownloadCpController
|
||||||
|
{
|
||||||
|
function __construct(){
|
||||||
|
parent::__construct();
|
||||||
|
$this->registerTask( 'install' , 'install' );
|
||||||
|
$this->registerTask( 'upgrade' , 'upgrade' );
|
||||||
|
}
|
||||||
|
|
||||||
|
function install() {
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
$msgSQL = '';
|
||||||
|
$msgFile = '';
|
||||||
|
$msgError = '';
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
$query =' DROP TABLE IF EXISTS '.$db->quoteName('#__phocadownload_categories').' ;';
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||||
|
|
||||||
|
|
||||||
|
$query ='CREATE TABLE '.$db->quoteName('#__phocadownload_categories').' ('."\n";
|
||||||
|
$query.=' '.$db->quoteName('id').' int(11) NOT NULL auto_increment,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('parent_id').' int(11) NOT NULL default 0,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('section').' int(11) NOT NULL default 0,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('title').' varchar(255) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('name').' varchar(255) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('alias').' varchar(255) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('image').' varchar(255) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('image_position').' varchar(30) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('description').' text,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('published').' tinyint(1) NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('checked_out').' int(11) unsigned NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('checked_out_time').' datetime NOT NULL default \'0000-00-00 00:00:00\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('editor').' varchar(50) default NULL,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('ordering').' int(11) NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('access').' int(11) unsigned NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('uploaduserid').' text,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('accessuserid').' text,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('deleteuserid').' text,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('date').' datetime NOT NULL default \'0000-00-00 00:00:00\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('count').' int(11) NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('params').' text,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('hits').' int(11) NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('metakey').' text,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('metadesc').' text,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('metadata').' text,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('language').' char(7) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' PRIMARY KEY ('.$db->quoteName('id').'),'."\n";
|
||||||
|
$query.=' KEY '.$db->quoteName('cat_idx').' ('.$db->quoteName('section').', '. $db->quoteName('published').', '. $db->quoteName('access').'),'."\n";
|
||||||
|
$query.=' KEY '.$db->quoteName('idx_access').' ('.$db->quoteName('access').'),'."\n";
|
||||||
|
$query.=' KEY '.$db->quoteName('idx_checkout').' ('.$db->quoteName('checked_out').')'."\n";
|
||||||
|
$query.=') default CHARSET=utf8;';
|
||||||
|
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------
|
||||||
|
/*
|
||||||
|
$query=' DROP TABLE IF EXISTS '.$db->quoteName('#__phocadownload_sections').' ;'."\n";
|
||||||
|
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||||
|
|
||||||
|
$query ='CREATE TABLE '.$db->quoteName('#__phocadownload_sections').' ('."\n";
|
||||||
|
$query.=' '.$db->quoteName('id').' int(11) NOT NULL auto_increment,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('title').' varchar(255) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('name').' varchar(255) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('alias').' varchar(255) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('image').' text,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('scope').' varchar(50) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('image_position').' varchar(30) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('description').' text,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('published').' tinyint(1) NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('checked_out').' int(11) unsigned NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('checked_out_time').' datetime NOT NULL default \'0000-00-00 00:00:00\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('ordering').' int(11) NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('access').' int(11) unsigned NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('date').' datetime NOT NULL default \'0000-00-00 00:00:00\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('count').' int(11) NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('params').' text,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('metakey').' text,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('metadesc').' text,'."\n";
|
||||||
|
$query.=' PRIMARY KEY ('.$db->quoteName('id').'),'."\n";
|
||||||
|
$query.=' KEY '.$db->quoteName('idx_scope').' ('.$db->quoteName('scope').')'."\n";
|
||||||
|
$query.=') TYPE=MyISAM CHARACTER SET '.$db->quoteName('utf8').' ;';
|
||||||
|
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||||
|
*/
|
||||||
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
$query=' DROP TABLE IF EXISTS '.$db->quoteName('#__phocadownload').' ;'."\n";
|
||||||
|
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||||
|
|
||||||
|
$query ='CREATE TABLE '.$db->quoteName('#__phocadownload').' ('."\n";
|
||||||
|
$query.=' '.$db->quoteName('id').' int(11) unsigned NOT NULL auto_increment,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('catid').' int(11) NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('sectionid').' int(11) NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('owner_id').' int(11) NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('sid').' int(11) NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('title').' varchar(250) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('alias').' varchar(255) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('filename').' varchar(250) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('filesize').' int(11) NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('filename_play').' varchar(250) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('filename_preview').' varchar(250) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('author').' varchar(255) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('author_email').' varchar(255) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('author_url').' varchar(255) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('license').' varchar(255) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('license_url').' varchar(255) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('video_filename').' varchar(255) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('image_filename').' varchar(255) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('image_filename_spec1').' varchar(255) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('image_filename_spec2').' varchar(255) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('image_download').' varchar(255) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('link_external').' varchar(255) NOT NULL default \'\','."\n";
|
||||||
|
|
||||||
|
$query.=' '.$db->quoteName('mirror1link').' varchar(255) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('mirror1title').' varchar(255) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('mirror1target').' varchar(10) NOT NULL default \'\','."\n";
|
||||||
|
|
||||||
|
$query.=' '.$db->quoteName('mirror2link').' varchar(255) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('mirror2title').' varchar(255) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('mirror2target').' varchar(10) NOT NULL default \'\','."\n";
|
||||||
|
|
||||||
|
$query.=' '.$db->quoteName('description').' text,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('features').' text,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('changelog').' text,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('notes').' text,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('userid').' int(11) NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('version').' varchar(255) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('directlink').' tinyint(1) NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('date').' datetime NOT NULL default \'0000-00-00 00:00:00\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('publish_up').' datetime NOT NULL default \'0000-00-00 00:00:00\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('publish_down').' datetime NOT NULL default \'0000-00-00 00:00:00\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('hits').' int(11) NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('textonly').' tinyint(1) NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('published').' tinyint(1) NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('approved').' tinyint(3) unsigned NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('checked_out').' int(11) NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('checked_out_time').' datetime NOT NULL default \'0000-00-00 00:00:00\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('ordering').' int(11) NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('access').' int(11) unsigned NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('confirm_license').' int(11) NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('unaccessible_file').' int(11) NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('params').' text,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('metakey').' text,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('metadesc').' text,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('metadata').' text,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('language').' char(7) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' PRIMARY KEY ('.$db->quoteName('id').'),'."\n";
|
||||||
|
$query.=' KEY '.$db->quoteName('catid').' ('.$db->quoteName('catid').', '. $db->quoteName('published').')'."\n";
|
||||||
|
$query.=') default CHARSET=utf8;';
|
||||||
|
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------
|
||||||
|
/*
|
||||||
|
$query=' DROP TABLE IF EXISTS '.$db->quoteName('#__phocadownload_settings').' ;'."\n";
|
||||||
|
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||||
|
|
||||||
|
$query =' CREATE TABLE '.$db->quoteName('#__phocadownload_settings').' ('."\n";
|
||||||
|
$query.=' '.$db->quoteName('id').' int(11) unsigned NOT NULL auto_increment,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('title').' varchar(250) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('value').' text,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('values').' text,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('type').' varchar(50) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' PRIMARY KEY ('.$db->quoteName('id').')'."\n";
|
||||||
|
$query.=') TYPE=MyISAM CHARACTER SET '.$db->quoteName('utf8').' ;';
|
||||||
|
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||||
|
|
||||||
|
// VALUES
|
||||||
|
|
||||||
|
$queries[] = "INSERT INTO ".$db->quoteName('#__phocadownload_settings')." VALUES (null, 'download_folder', 'phocadownload','', 'text');"."\n";
|
||||||
|
|
||||||
|
$queries[] = "INSERT INTO ".$db->quoteName('#__phocadownload_settings')." VALUES (null, 'allowed_file_types', '{hqx=application/mac-binhex40}\n{cpt=application/mac-compactpro}\n{csv=text/x-comma-separated-values}\n{bin=application/macbinary}\n{dms=application/octet-stream}\n{lha=application/octet-stream}\n{lzh=application/octet-stream}\n{exe=application/octet-stream}\n{class=application/octet-stream}\n{psd=application/x-photoshop}\n{so=application/octet-stream}\n{sea=application/octet-stream}\n{dll=application/octet-stream}\n{oda=application/oda}\n{pdf=application/pdf}\n{ai=application/postscript}\n{eps=application/postscript}\n{ps=application/postscript}\n{smi=application/smil}\n{smil=application/smil}\n{mif=application/vnd.mif}\n{xls=application/vnd.ms-excel}\n{ppt=application/powerpoint}\n{wbxml=application/wbxml}\n{wmlc=application/wmlc}\n{dcr=application/x-director}\n{dir=application/x-director}\n{dxr=application/x-director}\n{dvi=application/x-dvi}\n{gtar=application/x-gtar}\n{gz=application/x-gzip}\n{php=application/x-httpd-php}\n{php4=application/x-httpd-php}\n{php3=application/x-httpd-php}\n{phtml=application/x-httpd-php}\n{phps=application/x-httpd-php-source}\n{js=application/x-javascript}\n{swf=application/x-shockwave-flash}\n{sit=application/x-stuffit}\n{tar=application/x-tar}\n{tgz=application/x-tar}\n{xhtml=application/xhtml+xml}\n{xht=application/xhtml+xml}\n{zip=application/x-zip}\n{mid=audio/midi}\n{midi=audio/midi}\n{mpga=audio/mpeg}\n{mp2=audio/mpeg}\n{mp3=audio/mpeg}\n{aif=audio/x-aiff}\n{aiff=audio/x-aiff}\n{aifc=audio/x-aiff}\n{ram=audio/x-pn-realaudio}\n{rm=audio/x-pn-realaudio}\n{rpm=audio/x-pn-realaudio-plugin}\n{ra=audio/x-realaudio}\n{rv=video/vnd.rn-realvideo}\n{wav=audio/x-wav}\n{bmp=image/bmp}\n{gif=image/gif}\n{jpeg=image/jpeg}\n{jpg=image/jpeg}\n{jpe=image/jpeg}\n{png=image/png}\n{tiff=image/tiff}\n{tif=image/tiff}\n{css=text/css}\n{html=text/html}\n{htm=text/html}\n{shtml=text/html}\n{txt=text/plain}\n{text=text/plain}\n{log=text/plain}\n{rtx=text/richtext}\n{rtf=text/rtf}\n{xml=text/xml}\n{xsl=text/xml}\n{mpeg=video/mpeg}\n{mpg=video/mpeg}\n{mpe=video/mpeg}\n{qt=video/quicktime}\n{mov=video/quicktime}\n{avi=video/x-msvideo}\n{flv=video/x-flv}\n{movie=video/x-sgi-movie}\n{doc=application/msword}\n{xl=application/excel}\n{eml=message/rfc822}', '', 'textarea');"."\n";
|
||||||
|
|
||||||
|
$queries[] = "INSERT INTO ".$db->quoteName('#__phocadownload_settings')." VALUES (null, 'disallowed_file_types', '','', 'textarea');"."\n";
|
||||||
|
$queries[] = "INSERT INTO ".$db->quoteName('#__phocadownload_settings')." VALUES (null, 'upload_maxsize', '3145728','', 'text');"."\n";
|
||||||
|
$queries[] = "INSERT INTO ".$db->quoteName('#__phocadownload_settings')." VALUES (null, 'enable_flash', 0,'{0=No}{1=Yes}', 'select');"."\n";
|
||||||
|
|
||||||
|
// Version 1.0.6
|
||||||
|
$queries[] = "INSERT INTO ".$db->quoteName('#__phocadownload_settings')." VALUES (null, 'enable_user_statistics', 1,'{0=No}{1=Yes}', 'select');"."\n";
|
||||||
|
// Version 1.1.0
|
||||||
|
$queries[] = "INSERT INTO ".$db->quoteName('#__phocadownload_settings')." VALUES (null, 'absolute_path', '','', 'text');"."\n";
|
||||||
|
// Version 1.3.4
|
||||||
|
$queries[] = "INSERT INTO ".$db->quoteName('#__phocadownload_settings')." VALUES (null, 'description', '','', 'textareaeditor');"."\n";
|
||||||
|
|
||||||
|
foreach ($queries as $valueQuery) {
|
||||||
|
$db->setQuery( $valueQuery );
|
||||||
|
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
$query=' DROP TABLE IF EXISTS '.$db->quoteName('#__phocadownload_user_stat').' ;'."\n";
|
||||||
|
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||||
|
|
||||||
|
$query='CREATE TABLE '.$db->quoteName('#__phocadownload_user_stat').' ('."\n";
|
||||||
|
$query.=' '.$db->quoteName('id').' int(11) NOT NULL auto_increment,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('fileid').' int(11) NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('userid').' int(11) NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('count').' int(11) NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('date').' datetime NOT NULL default \'0000-00-00 00:00:00\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('published').' tinyint(1) NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('ordering').' int(11) NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('language').' char(7) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' PRIMARY KEY ('.$db->quoteName('id').')'."\n";
|
||||||
|
$query.=') default CHARSET=utf8;';
|
||||||
|
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
$query=' DROP TABLE IF EXISTS '.$db->quoteName('#__phocadownload_licenses').' ;'."\n";
|
||||||
|
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||||
|
|
||||||
|
$query ='CREATE TABLE '.$db->quoteName('#__phocadownload_licenses').' ('."\n";
|
||||||
|
$query.=' '.$db->quoteName('id').' int(11) NOT NULL auto_increment,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('title').' varchar(255) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('alias').' varchar(255) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('description').' text,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('checked_out').' int(11) unsigned NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('checked_out_time').' datetime NOT NULL default \'0000-00-00 00:00:00\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('published').' tinyint(1) NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('ordering').' int(11) NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('language').' char(7) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' PRIMARY KEY ('.$db->quoteName('id').')'."\n";
|
||||||
|
$query.=') default CHARSET=utf8;';
|
||||||
|
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||||
|
|
||||||
|
|
||||||
|
// ------------------------------------------
|
||||||
|
// PHOCADOWNLOAD FILE VOTES (2.0.0 RC2)
|
||||||
|
// ------------------------------------------
|
||||||
|
$query ='DROP TABLE IF EXISTS '.$db->quoteName('#__phocadownload_file_votes').';'."\n";
|
||||||
|
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||||
|
|
||||||
|
$query =' CREATE TABLE '.$db->quoteName('#__phocadownload_file_votes').' ('."\n";
|
||||||
|
$query.=' '.$db->quoteName('id').' int(11) NOT NULL auto_increment,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('fileid').' int(11) NOT NULL default 0,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('userid').' int(11) NOT NULL default 0,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('date').' datetime NOT NULL default \'0000-00-00 00:00:00\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('rating').' tinyint(1) NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('published').' tinyint(1) NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('checked_out').' int(11) unsigned NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('checked_out_time').' datetime NOT NULL default \'0000-00-00 00:00:00\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('ordering').' int(11) NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('params').' text,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('language').' char(7) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' PRIMARY KEY ('.$db->quoteName('id').')'."\n";
|
||||||
|
$query.=') default CHARSET=utf8;'."\n";
|
||||||
|
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||||
|
|
||||||
|
// ------------------------------------------
|
||||||
|
// PHOCADOWNLOAD FILE VOTES STATISTICS (2.0.0 RC2)
|
||||||
|
// ------------------------------------------
|
||||||
|
$query ='DROP TABLE IF EXISTS '.$db->quoteName('#__phocadownload_file_votes_statistics').';'."\n";
|
||||||
|
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||||
|
|
||||||
|
$query =' CREATE TABLE '.$db->quoteName('#__phocadownload_file_votes_statistics').' ('."\n";
|
||||||
|
$query.=' '.$db->quoteName('id').' int(11) NOT NULL auto_increment,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('fileid').' int(11) NOT NULL default 0,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('count').' int(11) NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('average').' float(8,6) NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('language').' char(7) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' PRIMARY KEY ('.$db->quoteName('id').')'."\n";
|
||||||
|
$query.=') default CHARSET=utf8;'."\n";
|
||||||
|
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||||
|
|
||||||
|
|
||||||
|
// ------------------------------------------
|
||||||
|
// PHOCADOWNLOAD TAGS (2.1.0)
|
||||||
|
// ------------------------------------------
|
||||||
|
|
||||||
|
$query =' DROP TABLE IF EXISTS '.$db->quoteName('#__phocadownload_tags').' ;';
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||||
|
|
||||||
|
$query ='CREATE TABLE '.$db->quoteName('#__phocadownload_tags').' ('."\n";
|
||||||
|
$query.=' '.$db->quoteName('id').' int(11) NOT NULL auto_increment,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('title').' varchar(255) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('alias').' varchar(255) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('link_cat').' int(11) NOT NULL default 0,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('link_ext').' varchar(255) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('description').' text,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('published').' tinyint(1) NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('checked_out').' int(11) unsigned NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('checked_out_time').' datetime NOT NULL default \'0000-00-00 00:00:00\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('ordering').' int(11) NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('params').' text,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('language').' char(7) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' PRIMARY KEY ('.$db->quoteName('id').')'."\n";
|
||||||
|
$query.=') default CHARSET=utf8;'."\n";
|
||||||
|
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$query =' DROP TABLE IF EXISTS '.$db->quoteName('#__phocadownload_tags_ref').' ;';
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||||
|
|
||||||
|
$query ='CREATE TABLE '.$db->quoteName('#__phocadownload_tags_ref').' ('."\n";
|
||||||
|
$query.=' '.$db->quoteName('id').' SERIAL,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('fileid').' int(11) NOT NULL default 0,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('tagid').' int(11) NOT NULL default 0,'."\n";
|
||||||
|
$query.=' PRIMARY KEY ('.$db->quoteName('id').'),'."\n";
|
||||||
|
$query.=' UNIQUE KEY '.$db->quoteName('i_fileid').' ('.$db->quoteName('fileid').','.$db->quoteName('tagid').')'."\n";
|
||||||
|
$query.=') default CHARSET=utf8;'."\n";
|
||||||
|
|
||||||
|
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$query =' DROP TABLE IF EXISTS '.$db->quoteName('#__phocadownload_layout').' ;';
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||||
|
|
||||||
|
$query ='CREATE TABLE '.$db->quoteName('#__phocadownload_layout').' ('."\n";
|
||||||
|
$query.=' '.$db->quoteName('id').' int(11) NOT NULL auto_increment,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('categories').' text,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('category').' text,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('file').' text,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('checked_out').' int(11) unsigned NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('checked_out_time').' datetime NOT NULL default \'0000-00-00 00:00:00\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('params').' text,'."\n";
|
||||||
|
$query.=' PRIMARY KEY ('.$db->quoteName('id').')'."\n";
|
||||||
|
$query.=') default CHARSET=utf8;'."\n";
|
||||||
|
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||||
|
|
||||||
|
|
||||||
|
$query ='INSERT INTO '.$db->quoteName('#__phocadownload_layout').' ('."\n";
|
||||||
|
$query.=' '.$db->quoteName('id').' ,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('categories').' ,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('category').' ,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('file').' ,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('checked_out').' ,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('checked_out_time').' ,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('params').' )'."\n";
|
||||||
|
$query.=' VALUES ('."\n";
|
||||||
|
$query.=' NULL,'."\n";
|
||||||
|
|
||||||
|
$query.=' '.$db->Quote('<div class="pd-categoriesbox">
|
||||||
|
<div class="pd-title">{pdtitle}</div>
|
||||||
|
{pdsubcategories}
|
||||||
|
{pdclear}
|
||||||
|
</div>').','."\n";
|
||||||
|
$query.=' '.$db->Quote('<div class="pd-filebox">
|
||||||
|
{pdfiledesctop}
|
||||||
|
{pdfile}
|
||||||
|
<div class="pd-buttons">{pdbuttondownload}</div>
|
||||||
|
<div class="pd-buttons">{pdbuttondetails}</div>
|
||||||
|
<div class="pd-buttons">{pdbuttonpreview}</div>
|
||||||
|
<div class="pd-buttons">{pdbuttonplay}</div>
|
||||||
|
<div class="pd-mirrors">{pdmirrorlink2} {pdmirrorlink1}</div>
|
||||||
|
<div class="pd-rating">{pdrating}</div>
|
||||||
|
<div class="pd-tags">{pdtags}</div>
|
||||||
|
{pdfiledescbottom}
|
||||||
|
<div class="pd-cb"></div>
|
||||||
|
</div>').','."\n";
|
||||||
|
$query.=' '.$db->Quote('<div class="pd-filebox">
|
||||||
|
{pdimage}
|
||||||
|
{pdfile}
|
||||||
|
{pdfilesize}
|
||||||
|
{pdversion}
|
||||||
|
{pdlicense}
|
||||||
|
{pdauthor}
|
||||||
|
{pdauthoremail}
|
||||||
|
{pdfiledate}
|
||||||
|
{pddownloads}
|
||||||
|
{pddescription}
|
||||||
|
{pdfeatures}
|
||||||
|
{pdchangelog}
|
||||||
|
{pdnotes}
|
||||||
|
<div class="pd-mirrors">{pdmirrorlink2} {pdmirrorlink1}</div>
|
||||||
|
<div class="pd-report">{pdreportlink}</div>
|
||||||
|
<div class="pd-rating">{pdrating}</div>
|
||||||
|
<div class="pd-tags">{pdtags}</div>
|
||||||
|
<div class="pd-cb"></div>
|
||||||
|
</div>').','."\n";
|
||||||
|
$query.=' '.$db->Quote('0').','."\n";
|
||||||
|
$query.=' '.$db->Quote('0000-00-00 00:00:00').','."\n";
|
||||||
|
$query.=' NULL'."\n";
|
||||||
|
$query.=' );'."\n";
|
||||||
|
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||||
|
|
||||||
|
|
||||||
|
// END -------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Error
|
||||||
|
if ($msgSQL !='') {
|
||||||
|
$msgError .= '<br />' . $msgSQL;
|
||||||
|
}
|
||||||
|
if ($msgFile !='') {
|
||||||
|
$msgError .= '<br />' . $msgFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
// End Message
|
||||||
|
if ($msgError !='') {
|
||||||
|
$msg = JText::_( 'Phoca Download not successfully installed' ) . ': ' . $msgError;
|
||||||
|
} else {
|
||||||
|
$msg = JText::_( 'Phoca Download successfully installed' );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$link = 'index.php?option=com_phocadownload';
|
||||||
|
$this->setRedirect($link, $msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function upgrade()
|
||||||
|
{
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
$dbPref = $db->getPrefix();
|
||||||
|
$msgSQL = '';
|
||||||
|
$msgFile = '';
|
||||||
|
$msgError = '';
|
||||||
|
|
||||||
|
|
||||||
|
$query =' SELECT * FROM '.$db->quoteName('#__phocadownload').' LIMIT 1;';
|
||||||
|
$db->setQuery( $query );
|
||||||
|
$result = $db->loadResult();
|
||||||
|
if ($db->getErrorNum())
|
||||||
|
{
|
||||||
|
$msgSQL .= $db->getErrorMsg(). '<br />';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$query=' SELECT * FROM '.$db->quoteName('#__phocadownload_categories').' LIMIT 1;'."\n";
|
||||||
|
|
||||||
|
$db->setQuery( $query );
|
||||||
|
$result = $db->loadResult();
|
||||||
|
if ($db->getErrorNum())
|
||||||
|
{
|
||||||
|
$msgSQL .= $db->getErrorMsg(). '<br />';
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
$query=' SELECT * FROM '.$db->quoteName('#__phocadownload_sections').' LIMIT 1;'."\n";
|
||||||
|
|
||||||
|
$db->setQuery( $query );
|
||||||
|
$result = $db->loadResult();
|
||||||
|
if ($db->getErrorNum())
|
||||||
|
{
|
||||||
|
$msgSQL .= $db->getErrorMsg(). '<br />';
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
// UPGRADE PHOCA DOWNLOAD 2.1.0 VERSION
|
||||||
|
// ------------------------------------------
|
||||||
|
// PHOCADOWNLOAD TAGS
|
||||||
|
// ------------------------------------------
|
||||||
|
|
||||||
|
$query ='CREATE TABLE IF NOT EXISTS '.$db->quoteName('#__phocadownload_tags').' ('."\n";
|
||||||
|
$query.=' '.$db->quoteName('id').' int(11) NOT NULL auto_increment,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('title').' varchar(255) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('alias').' varchar(255) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('link_cat').' int(11) NOT NULL default 0,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('link_ext').' varchar(255) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('description').' text,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('published').' tinyint(1) NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('checked_out').' int(11) unsigned NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('checked_out_time').' datetime NOT NULL default \'0000-00-00 00:00:00\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('ordering').' int(11) NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('params').' text,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('language').' char(7) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' PRIMARY KEY ('.$db->quoteName('id').')'."\n";
|
||||||
|
$query.=') default CHARSET=utf8;'."\n";
|
||||||
|
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||||
|
|
||||||
|
|
||||||
|
$query ='CREATE TABLE IF NOT EXISTS'.$db->quoteName('#__phocadownload_tags_ref').' ('."\n";
|
||||||
|
$query.=' '.$db->quoteName('id').' SERIAL,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('fileid').' int(11) NOT NULL default 0,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('tagid').' int(11) NOT NULL default 0,'."\n";
|
||||||
|
$query.=' PRIMARY KEY ('.$db->quoteName('id').'),'."\n";
|
||||||
|
$query.=' UNIQUE KEY '.$db->quoteName('i_fileid').' ('.$db->quoteName('fileid').','.$db->quoteName('tagid').')'."\n";
|
||||||
|
$query.=') default CHARSET=utf8;'."\n";
|
||||||
|
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||||
|
|
||||||
|
|
||||||
|
$query ='CREATE TABLE IF NOT EXISTS '.$db->quoteName('#__phocadownload_layout').' ('."\n";
|
||||||
|
$query.=' '.$db->quoteName('id').' int(11) NOT NULL auto_increment,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('categories').' text,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('category').' text,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('file').' text,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('checked_out').' int(11) unsigned NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('checked_out_time').' datetime NOT NULL default \'0000-00-00 00:00:00\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('params').' text,'."\n";
|
||||||
|
$query.=' PRIMARY KEY ('.$db->quoteName('id').')'."\n";
|
||||||
|
$query.=') default CHARSET=utf8;'."\n";
|
||||||
|
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||||
|
|
||||||
|
|
||||||
|
$update0 = false;
|
||||||
|
$errorMsg = '';
|
||||||
|
$update0 = $this->AddColumnIfNotExists( $errorMsg, "#__phocadownload", "features", "text", "description" );
|
||||||
|
if (!$update0) {
|
||||||
|
$msgSQL .= 'Error while updating Features column';
|
||||||
|
}
|
||||||
|
$update1 = false;
|
||||||
|
$errorMsg = '';
|
||||||
|
$update1 = $this->AddColumnIfNotExists( $errorMsg, "#__phocadownload", "changelog", "text", "description" );
|
||||||
|
if (!$update1) {
|
||||||
|
$msgSQL .= 'Error while updating Changelog column';
|
||||||
|
}
|
||||||
|
$update2 = false;
|
||||||
|
$errorMsg = '';
|
||||||
|
$update2 = $this->AddColumnIfNotExists( $errorMsg, "#__phocadownload", "notes", "text", "description" );
|
||||||
|
if (!$update2) {
|
||||||
|
$msgSQL .= 'Error while updating Notes column';
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
$query=' SELECT title FROM '.$db->quoteName('#__phocadownload_settings').' WHERE title = \'enable_user_statistics\' LIMIT 1;'."\n";
|
||||||
|
$db->setQuery($query);
|
||||||
|
|
||||||
|
if (!$result = $db->loadObject()) {
|
||||||
|
$query = "INSERT INTO ".$db->quoteName('#__phocadownload_settings')." VALUES (null, 'enable_user_statistics', 1,'{0=No}{1=Yes}', 'select');"."\n";
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// UPGRADE PHOCA DOWNLOAD 1.1.0 VERSION
|
||||||
|
// ------------------------------------------
|
||||||
|
// PHOCADOWNLOAD USER STAT
|
||||||
|
// ------------------------------------------
|
||||||
|
|
||||||
|
$query='CREATE TABLE IF NOT EXISTS '.$db->quoteName('#__phocadownload_licenses').' ('."\n";
|
||||||
|
$query.=' '.$db->quoteName('id').' int(11) NOT NULL auto_increment,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('title').' varchar(255) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('alias').' varchar(255) NOT NULL default \'\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('description').' text,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('checked_out').' int(11) unsigned NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('checked_out_time').' datetime NOT NULL default \'0000-00-00 00:00:00\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('published').' tinyint(1) NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' '.$db->quoteName('ordering').' int(11) NOT NULL default \'0\','."\n";
|
||||||
|
$query.=' PRIMARY KEY ('.$db->quoteName('id').')'."\n";
|
||||||
|
$query.=') TYPE=MyISAM CHARACTER SET '.$db->quoteName('utf8').' ;';
|
||||||
|
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// ------------------------------------------
|
||||||
|
// PHOCADOWNLOAD UPDATE confirm_license
|
||||||
|
// ------------------------------------------
|
||||||
|
$updateCL = false;
|
||||||
|
$updateCL = $this->AddColumnIfNotExists($errorMsg, "#__phocadownload", "confirm_license", "int(11) NOT NULL default '0'", "access" );
|
||||||
|
if (!$updateCL) {
|
||||||
|
$msgSQL .= 'Error while updating Confirm License column<br />';
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------
|
||||||
|
// PHOCADOWNLOAD UPDATE confirm_license
|
||||||
|
// ------------------------------------------
|
||||||
|
$updateUF = false;
|
||||||
|
$updateUF = $this->AddColumnIfNotExists($errorMsg, "#__phocadownload", "unaccessible_file", "int(11) NOT NULL default '0'", "access" );
|
||||||
|
if (!$updateUF) {
|
||||||
|
$msgSQL .= 'Error while updating Display Unaccessible Files column <br />';
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------
|
||||||
|
// PHOCADOWNLOAD CATEGORIES UPDATE date
|
||||||
|
// ------------------------------------------
|
||||||
|
$updateCD = false;
|
||||||
|
$updateCD = $this->AddColumnIfNotExists($errorMsg, "#__phocadownload_categories", "date", "datetime NOT NULL default '0000-00-00 00:00:00'", "access" );
|
||||||
|
if (!$updateCD) {
|
||||||
|
$msgSQL .= 'Error while updating Date column (categories) <br />';
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------
|
||||||
|
// PHOCADOWNLOAD SECTIONS UPDATE date
|
||||||
|
// ------------------------------------------
|
||||||
|
$updateSD = false;
|
||||||
|
$updateSD = $this->AddColumnIfNotExists($errorMsg, "#__phocadownload_sections", "date", "datetime NOT NULL default '0000-00-00 00:00:00'", "access" );
|
||||||
|
if (!$updateSD) {
|
||||||
|
$msgSQL .= 'Error while updating Date column (sections) <br />';
|
||||||
|
}
|
||||||
|
// ------------------------------------------
|
||||||
|
// PHOCADOWNLOAD SETTINGS UPDATE absolute_path
|
||||||
|
// ------------------------------------------
|
||||||
|
|
||||||
|
$query=' SELECT title FROM '.$db->quoteName('#__phocadownload_settings').' WHERE title = \'absolute_path\' LIMIT 1;'."\n";
|
||||||
|
$db->setQuery($query);
|
||||||
|
|
||||||
|
if (!$result = $db->loadObject()) {
|
||||||
|
$query = "INSERT INTO ".$db->quoteName('#__phocadownload_settings')." VALUES (null, 'absolute_path', '','', 'text');"."\n";
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------
|
||||||
|
// PHOCA DOWNLOAD UPDATE 1.2.0
|
||||||
|
// ------------------------------------------
|
||||||
|
|
||||||
|
// Filename_preview
|
||||||
|
$updateFPR = false;
|
||||||
|
$updateFPR = $this->AddColumnIfNotExists($errorMsg, "#__phocadownload", "filename_preview", "varchar(250) NOT NULL default ''", "filename" );
|
||||||
|
if (!$updateFPR) {
|
||||||
|
$msgSQL .= 'Error while updating Filename Preview column<br />';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filename_play
|
||||||
|
$updateFPL = false;
|
||||||
|
$updateFPL = $this->AddColumnIfNotExists($errorMsg, "#__phocadownload", "filename_play", "varchar(250) NOT NULL default ''", "filename" );
|
||||||
|
if (!$updateFPL) {
|
||||||
|
$msgSQL .= 'Error while updating Filename Play column<br />';
|
||||||
|
}
|
||||||
|
|
||||||
|
$updateIFS1 = false;
|
||||||
|
$updateIFS1 = $this->AddColumnIfNotExists($errorMsg, "#__phocadownload", "image_filename_spec1", "varchar(250) NOT NULL default ''", "filename" );
|
||||||
|
if (!$updateIFS1) {
|
||||||
|
$msgSQL .= 'Error while updating Image Filename Spec1 column<br />';
|
||||||
|
}
|
||||||
|
|
||||||
|
$updateIFS2 = false;
|
||||||
|
$updateIFS2 = $this->AddColumnIfNotExists($errorMsg, "#__phocadownload", "image_filename_spec2", "varchar(250) NOT NULL default ''", "filename" );
|
||||||
|
if (!$updateIFS2) {
|
||||||
|
$msgSQL .= 'Error while updating Image Filename Spec2 column<br />';
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------
|
||||||
|
// PHOCA DOWNLOAD UPDATE 1.3.0
|
||||||
|
// ------------------------------------------
|
||||||
|
|
||||||
|
// Approved
|
||||||
|
$updateApr = false;
|
||||||
|
$updateApr = $this->AddColumnIfNotExists($errorMsg, "#__phocadownload", "approved", "tinyint(1) NOT NULL default '0'", "published" );
|
||||||
|
if (!$updateApr) {
|
||||||
|
$msgSQL .= 'Error while updating Approved column<br />';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Upload
|
||||||
|
$updateUpl = false;
|
||||||
|
$updateUpl = $this->AddColumnIfNotExists($errorMsg, "#__phocadownload_categories", "uploaduserid", "text", "access" );
|
||||||
|
if (!$updateUpl) {
|
||||||
|
$msgSQL .= 'Error while updating Upload User ID column<br />';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Owner ID
|
||||||
|
$updateOid = false;
|
||||||
|
$updateOid = $this->AddColumnIfNotExists($errorMsg, "#__phocadownload", "owner_id", "int(11) NOT NULL default '0'", "id" );
|
||||||
|
if (!$updateOid) {
|
||||||
|
$msgSQL .= 'Error while updating Owner ID column<br />';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Owner ID
|
||||||
|
$fileSize = false;
|
||||||
|
$fileSize = $this->AddColumnIfNotExists($errorMsg, "#__phocadownload", "filesize", "int(11) NOT NULL default '0'", "filename" );
|
||||||
|
if (!$fileSize) {
|
||||||
|
$msgSQL .= 'Error while updating File Size column<br />';
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------
|
||||||
|
// PHOCA DOWNLOAD UPDATE 1.3.2
|
||||||
|
// ------------------------------------------
|
||||||
|
|
||||||
|
$updateMK = false;
|
||||||
|
$errorMsg = '';
|
||||||
|
$updateMK = $this->AddColumnIfNotExists( $errorMsg, "#__phocadownload", "metakey", "text", "params" );
|
||||||
|
if (!$updateMK) {
|
||||||
|
$msgSQL .= 'Error while updating Metakey (File) column';
|
||||||
|
}
|
||||||
|
$updateMKC = false;
|
||||||
|
$errorMsg = '';
|
||||||
|
$updateMKC = $this->AddColumnIfNotExists( $errorMsg, "#__phocadownload_categories", "metakey", "text", "params" );
|
||||||
|
if (!$updateMKC) {
|
||||||
|
$msgSQL .= 'Error while updating Metakey (Category) column';
|
||||||
|
}
|
||||||
|
$updateMKS = false;
|
||||||
|
$errorMsg = '';
|
||||||
|
$updateMKS = $this->AddColumnIfNotExists( $errorMsg, "#__phocadownload_sections", "metakey", "text", "params" );
|
||||||
|
if (!$updateMKS) {
|
||||||
|
$msgSQL .= 'Error while updating Metakey (Section) column';
|
||||||
|
}
|
||||||
|
$updateMD = false;
|
||||||
|
$errorMsg = '';
|
||||||
|
$updateMD = $this->AddColumnIfNotExists( $errorMsg, "#__phocadownload", "metadesc", "text", "params" );
|
||||||
|
if (!$updateMD) {
|
||||||
|
$msgSQL .= 'Error while updating Metadesc (File) column';
|
||||||
|
}
|
||||||
|
$updateMDC = false;
|
||||||
|
$errorMsg = '';
|
||||||
|
$updateMDC = $this->AddColumnIfNotExists( $errorMsg, "#__phocadownload_categories", "metadesc", "text", "params" );
|
||||||
|
if (!$updateMDC) {
|
||||||
|
$msgSQL .= 'Error while updating Metadesc (Category) column';
|
||||||
|
}
|
||||||
|
$updateMDS = false;
|
||||||
|
$errorMsg = '';
|
||||||
|
$updateMDS = $this->AddColumnIfNotExists( $errorMsg, "#__phocadownload_sections", "metadesc", "text", "params" );
|
||||||
|
if (!$updateMDS) {
|
||||||
|
$msgSQL .= 'Error while updating Metadesc (Section) column';
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------
|
||||||
|
// PHOCA DOWNLOAD UPDATE 1.3.4
|
||||||
|
// ------------------------------------------
|
||||||
|
|
||||||
|
$query=' SELECT title FROM '.$db->quoteName('#__phocadownload_settings').' WHERE title = \'description\' LIMIT 1;'."\n";
|
||||||
|
$db->setQuery($query);
|
||||||
|
|
||||||
|
if (!$result = $db->loadObject()) {
|
||||||
|
$query = "INSERT INTO ".$db->quoteName('#__phocadownload_settings')." VALUES (null, 'description', '','', 'textareaeditor');"."\n";
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||||
|
}
|
||||||
|
|
||||||
|
$updatePU = false;
|
||||||
|
$errorMsg = '';
|
||||||
|
$updatePU = $this->AddColumnIfNotExists( $errorMsg, "#__phocadownload", "publish_up", "datetime NOT NULL default '0000-00-00 00:00:00'", "date" );
|
||||||
|
if (!$updatePU) {
|
||||||
|
$msgSQL .= 'Error while updating Publish Up column';
|
||||||
|
}
|
||||||
|
|
||||||
|
$updatePD = false;
|
||||||
|
$errorMsg = '';
|
||||||
|
$updatePD = $this->AddColumnIfNotExists( $errorMsg, "#__phocadownload", "publish_down", "datetime NOT NULL default '0000-00-00 00:00:00'", "date" );
|
||||||
|
if (!$updatePD) {
|
||||||
|
$msgSQL .= 'Error while updating Publish Down column';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ------------------------------------------
|
||||||
|
// PHOCA DOWNLOAD UPDATE 1.3.4
|
||||||
|
// ------------------------------------------
|
||||||
|
|
||||||
|
// Access User ID
|
||||||
|
$updateAid = false;
|
||||||
|
$updateAid = $this->AddColumnIfNotExists($errorMsg, "#__phocadownload_categories", "accessuserid", "text", "access" );
|
||||||
|
if (!$updateAid) {
|
||||||
|
$msgSQL .= 'Error while updating Access User ID column<br />';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete User ID
|
||||||
|
$updateDid = false;
|
||||||
|
$updateDid = $this->AddColumnIfNotExists($errorMsg, "#__phocadownload_categories", "deleteuserid", "text", "access" );
|
||||||
|
if (!$updateDid) {
|
||||||
|
$msgSQL .= 'Error while updating Delete User ID column<br />';
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
// CHECK TABLES
|
||||||
|
|
||||||
|
$query =' SELECT * FROM '.$db->quoteName('#__phocadownload').' LIMIT 1;';
|
||||||
|
$db->setQuery( $query );
|
||||||
|
$result = $db->loadResult();
|
||||||
|
if ($db->getErrorNum()) {
|
||||||
|
$msgSQL .= $db->getErrorMsg(). '<br />';
|
||||||
|
}
|
||||||
|
|
||||||
|
$query =' SELECT * FROM '.$db->quoteName('#__phocadownload_categories').' LIMIT 1;';
|
||||||
|
$db->setQuery( $query );
|
||||||
|
$result = $db->loadResult();
|
||||||
|
if ($db->getErrorNum()) {
|
||||||
|
$msgSQL .= $db->getErrorMsg(). '<br />';
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
$query =' SELECT * FROM '.$db->quoteName('#__phocadownload_sections').' LIMIT 1;';
|
||||||
|
$db->setQuery( $query );
|
||||||
|
$result = $db->loadResult();
|
||||||
|
if ($db->getErrorNum()) {
|
||||||
|
$msgSQL .= $db->getErrorMsg(). '<br />';
|
||||||
|
}
|
||||||
|
|
||||||
|
$query =' SELECT * FROM '.$db->quoteName('#__phocadownload_settings').' LIMIT 1;';
|
||||||
|
$db->setQuery( $query );
|
||||||
|
$result = $db->loadResult();
|
||||||
|
if ($db->getErrorNum()) {
|
||||||
|
$msgSQL .= $db->getErrorMsg(). '<br />';
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
$query =' SELECT * FROM '.$db->quoteName('#__phocadownload_user_stat').' LIMIT 1;';
|
||||||
|
$db->setQuery( $query );
|
||||||
|
$result = $db->loadResult();
|
||||||
|
if ($db->getErrorNum()) {
|
||||||
|
$msgSQL .= $db->getErrorMsg(). '<br />';
|
||||||
|
}
|
||||||
|
|
||||||
|
$query =' SELECT * FROM '.$db->quoteName('#__phocadownload_licenses').' LIMIT 1;';
|
||||||
|
$db->setQuery( $query );
|
||||||
|
$result = $db->loadResult();
|
||||||
|
if ($db->getErrorNum()) {
|
||||||
|
$msgSQL .= $db->getErrorMsg(). '<br />';
|
||||||
|
}
|
||||||
|
|
||||||
|
$query =' SELECT * FROM '.$db->quoteName('#__phocadownload_tags').' LIMIT 1;';
|
||||||
|
$db->setQuery( $query );
|
||||||
|
$result = $db->loadResult();
|
||||||
|
if ($db->getErrorNum()) {
|
||||||
|
$msgSQL .= $db->getErrorMsg(). '<br />';
|
||||||
|
}
|
||||||
|
|
||||||
|
$query =' SELECT * FROM '.$db->quoteName('#__phocadownload_layout').' LIMIT 1;';
|
||||||
|
$db->setQuery( $query );
|
||||||
|
$result = $db->loadObjectList();
|
||||||
|
if ($db->getErrorNum()) {
|
||||||
|
$msgSQL .= $db->getErrorMsg(). '<br />';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((!isset($result->categories) && !isset($result->category) && !isset($result->file)) ||
|
||||||
|
(isset($result->categories) && $result->category == '' && isset($result->category) && $result->category == '' && isset($result->file) && $result->file == '')
|
||||||
|
) {
|
||||||
|
|
||||||
|
$query ='INSERT INTO '.$db->quoteName('#__phocadownload_layout').' ('."\n";
|
||||||
|
$query.=' '.$db->quoteName('id').' ,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('categories').' ,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('category').' ,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('file').' ,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('checked_out').' ,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('checked_out_time').' ,'."\n";
|
||||||
|
$query.=' '.$db->quoteName('params').' )'."\n";
|
||||||
|
$query.=' VALUES ('."\n";
|
||||||
|
$query.=' NULL,'."\n";
|
||||||
|
|
||||||
|
$query.=' '.$db->Quote('<div class="pd-categoriesbox">
|
||||||
|
<div class="pd-title">{pdtitle}</div>
|
||||||
|
{pdsubcategories}
|
||||||
|
{pdclear}
|
||||||
|
</div>').','."\n";
|
||||||
|
$query.=' '.$db->Quote('<div class="pd-filebox">
|
||||||
|
{pdfiledesctop}
|
||||||
|
{pdfile}
|
||||||
|
<div class="pd-buttons">{pdbuttondownload}</div>
|
||||||
|
<div class="pd-buttons">{pdbuttondetails}</div>
|
||||||
|
<div class="pd-buttons">{pdbuttonpreview}</div>
|
||||||
|
<div class="pd-buttons">{pdbuttonplay}</div>
|
||||||
|
<div class="pd-mirrors">{pdmirrorlink2} {pdmirrorlink1}</div>
|
||||||
|
<div class="pd-rating">{pdrating}</div>
|
||||||
|
<div class="pd-tags">{pdtags}</div>
|
||||||
|
{pdfiledescbottom}
|
||||||
|
<div class="pd-cb"></div>
|
||||||
|
</div>').','."\n";
|
||||||
|
$query.=' '.$db->Quote('<div class="pd-filebox">
|
||||||
|
{pdimage}
|
||||||
|
{pdfile}
|
||||||
|
{pdfilesize}
|
||||||
|
{pdversion}
|
||||||
|
{pdlicense}
|
||||||
|
{pdauthor}
|
||||||
|
{pdauthoremail}
|
||||||
|
{pdfiledate}
|
||||||
|
{pddownloads}
|
||||||
|
{pddescription}
|
||||||
|
{pdfeatures}
|
||||||
|
{pdchangelog}
|
||||||
|
{pdnotes}
|
||||||
|
<div class="pd-mirrors">{pdmirrorlink2} {pdmirrorlink1}</div>
|
||||||
|
<div class="pd-report">{pdreportlink}</div>
|
||||||
|
<div class="pd-rating">{pdrating}</div>
|
||||||
|
<div class="pd-tags">{pdtags}</div>
|
||||||
|
<div class="pd-cb"></div>
|
||||||
|
</div>').','."\n";
|
||||||
|
$query.=' '.$db->Quote('0').','."\n";
|
||||||
|
$query.=' '.$db->Quote('0000-00-00 00:00:00').','."\n";
|
||||||
|
$query.=' NULL'."\n";
|
||||||
|
$query.=' );'."\n";
|
||||||
|
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if (!$result = $db->query()){$msgSQL .= $db->stderr() . '<br />';}
|
||||||
|
}
|
||||||
|
// - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
|
||||||
|
// ------------------------------------------
|
||||||
|
// PHOCA DOWNLOAD UPDATE 2.1.1
|
||||||
|
// ------------------------------------------
|
||||||
|
|
||||||
|
$updateVL = false;
|
||||||
|
$errorMsg = '';
|
||||||
|
$updateVL = $this->AddColumnIfNotExists( $errorMsg, "#__phocadownload", "video_filename", "varchar(255) NOT NULL default ''", "params" );
|
||||||
|
if (!$updateVL) {
|
||||||
|
$msgSQL .= 'Error while updating Video Filename column';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Error
|
||||||
|
if ($msgSQL !='') {
|
||||||
|
$msgError .= '<br />' . $msgSQL;
|
||||||
|
}
|
||||||
|
if ($msgFile !='') {
|
||||||
|
$msgError .= '<br />' . $msgFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
// End Message
|
||||||
|
if ($msgError !='') {
|
||||||
|
$msg = JText::_( 'Phoca Download not successfully upgraded' ) . ': ' . $msgError;
|
||||||
|
} else {
|
||||||
|
$msg = JText::_( 'Phoca Download successfully upgraded' );
|
||||||
|
}
|
||||||
|
|
||||||
|
$link = 'index.php?option=com_phocadownload';
|
||||||
|
$this->setRedirect($link, $msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
function AddColumnIfNotExists(&$errorMsg, $table, $column, $attributes = "INT( 11 ) NOT NULL default '0'", $after = '' ) {
|
||||||
|
|
||||||
|
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
$columnExists = false;
|
||||||
|
|
||||||
|
$query = 'SHOW COLUMNS FROM '.$table;
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if (!$result = $db->query()){return false;}
|
||||||
|
$columnData = $db->loadObjectList();
|
||||||
|
|
||||||
|
foreach ($columnData as $valueColumn) {
|
||||||
|
if ($valueColumn->Field == $column) {
|
||||||
|
$columnExists = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$columnExists) {
|
||||||
|
if ($after != '') {
|
||||||
|
$query = 'ALTER TABLE '.$db->quoteName($table).' ADD '.$db->quoteName($column).' '.$attributes.' AFTER '.$db->quoteName($after).';';
|
||||||
|
} else {
|
||||||
|
$query = 'ALTER TABLE '.$db->quoteName($table).' ADD '.$db->quoteName($column).' '.$attributes.';';
|
||||||
|
}
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if (!$result = $db->query()){return false;}
|
||||||
|
$errorMsg = 'notexistcreated';
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// utf-8 test: ä,ö,ü,ø,ž
|
||||||
|
?>
|
||||||
@ -0,0 +1,110 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* @package Joomla 1.5
|
||||||
|
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
*
|
||||||
|
* @component Phoca Component
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
jimport('joomla.application.component.controllerform');
|
||||||
|
|
||||||
|
|
||||||
|
class PhocaDownloadCpControllerPhocaDownloadLayout extends JControllerForm
|
||||||
|
{
|
||||||
|
protected $option = 'com_phocadownload';
|
||||||
|
|
||||||
|
function __construct($config=array()) {
|
||||||
|
|
||||||
|
parent::__construct($config);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function execute($task)
|
||||||
|
{
|
||||||
|
parent::execute($task);
|
||||||
|
// Clear the component's cache
|
||||||
|
if ($task != 'display') {
|
||||||
|
$cache = JFactory::getCache('com_phocadownload');
|
||||||
|
$cache->clean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function allowAdd($data = array()) {
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$allow = null;
|
||||||
|
$allow = $user->authorise('core.create', 'com_phocadownload');
|
||||||
|
if ($allow === null) {
|
||||||
|
return parent::allowAdd($data);
|
||||||
|
} else {
|
||||||
|
return $allow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function allowEdit($data = array(), $key = 'id') {
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$allow = null;
|
||||||
|
$allow = $user->authorise('core.edit', 'com_phocadownload');
|
||||||
|
if ($allow === null) {
|
||||||
|
return parent::allowEdit($data, $key);
|
||||||
|
} else {
|
||||||
|
return $allow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function back($key = null) {
|
||||||
|
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||||
|
|
||||||
|
// Initialise variables.
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$model = $this->getModel();
|
||||||
|
$table = $model->getTable();
|
||||||
|
$checkin = property_exists($table, 'checked_out');
|
||||||
|
$context = "$this->option.edit.$this->context";
|
||||||
|
|
||||||
|
if (empty($key))
|
||||||
|
{
|
||||||
|
$key = $table->getKeyName();
|
||||||
|
}
|
||||||
|
|
||||||
|
$recordId = JRequest::getInt($key);
|
||||||
|
|
||||||
|
|
||||||
|
// Attempt to check-in the current record.
|
||||||
|
if ($recordId)
|
||||||
|
{
|
||||||
|
// Check we are holding the id in the edit list.
|
||||||
|
if (!$this->checkEditId($context, $recordId))
|
||||||
|
{
|
||||||
|
// Somehow the person just went to the form - we don't allow that.
|
||||||
|
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $recordId));
|
||||||
|
$this->setMessage($this->getError(), 'error');
|
||||||
|
$this->setRedirect(JRoute::_('index.php?option=' . $this->option, false));
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($checkin)
|
||||||
|
{
|
||||||
|
if ($model->checkin($recordId) === false)
|
||||||
|
{
|
||||||
|
// Check-in failed, go back to the record and display a notice.
|
||||||
|
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError()));
|
||||||
|
$this->setMessage($this->getError(), 'error');
|
||||||
|
$this->setRedirect(JRoute::_('index.php?option=' . $this->option, false));
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clean the session data and redirect.
|
||||||
|
$this->releaseEditId($context, $recordId);
|
||||||
|
$app->setUserState($context . '.data', null);
|
||||||
|
$this->setRedirect(JRoute::_('index.php?option=' . $this->option, false));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* @package Joomla.Framework
|
||||||
|
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*
|
||||||
|
* @component Phoca Component
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
|
||||||
|
*/
|
||||||
|
defined('_JEXEC') or die();
|
||||||
|
jimport('joomla.application.component.controllerform');
|
||||||
|
|
||||||
|
class PhocaDownloadCpControllerPhocaDownloadLayouts extends JControllerForm
|
||||||
|
{
|
||||||
|
protected $option = 'com_phocadownload';
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* @package Joomla.Framework
|
||||||
|
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*
|
||||||
|
* @component Phoca Component
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
|
||||||
|
*/
|
||||||
|
defined('_JEXEC') or die();
|
||||||
|
jimport('joomla.application.component.controllerform');
|
||||||
|
|
||||||
|
class PhocaDownloadCpControllerPhocaDownloadLic extends JControllerForm
|
||||||
|
{
|
||||||
|
protected $option = 'com_phocadownload';
|
||||||
|
|
||||||
|
function __construct($config=array()) {
|
||||||
|
parent::__construct($config);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function allowAdd($data = array()) {
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$allow = null;
|
||||||
|
$allow = $user->authorise('core.create', 'com_phocadownload');
|
||||||
|
if ($allow === null) {
|
||||||
|
return parent::allowAdd($data);
|
||||||
|
} else {
|
||||||
|
return $allow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function allowEdit($data = array(), $key = 'id') {
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$allow = null;
|
||||||
|
$allow = $user->authorise('core.edit', 'com_phocadownload');
|
||||||
|
if ($allow === null) {
|
||||||
|
return parent::allowEdit($data, $key);
|
||||||
|
} else {
|
||||||
|
return $allow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
/* @package Joomla
|
||||||
|
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
* @extension Phoca Extension
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
jimport('joomla.application.component.controlleradmin');
|
||||||
|
|
||||||
|
class PhocaDownloadCpControllerPhocaDownloadLics extends JControllerAdmin
|
||||||
|
{
|
||||||
|
protected $option = 'com_phocadownload';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function &getModel($name = 'PhocaDownloadLic', $prefix = 'PhocaDownloadCpModel', $config = array())
|
||||||
|
{
|
||||||
|
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
|
||||||
|
return $model;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function saveOrderAjax() {
|
||||||
|
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||||
|
$pks = $this->input->post->get('cid', array(), 'array');
|
||||||
|
$order = $this->input->post->get('order', array(), 'array');
|
||||||
|
JArrayHelper::toInteger($pks);
|
||||||
|
JArrayHelper::toInteger($order);
|
||||||
|
$model = $this->getModel();
|
||||||
|
$return = $model->saveorder($pks, $order);
|
||||||
|
if ($return) { echo "1";}
|
||||||
|
JFactory::getApplication()->close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* @package Joomla 1.5
|
||||||
|
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
*
|
||||||
|
* @component Phoca Component
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
defined('_JEXEC') or die();
|
||||||
|
class PhocaDownloadCpControllerPhocaDownloadLinkFile extends PhocaDownloadCpController
|
||||||
|
{
|
||||||
|
function __construct() {
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
/* @package Joomla
|
||||||
|
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
* @extension Phoca Extension
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
defined('_JEXEC') or die();
|
||||||
|
|
||||||
|
class PhocaDownloadCpControllerPhocaDownloadLogs extends PhocaDownloadCpController
|
||||||
|
{
|
||||||
|
function __construct() {
|
||||||
|
parent::__construct();
|
||||||
|
$this->registerTask( 'reset', 'reset');
|
||||||
|
}
|
||||||
|
|
||||||
|
function reset() {
|
||||||
|
|
||||||
|
$model = $this->getModel( 'phocadownloadlog' );
|
||||||
|
|
||||||
|
if ($model->reset($cid)) {
|
||||||
|
$msg = JText::_( 'COM_PHOCADOWNLOAD_SUCCESS_RESET_LOG_STAT' );
|
||||||
|
} else {
|
||||||
|
$msg = JText::_( 'COM_PHOCADOWNLOAD_ERROR_RESET_LOG_STAT' );
|
||||||
|
}
|
||||||
|
|
||||||
|
$link = 'index.php?option=com_phocadownload&view=phocadownloadlogs';
|
||||||
|
$this->setRedirect($link, $msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* @package Joomla 1.5
|
||||||
|
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
*
|
||||||
|
* @component Phoca Gallery
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die();
|
||||||
|
jimport('joomla.application.component.controllerform');
|
||||||
|
|
||||||
|
class PhocaDownloadCpControllerPhocaDownloadM extends JControllerForm
|
||||||
|
{
|
||||||
|
protected $option = 'com_phocadownload';
|
||||||
|
protected $view_list = 'phocadownloadmanager';
|
||||||
|
protected $layout = 'edit';
|
||||||
|
|
||||||
|
function __construct() {
|
||||||
|
parent::__construct();
|
||||||
|
$this->layout = 'edit';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function allowAdd($data = array()) {
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$allow = null;
|
||||||
|
$allow = $user->authorise('core.create', 'com_phocadownload');
|
||||||
|
if ($allow === null) {
|
||||||
|
return parent::allowAdd($data);
|
||||||
|
} else {
|
||||||
|
return $allow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function allowEdit($data = array(), $key = 'id') {
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$allow = null;
|
||||||
|
$allow = $user->authorise('core.edit', 'com_phocadownload');
|
||||||
|
if ($allow === null) {
|
||||||
|
return parent::allowEdit($data, $key);
|
||||||
|
} else {
|
||||||
|
return $allow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function edit($key = NULL, $urlVar = NULL) {
|
||||||
|
$this->setRedirect(JRoute::_('index.php?option='.$this->option.'&view='.$this->view_list.'&layout='.$this->layout.'&manager=filemultiple', false));
|
||||||
|
}
|
||||||
|
|
||||||
|
function cancel($key = NULL) {
|
||||||
|
$this->setRedirect( 'index.php?option=com_phocadownload&view=phocadownloadfiles' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
/* @package Joomla
|
||||||
|
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
* @extension Phoca Extension
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
jimport('joomla.application.component.controlleradmin');
|
||||||
|
|
||||||
|
class PhocaDownloadCpControllerPhocaDownloadRaFile extends JControllerAdmin
|
||||||
|
{
|
||||||
|
protected $option = 'com_phocadownload';
|
||||||
|
|
||||||
|
public function &getModel($name = 'PhocaDownloadRaFile', $prefix = 'PhocaDownloadCpModel', $config = array())
|
||||||
|
{
|
||||||
|
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
|
||||||
|
return $model;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function saveOrderAjax() {
|
||||||
|
$pks = $this->input->post->get('cid', array(), 'array');
|
||||||
|
$order = $this->input->post->get('order', array(), 'array');
|
||||||
|
JArrayHelper::toInteger($pks);
|
||||||
|
JArrayHelper::toInteger($order);
|
||||||
|
$model = $this->getModel();
|
||||||
|
$return = $model->saveorder($pks, $order);
|
||||||
|
if ($return) { echo "1";}
|
||||||
|
JFactory::getApplication()->close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,67 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* @package Joomla 1.5
|
||||||
|
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
*
|
||||||
|
* @component Phoca Component
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die();
|
||||||
|
|
||||||
|
class PhocaDownloadCpControllerPhocaDownloadset extends PhocaDownloadCpController
|
||||||
|
{
|
||||||
|
function __construct() {
|
||||||
|
parent::__construct();
|
||||||
|
|
||||||
|
$this->registerTask( 'apply' , 'save' );
|
||||||
|
}
|
||||||
|
|
||||||
|
function save() {
|
||||||
|
$post = JRequest::get('post');
|
||||||
|
$phocaSet = JRequest::getVar( 'phocaset', array(0), 'post', 'array' );
|
||||||
|
|
||||||
|
$model = $this->getModel( 'phocadownloadset' );
|
||||||
|
$errorMsg = '';
|
||||||
|
switch ( JRequest::getCmd('task') ) {
|
||||||
|
case 'apply':
|
||||||
|
|
||||||
|
if ($model->store($phocaSet, $errorMsg)) {
|
||||||
|
$msg = JText::_( 'Changes to Phoca Download Settings Saved' );
|
||||||
|
if ($errorMsg != '') {
|
||||||
|
$msg .= '<br />'.JText::_($errorMsg);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$msg = JText::_( 'Error Saving Phoca Download Settings' );
|
||||||
|
}
|
||||||
|
$this->setRedirect( 'index.php?option=com_phocadownload&view=phocadownloadset', $msg );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'save':
|
||||||
|
default:
|
||||||
|
if ($model->store($phocaSet, $errorMsg)) {
|
||||||
|
$msg = JText::_( 'Phoca Download Settings Saved' );
|
||||||
|
if ($errorMsg != '') {
|
||||||
|
$msg .= '<br />'.JText::_($errorMsg);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$msg = JText::_( 'Error Saving Phoca Download Settings' );
|
||||||
|
}
|
||||||
|
$this->setRedirect( 'index.php?option=com_phocadownload', $msg );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// Check the table in so it can be edited.... we are done with it anyway
|
||||||
|
$model->checkin();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function cancel($key = NULL) {
|
||||||
|
$model = $this->getModel( 'phocadownload' );
|
||||||
|
$model->checkin();
|
||||||
|
|
||||||
|
$this->setRedirect( 'index.php?option=com_phocadownload' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
/* @package Joomla
|
||||||
|
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
* @extension Phoca Extension
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die();
|
||||||
|
|
||||||
|
class PhocaDownloadCpControllerPhocaDownloadstat extends JControllerAdmin
|
||||||
|
{
|
||||||
|
public function __construct() {
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
public function cancel($key = NULL) {
|
||||||
|
$model = $this->getModel( 'phocadownload' );
|
||||||
|
$model->checkin();
|
||||||
|
|
||||||
|
$this->setRedirect( 'index.php?option=com_phocadownload' );
|
||||||
|
}*/
|
||||||
|
|
||||||
|
public function back($key = null) {
|
||||||
|
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||||
|
$this->setRedirect(JRoute::_('index.php?option=com_phocadownload', false));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function saveOrderAjax() {
|
||||||
|
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||||
|
$pks = $this->input->post->get('cid', array(), 'array');
|
||||||
|
$order = $this->input->post->get('order', array(), 'array');
|
||||||
|
JArrayHelper::toInteger($pks);
|
||||||
|
JArrayHelper::toInteger($order);
|
||||||
|
$model = $this->getModel();
|
||||||
|
$return = $model->saveorder($pks, $order);
|
||||||
|
if ($return) { echo "1";}
|
||||||
|
JFactory::getApplication()->close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
/* @package Joomla
|
||||||
|
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
* @extension Phoca Extension
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
defined('_JEXEC') or die();
|
||||||
|
jimport('joomla.application.component.controllerform');
|
||||||
|
|
||||||
|
class PhocaDownloadCpControllerPhocaDownloadStyle extends JControllerForm
|
||||||
|
{
|
||||||
|
protected $option = 'com_phocadownload';
|
||||||
|
|
||||||
|
|
||||||
|
function __construct($config=array()) {
|
||||||
|
parent::__construct($config);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function allowAdd($data = array()) {
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$allow = null;
|
||||||
|
$allow = $user->authorise('core.create', 'com_phocadownload');
|
||||||
|
if ($allow === null) {
|
||||||
|
return parent::allowAdd($data);
|
||||||
|
} else {
|
||||||
|
return $allow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function allowEdit($data = array(), $key = 'id') {
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$allow = null;
|
||||||
|
$allow = $user->authorise('core.edit', 'com_phocadownload');
|
||||||
|
if ($allow === null) {
|
||||||
|
return parent::allowEdit($data, $key);
|
||||||
|
} else {
|
||||||
|
return $allow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
/* @package Joomla
|
||||||
|
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
* @extension Phoca Extension
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
class PhocaDownloadCpControllerPhocaDownloadStyles extends JControllerAdmin
|
||||||
|
{
|
||||||
|
protected $option = 'com_phocadownload';
|
||||||
|
|
||||||
|
public function __construct($config = array()){
|
||||||
|
parent::__construct($config);
|
||||||
|
$this->registerTask('apply', 'save');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function &getModel($name = 'PhocaDownloadStyle', $prefix = 'PhocaDownloadCpModel', $config = array()) {
|
||||||
|
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
|
||||||
|
return $model;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function saveOrderAjax() {
|
||||||
|
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||||
|
$pks = $this->input->post->get('cid', array(), 'array');
|
||||||
|
$order = $this->input->post->get('order', array(), 'array');
|
||||||
|
JArrayHelper::toInteger($pks);
|
||||||
|
JArrayHelper::toInteger($order);
|
||||||
|
$model = $this->getModel();
|
||||||
|
$return = $model->saveorder($pks, $order);
|
||||||
|
if ($return) { echo "1";}
|
||||||
|
JFactory::getApplication()->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* @package Joomla.Framework
|
||||||
|
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*
|
||||||
|
* @component Phoca Component
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
|
||||||
|
*/
|
||||||
|
defined('_JEXEC') or die();
|
||||||
|
jimport('joomla.application.component.controllerform');
|
||||||
|
|
||||||
|
class PhocaDownloadCpControllerPhocaDownloadTag extends JControllerForm
|
||||||
|
{
|
||||||
|
protected $option = 'com_phocadownload';
|
||||||
|
|
||||||
|
function __construct($config=array()) {
|
||||||
|
parent::__construct($config);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function allowAdd($data = array()) {
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$allow = null;
|
||||||
|
$allow = $user->authorise('core.create', 'com_phocadownload');
|
||||||
|
if ($allow === null) {
|
||||||
|
return parent::allowAdd($data);
|
||||||
|
} else {
|
||||||
|
return $allow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function allowEdit($data = array(), $key = 'id') {
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$allow = null;
|
||||||
|
$allow = $user->authorise('core.edit', 'com_phocadownload');
|
||||||
|
if ($allow === null) {
|
||||||
|
return parent::allowEdit($data, $key);
|
||||||
|
} else {
|
||||||
|
return $allow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
/* @package Joomla
|
||||||
|
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
* @extension Phoca Extension
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
jimport('joomla.application.component.controlleradmin');
|
||||||
|
|
||||||
|
class PhocaDownloadCpControllerPhocaDownloadTags extends JControllerAdmin
|
||||||
|
{
|
||||||
|
protected $option = 'com_phocadownload';
|
||||||
|
|
||||||
|
public function &getModel($name = 'PhocaDownloadTag', $prefix = 'PhocaDownloadCpModel', $config = array())
|
||||||
|
{
|
||||||
|
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
|
||||||
|
return $model;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function saveOrderAjax() {
|
||||||
|
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||||
|
$pks = $this->input->post->get('cid', array(), 'array');
|
||||||
|
$order = $this->input->post->get('order', array(), 'array');
|
||||||
|
JArrayHelper::toInteger($pks);
|
||||||
|
JArrayHelper::toInteger($order);
|
||||||
|
$model = $this->getModel();
|
||||||
|
$return = $model->saveorder($pks, $order);
|
||||||
|
if ($return) { echo "1";}
|
||||||
|
JFactory::getApplication()->close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* @package Joomla 1.5
|
||||||
|
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
*
|
||||||
|
* @component Phoca Component
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Check to ensure this file is included in Joomla!
|
||||||
|
defined('_JEXEC') or die();
|
||||||
|
|
||||||
|
class PhocaDownloadCpControllerPhocaDownloaduninstall extends PhocaDownloadCpController
|
||||||
|
{
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
|
||||||
|
// Register Extra tasks
|
||||||
|
$this->registerTask( 'remove' , 'remove' );
|
||||||
|
$this->registerTask( 'keep' , 'keep' );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function remove()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function keep()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,116 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* @package Joomla.Framework
|
||||||
|
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*
|
||||||
|
* @component Phoca Component
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
|
||||||
|
*/
|
||||||
|
defined('_JEXEC') or die( 'Restricted access' );
|
||||||
|
jimport('joomla.client.helper');
|
||||||
|
jimport('joomla.filesystem.file');
|
||||||
|
jimport('joomla.filesystem.folder');
|
||||||
|
|
||||||
|
class PhocaDownloadCpControllerPhocaDownloadUpload extends PhocaDownloadCpController
|
||||||
|
{
|
||||||
|
function __construct() {
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
function createfolder() {
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
// Check for request forgeries
|
||||||
|
JRequest::checkToken() or jexit( 'COM_PHOCADOWNLOAD_INVALID_TOKEN' );
|
||||||
|
|
||||||
|
// Set FTP credentials, if given
|
||||||
|
jimport('joomla.client.helper');
|
||||||
|
JClientHelper::setCredentialsFromRequest('ftp');
|
||||||
|
|
||||||
|
$paramsC = JComponentHelper::getParams('com_phocadownload');
|
||||||
|
$folder_permissions = $paramsC->get( 'folder_permissions', 0755 );
|
||||||
|
//$folder_permissions = octdec((int)$folder_permissions);
|
||||||
|
|
||||||
|
|
||||||
|
$folderNew = JRequest::getCmd( 'foldername', '');
|
||||||
|
$folderCheck = JRequest::getVar( 'foldername', null, '', 'string', JREQUEST_ALLOWRAW);
|
||||||
|
$parent = JRequest::getVar( 'folderbase', '', '', 'path' );
|
||||||
|
$tab = JRequest::getVar( 'tab', 0, '', 'string' );
|
||||||
|
$field = JRequest::getVar( 'field');
|
||||||
|
$viewBack = JRequest::getVar( 'viewback', '', '', 'phocadownloadmanager' );
|
||||||
|
$manager = JRequest::getVar( 'manager', 'file', '', 'string' );
|
||||||
|
|
||||||
|
|
||||||
|
$link = '';
|
||||||
|
if ($manager != '') {
|
||||||
|
$group = PhocaDownloadSettings::getManagerGroup($manager);
|
||||||
|
$link = 'index.php?option=com_phocadownload&view='.(string)$viewBack.'&manager='.(string)$manager
|
||||||
|
.str_replace('&', '&', $group['c']).'&folder='.$parent.'&tab='.(string)$tab.'&field='.$field;
|
||||||
|
$path = PhocaDownloadPath::getPathSet($manager);// we use viewback to get right path
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$app->enqueueMessage( JText::_('COM_PHOCADOWNLOAD_ERROR_CONTROLLER_MANAGER_NOT_SET'));
|
||||||
|
$app->redirect('index.php?option=com_phocadownload');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
JRequest::setVar('folder', $parent);
|
||||||
|
|
||||||
|
if (($folderCheck !== null) && ($folderNew !== $folderCheck)) {
|
||||||
|
$app->enqueueMessage( JText::_('COM_PHOCADOWNLOAD_WARNING_DIRNAME'));
|
||||||
|
$app->redirect($link);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strlen($folderNew) > 0) {
|
||||||
|
$folder = JPath::clean($path['orig_abs_ds'].$parent.DS.$folderNew);
|
||||||
|
|
||||||
|
if (!JFolder::exists($folder) && !JFile::exists($folder)) {
|
||||||
|
//JFolder::create($path, $folder_permissions );
|
||||||
|
|
||||||
|
switch((int)$folder_permissions) {
|
||||||
|
case 777:
|
||||||
|
JFolder::create($folder, 0777 );
|
||||||
|
break;
|
||||||
|
case 705:
|
||||||
|
JFolder::create($folder, 0705 );
|
||||||
|
break;
|
||||||
|
case 666:
|
||||||
|
JFolder::create($folder, 0666 );
|
||||||
|
break;
|
||||||
|
case 644:
|
||||||
|
JFolder::create($folder, 0644 );
|
||||||
|
break;
|
||||||
|
case 755:
|
||||||
|
Default:
|
||||||
|
JFolder::create($folder, 0755 );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (isset($folder)) {
|
||||||
|
$data = "<html>\n<body bgcolor=\"#FFFFFF\">\n</body>\n</html>";
|
||||||
|
JFile::write($folder.DS."index.html", $data);
|
||||||
|
} else {
|
||||||
|
$app->redirect($link, JText::_('COM_PHOCADOWNLOAD_ERROR_FOLDER_CREATING'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$app->redirect($link, JText::_('COM_PHOCADOWNLOAD_SUCCESS_FOLDER_CREATING'));
|
||||||
|
} else {
|
||||||
|
$app->redirect($link, JText::_('COM_PHOCADOWNLOAD_ERROR_FOLDER_CREATING_EXISTS'));
|
||||||
|
}
|
||||||
|
//JRequest::setVar('folder', ($parent) ? $parent.'/'.$folder : $folder);
|
||||||
|
}
|
||||||
|
$app->redirect($link);
|
||||||
|
}
|
||||||
|
|
||||||
|
function multipleupload() {
|
||||||
|
$result = PhocaDownloadFileUpload::realMultipleUpload();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function upload() {
|
||||||
|
$result = PhocaDownloadFileUpload::realSingleUpload();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
/* @package Joomla
|
||||||
|
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
* @extension Phoca Extension
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
defined('_JEXEC') or die();
|
||||||
|
|
||||||
|
class PhocaDownloadCpControllerPhocaDownloadUploads extends PhocaDownloadCpController
|
||||||
|
{
|
||||||
|
function __construct() {
|
||||||
|
parent::__construct();
|
||||||
|
$this->registerTask( 'approveall', 'approveall');
|
||||||
|
}
|
||||||
|
|
||||||
|
function approveall() {
|
||||||
|
|
||||||
|
$model = $this->getModel('phocadownloadupload');
|
||||||
|
if(!$model->approveall()) {
|
||||||
|
$msg = JText::_( 'COM_PHOCADOWNLOAD_ERROR_APPROVE_ALL' );
|
||||||
|
} else {
|
||||||
|
$msg = JText::_( 'COM_PHOCADOWNLOAD_ALL_APPROVED' );
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->setRedirect( 'index.php?option=com_phocadownload&view=phocadownloaduploads' , $msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 6.3 KiB |
@ -0,0 +1,31 @@
|
|||||||
|
<?php defined('_JEXEC') or die('Restricted access');?>
|
||||||
|
<!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" lang="en_GB" xml:lang="en_GB">
|
||||||
|
<head>
|
||||||
|
<title>Phoca Download</title>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<style type="text/css">
|
||||||
|
body {
|
||||||
|
font-family: sans, Arial;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Phoca Download</h1>
|
||||||
|
<div style="float:right;margin:10px;">
|
||||||
|
<img src="logo-phoca.png" alt="" />
|
||||||
|
</div>
|
||||||
|
<p> </p>
|
||||||
|
<p> </p>
|
||||||
|
<p>
|
||||||
|
<a href="http://www.phoca.cz/phocadownload/" target="_blank">Phoca Download Main Site</a><br />
|
||||||
|
<a href="http://www.phoca.cz/documentation/" target="_blank">Phoca Download User Manual</a><br />
|
||||||
|
<a href="http://www.phoca.cz/forum/" target="_blank">Phoca Download Forum</a><br />
|
||||||
|
</p>
|
||||||
|
<p> </p>
|
||||||
|
<p> </p>
|
||||||
|
<p> </p>
|
||||||
|
<a href="javascript:void(0);" onclick="javascript:window.close();"><span class="small">Close window</span></a>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 6.3 KiB |
@ -0,0 +1,31 @@
|
|||||||
|
<?php defined('_JEXEC') or die('Restricted access');?>
|
||||||
|
<!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" lang="en_GB" xml:lang="en_GB">
|
||||||
|
<head>
|
||||||
|
<title>Phoca Download</title>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<style type="text/css">
|
||||||
|
body {
|
||||||
|
font-family: sans, Arial;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Phoca Download</h1>
|
||||||
|
<div style="float:right;margin:10px;">
|
||||||
|
<img src="logo-phoca.png" alt="" />
|
||||||
|
</div>
|
||||||
|
<p> </p>
|
||||||
|
<p> </p>
|
||||||
|
<p>
|
||||||
|
<a href="http://www.phoca.cz/phocadownload/" target="_blank">Phoca Download Main Site</a><br />
|
||||||
|
<a href="http://www.phoca.cz/documentation/" target="_blank">Phoca Download User Manual</a><br />
|
||||||
|
<a href="http://www.phoca.cz/forum/" target="_blank">Phoca Download Forum</a><br />
|
||||||
|
</p>
|
||||||
|
<p> </p>
|
||||||
|
<p> </p>
|
||||||
|
<p> </p>
|
||||||
|
<a href="javascript:void(0);" onclick="javascript:window.close();"><span class="small">Close window</span></a>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
/* @package Joomla
|
||||||
|
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
* @extension Phoca Extension
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
class PhocaDownloadCatsHelper
|
||||||
|
{
|
||||||
|
public static function getActions($t, $id = 0) {
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$result = new JObject;
|
||||||
|
|
||||||
|
if (empty($id)) {
|
||||||
|
$assetName = $t['o'];
|
||||||
|
} else {
|
||||||
|
$assetName = $t['o'].'.'.$t['tasks'].'.'.(int) $id;
|
||||||
|
}
|
||||||
|
$actions = array('core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete');
|
||||||
|
|
||||||
|
foreach ($actions as $action) {
|
||||||
|
$result->set($action, $user->authorise($action, $assetName));
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
/* @package Joomla
|
||||||
|
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
* @extension Phoca Extension
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
class PhocaDownloadCpHelper
|
||||||
|
{
|
||||||
|
public static function getActions($c = 'phocadownload') {
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$result = new JObject;
|
||||||
|
$assetName = 'com_'.$c;
|
||||||
|
$actions = array('core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete');
|
||||||
|
|
||||||
|
foreach ($actions as $action) {
|
||||||
|
$result->set($action, $user->authorise($action, $assetName));
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
/* @package Joomla
|
||||||
|
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
* @extension Phoca Extension
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
class PhocaDownloadDownloadsHelper
|
||||||
|
{
|
||||||
|
public static function getActions($t, $id = 0) {
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$result = new JObject;
|
||||||
|
|
||||||
|
if (empty($id)) {
|
||||||
|
$assetName = $t['o'];
|
||||||
|
} else {
|
||||||
|
$assetName = $t['o'].'.'.$t['tasks'].'.'.(int) $id;
|
||||||
|
}
|
||||||
|
$actions = array('core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete');
|
||||||
|
|
||||||
|
foreach ($actions as $action) {
|
||||||
|
$result->set($action, $user->authorise($action, $assetName));
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
/* @package Joomla
|
||||||
|
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
* @extension Phoca Extension
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
class PhocaDownloadFilesHelper
|
||||||
|
{
|
||||||
|
public static function getActions($t, $id = 0) {
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$result = new JObject;
|
||||||
|
|
||||||
|
if (empty($id)) {
|
||||||
|
$assetName = $t['o'];
|
||||||
|
} else {
|
||||||
|
$assetName = $t['o'].'.'.$t['tasks'].'.'.(int) $id;
|
||||||
|
}
|
||||||
|
$actions = array('core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete');
|
||||||
|
|
||||||
|
foreach ($actions as $action) {
|
||||||
|
$result->set($action, $user->authorise($action, $assetName));
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
/* @package Joomla
|
||||||
|
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
* @extension Phoca Extension
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
class PhocaDownloadLayoutsHelper
|
||||||
|
{
|
||||||
|
public static function getActions($t, $id = 0) {
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$result = new JObject;
|
||||||
|
|
||||||
|
if (empty($id)) {
|
||||||
|
$assetName = $t['o'];
|
||||||
|
} else {
|
||||||
|
$assetName = $t['o'].'.'.$t['tasks'].'.'.(int) $id;
|
||||||
|
}
|
||||||
|
$actions = array('core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete');
|
||||||
|
|
||||||
|
foreach ($actions as $action) {
|
||||||
|
$result->set($action, $user->authorise($action, $assetName));
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getTableId() {
|
||||||
|
|
||||||
|
$idString = '';
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
$query = ' SELECT a.id'
|
||||||
|
.' FROM #__phocadownload_layout AS a';
|
||||||
|
$db->setQuery($query, 0,1);
|
||||||
|
|
||||||
|
if (!$db->query()) {
|
||||||
|
$this->setError('Database Error - Getting Layout ID');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$idO = $db->loadObject();
|
||||||
|
|
||||||
|
//First autoincrement line can be different
|
||||||
|
if (isset($idO->id) && $idO->id > 0) {
|
||||||
|
$idString = '&id='.(int)$idO->id;
|
||||||
|
}
|
||||||
|
return $idString;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
/* @package Joomla
|
||||||
|
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
* @extension Phoca Extension
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
class PhocaDownloadLicsHelper
|
||||||
|
{
|
||||||
|
public static function getActions($t, $id = 0) {
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$result = new JObject;
|
||||||
|
|
||||||
|
if (empty($id)) {
|
||||||
|
$assetName = $t['o'];
|
||||||
|
} else {
|
||||||
|
$assetName = $t['o'].'.'.$t['tasks'].'.'.(int) $id;
|
||||||
|
}
|
||||||
|
$actions = array('core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete');
|
||||||
|
|
||||||
|
foreach ($actions as $action) {
|
||||||
|
$result->set($action, $user->authorise($action, $assetName));
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
/* @package Joomla
|
||||||
|
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
* @extension Phoca Extension
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
class PhocaDownloadLogsHelper
|
||||||
|
{
|
||||||
|
public static function getActions($t, $id = 0) {
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$result = new JObject;
|
||||||
|
|
||||||
|
if (empty($id)) {
|
||||||
|
$assetName = $t['o'];
|
||||||
|
} else {
|
||||||
|
$assetName = $t['o'].'.'.$t['tasks'].'.'.(int) $id;
|
||||||
|
}
|
||||||
|
$actions = array('core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete');
|
||||||
|
|
||||||
|
foreach ($actions as $action) {
|
||||||
|
$result->set($action, $user->authorise($action, $assetName));
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* @package Joomla.Framework
|
||||||
|
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*
|
||||||
|
* @component Phoca Component
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
|
||||||
|
*/
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
class PhocaDownloadManagerHelper
|
||||||
|
{
|
||||||
|
public static function getActions($categoryId = 0)
|
||||||
|
{
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$result = new JObject;
|
||||||
|
|
||||||
|
if (empty($categoryId)) {
|
||||||
|
$assetName = 'com_phocadownload';
|
||||||
|
} else {
|
||||||
|
$assetName = 'com_phocadownload.phocadownloadraimg.'.(int) $categoryId;
|
||||||
|
}
|
||||||
|
|
||||||
|
$actions = array(
|
||||||
|
'core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete'
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ($actions as $action) {
|
||||||
|
$result->set($action, $user->authorise($action, $assetName));
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* @package Joomla.Framework
|
||||||
|
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*
|
||||||
|
* @component Phoca Component
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
|
||||||
|
*/
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
class PhocaDownloadRaFileHelper
|
||||||
|
{
|
||||||
|
public static function getActions($categoryId = 0)
|
||||||
|
{
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$result = new JObject;
|
||||||
|
|
||||||
|
if (empty($categoryId)) {
|
||||||
|
$assetName = 'com_phocadownload';
|
||||||
|
} else {
|
||||||
|
$assetName = 'com_phocadownload.phocadownloadraimg.'.(int) $categoryId;
|
||||||
|
}
|
||||||
|
|
||||||
|
$actions = array(
|
||||||
|
'core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete'
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ($actions as $action) {
|
||||||
|
$result->set($action, $user->authorise($action, $assetName));
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,313 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* @package Joomla.Framework
|
||||||
|
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*
|
||||||
|
* @component Phoca Component
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||||
|
|
||||||
|
class PhocaDownloadRateHelper
|
||||||
|
{
|
||||||
|
function updateVoteStatisticsFile( $fileid ) {
|
||||||
|
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
|
||||||
|
// Get AVG and COUNT
|
||||||
|
$query = 'SELECT COUNT(vs.id) AS count, AVG(vs.rating) AS average'
|
||||||
|
.' FROM #__phocadownload_file_votes AS vs'
|
||||||
|
.' WHERE vs.fileid = '.(int) $fileid;
|
||||||
|
// .' AND vs.published = 1';
|
||||||
|
$db->setQuery($query, 0, 1);
|
||||||
|
$votesStatistics = $db->loadObject();
|
||||||
|
// if no count, set the average to 0
|
||||||
|
if($votesStatistics->count == 0) {
|
||||||
|
$votesStatistics->count = (int)0;
|
||||||
|
$votesStatistics->average = (float)0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($votesStatistics->count) && isset($votesStatistics->average)) {
|
||||||
|
// Insert or update
|
||||||
|
$query = 'SELECT vs.id AS id'
|
||||||
|
.' FROM #__phocadownload_file_votes_statistics AS vs'
|
||||||
|
.' WHERE vs.fileid = '.(int) $fileid;
|
||||||
|
$db->setQuery($query, 0, 1);
|
||||||
|
$votesStatisticsId = $db->loadObject();
|
||||||
|
|
||||||
|
// Yes, there is id (UPDATE) x No, there isn't (INSERT)
|
||||||
|
if (!empty($votesStatisticsId->id)) {
|
||||||
|
|
||||||
|
$query = 'UPDATE #__phocadownload_file_votes_statistics'
|
||||||
|
.' SET count = ' .(int)$votesStatistics->count
|
||||||
|
.' , average = ' .(float)$votesStatistics->average
|
||||||
|
.' WHERE fileid = '.(int) $fileid;
|
||||||
|
$db->setQuery($query);
|
||||||
|
|
||||||
|
if (!$db->query()) {
|
||||||
|
$this->setError('Database Error Voting 1');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$query = 'INSERT into #__phocadownload_file_votes_statistics'
|
||||||
|
.' (id, fileid, count, average)'
|
||||||
|
.' VALUES (null, '.(int)$fileid
|
||||||
|
.' , '.(int)$votesStatistics->count
|
||||||
|
.' , '.(float)$votesStatistics->average
|
||||||
|
.')';
|
||||||
|
$db->setQuery($query);
|
||||||
|
|
||||||
|
if (!$db->query()) {
|
||||||
|
$this->setError('Database Error Voting 2');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getVotesStatisticsFile($id) {
|
||||||
|
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
$query = 'SELECT vs.count AS count, vs.average AS average'
|
||||||
|
.' FROM #__phocadownload_file_votes_statistics AS vs'
|
||||||
|
.' WHERE vs.fileid = '.(int) $id;
|
||||||
|
$db->setQuery($query, 0, 1);
|
||||||
|
$votesStatistics = $db->loadObject();
|
||||||
|
|
||||||
|
return $votesStatistics;
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkUserVoteFile($fileid, $userid) {
|
||||||
|
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
$query = 'SELECT v.id AS id'
|
||||||
|
.' FROM #__phocadownload_file_votes AS v'
|
||||||
|
.' WHERE v.fileid = '. (int)$fileid
|
||||||
|
.' AND v.userid = '. (int)$userid;
|
||||||
|
$db->setQuery($query, 0, 1);
|
||||||
|
$checkUserVote = $db->loadObject();
|
||||||
|
if ($checkUserVote) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function renderRateFile($id, $displayRating, $small = 1, $refresh = false) {
|
||||||
|
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$neededAccessLevels = PhocaDownloadAccess::getNeededAccessLevels();
|
||||||
|
$access = PhocaDownloadAccess::isAccess($user->getAuthorisedViewLevels(), $neededAccessLevels);
|
||||||
|
|
||||||
|
|
||||||
|
if ($small == 1) {
|
||||||
|
$smallO = '-small';
|
||||||
|
$ratio = 18;
|
||||||
|
} else {
|
||||||
|
$smallO = '';
|
||||||
|
$ratio = 22;
|
||||||
|
}
|
||||||
|
|
||||||
|
$o = '';
|
||||||
|
|
||||||
|
//.$rating['urlvote'].$amp.'controller=detail&task=rate&rating=1
|
||||||
|
//$amp = PhocaDownloadUtils::setQuestionmarkOrAmp($rating['urlvote']);
|
||||||
|
$href = 'javascript:void(0);';
|
||||||
|
|
||||||
|
if ((int)$displayRating != 1) {
|
||||||
|
return '';
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$rating['alreadyratedfile'] = self::checkUserVoteFile( (int)$id, (int)$user->id );
|
||||||
|
|
||||||
|
$rating['notregisteredfile'] = true;
|
||||||
|
//$rating['usernamefile'] = '';
|
||||||
|
if ($access > 0) {
|
||||||
|
$rating['notregisteredfile'] = false;
|
||||||
|
$rating['usernamefile'] = $user->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
$rating['votescountfile'] = 0;
|
||||||
|
$rating['votesaveragefile'] = 0;
|
||||||
|
$rating['voteswidthfile'] = 0;
|
||||||
|
$votesStatistics = self::getVotesStatisticsFile((int)$id);
|
||||||
|
if (!empty($votesStatistics->count)) {
|
||||||
|
$rating['votescountfile'] = $votesStatistics->count;
|
||||||
|
}
|
||||||
|
if (!empty($votesStatistics->average)) {
|
||||||
|
$rating['votesaveragefile'] = $votesStatistics->average;
|
||||||
|
if ($rating['votesaveragefile'] > 0) {
|
||||||
|
$rating['votesaveragefile'] = round(((float)$rating['votesaveragefile'] / 0.5)) * 0.5;
|
||||||
|
$rating['voteswidthfile'] = $ratio * $rating['votesaveragefile'];
|
||||||
|
} else {
|
||||||
|
$rating['votesaveragefile'] = (int)0;// not float displaying
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Leave message for already voted images
|
||||||
|
//$vote = JRequest::getVar('vote', 0, '', 'int');
|
||||||
|
$voteMsg = JText::_('COM_PHOCADOWNLOAD_RATING_ALREADY_RATED_FILE');
|
||||||
|
//if ($vote == 1) {
|
||||||
|
// $voteMsg = JText::_('COM_PHOCADOWNLOAD_ALREADY_RATED_FILE_THANKS');
|
||||||
|
//}
|
||||||
|
|
||||||
|
$rating['votestextimg'] = 'VOTE';
|
||||||
|
if ((int)$rating['votescountfile'] > 1) {
|
||||||
|
$rating['votestextimg'] = 'VOTES';
|
||||||
|
}
|
||||||
|
|
||||||
|
$o .= '<div style="float:left;"><strong>'
|
||||||
|
. JText::_('COM_PHOCADOWNLOAD_RATING'). '</strong>: ' . $rating['votesaveragefile'] .' / '
|
||||||
|
.$rating['votescountfile'] . ' ' . JText::_('COM_PHOCADOWNLOAD_'.$rating['votestextimg']). ' </div>';
|
||||||
|
|
||||||
|
if ($rating['alreadyratedfile']) {
|
||||||
|
$o .= '<div style="float:left;"><ul class="star-rating'.$smallO.'">'
|
||||||
|
.'<li class="current-rating" style="width:'.$rating['voteswidthfile'].'px"></li>'
|
||||||
|
.'<li><span class="star1"></span></li>';
|
||||||
|
|
||||||
|
for ($i = 2;$i < 6;$i++) {
|
||||||
|
$o .= '<li><span class="stars'.$i.'"></span></li>';
|
||||||
|
}
|
||||||
|
$o .= '</ul></div>';
|
||||||
|
|
||||||
|
$or ='<div class="pd-result" id="pdresult'.(int)$id.'" style="float:left;margin-left:5px">'.JText::_('COM_PHOCADOWNLOAD_RATING_ALREADY_RATED_FILE').'</div>';
|
||||||
|
|
||||||
|
} else if ($rating['notregisteredfile']) {
|
||||||
|
|
||||||
|
$o .= '<div style="float:left;"><ul class="star-rating'.$smallO.'">'
|
||||||
|
.'<li class="current-rating" style="width:'.$rating['voteswidthfile'].'px"></li>'
|
||||||
|
.'<li><span class="star1"></span></li>';
|
||||||
|
|
||||||
|
for ($i = 2;$i < 6;$i++) {
|
||||||
|
$o .= '<li><span class="stars'.$i.'"></span></li>';
|
||||||
|
}
|
||||||
|
$o .= '</ul></div>';
|
||||||
|
|
||||||
|
$or ='<div class="pd-result" id="pdresult'.(int)$id.'" style="float:left;margin-left:5px">'.JText::_('COM_PHOCADOWNLOAD_ONLY_REGISTERED_LOGGED_RATE_FILE').'</div>';
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$o .= '<div style="float:left;"><ul class="star-rating'.$smallO.'">'
|
||||||
|
.'<li class="current-rating" style="width:'.$rating['voteswidthfile'].'px"></li>'
|
||||||
|
.'<li><a href="'.$href.'" onclick="pdRating('.(int)$id.', 1)" title="1 '. JText::_('COM_PHOCADOWNLOAD_STAR_OUT_OF').' 5" class="star1">1</a></li>';
|
||||||
|
|
||||||
|
for ($i = 2;$i < 6;$i++) {
|
||||||
|
$o .= '<li><a href="'.$href.'" onclick="pdRating('.(int)$id.', '.$i.')" title="'.$i.' '. JText::_('COM_PHOCADOWNLOAD_STARS_OUT_OF').' 5" class="stars'.$i.'">'.$i.'</a></li>';
|
||||||
|
}
|
||||||
|
$o .= '</ul></div>';
|
||||||
|
|
||||||
|
$or ='<div class="pd-result" id="pdresult'.(int)$id.'" style="float:left;margin-left:5px"></div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($refresh == true) {
|
||||||
|
return $o;//we are in Ajax, return only content of pdvoting div
|
||||||
|
} else {
|
||||||
|
return '<div id="pdvoting'.(int)$id.'">'.$o.'</div>' .$or ;//not in ajax, return the contend in div
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function renderRateFileJS($small = 1) {
|
||||||
|
|
||||||
|
$document = JFactory::getDocument();
|
||||||
|
$url = 'index.php?option=com_phocadownload&view=ratingfilea&task=rate&format=json&'.JSession::getFormToken().'=1';
|
||||||
|
$urlRefresh = 'index.php?option=com_phocadownload&view=ratingfilea&task=refreshrate&small='.$small.'&format=json&'.JSession::getFormToken().'=1';
|
||||||
|
$imgLoadingUrl = JURI::base(). 'components/com_phocadownload/assets/images/icon-loading2.gif';
|
||||||
|
$imgLoadingHTML = '<img src="'.$imgLoadingUrl.'" alt="" />';
|
||||||
|
$js = '<script type="text/javascript">' . "\n" . '<!--' . "\n";
|
||||||
|
//$js .= 'window.addEvent("domready",function() {
|
||||||
|
$js .= '
|
||||||
|
function pdRating(id, vote) {
|
||||||
|
|
||||||
|
var result = "pdresult" + id;
|
||||||
|
var resultvoting = "pdvoting" + id;
|
||||||
|
var pdRequest = new Request.JSON({
|
||||||
|
url: "'.$url.'",
|
||||||
|
method: "post",
|
||||||
|
|
||||||
|
onRequest: function(){
|
||||||
|
$(result).set("html", "'.addslashes($imgLoadingHTML).'");
|
||||||
|
},
|
||||||
|
|
||||||
|
onComplete: function(jsonObj) {
|
||||||
|
try {
|
||||||
|
var r = jsonObj;
|
||||||
|
} catch(e) {
|
||||||
|
var r = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (r) {
|
||||||
|
if (r.error == false) {
|
||||||
|
$(result).set("text", jsonObj.message);
|
||||||
|
|
||||||
|
// Refreshing Voting
|
||||||
|
var pdRequestRefresh = new Request.JSON({
|
||||||
|
url: "'.$urlRefresh.'",
|
||||||
|
method: "post",
|
||||||
|
|
||||||
|
onComplete: function(json2Obj) {
|
||||||
|
try {
|
||||||
|
var rr = json2Obj;
|
||||||
|
} catch(e) {
|
||||||
|
var rr = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rr) {
|
||||||
|
$(resultvoting).set("html", json2Obj.message);
|
||||||
|
} else {
|
||||||
|
$(resultvoting).set("text", "'.JText::_('COM_PHOCADOWNLOAD_ERROR_REQUESTING_RATING').'");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
onFailure: function() {
|
||||||
|
$(resultvoting).set("text", "'.JText::_('COM_PHOCADOWNLOAD_ERROR_REQUESTING_RATING').'");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
pdRequestRefresh.send({
|
||||||
|
data: {"ratingId": id, "ratingVote": vote, "format":"json"}
|
||||||
|
});
|
||||||
|
//End refreshing voting
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$(result).set("html", r.error);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$(result).set("text", "'.JText::_('COM_PHOCADOWNLOAD_ERROR_REQUESTING_RATING').'");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
onFailure: function() {
|
||||||
|
$(result).set("text", "'.JText::_('COM_PHOCADOWNLOAD_ERROR_REQUESTING_RATING').'");
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
pdRequest.send({
|
||||||
|
data: {"ratingId": id, "ratingVote": vote, "format":"json"},
|
||||||
|
});
|
||||||
|
|
||||||
|
};';
|
||||||
|
|
||||||
|
//$js .= '});';
|
||||||
|
|
||||||
|
$js .= "\n" . '//-->' . "\n" .'</script>';
|
||||||
|
$document->addCustomTag($js);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
/* @package Joomla
|
||||||
|
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
* @extension Phoca Extension
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
class PhocaDownloadStatHelper
|
||||||
|
{
|
||||||
|
public static function getActions($t, $id = 0) {
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$result = new JObject;
|
||||||
|
|
||||||
|
if (empty($id)) {
|
||||||
|
$assetName = $t['o'];
|
||||||
|
} else {
|
||||||
|
$assetName = $t['o'].'.'.$t['tasks'].'.'.(int) $id;
|
||||||
|
}
|
||||||
|
$actions = array('core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete');
|
||||||
|
|
||||||
|
foreach ($actions as $action) {
|
||||||
|
$result->set($action, $user->authorise($action, $assetName));
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
/* @package Joomla
|
||||||
|
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
* @extension Phoca Extension
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
class PhocaDownloadStylesHelper
|
||||||
|
{
|
||||||
|
public static function getActions($t, $id = 0) {
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$result = new JObject;
|
||||||
|
|
||||||
|
if (empty($id)) {
|
||||||
|
$assetName = $t['o'];
|
||||||
|
} else {
|
||||||
|
$assetName = $t['o'].'.'.$t['tasks'].'.'.(int) $id;
|
||||||
|
}
|
||||||
|
$actions = array('core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete');
|
||||||
|
|
||||||
|
foreach ($actions as $action) {
|
||||||
|
$result->set($action, $user->authorise($action, $assetName));
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
/* @package Joomla
|
||||||
|
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
* @extension Phoca Extension
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
class PhocaDownloadTagsHelper
|
||||||
|
{
|
||||||
|
public static function getActions($t, $id = 0) {
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$result = new JObject;
|
||||||
|
|
||||||
|
if (empty($id)) {
|
||||||
|
$assetName = $t['o'];
|
||||||
|
} else {
|
||||||
|
$assetName = $t['o'].'.'.$t['tasks'].'.'.(int) $id;
|
||||||
|
}
|
||||||
|
$actions = array('core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete');
|
||||||
|
|
||||||
|
foreach ($actions as $action) {
|
||||||
|
$result->set($action, $user->authorise($action, $assetName));
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
/* @package Joomla
|
||||||
|
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
* @extension Phoca Extension
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
class PhocaDownloadUploadsHelper
|
||||||
|
{
|
||||||
|
public static function getActions($t, $id = 0) {
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$result = new JObject;
|
||||||
|
|
||||||
|
if (empty($id)) {
|
||||||
|
$assetName = $t['o'];
|
||||||
|
} else {
|
||||||
|
$assetName = $t['o'].'.'.$t['tasks'].'.'.(int) $id;
|
||||||
|
}
|
||||||
|
$actions = array('core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete');
|
||||||
|
|
||||||
|
foreach ($actions as $action) {
|
||||||
|
$result->set($action, $user->authorise($action, $assetName));
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,62 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* @package Joomla 1.5
|
||||||
|
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
*
|
||||||
|
* @component Phoca Component
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Check to ensure this file is included in Joomla!
|
||||||
|
defined('_JEXEC') or die();
|
||||||
|
jimport('joomla.application.component.model');
|
||||||
|
|
||||||
|
class PhocaUserStatHelper
|
||||||
|
{
|
||||||
|
function createUserStatEntry($downloadId) {
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
|
||||||
|
|
||||||
|
$query = ' SELECT * FROM '.$db->quoteName('#__phocadownload_user_stat')
|
||||||
|
.' WHERE '. $db->quoteName('userid')
|
||||||
|
.' = '
|
||||||
|
.$db->Quote((int)$user->id)
|
||||||
|
.' AND '. $db->quoteName('fileid')
|
||||||
|
.' = '
|
||||||
|
.$db->Quote((int)$downloadId);
|
||||||
|
|
||||||
|
$db->setQuery($query);
|
||||||
|
$results = $db->loadObjectList();
|
||||||
|
|
||||||
|
$date = gmdate('Y-m-d H:i:s');
|
||||||
|
if ($results) {
|
||||||
|
// Update count
|
||||||
|
$query = 'UPDATE '.$db->quoteName('#__phocadownload_user_stat')
|
||||||
|
.' SET count = (count + 1),'
|
||||||
|
.' date = '.$db->Quote($date)
|
||||||
|
.' WHERE userid = '.$db->Quote((int)$user->id)
|
||||||
|
.' AND fileid = '.$db->Quote((int)$downloadId);
|
||||||
|
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->query();
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$query = 'INSERT INTO '.$db->quoteName('#__phocadownload_user_stat')
|
||||||
|
.' ('.$db->quoteName('count').','
|
||||||
|
.' '.$db->quoteName('userid').','
|
||||||
|
.' '.$db->quoteName('fileid').','
|
||||||
|
.' '.$db->quoteName('date').')'
|
||||||
|
.' VALUES ('.$db->Quote(1).','
|
||||||
|
.' '.$db->Quote((int)$user->id).','
|
||||||
|
.' '.$db->Quote((int)$downloadId).','
|
||||||
|
.' '.$db->Quote($date).')';
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->query();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body style="background-color: #000;"></body></html>
|
||||||
@ -0,0 +1,140 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* @package Joomla.Framework
|
||||||
|
* @copyright Copyright (C) Open Source Matters, Inc. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
* @component Phoca Component
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
|
||||||
|
*/
|
||||||
|
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||||
|
if(!defined('DS')) define('DS', DIRECTORY_SEPARATOR);
|
||||||
|
jimport( 'joomla.filesystem.folder' );
|
||||||
|
|
||||||
|
class com_phocadownloadInstallerScript
|
||||||
|
{
|
||||||
|
function install($parent) {
|
||||||
|
//echo '<p>' . JText::_('COM_PHOCAGALLLERY_INSTALL_TEXT') . '</p>';
|
||||||
|
|
||||||
|
|
||||||
|
$folder[0][0] = 'phocadownload' ;
|
||||||
|
$folder[0][1] = JPATH_ROOT . DS . $folder[0][0];
|
||||||
|
|
||||||
|
$folder[1][0] = 'images' . DS . 'phocadownload' ;
|
||||||
|
$folder[1][1] = JPATH_ROOT . DS . $folder[1][0];
|
||||||
|
|
||||||
|
$folder[2][0] = 'phocadownload' . DS .'userupload';
|
||||||
|
$folder[2][1] = JPATH_ROOT . DS . $folder[2][0];
|
||||||
|
|
||||||
|
$folder[3][0] = 'phocadownloadpap';
|
||||||
|
$folder[3][1] = JPATH_ROOT . DS . $folder[3][0];
|
||||||
|
|
||||||
|
$folder[4][0] = 'phocadownloadpap' . DS .'userupload';
|
||||||
|
$folder[4][1] = JPATH_ROOT . DS . $folder[4][0];
|
||||||
|
|
||||||
|
$message = '';
|
||||||
|
$error = array();
|
||||||
|
foreach ($folder as $key => $value)
|
||||||
|
{
|
||||||
|
if (!JFolder::exists( $value[1]))
|
||||||
|
{
|
||||||
|
if (JFolder::create( $value[1], 0755 ))
|
||||||
|
{
|
||||||
|
|
||||||
|
$data = "<html>\n<body bgcolor=\"#FFFFFF\">\n</body>\n</html>";
|
||||||
|
JFile::write($value[1].DS."index.html", $data);
|
||||||
|
$message .= '<div><b><span style="color:#009933">Folder</span> ' . $value[0]
|
||||||
|
.' <span style="color:#009933">created!</span></b></div>';
|
||||||
|
$error[] = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$message .= '<div><b><span style="color:#CC0033">Folder</span> ' . $value[0]
|
||||||
|
.' <span style="color:#CC0033">creation failed!</span></b> Please create it manually.</div>';
|
||||||
|
$error[] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else//Folder exist
|
||||||
|
{
|
||||||
|
$message .= '<div><b><span style="color:#009933">Folder</span> ' . $value[0]
|
||||||
|
.' <span style="color:#009933">exists!</span></b></div>';
|
||||||
|
$error[] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
JFactory::getApplication()->enqueueMessage($message, 'message');
|
||||||
|
//$app = JFactory::getApplication();
|
||||||
|
//$app->redirect(JRoute::_('index.php?option=com_phocadownload'), $message);
|
||||||
|
$parent->getParent()->setRedirectURL('index.php?option=com_phocadownload');
|
||||||
|
}
|
||||||
|
function uninstall($parent) {
|
||||||
|
//echo '<p>' . JText::_('COM_PHOCAGALLLERY_UNINSTALL_TEXT') . '</p>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function update($parent) {
|
||||||
|
//echo '<p>' . JText::sprintf('COM_PHOCADOWNLOAD_UPDATE_TEXT', $parent->get('manifest')->version) . '</p>';
|
||||||
|
|
||||||
|
$folder[0][0] = 'phocadownload' ;
|
||||||
|
$folder[0][1] = JPATH_ROOT . DS . $folder[0][0];
|
||||||
|
|
||||||
|
$folder[1][0] = 'images' . DS . 'phocadownload' ;
|
||||||
|
$folder[1][1] = JPATH_ROOT . DS . $folder[1][0];
|
||||||
|
|
||||||
|
$folder[2][0] = 'phocadownload' . DS .'userupload';
|
||||||
|
$folder[2][1] = JPATH_ROOT . DS . $folder[2][0];
|
||||||
|
|
||||||
|
$folder[3][0] = 'phocadownloadpap';
|
||||||
|
$folder[3][1] = JPATH_ROOT . DS . $folder[3][0];
|
||||||
|
|
||||||
|
$folder[4][0] = 'phocadownloadpap' . DS .'userupload';
|
||||||
|
$folder[4][1] = JPATH_ROOT . DS . $folder[4][0];
|
||||||
|
|
||||||
|
$message = '';
|
||||||
|
$error = array();
|
||||||
|
foreach ($folder as $key => $value)
|
||||||
|
{
|
||||||
|
if (!JFolder::exists( $value[1]))
|
||||||
|
{
|
||||||
|
if (JFolder::create( $value[1], 0755 ))
|
||||||
|
{
|
||||||
|
|
||||||
|
$data = "<html>\n<body bgcolor=\"#FFFFFF\">\n</body>\n</html>";
|
||||||
|
JFile::write($value[1].DS."index.html", $data);
|
||||||
|
$message .= '<div><b><span style="color:#009933">Folder</span> ' . $value[0]
|
||||||
|
.' <span style="color:#009933">created!</span></b></div>';
|
||||||
|
$error[] = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$message .= '<div><b><span style="color:#CC0033">Folder</span> ' . $value[0]
|
||||||
|
.' <span style="color:#CC0033">creation failed!</span></b> Please create it manually.</div>';
|
||||||
|
$error[] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else//Folder exist
|
||||||
|
{
|
||||||
|
$message .= '<div><b><span style="color:#009933">Folder</span> ' . $value[0]
|
||||||
|
.' <span style="color:#009933">exists!</span></b></div>';
|
||||||
|
$error[] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$msg = JText::_('COM_PHOCADOWNLOAD_UPDATE_TEXT');
|
||||||
|
$msg .= ' (' . JText::_('COM_PHOCADOWNLOAD_VERSION'). ': ' . $parent->get('manifest')->version . ')';
|
||||||
|
|
||||||
|
$msg .= '<br />'. $message;
|
||||||
|
//$parent->getParent()->setRedirectURL('index.php?option=com_phocadownload');
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$app->enqueueMessage($msg);
|
||||||
|
$app->redirect(JRoute::_('index.php?option=com_phocadownload'));
|
||||||
|
}
|
||||||
|
|
||||||
|
function preflight($type, $parent) {
|
||||||
|
//echo '<p>' . JText::_('COM_PHOCADOWNLOAD_PREFLIGHT_' . $type . '_TEXT') . '</p>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function postflight($type, $parent) {
|
||||||
|
//echo '<p>' . JText::_('COM_PHOCADOWNLOAD_POSTFLIGHT_' . $type . '_TEXT') . '</p>';
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body style="background-color: #000;"></body></html>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body style="background-color: #000;"></body></html>
|
||||||
@ -0,0 +1,278 @@
|
|||||||
|
-- -------------------------------------------------------------------- --
|
||||||
|
-- Phoca Download manual installation --
|
||||||
|
-- -------------------------------------------------------------------- --
|
||||||
|
-- See documentation on http://www.phoca.cz/ --
|
||||||
|
-- --
|
||||||
|
-- Change all prefixes #__ to prefix which is set in your Joomla! site --
|
||||||
|
-- (e.g. from #__phocadownload to jos_phocadownload) --
|
||||||
|
-- Run this SQL queries in your database tool, e.g. in phpMyAdmin --
|
||||||
|
-- If you have questions, just ask in Phoca Forum --
|
||||||
|
-- http://www.phoca.cz/forum/ --
|
||||||
|
-- -------------------------------------------------------------------- --
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `#__phocadownload_categories` (
|
||||||
|
`id` int(11) NOT NULL auto_increment,
|
||||||
|
`parent_id` int(11) NOT NULL default 0,
|
||||||
|
`section` int(11) NOT NULL default 0,
|
||||||
|
`title` varchar(255) NOT NULL default '',
|
||||||
|
`name` varchar(255) NOT NULL default '',
|
||||||
|
`alias` varchar(255) NOT NULL default '',
|
||||||
|
`image` varchar(255) NOT NULL default '',
|
||||||
|
`image_position` varchar(30) NOT NULL default '',
|
||||||
|
`description` text,
|
||||||
|
`published` tinyint(1) NOT NULL default '0',
|
||||||
|
`checked_out` int(11) unsigned NOT NULL default '0',
|
||||||
|
`checked_out_time` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||||
|
`editor` varchar(50) default NULL,
|
||||||
|
`ordering` int(11) NOT NULL default '0',
|
||||||
|
`access` int(11) unsigned NOT NULL default '0',
|
||||||
|
`uploaduserid` text,
|
||||||
|
`accessuserid` text,
|
||||||
|
`deleteuserid` text,
|
||||||
|
`date` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||||
|
`count` int(11) NOT NULL default '0',
|
||||||
|
`hits` int(11) NOT NULL default '0',
|
||||||
|
`params` text,
|
||||||
|
`metakey` text,
|
||||||
|
`metadesc` text,
|
||||||
|
`metadata` text,
|
||||||
|
`language` char(7) NOT NULL default '',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `cat_idx` (`section`,`published`,`access`),
|
||||||
|
KEY `idx_access` (`access`),
|
||||||
|
KEY `idx_checkout` (`checked_out`)
|
||||||
|
) default CHARSET=utf8;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `#__phocadownload` (
|
||||||
|
`id` int(11) unsigned NOT NULL auto_increment,
|
||||||
|
`catid` int(11) NOT NULL default '0',
|
||||||
|
`sectionid` int(11) NOT NULL default '0',
|
||||||
|
`sid` int(11) NOT NULL default '0',
|
||||||
|
`owner_id` int(11) NOT NULL default 0,
|
||||||
|
`title` varchar(250) NOT NULL default '',
|
||||||
|
`alias` varchar(255) NOT NULL default '',
|
||||||
|
`filename` varchar(250) NOT NULL default '',
|
||||||
|
`filename_play` varchar(250) NOT NULL default '',
|
||||||
|
`filename_preview` varchar(250) NOT NULL default '',
|
||||||
|
`filesize` int(11) NOT NULL default 0,
|
||||||
|
`author` varchar(255) NOT NULL default '',
|
||||||
|
`author_email` varchar(255) NOT NULL default '',
|
||||||
|
`author_url` varchar(255) NOT NULL default '',
|
||||||
|
`license` varchar(255) NOT NULL default '',
|
||||||
|
`license_url` varchar(255) NOT NULL default '',
|
||||||
|
`image_filename` varchar(255) NOT NULL default '',
|
||||||
|
`image_filename_spec1` varchar(255) NOT NULL default '',
|
||||||
|
`image_filename_spec2` varchar(255) NOT NULL default '',
|
||||||
|
`image_download` varchar(255) NOT NULL default '',
|
||||||
|
`video_filename` varchar(255) NOT NULL default '',
|
||||||
|
`link_external` varchar(255) NOT NULL default '',
|
||||||
|
`mirror1link` varchar(255) NOT NULL default '',
|
||||||
|
`mirror1title` varchar(255) NOT NULL default '',
|
||||||
|
`mirror1target` varchar(10) NOT NULL default '',
|
||||||
|
`mirror2link` varchar(255) NOT NULL default '',
|
||||||
|
`mirror2title` varchar(255) NOT NULL default '',
|
||||||
|
`mirror2target` varchar(10) NOT NULL default '',
|
||||||
|
`description` text,
|
||||||
|
`features` text,
|
||||||
|
`changelog` text,
|
||||||
|
`notes` text,
|
||||||
|
`userid` int(11) NOT NULL default '0',
|
||||||
|
`version` varchar(255) NOT NULL default '',
|
||||||
|
`directlink` tinyint(1) NOT NULL default '0',
|
||||||
|
`date` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||||
|
`publish_up` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||||
|
`publish_down` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||||
|
`hits` int(11) NOT NULL default '0',
|
||||||
|
`textonly` tinyint(1) NOT NULL default '0',
|
||||||
|
`published` tinyint(1) NOT NULL default '0',
|
||||||
|
`approved` tinyint(1) NOT NULL default '0',
|
||||||
|
`checked_out` int(11) NOT NULL default '0',
|
||||||
|
`checked_out_time` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||||
|
`ordering` int(11) NOT NULL default '0',
|
||||||
|
`access` int(11) unsigned NOT NULL default '0',
|
||||||
|
`confirm_license` int(11) NOT NULL default '0',
|
||||||
|
`unaccessible_file` int(11) NOT NULL default '0',
|
||||||
|
`token` char(64) default NULL,
|
||||||
|
`tokenhits` int(11) NOT NULL default 0,
|
||||||
|
`tags_string` varchar(255) NOT NULL default '',
|
||||||
|
`params` text,
|
||||||
|
`metakey` text,
|
||||||
|
`metadesc` text,
|
||||||
|
`metadata` text,
|
||||||
|
`language` char(7) NOT NULL default '',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `catid` (`catid`,`published`)
|
||||||
|
) default CHARSET=utf8;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `#__phocadownload_user_stat` (
|
||||||
|
`id` int(11) NOT NULL auto_increment,
|
||||||
|
`fileid` int(11) NOT NULL default '0',
|
||||||
|
`userid` int(11) NOT NULL default '0',
|
||||||
|
`count` int(11) NOT NULL default '0',
|
||||||
|
`date` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||||
|
`published` tinyint(1) NOT NULL default '0',
|
||||||
|
`ordering` int(11) NOT NULL default '0',
|
||||||
|
`language` char(7) NOT NULL default '',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) default CHARSET=utf8;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `#__phocadownload_licenses` (
|
||||||
|
`id` int(11) NOT NULL auto_increment,
|
||||||
|
`title` varchar(255) NOT NULL default '',
|
||||||
|
`alias` varchar(255) NOT NULL default '',
|
||||||
|
`description` text,
|
||||||
|
`checked_out` int(11) unsigned NOT NULL default '0',
|
||||||
|
`checked_out_time` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||||
|
`published` tinyint(1) NOT NULL default '0',
|
||||||
|
`ordering` int(11) NOT NULL default '0',
|
||||||
|
`language` char(7) NOT NULL default '',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) default CHARSET=utf8;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `#__phocadownload_file_votes` (
|
||||||
|
`id` int(11) NOT NULL auto_increment,
|
||||||
|
`fileid` int(11) NOT NULL default 0,
|
||||||
|
`userid` int(11) NOT NULL default 0,
|
||||||
|
`date` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||||
|
`rating` tinyint(1) NOT NULL default '0',
|
||||||
|
`published` tinyint(1) NOT NULL default '0',
|
||||||
|
`checked_out` int(11) unsigned NOT NULL default '0',
|
||||||
|
`checked_out_time` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||||
|
`ordering` int(11) NOT NULL default '0',
|
||||||
|
`params` text,
|
||||||
|
`language` char(7) NOT NULL default '',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) default CHARSET=utf8;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `#__phocadownload_file_votes_statistics` (
|
||||||
|
`id` int(11) NOT NULL auto_increment,
|
||||||
|
`fileid` int(11) NOT NULL default 0,
|
||||||
|
`count` int(11) NOT NULL default '0',
|
||||||
|
`average` float(8,6) NOT NULL default '0',
|
||||||
|
`language` char(7) NOT NULL default '',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) default CHARSET=utf8;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `#__phocadownload_tags` (
|
||||||
|
`id` int(11) NOT NULL auto_increment,
|
||||||
|
`title` varchar(255) NOT NULL default '',
|
||||||
|
`alias` varchar(255) NOT NULL default '',
|
||||||
|
`link_ext` varchar(255) NOT NULL default '',
|
||||||
|
`link_cat` int(11) unsigned NOT NULL default '0',
|
||||||
|
`description` text,
|
||||||
|
`published` tinyint(1) NOT NULL default '0',
|
||||||
|
`checked_out` int(11) unsigned NOT NULL default '0',
|
||||||
|
`checked_out_time` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||||
|
`ordering` int(11) NOT NULL default '0',
|
||||||
|
`params` text,
|
||||||
|
`language` char(7) NOT NULL default '',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) default CHARSET=utf8;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `#__phocadownload_tags_ref` (
|
||||||
|
`id` SERIAL,
|
||||||
|
`fileid` int(11) NOT NULL default 0,
|
||||||
|
`tagid` int(11) NOT NULL default 0,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `i_fileid` (`fileid`,`tagid`)
|
||||||
|
) default CHARSET=utf8;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `#__phocadownload_layout` (
|
||||||
|
`id` int(11) NOT NULL auto_increment,
|
||||||
|
`categories` text,
|
||||||
|
`category` text,
|
||||||
|
`file` text,
|
||||||
|
`checked_out` int(11) unsigned NOT NULL default '0',
|
||||||
|
`checked_out_time` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||||
|
`params` text,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) default CHARSET=utf8;
|
||||||
|
|
||||||
|
INSERT INTO `#__phocadownload_layout` (
|
||||||
|
`id` ,
|
||||||
|
`categories` ,
|
||||||
|
`category` ,
|
||||||
|
`file` ,
|
||||||
|
`checked_out` ,
|
||||||
|
`checked_out_time` ,
|
||||||
|
`params`
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
NULL , '<div class="pd-categoriesbox">
|
||||||
|
<div class="pd-title">{pdtitle}</div>
|
||||||
|
{pdsubcategories}
|
||||||
|
{pdclear}
|
||||||
|
</div>',
|
||||||
|
|
||||||
|
'<div class="pd-filebox">
|
||||||
|
{pdfiledesctop}
|
||||||
|
{pdfile}
|
||||||
|
<div class="pd-buttons">{pdbuttondownload}</div>
|
||||||
|
<div class="pd-buttons">{pdbuttondetails}</div>
|
||||||
|
<div class="pd-buttons">{pdbuttonpreview}</div>
|
||||||
|
<div class="pd-buttons">{pdbuttonplay}</div>
|
||||||
|
<div class="pd-mirrors">{pdmirrorlink2} {pdmirrorlink1}</div>
|
||||||
|
<div class="pd-rating">{pdrating}</div>
|
||||||
|
<div class="pd-tags">{pdtags}</div>
|
||||||
|
{pdfiledescbottom}
|
||||||
|
<div class="pd-cb"></div>
|
||||||
|
</div>'
|
||||||
|
|
||||||
|
, '<div class="pd-filebox">
|
||||||
|
{pdimage}
|
||||||
|
{pdfile}
|
||||||
|
{pdfilesize}
|
||||||
|
{pdversion}
|
||||||
|
{pdlicense}
|
||||||
|
{pdauthor}
|
||||||
|
{pdauthoremail}
|
||||||
|
{pdfiledate}
|
||||||
|
{pddownloads}
|
||||||
|
{pddescription}
|
||||||
|
{pdfeatures}
|
||||||
|
{pdchangelog}
|
||||||
|
{pdnotes}
|
||||||
|
<div class="pd-mirrors">{pdmirrorlink2} {pdmirrorlink1}</div>
|
||||||
|
<div class="pd-report">{pdreportlink}</div>
|
||||||
|
<div class="pd-rating">{pdrating}</div>
|
||||||
|
<div class="pd-tags">{pdtags}</div>
|
||||||
|
<div class="pd-cb"></div>
|
||||||
|
</div>' , '0', '0000-00-00 00:00:00', NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `#__phocadownload_styles` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`title` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`alias` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`filename` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`menulink` text,
|
||||||
|
`type` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`published` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`checked_out` int(11) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`checked_out_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
`ordering` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`params` text,
|
||||||
|
`language` char(7) NOT NULL DEFAULT '',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) DEFAULT CHARSET=utf8 ;
|
||||||
|
|
||||||
|
INSERT INTO `#__phocadownload_styles` (`id`, `title`, `alias`, `filename`, `menulink`, `type`, `published`, `checked_out`, `checked_out_time`, `ordering`, `params`, `language`) VALUES
|
||||||
|
(1, 'Phocadownload', 'phocadownload', 'phocadownload.css', NULL, 1, 1, 0, '0000-00-00 00:00:00', 1, NULL, '*'),
|
||||||
|
(2, 'Rating', 'rating', 'rating.css', NULL, 1, 1, 0, '0000-00-00 00:00:00', 2, NULL, '*'),
|
||||||
|
(3, 'Button', 'button', 'button.css', NULL, 1, 0, 0, '0000-00-00 00:00:00', 3, NULL, '*'),
|
||||||
|
(4, 'Button (Rounded Corners)', '', 'buttonrc.css', NULL, 1, 0, 0, '0000-00-00 00:00:00', 4, NULL, '*'),
|
||||||
|
(5, 'Default', 'default', 'default.css', NULL, 2, 1, 0, '0000-00-00 00:00:00', 1, NULL, '*'),
|
||||||
|
(6, 'Bootstrap', '', 'bootstrap.min.css', NULL, 1, 0, 0, '0000-00-00 00:00:00', 5, NULL, '*');
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `#__phocadownload_logging` (
|
||||||
|
`id` int(11) unsigned NOT NULL auto_increment,
|
||||||
|
`fileid` int(11) NOT NULL default '0',
|
||||||
|
`catid` int(11) NOT NULL default '0',
|
||||||
|
`userid` int(11) NOT NULL default '0',
|
||||||
|
`ip` varchar(20) NOT NULL default '',
|
||||||
|
`page` varchar(255) NOT NULL,
|
||||||
|
`date` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||||
|
`type` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`params` text NOT NULL,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) DEFAULT CHARSET=utf8 ;
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
DROP TABLE IF EXISTS `#__phocadownload`;
|
||||||
|
DROP TABLE IF EXISTS `#__phocadownload_categories`;
|
||||||
|
DROP TABLE IF EXISTS `#__phocadownload_user_stat`;
|
||||||
|
DROP TABLE IF EXISTS `#__phocadownload_licenses`;
|
||||||
|
DROP TABLE IF EXISTS `#__phocadownload_file_votes`;
|
||||||
|
DROP TABLE IF EXISTS `#__phocadownload_file_votes_statistics`;
|
||||||
|
DROP TABLE IF EXISTS `#__phocadownload_tags`;
|
||||||
|
DROP TABLE IF EXISTS `#__phocadownload_tags_ref`;
|
||||||
|
DROP TABLE IF EXISTS `#__phocadownload_layout`;
|
||||||
|
DROP TABLE IF EXISTS `#__phocadownload_styles`;
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,78 @@
|
|||||||
|
<?php
|
||||||
|
/* @package Joomla
|
||||||
|
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
* @extension Phoca Extension
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
spl_autoload_register(array('JLoader','load'));
|
||||||
|
|
||||||
|
class PhocaDownloadLoader extends JLoader
|
||||||
|
{
|
||||||
|
private static $paths = array();
|
||||||
|
protected static $classes = array();
|
||||||
|
|
||||||
|
public static function import($filePath, $base = null, $key = 'libraries.') {
|
||||||
|
|
||||||
|
$cU = 'phocadownload';
|
||||||
|
$cN = 'PhocaDownload';
|
||||||
|
|
||||||
|
$keyPath = $key ? $key . $filePath : $filePath;
|
||||||
|
|
||||||
|
if (!isset($paths[$keyPath])) {
|
||||||
|
if ( !$base ) {
|
||||||
|
$base = JPATH_ADMINISTRATOR.'/components/com_'.$cU.'/libraries';
|
||||||
|
}
|
||||||
|
|
||||||
|
$parts = explode( '.', $filePath );
|
||||||
|
|
||||||
|
$className = array_pop( $parts );
|
||||||
|
|
||||||
|
|
||||||
|
switch($className) {
|
||||||
|
case 'helper' :
|
||||||
|
$className = ucfirst(array_pop( $parts )).ucfirst($className);
|
||||||
|
break;
|
||||||
|
|
||||||
|
Default :
|
||||||
|
$className = ucfirst($className);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$path = str_replace( '.', DS, $filePath );
|
||||||
|
|
||||||
|
if (strpos($filePath, $cU) === 0) {
|
||||||
|
$className = $cN.$className;
|
||||||
|
$classes = JLoader::register($className, $base.DS.$path.'.php');
|
||||||
|
$rs = isset($classes[strtolower($className)]);
|
||||||
|
} else {
|
||||||
|
// If it is not in the joomla namespace then we have no idea if
|
||||||
|
// it uses our pattern for class names/files so just include
|
||||||
|
// if the file exists or set it to false if not
|
||||||
|
|
||||||
|
$filename = $base.DS.$path.'.php';
|
||||||
|
if (is_file($filename)) {
|
||||||
|
$rs = (bool) include $filename;
|
||||||
|
} else {
|
||||||
|
// if the file doesn't exist fail
|
||||||
|
$rs = false;
|
||||||
|
|
||||||
|
// note: JLoader::register does an is_file check itself so we don't need it above, we do it here because we
|
||||||
|
// try to load the file directly and it may not exist which could cause php to throw up nasty warning messages
|
||||||
|
// at us so we set it to false here and hope that if the programmer is good enough they'll check the return value
|
||||||
|
// instead of hoping it'll work. remmeber include only fires a warning, so $rs was going to be false with a nasty
|
||||||
|
// warning message
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PhocaDownloadLoader::$paths[$keyPath] = $rs;
|
||||||
|
}
|
||||||
|
|
||||||
|
return PhocaDownloadLoader::$paths[$keyPath];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function phocadownloadimport($path) {
|
||||||
|
return PhocaDownloadLoader::import($path);
|
||||||
|
}
|
||||||
@ -0,0 +1,174 @@
|
|||||||
|
<?php
|
||||||
|
/* @package Joomla
|
||||||
|
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
* @extension Phoca Extension
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||||
|
class PhocaDownloadAccess
|
||||||
|
{
|
||||||
|
public static function getCategoryAccess($id) {
|
||||||
|
|
||||||
|
$output = array();
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
$query = 'SELECT c.access, c.uploaduserid, c.deleteuserid' .
|
||||||
|
' FROM #__phocadownload_categories AS c' .
|
||||||
|
' WHERE c.id = '. (int) $id .
|
||||||
|
' ORDER BY c.id';
|
||||||
|
$db->setQuery($query, 0, 1);
|
||||||
|
$output = $db->loadObject();
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getCategoryAccessByFileId($id) {
|
||||||
|
|
||||||
|
$output = array();
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
$query = 'SELECT c.access, c.uploaduserid, c.deleteuserid' .
|
||||||
|
' FROM #__phocadownload_categories AS c' .
|
||||||
|
' LEFT JOIN #__phocadownload as a ON a.catid = c.id' .
|
||||||
|
' WHERE a.id = '. (int) $id .
|
||||||
|
' ORDER BY c.id';
|
||||||
|
$db->setQuery($query, 0, 1);
|
||||||
|
$output = $db->loadObject();
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to check if the user have access to category
|
||||||
|
* Display or hide the not accessible categories - subcat folder will be not displayed
|
||||||
|
* Check whether category access level allows access
|
||||||
|
*
|
||||||
|
* E.g.: Should the link to Subcategory or to Parentcategory be displayed
|
||||||
|
* E.g.: Should the delete button displayed, should be the upload button displayed
|
||||||
|
*
|
||||||
|
* @param string $params rightType: accessuserid, uploaduserid, deleteuserid - access, upload, delete right
|
||||||
|
* @param int $params rightUsers - All selected users which should have the "rightType" right
|
||||||
|
* @param int $params rightGroup - All selected Groups of users(public, registered or special ) which should have the "rT" right
|
||||||
|
* @param int $params userAID - Specific group of user who display the category in front (public, special, registerd)
|
||||||
|
* @param int $params userId - Specific id of user who display the category in front (1,2,3,...)
|
||||||
|
* @param int $params Additional param - e.g. $display_access_category (Should be unaccessed category displayed)
|
||||||
|
* @return boolean 1 or 0
|
||||||
|
* $rightUsers -> $userId
|
||||||
|
* $rightGroup -> $userAID
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static function getUserRight($rightType = 'accessuserid', $rightUsers, $rightGroup = 0, $userAID = array(), $userId = 0 , $additionalParam = 0 ) {
|
||||||
|
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
// we can get the variables here, not before function call
|
||||||
|
$userAID = $user->getAuthorisedViewLevels();
|
||||||
|
$userId = $user->get('id', 0);
|
||||||
|
|
||||||
|
$guest = 0;
|
||||||
|
if (isset($user->guest) && $user->guest == 1) {
|
||||||
|
$guest = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// User ACL
|
||||||
|
$rightGroupAccess = 0;
|
||||||
|
// User can be assigned to different groups
|
||||||
|
foreach ($userAID as $keyUserAID => $valueUserAID) {
|
||||||
|
if ((int)$rightGroup == (int)$valueUserAID) {
|
||||||
|
$rightGroupAccess = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
$rightUsersIdArray = array();
|
||||||
|
if (!empty($rightUsers)) {
|
||||||
|
$rightUsersIdArray = explode( ',', trim( $rightUsers ) );
|
||||||
|
} else {
|
||||||
|
$rightUsersIdArray = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
$rightDisplay = 1;
|
||||||
|
if ($additionalParam == 0) { // We want not to display unaccessable categories ($display_access_category)
|
||||||
|
if ($rightGroup != 0) {
|
||||||
|
|
||||||
|
if ($rightGroupAccess == 0) {
|
||||||
|
$rightDisplay = 0;
|
||||||
|
} else { // Access level only for one registered user
|
||||||
|
if (!empty($rightUsersIdArray)) {
|
||||||
|
// Check if the user is contained in selected array
|
||||||
|
$userIsContained = 0;
|
||||||
|
foreach ($rightUsersIdArray as $key => $value) {
|
||||||
|
if ($userId == $value) {
|
||||||
|
$userIsContained = 1;// check if the user id is selected in multiple box
|
||||||
|
break;// don't search again
|
||||||
|
}
|
||||||
|
// for access (-1 not selected - all registered, 0 all users)
|
||||||
|
if ($value == -1) {
|
||||||
|
if ($guest == 0) {
|
||||||
|
$userIsContained = 1;// in multiple select box is selected - All registered users
|
||||||
|
}
|
||||||
|
break;// don't search again
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($userIsContained == 0) {
|
||||||
|
$rightDisplay = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Access rights (Default open for all)
|
||||||
|
// Upload and Delete rights (Default closed for all)
|
||||||
|
switch ($rightType) {
|
||||||
|
case 'accessuserid':
|
||||||
|
$rightDisplay = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
Default:
|
||||||
|
$rightDisplay = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $rightDisplay;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static function getNeededAccessLevels() {
|
||||||
|
|
||||||
|
$paramsC = JComponentHelper::getParams('com_phocadownload');
|
||||||
|
$registeredAccessLevel = $paramsC->get( 'registered_access_level', array(2,3,4) );
|
||||||
|
return $registeredAccessLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check if user's groups access rights (e.g. user is public, registered, special) can meet needed Levels
|
||||||
|
*/
|
||||||
|
|
||||||
|
public static function isAccess($userLevels, $neededLevels) {
|
||||||
|
|
||||||
|
$rightGroupAccess = 0;
|
||||||
|
|
||||||
|
// User can be assigned to different groups
|
||||||
|
foreach($userLevels as $keyuserLevels => $valueuserLevels) {
|
||||||
|
foreach($neededLevels as $keyneededLevels => $valueneededLevels) {
|
||||||
|
|
||||||
|
if ((int)$valueneededLevels == (int)$valueuserLevels) {
|
||||||
|
$rightGroupAccess = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($rightGroupAccess == 1) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (boolean)$rightGroupAccess;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,152 @@
|
|||||||
|
<?php
|
||||||
|
/* @package Joomla
|
||||||
|
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
* @extension Phoca Extension
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
defined('_JEXEC') or die();
|
||||||
|
jimport('joomla.application.component.model');
|
||||||
|
|
||||||
|
class PhocaDownloadCategory
|
||||||
|
{
|
||||||
|
public static function CategoryTreeOption($data, $tree, $id=0, $text='', $currentId) {
|
||||||
|
|
||||||
|
foreach ($data as $key) {
|
||||||
|
$show_text = $text . $key->text;
|
||||||
|
|
||||||
|
if ($key->parentid == $id && $currentId != $id && $currentId != $key->value) {
|
||||||
|
$tree[$key->value] = new JObject();
|
||||||
|
$tree[$key->value]->text = $show_text;
|
||||||
|
$tree[$key->value]->value = $key->value;
|
||||||
|
$tree = PhocaDownloadCategory::CategoryTreeOption($data, $tree, $key->value, $show_text . " - ", $currentId );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return($tree);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function filterCategory($query, $active = NULL, $frontend = NULL, $onChange = TRUE, $fullTree = NULL ) {
|
||||||
|
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
|
||||||
|
$form = 'adminForm';
|
||||||
|
if ($frontend == 1) {
|
||||||
|
$form = 'phocadownloadfilesform';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($onChange) {
|
||||||
|
$onChO = 'class="inputbox" size="1" onchange="document.'.$form.'.submit( );"';
|
||||||
|
} else {
|
||||||
|
$onChO = 'class="inputbox" size="1"';
|
||||||
|
}
|
||||||
|
|
||||||
|
$categories[] = JHTML::_('select.option', '0', '- '.JText::_('COM_PHOCADOWNLOAD_SELECT_CATEGORY').' -');
|
||||||
|
$db->setQuery($query);
|
||||||
|
$catData = $db->loadObjectList();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if ($fullTree) {
|
||||||
|
|
||||||
|
// Start - remove in case there is a memory problem
|
||||||
|
$tree = array();
|
||||||
|
$text = '';
|
||||||
|
|
||||||
|
$queryAll = ' SELECT cc.id AS value, cc.title AS text, cc.parent_id as parentid'
|
||||||
|
.' FROM #__phocadownload_categories AS cc'
|
||||||
|
.' ORDER BY cc.ordering';
|
||||||
|
$db->setQuery($queryAll);
|
||||||
|
$catDataAll = $db->loadObjectList();
|
||||||
|
|
||||||
|
$catDataTree = PhocaDownloadCategory::CategoryTreeOption($catDataAll, $tree, 0, $text, -1);
|
||||||
|
|
||||||
|
$catDataTreeRights = array();
|
||||||
|
/*foreach ($catData as $k => $v) {
|
||||||
|
foreach ($catDataTree as $k2 => $v2) {
|
||||||
|
if ($v->value == $v2->value) {
|
||||||
|
$catDataTreeRights[$k]->text = $v2->text;
|
||||||
|
$catDataTreeRights[$k]->value = $v2->value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
foreach ($catDataTree as $k => $v) {
|
||||||
|
foreach ($catData as $k2 => $v2) {
|
||||||
|
if ($v->value == $v2->value) {
|
||||||
|
$catDataTreeRights[$k] = new StdClass();
|
||||||
|
$catDataTreeRights[$k]->text = $v->text;
|
||||||
|
$catDataTreeRights[$k]->value = $v->value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$catDataTree = array();
|
||||||
|
$catDataTree = $catDataTreeRights;
|
||||||
|
// End - remove in case there is a memory problem
|
||||||
|
|
||||||
|
// Uncomment in case there is a memory problem
|
||||||
|
//$catDataTree = $catData;
|
||||||
|
} else {
|
||||||
|
$catDataTree = $catData;
|
||||||
|
}
|
||||||
|
|
||||||
|
$categories = array_merge($categories, $catDataTree );
|
||||||
|
|
||||||
|
$category = JHTML::_('select.genericlist', $categories, 'catid', $onChO, 'value', 'text', $active);
|
||||||
|
|
||||||
|
return $category;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function options($type = 0)
|
||||||
|
{
|
||||||
|
if ($type == 1) {
|
||||||
|
$tree[0] = new JObject();
|
||||||
|
$tree[0]->text = JText::_('COM_PHOCADOWNLOAD_MAIN_CSS');
|
||||||
|
$tree[0]->value = 1;
|
||||||
|
$tree[1] = new JObject();
|
||||||
|
$tree[1]->text = JText::_('COM_PHOCADOWNLOAD_CUSTOM_CSS');
|
||||||
|
$tree[1]->value = 2;
|
||||||
|
return $tree;
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
|
||||||
|
//build the list of categories
|
||||||
|
$query = 'SELECT a.title AS text, a.id AS value, a.parent_id as parentid'
|
||||||
|
. ' FROM #__phocadownload_categories AS a'
|
||||||
|
. ' WHERE a.published = 1'
|
||||||
|
. ' ORDER BY a.ordering';
|
||||||
|
$db->setQuery( $query );
|
||||||
|
$items = $db->loadObjectList();
|
||||||
|
|
||||||
|
$catId = -1;
|
||||||
|
|
||||||
|
$javascript = 'class="inputbox" size="1" onchange="submitform( );"';
|
||||||
|
|
||||||
|
$tree = array();
|
||||||
|
$text = '';
|
||||||
|
$tree = PhocaDownloadCategory::CategoryTreeOption($items, $tree, 0, $text, $catId);
|
||||||
|
|
||||||
|
return $tree;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getCategoryByFile($id = 0) {
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
$query = 'SELECT c.id, c.title, c.alias'
|
||||||
|
. ' FROM #__phocadownload_categories AS c'
|
||||||
|
. ' LEFT JOIN #__phocadownload AS a ON a.catid = c.id'
|
||||||
|
//. ' WHERE c.published = 1'
|
||||||
|
. ' WHERE a.id ='.(int)$id
|
||||||
|
. ' ORDER BY c.id'
|
||||||
|
. ' LIMIT 1';
|
||||||
|
$db->setQuery( $query );
|
||||||
|
$item = $db->loadObject();
|
||||||
|
return $item;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,715 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* @package Joomla 1.5
|
||||||
|
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
*
|
||||||
|
* @component Phoca Component
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Check to ensure this file is included in Joomla!
|
||||||
|
defined('_JEXEC') or die();
|
||||||
|
jimport('joomla.application.component.model');
|
||||||
|
jimport('joomla.filesystem.folder');
|
||||||
|
jimport('joomla.filesystem.file');
|
||||||
|
|
||||||
|
class PhocaDownloadDownload
|
||||||
|
{
|
||||||
|
public static function download($fileData, $downloadId, $currentLink, $type = 0, $multiDownload = false)
|
||||||
|
{
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$params = $app->getParams();
|
||||||
|
$directLink = $fileData['directlink']; // Direct Link 0 or 1
|
||||||
|
$externalLink = $fileData['externallink'];
|
||||||
|
$absOrRelFile = $fileData['file']; // Relative Path or Absolute Path
|
||||||
|
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$status = $user->guest;
|
||||||
|
|
||||||
|
if ($status != 1 && JURI::base() == 'https://www.archlinexp.com/') {
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
|
||||||
|
$query = "SELECT *
|
||||||
|
FROM #__phocadownload p
|
||||||
|
WHERE p.id = $downloadId";
|
||||||
|
|
||||||
|
$db->setQuery($query);
|
||||||
|
$downloadedFile = $db->loadObject();
|
||||||
|
|
||||||
|
if ($downloadedFile->version == 'trial') {
|
||||||
|
$query = "SELECT * FROM cl_hlusers.users
|
||||||
|
WHERE nUserID = $user->nUserID";
|
||||||
|
|
||||||
|
$db->setQuery($query);
|
||||||
|
$crmUser = $db->loadObject();
|
||||||
|
|
||||||
|
if (!empty($crmUser)) {
|
||||||
|
$query = "SELECT * FROM cl_hlusers.u_emails
|
||||||
|
WHERE nUserID = $user->nUserID AND newsletter = 1";
|
||||||
|
|
||||||
|
$db->setQuery($query);
|
||||||
|
$u_email = $db->loadObject();
|
||||||
|
|
||||||
|
if (!empty($u_email) && ($u_email->trial_download_date == '' || $u_email->trial_download_date == null)) {
|
||||||
|
$url_1 = 'https://www.archlinexp.com/maintenance/followedlinks.php?id=' . base64_encode('?email=' . $u_email->email . '&alias=trial-download');
|
||||||
|
$url_2 = 'https://www.archlinexp.com/maintenance/followedlinks.php?id=' . base64_encode('?email=' . $u_email->email . '&alias=trial-download-[2]');
|
||||||
|
$date = date('Y-m-d');
|
||||||
|
|
||||||
|
/*$body = "<a href='https://www.archlinexp.com/'>
|
||||||
|
<img src='https://www.archlinexp.com/images/2021/11/16/al_logo_trial_download.png' style='margin-left: 5%;' />
|
||||||
|
</a>
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
<div style='font-family: Raleway, sans-serif; text-align: center; margin: 0px 60px 0px 60px; font-size: 16px;'>
|
||||||
|
<img src='https://www.archlinexp.com/images/2021/11/16/00ce025d7b6314a82b3ef2c35db5193af596da51390b0b76f6fa3ee55567c326.png'
|
||||||
|
style='width: 75%; display: block; margin-left: auto; margin-right: auto;' />
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
<h2>Congratulations!</h2>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
ARCHLine.XP was designed with You in our mind, and we want you to get the most out of this FREE trial.
|
||||||
|
You can choose two ways of working with TRIAL version:
|
||||||
|
a. Anonym user 30 day TRIAL. If you wish to try the software as Anonymous User without an ARCHLine.XP account choose anonymous logon.
|
||||||
|
Unauthenticated (anonymous) users may have some limits using TRIAL version.
|
||||||
|
b. If you need more time, create an account, sign in and the trial period will be 10 days longer (bonus time 30 + 10 days ).
|
||||||
|
If you have already registered an account use your username and password.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<a href='{$url_1}' style='background-color: #e47d25; font-size: 20px; color: #000000; font-weight: bold; text-decoration: none; padding: 10px 10px; border-radius: 5px; display: inline-block; mso-padding-alt: 0;'>
|
||||||
|
<i style='letter-spacing: 20px; mso-font-width: -90%; mso-text-raise: 20pt;'> </i>
|
||||||
|
<span style='mso-text-raise: 10pt;'>Start Exploring</span>
|
||||||
|
<i style='letter-spacing: 20px; mso-font-width: -90%;'> </i>
|
||||||
|
</a>
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<b>Are you an interior designer?</b> Check out this 2 minute video to enjoy the work of our next generation designers.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<a href='{$url_2}' style='background-color: #e47d25; font-size: 20px; color: #000000; font-weight: bold; text-decoration: none; padding: 10px 10px; border-radius: 5px; display: inline-block; mso-padding-alt: 0;'>
|
||||||
|
<i style='letter-spacing: 20px; mso-font-width: -90%; mso-text-raise: 20pt;'> </i>
|
||||||
|
<span style='mso-text-raise: 10pt;'>Start Exploring</span>
|
||||||
|
<i style='letter-spacing: 20px; mso-font-width: -90%;'> </i>
|
||||||
|
</a>
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
<a href='https://www.archlinexp.com/leiratkozas/" . $u_email->email . "'>Unsubscribe</a>
|
||||||
|
</div>";*/
|
||||||
|
|
||||||
|
$db->setQuery("SELECT * FROM #__content c WHERE c.id = 972");
|
||||||
|
$content = $db->loadObject();
|
||||||
|
$body = str_replace('[EMAIL]', $u_email->email, $content->introtext);
|
||||||
|
|
||||||
|
$config = JFactory::getConfig();
|
||||||
|
$mailer = JFactory::getMailer();
|
||||||
|
|
||||||
|
$mailer->isHTML(true);
|
||||||
|
$mailer->setSender(array($config->get('mailfrom'), $config->get('fromname')));
|
||||||
|
$mailer->addRecipient($u_email->email);
|
||||||
|
$mailer->setSubject('Welcome to ARCHLine.XP!');
|
||||||
|
$mailer->setBody($body);
|
||||||
|
$mailer->Send();
|
||||||
|
|
||||||
|
$db->setQuery("UPDATE cl_hlusers.u_emails SET trial_download_date = '$date' WHERE u_emails_id = $u_email->u_emails_id LIMIT 1;");
|
||||||
|
$db->execute();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Type = 1 - Token - unique download link - cannot be direct
|
||||||
|
if ($type == 1) {
|
||||||
|
$directLink = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// NO FILES FOUND (abs file)
|
||||||
|
$error = false;
|
||||||
|
$error = preg_match("/COM_PHOCADOWNLOAD_ERROR/i", $absOrRelFile);
|
||||||
|
|
||||||
|
if ($multiDownload) {
|
||||||
|
$txtMsg = '';
|
||||||
|
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
|
||||||
|
$query = $db->getQuery(true);
|
||||||
|
|
||||||
|
$query->select(array('p.id'));
|
||||||
|
$query->from($db->quoteName('www_archline_hu.jml_phocadownload', 'p'));
|
||||||
|
$query->where($db->quoteName('p.catid') . ' = ' . $db->quote((int)$downloadId));
|
||||||
|
|
||||||
|
$db->setQuery($query);
|
||||||
|
|
||||||
|
$files = $db->loadObjectList();
|
||||||
|
$last_key = end(array_keys($files));
|
||||||
|
foreach ($files as $key => $file) {
|
||||||
|
$txtMsg .= "https://www.archline.hu/index.php?option=com_phocadownload&view=category&download=" . $file->id . "&id=&Itemid=730";
|
||||||
|
|
||||||
|
if ($key != $last_key)
|
||||||
|
$txtMsg .= "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
$downloadFile = "downloadAll.txt";
|
||||||
|
$txt = fopen($downloadFile, "w") or die("Unable to open file!");
|
||||||
|
fwrite($txt, $txtMsg);
|
||||||
|
fclose($txt);
|
||||||
|
|
||||||
|
header('Content-Description: File Transfer');
|
||||||
|
header('Content-Disposition: attachment; filename=' . basename($downloadFile));
|
||||||
|
header('Expires: 0');
|
||||||
|
header('Cache-Control: must-revalidate');
|
||||||
|
header('Pragma: public');
|
||||||
|
header('Content-Length: ' . filesize($downloadFile));
|
||||||
|
header("Content-Type: text/plain");
|
||||||
|
readfile($downloadFile);
|
||||||
|
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($error) {
|
||||||
|
$msg = JText::_('COM_PHOCADOWNLOAD_ERROR_WHILE_DOWNLOADING_FILE') . ' ' . JText::_($absOrRelFile);
|
||||||
|
$app->redirect(JRoute::_($currentLink), $msg);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Get extensions
|
||||||
|
$extension = JFile::getExt(strtolower($absOrRelFile));
|
||||||
|
|
||||||
|
$aft = $params->get('allowed_file_types_download', PhocaDownloadSettings::getDefaultAllowedMimeTypesDownload());
|
||||||
|
$dft = $params->get('disallowed_file_types_download', '');
|
||||||
|
|
||||||
|
// Get Mime from params ( ext --> mime)
|
||||||
|
$allowedMimeType = PhocaDownloadFile::getMimeType($extension, $aft);
|
||||||
|
$disallowedMimeType = PhocaDownloadFile::getMimeType($extension, $dft);
|
||||||
|
|
||||||
|
// NO MIME FOUND
|
||||||
|
$errorAllowed = false; // !!! IF YES - Disallow Downloading
|
||||||
|
$errorDisallowed = false; // !!! IF YES - Allow Downloading
|
||||||
|
|
||||||
|
$errorAllowed = preg_match("/PhocaError/i", $allowedMimeType);
|
||||||
|
$errorDisallowed = preg_match("/PhocaError/i", $disallowedMimeType);
|
||||||
|
|
||||||
|
$ignoreDownloadCheck = $params->get('ignore_file_types_check', 2);
|
||||||
|
if ($ignoreDownloadCheck == 3 || $ignoreDownloadCheck == 4 || $ignoreDownloadCheck == 5) {
|
||||||
|
$errorAllowed = false;
|
||||||
|
$errorDisallowed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($extension == 'environment' || $extension == 'skp' || $extension == 'dxf') {
|
||||||
|
$errorAllowed = false;
|
||||||
|
$errorDisallowed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($errorAllowed) {
|
||||||
|
$msg = JText::_('COM_PHOCADOWNLOAD_WARNFILETYPE_DOWNLOAD');
|
||||||
|
$app->redirect(JRoute::_($currentLink), $msg);
|
||||||
|
} else if (!$errorDisallowed) {
|
||||||
|
$msg = JText::_('COM_PHOCADOWNLOAD_WARNFILETYPE_DISALLOWED_DOWNLOAD');
|
||||||
|
$app->redirect(JRoute::_($currentLink), $msg);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if ($directLink == 1) {
|
||||||
|
|
||||||
|
// Direct Link on the same server
|
||||||
|
$fileWithoutPath = basename($absOrRelFile);
|
||||||
|
$addHit = self::hit($downloadId);
|
||||||
|
if ($type == 1) {
|
||||||
|
self::hitToken($downloadId);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((int)$params->get('send_mail_download', 0) > 0) {
|
||||||
|
PhocaDownloadMail::sendMail((int)$params->get('send_mail_download', 0), $fileWithoutPath, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// USER Statistics
|
||||||
|
if ((int)$params->get('enable_user_statistics', 1) == 1) {
|
||||||
|
$addUserStat = PhocaDownloadStat::createUserStatEntry($downloadId);
|
||||||
|
}
|
||||||
|
|
||||||
|
PhocaDownloadLog::log($downloadId, 1);
|
||||||
|
|
||||||
|
if ($extension == 'dxf') {
|
||||||
|
$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]";
|
||||||
|
|
||||||
|
header('Content-Type: application/octet-stream');
|
||||||
|
header("Content-Transfer-Encoding: Binary");
|
||||||
|
header("Content-disposition: attachment; filename=\"" . basename($actual_link . $absOrRelFile) . "\"");
|
||||||
|
readfile($actual_link . $absOrRelFile);
|
||||||
|
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$app->redirect($absOrRelFile);
|
||||||
|
exit;
|
||||||
|
} else if ($directLink == 0 && $externalLink != '') {
|
||||||
|
|
||||||
|
// External Link but with redirect
|
||||||
|
// In case there is directLink the external Link does not go this way but directly to the external URL
|
||||||
|
$addHit = self::hit($downloadId);
|
||||||
|
if ($type == 1) {
|
||||||
|
self::hitToken($downloadId);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((int)$params->get('send_mail_download', 0) > 0) {
|
||||||
|
PhocaDownloadMail::sendMail((int)$params->get('send_mail_download', 0), $externalLink, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// USER Statistics
|
||||||
|
if ((int)$params->get('enable_user_statistics', 1) == 1) {
|
||||||
|
$addUserStat = PhocaDownloadStat::createUserStatEntry($downloadId);
|
||||||
|
}
|
||||||
|
|
||||||
|
PhocaDownloadLog::log($downloadId, 1);
|
||||||
|
|
||||||
|
|
||||||
|
$app->redirect($externalLink);
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Clears file status cache
|
||||||
|
clearstatcache();
|
||||||
|
|
||||||
|
$fileWithoutPath = basename($absOrRelFile);
|
||||||
|
$fileSize = filesize($absOrRelFile);
|
||||||
|
$mimeType = '';
|
||||||
|
$mimeType = $allowedMimeType;
|
||||||
|
|
||||||
|
// HIT Statistics
|
||||||
|
$addHit = self::hit($downloadId);
|
||||||
|
if ($type == 1) {
|
||||||
|
self::hitToken($downloadId);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((int)$params->get('send_mail_download', 0) > 0) {
|
||||||
|
PhocaDownloadMail::sendMail((int)$params->get('send_mail_download', 0), $fileWithoutPath, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// USER Statistics
|
||||||
|
if ((int)$params->get('enable_user_statistics', 1) == 1) {
|
||||||
|
$addUserStat = PhocaDownloadStat::createUserStatEntry($downloadId);
|
||||||
|
}
|
||||||
|
|
||||||
|
PhocaDownloadLog::log($downloadId, 1);
|
||||||
|
|
||||||
|
|
||||||
|
if ($fileSize == 0) {
|
||||||
|
die(JText::_('COM_PHOCADOWNLOAD_FILE_SIZE_EMPTY'));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clean the output buffer
|
||||||
|
ob_end_clean();
|
||||||
|
|
||||||
|
// test for protocol and set the appropriate headers
|
||||||
|
jimport('joomla.environment.uri');
|
||||||
|
$_tmp_uri = JURI::getInstance(JURI::current());
|
||||||
|
$_tmp_protocol = $_tmp_uri->getScheme();
|
||||||
|
if ($_tmp_protocol == "https") {
|
||||||
|
// SSL Support
|
||||||
|
header('Cache-Control: private, max-age=0, must-revalidate, no-store');
|
||||||
|
} else {
|
||||||
|
header("Cache-Control: public, must-revalidate");
|
||||||
|
header('Cache-Control: pre-check=0, post-check=0, max-age=0');
|
||||||
|
header("Pragma: no-cache");
|
||||||
|
header("Expires: 0");
|
||||||
|
} /* end if protocol https */
|
||||||
|
header("Content-Description: File Transfer");
|
||||||
|
header("Expires: Sat, 30 Dec 1990 07:07:07 GMT");
|
||||||
|
header("Accept-Ranges: bytes");
|
||||||
|
|
||||||
|
|
||||||
|
// HTTP Range
|
||||||
|
/* $httpRange = 0;
|
||||||
|
if(isset($_SERVER['HTTP_RANGE'])) {
|
||||||
|
list($a, $httpRange) = explode('=', $_SERVER['HTTP_RANGE']);
|
||||||
|
str_replace($httpRange, '-', $httpRange);
|
||||||
|
$newFileSize = $fileSize - 1;
|
||||||
|
$newFileSizeHR = $fileSize - $httpRange;
|
||||||
|
header("HTTP/1.1 206 Partial Content");
|
||||||
|
header("Content-Length: ".(string)$newFileSizeHR);
|
||||||
|
header("Content-Range: bytes ".$httpRange . $newFileSize .'/'. $fileSize);
|
||||||
|
} else {
|
||||||
|
$newFileSize = $fileSize - 1;
|
||||||
|
header("Content-Length: ".(string)$fileSize);
|
||||||
|
header("Content-Range: bytes 0-".$newFileSize . '/'.$fileSize);
|
||||||
|
}
|
||||||
|
header("Content-Type: " . (string)$mimeType);
|
||||||
|
header('Content-Disposition: attachment; filename="'.$fileWithoutPath.'"');
|
||||||
|
header("Content-Transfer-Encoding: binary\n");*/
|
||||||
|
|
||||||
|
// Modified by Rene
|
||||||
|
// HTTP Range - see RFC2616 for more informations (http://www.ietf.org/rfc/rfc2616.txt)
|
||||||
|
$httpRange = 0;
|
||||||
|
$newFileSize = $fileSize - 1;
|
||||||
|
// Default values! Will be overridden if a valid range header field was detected!
|
||||||
|
$resultLenght = (string)$fileSize;
|
||||||
|
$resultRange = "0-" . $newFileSize;
|
||||||
|
// We support requests for a single range only.
|
||||||
|
// So we check if we have a range field. If yes ensure that it is a valid one.
|
||||||
|
// If it is not valid we ignore it and sending the whole file.
|
||||||
|
if (isset($_SERVER['HTTP_RANGE']) && preg_match('%^bytes=\d*\-\d*$%', $_SERVER['HTTP_RANGE'])) {
|
||||||
|
// Let's take the right side
|
||||||
|
list($a, $httpRange) = explode('=', $_SERVER['HTTP_RANGE']);
|
||||||
|
// and get the two values (as strings!)
|
||||||
|
$httpRange = explode('-', $httpRange);
|
||||||
|
// Check if we have values! If not we have nothing to do!
|
||||||
|
if (!empty($httpRange[0]) || !empty($httpRange[1])) {
|
||||||
|
// We need the new content length ...
|
||||||
|
$resultLenght = $fileSize - $httpRange[0] - $httpRange[1];
|
||||||
|
// ... and we can add the 206 Status.
|
||||||
|
header("HTTP/1.1 206 Partial Content");
|
||||||
|
// Now we need the content-range, so we have to build it depending on the given range!
|
||||||
|
// ex.: -500 -> the last 500 bytes
|
||||||
|
if (empty($httpRange[0]))
|
||||||
|
$resultRange = $resultLenght . '-' . $newFileSize;
|
||||||
|
// ex.: 500- -> from 500 bytes to filesize
|
||||||
|
elseif (empty($httpRange[1]))
|
||||||
|
$resultRange = $httpRange[0] . '-' . $newFileSize;
|
||||||
|
// ex.: 500-1000 -> from 500 to 1000 bytes
|
||||||
|
else
|
||||||
|
$resultRange = $httpRange[0] . '-' . $httpRange[1];
|
||||||
|
//header("Content-Range: bytes ".$httpRange . $newFileSize .'/'. $fileSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
header("Content-Length: " . $resultLenght);
|
||||||
|
header("Content-Range: bytes " . $resultRange . '/' . $fileSize);
|
||||||
|
header("Content-Type: " . (string)$mimeType);
|
||||||
|
header('Content-Disposition: attachment; filename="' . $fileWithoutPath . '"');
|
||||||
|
header("Content-Transfer-Encoding: binary\n");
|
||||||
|
|
||||||
|
// TEST TEMP SOLUTION - makes problems on somve server, @ added to prevent from warning
|
||||||
|
// Do problems on some servers
|
||||||
|
//@ob_end_clean();
|
||||||
|
|
||||||
|
//@readfile($absOrRelFile);
|
||||||
|
|
||||||
|
// Try to deliver in chunks
|
||||||
|
@set_time_limit(0);
|
||||||
|
$fp = @fopen($absOrRelFile, 'rb');
|
||||||
|
if ($fp !== false) {
|
||||||
|
while (!feof($fp)) {
|
||||||
|
echo fread($fp, 8192);
|
||||||
|
}
|
||||||
|
fclose($fp);
|
||||||
|
} else {
|
||||||
|
@readfile($absOrRelFile);
|
||||||
|
}
|
||||||
|
flush();
|
||||||
|
exit;
|
||||||
|
|
||||||
|
/*
|
||||||
|
http://www.phoca.cz/forum/viewtopic.php?f=31&t=11811
|
||||||
|
|
||||||
|
$fp = @fopen($absOrRelFile, 'rb');
|
||||||
|
// HTTP Range - see RFC2616 for more informations (http://www.ietf.org/rfc/rfc2616.txt)
|
||||||
|
$newFileSize = $fileSize - 1;
|
||||||
|
// Default values! Will be overridden if a valid range header field was detected!
|
||||||
|
$rangeStart = 0;
|
||||||
|
$rangeEnd = 0;
|
||||||
|
$resultLength = $fileSize;
|
||||||
|
// We support requests for a single range only.
|
||||||
|
// So we check if we have a range field. If yes ensure that it is a valid one.
|
||||||
|
// If it is not valid we ignore it and sending the whole file.
|
||||||
|
if ($fp && isset($_SERVER['HTTP_RANGE']) && preg_match('%^bytes=\d*\-\d*$%', $_SERVER['HTTP_RANGE'])) {
|
||||||
|
// Let's take the right side
|
||||||
|
list($a, $httpRange) = explode('=', $_SERVER['HTTP_RANGE']);
|
||||||
|
// and get the two values (as strings!)
|
||||||
|
$httpRange = explode('-', $httpRange);
|
||||||
|
// Check if we have values! If not we have nothing to do!
|
||||||
|
if (sizeof($httpRange) == 2) {
|
||||||
|
// Explictly convert to int
|
||||||
|
$rangeStart = intval($httpRange[0]);
|
||||||
|
$rangeEnd = intval($httpRange[1]); // Allowed to be empty == 0
|
||||||
|
if (($rangeStart || $rangeEnd) // something actually set?
|
||||||
|
&& $rangeStart < $fileSize // must be smaller
|
||||||
|
&& $rangeEnd < $fileSize // must be smaller
|
||||||
|
&& (!$rangeEnd || $rangeEnd > $rangeStart) // end > start, if end is set
|
||||||
|
) {
|
||||||
|
header("HTTP/1.1 206 Partial Content");
|
||||||
|
if (!$rangeEnd) {
|
||||||
|
$resultLength = $fileSize - $rangeStart;
|
||||||
|
$range = $rangeStart . "-" . ($fileSize - 1) . "/" . $fileSize;
|
||||||
|
} else {
|
||||||
|
$resultLength = ($rangeEnd - $rangeStart 1);
|
||||||
|
$range = $rangeStart . "-" . $rangeEnd . "/" . $fileSize;
|
||||||
|
}
|
||||||
|
header("Content-Range: bytes " . $range);
|
||||||
|
} else {
|
||||||
|
// Didn't validate: kill
|
||||||
|
$rangeStart = 0;
|
||||||
|
$rangeEnd = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
header("Content-Length: ". $resultLength);
|
||||||
|
header("Content-Type: " . (string)$mimeType);
|
||||||
|
header('Content-Disposition: attachment; filename="'.$fileWithoutPath.'"');
|
||||||
|
header("Content-Transfer-Encoding: binary\n");
|
||||||
|
@@ -211,13 +198,25 @@ class PhocaDownloadAccessFront
|
||||||
|
|
||||||
|
// Try to deliver in chunks
|
||||||
|
@set_time_limit(0);
|
||||||
|
if ($fp !== false) {
|
||||||
|
if ($rangeStart) {
|
||||||
|
// Need to pass only part of the file, starting at $rangeStart
|
||||||
|
fseek($fp, $rangeStart, SEEK_SET);
|
||||||
|
}
|
||||||
|
// If $rangeEnd is open ended (0, whole file from $rangeStart) try fpassthru,
|
||||||
|
// else send in small chunks
|
||||||
|
if ($rangeEnd || @!fpassthru($fp)) {
|
||||||
|
while ($resultLength > 0 && !feof($fp)) {
|
||||||
|
// 4 * 1460 (default MSS with ethernet 1500 MTU)
|
||||||
|
// This is optimized for network packets, not disk access
|
||||||
|
$bytes = min(5840, $resultLength);
|
||||||
|
echo fread($fp, $bytes);
|
||||||
|
$resultLength = $resultLength - $bytes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fclose($fp);
|
||||||
|
} else {
|
||||||
|
// Ranges are disabled at this point and were never set up
|
||||||
|
@readfile($absOrRelFile);
|
||||||
|
}
|
||||||
|
flush();
|
||||||
|
exit;
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getDownloadData($id, $return, $type = 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
$outcome = array();
|
||||||
|
$wheres = array();
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$params = $app->getParams();
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$redirectUrl = urlencode(base64_encode($return));
|
||||||
|
$returnUrl = 'index.php?option=com_users&view=login&return=' . $redirectUrl;
|
||||||
|
|
||||||
|
$userLevels = implode(',', $user->getAuthorisedViewLevels());
|
||||||
|
|
||||||
|
$limitEnabled = $params->get('user_files_max_count_download', 0);
|
||||||
|
if ((int)$limitEnabled > 0) {
|
||||||
|
if ((int)$user->id < 1) {
|
||||||
|
$app->redirect(JRoute::_($returnUrl, false), JText::_("COM_PHOCADOWNLOAD_NOT_LOGGED_IN_USERS_NOT_ALLOWED_DOWNLOAD"));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$userFileCount = PhocaDownloadStat::getCountFilePerUser($id);
|
||||||
|
(int)$userFileCount++; // Because we need to count this attempt too.
|
||||||
|
if ((int)$userFileCount > (int)$limitEnabled) {
|
||||||
|
$app->redirect(JRoute::_($returnUrl, false), JText::_("COM_PHOCADOWNLOAD_MAX_LIMIT_DOWNLOAD_PER_FILE_REACHED"));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$pQ = $params->get('enable_plugin_query', 0);
|
||||||
|
|
||||||
|
$wheres[] = " c.id = " . (int)$id;
|
||||||
|
$wheres[] = " c.published = 1";
|
||||||
|
$wheres[] = " c.approved = 1";
|
||||||
|
$wheres[] = " c.catid = cc.id";
|
||||||
|
|
||||||
|
if ($type == 1) {
|
||||||
|
// Unique download link does not have any access
|
||||||
|
$rightDisplay = 1;
|
||||||
|
} else {
|
||||||
|
$wheres[] = " cc.access IN (" . $userLevels . ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Active
|
||||||
|
$jnow = JFactory::getDate();
|
||||||
|
$now = $jnow->toSql();
|
||||||
|
$nullDate = $db->getNullDate();
|
||||||
|
$wheres[] = ' ( c.publish_up = ' . $db->Quote($nullDate) . ' OR c.publish_up <= ' . $db->Quote($now) . ' )';
|
||||||
|
$wheres[] = ' ( c.publish_down = ' . $db->Quote($nullDate) . ' OR c.publish_down >= ' . $db->Quote($now) . ' )';
|
||||||
|
|
||||||
|
if ($pQ == 1) {
|
||||||
|
// GWE MOD - to allow for access restrictions
|
||||||
|
JPluginHelper::importPlugin("phoca");
|
||||||
|
$dispatcher = &JDispatcher::getInstance();
|
||||||
|
$joins = array();
|
||||||
|
$results = $dispatcher->trigger('onGetDownload', array(&$wheres, &$joins, $id, $paramsC));
|
||||||
|
// END GWE MOD
|
||||||
|
}
|
||||||
|
|
||||||
|
/*$query = " SELECT c.filename, c.directlink, c.access"
|
||||||
|
." FROM #__phocadownload AS c"
|
||||||
|
. ($pQ == 1 ? ((count($joins)>0?( " LEFT JOIN " .implode( " LEFT JOIN ", $joins )):"")):"") // GWE MOD
|
||||||
|
. " WHERE " . implode( " AND ", $wheres )
|
||||||
|
. " ORDER BY c.ordering";*/
|
||||||
|
|
||||||
|
|
||||||
|
$query = ' SELECT c.catid, c.filename, c.directlink, c.link_external, c.access, c.confirm_license, c.metakey, c.metadesc, cc.access as cataccess, cc.accessuserid as cataccessuserid, c.tokenhits '
|
||||||
|
. ' FROM #__phocadownload AS c, #__phocadownload_categories AS cc '
|
||||||
|
. ($pQ == 1 ? ((count($joins) > 0 ? (' LEFT JOIN ' . implode(' LEFT JOIN ', $joins)) : '')) : '') // GWE MOD
|
||||||
|
. ' WHERE ' . implode(' AND ', $wheres)
|
||||||
|
. ' ORDER BY c.ordering';
|
||||||
|
|
||||||
|
$db->setQuery($query, 0, 1);
|
||||||
|
$filename = $db->loadObjectList();
|
||||||
|
|
||||||
|
$limitTokenEnabled = $params->get('token_files_max_count_download', 0);
|
||||||
|
if ((int)$limitTokenEnabled > 0) {
|
||||||
|
if (isset($filename[0]->tokenhits)) {
|
||||||
|
$tokenFileCount = $filename[0]->tokenhits;
|
||||||
|
(int)$tokenFileCount++; // Because we need to count this attempt too.
|
||||||
|
if ((int)$tokenFileCount > (int)$limitTokenEnabled) {
|
||||||
|
$app->redirect(JRoute::_(htmlspecialchars($return)), JText::_("COM_PHOCADOWNLOAD_MAX_LIMIT_DOWNLOAD_TOKEN_REACHED"));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//OSE Modified Start;
|
||||||
|
if (!empty($filename[0])) {
|
||||||
|
phocadownloadimport('phocadownload.utils.external');
|
||||||
|
PhocaDownloadExternal::checkOSE($filename[0]);
|
||||||
|
}
|
||||||
|
//OSE Modified End;
|
||||||
|
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - -
|
||||||
|
// USER RIGHT - Access of categories (if file is included in some not accessed category) - - - - -
|
||||||
|
// ACCESS is handled in SQL query, ACCESS USER ID is handled here (specific users)
|
||||||
|
|
||||||
|
$rightDisplay = 0;
|
||||||
|
if ($type == 1) {
|
||||||
|
// Unique download link does not have any access
|
||||||
|
$rightDisplay = 1;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (!empty($filename[0])) {
|
||||||
|
$rightDisplay = PhocaDownloadAccess::getUserRight('accessuserid', $filename[0]->cataccessuserid, $filename[0]->cataccess, $user->getAuthorisedViewLevels(), $user->get('id', 0), 0);
|
||||||
|
}
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
if ($rightDisplay == 0) {
|
||||||
|
$app->redirect(JRoute::_($returnUrl, false), JText::_("COM_PHOCADOWNLOAD_NO_RIGHTS_ACCESS_CATEGORY_FILE"));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (empty($filename)) {
|
||||||
|
$outcome['file'] = "COM_PHOCADOWNLOAD_ERROR_NO_DB_RESULT";
|
||||||
|
$outcome['directlink'] = 0;
|
||||||
|
$outcome['externallink'] = 0;
|
||||||
|
return $outcome;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($type == 1) {
|
||||||
|
// Unique download link
|
||||||
|
} else {
|
||||||
|
if (isset($filename[0]->access)) {
|
||||||
|
if (!in_array($filename[0]->access, $user->getAuthorisedViewLevels())) {
|
||||||
|
$app->redirect(JRoute::_($returnUrl, false), JText::_('COM_PHOCADOWNLOAD_PLEASE_LOGIN_DOWNLOAD_FILE'));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$outcome['file'] = "COM_PHOCADOWNLOAD_ERROR_NO_DB_RESULT";
|
||||||
|
$outcome['directlink'] = 0;
|
||||||
|
$outcome['externallink'] = 0;
|
||||||
|
return $outcome;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
|
||||||
|
$filenameT = $filename[0]->filename;
|
||||||
|
$directlinkT = $filename[0]->directlink;
|
||||||
|
$linkExternalT = $filename[0]->link_external;
|
||||||
|
|
||||||
|
// Unique Download Link
|
||||||
|
if ($type == 1) {
|
||||||
|
$directlinkT = 0; // Unique Download Link cannot work with direct link
|
||||||
|
}
|
||||||
|
|
||||||
|
$filePath = PhocaDownloadPath::getPathSet('file');
|
||||||
|
|
||||||
|
if ($filenameT != '') {
|
||||||
|
|
||||||
|
// Important - you cannot use direct link if you have selected absolute path
|
||||||
|
// Absolute Path defined by user
|
||||||
|
$absolutePath = $params->get('absolute_path', '');
|
||||||
|
if ($absolutePath != '') {
|
||||||
|
$directlinkT = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($directlinkT == 1) {
|
||||||
|
$relFile = JURI::base(true) . '/' . $params->get('download_folder', 'phocadownload') . '/' . $filenameT;
|
||||||
|
$outcome['file'] = $relFile;
|
||||||
|
$outcome['directlink'] = $directlinkT;
|
||||||
|
$outcome['externallink'] = $linkExternalT;
|
||||||
|
return $outcome;
|
||||||
|
} else if ($directlinkT == 0 && $linkExternalT != '') {
|
||||||
|
$relFile = JURI::base(true) . '/' . $params->get('download_folder', 'phocadownload') . '/' . $filenameT;
|
||||||
|
$outcome['file'] = $relFile;
|
||||||
|
$outcome['directlink'] = $directlinkT;
|
||||||
|
$outcome['externallink'] = $linkExternalT;
|
||||||
|
return $outcome;
|
||||||
|
} else {
|
||||||
|
$absFile = str_replace('/', DS, JPath::clean($filePath['orig_abs_ds'] . $filenameT));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (JFile::exists($absFile)) {
|
||||||
|
$outcome['file'] = $absFile;
|
||||||
|
$outcome['directlink'] = $directlinkT;
|
||||||
|
$outcome['externallink'] = $linkExternalT;
|
||||||
|
return $outcome;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$outcome['file'] = "COM_PHOCADOWNLOAD_ERROR_NO_ABS_FILE";
|
||||||
|
$outcome['directlink'] = 0;
|
||||||
|
$outcome['externallink'] = $linkExternalT;
|
||||||
|
return $outcome;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$outcome['file'] = "COM_PHOCADOWNLOAD_ERROR_NO_DB_FILE";
|
||||||
|
$outcome['directlink'] = 0;
|
||||||
|
$outcome['externallink'] = $linkExternalT;
|
||||||
|
return $outcome;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static function hit($id)
|
||||||
|
{
|
||||||
|
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$table = JTable::getInstance('PhocaDownload', 'Table');
|
||||||
|
$table->hit($id);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static function hitToken($id)
|
||||||
|
{
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
$query = $db->getQuery(true)
|
||||||
|
->update('#__phocadownload')
|
||||||
|
->set($db->quoteName('tokenhits') . ' = (' . $db->quoteName('tokenhits') . ' + 1)')
|
||||||
|
->where('id = ' . $db->quote((int)$id));
|
||||||
|
$db->setQuery($query);
|
||||||
|
|
||||||
|
$db->execute();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,423 @@
|
|||||||
|
<?php
|
||||||
|
/* @package Joomla
|
||||||
|
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
* @extension Phoca Extension
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||||
|
jimport( 'joomla.filesystem.folder' );
|
||||||
|
jimport( 'joomla.filesystem.file' );
|
||||||
|
|
||||||
|
class PhocaDownloadFile
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* http://aidanlister.com/repos/v/function.size_readable.php
|
||||||
|
*/
|
||||||
|
public static function getFileSizeReadable ($size, $retstring = null, $onlyMB = false) {
|
||||||
|
|
||||||
|
if ($onlyMB) {
|
||||||
|
$sizes = array('B', 'kB', 'MB');
|
||||||
|
} else {
|
||||||
|
$sizes = array('B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($retstring === null) { $retstring = '%01.2f %s'; }
|
||||||
|
$lastsizestring = end($sizes);
|
||||||
|
|
||||||
|
foreach ($sizes as $sizestring) {
|
||||||
|
if ($size < 1024) { break; }
|
||||||
|
if ($sizestring != $lastsizestring) { $size /= 1024; }
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($sizestring == $sizes[0]) { $retstring = '%01d %s'; } // Bytes aren't normally fractional
|
||||||
|
return sprintf($retstring, $size, $sizestring);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getMimeTypeIcon($filename, $size = 16, $outcome = 0) {
|
||||||
|
$ext = JFile::getExt($filename);
|
||||||
|
switch(strtolower($ext)) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case 'html':
|
||||||
|
case 'htm':
|
||||||
|
$icon = 'html';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'c':
|
||||||
|
case 'js':
|
||||||
|
case 'py':
|
||||||
|
case 'rp':
|
||||||
|
$icon = 'source';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'xml':
|
||||||
|
$icon = 'xml';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'odp':
|
||||||
|
case 'ppt':
|
||||||
|
case 'pps':
|
||||||
|
case 'ppsx':
|
||||||
|
case 'pptx':
|
||||||
|
case 'pptm':
|
||||||
|
case 'ppsm':
|
||||||
|
$icon = 'presentation';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'ods':
|
||||||
|
case 'xls':
|
||||||
|
case 'xlsx':
|
||||||
|
$icon = 'spreadsheet';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'odt':
|
||||||
|
case 'doc':
|
||||||
|
case 'docx':
|
||||||
|
$icon = 'document';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'php':
|
||||||
|
$icon = 'php';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'png':
|
||||||
|
case 'jpg':
|
||||||
|
case 'jpeg':
|
||||||
|
case 'gif':
|
||||||
|
case 'bmp':
|
||||||
|
$icon = 'img';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'jar':
|
||||||
|
$icon = 'jar';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'pdf':
|
||||||
|
$icon = 'pdf';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'sql':
|
||||||
|
$icon = 'sql';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'svg':
|
||||||
|
case 'ai':
|
||||||
|
case 'cdr':
|
||||||
|
$icon = 'drawing';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'txt':
|
||||||
|
case 'ini':
|
||||||
|
$icon = 'txt';
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
case '7z':
|
||||||
|
$icon = '7zip';
|
||||||
|
break;
|
||||||
|
case 'gz':
|
||||||
|
$icon = 'gzip';
|
||||||
|
break;
|
||||||
|
case 'rar':
|
||||||
|
$icon = 'rar';
|
||||||
|
break;
|
||||||
|
case 'tar':
|
||||||
|
$icon = 'tar';
|
||||||
|
break;
|
||||||
|
case 'zip':
|
||||||
|
case 'bzip':
|
||||||
|
$icon = 'zip';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'flv':
|
||||||
|
case 'avi':
|
||||||
|
case 'mp4':
|
||||||
|
case 'mpeg':
|
||||||
|
case 'ogv':
|
||||||
|
$icon = 'video';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'ogg':
|
||||||
|
case 'mp3':
|
||||||
|
case 'wav':
|
||||||
|
case 'mid':
|
||||||
|
$icon = 'audio';
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
$icon = 'empty';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($outcome == 1) {
|
||||||
|
return 'style="background: url(\''.JURI::root(). 'media/com_phocadownload/images/mime/'.(int)$size.'/icon-'. htmlspecialchars($icon).'.png\') 0 center no-repeat;"';
|
||||||
|
} else {
|
||||||
|
return '<img src="'.JURI::root(). 'media/com_phocadownload/images/mime/'.(int)$size.'/icon-'. htmlspecialchars($icon). '.png'.'" alt="" />';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $mime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function existsCss($file, $type) {
|
||||||
|
$path = self::getCSSPath($type);
|
||||||
|
if (file_exists($path.$file) && $file != '') {
|
||||||
|
return $path.$file;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getCSSPath($type, $rel = 0) {
|
||||||
|
$paths = PhocaDownloadPath::getPathMedia();
|
||||||
|
if ($rel == 1) {
|
||||||
|
if ($type == 1) {
|
||||||
|
return $paths->media_css_rel . 'main/';
|
||||||
|
} else {
|
||||||
|
return $paths->media_css_rel . 'custom/';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($type == 1) {
|
||||||
|
return JPath::clean($paths->media_css_abs . 'main/');
|
||||||
|
} else {
|
||||||
|
return JPath::clean($paths->media_css_abs . 'custom/');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getCSSFile($id = 0, $fullPath = 0) {
|
||||||
|
if ((int)$id > 0) {
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
$query = 'SELECT a.filename as filename, a.type as type'
|
||||||
|
.' FROM #__phocadownload_styles AS a'
|
||||||
|
.' WHERE a.id = '.(int) $id
|
||||||
|
.' ORDER BY a.id';
|
||||||
|
$db->setQuery($query, 0, 1);
|
||||||
|
$filename = $db->loadObject();
|
||||||
|
|
||||||
|
if (isset($filename->filename) && $filename->filename != '') {
|
||||||
|
if ($fullPath == 1 && isset($filename->type)) {
|
||||||
|
return self::getCSSPath($filename->type). $filename->filename;
|
||||||
|
} else {
|
||||||
|
return $filename->filename;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getFileSize($filename, $readable = 1) {
|
||||||
|
|
||||||
|
$path = PhocaDownloadPath::getPathSet();
|
||||||
|
$fileNameAbs = JPath::clean($path['orig_abs'] . DS . $filename);
|
||||||
|
|
||||||
|
if ($readable == 1) {
|
||||||
|
return self::getFileSizeReadable(filesize($fileNameAbs));
|
||||||
|
} else {
|
||||||
|
return filesize($fileNameAbs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static function getFileTime($filename, $function, $format = "d. M Y") {
|
||||||
|
|
||||||
|
$path = PhocaDownloadPath::getPathSet();
|
||||||
|
$fileNameAbs = JPath::clean($path['orig_abs'] . DS . $filename);
|
||||||
|
if (JFile::exists($fileNameAbs)) {
|
||||||
|
switch($function) {
|
||||||
|
case 2:
|
||||||
|
$fileTime = filectime($fileNameAbs);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
$fileTime = fileatime($fileNameAbs);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
default:
|
||||||
|
$fileTime = filemtime($fileNameAbs);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$fileTime = JHTML::Date($fileTime, $format);
|
||||||
|
} else {
|
||||||
|
$fileTime = '';
|
||||||
|
}
|
||||||
|
return $fileTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static function getTitleFromFilenameWithExt (&$filename) {
|
||||||
|
$folder_array = explode('/', $filename);//Explode the filename (folder and file name)
|
||||||
|
$count_array = count($folder_array);//Count this array
|
||||||
|
$last_array_value = $count_array - 1;//The last array value is (Count array - 1)
|
||||||
|
|
||||||
|
return $folder_array[$last_array_value];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function getMimeType($extension, $params) {
|
||||||
|
|
||||||
|
$regex_one = '/({\s*)(.*?)(})/si';
|
||||||
|
$regex_all = '/{\s*.*?}/si';
|
||||||
|
$matches = array();
|
||||||
|
$count_matches = preg_match_all($regex_all,$params,$matches,PREG_OFFSET_CAPTURE | PREG_PATTERN_ORDER);
|
||||||
|
|
||||||
|
$returnMime = '';
|
||||||
|
|
||||||
|
for($i = 0; $i < $count_matches; $i++) {
|
||||||
|
|
||||||
|
$phocaDownload = $matches[0][$i][0];
|
||||||
|
preg_match($regex_one,$phocaDownload,$phocaDownloadParts);
|
||||||
|
$values_replace = array ("/^'/", "/'$/", "/^'/", "/'$/", "/<br \/>/");
|
||||||
|
$values = explode("=", $phocaDownloadParts[2], 2);
|
||||||
|
|
||||||
|
foreach ($values_replace as $key2 => $values2) {
|
||||||
|
$values = preg_replace($values2, '', $values);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return mime if extension call it
|
||||||
|
if ($extension == $values[0]) {
|
||||||
|
$returnMime = $values[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($returnMime != '') {
|
||||||
|
return $returnMime;
|
||||||
|
} else {
|
||||||
|
return "PhocaErrorNoMimeFound";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getMimeTypeString($params) {
|
||||||
|
|
||||||
|
$regex_one = '/({\s*)(.*?)(})/si';
|
||||||
|
$regex_all = '/{\s*.*?}/si';
|
||||||
|
$matches = array();
|
||||||
|
$count_matches = preg_match_all($regex_all,$params,$matches,PREG_OFFSET_CAPTURE | PREG_PATTERN_ORDER);
|
||||||
|
|
||||||
|
$extString = '';
|
||||||
|
$mimeString = '';
|
||||||
|
|
||||||
|
for($i = 0; $i < $count_matches; $i++) {
|
||||||
|
|
||||||
|
$phocaDownload = $matches[0][$i][0];
|
||||||
|
preg_match($regex_one,$phocaDownload,$phocaDownloadParts);
|
||||||
|
$values_replace = array ("/^'/", "/'$/", "/^'/", "/'$/", "/<br \/>/");
|
||||||
|
$values = explode("=", $phocaDownloadParts[2], 2);
|
||||||
|
|
||||||
|
foreach ($values_replace as $key2 => $values2) {
|
||||||
|
$values = preg_replace($values2, '', $values);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create strings
|
||||||
|
$extString .= $values[0];
|
||||||
|
$mimeString .= $values[1];
|
||||||
|
|
||||||
|
$j = $i + 1;
|
||||||
|
if ($j < $count_matches) {
|
||||||
|
$extString .=',';
|
||||||
|
$mimeString .=',';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$string = array();
|
||||||
|
$string['mime'] = $mimeString;
|
||||||
|
$string['ext'] = $extString;
|
||||||
|
|
||||||
|
return $string;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getTitleFromFilenameWithoutExt (&$filename) {
|
||||||
|
|
||||||
|
$folder_array = explode('/', $filename);//Explode the filename (folder and file name)
|
||||||
|
$count_array = count($folder_array);//Count this array
|
||||||
|
$last_array_value = $count_array - 1;//The last array value is (Count array - 1)
|
||||||
|
|
||||||
|
$string = false;
|
||||||
|
$string = preg_match( "/\./i", $folder_array[$last_array_value] );
|
||||||
|
if ($string) {
|
||||||
|
return PhocaDownloadFile::removeExtension($folder_array[$last_array_value]);
|
||||||
|
} else {
|
||||||
|
return $folder_array[$last_array_value];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getFolderFromTheFile($filename) {
|
||||||
|
|
||||||
|
$folder_array = explode('/', $filename);
|
||||||
|
$count_array = count($folder_array);//Count this array
|
||||||
|
$last_array_value = $count_array - 1;
|
||||||
|
return str_replace($folder_array[$last_array_value], '', $filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function removeExtension($file_name) {
|
||||||
|
return substr($file_name, 0, strrpos( $file_name, '.' ));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getExtension( $file_name ) {
|
||||||
|
return strtolower( substr( strrchr( $file_name, "." ), 1 ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function canPlay( $fileName ) {
|
||||||
|
$fileExt = PhocaDownloadFile::getExtension($fileName);
|
||||||
|
|
||||||
|
$paramsC = JComponentHelper::getParams('com_phocadownload');
|
||||||
|
$html5 = $paramsC->get( 'html5_play', 0 );
|
||||||
|
|
||||||
|
if ($html5 == 1) {
|
||||||
|
switch($fileExt) {
|
||||||
|
case 'mp3':
|
||||||
|
case 'mp4':
|
||||||
|
case 'flv':
|
||||||
|
case 'ogg':
|
||||||
|
case 'ogv':
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
switch($fileExt) {
|
||||||
|
case 'mp3':
|
||||||
|
case 'mp4':
|
||||||
|
case 'flv':
|
||||||
|
//case 'mov':
|
||||||
|
//case 'wmv':
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function canPreview( $fileName ) {
|
||||||
|
$fileExt = PhocaDownloadFile::getExtension($fileName);
|
||||||
|
|
||||||
|
switch($fileExt) {
|
||||||
|
case 'pdf':
|
||||||
|
case 'jpeg':
|
||||||
|
case 'jpg':
|
||||||
|
case 'png':
|
||||||
|
case 'gif':
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,693 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* @package Joomla.Framework
|
||||||
|
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*
|
||||||
|
* @component Phoca Component
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
|
||||||
|
*/
|
||||||
|
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||||
|
jimport( 'joomla.filesystem.folder' );
|
||||||
|
jimport( 'joomla.filesystem.file' );
|
||||||
|
|
||||||
|
class PhocaDownloadFileUpload
|
||||||
|
{
|
||||||
|
public static function realMultipleUpload( $frontEnd = 0) {
|
||||||
|
|
||||||
|
$paramsC = JComponentHelper::getParams('com_phocadownload');
|
||||||
|
$chunkMethod = $paramsC->get( 'multiple_upload_chunk', 0 );
|
||||||
|
$uploadMethod = $paramsC->get( 'multiple_upload_method', 4 );
|
||||||
|
|
||||||
|
$overwriteExistingFiles = $paramsC->get( 'overwrite_existing_files', 0 );
|
||||||
|
|
||||||
|
JResponse::allowCache(false);
|
||||||
|
|
||||||
|
// Chunk Files
|
||||||
|
header('Content-type: text/plain; charset=UTF-8');
|
||||||
|
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||||
|
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
||||||
|
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||||
|
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||||
|
header("Pragma: no-cache");
|
||||||
|
|
||||||
|
// Invalid Token
|
||||||
|
JRequest::checkToken( 'request' ) or jexit(json_encode(array( 'jsonrpc' => '2.0', 'result' => 'error', 'code' => 100,
|
||||||
|
'message' => JText::_('COM_PHOCADOWNLOAD_ERROR').': ',
|
||||||
|
'details' => JTEXT::_('COM_PHOCADOWNLOAD_INVALID_TOKEN'))));
|
||||||
|
|
||||||
|
// Set FTP credentials, if given
|
||||||
|
$ftp = JClientHelper::setCredentialsFromRequest('ftp');
|
||||||
|
|
||||||
|
|
||||||
|
$file = JRequest::getVar( 'file', '', 'files', 'array' );
|
||||||
|
$chunk = JRequest::getVar( 'chunk', 0, '', 'int' );
|
||||||
|
$chunks = JRequest::getVar( 'chunks', 0, '', 'int' );
|
||||||
|
$folder = JRequest::getVar( 'folder', '', '', 'path' );
|
||||||
|
$manager = JRequest::getVar( 'manager', 'file', '', 'string' );
|
||||||
|
|
||||||
|
|
||||||
|
$path = PhocaDownloadPath::getPathSet($manager);// we use viewback to get right path
|
||||||
|
|
||||||
|
// Make the filename safe
|
||||||
|
if (isset($file['name'])) {
|
||||||
|
$file['name'] = JFile::makeSafe($file['name']);
|
||||||
|
}
|
||||||
|
if (isset($folder) && $folder != '') {
|
||||||
|
$folder = $folder . DS;
|
||||||
|
}
|
||||||
|
|
||||||
|
$chunkEnabled = 0;
|
||||||
|
// Chunk only if is enabled and only if flash is enabled
|
||||||
|
if (($chunkMethod == 1 && $uploadMethod == 1) || ($frontEnd == 0 && $chunkMethod == 0 && $uploadMethod == 1)) {
|
||||||
|
$chunkEnabled = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (isset($file['name'])) {
|
||||||
|
|
||||||
|
|
||||||
|
// - - - - - - - - - -
|
||||||
|
// Chunk Method
|
||||||
|
// - - - - - - - - - -
|
||||||
|
// $chunkMethod = 1, for frontend and backend
|
||||||
|
// $chunkMethod = 0, only for backend
|
||||||
|
if ($chunkEnabled == 1) {
|
||||||
|
|
||||||
|
// If chunk files are used, we need to upload parts to temp directory
|
||||||
|
// and then we can run e.g. the condition to recognize if the file already exists
|
||||||
|
// We must upload the parts to temp, in other case we get everytime the info
|
||||||
|
// that the file exists (because the part has the same name as the file)
|
||||||
|
// so after first part is uploaded, in fact the file already exists
|
||||||
|
// Example: NOT USING CHUNK
|
||||||
|
// If we upload abc.jpg file to server and there is the same file
|
||||||
|
// we compare it and can recognize, there is one, don't upload it again.
|
||||||
|
// Example: USING CHUNK
|
||||||
|
// If we upload abc.jpg file to server and there is the same file
|
||||||
|
// the part of current file will overwrite the same file
|
||||||
|
// and then (after all parts will be uploaded) we can make the condition to compare the file
|
||||||
|
// and we recognize there is one - ok don't upload it BUT the file will be damaged by
|
||||||
|
// parts uploaded by the new file - so this is why we are using temp file in Chunk method
|
||||||
|
$stream = JFactory::getStream();// Chunk Files
|
||||||
|
$tempFolder = 'pdpluploadtmpfolder'.DS;
|
||||||
|
//$filepathImgFinal = JPath::clean($path['orig_abs_ds'].$folder.strtolower($file['name']));
|
||||||
|
//$filepathImgTemp = JPath::clean($path['orig_abs_ds'].$folder.$tempFolder.strtolower($file['name']));
|
||||||
|
$filepathImgFinal = JPath::clean($path['orig_abs_ds'].$folder.$file['name']);
|
||||||
|
$filepathImgTemp = JPath::clean($path['orig_abs_ds'].$folder.$tempFolder.$file['name']);
|
||||||
|
$filepathFolderFinal = JPath::clean($path['orig_abs_ds'].$folder);
|
||||||
|
$filepathFolderTemp = JPath::clean($path['orig_abs_ds'].$folder.$tempFolder);
|
||||||
|
$maxFileAge = 60 * 60; // Temp file age in seconds
|
||||||
|
$lastChunk = $chunk + 1;
|
||||||
|
$realSize = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Get the real size - if chunk is uploaded, it is only a part size, so we must compute all size
|
||||||
|
// If there is last chunk we can computhe the whole size
|
||||||
|
if ($lastChunk == $chunks) {
|
||||||
|
if (JFile::exists($filepathImgTemp) && JFile::exists($file['tmp_name'])) {
|
||||||
|
$realSize = filesize($filepathImgTemp) + filesize($file['tmp_name']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5 minutes execution time
|
||||||
|
@set_time_limit(5 * 60);// usleep(5000);
|
||||||
|
|
||||||
|
// If the file already exists on the server:
|
||||||
|
// - don't copy the temp file to final
|
||||||
|
// - remove all parts in temp file
|
||||||
|
// Because some parts are uploaded before we can run the condition
|
||||||
|
// to recognize if the file already exists.
|
||||||
|
|
||||||
|
// Files should be overwritten
|
||||||
|
if ($overwriteExistingFiles == 1) {
|
||||||
|
JFile::delete($filepathImgFinal);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (JFile::exists($filepathImgFinal)) {
|
||||||
|
if($lastChunk == $chunks){
|
||||||
|
@JFolder::delete($filepathFolderTemp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
jexit(json_encode(array( 'jsonrpc' => '2.0', 'result' => 'error', 'code' => 108,
|
||||||
|
'message' => JText::_('COM_PHOCADOWNLOAD_ERROR').': ',
|
||||||
|
'details' => JTEXT::_('COM_PHOCADOWNLOAD_FILE_ALREADY_EXISTS'))));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!PhocaDownloadFileUpload::canUpload( $file, $errUploadMsg, $manager, $frontEnd, $chunkEnabled, $realSize )) {
|
||||||
|
|
||||||
|
// If there is some error, remove the temp folder with temp files
|
||||||
|
if($lastChunk == $chunks){
|
||||||
|
@JFolder::delete($filepathFolderTemp);
|
||||||
|
}
|
||||||
|
jexit(json_encode(array( 'jsonrpc' => '2.0', 'result' => 'error', 'code' => 104,
|
||||||
|
'message' => JText::_('COM_PHOCADOWNLOAD_ERROR').': ',
|
||||||
|
'details' => JTEXT::_($errUploadMsg))));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ok create temp folder and add chunks
|
||||||
|
if (!JFolder::exists($filepathFolderTemp)) {
|
||||||
|
@JFolder::create($filepathFolderTemp);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove old temp files
|
||||||
|
if (JFolder::exists($filepathFolderTemp)) {
|
||||||
|
$dirFiles = JFolder::files($filepathFolderTemp);
|
||||||
|
if (!empty($dirFiles)) {
|
||||||
|
foreach ($dirFiles as $fileS) {
|
||||||
|
$filePathImgS = $filepathFolderTemp . $fileS;
|
||||||
|
// Remove temp files if they are older than the max age
|
||||||
|
if (preg_match('/\\.tmp$/', $fileS) && (filemtime($filepathImgTemp) < time() - $maxFileAge)) {
|
||||||
|
@JFile::delete($filePathImgS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
jexit(json_encode(array( 'jsonrpc' => '2.0', 'result' => 'error', 'code' => 100,
|
||||||
|
'message' => JText::_('COM_PHOCADOWNLOAD_ERROR').': ',
|
||||||
|
'details' => JTEXT::_('COM_PHOCADOWNLOAD_ERROR_FOLDER_UPLOAD_NOT_EXISTS'))));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Look for the content type header
|
||||||
|
if (isset($_SERVER["HTTP_CONTENT_TYPE"]))
|
||||||
|
$contentType = $_SERVER["HTTP_CONTENT_TYPE"];
|
||||||
|
|
||||||
|
if (isset($_SERVER["CONTENT_TYPE"]))
|
||||||
|
$contentType = $_SERVER["CONTENT_TYPE"];
|
||||||
|
|
||||||
|
if (strpos($contentType, "multipart") !== false) {
|
||||||
|
if (isset($file['tmp_name']) && is_uploaded_file($file['tmp_name'])) {
|
||||||
|
|
||||||
|
// Open temp file
|
||||||
|
$out = $stream->open($filepathImgTemp, $chunk == 0 ? "wb" : "ab");
|
||||||
|
//$out = fopen($filepathImgTemp, $chunk == 0 ? "wb" : "ab");
|
||||||
|
if ($out) {
|
||||||
|
// Read binary input stream and append it to temp file
|
||||||
|
$in = fopen($file['tmp_name'], "rb");
|
||||||
|
if ($in) {
|
||||||
|
while ($buff = fread($in, 4096)) {
|
||||||
|
$stream->write($buff);
|
||||||
|
//fwrite($out, $buff);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
jexit(json_encode(array( 'jsonrpc' => '2.0', 'result' => 'error', 'code' => 101,
|
||||||
|
'message' => JText::_('COM_PHOCADOWNLOAD_ERROR').': ',
|
||||||
|
'details' => JTEXT::_('COM_PHOCADOWNLOAD_ERROR_OPEN_INPUT_STREAM'))));
|
||||||
|
}
|
||||||
|
$stream->close();
|
||||||
|
//fclose($out);
|
||||||
|
@JFile::delete($file['tmp_name']);
|
||||||
|
} else {
|
||||||
|
jexit(json_encode(array( 'jsonrpc' => '2.0', 'result' => 'error', 'code' => 102,
|
||||||
|
'message' => JText::_('COM_PHOCADOWNLOAD_ERROR').': ',
|
||||||
|
'details' => JTEXT::_('COM_PHOCADOWNLOAD_ERROR_OPEN_OUTPUT_STREAM'))));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
jexit(json_encode(array( 'jsonrpc' => '2.0', 'result' => 'error', 'code' => 103,
|
||||||
|
'message' => JText::_('COM_PHOCADOWNLOAD_ERROR').': ',
|
||||||
|
'details' => JTEXT::_('COM_PHOCADOWNLOAD_ERROR_MOVE_UPLOADED_FILE'))));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Open temp file
|
||||||
|
$out = $stream->open($filepathImgTemp, $chunk == 0 ? "wb" : "ab");
|
||||||
|
//$out = JFile::read($filepathImg);
|
||||||
|
if ($out) {
|
||||||
|
// Read binary input stream and append it to temp file
|
||||||
|
$in = fopen("php://input", "rb");
|
||||||
|
|
||||||
|
if ($in) {
|
||||||
|
while ($buff = fread($in, 4096)) {
|
||||||
|
$stream->write($buff);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
jexit(json_encode(array( 'jsonrpc' => '2.0', 'result' => 'error', 'code' => 101,
|
||||||
|
'message' => JText::_('COM_PHOCADOWNLOAD_ERROR').': ',
|
||||||
|
'details' => JTEXT::_('COM_PHOCADOWNLOAD_ERROR_OPEN_INPUT_STREAM'))));
|
||||||
|
}
|
||||||
|
$stream->close();
|
||||||
|
//fclose($out);
|
||||||
|
} else {
|
||||||
|
jexit(json_encode(array( 'jsonrpc' => '2.0', 'result' => 'error', 'code' => 102,
|
||||||
|
'message' => JText::_('COM_PHOCADOWNLOAD_ERROR').': ',
|
||||||
|
'details' => JTEXT::_('COM_PHOCADOWNLOAD_ERROR_OPEN_OUTPUT_STREAM'))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Rename the Temp File to Final File
|
||||||
|
if($lastChunk == $chunks){
|
||||||
|
|
||||||
|
/*if(($imginfo = getimagesize($filepathImgTemp)) === FALSE) {
|
||||||
|
JFolder::delete($filepathFolderTemp);
|
||||||
|
jexit(json_encode(array( 'jsonrpc' => '2.0', 'result' => 'error', 'code' => 110,
|
||||||
|
'message' => JText::_('COM_PHOCADOWNLOAD_ERROR').': ',
|
||||||
|
'details' => JTEXT::_('COM_PHOCADOWNLOAD_WARNING_INVALIDIMG'))));
|
||||||
|
}*/
|
||||||
|
|
||||||
|
// Files should be overwritten
|
||||||
|
if ($overwriteExistingFiles == 1) {
|
||||||
|
JFile::delete($filepathImgFinal);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!JFile::move($filepathImgTemp, $filepathImgFinal)) {
|
||||||
|
|
||||||
|
JFolder::delete($filepathFolderTemp);
|
||||||
|
|
||||||
|
jexit(json_encode(array( 'jsonrpc' => '2.0', 'result' => 'error', 'code' => 109,
|
||||||
|
'message' => JText::_('COM_PHOCADOWNLOAD_ERROR').': ',
|
||||||
|
'details' => JTEXT::_('COM_PHOCADOWNLOAD_ERROR_UNABLE_TO_MOVE_FILE') .'<br />'
|
||||||
|
. JText::_('COM_PHOCADOWNLOAD_CHECK_PERMISSIONS_OWNERSHIP'))));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
JFolder::delete($filepathFolderTemp);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((int)$frontEnd > 0) {
|
||||||
|
return $file['name'];
|
||||||
|
}
|
||||||
|
|
||||||
|
jexit(json_encode(array( 'jsonrpc' => '2.0', 'result' => 'OK', 'code' => 200,
|
||||||
|
'message' => JText::_('COM_PHOCADOWNLOAD_SUCCESS').': ',
|
||||||
|
'details' => JTEXT::_('COM_PHOCADOWNLOAD_FILES_UPLOADED'))));
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// No Chunk Method
|
||||||
|
$filepathImgFinal = JPath::clean($path['orig_abs_ds'].$folder.strtolower($file['name']));
|
||||||
|
$filepathImgFinal = JPath::clean($path['orig_abs_ds'].$folder.$file['name']);
|
||||||
|
$filepathFolderFinal = JPath::clean($path['orig_abs_ds'].$folder);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (!PhocaDownloadFileUpload::canUpload( $file, $errUploadMsg, $manager, $frontEnd, $chunkMethod, 0 )) {
|
||||||
|
jexit(json_encode(array( 'jsonrpc' => '2.0', 'result' => 'error', 'code' => 104,
|
||||||
|
'message' => JText::_('COM_PHOCADOWNLOAD_ERROR').': ',
|
||||||
|
'details' => JTEXT::_($errUploadMsg))));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (JFile::exists($filepathImgFinal) && $overwriteExistingFiles == 0) {
|
||||||
|
jexit(json_encode(array( 'jsonrpc' => '2.0', 'result' => 'error', 'code' => 108,
|
||||||
|
'message' => JText::_('COM_PHOCADOWNLOAD_ERROR').': ',
|
||||||
|
'details' => JTEXT::_('COM_PHOCADOWNLOAD_FILE_ALREADY_EXISTS'))));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(!JFile::upload($file['tmp_name'], $filepathImgFinal, false, true)) {
|
||||||
|
jexit(json_encode(array( 'jsonrpc' => '2.0', 'result' => 'error', 'code' => 109,
|
||||||
|
'message' => JText::_('COM_PHOCADOWNLOAD_ERROR').': ',
|
||||||
|
'details' => JTEXT::_('COM_PHOCADOWNLOAD_ERROR_UNABLE_TO_UPLOAD_FILE') .'<br />'
|
||||||
|
. JText::_('COM_PHOCADOWNLOAD_CHECK_PERMISSIONS_OWNERSHIP'))));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((int)$frontEnd > 0) {
|
||||||
|
return $file['name'];
|
||||||
|
}
|
||||||
|
|
||||||
|
jexit(json_encode(array( 'jsonrpc' => '2.0', 'result' => 'OK', 'code' => 200,
|
||||||
|
'message' => JText::_('COM_PHOCADOWNLOAD_SUCCESS').': ',
|
||||||
|
'details' => JTEXT::_('COM_PHOCADOWNLOAD_IMAGES_UPLOADED'))));
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// No isset $file['name']
|
||||||
|
jexit(json_encode(array( 'jsonrpc' => '2.0', 'result' => 'error', 'code' => 104,
|
||||||
|
'message' => JText::_('COM_PHOCADOWNLOAD_ERROR').': ',
|
||||||
|
'details' => JTEXT::_('COM_PHOCADOWNLOAD_ERROR_UNABLE_TO_UPLOAD_FILE'))));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function realSingleUpload( $frontEnd = 0 ) {
|
||||||
|
|
||||||
|
$paramsC = JComponentHelper::getParams('com_phocadownload');
|
||||||
|
// $chunkMethod = $paramsC->get( 'multiple_upload_chunk', 0 );
|
||||||
|
// $uploadMethod = $paramsC->get( 'multiple_upload_method', 4 );
|
||||||
|
|
||||||
|
$overwriteExistingFiles = $paramsC->get( 'overwrite_existing_files', 0 );
|
||||||
|
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
JRequest::checkToken( 'request' ) or jexit( 'ERROR: '. JTEXT::_('COM_PHOCADOWNLOAD_INVALID_TOKEN'));
|
||||||
|
JResponse::allowCache(false);
|
||||||
|
|
||||||
|
|
||||||
|
$file = JRequest::getVar( 'Filedata', '', 'files', 'array' );
|
||||||
|
$folder = JRequest::getVar( 'folder', '', '', 'path' );
|
||||||
|
$format = JRequest::getVar( 'format', 'html', '', 'cmd');
|
||||||
|
$return = JRequest::getVar( 'return-url', null, 'post', 'base64' );//includes field
|
||||||
|
$viewBack = JRequest::getVar( 'viewback', '', '', '' );
|
||||||
|
$manager = JRequest::getVar( 'manager', 'file', '', 'string' );
|
||||||
|
$tab = JRequest::getVar( 'tab', '', '', 'string' );
|
||||||
|
$field = JRequest::getVar( 'field' );
|
||||||
|
$errUploadMsg = '';
|
||||||
|
$folderUrl = $folder;
|
||||||
|
$tabUrl = '';
|
||||||
|
$component = JRequest::getVar( 'option', '', '', 'string' );
|
||||||
|
|
||||||
|
$path = PhocaDownloadPath::getPathSet($manager);// we use viewback to get right path
|
||||||
|
|
||||||
|
|
||||||
|
// In case no return value will be sent (should not happen)
|
||||||
|
if ($component != '' && $frontEnd == 0) {
|
||||||
|
$componentUrl = 'index.php?option='.$component;
|
||||||
|
} else {
|
||||||
|
$componentUrl = 'index.php';
|
||||||
|
}
|
||||||
|
if ($tab != '') {
|
||||||
|
$tabUrl = '&tab='.(string)$tab;
|
||||||
|
}
|
||||||
|
|
||||||
|
$ftp = JClientHelper::setCredentialsFromRequest('ftp');
|
||||||
|
|
||||||
|
// Make the filename safe
|
||||||
|
if (isset($file['name'])) {
|
||||||
|
$file['name'] = JFile::makeSafe($file['name']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (isset($folder) && $folder != '') {
|
||||||
|
$folder = $folder . DS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// All HTTP header will be overwritten with js message
|
||||||
|
if (isset($file['name'])) {
|
||||||
|
$filepath = JPath::clean($path['orig_abs_ds'].$folder.strtolower($file['name']));
|
||||||
|
$filepath = JPath::clean($path['orig_abs_ds'].$folder.$file['name']);
|
||||||
|
|
||||||
|
if (!PhocaDownloadFileUpload::canUpload( $file, $errUploadMsg, $manager, $frontEnd )) {
|
||||||
|
|
||||||
|
if ($errUploadMsg == 'COM_PHOCADOWNLOAD_WARNING_FILE_TOOLARGE') {
|
||||||
|
$errUploadMsg = JText::_($errUploadMsg) . ' ('.PhocaDownloadFileUpload::getFileSizeReadable($file['size']).')';
|
||||||
|
} /* else if ($errUploadMsg == 'COM_PHOCADOWNLOAD_WARNING_FILE_TOOLARGE_RESOLUTION') {
|
||||||
|
$imgSize = phocadownloadImage::getImageSize($file['tmp_name']);
|
||||||
|
$errUploadMsg = JText::_($errUploadMsg) . ' ('.(int)$imgSize[0].' x '.(int)$imgSize[1].' px)';
|
||||||
|
} */ else {
|
||||||
|
$errUploadMsg = JText::_($errUploadMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($return) {
|
||||||
|
$app->enqueueMessage( $errUploadMsg, 'error');
|
||||||
|
$app->redirect(base64_decode($return).'&manager='.(string)$manager.'&folder='.$folderUrl);
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
$app->enqueueMessage( $errUploadMsg, 'error');
|
||||||
|
$app->redirect($componentUrl, $errUploadMsg);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (JFile::exists($filepath) && $overwriteExistingFiles == 0) {
|
||||||
|
if ($return) {
|
||||||
|
$app->redirect(base64_decode($return).'&manager='.(string)$manager.'&folder='.$folderUrl, JText::_('COM_PHOCADOWNLOAD_FILE_ALREADY_EXISTS'), 'error');
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
$app->enqueueMessage( JText::_('COM_PHOCADOWNLOAD_FILE_ALREADY_EXISTS'), 'error');
|
||||||
|
$app->redirect($componentUrl);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!JFile::upload($file['tmp_name'], $filepath, false, true)) {
|
||||||
|
if ($return) {
|
||||||
|
$app->enqueueMessage( JText::_('COM_PHOCADOWNLOAD_ERROR_UNABLE_TO_UPLOAD_FILE'), 'error');
|
||||||
|
$app->redirect(base64_decode($return).'&manager='.(string)$manager.'&folder='.$folderUrl);
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
$app->enqueueMessage( JText::_('COM_PHOCADOWNLOAD_ERROR_UNABLE_TO_UPLOAD_FILE'), 'error');
|
||||||
|
$app->redirect($componentUrl);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if ((int)$frontEnd > 0) {
|
||||||
|
return $file['name'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($return) {
|
||||||
|
$app->enqueueMessage( JText::_('COM_PHOCADOWNLOAD_SUCCESS_FILE_UPLOAD'));
|
||||||
|
$app->redirect(base64_decode($return).'&manager='.(string)$manager.'&folder='.$folderUrl);
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
$app->enqueueMessage( JText::_('COM_PHOCADOWNLOAD_SUCCESS_FILE_UPLOAD'));
|
||||||
|
$app->redirect($componentUrl);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$msg = JText::_('COM_PHOCADOWNLOAD_ERROR_UNABLE_TO_UPLOAD_FILE');
|
||||||
|
if ($return) {
|
||||||
|
$app->enqueueMessage( $msg, 'error');
|
||||||
|
$app->redirect(base64_decode($return).'&manager='.(string)$manager.'&folder='.$folderUrl);
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
if($viewBack != '') {
|
||||||
|
$group = PhocaDownloadSettings::getManagerGroup($manager);
|
||||||
|
$link = 'index.php?option=com_phocadownload&view=phocadownloadmanager&manager='.(string)$manager
|
||||||
|
.str_replace('&', '&', $group['c']).'&'.$tabUrl.'&folder='.$folder.'&field='.$field;
|
||||||
|
$app->enqueueMessage( $msg, 'error');
|
||||||
|
$app->redirect($link);
|
||||||
|
} else {
|
||||||
|
$app->enqueueMessage( $msg, 'error');
|
||||||
|
$app->redirect('index.php?option=com_phocadownload');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static function canUpload( $file, &$err, $manager = '', $frontEnd = 0, $chunkEnabled = 0, $realSize = 0) {
|
||||||
|
|
||||||
|
$paramsC = JComponentHelper::getParams( 'com_phocadownload' );
|
||||||
|
|
||||||
|
if ($frontEnd == 1) {
|
||||||
|
$aft = $paramsC->get( 'allowed_file_types_upload', PhocaDownloadSettings::getDefaultAllowedMimeTypesUpload() );
|
||||||
|
$dft = $paramsC->get( 'disallowed_file_types_upload', '' );
|
||||||
|
$allowedMimeType = PhocaDownloadFile::getMimeTypeString($aft);
|
||||||
|
$disallowedMimeType = PhocaDownloadFile::getMimeTypeString($dft);
|
||||||
|
|
||||||
|
$ignoreUploadCh = 0;
|
||||||
|
$ignoreUploadCheck = $params->get( 'ignore_file_types_check', 2 );
|
||||||
|
if ($ignoreUploadCheck == 1 || $ignoreUploadCheck == 4 ) {
|
||||||
|
$ignoreUploadCh = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$aft = $paramsC->get( 'allowed_file_types_download', PhocaDownloadSettings::getDefaultAllowedMimeTypesDownload() );
|
||||||
|
$dft = $paramsC->get( 'disallowed_file_types_download', '' );
|
||||||
|
$allowedMimeType = PhocaDownloadFile::getMimeTypeString($aft);
|
||||||
|
$disallowedMimeType = PhocaDownloadFile::getMimeTypeString($dft);
|
||||||
|
|
||||||
|
$ignoreUploadCh = 0;
|
||||||
|
$ignoreUploadCheck = $paramsC->get( 'ignore_file_types_check', 2 );
|
||||||
|
if ($ignoreUploadCheck == 5 || $ignoreUploadCheck == 5 ) {
|
||||||
|
$ignoreUploadCh = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$paramsL = array();
|
||||||
|
$group = PhocaDownloadSettings::getManagerGroup($manager);
|
||||||
|
if ($group['f'] == 2) {
|
||||||
|
$paramsL['upload_extensions'] = 'gif,jpg,png,jpeg';
|
||||||
|
$paramsL['image_extensions'] = 'gif,jpg,png,jpeg';
|
||||||
|
$paramsL['upload_mime'] = 'image/jpeg,image/gif,image/png';
|
||||||
|
$paramsL['upload_mime_illegal'] ='application/x-shockwave-flash,application/msword,application/excel,application/pdf,application/powerpoint,text/plain,application/x-zip,text/html';
|
||||||
|
$paramsL['upload_ext_illegal'] = $disallowedMimeType['ext'];
|
||||||
|
} else {
|
||||||
|
$paramsL['upload_extensions'] = $allowedMimeType['ext'];
|
||||||
|
$paramsL['image_extensions'] = 'bmp,gif,jpg,png,jpeg';
|
||||||
|
$paramsL['upload_mime'] = $allowedMimeType['mime'];
|
||||||
|
$paramsL['upload_mime_illegal'] = $disallowedMimeType['mime'];
|
||||||
|
$paramsL['upload_ext_illegal'] = $disallowedMimeType['ext'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// The file doesn't exist
|
||||||
|
if(empty($file['name'])) {
|
||||||
|
$err = 'COM_PHOCADOWNLOAD_WARNING_INPUT_FILE_UPLOAD';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// Not safe file
|
||||||
|
jimport('joomla.filesystem.file');
|
||||||
|
if ($file['name'] !== JFile::makesafe($file['name'])) {
|
||||||
|
$err = 'COM_PHOCADOWNLOAD_WARNFILENAME';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$format = strtolower(JFile::getExt($file['name']));
|
||||||
|
if ($ignoreUploadCh == 1) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$allowable = explode( ',', $paramsL['upload_extensions']);
|
||||||
|
$notAllowable = explode( ',', $paramsL['upload_ext_illegal']);
|
||||||
|
if(in_array($format, $notAllowable)) {
|
||||||
|
$err = 'COM_PHOCADOWNLOAD_WARNFILETYPE_DISALLOWED';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//if (!in_array($format, $allowable)) {
|
||||||
|
if ($format == '' || $format == false || (!in_array($format, $allowable))) {
|
||||||
|
$err = 'COM_PHOCADOWNLOAD_WARNFILETYPE_NOT_ALLOWED';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Max size of image
|
||||||
|
// If chunk method is used, we need to get computed size
|
||||||
|
$maxSize = $paramsC->get( 'upload_maxsize', 3145728 );
|
||||||
|
if ((int)$frontEnd > 0) {
|
||||||
|
$maxSize = $paramsC->get( 'user_file_upload_size', 3145728 );
|
||||||
|
} else {
|
||||||
|
$maxSize = $paramsC->get( 'upload_maxsize', 3145728 );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($chunkEnabled == 1) {
|
||||||
|
if ((int)$maxSize > 0 && (int)$realSize > (int)$maxSize) {
|
||||||
|
$err = 'COM_PHOCADOWNLOAD_WARNFILETOOLARGE';
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ((int)$maxSize > 0 && (int)$file['size'] > (int)$maxSize) {
|
||||||
|
$err = 'COM_PHOCADOWNLOAD_WARNFILETOOLARGE';
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// User (only in ucp) - Check the size of all files by users
|
||||||
|
if ($frontEnd == 2) {
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$maxUserUploadSize = (int)$paramsC->get( 'user_files_max_size', 20971520 );
|
||||||
|
$maxUserUploadCount = (int)$paramsC->get( 'user_files_max_count', 5 );
|
||||||
|
$allFile = PhocaDownloadUser:: getUserFileInfo($file, $user->id);
|
||||||
|
|
||||||
|
if ($chunkEnabled == 1) {
|
||||||
|
$fileSize = $realSize;
|
||||||
|
} else {
|
||||||
|
$fileSize = $file['size'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((int)$maxUserUploadSize > 0 && (int) $allFile['size'] > $maxUserUploadSize) {
|
||||||
|
$err = JText::_('COM_PHOCADOWNLOAD_WARNUSERFILESTOOLARGE');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((int) $allFile['count'] > $maxUserUploadCount) {
|
||||||
|
$err = JText::_('COM_PHOCADOWNLOAD_WARNUSERFILESTOOMUCH');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Image check
|
||||||
|
$imginfo = null;
|
||||||
|
$images = explode( ',', $paramsL['image_extensions']);
|
||||||
|
|
||||||
|
if(in_array($format, $images)) { // if its an image run it through getimagesize
|
||||||
|
|
||||||
|
$group = PhocaDownloadSettings::getManagerGroup($manager);
|
||||||
|
if($group['i'] == 1) {
|
||||||
|
if ($chunkEnabled != 1) {
|
||||||
|
if(($imginfo = getimagesize($file['tmp_name'])) === FALSE) {
|
||||||
|
$err = 'COM_PHOCADOWNLOAD_WARNINVALIDIMG';
|
||||||
|
$err = $imginfo[0];
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if(!in_array($format, $images)) { // if its not an image...and we're not ignoring it
|
||||||
|
$allowed_mime = explode(',', $paramsL['upload_mime']);
|
||||||
|
$illegal_mime = explode(',', $paramsL['upload_mime_illegal']);
|
||||||
|
if(function_exists('finfo_open')) {// We have fileinfo
|
||||||
|
$finfo = finfo_open(FILEINFO_MIME);
|
||||||
|
$type = finfo_file($finfo, $file['tmp_name']);
|
||||||
|
if(strlen($type) && !in_array($type, $allowed_mime) && in_array($type, $illegal_mime)) {
|
||||||
|
$err = 'COM_PHOCADOWNLOAD_WARNINVALIDMIME';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
finfo_close($finfo);
|
||||||
|
} else if(function_exists('mime_content_type')) { // we have mime magic
|
||||||
|
$type = mime_content_type($file['tmp_name']);
|
||||||
|
if(strlen($type) && !in_array($type, $allowed_mime) && in_array($type, $illegal_mime)) {
|
||||||
|
$err = 'COM_PHOCADOWNLOAD_WARNINVALIDMIME';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// XSS Check
|
||||||
|
$xss_check = JFile::read($file['tmp_name'],false,256);
|
||||||
|
$html_tags = PhocaDownloadSettings::getHTMLTagsUpload();
|
||||||
|
foreach($html_tags as $tag) { // A tag is '<tagname ', so we need to add < and a space or '<tagname>'
|
||||||
|
if(stristr($xss_check, '<'.$tag.' ') || stristr($xss_check, '<'.$tag.'>')) {
|
||||||
|
$err = 'COM_PHOCADOWNLOAD_WARNIEXSS';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function renderFTPaccess() {
|
||||||
|
|
||||||
|
$ftpOutput = '<fieldset title="'.JText::_('COM_PHOCADOWNLOAD_FTP_LOGIN_LABEL'). '">'
|
||||||
|
.'<legend>'. JText::_('COM_PHOCADOWNLOAD_FTP_LOGIN_LABEL').'</legend>'
|
||||||
|
.JText::_('COM_PHOCADOWNLOAD_FTP_LOGIN_DESC')
|
||||||
|
.'<table class="adminform nospace">'
|
||||||
|
.'<tr>'
|
||||||
|
.'<td width="120"><label for="username">'. JText::_('JGLOBAL_USERNAME').':</label></td>'
|
||||||
|
.'<td><input type="text" id="username" name="username" class="input_box" size="70" value="" /></td>'
|
||||||
|
.'</tr>'
|
||||||
|
.'<tr>'
|
||||||
|
.'<td width="120"><label for="password">'. JText::_('JGLOBAL_PASSWORD').':</label></td>'
|
||||||
|
.'<td><input type="password" id="password" name="password" class="input_box" size="70" value="" /></td>'
|
||||||
|
.'</tr></table></fieldset>';
|
||||||
|
return $ftpOutput;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function renderCreateFolder($sessName, $sessId, $currentFolder, $viewBack, $attribs = '') {
|
||||||
|
|
||||||
|
if ($attribs != '') {
|
||||||
|
$attribs = '&'.$attribs;
|
||||||
|
}
|
||||||
|
|
||||||
|
$folderOutput = '<form action="'. JURI::base()
|
||||||
|
.'index.php?option=com_phocadownload&task=phocadownloadupload.createfolder&'. $sessName.'='.$sessId.'&'
|
||||||
|
.JSession::getFormToken().'=1&viewback='.$viewBack.'&'
|
||||||
|
.'folder='.$currentFolder.$attribs .'" name="folderForm" id="folderForm" method="post" class="form-inline" >'."\n"
|
||||||
|
|
||||||
|
.'<h4>'.JText::_('COM_PHOCADOWNLOAD_FOLDER').'</h4>'."\n"
|
||||||
|
.'<div class="path">'
|
||||||
|
.'<input class="inputbox" type="text" id="foldername" name="foldername" />'
|
||||||
|
.'<input class="update-folder" type="hidden" name="folderbase" id="folderbase" value="'.$currentFolder.'" />'
|
||||||
|
.' <button type="submit" class="btn">'. JText::_( 'COM_PHOCADOWNLOAD_CREATE_FOLDER' ).'</button>'
|
||||||
|
.'</div>'."\n"
|
||||||
|
.JHTML::_( 'form.token' )
|
||||||
|
.'</form>';
|
||||||
|
return $folderOutput;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,288 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* @package Joomla.Framework
|
||||||
|
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*
|
||||||
|
* @component Phoca Component
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
|
||||||
|
*/
|
||||||
|
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||||
|
|
||||||
|
class PhocaDownloadFileUploadMultiple
|
||||||
|
{
|
||||||
|
public $method = 1;
|
||||||
|
public $url = '';
|
||||||
|
public $reload = '';
|
||||||
|
public $maxFileSize = '';
|
||||||
|
public $chunkSize = '';
|
||||||
|
public $imageHeight = '';
|
||||||
|
public $imageWidth = '';
|
||||||
|
public $imageQuality= '';
|
||||||
|
public $frontEnd = 0;
|
||||||
|
|
||||||
|
public function __construct() {}
|
||||||
|
|
||||||
|
public static function renderMultipleUploadLibraries() {
|
||||||
|
|
||||||
|
|
||||||
|
$paramsC = JComponentHelper::getParams('com_phocadownload');
|
||||||
|
$chunkMethod = $paramsC->get( 'multiple_upload_chunk', 0 );
|
||||||
|
$uploadMethod = $paramsC->get( 'multiple_upload_method', 4 );
|
||||||
|
|
||||||
|
JHtml::_('behavior.framework', true);// Load it here to be sure, it is loaded before jquery
|
||||||
|
JHtml::_('jquery.framework', false);// Load it here because of own nonConflict method (nonconflict is set below)
|
||||||
|
$document = JFactory::getDocument();
|
||||||
|
// No more used - - - - -
|
||||||
|
//$document->addScript(JURI::root(true).'/components/com_phocadownload/assets/jquery/jquery-1.6.4.min.js');//USE SYSTEM
|
||||||
|
//$nC = 'var pgJQ = jQuery.noConflict();';//SET BELOW
|
||||||
|
//$document->addScriptDeclaration($nC);//SET BELOW
|
||||||
|
// - - - - - - - - - - - -
|
||||||
|
|
||||||
|
//$document->addScript(JURI::root(true).'/components/com_phocadownload/assets/plupload/jquery.ui.plupload/jquery.ui.plupload.js');
|
||||||
|
|
||||||
|
if ($uploadMethod == 2) {
|
||||||
|
//$document->addScript(JURI::root(true).'/components/com_phocadownload/assets/plupload/plupload.gears.js');
|
||||||
|
}
|
||||||
|
if ($uploadMethod == 5) {
|
||||||
|
//$document->addScript(JURI::root(true).'/components/com_phocadownload/assets/plupload/plupload.browserplus.js');
|
||||||
|
}
|
||||||
|
$document->addScript(JURI::root(true).'/components/com_phocadownload/assets/plupload/plupload.js');
|
||||||
|
if ($uploadMethod == 2) {
|
||||||
|
$document->addScript(JURI::root(true).'/components/com_phocadownload/assets/plupload/plupload.gears.js');
|
||||||
|
}
|
||||||
|
if ($uploadMethod == 3) {
|
||||||
|
$document->addScript(JURI::root(true).'/components/com_phocadownload/assets/plupload/plupload.silverlight.js');
|
||||||
|
}
|
||||||
|
if ($uploadMethod == 1) {
|
||||||
|
$document->addScript(JURI::root(true).'/components/com_phocadownload/assets/plupload/plupload.flash.js');
|
||||||
|
}
|
||||||
|
if ($uploadMethod == 5) {
|
||||||
|
$document->addScript(JURI::root(true).'/components/com_phocadownload/assets/plupload/plupload.browserplus.js');
|
||||||
|
}
|
||||||
|
if ($uploadMethod == 6) {
|
||||||
|
$document->addScript(JURI::root(true).'/components/com_phocadownload/assets/plupload/plupload.html4.js');
|
||||||
|
}
|
||||||
|
if ($uploadMethod == 4) {
|
||||||
|
$document->addScript(JURI::root(true).'/components/com_phocadownload/assets/plupload/plupload.html5.js');
|
||||||
|
}
|
||||||
|
$document->addScript(JURI::root(true).'/components/com_phocadownload/assets/plupload/jquery.plupload.queue/jquery.plupload.queue.js');
|
||||||
|
JHTML::stylesheet( 'components/com_phocadownload/assets/plupload/jquery.plupload.queue/css/jquery.plupload.queue.css' );
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getMultipleUploadSizeFormat($size) {
|
||||||
|
$readableSize = PhocaDownloadFile::getFileSizeReadable($size, '%01.0f %s', 1);
|
||||||
|
|
||||||
|
$readableSize = str_replace(' ', '', $readableSize);
|
||||||
|
|
||||||
|
$readableSize = strtolower($readableSize);
|
||||||
|
return $readableSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function renderMultipleUploadJS($frontEnd = 0, $chunkMethod = 0) {
|
||||||
|
|
||||||
|
$document = JFactory::getDocument();
|
||||||
|
|
||||||
|
switch ($this->method) {
|
||||||
|
case 2:
|
||||||
|
$name = 'gears_uploader';
|
||||||
|
$runtime = 'gears';
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
$name = 'silverlight_uploader';
|
||||||
|
$runtime = 'silverlight';
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
$name = 'html5_uploader';
|
||||||
|
$runtime = 'html5';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 5:
|
||||||
|
$name = 'browserplus_uploader';
|
||||||
|
$runtime = 'browserplus';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 6:
|
||||||
|
$name = 'html4_uploader';
|
||||||
|
$runtime = 'html4';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
default:
|
||||||
|
$name = 'flash_uploader';
|
||||||
|
$runtime = 'flash';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$chunkEnabled = 0;
|
||||||
|
// Chunk only if is enabled and only if flash is enabled
|
||||||
|
if (($chunkMethod == 1 && $this->method == 1) || ($this->frontEnd == 0 && $chunkMethod == 0 && $this->method == 1)) {
|
||||||
|
$chunkEnabled = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->url = str_replace('&', '&', $this->url);
|
||||||
|
$this->reload = str_replace('&', '&', $this->reload);
|
||||||
|
|
||||||
|
|
||||||
|
$js = 'var pgJQ = jQuery.noConflict();';
|
||||||
|
|
||||||
|
$js .='pgJQ(function() {'."\n";
|
||||||
|
|
||||||
|
$js.=''."\n";
|
||||||
|
$js.=' plupload.addI18n({'."\n";
|
||||||
|
$js.=' \'Select files\' : \''.addslashes(JText::_('COM_PHOCADOWNLOAD_SELECT_FILES')).'\','."\n";
|
||||||
|
$js.=' \'Add files to the upload queue and click the start button.\' : \''.addslashes(JText::_('COM_PHOCADOWNLOAD_ADD_FILES_TO_UPLOAD_QUEUE_AND_CLICK_START_BUTTON')).'\','."\n";
|
||||||
|
$js.=' \'Filename\' : \''.addslashes(JText::_('COM_PHOCADOWNLOAD_FILENAME')).'\','."\n";
|
||||||
|
$js.=' \'Status\' : \''.addslashes(JText::_('COM_PHOCADOWNLOAD_STATUS')).'\','."\n";
|
||||||
|
$js.=' \'Size\' : \''.addslashes(JText::_('COM_PHOCADOWNLOAD_SIZE')).'\','."\n";
|
||||||
|
$js.=' \'Add files\' : \''.addslashes(JText::_('COM_PHOCADOWNLOAD_ADD_FILES')).'\','."\n";
|
||||||
|
$js.=' \'Start upload\':\''.addslashes(JText::_('COM_PHOCADOWNLOAD_START_UPLOAD')).'\','."\n";
|
||||||
|
$js.=' \'Stop current upload\' : \''.addslashes(JText::_('COM_PHOCADOWNLOAD_STOP_CURRENT_UPLOAD')).'\','."\n";
|
||||||
|
$js.=' \'Start uploading queue\' : \''.addslashes(JText::_('COM_PHOCADOWNLOAD_START_UPLOADING_QUEUE')).'\','."\n";
|
||||||
|
$js.=' \'Drag files here.\' : \''.addslashes(JText::_('COM_PHOCADOWNLOAD_DRAG_FILES_HERE')).'\''."\n";
|
||||||
|
$js.=' });';
|
||||||
|
$js.=''."\n";
|
||||||
|
|
||||||
|
|
||||||
|
$js.=' pgJQ("#'.$name.'").pluploadQueue({'."\n";
|
||||||
|
$js.=' runtimes : \''.$runtime.'\','."\n";
|
||||||
|
$js.=' url : \''.$this->url.'\','."\n";
|
||||||
|
//$js.=' max_file_size : \''.$this->maxFileSize.'\','."\n";
|
||||||
|
|
||||||
|
if ($this->maxFileSize != '0b') {
|
||||||
|
$js.=' max_file_size : \''.$this->maxFileSize.'\','."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($chunkEnabled == 1) {
|
||||||
|
$js.=' chunk_size : \'1mb\','."\n";
|
||||||
|
}
|
||||||
|
$js.=' preinit: attachCallbacks,'."\n";
|
||||||
|
$js.=' unique_names : false,'."\n";
|
||||||
|
$js.=' multipart: true,'."\n";
|
||||||
|
$js.=' filters : ['."\n";
|
||||||
|
//$js.=' {title : "'.JText::_('COM_PHOCADOWNLOAD_IMAGE_FILES').'", extensions : "jpg,gif,png"}'."\n";
|
||||||
|
//$js.=' {title : "Zip files", extensions : "zip"}'."\n";
|
||||||
|
$js.=' ],'."\n";
|
||||||
|
$js.=''."\n";
|
||||||
|
/*if ($this->method != 6) {
|
||||||
|
if ((int)$this->imageWidth > 0 || (int)$this->imageWidth > 0) {
|
||||||
|
$js.=' resize : {width : '.$this->imageWidth.', height : '.$this->imageHeight.', quality : '.$this->imageQuality.'},'."\n";
|
||||||
|
$js.=''."\n";
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
if ($this->method == 1) {
|
||||||
|
$js.=' flash_swf_url : \''.JURI::root(true).'/components/com_phocadownload/assets/plupload/plupload.flash.swf\''."\n";
|
||||||
|
} else if ($this->method == 3) {
|
||||||
|
$js.=' silverlight_xap_url : \''.JURI::root(true).'/components/com_phocadownload/assets/plupload/plupload.silverlight.xap\''."\n";
|
||||||
|
}
|
||||||
|
$js.=' });'."\n";
|
||||||
|
|
||||||
|
$js.=''."\n";
|
||||||
|
|
||||||
|
$js.='function attachCallbacks(Uploader) {'."\n";
|
||||||
|
$js.=' Uploader.bind(\'FileUploaded\', function(Up, File, Response) {'."\n";
|
||||||
|
$js.=' var obj = eval(\'(\' + Response.response + \')\');'."\n";
|
||||||
|
//if ($this->method == 4 || $this->method == 6) {
|
||||||
|
if ($this->method == 6) {
|
||||||
|
$js.=' var queueFiles = Uploader.total.failed + Uploader.total.uploaded;'."\n";
|
||||||
|
$js.=' var uploaded0 = Uploader.total.uploaded;'."\n";
|
||||||
|
} else {
|
||||||
|
$js.=' var queueFiles = Uploader.total.failed + Uploader.total.uploaded + 1;'."\n";
|
||||||
|
$js.=' var uploaded0 = Uploader.total.uploaded + 1;'."\n";
|
||||||
|
}
|
||||||
|
$js.=''."\n";
|
||||||
|
$js.=' if ((typeof(obj.result) != \'undefined\') && obj.result == \'error\') {'."\n";
|
||||||
|
$js.=' '."\n";
|
||||||
|
if ($this->method == 6) {
|
||||||
|
//$js.=' var uploaded0 = Uploader.total.uploaded;'."\n";
|
||||||
|
} else {
|
||||||
|
//$js.=' var uploaded0 = Uploader.total.uploaded + 1;'."\n";
|
||||||
|
}
|
||||||
|
$js.=' Up.trigger("Error", {message : obj.message, code : obj.code, details : obj.details, file: File});'."\n";
|
||||||
|
$js.=' if( queueFiles == Uploader.files.length) {'."\n";
|
||||||
|
if ($this->method == 6) {
|
||||||
|
$js.=' var uploaded0 = Uploader.total.uploaded;'."\n";
|
||||||
|
} else {
|
||||||
|
$js.=' var uploaded0 = Uploader.total.uploaded;'."\n";
|
||||||
|
}
|
||||||
|
$js.=' window.location = \''.$this->reload.'\' + \'&muuploaded=\' + uploaded0 + \'&mufailed=\' + Uploader.total.failed;'."\n";
|
||||||
|
//$js.=' alert(\'Error\' + obj.message)'."\n";
|
||||||
|
$js.=' }'."\n";
|
||||||
|
$js.=' return false; '."\n";
|
||||||
|
$js.=''."\n";
|
||||||
|
$js.=' } else {'."\n";
|
||||||
|
$js.=' if( queueFiles == Uploader.files.length) {'."\n";
|
||||||
|
//$js.=' var uploaded = Uploader.total.uploaded + 1;'."\n";
|
||||||
|
if ($this->method == 6) {
|
||||||
|
$js.=' var uploaded = Uploader.total.uploaded;'."\n";
|
||||||
|
} else {
|
||||||
|
$js.=' var uploaded = Uploader.total.uploaded + 1;'."\n";
|
||||||
|
}
|
||||||
|
$js.=' window.location = \''.$this->reload.'\' + \'&muuploaded=\' + uploaded + \'&mufailed=\' + Uploader.total.failed;'."\n";
|
||||||
|
//$js.=' alert(\'OK\' + obj.message)'."\n";
|
||||||
|
$js.=' }'."\n";
|
||||||
|
$js.=' }'."\n";
|
||||||
|
$js.=' });'."\n";
|
||||||
|
$js.=' '."\n";
|
||||||
|
$js.=' Uploader.bind(\'Error\', function(Up, ErrorObj) {'."\n";
|
||||||
|
$js.=''."\n";
|
||||||
|
// $js.=' if (ErrorObj.code == 100) { '."\n";
|
||||||
|
//$js.=' pgJQ(\'#\' + ErrorObj.file.id).append(\'<div class="pgerrormsg">\'+ ErrorObj.message + ErrorObj.details +\'</div>\');'."\n";
|
||||||
|
$js.=' pgJQ(\'#\' + ErrorObj.file.id).append(\'<div class="alert alert-error">\'+ ErrorObj.message + ErrorObj.details +\'</div>\');'."\n";
|
||||||
|
// $js.=' }'."\n";
|
||||||
|
$js.=' }); '."\n";
|
||||||
|
$js.='}';
|
||||||
|
|
||||||
|
$js.='});'."\n";// End $(function()
|
||||||
|
|
||||||
|
$document->addScriptDeclaration($js);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMultipleUploadHTML($width = '', $height = '330', $mootools = 1) {
|
||||||
|
|
||||||
|
|
||||||
|
switch ($this->method) {
|
||||||
|
case 2:
|
||||||
|
$name = 'gears_uploader';
|
||||||
|
$msg = JText::_('COM_PHOCADOWNLOAD_NOT_INSTALLED_GEARS');
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
$name = 'silverlight_uploader';
|
||||||
|
$msg = JText::_('COM_PHOCADOWNLOAD_NOT_INSTALLED_SILVERLIGHT');
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
$name = 'html5_uploader';
|
||||||
|
$msg = JText::_('COM_PHOCADOWNLOAD_NOT_SUPPORTED_HTML5');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 5:
|
||||||
|
$name = 'browserplus_uploader';
|
||||||
|
$msg = JText::_('COM_PHOCADOWNLOAD_NOT_INSTALLED_BROWSERPLUS');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 6:
|
||||||
|
$name = 'html4_uploader';
|
||||||
|
$msg = JText::_('COM_PHOCADOWNLOAD_NOT_SUPPORTED_HTML4');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
default:
|
||||||
|
$name = 'flash_uploader';
|
||||||
|
$msg = JText::_('COM_PHOCADOWNLOAD_NOT_INSTALLED_FLASH');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$style = '';
|
||||||
|
if ($width != '') {
|
||||||
|
$style .= 'width: '.(int)$width.'px;';
|
||||||
|
}
|
||||||
|
if ($height != '') {
|
||||||
|
$style .= 'height: '.(int)$height.'px;';
|
||||||
|
}
|
||||||
|
|
||||||
|
return '<div id="'.$name.'" style="'.$style.'">'.$msg.'</div>';
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* @package Joomla.Framework
|
||||||
|
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*
|
||||||
|
* @component Phoca Component
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
|
||||||
|
*/
|
||||||
|
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||||
|
|
||||||
|
class PhocaDownloadFileUploadSingle
|
||||||
|
{
|
||||||
|
public $tab = '';
|
||||||
|
public $returnUrl = '';
|
||||||
|
|
||||||
|
public function __construct() {}
|
||||||
|
|
||||||
|
public function getSingleUploadHTML( $frontEnd = 0) {
|
||||||
|
|
||||||
|
if ($frontEnd == 1) {
|
||||||
|
|
||||||
|
$html = '<input type="hidden" name="controller" value="category" />'
|
||||||
|
.'<input type="hidden" name="tab" value="'.$this->tab.'" />';
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$html = '<input type="file" id="sfile-upload" name="Filedata" />'
|
||||||
|
//.'<input type="submit" id="sfile-upload-submit" value="'.JText::_('COM_PHOCADOWNLOAD_START_UPLOAD').'"/>'
|
||||||
|
.'<button class="btn btn-primary" id="upload-submit"><i class="icon-upload icon-white"></i> '.JText::_('COM_PHOCADOWNLOAD_START_UPLOAD').'</button>'
|
||||||
|
.'<input type="hidden" name="return-url" value="'. base64_encode($this->returnUrl).'" />'
|
||||||
|
.'<input type="hidden" name="tab" value="'.$this->tab.'" />';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $html;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
/* @package Joomla
|
||||||
|
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
* @extension Phoca Extension
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('JPATH_PLATFORM') or die;
|
||||||
|
|
||||||
|
abstract class PhocaDownloadBatch
|
||||||
|
{
|
||||||
|
|
||||||
|
public static function item($published, $category = 0)
|
||||||
|
{
|
||||||
|
// Create the copy/move options.
|
||||||
|
$options = array(
|
||||||
|
JHtml::_('select.option', 'c', JText::_('JLIB_HTML_BATCH_COPY')),
|
||||||
|
JHtml::_('select.option', 'm', JText::_('JLIB_HTML_BATCH_MOVE'))
|
||||||
|
);
|
||||||
|
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
|
||||||
|
//build the list of categories
|
||||||
|
$query = 'SELECT a.title AS text, a.id AS value, a.parent_id as parentid'
|
||||||
|
. ' FROM #__phocadownload_categories AS a'
|
||||||
|
// TODO. ' WHERE a.published = '.(int)$published
|
||||||
|
. ' ORDER BY a.ordering';
|
||||||
|
$db->setQuery( $query );
|
||||||
|
$data = $db->loadObjectList();
|
||||||
|
$tree = array();
|
||||||
|
$text = '';
|
||||||
|
$catId= -1;
|
||||||
|
$tree = PhocaDownloadCategory::CategoryTreeOption($data, $tree, 0, $text, $catId);
|
||||||
|
|
||||||
|
if ($category == 1) {
|
||||||
|
array_unshift($tree, JHTML::_('select.option', 0, JText::_('JLIB_HTML_ADD_TO_ROOT'), 'value', 'text'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Create the batch selector to change select the category by which to move or copy.
|
||||||
|
$lines = array(
|
||||||
|
'<label id="batch-choose-action-lbl" for="batch-choose-action">',
|
||||||
|
JText::_('JLIB_HTML_BATCH_MENU_LABEL'),
|
||||||
|
'</label>',
|
||||||
|
'<fieldset id="batch-choose-action" class="combo">',
|
||||||
|
'<select name="batch[category_id]" class="inputbox" id="batch-category-id">',
|
||||||
|
'<option value="">'.JText::_('JSELECT').'</option>',
|
||||||
|
/*JHtml::_('select.options', JHtml::_('category.options', $extension, array('published' => (int) $published))),*/
|
||||||
|
JHTML::_('select.options', $tree ),
|
||||||
|
'</select>',
|
||||||
|
JHTML::_( 'select.radiolist', $options, 'batch[move_copy]', '', 'value', 'text', 'm'),
|
||||||
|
'</fieldset>'
|
||||||
|
);
|
||||||
|
|
||||||
|
return implode("\n", $lines);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
/* @package Joomla
|
||||||
|
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
* @extension Phoca Extension
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
if (! class_exists('JHtmlGrid')) {
|
||||||
|
require_once( JPATH_SITE.DS.'libraries'.DS.'joomla'.DS.'html'.DS.'html'.DS.'grid.php' );
|
||||||
|
}
|
||||||
|
//jimport('joomla.html.html.jgrid');
|
||||||
|
class PhocaDownloadGrid extends JHtmlJGrid
|
||||||
|
{
|
||||||
|
|
||||||
|
public static function approved($value, $i, $prefix = '', $enabled = true, $checkbox='cb')
|
||||||
|
{
|
||||||
|
if (is_array($prefix)) {
|
||||||
|
$options = $prefix;
|
||||||
|
$enabled = array_key_exists('enabled', $options) ? $options['enabled'] : $enabled;
|
||||||
|
$checkbox = array_key_exists('checkbox', $options) ? $options['checkbox'] : $checkbox;
|
||||||
|
$prefix = array_key_exists('prefix', $options) ? $options['prefix'] : '';
|
||||||
|
}
|
||||||
|
$states = array(
|
||||||
|
1 => array('disapprove', 'COM_PHOCADOWNLOAD_APPROVED', 'COM_PHOCADOWNLOAD_NOT_APPROVE_ITEM', 'COM_PHOCADOWNLOAD_APPROVED', false, 'publish', 'publish'),
|
||||||
|
0 => array('approve', 'COM_PHOCADOWNLOAD_NOT_APPROVED', 'COM_PHOCADOWNLOAD_APPROVE_ITEM', 'COM_PHOCADOWNLOAD_NOT_APPROVED', false, 'unpublish', 'unpublish')
|
||||||
|
);
|
||||||
|
return self::state($states, $value, $i, $prefix, $enabled, true, $checkbox);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body></body></html>
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
/* @package Joomla
|
||||||
|
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
* @extension Phoca Extension
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
jimport('joomla.html.grid');
|
||||||
|
jimport('joomla.html.html.grid');
|
||||||
|
jimport('joomla.html.html.jgrid');
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (! class_exists('JHtmlJGrid')) {
|
||||||
|
require_once( JPATH_SITE.DS.'libraries'.DS.'joomla'.DS.'html'.DS.'html'.DS.'jgrid.php' );
|
||||||
|
}
|
||||||
|
|
||||||
|
class PhocaDownloadJGrid extends JHtmlJGrid
|
||||||
|
{
|
||||||
|
|
||||||
|
public static function approved($value, $i, $prefix = '', $enabled = true, $checkbox='cb')
|
||||||
|
{
|
||||||
|
if (is_array($prefix)) {
|
||||||
|
$options = $prefix;
|
||||||
|
$enabled = array_key_exists('enabled', $options) ? $options['enabled'] : $enabled;
|
||||||
|
$checkbox = array_key_exists('checkbox', $options) ? $options['checkbox'] : $checkbox;
|
||||||
|
$prefix = array_key_exists('prefix', $options) ? $options['prefix'] : '';
|
||||||
|
}
|
||||||
|
$states = array(
|
||||||
|
1 => array('disapprove', 'COM_PHOCADOWNLOAD_APPROVED', 'COM_PHOCADOWNLOAD_NOT_APPROVE_ITEM', 'COM_PHOCADOWNLOAD_APPROVED', false, 'publish', 'publish'),
|
||||||
|
0 => array('approve', 'COM_PHOCADOWNLOAD_NOT_APPROVED', 'COM_PHOCADOWNLOAD_APPROVE_ITEM', 'COM_PHOCADOWNLOAD_NOT_APPROVED', false, 'unpublish', 'unpublish')
|
||||||
|
);
|
||||||
|
return self::state($states, $value, $i, $prefix, $enabled, true, $checkbox);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,68 @@
|
|||||||
|
<?php
|
||||||
|
/* @package Joomla
|
||||||
|
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
* @extension Phoca Extension
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||||
|
|
||||||
|
class PhocaDownloadLog
|
||||||
|
{
|
||||||
|
|
||||||
|
public static function log($fileid, $type = 1) {
|
||||||
|
|
||||||
|
$paramsC = JComponentHelper::getParams('com_phocadownload');
|
||||||
|
$logging = $paramsC->get('enable_logging', 0);
|
||||||
|
// No Logging
|
||||||
|
if ($logging == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only Downloads
|
||||||
|
if ($logging == 1 && $type == 2) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only Uploads
|
||||||
|
if ($logging == 2 && $type == 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$uri = JFactory::getURI();
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
|
||||||
|
$row = JTable::getInstance('PhocaDownloadLogging', 'Table');
|
||||||
|
$data = array();
|
||||||
|
$data['type'] = (int)$type;
|
||||||
|
$data['fileid'] = (int)$fileid;
|
||||||
|
$data['catid'] = 0;// Don't stored catid, bind the catid while displaying log
|
||||||
|
$data['userid'] = (int)$user->id;
|
||||||
|
$data['ip'] = $_SERVER["REMOTE_ADDR"];
|
||||||
|
$data['page'] = $uri->toString();
|
||||||
|
|
||||||
|
|
||||||
|
if (!$row->bind($data)) {
|
||||||
|
$this->setError($db->getErrorMsg());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$jnow = JFactory::getDate();
|
||||||
|
$row->date = $jnow->toSql();
|
||||||
|
|
||||||
|
if (!$row->check()) {
|
||||||
|
$this->setError($db->getErrorMsg());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$row->store()) {
|
||||||
|
$this->setError($db->getErrorMsg());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,83 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* @package Joomla.Framework
|
||||||
|
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*
|
||||||
|
* @component Phoca Component
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||||
|
|
||||||
|
class PhocaDownloadMail
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* param method 1 = download, 2 = upload
|
||||||
|
*/
|
||||||
|
public static function sendMail ( $id, $fileName, $method = 1 ) {
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
$sitename = $app->getCfg( 'sitename' );
|
||||||
|
$mailfrom = $app->getCfg( 'mailfrom' );
|
||||||
|
$fromname = $sitename;
|
||||||
|
$date = JHTML::_('date', gmdate('Y-m-d H:i:s'), JText::_( 'DATE_FORMAT_LC2' ));
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$params = $app->getParams();
|
||||||
|
|
||||||
|
if (isset($user->name) && $user->name != '') {
|
||||||
|
$name = $user->name;
|
||||||
|
} else {
|
||||||
|
$name = JText::_('COM_PHOCADOWNLOAD_ANONYMOUS');
|
||||||
|
}
|
||||||
|
if (isset($user->username) && $user->username != '') {
|
||||||
|
$userName = ' ('.$user->username.')';
|
||||||
|
} else {
|
||||||
|
$userName = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($method == 1) {
|
||||||
|
$subject = $sitename. ' - ' . JText::_( 'COM_PHOCADOWNLOAD_FILE_DOWNLOADED' );
|
||||||
|
$title = JText::_( 'COM_PHOCADOWNLOAD_FILE_DOWNLOADED' );
|
||||||
|
$messageText = JText::_( 'COM_PHOCADOWNLOAD_FILE') . ' "' .$fileName . '" '.JText::_('COM_PHOCADOWNLOAD_WAS_DOWNLOADED_BY'). ' '.$name . $userName.'.';
|
||||||
|
} else {
|
||||||
|
$subject = $sitename. ' - ' . JText::_( 'COM_PHOCADOWNLOAD_SUCCESS_FILE_UPLOADED' );
|
||||||
|
$title = JText::_( 'COM_PHOCADOWNLOAD_SUCCESS_NEW_FILE_UPLOADED' );
|
||||||
|
$messageText = JText::_( 'COM_PHOCADOWNLOAD_FILE') . ' "' .$fileName . '" '.JText::_('COM_PHOCADOWNLOAD_WAS_UPLOADED_BY'). ' '.$name . $userName.'.';
|
||||||
|
}
|
||||||
|
|
||||||
|
//get all super administrator
|
||||||
|
$query = 'SELECT name, email, sendEmail' .
|
||||||
|
' FROM #__users' .
|
||||||
|
' WHERE id = '.(int)$id .
|
||||||
|
' ORDER BY id';
|
||||||
|
$db->setQuery( $query );
|
||||||
|
$rows = $db->loadObjectList();
|
||||||
|
|
||||||
|
if (isset($rows[0]->email)) {
|
||||||
|
$email = $rows[0]->email;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$message = $title . "\n\n"
|
||||||
|
. JText::_( 'COM_PHOCADOWNLOAD_WEBSITE' ) . ': '. $sitename . "\n"
|
||||||
|
. JText::_( 'COM_PHOCADOWNLOAD_DATE' ) . ': '. $date . "\n"
|
||||||
|
. 'IP: ' . $_SERVER["REMOTE_ADDR"]. "\n\n"
|
||||||
|
. JText::_( 'COM_PHOCADOWNLOAD_MESSAGE' ) . ': '."\n"
|
||||||
|
. "\n\n"
|
||||||
|
. $messageText
|
||||||
|
. "\n\n"
|
||||||
|
. JText::_( 'COM_PHOCADOWNLOAD_REGARDS' ) .", \n"
|
||||||
|
. $sitename ."\n";
|
||||||
|
|
||||||
|
$subject = html_entity_decode($subject, ENT_QUOTES);
|
||||||
|
$message = html_entity_decode($message, ENT_QUOTES);
|
||||||
|
|
||||||
|
$mail = JFactory::getMailer();
|
||||||
|
$mail->sendMail($mailfrom, $fromname, $email, $subject, $message);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,152 @@
|
|||||||
|
<?php
|
||||||
|
/* @package Joomla
|
||||||
|
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
* @extension Phoca Extension
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||||
|
class PhocaDownloadOrdering
|
||||||
|
{
|
||||||
|
public static function getOrderingText ($ordering, $type = 1) {
|
||||||
|
|
||||||
|
$pref = 'c';
|
||||||
|
if ($type == 2) {
|
||||||
|
$pref = 'cc';
|
||||||
|
} else if ($type == 3) {
|
||||||
|
$pref = 'a';
|
||||||
|
}
|
||||||
|
switch ((int)$ordering) {
|
||||||
|
case 2:
|
||||||
|
$orderingOutput = 'ordering DESC';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
$orderingOutput = 'title ASC';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
$orderingOutput = 'title DESC';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 5:
|
||||||
|
$orderingOutput = 'date ASC';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 6:
|
||||||
|
$orderingOutput = 'date DESC';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 7:
|
||||||
|
$orderingOutput = 'id ASC';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 8:
|
||||||
|
$orderingOutput = 'id DESC';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 9:
|
||||||
|
$orderingOutput = 'hits ASC';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 10:
|
||||||
|
$orderingOutput = 'hits DESC';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 11:
|
||||||
|
$orderingOutput = 'filename ASC';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 12:
|
||||||
|
$orderingOutput = 'filename DESC';
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
case 15:
|
||||||
|
$orderingOutput = 'count ASC';
|
||||||
|
$pref = 'r';
|
||||||
|
break;
|
||||||
|
case 16:
|
||||||
|
$orderingOutput = 'count DESC';
|
||||||
|
$pref = 'r';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 13:
|
||||||
|
$orderingOutput = 'average ASC';
|
||||||
|
$pref = 'r';
|
||||||
|
break;
|
||||||
|
case 14:
|
||||||
|
$orderingOutput = 'average DESC';
|
||||||
|
$pref = 'r';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
default:
|
||||||
|
$orderingOutput = 'ordering ASC';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return $pref . '.' . $orderingOutput;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function renderOrderingFront( $selected, $type = 1) {
|
||||||
|
|
||||||
|
switch($type) {
|
||||||
|
case 2:
|
||||||
|
$typeOrdering = PhocaDownloadOrdering::getOrderingCategoryArray();
|
||||||
|
$ordering = 'catordering';
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
$typeOrdering = PhocaDownloadOrdering::getOrderingFileArray();
|
||||||
|
$ordering = 'fileordering';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$html = JHTML::_('select.genericlist', $typeOrdering, $ordering, 'class="inputbox" size="1" onchange="this.form.submit()"', 'value', 'text', $selected);
|
||||||
|
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getOrderingFileArray() {
|
||||||
|
$imgOrdering = array(
|
||||||
|
1 => JText::_('COM_PHOCADOWNLOAD_ORDERING_ASC'),
|
||||||
|
2 => JText::_('COM_PHOCADOWNLOAD_ORDERING_DESC'),
|
||||||
|
3 => JText::_('COM_PHOCADOWNLOAD_TITLE_ASC'),
|
||||||
|
4 => JText::_('COM_PHOCADOWNLOAD_TITLE_DESC'),
|
||||||
|
5 => JText::_('COM_PHOCADOWNLOAD_DATE_ASC'),
|
||||||
|
6 => JText::_('COM_PHOCADOWNLOAD_DATE_DESC'),
|
||||||
|
//7 => JText::_('COM_PHOCADOWNLOAD_ID_ASC'),
|
||||||
|
//8 => JText::_('COM_PHOCADOWNLOAD_ID_DESC'),
|
||||||
|
11 => JText::_('COM_PHOCADOWNLOAD_FILENAME_ASC'),
|
||||||
|
12 => JText::_('COM_PHOCADOWNLOAD_FILENAME_DESC'),
|
||||||
|
|
||||||
|
15 => JText::_('COM_PHOCADOWNLOAD_COUNT_ASC'),
|
||||||
|
16 => JText::_('COM_PHOCADOWNLOAD_COUNT_DESC'),
|
||||||
|
13 => JText::_('COM_PHOCADOWNLOAD_AVERAGE_ASC'),
|
||||||
|
14 => JText::_('COM_PHOCADOWNLOAD_AVERAGE_DESC'),
|
||||||
|
9 => JText::_('COM_PHOCADOWNLOAD_DOWNLOADS_ASC'),
|
||||||
|
10 => JText::_('COM_PHOCADOWNLOAD_DOWNLOADS_DESC'));
|
||||||
|
return $imgOrdering;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getOrderingCategoryArray() {
|
||||||
|
$imgOrdering = array(
|
||||||
|
1 => JText::_('COM_PHOCADOWNLOAD_ORDERING_ASC'),
|
||||||
|
2 => JText::_('COM_PHOCADOWNLOAD_ORDERING_DESC'),
|
||||||
|
3 => JText::_('COM_PHOCADOWNLOAD_TITLE_ASC'),
|
||||||
|
4 => JText::_('COM_PHOCADOWNLOAD_TITLE_DESC'),
|
||||||
|
5 => JText::_('COM_PHOCADOWNLOAD_DATE_ASC'),
|
||||||
|
6 => JText::_('COM_PHOCADOWNLOAD_DATE_DESC'),
|
||||||
|
//7 => JText::_('COM_PHOCADOWNLOAD_ID_ASC'),
|
||||||
|
//8 => JText::_('COM_PHOCADOWNLOAD_ID_DESC'),
|
||||||
|
11 => JText::_('COM_PHOCADOWNLOAD_COUNT_ASC'),
|
||||||
|
12 => JText::_('COM_PHOCADOWNLOAD_COUNT_DESC'),
|
||||||
|
13 => JText::_('COM_PHOCADOWNLOAD_AVERAGE_ASC'),
|
||||||
|
14 => JText::_('COM_PHOCADOWNLOAD_AVERAGE_DESC'),
|
||||||
|
15 => JText::_('COM_PHOCADOWNLOAD_HITS_ASC'),
|
||||||
|
16 => JText::_('COM_PHOCADOWNLOAD_HITS_DESC'));
|
||||||
|
return $imgOrdering;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
/* @package Joomla
|
||||||
|
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
* @extension Phoca Extension
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||||
|
jimport('joomla.html.pagination');
|
||||||
|
class PhocaDownloadPagination extends JPagination
|
||||||
|
{
|
||||||
|
function getLimitBox() {
|
||||||
|
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$paramsC = JComponentHelper::getParams('com_phocadownload') ;
|
||||||
|
$pagination = $paramsC->get( 'pagination', '5,10,15,20,50,100' );
|
||||||
|
$paginationArray = explode( ',', $pagination );
|
||||||
|
|
||||||
|
// Initialize variables
|
||||||
|
$limits = array ();
|
||||||
|
|
||||||
|
foreach ($paginationArray as $paginationValue) {
|
||||||
|
$limits[] = JHTML::_('select.option', $paginationValue);
|
||||||
|
}
|
||||||
|
$limits[] = JHTML::_('select.option', '0', JText::_('COM_PHOCADOWNLOAD_ALL'));
|
||||||
|
|
||||||
|
$selected = $this->viewall ? 0 : $this->limit;
|
||||||
|
|
||||||
|
// Build the select list
|
||||||
|
if ($app->isAdmin()) {
|
||||||
|
$html = JHTML::_('select.genericlist', $limits, 'limit', 'class="inputbox" size="1" onchange="submitform();"', 'value', 'text', $selected);
|
||||||
|
} else {
|
||||||
|
$html = JHTML::_('select.genericlist', $limits, 'limit', 'class="inputbox input-mini" size="1" onchange="this.form.submit()"', 'value', 'text', $selected);
|
||||||
|
}
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,88 @@
|
|||||||
|
<?php
|
||||||
|
/* @package Joomla
|
||||||
|
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
* @extension Phoca Extension
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||||
|
|
||||||
|
class PhocaDownloadPath
|
||||||
|
{
|
||||||
|
public static function getPathSet( $manager = '') {
|
||||||
|
|
||||||
|
$group = PhocaDownloadSettings::getManagerGroup($manager);
|
||||||
|
|
||||||
|
// Params
|
||||||
|
$paramsC = JComponentHelper::getParams( 'com_phocadownload' );
|
||||||
|
// Folder where to stored files for download
|
||||||
|
$downloadFolder = $paramsC->get( 'download_folder', 'phocadownload' );
|
||||||
|
$downloadFolderPap = $paramsC->get( 'download_folder_pap', 'phocadownloadpap' );
|
||||||
|
// Absolute path which can be outside public_html - if this will be set, download folder will be ignored
|
||||||
|
$absolutePath = $paramsC->get( 'absolute_path', '' );
|
||||||
|
|
||||||
|
// Path of preview and play
|
||||||
|
$downloadFolderPap = JPath::clean($downloadFolderPap);
|
||||||
|
$path['orig_abs_pap'] = JPATH_ROOT . DS . $downloadFolderPap;
|
||||||
|
$path['orig_abs_pap_ds'] = $path['orig_abs_pap'] . DS ;
|
||||||
|
|
||||||
|
if ($group['f'] == 2) {
|
||||||
|
// Images
|
||||||
|
$path['orig_abs'] = JPATH_ROOT . DS . 'images' . DS . 'phocadownload' ;
|
||||||
|
$path['orig_abs_ds'] = $path['orig_abs'] . DS ;
|
||||||
|
$path['orig_abs_user_upload'] = $path['orig_abs'] . DS . 'userupload' ;
|
||||||
|
$path['orig_abs_user_upload_pap']= $path['orig_abs_pap'] . DS . 'userupload' ;
|
||||||
|
$path['orig_rel_ds'] = '../images/phocadownload/';
|
||||||
|
} else if ($group['f'] == 3) {
|
||||||
|
// Play and Preview
|
||||||
|
$path['orig_abs'] = $path['orig_abs_pap'];
|
||||||
|
$path['orig_abs_ds'] = $path['orig_abs_pap_ds'];
|
||||||
|
$path['orig_abs_user_upload'] = $path['orig_abs'] . DS . 'userupload' ;
|
||||||
|
$path['orig_abs_user_upload_pap']= $path['orig_abs_pap'] . DS . 'userupload' ;
|
||||||
|
$path['orig_rel_ds'] = '../'.str_replace('/', DS, JPath::clean($downloadFolderPap)).'/';
|
||||||
|
} else {
|
||||||
|
// Standard Path
|
||||||
|
if ($absolutePath != '') {
|
||||||
|
$downloadFolder = str_replace('/', DS, JPath::clean($absolutePath));
|
||||||
|
$path['orig_abs'] = str_replace('/', DS, JPath::clean($absolutePath));
|
||||||
|
$path['orig_abs_ds'] = JPath::clean($path['orig_abs'] . DS) ;
|
||||||
|
$path['orig_abs_user_upload'] = JPath::clean($path['orig_abs'] . DS . 'userupload') ;
|
||||||
|
$path['orig_abs_user_upload_pap']= JPath::clean($path['orig_abs_pap'] . DS . 'userupload') ;
|
||||||
|
//$downloadFolderRel = str_replace(DS, '/', JPath::clean($downloadFolder));
|
||||||
|
$path['orig_rel_ds'] = '';
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$downloadFolder = str_replace('/', DS, JPath::clean($downloadFolder));
|
||||||
|
$path['orig_abs'] = JPATH_ROOT . DS . $downloadFolder ;
|
||||||
|
$path['orig_abs_ds'] = JPATH_ROOT . DS . $downloadFolder . DS ;
|
||||||
|
$path['orig_abs_user_upload'] = $path['orig_abs'] . DS . 'userupload' ;
|
||||||
|
$path['orig_abs_user_upload_pap']= $path['orig_abs_pap'] . DS . 'userupload' ;
|
||||||
|
|
||||||
|
$downloadFolderRel = str_replace(DS, '/', JPath::clean($downloadFolder));
|
||||||
|
$path['orig_rel_ds'] = '../' . $downloadFolderRel .'/';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getPathMedia() {
|
||||||
|
|
||||||
|
//TODO create a singleton
|
||||||
|
$option = 'com_phocadownload';
|
||||||
|
$instance = new StdClass();
|
||||||
|
$baseFront = JURI::root(true);
|
||||||
|
$instance->media_css_abs = JPATH_ROOT . DS . 'media'. DS . $option . DS . 'css' . DS;
|
||||||
|
$instance->media_img_abs = JPATH_ROOT . DS . 'media'. DS . $option . DS . 'images' . DS;
|
||||||
|
$instance->media_js_abs = JPATH_ROOT . DS . 'media'. DS . $option . DS . 'js' . DS;
|
||||||
|
$instance->media_css_rel = 'media/'. $option .'/css/';
|
||||||
|
$instance->media_img_rel = 'media/'. $option .'/images/';
|
||||||
|
$instance->media_js_rel = 'components/'. $option .'/assets/';
|
||||||
|
$instance->media_css_rel_full = $baseFront . '/' . $instance->media_css_rel;
|
||||||
|
$instance->media_img_rel_full = $baseFront . '/' . $instance->media_img_rel;
|
||||||
|
$instance->media_js_rel_full = $baseFront . '/' . $instance->media_js_rel;
|
||||||
|
return $instance;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,393 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @version $Id: route.php 11190 2008-10-20 00:49:55Z ian $
|
||||||
|
* @package Joomla
|
||||||
|
* @subpackage Content
|
||||||
|
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||||
|
* @license GNU/GPL, see LICENSE.php
|
||||||
|
* Joomla! is free software. This version may have been modified pursuant to the
|
||||||
|
* GNU General Public License, and as distributed it includes or is derivative
|
||||||
|
* of works licensed under the GNU General Public License or other free or open
|
||||||
|
* source software licenses. See COPYRIGHT.php for copyright notices and
|
||||||
|
* details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// no direct access
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
// Component Helper
|
||||||
|
jimport('joomla.application.component.helper');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Content Component Route Helper
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
* @package Joomla
|
||||||
|
* @subpackage Content
|
||||||
|
* @since 1.5
|
||||||
|
*/
|
||||||
|
class PhocaDownloadRoute
|
||||||
|
{
|
||||||
|
|
||||||
|
public static function getCategoriesRoute() {
|
||||||
|
// TEST SOLUTION
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$menu = $app->getMenu();
|
||||||
|
$active = $menu->getActive();
|
||||||
|
|
||||||
|
$activeId = 0;
|
||||||
|
if (isset($active->id)){
|
||||||
|
$activeId = $active->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
$itemId = 0;
|
||||||
|
$option = $app->input->get( 'option', '', 'string' );
|
||||||
|
$view = $app->input->get( 'view', '', 'string' );
|
||||||
|
if ($option == 'com_phocadownload' && $view == 'category') {
|
||||||
|
if ((int)$activeId > 0) {
|
||||||
|
// 2) if there are two menu links, try to select the one active
|
||||||
|
$itemId = $activeId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$needles = array(
|
||||||
|
'categories' => ''
|
||||||
|
);
|
||||||
|
|
||||||
|
$link = 'index.php?option=com_phocadownload&view=categories';
|
||||||
|
|
||||||
|
if($item = self::_findItem($needles, 1)) {
|
||||||
|
if(isset($item->query['layout'])) {
|
||||||
|
$link .= '&layout='.$item->query['layout'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1) get standard item id if exists
|
||||||
|
if ((int)$itemId > 0) {
|
||||||
|
$link .= '&Itemid='.(int)$itemId;
|
||||||
|
} else if (isset($item->id)) {
|
||||||
|
$link .= '&Itemid='.(int)$item->id;;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*if (isset($item->id)) {
|
||||||
|
$link .= '&Itemid='.$item->id;
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
return $link;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getCategoryRoute($catid, $catidAlias = '') {
|
||||||
|
|
||||||
|
// TEST SOLUTION
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$menu = $app->getMenu();
|
||||||
|
$active = $menu->getActive();
|
||||||
|
$option = $app->input->get( 'option', '', 'string' );
|
||||||
|
|
||||||
|
$activeId = 0;
|
||||||
|
if (isset($active->id)){
|
||||||
|
$activeId = $active->id;
|
||||||
|
}
|
||||||
|
if ((int)$activeId > 0 && $option == 'com_phocadownload') {
|
||||||
|
$needles = array(
|
||||||
|
'category' => (int)$catid,
|
||||||
|
'categories' => (int)$activeId
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$needles = array(
|
||||||
|
'category' => (int)$catid,
|
||||||
|
'categories' => ''
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($catidAlias != '') {
|
||||||
|
$catid = $catid . ':' . $catidAlias;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Create the link
|
||||||
|
$link = 'index.php?option=com_phocadownload&view=category&id='. $catid;
|
||||||
|
|
||||||
|
if($item = self::_findItem($needles)) {
|
||||||
|
if(isset($item->query['layout'])) {
|
||||||
|
$link .= '&layout='.$item->query['layout'];
|
||||||
|
}
|
||||||
|
if(isset($item->id)) {
|
||||||
|
$link .= '&Itemid='.$item->id;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return $link;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getCategoryRouteByTag($tagId)
|
||||||
|
{
|
||||||
|
$needles = array(
|
||||||
|
'category' => '',
|
||||||
|
//'section' => (int) $sectionid,
|
||||||
|
'categories' => ''
|
||||||
|
);
|
||||||
|
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
|
||||||
|
$query = 'SELECT a.id, a.title, a.link_ext, a.link_cat'
|
||||||
|
.' FROM #__phocadownload_tags AS a'
|
||||||
|
.' WHERE a.id = '.(int)$tagId;
|
||||||
|
|
||||||
|
$db->setQuery($query, 0, 1);
|
||||||
|
$tag = $db->loadObject();
|
||||||
|
|
||||||
|
if (!$db->query()) {
|
||||||
|
$this->setError($db->getErrorMsg());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Create the link
|
||||||
|
if (isset($tag->id)) {
|
||||||
|
$link = 'index.php?option=com_phocadownload&view=category&id=tag&tagid='.(int)$tag->id;
|
||||||
|
} else {
|
||||||
|
$link = 'index.php?option=com_phocadownload&view=category&id=tag&tagid=0';
|
||||||
|
}
|
||||||
|
|
||||||
|
if($item = self::_findItem($needles)) {
|
||||||
|
if(isset($item->query['layout'])) {
|
||||||
|
$link .= '&layout='.$item->query['layout'];
|
||||||
|
}
|
||||||
|
if(isset($item->id)) {
|
||||||
|
$link .= '&Itemid='.$item->id;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return $link;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function getFileRoute($id, $catid = 0, $idAlias = '', $catidAlias = '', $sectionid = 0, $type = 'file', $suffix = '')
|
||||||
|
{
|
||||||
|
// TEST SOLUTION
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$menu = $app->getMenu();
|
||||||
|
$active = $menu->getActive();
|
||||||
|
$option = $app->input->get( 'option', '', 'string' );
|
||||||
|
|
||||||
|
$activeId = 0;
|
||||||
|
if (isset($active->id)){
|
||||||
|
$activeId = $active->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((int)$activeId > 0 && $option == 'com_phocadownload') {
|
||||||
|
|
||||||
|
$needles = array(
|
||||||
|
'file' => (int) $id,
|
||||||
|
'category' => (int) $catid,
|
||||||
|
'categories' => (int)$activeId
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$needles = array(
|
||||||
|
'file' => (int) $id,
|
||||||
|
'category' => (int) $catid,
|
||||||
|
'categories' => ''
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($idAlias != '') {
|
||||||
|
$id = $id . ':' . $idAlias;
|
||||||
|
}
|
||||||
|
if ($catidAlias != '') {
|
||||||
|
$catid = $catid . ':' . $catidAlias;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Create the link
|
||||||
|
|
||||||
|
switch ($type)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
case 'play':
|
||||||
|
$link = 'index.php?option=com_phocadownload&view=play&id='. $id.'&tmpl=component';
|
||||||
|
break;
|
||||||
|
case 'detail':
|
||||||
|
$link = 'index.php?option=com_phocadownload&view=file&id='. $id.'&tmpl=component';
|
||||||
|
break;
|
||||||
|
case 'download':
|
||||||
|
$link = 'index.php?option=com_phocadownload&view=category&download='. $id . '&id='. $catid;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$link = 'index.php?option=com_phocadownload&view=file&id='. $id;
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($item = self::_findItem($needles)) {
|
||||||
|
if (isset($item->id)) {
|
||||||
|
$link .= '&Itemid='.$item->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($suffix != '') {
|
||||||
|
$link .= '&'.$suffix;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $link;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getDownloadRoute($id, $catid, $token, $directDownload = 1)
|
||||||
|
{
|
||||||
|
$needles = array(
|
||||||
|
'download' => '',
|
||||||
|
'categories' => '',
|
||||||
|
'category' => (int) $catid,
|
||||||
|
'file' => (int) $id
|
||||||
|
);
|
||||||
|
if ($directDownload == 1) {
|
||||||
|
$link = 'index.php?option=com_phocadownload&view=download&id='. $token.'&download=1&' . JSession::getFormToken() . '=1';
|
||||||
|
} else {
|
||||||
|
$link = 'index.php?option=com_phocadownload&view=download&id='. $token;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($item = self::_findItem($needles)) {
|
||||||
|
if (isset($item->id)) {
|
||||||
|
$link .= '&Itemid='.$item->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $link;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getFeedRoute($id, $catid = 0, $sectionid = 0, $type = 'rss')
|
||||||
|
{
|
||||||
|
$needles = array(
|
||||||
|
'categories' => '',
|
||||||
|
//'section' => (int) $sectionid,
|
||||||
|
'category' => (int) $catid,
|
||||||
|
'file' => (int) $id
|
||||||
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
if ($idAlias != '') {
|
||||||
|
$id = $id . ':' . $idAlias;
|
||||||
|
}
|
||||||
|
if ($catidAlias != '') {
|
||||||
|
$catid = $catid . ':' . $catidAlias;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
//Create the link
|
||||||
|
$link = 'index.php?option=com_phocadownload&view=feed&id='.$id.'&format=feed&type='.$type;
|
||||||
|
|
||||||
|
if($item = self::_findItem($needles, 1)) {
|
||||||
|
if (isset($item->id)) {
|
||||||
|
$link .= '&Itemid='.$item->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $link;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getGuestbookRoute($id, $title)
|
||||||
|
{
|
||||||
|
$needles = array(
|
||||||
|
'guestbook' => (int) $id
|
||||||
|
);
|
||||||
|
|
||||||
|
$link = 'index.php?option=com_phocaguestbook&view=guestbook&cid='.(int)$id.'&reporttitle='.strip_tags($title).'&tmpl=component';
|
||||||
|
|
||||||
|
if($item = self::_findItem($needles, 1, 'com_phocaguestbook')) {
|
||||||
|
if (isset($item->id)) {
|
||||||
|
$link .= '&Itemid='.$item->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $link;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
function getSectionRoute($sectionid, $sectionidAlias = '')
|
||||||
|
{
|
||||||
|
$needles = array(
|
||||||
|
'section' => (int) $sectionid,
|
||||||
|
'sections' => ''
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($sectionidAlias != '') {
|
||||||
|
$sectionid = $sectionid . ':' . $sectionidAlias;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Create the link
|
||||||
|
$link = 'index.php?option=com_phocadownload&view=section&id='.$sectionid;
|
||||||
|
|
||||||
|
if($item = self::_findItem($needles)) {
|
||||||
|
if(isset($item->query['layout'])) {
|
||||||
|
$link .= '&layout='.$item->query['layout'];
|
||||||
|
}
|
||||||
|
$link .= '&Itemid='.$item->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $link;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getSectionsRoute()
|
||||||
|
{
|
||||||
|
$needles = array(
|
||||||
|
'sections' => ''
|
||||||
|
);
|
||||||
|
|
||||||
|
//Create the link
|
||||||
|
$link = 'index.php?option=com_phocadownload&view=sections';
|
||||||
|
|
||||||
|
if($item = self::_findItem($needles)) {
|
||||||
|
if(isset($item->query['layout'])) {
|
||||||
|
$link .= '&layout='.$item->query['layout'];
|
||||||
|
}
|
||||||
|
if (isset($item->id)) {
|
||||||
|
$link .= '&Itemid='.$item->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $link;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
protected static function _findItem($needles, $notCheckId = 0, $component = 'com_phocadownload')
|
||||||
|
{
|
||||||
|
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$menus = $app->getMenu('site', array());
|
||||||
|
$items = $menus->getItems('component', $component);
|
||||||
|
|
||||||
|
if(!$items) {
|
||||||
|
return $app->input->get('Itemid', 0, '', 'int');
|
||||||
|
//return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$match = null;
|
||||||
|
|
||||||
|
|
||||||
|
foreach($needles as $needle => $id)
|
||||||
|
{
|
||||||
|
|
||||||
|
if ($notCheckId == 0) {
|
||||||
|
foreach($items as $item) {
|
||||||
|
if ((@$item->query['view'] == $needle) && (@$item->query['id'] == $id)) {
|
||||||
|
$match = $item;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
foreach($items as $item) {
|
||||||
|
if (@$item->query['view'] == $needle) {
|
||||||
|
$match = $item;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($match)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $match;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,288 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* @package Joomla.Framework
|
||||||
|
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*
|
||||||
|
* @component Phoca Component
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||||
|
|
||||||
|
class PhocaDownloadRate
|
||||||
|
{
|
||||||
|
public static function updateVoteStatisticsFile( $fileid ) {
|
||||||
|
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
|
||||||
|
// Get AVG and COUNT
|
||||||
|
$query = 'SELECT COUNT(vs.id) AS count, AVG(vs.rating) AS average'
|
||||||
|
.' FROM #__phocadownload_file_votes AS vs'
|
||||||
|
.' WHERE vs.fileid = '.(int) $fileid;
|
||||||
|
// .' AND vs.published = 1';
|
||||||
|
$db->setQuery($query, 0, 1);
|
||||||
|
$votesStatistics = $db->loadObject();
|
||||||
|
// if no count, set the average to 0
|
||||||
|
if($votesStatistics->count == 0) {
|
||||||
|
$votesStatistics->count = (int)0;
|
||||||
|
$votesStatistics->average = (float)0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($votesStatistics->count) && isset($votesStatistics->average)) {
|
||||||
|
// Insert or update
|
||||||
|
$query = 'SELECT vs.id AS id'
|
||||||
|
.' FROM #__phocadownload_file_votes_statistics AS vs'
|
||||||
|
.' WHERE vs.fileid = '.(int) $fileid
|
||||||
|
.' ORDER BY vs.id';
|
||||||
|
$db->setQuery($query, 0, 1);
|
||||||
|
$votesStatisticsId = $db->loadObject();
|
||||||
|
|
||||||
|
// Yes, there is id (UPDATE) x No, there isn't (INSERT)
|
||||||
|
if (!empty($votesStatisticsId->id)) {
|
||||||
|
|
||||||
|
$query = 'UPDATE #__phocadownload_file_votes_statistics'
|
||||||
|
.' SET count = ' .(int)$votesStatistics->count
|
||||||
|
.' , average = ' .(float)$votesStatistics->average
|
||||||
|
.' WHERE fileid = '.(int) $fileid;
|
||||||
|
$db->setQuery($query);
|
||||||
|
|
||||||
|
if (!$db->query()) {
|
||||||
|
$this->setError('Database Error Voting 1');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$query = 'INSERT into #__phocadownload_file_votes_statistics'
|
||||||
|
.' (id, fileid, count, average)'
|
||||||
|
.' VALUES (null, '.(int)$fileid
|
||||||
|
.' , '.(int)$votesStatistics->count
|
||||||
|
.' , '.(float)$votesStatistics->average
|
||||||
|
.')';
|
||||||
|
$db->setQuery($query);
|
||||||
|
|
||||||
|
if (!$db->query()) {
|
||||||
|
$this->setError('Database Error Voting 2');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getVotesStatisticsFile($id) {
|
||||||
|
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
$query = 'SELECT vs.count AS count, vs.average AS average'
|
||||||
|
.' FROM #__phocadownload_file_votes_statistics AS vs'
|
||||||
|
.' WHERE vs.fileid = '.(int) $id
|
||||||
|
.' ORDER BY vs.fileid';
|
||||||
|
$db->setQuery($query, 0, 1);
|
||||||
|
$votesStatistics = $db->loadObject();
|
||||||
|
|
||||||
|
return $votesStatistics;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function checkUserVoteFile($fileid, $userid) {
|
||||||
|
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
$query = 'SELECT v.id AS id'
|
||||||
|
.' FROM #__phocadownload_file_votes AS v'
|
||||||
|
.' WHERE v.fileid = '. (int)$fileid
|
||||||
|
.' AND v.userid = '. (int)$userid
|
||||||
|
.' ORDER BY v.id';
|
||||||
|
$db->setQuery($query, 0, 1);
|
||||||
|
$checkUserVote = $db->loadObject();
|
||||||
|
if ($checkUserVote) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function renderRateFile($id, $displayRating, $small = 1, $refresh = false) {
|
||||||
|
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$neededAccessLevels = PhocaDownloadAccess::getNeededAccessLevels();
|
||||||
|
$access = PhocaDownloadAccess::isAccess($user->getAuthorisedViewLevels(), $neededAccessLevels);
|
||||||
|
|
||||||
|
|
||||||
|
if ($small == 1) {
|
||||||
|
$smallO = '-small';
|
||||||
|
$ratio = 18;
|
||||||
|
} else {
|
||||||
|
$smallO = '';
|
||||||
|
$ratio = 22;
|
||||||
|
}
|
||||||
|
|
||||||
|
$o = '';
|
||||||
|
|
||||||
|
//.$rating['urlvote'].$amp.'controller=detail&task=rate&rating=1
|
||||||
|
//$amp = PhocaDownloadAccess::setQuestionmarkOrAmp($rating['urlvote']);
|
||||||
|
$href = 'javascript:void(0);';
|
||||||
|
|
||||||
|
if ((int)$displayRating != 1) {
|
||||||
|
return '';
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$rating['alreadyratedfile'] = self::checkUserVoteFile( (int)$id, (int)$user->id );
|
||||||
|
|
||||||
|
$rating['notregisteredfile'] = true;
|
||||||
|
//$rating['usernamefile'] = '';
|
||||||
|
if ($access > 0) {
|
||||||
|
$rating['notregisteredfile'] = false;
|
||||||
|
$rating['usernamefile'] = $user->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
$rating['votescountfile'] = 0;
|
||||||
|
$rating['votesaveragefile'] = 0;
|
||||||
|
$rating['voteswidthfile'] = 0;
|
||||||
|
$votesStatistics = self::getVotesStatisticsFile((int)$id);
|
||||||
|
if (!empty($votesStatistics->count)) {
|
||||||
|
$rating['votescountfile'] = $votesStatistics->count;
|
||||||
|
}
|
||||||
|
if (!empty($votesStatistics->average)) {
|
||||||
|
$rating['votesaveragefile'] = $votesStatistics->average;
|
||||||
|
if ($rating['votesaveragefile'] > 0) {
|
||||||
|
$rating['votesaveragefile'] = round(((float)$rating['votesaveragefile'] / 0.5)) * 0.5;
|
||||||
|
$rating['voteswidthfile'] = $ratio * $rating['votesaveragefile'];
|
||||||
|
} else {
|
||||||
|
$rating['votesaveragefile'] = (int)0;// not float displaying
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Leave message for already voted images
|
||||||
|
//$vote = JRequest::getVar('vote', 0, '', 'int');
|
||||||
|
$voteMsg = JText::_('COM_PHOCADOWNLOAD_RATING_ALREADY_RATED_FILE');
|
||||||
|
//if ($vote == 1) {
|
||||||
|
// $voteMsg = JText::_('COM_PHOCADOWNLOAD_ALREADY_RATED_FILE_THANKS');
|
||||||
|
//}
|
||||||
|
|
||||||
|
$rating['votestextimg'] = 'VOTE';
|
||||||
|
if ((int)$rating['votescountfile'] > 1) {
|
||||||
|
$rating['votestextimg'] = 'VOTES';
|
||||||
|
}
|
||||||
|
|
||||||
|
$o .= '<div style="float:left;"><strong>'
|
||||||
|
. JText::_('COM_PHOCADOWNLOAD_RATING'). '</strong>: ' . $rating['votesaveragefile'] .' / '
|
||||||
|
.$rating['votescountfile'] . ' ' . JText::_('COM_PHOCADOWNLOAD_'.$rating['votestextimg']). ' </div>';
|
||||||
|
|
||||||
|
if ($rating['alreadyratedfile']) {
|
||||||
|
$o .= '<div style="float:left;"><ul class="star-rating'.$smallO.'">'
|
||||||
|
.'<li class="current-rating" style="width:'.$rating['voteswidthfile'].'px"></li>'
|
||||||
|
.'<li><span class="star1"></span></li>';
|
||||||
|
|
||||||
|
for ($i = 2;$i < 6;$i++) {
|
||||||
|
$o .= '<li><span class="stars'.$i.'"></span></li>';
|
||||||
|
}
|
||||||
|
$o .= '</ul></div>';
|
||||||
|
|
||||||
|
$or ='<div class="pd-result" id="pdresult'.(int)$id.'" style="float:left;margin-left:5px">'.JText::_('COM_PHOCADOWNLOAD_RATING_ALREADY_RATED_FILE').'</div>';
|
||||||
|
|
||||||
|
} else if ($rating['notregisteredfile']) {
|
||||||
|
|
||||||
|
$o .= '<div style="float:left;"><ul class="star-rating'.$smallO.'">'
|
||||||
|
.'<li class="current-rating" style="width:'.$rating['voteswidthfile'].'px"></li>'
|
||||||
|
.'<li><span class="star1"></span></li>';
|
||||||
|
|
||||||
|
for ($i = 2;$i < 6;$i++) {
|
||||||
|
$o .= '<li><span class="stars'.$i.'"></span></li>';
|
||||||
|
}
|
||||||
|
$o .= '</ul></div>';
|
||||||
|
|
||||||
|
$or ='<div class="pd-result" id="pdresult'.(int)$id.'" style="float:left;margin-left:5px">'.JText::_('COM_PHOCADOWNLOAD_ONLY_REGISTERED_LOGGED_RATE_FILE').'</div>';
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$o .= '<div style="float:left;"><ul class="star-rating'.$smallO.'">'
|
||||||
|
.'<li class="current-rating" style="width:'.$rating['voteswidthfile'].'px"></li>'
|
||||||
|
.'<li><a href="'.$href.'" onclick="pdRating('.(int)$id.', 1)" title="1 '. JText::_('COM_PHOCADOWNLOAD_STAR_OUT_OF').' 5" class="star1">1</a></li>';
|
||||||
|
|
||||||
|
for ($i = 2;$i < 6;$i++) {
|
||||||
|
$o .= '<li><a href="'.$href.'" onclick="pdRating('.(int)$id.', '.$i.')" title="'.$i.' '. JText::_('COM_PHOCADOWNLOAD_STARS_OUT_OF').' 5" class="stars'.$i.'">'.$i.'</a></li>';
|
||||||
|
}
|
||||||
|
$o .= '</ul></div>';
|
||||||
|
|
||||||
|
$or ='<div class="pd-result" id="pdresult'.(int)$id.'" style="float:left;margin-left:5px"></div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($refresh == true) {
|
||||||
|
return $o;//we are in Ajax, return only content of pdvoting div
|
||||||
|
} else {
|
||||||
|
return '<div id="pdvoting'.(int)$id.'">'.$o.'</div>' .$or ;//not in ajax, return the contend in div
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function renderRateFileJS($small = 1) {
|
||||||
|
|
||||||
|
$document = JFactory::getDocument();
|
||||||
|
$url = 'index.php?option=com_phocadownload&view=ratingfilea&task=rate&format=json&'.JSession::getFormToken().'=1';
|
||||||
|
$urlRefresh = 'index.php?option=com_phocadownload&view=ratingfilea&task=refreshrate&small='.$small.'&format=json&'.JSession::getFormToken().'=1';
|
||||||
|
$imgLoadingUrl = JURI::base(). 'media/com_phocadownload/images/icon-loading2.gif';
|
||||||
|
$imgLoadingHTML = '<img src="'.$imgLoadingUrl.'" alt="" />';
|
||||||
|
$js = '<script type="text/javascript">' . "\n" . '<!--' . "\n";
|
||||||
|
//$js .= 'window.addEvent("domready",function() {
|
||||||
|
$js .= '
|
||||||
|
function pdRating(id, vote) {
|
||||||
|
|
||||||
|
var result = "#pdresult" + id;
|
||||||
|
var resultvoting = "#pdvoting" + id;
|
||||||
|
|
||||||
|
jQuery(result).html("'.addslashes($imgLoadingHTML).'");
|
||||||
|
var dataPost = {"ratingId": id, "ratingVote": vote, "format":"json"};
|
||||||
|
var dataPost2= {"ratingId": id, "ratingVote": vote, "format":"json"};
|
||||||
|
|
||||||
|
phRequestActive = jQuery.ajax({
|
||||||
|
url: "'.$url.'",
|
||||||
|
type:\'POST\',
|
||||||
|
data:dataPost,
|
||||||
|
dataType:\'JSON\',
|
||||||
|
success:function(data1){
|
||||||
|
if ( data1.status == 1 ){
|
||||||
|
jQuery(result).html(data1.message);
|
||||||
|
|
||||||
|
phRequestActive2 = jQuery.ajax({
|
||||||
|
url: "'.$urlRefresh.'",
|
||||||
|
type:\'POST\',
|
||||||
|
data:dataPost2,
|
||||||
|
dataType:\'JSON\',
|
||||||
|
success:function(data2){
|
||||||
|
if ( data2.status == 1 ){
|
||||||
|
alert(data2.status);
|
||||||
|
jQuery(resultvoting).html(data2.message);
|
||||||
|
} else {
|
||||||
|
jQuery(resultvoting).html(data2.message);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error:function(data2){
|
||||||
|
jQuery(resultvoting).html("'.JText::_('COM_PHOCADOWNLOAD_ERROR_REQUESTING_RATING').'");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
jQuery(result).html(data1.message);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error:function(data1){
|
||||||
|
jQuery(result).html("'.JText::_('COM_PHOCADOWNLOAD_ERROR_REQUESTING_RATING').'");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}';
|
||||||
|
|
||||||
|
|
||||||
|
$js .= "\n" . '//-->' . "\n" .'</script>';
|
||||||
|
$document->addCustomTag($js);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,327 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* @package Joomla.Framework
|
||||||
|
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*
|
||||||
|
* @component Phoca Component
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
|
||||||
|
*/
|
||||||
|
|
||||||
|
class PhocaDownloadLayout
|
||||||
|
{
|
||||||
|
public $params;
|
||||||
|
public $filePath;
|
||||||
|
public $iconPath;
|
||||||
|
public $cssImagePath;
|
||||||
|
public $fileAbsPath;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
if (empty($params)) {
|
||||||
|
$this->params = JComponentHelper::getParams('com_phocadownload');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->filePath == '') {
|
||||||
|
$this->filePath = PhocaDownloadPath::getPathSet('file');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->iconPath == '') {
|
||||||
|
$this->iconPath = PhocaDownloadPath::getPathSet('icon');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->cssImagePath == '') {
|
||||||
|
$this->cssImagePath = str_replace('../', JURI::base(true) . '/', $this->iconPath['orig_rel_ds']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->fileAbsPath == '') {
|
||||||
|
$this->fileAbsPath = $this->filePath['orig_abs_ds'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getName($title, $filename, $preferTitle = 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
$name = $title;
|
||||||
|
$fon = $this->params->get('filename_or_name', 'filename');
|
||||||
|
|
||||||
|
if ($fon == 'title') {
|
||||||
|
$name = $title;
|
||||||
|
} else if ($fon == 'filename') {
|
||||||
|
$name = PhocaDownloadFile::getTitleFromFilenameWithExt($filename);
|
||||||
|
} else if ($fon == 'filenametitle') {
|
||||||
|
if ($preferTitle == 1) {
|
||||||
|
$name = $title;
|
||||||
|
} else {
|
||||||
|
// Must be solved before
|
||||||
|
$name = PhocaDownloadFile::getTitleFromFilenameWithExt($filename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getImageFileName($imageFilename, $fileName = '', $type = 1, $iconSize = 16)
|
||||||
|
{
|
||||||
|
|
||||||
|
$name['filenamestyle'] = '';
|
||||||
|
$name['filenamethumb'] = '';
|
||||||
|
|
||||||
|
if ($imageFilename != '') {
|
||||||
|
$thumbnail = false;
|
||||||
|
$thumbnail = preg_match("/phocathumbnail/i", $imageFilename);
|
||||||
|
if ($thumbnail) {
|
||||||
|
$name['filenamethumb'] = '<div class="pdfv-image-file-thumb" >'
|
||||||
|
. '<img src="' . $this->cssImagePath . $imageFilename . '" alt="" /></div>';
|
||||||
|
$name['filenamestyle'] = '';
|
||||||
|
} else {
|
||||||
|
$name['filenamethumb'] = '';
|
||||||
|
$name['filenamestyle'] = 'style="background: url(\'' . $this->cssImagePath . $imageFilename . '\') 0 center no-repeat;"';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$file_icon_mime = $this->params->get('file_icon_mime', 1);
|
||||||
|
if ($fileName != '' && $file_icon_mime == 1) {
|
||||||
|
if ($type == 3) { // Plugin
|
||||||
|
$file_icon_size = $iconSize;
|
||||||
|
} else if ($type == 2) {
|
||||||
|
$file_icon_size = $this->params->get('file_icon_size_md', 16);
|
||||||
|
} else {
|
||||||
|
$file_icon_size = $this->params->get('file_icon_size', 16);
|
||||||
|
}
|
||||||
|
$icon = PhocaDownloadFile::getMimeTypeIcon($fileName, (int)$file_icon_size, 1);
|
||||||
|
$name['filenamethumb'] = '';
|
||||||
|
$name['filenamestyle'] = $icon;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFileSize($filename)
|
||||||
|
{
|
||||||
|
|
||||||
|
$size = '';
|
||||||
|
if ($filename != '') {
|
||||||
|
$absFile = str_replace('/', DS, JPath::clean($this->fileAbsPath . $filename));
|
||||||
|
if (JFile::exists($absFile)) {
|
||||||
|
$size = PhocaDownloadFile::getFileSizeReadable(filesize($absFile));
|
||||||
|
} else {
|
||||||
|
$size = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $size;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getProtectEmail($email)
|
||||||
|
{
|
||||||
|
|
||||||
|
$email = str_replace('@', '[' . JText::_('COM_PHOCADOWNLOAD_AT') . ']', $email);
|
||||||
|
$email = str_replace('.', '[' . JText::_('COM_PHOCADOWNLOAD_DOT') . ']', $email);
|
||||||
|
|
||||||
|
return $email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFileDate($filename, $date)
|
||||||
|
{
|
||||||
|
|
||||||
|
$dateO = '';
|
||||||
|
$ddt = $this->params->get('display_date_type', 0);
|
||||||
|
if ((int)$ddt > 0) {
|
||||||
|
if ($filename != '') {
|
||||||
|
$dateO = PhocaDownloadFile::getFileTime($filename, $ddt);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$dateO = JHTML::Date($date, JText::_('DATE_FORMAT_LC3'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$newDate = date_create($date);
|
||||||
|
date_modify($newDate, "+1 hour");
|
||||||
|
$newDate = date_format($newDate, "Y-m-d H:i:s");
|
||||||
|
|
||||||
|
$dateArray = explode(" ", $newDate);
|
||||||
|
|
||||||
|
return $dateO . ' ' . $dateArray[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isValueEditor($text)
|
||||||
|
{
|
||||||
|
|
||||||
|
if ($text != '' && $text != '<p> </p>' && $text != '<p> </p>' && $text != '<p></p>' && $text != '<br />') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getImageDownload($img)
|
||||||
|
{
|
||||||
|
|
||||||
|
return '<img src="' . $this->cssImagePath . $img . '" alt="" />';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function displayTags($fileId, $type = 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
$o = '';
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
|
||||||
|
$query = 'SELECT a.id, a.title, a.link_ext, a.link_cat'
|
||||||
|
. ' FROM #__phocadownload_tags AS a'
|
||||||
|
. ' LEFT JOIN #__phocadownload_tags_ref AS r ON r.tagid = a.id'
|
||||||
|
. ' WHERE r.fileid = ' . (int)$fileId
|
||||||
|
. ' ORDER BY a.id';
|
||||||
|
|
||||||
|
$db->setQuery($query);
|
||||||
|
$fileIdObject = $db->loadObjectList();
|
||||||
|
|
||||||
|
if (!$db->query()) {
|
||||||
|
$this->setError($db->getErrorMsg());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$tl = $this->params->get('tags_links', 0);
|
||||||
|
|
||||||
|
$class = '';
|
||||||
|
if ($type == 1) {
|
||||||
|
$class = 'class="label label-default"';
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($fileIdObject as $k => $v) {
|
||||||
|
$o .= '<span ' . $class . '>';
|
||||||
|
if ($tl == 0) {
|
||||||
|
$o .= $v->title;
|
||||||
|
} else if ($tl == 1) {
|
||||||
|
if ($v->link_ext != '') {
|
||||||
|
$o .= '<a href="' . $v->link_ext . '">' . $v->title . '</a>';
|
||||||
|
} else {
|
||||||
|
$o .= $v->title;
|
||||||
|
}
|
||||||
|
} else if ($tl == 2) {
|
||||||
|
|
||||||
|
if ($v->link_cat != '') {
|
||||||
|
$query = 'SELECT a.id, a.alias'
|
||||||
|
. ' FROM #__phocadownload_categories AS a'
|
||||||
|
. ' WHERE a.id = ' . (int)$v->link_cat
|
||||||
|
. ' ORDER BY a.id';
|
||||||
|
|
||||||
|
$db->setQuery($query, 0, 1);
|
||||||
|
$category = $db->loadObject();
|
||||||
|
|
||||||
|
if (!$db->query()) {
|
||||||
|
$this->setError($db->getErrorMsg());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (isset($category->id) && isset($category->alias)) {
|
||||||
|
$link = PhocaDownloadRoute::getCategoryRoute($category->id, $category->alias);
|
||||||
|
$o .= '<a href="' . $link . '">' . $v->title . '</a>';
|
||||||
|
} else {
|
||||||
|
$o .= $v->title;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$o .= $v->title;
|
||||||
|
}
|
||||||
|
} else if ($tl == 3) {
|
||||||
|
$link = PhocaDownloadRoute::getCategoryRouteByTag($v->id);
|
||||||
|
$o .= '<a href="' . $link . '">' . $v->title . '</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$o .= '</span> ';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function displayTagsString($string = '')
|
||||||
|
{
|
||||||
|
$o = array();
|
||||||
|
if ($string != '') {
|
||||||
|
$sA = explode(',', $string);
|
||||||
|
if (!empty($sA)) {
|
||||||
|
foreach ($sA as $k => $v) {
|
||||||
|
|
||||||
|
// Specific cases for Joomla! CMS
|
||||||
|
switch ($v) {
|
||||||
|
case '1.5':
|
||||||
|
$c = 'pd-j-15';
|
||||||
|
break;
|
||||||
|
case '1.7':
|
||||||
|
$c = 'pd-j-17';
|
||||||
|
break;
|
||||||
|
case '2.5':
|
||||||
|
$c = 'pd-j-25';
|
||||||
|
break;
|
||||||
|
case '3.x':
|
||||||
|
$c = 'pd-j-3x';
|
||||||
|
break;
|
||||||
|
case '3.5':
|
||||||
|
$c = 'pd-j-35';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$c = 'label-default';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$o[] = '<span class="label ' . $c . '">' . $v . '</span>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return implode(" ", $o);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function displayVideo($url, $view = 0, $ywidth = 0, $yheight = 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
$o = '';
|
||||||
|
if ($url != '' && PhocaDownloadUtils::isURLAddress($url)) {
|
||||||
|
|
||||||
|
|
||||||
|
$ssl = strpos($url, 'https');
|
||||||
|
$yLink = 'http://www.youtube.com/v/';
|
||||||
|
if ($ssl != false) {
|
||||||
|
$yLink = 'https://www.youtube.com/v/';
|
||||||
|
}
|
||||||
|
|
||||||
|
$shortUrl = 'http://youtu.be/';
|
||||||
|
$shortUrl2 = 'https://youtu.be/';
|
||||||
|
$pos = strpos($url, $shortUrl);
|
||||||
|
$pos2 = strpos($url, $shortUrl2);
|
||||||
|
if ($pos !== false) {
|
||||||
|
$code = str_replace($shortUrl, '', $url);
|
||||||
|
} else if ($pos2 !== false) {
|
||||||
|
$code = str_replace($shortUrl2, '', $url);
|
||||||
|
} else {
|
||||||
|
$codeArray = explode('=', $url);
|
||||||
|
$code = str_replace($codeArray[0] . '=', '', $url);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if ($view == 0) {
|
||||||
|
// Category View
|
||||||
|
$youtubeheight = $this->params->get('youtube_height_cv', 240);
|
||||||
|
$youtubewidth = $this->params->get('youtube_width_cv', 320);
|
||||||
|
} else {
|
||||||
|
// Detail View
|
||||||
|
$youtubeheight = $this->params->get('youtube_height_dv', 360);
|
||||||
|
$youtubewidth = $this->params->get('youtube_width_dv', 480);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((int)$ywidth > 0) {
|
||||||
|
$youtubewidth = (int)$ywidth;
|
||||||
|
}
|
||||||
|
if ((int)$yheight > 0) {
|
||||||
|
$youtubeheight = (int)$yheight;
|
||||||
|
}
|
||||||
|
|
||||||
|
$o .= '<object height="' . (int)$youtubeheight . '" width="' . (int)$youtubewidth . '" data="http://www.youtube.com/v/' . $code . '" type="application/x-shockwave-flash">'
|
||||||
|
. '<param name="movie" value="http://www.youtube.com/v/' . $code . '" />'
|
||||||
|
. '<param name="allowFullScreen" value="true" />'
|
||||||
|
. '<param name="allowscriptaccess" value="always" />'
|
||||||
|
. '<embed src="' . $yLink . $code . '" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" height="' . (int)$youtubeheight . '" width="' . (int)$youtubewidth . '" /></object>';
|
||||||
|
}
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,104 @@
|
|||||||
|
<?php
|
||||||
|
/* @package Joomla
|
||||||
|
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
* @extension Phoca Extension
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||||
|
|
||||||
|
class PhocaDownloadRenderAdmin
|
||||||
|
{
|
||||||
|
|
||||||
|
public static function quickIconButton( $link, $image, $text, $imgUrl ) {
|
||||||
|
return '<div class="thumbnails ph-icon">'
|
||||||
|
.'<a class="thumbnail ph-icon-inside" href="'.$link.'">'
|
||||||
|
.JHTML::_('image', $imgUrl . $image, $text )
|
||||||
|
.'<br /><span>'.$text.'</span></a></div>'. "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getLinks() {
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$option = $app->input->get('option');
|
||||||
|
$oT = strtoupper($option);
|
||||||
|
|
||||||
|
$links = array();
|
||||||
|
switch ($option) {
|
||||||
|
|
||||||
|
case 'com_phocadownload':
|
||||||
|
$links[] = array('Phoca Download site', 'http://www.phoca.cz/phocadownload');
|
||||||
|
$links[] = array('Phoca Download documentation site', 'http://www.phoca.cz/documentation/category/17-phoca-download-component');
|
||||||
|
$links[] = array('Phoca Download download site', 'http://www.phoca.cz/download/category/68-phoca-download');
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$links[] = array('Phoca News', 'http://www.phoca.cz/news');
|
||||||
|
$links[] = array('Phoca Forum', 'http://www.phoca.cz/forum');
|
||||||
|
|
||||||
|
$components = array();
|
||||||
|
$components[] = array('Phoca Gallery','phocagallery', 'pg');
|
||||||
|
$components[] = array('Phoca Guestbook','phocaguestbook', 'pgb');
|
||||||
|
$components[] = array('Phoca Download','phocadownload', 'pd');
|
||||||
|
$components[] = array('Phoca Documentation','phocadocumentation', 'pdc');
|
||||||
|
$components[] = array('Phoca Favicon','phocafavicon', 'pfv');
|
||||||
|
$components[] = array('Phoca SEF','phocasef', 'psef');
|
||||||
|
$components[] = array('Phoca PDF','phocapdf', 'ppdf');
|
||||||
|
$components[] = array('Phoca Restaurant Menu','phocamenu', 'prm');
|
||||||
|
$components[] = array('Phoca Maps','phocamaps', 'pm');
|
||||||
|
$components[] = array('Phoca Font','phocafont', 'pf');
|
||||||
|
$components[] = array('Phoca Email','phocaemail', 'pe');
|
||||||
|
$components[] = array('Phoca Install','phocainstall', 'pi');
|
||||||
|
$components[] = array('Phoca Template','phocatemplate', 'pt');
|
||||||
|
$components[] = array('Phoca Panorama','phocapanorama', 'pp');
|
||||||
|
$components[] = array('Phoca Photo','phocaphoto', 'ph');
|
||||||
|
$components[] = array('Phoca Commander','phocacommander', 'pcm');
|
||||||
|
|
||||||
|
$banners = array();
|
||||||
|
$banners[] = array('Phoca Restaurant Menu','phocamenu', 'prm');
|
||||||
|
|
||||||
|
$o = '';
|
||||||
|
$o .= '<p> </p>';
|
||||||
|
$o .= '<h4 style="margin-bottom:5px;">'.JText::_($oT.'_USEFUL_LINKS'). '</h4>';
|
||||||
|
$o .= '<ul>';
|
||||||
|
foreach ($links as $k => $v) {
|
||||||
|
$o .= '<li><a style="text-decoration:underline" href="'.$v[1].'" target="_blank">'.$v[0].'</a></li>';
|
||||||
|
}
|
||||||
|
$o .= '</ul>';
|
||||||
|
|
||||||
|
$o .= '<div>';
|
||||||
|
$o .= '<p> </p>';
|
||||||
|
$o .= '<h4 style="margin-bottom:5px;">'.JText::_($oT.'_USEFUL_TIPS'). '</h4>';
|
||||||
|
|
||||||
|
$m = mt_rand(0, 10);
|
||||||
|
if ((int)$m > 0) {
|
||||||
|
$o .= '<div>';
|
||||||
|
$num = range(0,(count($components) - 1 ));
|
||||||
|
shuffle($num);
|
||||||
|
for ($i = 0; $i<3; $i++) {
|
||||||
|
$numO = $num[$i];
|
||||||
|
$o .= '<div style="float:left;width:33%;margin:0 auto;">';
|
||||||
|
$o .= '<div><a style="text-decoration:underline;" href="http://www.phoca.cz/'.$components[$numO][1].'" target="_blank">'.JHTML::_('image', 'media/'.$option.'/images/administrator/icon-box-'.$components[$numO][2].'.png', ''). '</a></div>';
|
||||||
|
$o .= '<div style="margin-top:-10px;"><small><a style="text-decoration:underline;" href="http://www.phoca.cz/'.$components[$numO][1].'" target="_blank">'.$components[$numO][0].'</a></small></div>';
|
||||||
|
$o .= '</div>';
|
||||||
|
}
|
||||||
|
$o .= '<div style="clear:both"></div>';
|
||||||
|
$o .= '</div>';
|
||||||
|
} else {
|
||||||
|
$num = range(0,(count($banners) - 1 ));
|
||||||
|
shuffle($num);
|
||||||
|
$numO = $num[0];
|
||||||
|
$o .= '<div><a href="http://www.phoca.cz/'.$banners[$numO][1].'" target="_blank">'.JHTML::_('image', 'media/'.$option.'/images/administrator/b-'.$banners[$numO][2].'.png', ''). '</a></div>';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$o .= '<p> </p>';
|
||||||
|
$o .= '<h4 style="margin-bottom:5px;">'.JText::_($oT.'_PLEASE_READ'). '</h4>';
|
||||||
|
$o .= '<div><a style="text-decoration:underline" href="http://www.phoca.cz/phoca-needs-your-help/" target="_blank">'.JText::_($oT.'_PHOCA_NEEDS_YOUR_HELP'). '</a></div>';
|
||||||
|
|
||||||
|
$o .= '</div>';
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,80 @@
|
|||||||
|
<?php
|
||||||
|
/* @package Joomla
|
||||||
|
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
* @extension Phoca Extension
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||||
|
|
||||||
|
class PhocaDownloadRenderAdminView
|
||||||
|
{
|
||||||
|
public function __construct(){}
|
||||||
|
|
||||||
|
public function startForm($option, $view, $itemId, $id = 'adminForm', $name = 'adminForm') {
|
||||||
|
return '<div id="'.$view.'"><form action="'.JRoute::_('index.php?option='.$option . '&layout=edit&id='.(int) $itemId).'" method="post" name="'.$name.'" id="'.$id.'" class="form-validate">'."\n"
|
||||||
|
.'<div class="row-fluid">'."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function endForm() {
|
||||||
|
return '</div>'."\n".'</form>'."\n".'</div>'."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function formInputs() {
|
||||||
|
|
||||||
|
return '<input type="hidden" name="task" value="" />'. "\n"
|
||||||
|
. JHtml::_('form.token'). "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function navigation($tabs) {
|
||||||
|
$o = '<ul class="nav nav-tabs">';
|
||||||
|
$i = 0;
|
||||||
|
foreach($tabs as $k => $v) {
|
||||||
|
$cA = 0;
|
||||||
|
if ($i == 0) {
|
||||||
|
$cA = 'class="active"';
|
||||||
|
}
|
||||||
|
$o .= '<li '.$cA.'><a href="#'.$k.'" data-toggle="tab">'. $v.'</a></li>'."\n";
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
$o .= '</ul>';
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function group($form, $formArray, $clear = 0) {
|
||||||
|
$o = '';
|
||||||
|
if (!empty($formArray)) {
|
||||||
|
if ($clear == 1) {
|
||||||
|
foreach ($formArray as $value) {
|
||||||
|
$o .= '<div>'. $form->getLabel($value) . '</div>'."\n"
|
||||||
|
. '<div class="clearfix"></div>'. "\n"
|
||||||
|
. '<div>' . $form->getInput($value). '</div>'."\n";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
foreach ($formArray as $value) {
|
||||||
|
$o .= '<div class="control-group">'."\n"
|
||||||
|
. '<div class="control-label">'. $form->getLabel($value) . '</div>'."\n"
|
||||||
|
. '<div class="controls">' . $form->getInput($value). '</div>'."\n"
|
||||||
|
. '</div>' . "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function item($form, $item, $suffix = '') {
|
||||||
|
$value = $o = '';
|
||||||
|
if ($suffix != '') {
|
||||||
|
$value = $suffix;
|
||||||
|
} else {
|
||||||
|
$value = $form->getInput($item);
|
||||||
|
}
|
||||||
|
$o .= '<div class="control-group">'."\n";
|
||||||
|
$o .= '<div class="control-label">'. $form->getLabel($item) . '</div>'."\n"
|
||||||
|
. '<div class="controls">' . $value.'</div>'."\n"
|
||||||
|
. '</div>' . "\n";
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,399 @@
|
|||||||
|
<?php
|
||||||
|
/* @package Joomla
|
||||||
|
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
* @extension Phoca Extension
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||||
|
|
||||||
|
class PhocaDownloadRenderAdminViews
|
||||||
|
{
|
||||||
|
public function __construct(){}
|
||||||
|
|
||||||
|
public function jsJorderTable($listOrder) {
|
||||||
|
return '<script type="text/javascript">' . "\n"
|
||||||
|
.'Joomla.orderTable = function() {' . "\n"
|
||||||
|
.' table = document.getElementById("sortTable");' . "\n"
|
||||||
|
.' direction = document.getElementById("directionTable");' . "\n"
|
||||||
|
.' order = table.options[table.selectedIndex].value;' . "\n"
|
||||||
|
.' if (order != \''. $listOrder.'\') {' . "\n"
|
||||||
|
.' dirn = \'asc\';' . "\n"
|
||||||
|
.' } else {' . "\n"
|
||||||
|
.' dirn = direction.options[direction.selectedIndex].value;' . "\n"
|
||||||
|
.' }' . "\n"
|
||||||
|
.' Joomla.tableOrdering(order, dirn, \'\');' . "\n"
|
||||||
|
.'}' . "\n"
|
||||||
|
.'</script>' . "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function startForm($option, $view, $id = 'adminForm', $name = 'adminForm') {
|
||||||
|
return '<div id="'.$view.'"><form action="'.JRoute::_('index.php?option='.$option.'&view='.$view).'" method="post" name="'.$name.'" id="'.$id.'">'."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function endForm() {
|
||||||
|
return '</form>'."\n".'</div>'."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function startFilter($txtFilter = ''){
|
||||||
|
$o = '<div id="j-sidebar-container" class="span2">'."\n". JHtmlSidebar::render()."\n";
|
||||||
|
|
||||||
|
|
||||||
|
if ($txtFilter != '') {
|
||||||
|
$o .= '<hr />'."\n" . '<div class="filter-select ">'."\n"
|
||||||
|
|
||||||
|
. '<h4 class="page-header">'. JText::_($txtFilter).'</h4>'."\n";
|
||||||
|
} else {
|
||||||
|
$o .= '<div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function endFilter() {
|
||||||
|
return '</div>' . "\n" . '</div>' . "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function selectFilterPublished($txtSp, $state) {
|
||||||
|
return '<div class="btn-group pull-right ph-select-status">'. "\n"
|
||||||
|
.'<select name="filter_published" class="inputbox" onchange="this.form.submit()">'."\n"
|
||||||
|
. '<option value="">'.JText::_($txtSp).'</option>'
|
||||||
|
. JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('archived' => 0, 'trash' => 0)), 'value', 'text', $state, true)
|
||||||
|
.'</select></div>'. "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function selectFilterType($txtSp, $type, $typeList) {
|
||||||
|
return '<div class="btn-group pull-right">'. "\n"
|
||||||
|
.'<select name="filter_type" class="inputbox" onchange="this.form.submit()">'."\n"
|
||||||
|
. '<option value="">'.JText::_($txtSp).'</option>'
|
||||||
|
. JHtml::_('select.options', $typeList, 'value', 'text', $type, true)
|
||||||
|
.'</select></div>'. "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function selectFilterLanguage($txtLng, $state) {
|
||||||
|
return '<div class="btn-group pull-right">'. "\n"
|
||||||
|
.'<select name="filter_language" class="inputbox" onchange="this.form.submit()">'."\n"
|
||||||
|
. '<option value="">'.JText::_($txtLng).'</option>'
|
||||||
|
. JHtml::_('select.options', JHtml::_('contentlanguage.existing', true, true), 'value', 'text', $state)
|
||||||
|
.'</select></div>'. "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function selectFilterCategory($categoryList, $txtLng, $state) {
|
||||||
|
return '<div class="btn-group pull-right ">'. "\n"
|
||||||
|
.'<select name="filter_category_id" class="inputbox" onchange="this.form.submit()">'."\n"
|
||||||
|
. '<option value="">'.JText::_($txtLng).'</option>'
|
||||||
|
. JHtml::_('select.options', $categoryList, 'value', 'text', $state)
|
||||||
|
. '</select></div>'. "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function selectFilterLevels($txtLng, $state) {
|
||||||
|
$levelList = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5);
|
||||||
|
return
|
||||||
|
'<div class="btn-group pull-right">'. "\n"
|
||||||
|
.'<select name="filter_level" class="inputbox" onchange="this.form.submit()">'."\n"
|
||||||
|
. '<option value="">'.JText::_($txtLng).'</option>'
|
||||||
|
. JHtml::_('select.options', $levelList, 'value', 'text', $state)
|
||||||
|
. '</select></div>'. "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function startMainContainer() {
|
||||||
|
return '<div id="j-main-container" class="span10">'. "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function endMainContainer() {
|
||||||
|
return '</div>'. "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function startFilterBar($id = 0) {
|
||||||
|
if ((int)$id > 0) {
|
||||||
|
return '<div id="filter-bar'.$id.'" class="btn-toolbar ph-btn-toolbar-'.$id.'">'. "\n";
|
||||||
|
} else {
|
||||||
|
return '<div id="filter-bar'.$id.'" class="btn-toolbar">'. "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function endFilterBar() {
|
||||||
|
return '</div>' . "\n" . '<div class="clearfix"> </div>'. "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function inputFilterSearch($txtSl, $txtSd, $state) {
|
||||||
|
return '<div class="filter-search btn-group pull-left">'. "\n"
|
||||||
|
.'<label for="filter_search" class="element-invisible">'.JText::_($txtSl).'</label>'. "\n"
|
||||||
|
.'<input type="text" name="filter_search" placeholder="'.JText::_($txtSd).'" id="filter_search"'
|
||||||
|
.' value="'.$state.'" title="'.JText::_($txtSd).'" />'. "\n"
|
||||||
|
.'</div>'. "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
/*public function inputFilterSearchClear($txtFs, $txtFc) {
|
||||||
|
return '<div class="btn-group pull-left hidden-phone">'. "\n"
|
||||||
|
.'<button class="btn tip hasTooltip" type="submit" title="'.JText::_($txtFs).'"><i class="icon-search"></i></button>'. "\n"
|
||||||
|
.'<button class="btn tip hasTooltip" type="button" onclick="document.id(\'filter_search\').value=\'\';this.form.submit();"'
|
||||||
|
.' title="'.JText::_($txtFc).'"><i class="icon-remove"></i></button>'. "\n"
|
||||||
|
.'</div>'. "\n";
|
||||||
|
}*/
|
||||||
|
|
||||||
|
public function inputFilterSearchClear($txtFs, $txtFc) {
|
||||||
|
return '<div class="btn-group pull-left hidden-phone">'. "\n"
|
||||||
|
.'<button class="btn tip hasTooltip" type="submit" title="'.JText::_($txtFs).'"><i class="icon-search"></i></button>'. "\n"
|
||||||
|
.'<button class="btn tip hasTooltip" type="button" onclick="document.getElementById(\'filter_search\').value=\'\';this.form.submit();"'
|
||||||
|
.' title="'.JText::_($txtFc).'"><i class="icon-remove"></i></button>'. "\n"
|
||||||
|
.'</div>'. "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function inputFilterSearchLimit($txtSl, $paginationLimitBox) {
|
||||||
|
return '<div class="btn-group pull-right hidden-phone">'. "\n"
|
||||||
|
.'<label for="limit" class="element-invisible">'.JText::_($txtSl).'</label>'. "\n"
|
||||||
|
.$paginationLimitBox ."\n" . '</div>'. "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function selectFilterDirection($txtOd, $txtOasc, $txtOdesc, $listDirn) {
|
||||||
|
$ascDir = $descDir = '';
|
||||||
|
if ($listDirn == 'asc') {$ascDir = 'selected="selected"';}
|
||||||
|
if ($listDirn == 'desc') {$descDir = 'selected="selected"';}
|
||||||
|
return '<div class="btn-group pull-right hidden-phone">'. "\n"
|
||||||
|
.'<label for="directionTable" class="element-invisible">' .JText::_('JFIELD_ORDERING_DESC').'</label>'. "\n"
|
||||||
|
.'<select name="directionTable" id="directionTable" class="input-medium" onchange="Joomla.orderTable()">'. "\n"
|
||||||
|
.'<option value="">' .JText::_('JFIELD_ORDERING_DESC').'</option>'. "\n"
|
||||||
|
.'<option value="asc" '.$ascDir.'>' . JText::_('JGLOBAL_ORDER_ASCENDING').'</option>'. "\n"
|
||||||
|
.'<option value="desc" '.$descDir.'>' . JText::_('JGLOBAL_ORDER_DESCENDING').'</option>'. "\n"
|
||||||
|
.'</select>'. "\n"
|
||||||
|
.'</div>'. "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function selectFilterSortBy($txtSb, $sortFields, $listOrder) {
|
||||||
|
return '<div class="btn-group pull-right">'. "\n"
|
||||||
|
.'<label for="sortTable" class="element-invisible">'.JText::_($txtSb).'</label>'. "\n"
|
||||||
|
.'<select name="sortTable" id="sortTable" class="input-medium" onchange="Joomla.orderTable()">'. "\n"
|
||||||
|
.'<option value="">'.JText::_($txtSb).'</option>'. "\n"
|
||||||
|
. JHtml::_('select.options', $sortFields, 'value', 'text', $listOrder). "\n"
|
||||||
|
.'</select>'. "\n"
|
||||||
|
.'</div>'. "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function startTable($id) {
|
||||||
|
return '<table class="table table-striped" id="'.$id.'">'. "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function endTable() {
|
||||||
|
return '</table>'. "\n";
|
||||||
|
}
|
||||||
|
public function tblFoot($listFooter, $columns) {
|
||||||
|
return '<tfoot>' . "\n" . '<tr><td colspan="'.(int)$columns.'">'.$listFooter.'</td></tr>'. "\n".'</tfoot>'. "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function startTblHeader() {
|
||||||
|
return '<thead>'."\n".'<tr>'."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function endTblHeader() {
|
||||||
|
return '</tr>'."\n".'</thead>'."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function thOrdering($txtHo, $listDirn, $listOrder ) {
|
||||||
|
return '<th class="nowrap center hidden-phone ph-ordering">'. "\n"
|
||||||
|
. JHtml::_('grid.sort', '<i class="icon-menu-2"></i>', 'a.ordering', $listDirn, $listOrder, null, 'asc', $txtHo). "\n"
|
||||||
|
. '</th>';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function thCheck($txtCh) {
|
||||||
|
return '<th class="hidden-phone ph-check">'. "\n"
|
||||||
|
.'<input type="checkbox" name="checkall-toggle" value="" title="'.JText::_($txtCh).'" onclick="Joomla.checkAll(this)" />'. "\n"
|
||||||
|
.'</th>'. "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function tdOrder($canChange, $saveOrder, $orderkey){
|
||||||
|
|
||||||
|
$o = '<td class="order nowrap center hidden-phone">'. "\n";
|
||||||
|
if ($canChange) {
|
||||||
|
$disableClassName = '';
|
||||||
|
$disabledLabel = '';
|
||||||
|
if (!$saveOrder) {
|
||||||
|
$disabledLabel = JText::_('JORDERINGDISABLED');
|
||||||
|
$disableClassName = 'inactive tip-top';
|
||||||
|
}
|
||||||
|
$o .= '<span class="sortable-handler hasTooltip '.$disableClassName.'" title="'.$disabledLabel.'"><i class="icon-menu"></i></span>'."\n";
|
||||||
|
} else {
|
||||||
|
$o .= '<span class="sortable-handler inactive"><i class="icon-menu"></i></span>'."\n";
|
||||||
|
}
|
||||||
|
$orderkeyPlus = $orderkey + 1;
|
||||||
|
$o .= '<input type="text" style="display:none" name="order[]" size="5" value="'.$orderkeyPlus.'" />'. "\n"
|
||||||
|
.'</td>'. "\n";
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function tdRating($ratingAvg) {
|
||||||
|
$o = '<td class="small hidden-phone">';
|
||||||
|
$voteAvg = round(((float)$ratingAvg / 0.5)) * 0.5;
|
||||||
|
$voteAvgWidth = 16 * $voteAvg;
|
||||||
|
$o .= '<ul class="star-rating-small">'
|
||||||
|
.'<li class="current-rating" style="width:'.$voteAvgWidth.'px"></li>'
|
||||||
|
.'<li><span class="star1"></span></li>';
|
||||||
|
|
||||||
|
for ($ir = 2;$ir < 6;$ir++) {
|
||||||
|
$o .= '<li><span class="stars'.$ir.'"></span></li>';
|
||||||
|
}
|
||||||
|
$o .= '</ul>';
|
||||||
|
$o .='</td>'. "\n";
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function tdLanguage($lang, $langTitle, $langTitleE ) {
|
||||||
|
|
||||||
|
$o = '<td class="small nowrap hidden-phone">';
|
||||||
|
if ($lang == '*') {
|
||||||
|
$o .= JText::_('JALL');
|
||||||
|
} else {
|
||||||
|
if ($langTitle) {
|
||||||
|
$o .= $langTitleE;
|
||||||
|
} else {
|
||||||
|
$o .= JText::_('JUNDEFINED');;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$o .= '</td>'. "\n";
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*public function formInputs($listOrder, $originalOrders) {
|
||||||
|
|
||||||
|
return '<input type="hidden" name="task" value="" />'. "\n"
|
||||||
|
.'<input type="hidden" name="boxchecked" value="0" />'. "\n"
|
||||||
|
.'<input type="hidden" name="filter_order" value="'.$listOrder.'" />'. "\n"
|
||||||
|
.'<input type="hidden" name="filter_order_Dir" value="" />'. "\n"
|
||||||
|
. JHtml::_('form.token'). "\n"
|
||||||
|
.'<input type="hidden" name="original_order_values" value="'. implode($originalOrders, ',').'" />'. "\n";
|
||||||
|
}*/
|
||||||
|
|
||||||
|
public function formInputs($listOrder, $listDirn, $originalOrders) {
|
||||||
|
|
||||||
|
return '<input type="hidden" name="task" value="" />'. "\n"
|
||||||
|
.'<input type="hidden" name="boxchecked" value="0" />'. "\n"
|
||||||
|
.'<input type="hidden" name="filter_order" value="'.$listOrder.'" />'. "\n"
|
||||||
|
.'<input type="hidden" name="filter_order_Dir" value="'.$listDirn.'" />'. "\n"
|
||||||
|
. JHtml::_('form.token'). "\n"
|
||||||
|
.'<input type="hidden" name="original_order_values" value="'. implode($originalOrders, ',').'" />'. "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function td($value, $class = '') {
|
||||||
|
if ($class != ''){
|
||||||
|
return '<td class="'.$class.'">'. $value.'</td>'. "\n";
|
||||||
|
} else {
|
||||||
|
return '<td>'. $value.'</td>'. "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TODO:
|
||||||
|
* CHANGE PATHS
|
||||||
|
* SET NEW PARAM IN PG: '/media/com_phocagallery/images/administrator/'
|
||||||
|
*/
|
||||||
|
public function tdImage($item, $button, $txtE, $class = '', $avatarAbs = '', $avatarRel = '') {
|
||||||
|
$o = '<td class="'.$class.'">'. "\n";
|
||||||
|
$o .= '<div class="phocagallery-box-file">'. "\n"
|
||||||
|
.' <center>'. "\n"
|
||||||
|
.' <div class="phocagallery-box-file-first">'. "\n"
|
||||||
|
.' <div class="phocagallery-box-file-second">'. "\n"
|
||||||
|
.' <div class="phocagallery-box-file-third">'. "\n"
|
||||||
|
.' <center>'. "\n";
|
||||||
|
|
||||||
|
if ($avatarAbs != '' && $avatarRel != '') {
|
||||||
|
// AVATAR
|
||||||
|
if (JFile::exists($avatarAbs.$item->avatar)){
|
||||||
|
$o .= '<a class="'. $button->modalname.'"'
|
||||||
|
.' title="'. $button->text.'"'
|
||||||
|
.' href="'.JURI::root().$avatarRel.$item->avatar.'" '
|
||||||
|
.' rel="'. $button->options.'" >'
|
||||||
|
.'<img src="'.JURI::root().$avatarRel.$item->avatar.'?imagesid='.md5(uniqid(time())).'" alt="'.JText::_($txtE).'" />'
|
||||||
|
.'</a>';
|
||||||
|
} else {
|
||||||
|
$o .= JHTML::_( 'image', '/media/com_phocagallery/images/administrator/phoca_thumb_s_no_image.gif', '');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// PICASA
|
||||||
|
if (isset($item->extid) && $item->extid !='') {
|
||||||
|
|
||||||
|
$resW = explode(',', $item->extw);
|
||||||
|
$resH = explode(',', $item->exth);
|
||||||
|
$correctImageRes = PhocaGalleryImage::correctSizeWithRate($resW[2], $resH[2], 50, 50);
|
||||||
|
$imgLink = $item->extl;
|
||||||
|
|
||||||
|
$o .= '<a class="'. $button->modalname.'" title="'.$button->text.'" href="'. $imgLink .'" rel="'. $button->options.'" >'
|
||||||
|
. '<img src="'.$item->exts.'?imagesid='.md5(uniqid(time())).'" width="'.$correctImageRes['width'].'" height="'.$correctImageRes['height'].'" alt="'.JText::_($txtE).'" />'
|
||||||
|
.'</a>'. "\n";
|
||||||
|
} else if (isset ($item->fileoriginalexist) && $item->fileoriginalexist == 1) {
|
||||||
|
|
||||||
|
$imageRes = PhocaGalleryImage::getRealImageSize($item->filename, 'small');
|
||||||
|
$correctImageRes = PhocaGalleryImage::correctSizeWithRate($imageRes['w'], $imageRes['h'], 50, 50);
|
||||||
|
$imgLink = PhocaGalleryFileThumbnail::getThumbnailName($item->filename, 'large');
|
||||||
|
|
||||||
|
$o .= '<a class="'. $button->modalname.'" title="'. $button->text.'" href="'. JURI::root(). $imgLink->rel.'" rel="'. $button->options.'" >'
|
||||||
|
. '<img src="'.JURI::root().$item->linkthumbnailpath.'?imagesid='.md5(uniqid(time())).'" width="'.$correctImageRes['width'].'" height="'.$correctImageRes['height'].'" alt="'.JText::_($txtE).'" />'
|
||||||
|
.'</a>'. "\n";
|
||||||
|
} else {
|
||||||
|
$o .= JHTML::_( 'image', 'media/com_phocagallery/images/administrator/phoca_thumb_s_no_image.gif', '');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$o .= ' </center>'. "\n"
|
||||||
|
.' </div>'. "\n"
|
||||||
|
.' </div>'. "\n"
|
||||||
|
.' </div>'. "\n"
|
||||||
|
.' </center>'. "\n"
|
||||||
|
.'</div>'. "\n";
|
||||||
|
$o .= '</td>'. "\n";
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function tdPublishDownUp ($publishUp, $publishDown, $langPref) {
|
||||||
|
|
||||||
|
$o = '';
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
//$app = JFactory::getApplication();
|
||||||
|
$nullDate = $db->getNullDate();
|
||||||
|
$now = JFactory::getDate();
|
||||||
|
$config = JFactory::getConfig();
|
||||||
|
$publish_up = JFactory::getDate($publishUp);
|
||||||
|
$publish_down = JFactory::getDate($publishDown);
|
||||||
|
//$tz = new DateTimeZone($config->get('offset'));
|
||||||
|
//$publish_up->setTimezone($tz);
|
||||||
|
//$publish_down->setTimezone($tz);
|
||||||
|
|
||||||
|
|
||||||
|
if ( $now->toUnix() <= $publish_up->toUnix() ) {
|
||||||
|
$text = JText::_( $langPref . '_PENDING' );
|
||||||
|
} else if ( ( $now->toUnix() <= $publish_down->toUnix() || $publishDown == $nullDate ) ) {
|
||||||
|
$text = JText::_( $langPref . '_ACTIVE' );
|
||||||
|
} else if ( $now->toUnix() > $publish_down->toUnix() ) {
|
||||||
|
$text = JText::_( $langPref . '_EXPIRED' );
|
||||||
|
}
|
||||||
|
|
||||||
|
$times = '';
|
||||||
|
if (isset($publishUp)) {
|
||||||
|
if ($publishUp == $nullDate) {
|
||||||
|
$times .= JText::_( $langPref . '_START') . ': '.JText::_( $langPref . '_ALWAYS' );
|
||||||
|
} else {
|
||||||
|
$times .= JText::_( $langPref . '_START') .": ". JHtml::_('date', $publish_up, 'D, d M Y H:i:s');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isset($publishDown)) {
|
||||||
|
|
||||||
|
if ($publishDown == $nullDate) {
|
||||||
|
$times .= "<br />". JText::_( $langPref . '_FINISH'). ': '. JText::_( $langPref . '_NO_EXPIRY' );
|
||||||
|
} else {
|
||||||
|
$times .= "<br />". JText::_( $langPref . '_FINISH') .": ". JHtml::_('date', $publish_down, 'D, d M Y H:i:s');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $times ) {
|
||||||
|
$o .= '<td align="center">'
|
||||||
|
.'<span class="editlinktip hasTip" title="'. JText::_( $langPref . '_PUBLISH_INFORMATION' ).'::'. $times.'">'
|
||||||
|
.'<a href="javascript:void(0);" >'. $text.'</a></span>'
|
||||||
|
.'</td>'. "\n";
|
||||||
|
} else {
|
||||||
|
$o .= '<td></td>'. "\n";
|
||||||
|
}
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,317 @@
|
|||||||
|
<?php
|
||||||
|
/* @package Joomla
|
||||||
|
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
* @extension Phoca Extension
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||||
|
|
||||||
|
class PhocaDownloadRenderFront
|
||||||
|
{
|
||||||
|
public static function renderAllCSS($noBootStrap = 0) {
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$itemid = $app->input->get('Itemid', 0, 'int');
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
$query = 'SELECT a.filename as filename, a.type as type, a.menulink as menulink'
|
||||||
|
.' FROM #__phocadownload_styles AS a'
|
||||||
|
.' WHERE a.published = 1'
|
||||||
|
.' ORDER BY a.type, a.ordering ASC';
|
||||||
|
$db->setQuery($query);
|
||||||
|
$filenames = $db->loadObjectList();
|
||||||
|
if (!empty($filenames)) {
|
||||||
|
foreach ($filenames as $fk => $fv) {
|
||||||
|
|
||||||
|
$path = PhocaDownloadFile::getCSSPath($fv->type, 1);
|
||||||
|
|
||||||
|
if ($fv->menulink != '' && (int)$fv->menulink > 1) {
|
||||||
|
|
||||||
|
$menuLinks = explode(',', $fv->menulink);
|
||||||
|
$isIncluded = in_array((int)$itemid, $menuLinks);
|
||||||
|
if ($isIncluded) {
|
||||||
|
JHtml::stylesheet($path . $fv->filename );
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
JHtml::stylesheet($path . $fv->filename );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function renderPhocaDownload() {
|
||||||
|
return '<div sty'.'le="t'.'ext-al'.'ign:ri'.'ght;">Po'
|
||||||
|
.'wered by <a href="ht'.'tp://www.pho'
|
||||||
|
.'ca.cz/phocad'.'ownload" targe'
|
||||||
|
.'t="_bla'.'nk" title="Pho'.'ca Dow'
|
||||||
|
.'nload">Phoca Down'.'load</a></div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function displayMirrorLinks($view = 1, $link, $title, $target) {
|
||||||
|
|
||||||
|
$paramsC = JComponentHelper::getParams( 'com_phocadownload' );
|
||||||
|
$param['display_mirror_links'] = $paramsC->get( 'display_mirror_links', 0 );
|
||||||
|
$o = '';
|
||||||
|
|
||||||
|
$displayM = 0;
|
||||||
|
if ($view == 1) {
|
||||||
|
//Category View
|
||||||
|
if ($param['display_mirror_links'] == 1 || $param['display_mirror_links'] == 3
|
||||||
|
|| $param['display_mirror_links'] == 4 || $param['display_mirror_links'] == 6) {
|
||||||
|
$displayM = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
//File View
|
||||||
|
if ($param['display_mirror_links'] == 2 || $param['display_mirror_links'] == 3
|
||||||
|
|| $param['display_mirror_links'] == 5 || $param['display_mirror_links'] == 6) {
|
||||||
|
$displayM = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if ($displayM == 1 && $link != '' && PhocaDownloadUtils::isURLAddress($link) && $title != '') {
|
||||||
|
|
||||||
|
$targetO = '';
|
||||||
|
if ($target != '') {
|
||||||
|
$targetO = 'target="'.$target.'"';
|
||||||
|
}
|
||||||
|
$o .= '<a class="" href="'.$link.'" '.$targetO.'>'.strip_tags($title).'</a>';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function displayReportLink($view = 1, $title = '') {
|
||||||
|
|
||||||
|
$paramsC = JComponentHelper::getParams( 'com_phocadownload' );
|
||||||
|
$param['display_report_link'] = $paramsC->get( 'display_report_link', 0 );
|
||||||
|
$param['report_link_guestbook_id'] = $paramsC->get( 'report_link_guestbook_id', 0 );
|
||||||
|
$o = '';
|
||||||
|
|
||||||
|
$displayL = 0;
|
||||||
|
if ($view == 1) {
|
||||||
|
//Category View
|
||||||
|
if ($param['display_report_link'] == 1 || $param['display_report_link'] == 3) {
|
||||||
|
$displayL = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
//File View
|
||||||
|
if ($param['display_report_link'] == 2 || $param['display_report_link'] == 3) {
|
||||||
|
$displayL = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($displayL == 1 && (int)$param['report_link_guestbook_id'] > 0) {
|
||||||
|
|
||||||
|
$onclick = "window.open(this.href,'win2','width=600,height=500,scrollbars=yes,menubar=no,resizable=yes'); return false;";
|
||||||
|
//$href = JRoute::_('index.php?option=com_phocaguestbook&view=guestbook&id='.(int)$param['report_link_guestbook_id'].'&reporttitle='.strip_tags($title).'&tmpl=component&Itemid='. JRequest::getVar('Itemid', 0, '', 'int') );
|
||||||
|
|
||||||
|
$href = PhocaDownloadRoute::getGuestbookRoute((int)$param['report_link_guestbook_id'],urlencode(strip_tags($title) ));
|
||||||
|
//$href = JRoute::_('index.php?option=com_phocaguestbook&view=guestbook&id='.(int)$param['report_link_guestbook_id'].'&reporttitle='.strip_tags($title).'&tmpl=component');
|
||||||
|
|
||||||
|
|
||||||
|
$o .= '<a href="'.$href.'#pgbTabForm" onclick="'.$onclick.'">'.JText::_('COM_PHOCADOWNLOAD_REPORT').'</a>';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function displayNewIcon ($date, $time = 0) {
|
||||||
|
|
||||||
|
if ($time == 0) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$dateAdded = strtotime($date, time());
|
||||||
|
$dateToday = time();
|
||||||
|
$dateExists = $dateToday - $dateAdded;
|
||||||
|
$dateNew = $time * 24 * 60 * 60;
|
||||||
|
|
||||||
|
|
||||||
|
if ($dateExists < $dateNew) {
|
||||||
|
//return ' '. JHTML::_('image', 'media/com_phocadownload/images/icon-new.png', JText::_('COM_PHOCADOWNLOAD_NEW'));
|
||||||
|
return ' <span class="label label-warning">'.JText::_('COM_PHOCADOWNLOAD_NEW').'</span>';
|
||||||
|
} else {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function displayHotIcon ($hits, $requiredHits = 0) {
|
||||||
|
|
||||||
|
if ($requiredHits == 0) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($requiredHits <= $hits) {
|
||||||
|
//return ' '. JHTML::_('image', 'media/com_phocadownload/images/icon-hot.png', JText::_('COM_PHOCADOWNLOAD_HOT'));
|
||||||
|
return ' <span class="label label-important">'.JText::_('COM_PHOCADOWNLOAD_HOT').'</span>';
|
||||||
|
} else {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function renderOnUploadJS() {
|
||||||
|
|
||||||
|
$tag = "<script type=\"text/javascript\"> \n"
|
||||||
|
. "function OnUploadSubmitFile() { \n"
|
||||||
|
. "if ( document.getElementById('catid').value < 1 ) { \n"
|
||||||
|
. "alert('".JText::_('COM_PHOCADOWNLOAD_PLEASE_SELECT_CATEGORY')."'); \n"
|
||||||
|
. "return false; \n"
|
||||||
|
. "} \n"
|
||||||
|
. "document.getElementById('loading-label-file').style.display='block'; \n"
|
||||||
|
. "return true; \n"
|
||||||
|
. "} \n"
|
||||||
|
. "</script>";
|
||||||
|
|
||||||
|
return $tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function renderDescriptionUploadJS($chars) {
|
||||||
|
|
||||||
|
$tag = "<script type=\"text/javascript\"> \n"
|
||||||
|
."function countCharsUpload() {" . "\n"
|
||||||
|
."var maxCount = ".$chars.";" . "\n"
|
||||||
|
."var pdu = document.getElementById('phocadownload-upload-form');" . "\n"
|
||||||
|
."var charIn = pdu.phocadownloaduploaddescription.value.length;" . "\n"
|
||||||
|
."var charLeft = maxCount - charIn;" . "\n"
|
||||||
|
."" . "\n"
|
||||||
|
."if (charLeft < 0) {" . "\n"
|
||||||
|
." alert('".JText::_('COM_PHOCADOWNLOAD_MAX_LIMIT_CHARS_REACHED')."');" . "\n"
|
||||||
|
." pdu.phocadownloaduploaddescription.value = pdu.phocadownloaduploaddescription.value.substring(0, maxCount);" . "\n"
|
||||||
|
." charIn = maxCount;" . "\n"
|
||||||
|
." charLeft = 0;" . "\n"
|
||||||
|
."}" . "\n"
|
||||||
|
."pdu.phocadownloaduploadcountin.value = charIn;" . "\n"
|
||||||
|
."pdu.phocadownloaduploadcountleft.value = charLeft;" . "\n"
|
||||||
|
."}" . "\n"
|
||||||
|
. "</script>";
|
||||||
|
|
||||||
|
return $tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function userTabOrdering() {
|
||||||
|
$js = "\t". '<script language="javascript" type="text/javascript">'."\n"
|
||||||
|
. 'function tableOrdering( order, dir, task )' . "\n"
|
||||||
|
. '{ ' . "\n"
|
||||||
|
. "\t".'var form = document.phocadownloadfilesform;' . "\n"
|
||||||
|
. "\t".'form.filter_order.value = order;' . "\n"
|
||||||
|
. "\t".'form.filter_order_Dir.value = dir;' . "\n"
|
||||||
|
. "\t".'document.phocadownloadfilesform.submit();' . "\n"
|
||||||
|
. '}'. "\n"
|
||||||
|
. '</script>' . "\n";
|
||||||
|
|
||||||
|
return $js;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function renderOverlibCSS($ol_fg_color, $ol_bg_color, $ol_tf_color, $ol_cf_color, $opacity = 0.8) {
|
||||||
|
|
||||||
|
$opacityPer = (float)$opacity * 100;
|
||||||
|
|
||||||
|
$css = "<style type=\"text/css\">\n"
|
||||||
|
|
||||||
|
. ".bgPhocaClass{
|
||||||
|
background:".$ol_bg_color.";
|
||||||
|
filter:alpha(opacity=".$opacityPer.");
|
||||||
|
opacity: ".$opacity.";
|
||||||
|
-moz-opacity:".$opacity.";
|
||||||
|
z-index:1000;
|
||||||
|
}
|
||||||
|
.fgPhocaClass{
|
||||||
|
background:".$ol_fg_color.";
|
||||||
|
filter:alpha(opacity=100);
|
||||||
|
opacity: 1;
|
||||||
|
-moz-opacity:1;
|
||||||
|
z-index:1000;
|
||||||
|
}
|
||||||
|
.fontPhocaClass{
|
||||||
|
color:".$ol_tf_color.";
|
||||||
|
z-index:1001;
|
||||||
|
}
|
||||||
|
.capfontPhocaClass, .capfontclosePhocaClass{
|
||||||
|
color:".$ol_cf_color.";
|
||||||
|
font-weight:bold;
|
||||||
|
z-index:1001;
|
||||||
|
}"
|
||||||
|
." </style>\n";
|
||||||
|
|
||||||
|
return $css;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function renderBootstrapModalJs($item = '.btn') {
|
||||||
|
$document = JFactory::getDocument();
|
||||||
|
JHtml::_('jquery.framework', false);
|
||||||
|
$s = '
|
||||||
|
jQuery(document).ready(function(){
|
||||||
|
|
||||||
|
jQuery("#phModalPlay").on("hidden.bs.modal", function (e) {
|
||||||
|
jQuery("#phModalPlay iframe").attr("src", jQuery("#phModalPlay iframe").attr("src"));
|
||||||
|
jQuery("audio").each(function(){this.pause();this.currentTime = 0;});
|
||||||
|
jQuery("video").each(function(){this.pause();this.currentTime = 0;});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
jQuery("'.$item.'").on("click", function () {
|
||||||
|
var $target = jQuery(this).data("target");
|
||||||
|
var $href = jQuery(this).data("href");
|
||||||
|
var $body = $target + "Body";
|
||||||
|
var $dialog = $target + "Dialog";
|
||||||
|
var $height = jQuery(this).data("height");
|
||||||
|
var $width = jQuery(this).data("width");
|
||||||
|
var $heightD= jQuery(this).data("height-dialog");
|
||||||
|
var $widthD = jQuery(this).data("width-dialog");
|
||||||
|
var $type = jQuery(this).data("type");
|
||||||
|
jQuery($body).css("height", $height);
|
||||||
|
jQuery($target).css("width", $width);
|
||||||
|
jQuery($body).css("overflow-y", "auto");
|
||||||
|
jQuery($dialog).css("height", $heightD);
|
||||||
|
jQuery($dialog).css("width", $widthD);
|
||||||
|
|
||||||
|
|
||||||
|
if ($type == "image") {
|
||||||
|
jQuery($body).html(\'<img class="img-responsive" src="\' + $href + \'" />\');
|
||||||
|
} else if ($type == "document") {
|
||||||
|
$widthD = $widthD -50;
|
||||||
|
$heightD = $heightD -40;
|
||||||
|
jQuery($body).html(\'<object type="application/pdf" data="\' + $href + \'" width="\' + $widthD + \'" height="\' + $heightD + \'" ></object>\');
|
||||||
|
} else {
|
||||||
|
jQuery($body).load($href, function (response, status, xhr) {
|
||||||
|
if (status == "success") {
|
||||||
|
/*jQuery($target).modal({ show: true });*/
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});';
|
||||||
|
$document->addScriptDeclaration($s);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Launch
|
||||||
|
<a type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#phModalDetail" data-href="..." data-height="500px">..</a>
|
||||||
|
*/
|
||||||
|
|
||||||
|
public static function bootstrapModalHtml($item = 'phModal', $title) {
|
||||||
|
|
||||||
|
$close = JText::_('COM_PHOCADOWNLAD_CLOSE');
|
||||||
|
$o = '<div id="'.$item.'" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="'.$item.'Label">
|
||||||
|
<div class="modal-dialog" role="document" id="'.$item.'Dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="'.$close.'"><span aria-hidden="true">×</span></button>
|
||||||
|
<h4 class="modal-title" id="'.$item.'Label">'.$title.'</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body" id="'.$item.'Body" ></div>
|
||||||
|
<div class="modal-footer"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>';
|
||||||
|
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,84 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* @package Joomla 1.5
|
||||||
|
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
*
|
||||||
|
* @component Phoca Component
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Check to ensure this file is included in Joomla!
|
||||||
|
defined('_JEXEC') or die();
|
||||||
|
jimport('joomla.application.component.model');
|
||||||
|
|
||||||
|
class PhocaDownloadStat
|
||||||
|
{
|
||||||
|
public static function createUserStatEntry($downloadId) {
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
|
||||||
|
|
||||||
|
$query = ' SELECT * FROM '.$db->quoteName('#__phocadownload_user_stat')
|
||||||
|
.' WHERE '. $db->quoteName('userid')
|
||||||
|
.' = '
|
||||||
|
.$db->Quote((int)$user->id)
|
||||||
|
.' AND '. $db->quoteName('fileid')
|
||||||
|
.' = '
|
||||||
|
.$db->Quote((int)$downloadId);
|
||||||
|
|
||||||
|
$db->setQuery($query);
|
||||||
|
$results = $db->loadObjectList();
|
||||||
|
|
||||||
|
$date = gmdate('Y-m-d H:i:s');
|
||||||
|
if ($results) {
|
||||||
|
// Update count
|
||||||
|
$query = 'UPDATE '.$db->quoteName('#__phocadownload_user_stat')
|
||||||
|
.' SET count = (count + 1),'
|
||||||
|
.' date = '.$db->Quote($date)
|
||||||
|
.' WHERE userid = '.$db->Quote((int)$user->id)
|
||||||
|
.' AND fileid = '.$db->Quote((int)$downloadId);
|
||||||
|
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->query();
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$query = 'INSERT INTO '.$db->quoteName('#__phocadownload_user_stat')
|
||||||
|
.' ('.$db->quoteName('count').','
|
||||||
|
.' '.$db->quoteName('userid').','
|
||||||
|
.' '.$db->quoteName('fileid').','
|
||||||
|
.' '.$db->quoteName('date').')'
|
||||||
|
.' VALUES ('.$db->Quote(1).','
|
||||||
|
.' '.$db->Quote((int)$user->id).','
|
||||||
|
.' '.$db->Quote((int)$downloadId).','
|
||||||
|
.' '.$db->Quote($date).')';
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->query();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getCountFilePerUser($downloadId) {
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
|
||||||
|
$query = ' SELECT count FROM '.$db->quoteName('#__phocadownload_user_stat')
|
||||||
|
.' WHERE '. $db->quoteName('userid')
|
||||||
|
.' = '
|
||||||
|
.$db->Quote((int)$user->id)
|
||||||
|
.' AND '. $db->quoteName('fileid')
|
||||||
|
.' = '
|
||||||
|
.$db->Quote((int)$downloadId)
|
||||||
|
.' LIMIT 0, 1';
|
||||||
|
|
||||||
|
$db->setQuery($query);
|
||||||
|
$count = $db->loadObject();
|
||||||
|
if (isset($count->count)) {
|
||||||
|
return (int)$count->count;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,103 @@
|
|||||||
|
<?php
|
||||||
|
/* @package Joomla
|
||||||
|
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
* @extension Phoca Extension
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
class PhocaDownloadTag
|
||||||
|
{
|
||||||
|
public static function getTags($fileId, $select = 0) {
|
||||||
|
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
|
||||||
|
if ($select == 1) {
|
||||||
|
$query = 'SELECT r.tagid';
|
||||||
|
} else {
|
||||||
|
$query = 'SELECT a.*';
|
||||||
|
}
|
||||||
|
$query .= ' FROM #__phocadownload_tags AS a'
|
||||||
|
//.' LEFT JOIN #__phocadownload AS f ON f.id = r.fileid'
|
||||||
|
.' LEFT JOIN #__phocadownload_tags_ref AS r ON a.id = r.tagid'
|
||||||
|
.' WHERE r.fileid = '.(int) $fileId
|
||||||
|
.' ORDER BY a.id';
|
||||||
|
$db->setQuery($query);
|
||||||
|
|
||||||
|
if (!$db->query()) {
|
||||||
|
echo PhocaDownloadException::renderErrorInfo('Database Error - Getting Selected Tags');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ($select == 1) {
|
||||||
|
$tags = $db->loadColumn();
|
||||||
|
} else {
|
||||||
|
$tags = $db->loadObjectList();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $tags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function storeTags($tagsArray, $fileId) {
|
||||||
|
|
||||||
|
|
||||||
|
if ((int)$fileId > 0) {
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
$query = ' DELETE '
|
||||||
|
.' FROM #__phocadownload_tags_ref'
|
||||||
|
. ' WHERE fileid = '. (int)$fileId;
|
||||||
|
$db->setQuery($query);
|
||||||
|
if (!$db->query()) {
|
||||||
|
echo PhocaDownloadException::renderErrorInfo('Database Error - Deleting FileId Tags');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($tagsArray)) {
|
||||||
|
|
||||||
|
$values = array();
|
||||||
|
$valuesString = '';
|
||||||
|
|
||||||
|
foreach($tagsArray as $k => $v) {
|
||||||
|
$values[] = ' ('.(int)$fileId.', '.(int)$v.')';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($values)) {
|
||||||
|
$valuesString = implode($values, ',');
|
||||||
|
|
||||||
|
$query = ' INSERT INTO #__phocadownload_tags_ref (fileid, tagid)'
|
||||||
|
.' VALUES '.(string)$valuesString;
|
||||||
|
|
||||||
|
$db->setQuery($query);
|
||||||
|
if (!$db->query()) {
|
||||||
|
echo PhocaDownloadException::renderErrorInfo('Database Error - Insert FileId Tags');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getAllTagsSelectBox($name, $id, $activeArray, $javascript = NULL, $order = 'id' ) {
|
||||||
|
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
$query = 'SELECT a.id AS value, a.title AS text'
|
||||||
|
.' FROM #__phocadownload_tags AS a'
|
||||||
|
. ' ORDER BY '. $order;
|
||||||
|
//. ' ORDER BY a.id';
|
||||||
|
$db->setQuery($query);
|
||||||
|
|
||||||
|
if (!$db->query()) {
|
||||||
|
echo PhocaDownloadException::renderErrorInfo('Database Error - Getting All Tags');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$tags = $db->loadObjectList();
|
||||||
|
|
||||||
|
$tagsO = JHTML::_('select.genericlist', $tags, $name, 'class="inputbox" size="4" multiple="multiple"'. $javascript, 'value', 'text', $activeArray, $id);
|
||||||
|
|
||||||
|
return $tagsO;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,134 @@
|
|||||||
|
<?php
|
||||||
|
/* @package Joomla
|
||||||
|
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
* @extension Phoca Extension
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
defined('_JEXEC') or die();
|
||||||
|
|
||||||
|
class PhocaDownloadUser
|
||||||
|
{
|
||||||
|
public static function getUserLang( $formName = 'language') {
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$paramsC = JComponentHelper::getParams('com_phocadownload') ;
|
||||||
|
$userLang = $paramsC->get( 'user_ucp_lang', 1 );
|
||||||
|
|
||||||
|
$o = array();
|
||||||
|
|
||||||
|
switch ($userLang){
|
||||||
|
case 2:
|
||||||
|
$registry = new JRegistry;
|
||||||
|
$registry->loadString($user->params);
|
||||||
|
$o['lang'] = $registry->get('language','*');
|
||||||
|
$o['langinput'] = '<input type="hidden" name="'.$formName.'" value="'.$o['lang'].'" />';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
$o['lang'] = JFactory::getLanguage()->getTag();
|
||||||
|
$o['langinput'] = '<input type="hidden" name="'.$formName.'" value="'.$o['lang'].'" />';
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
case 1:
|
||||||
|
$o['lang'] = '*';
|
||||||
|
$o['langinput'] = '<input type="hidden" name="'.$formName.'" value="*" />';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getUserFileInfo($file, $userId) {
|
||||||
|
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
$allFile['size'] = 0;
|
||||||
|
$allFile['count'] = 0;
|
||||||
|
$query = 'SELECT SUM(a.filesize) AS sumfiles, COUNT(a.id) AS countfiles'
|
||||||
|
.' FROM #__phocadownload AS a'
|
||||||
|
.' WHERE a.owner_id = '.(int)$userId;
|
||||||
|
$db->setQuery($query, 0, 1);
|
||||||
|
$fileData = $db->loadObject();
|
||||||
|
|
||||||
|
if(isset($fileData->sumfiles) && (int)$fileData->sumfiles > 0) {
|
||||||
|
$allFile['size'] = (int)$allFile['size'] + (int)$fileData->sumfiles;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($file['size'])) {
|
||||||
|
$allFile['size'] = (int)$allFile['size'] + (int)$file['size'];
|
||||||
|
$allFile['count'] = (int)$fileData->countfiles + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $allFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to display multiple select box
|
||||||
|
* @param string $name Name (id, name parameters)
|
||||||
|
* @param array $active Array of items which will be selected
|
||||||
|
* @param int $nouser Select no user
|
||||||
|
* @param string $javascript Add javascript to the select box
|
||||||
|
* @param string $order Ordering of items
|
||||||
|
* @param int $reg Only registered users
|
||||||
|
* @return array of id
|
||||||
|
*/
|
||||||
|
|
||||||
|
public static function usersList( $name, $id, $active, $nouser = 0, $javascript = NULL, $order = 'name', $reg = 1 ) {
|
||||||
|
|
||||||
|
$activeArray = $active;
|
||||||
|
if ($active != '') {
|
||||||
|
$activeArray = explode(',',$active);
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
$and = '';
|
||||||
|
if ($reg) {
|
||||||
|
// does not include registered users in the list
|
||||||
|
$and = ' AND m.group_id != 2';
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = 'SELECT u.id AS value, u.name AS text'
|
||||||
|
. ' FROM #__users AS u'
|
||||||
|
. ' JOIN #__user_usergroup_map AS m ON m.user_id = u.id'
|
||||||
|
. ' WHERE u.block = 0'
|
||||||
|
. $and
|
||||||
|
. ' GROUP BY u.id'
|
||||||
|
. ' ORDER BY '. $order;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if ( $nouser ) {
|
||||||
|
|
||||||
|
// Access rights (Default open for all)
|
||||||
|
// Upload and Delete rights (Default closed for all)
|
||||||
|
switch ($name) {
|
||||||
|
case 'jform[accessuserid][]':
|
||||||
|
$idInput1 = -1;
|
||||||
|
$idText1 = JText::_( 'COM_PHOCADOWNLOAD_ALL_REGISTERED_USERS' );
|
||||||
|
$idInput2 = -2;
|
||||||
|
$idText2 = JText::_( 'COM_PHOCADOWNLOAD_NOBODY' );
|
||||||
|
break;
|
||||||
|
|
||||||
|
Default:
|
||||||
|
$idInput1 = -2;
|
||||||
|
$idText1 = JText::_( 'COM_PHOCADOWNLOAD_NOBODY' );
|
||||||
|
$idInput2 = -1;
|
||||||
|
$idText2 = JText::_( 'COM_PHOCADOWNLOAD_ALL_REGISTERED_USERS' );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$users[] = JHTML::_('select.option', $idInput1, '- '. $idText1 .' -' );
|
||||||
|
$users[] = JHTML::_('select.option', $idInput2, '- '. $idText2 .' -' );
|
||||||
|
|
||||||
|
$users = array_merge( $users, $db->loadObjectList() );
|
||||||
|
} else {
|
||||||
|
$users = $db->loadObjectList();
|
||||||
|
}
|
||||||
|
|
||||||
|
$users = JHTML::_('select.genericlist', $users, $name, 'class="inputbox" size="4" multiple="multiple"'. $javascript, 'value', 'text', $activeArray, $id );
|
||||||
|
|
||||||
|
return $users;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* @package Joomla 1.5
|
||||||
|
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||||
|
*
|
||||||
|
* @component Phoca Gallery
|
||||||
|
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||||
|
*/
|
||||||
|
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||||
|
|
||||||
|
class PhocaDownloadException
|
||||||
|
{
|
||||||
|
|
||||||
|
public static function renderErrorInfo ($msg, $jText = false){
|
||||||
|
|
||||||
|
if ($jText) {
|
||||||
|
return '<div class="alert alert-error pg-error-info">'.JText::_($msg).'</div>';
|
||||||
|
} else {
|
||||||
|
return '<div class="alert alert-error pg-error-info">'.$msg.'</div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user