';
@@ -1707,4 +1903,150 @@ function getRatings($id){
return $html;
}
+function setAUPPointsUploads($submitted_by, $file_title){
+ // added (or reduce) points to the alphauserpoints when is activated in the jD config
+ // $submitted_by = user ID after upload a file
+ global $jlistConfig;
+ if ($jlistConfig['use.alphauserpoints'] && $submitted_by){
+ $api_AUP = JPATH_SITE.DS.'components'.DS.'com_alphauserpoints'.DS.'helper.php';
+ if (file_exists($api_AUP)){
+ require_once ($api_AUP);
+ $aupid = AlphaUserPointsHelper::getAnyUserReferreID( $submitted_by );
+ if ($aupid){
+ $text = JText::_('JLIST_BACKEND_SET_AUP_UPLOAD_TEXT');
+ $text = sprintf($text, $file_title);
+ AlphaUserPointsHelper::newpoints( 'plgaup_jdownloads_user_upload_published', $aupid, $file_title, $text);
+ }
+ }
+ }
+}
+
+function setAUPPointsDownload($user_id, $file_title, $price){
+ // added (or reduce) points to the alphauserpoints when is activated in the jD config
+ // $user_id = user ID from the file download
+ global $jlistConfig;
+ if ($jlistConfig['use.alphauserpoints'] && $user_id){
+ $api_AUP = JPATH_SITE.DS.'components'.DS.'com_alphauserpoints'.DS.'helper.php';
+ if (file_exists($api_AUP)){
+ require_once ($api_AUP);
+ $aupid = AlphaUserPointsHelper::getAnyUserReferreID( $user_id );
+ if ($aupid){
+ $text = JText::_('JLIST_BACKEND_SET_AUP_DOWNLOAD_TEXT');
+ $text = sprintf($text, $file_title);
+ // get AUP user data
+ $profil = AlphaUserPointsHelper:: getUserInfo ( '', $user_id );
+ if ($jlistConfig['user.can.download.file.when.zero.points'] || $profil->points > 0 || $price == 0){
+ if ($price){
+ // price as points activated
+ if ($profil->points >= $price){
+ if ($jlistConfig['use.alphauserpoints.with.price.field']){
+ AlphaUserPointsHelper::newpoints( 'plgaup_jdownloads_user_download_use_price', $aupid, '', $text, '-'.$price, $text);
+ return true;
+ } else {
+ AlphaUserPointsHelper::newpoints( 'plgaup_jdownloads_user_download', $aupid, '', $text);
+ return true;
+ }
+ } else {
+ // not enough points . no download
+ return false;
+ }
+ } else {
+ // use points set in AUP plugin
+ //AlphaUserPointsHelper::newpoints( 'plgaup_jdownloads_user_download', $aupid, '', $text);
+ return true;
+ }
+ } else {
+ // not enough points . no download
+ return false;
+ }
+ }
+ } else {
+ return true;
+ }
+ } else {
+ if ($price){
+ // not registered user
+ return false;
+ } else {
+ // guest but no price
+ return true;
+ }
+ }
+}
+
+function setAUPPointsDownloads($user_id, $file_title, $price){
+ // added (or reduce) points to the alphauserpoints when is activated in the jD config
+ // $user_id = user ID from the file download
+ global $jlistConfig;
+ if ($jlistConfig['use.alphauserpoints'] && $user_id){
+ $api_AUP = JPATH_SITE.DS.'components'.DS.'com_alphauserpoints'.DS.'helper.php';
+ if (file_exists($api_AUP)){
+ require_once ($api_AUP);
+ $aupid = AlphaUserPointsHelper::getAnyUserReferreID( $user_id );
+ if ($aupid){
+ $text = JText::_('JLIST_BACKEND_SET_AUP_DOWNLOAD_TEXT');
+ $text = sprintf($text, $file_title);
+ // get AUP user data
+ $profil = AlphaUserPointsHelper:: getUserInfo ( '', $user_id );
+ if ($jlistConfig['user.can.download.file.when.zero.points'] || $profil->points > 0 || $price == 0){
+ if ($price){
+ // price as points activated
+ AlphaUserPointsHelper::newpoints( 'plgaup_jdownloads_user_download_use_price', $aupid, '', $text, '-'.$price, $text);
+ return true;
+ } else {
+ AlphaUserPointsHelper::newpoints( 'plgaup_jdownloads_user_download', $aupid, '', $text);
+ return true;
+ }
+ } else {
+ return false;
+ }
+ }
+ } else {
+ return true;
+ }
+ } else {
+ return true;
+ }
+}
+
+function checkLog($fileid, $user){
+ global $jlistConfig;
+ $database = &JFactory::getDBO();
+ $app = JFactory::getApplication();
+ $offset = $app->getCfg('offset');
+ $datenow =& JFactory::getDate();
+ $datenow->setOffset($offset);
+
+ $date = $datenow->toFormat("%Y-%m-%d");
+ $max_files_day = $jlistConfig['limited.download.number.per.day'];
+ if ($max_files_day == 0 || $user->get('aid') == 0 || $user->get('aid') == 2){
+ // not limited or guest or special user group
+ return true;
+ } else {
+ // delete first old data sets
+ $database->setQuery("DELETE FROM #__jdownloads_log WHERE log_datetime != '$date'");
+ $database->Query();
+ // check limit
+ $logged_user_files = array();
+ $database->setQuery("SELECT * FROM #__jdownloads_log WHERE log_datetime = '$date' AND log_user = '". (int) $user->get('id')."'");
+ $logged_user_files = $database->loadObjectList();
+ if (!$logged_user_files || count($logged_user_files) < $max_files_day){
+ // add file in log
+ $database->setQuery("INSERT INTO #__jdownloads_log (log_file_id, log_ip, log_datetime, log_user, log_browser) VALUES ('".$fileid."', '".$_SERVER['REMOTE_ADDR']."', '".$date."', '".$user->get('id')."', '')");
+ $database->query();
+ return true;
+ } else {
+ // download not allowed
+ return false;
+ }
+ }
+}
+
+// added for search function
+function _ctrSort($a, $b) {
+ if (!is_array($a) || !is_array($b) || !array_key_exists("ctr", $a) || !array_key_exists("ctr", $b) || $a['ctr'] == $b['ctr'])
+ return 0;
+ return ($a['ctr'] < $b['ctr']) ? 1 : -1;
+
+}
?>
\ No newline at end of file
diff --git a/oss/joomla/trunk/components/com_jdownloads/lightbox/lightbox.js b/oss/joomla/trunk/components/com_jdownloads/lightbox/lightbox.js
index 95726e07..c18a67a5 100644
--- a/oss/joomla/trunk/components/com_jdownloads/lightbox/lightbox.js
+++ b/oss/joomla/trunk/components/com_jdownloads/lightbox/lightbox.js
@@ -38,8 +38,8 @@
//
// If you would like to use a custom loading image or close button reference them in the next two lines.
-var loadingImage = 'components/com_jdownloads/lightbox/loading.gif';
-var closeButton = 'components/com_jdownloads/lightbox/close.gif';
+var loadingImage = live_site+'components/com_jdownloads/lightbox/loading.gif';
+var closeButton = live_site+'components/com_jdownloads/lightbox/close.gif';
diff --git a/oss/joomla/trunk/components/com_jdownloads/views/upload/index.html b/oss/joomla/trunk/components/com_jdownloads/views/upload/index.html
new file mode 100644
index 00000000..fa6d84e8
--- /dev/null
+++ b/oss/joomla/trunk/components/com_jdownloads/views/upload/index.html
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/oss/joomla/trunk/components/com_jdownloads/views/upload/metadata.xml b/oss/joomla/trunk/components/com_jdownloads/views/upload/metadata.xml
new file mode 100644
index 00000000..e2a880ce
--- /dev/null
+++ b/oss/joomla/trunk/components/com_jdownloads/views/upload/metadata.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/oss/joomla/trunk/components/com_jdownloads/views/upload/tmpl/default.xml b/oss/joomla/trunk/components/com_jdownloads/views/upload/tmpl/default.xml
new file mode 100644
index 00000000..83cb4594
--- /dev/null
+++ b/oss/joomla/trunk/components/com_jdownloads/views/upload/tmpl/default.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+ JD_MENU_UPLOAD_LAYOUT
+ JD_MENU_UPLOAD_LAYOUT_DESC
+
+
+
+
\ No newline at end of file
diff --git a/oss/joomla/trunk/components/com_jdownloads/views/upload/tmpl/index.html b/oss/joomla/trunk/components/com_jdownloads/views/upload/tmpl/index.html
new file mode 100644
index 00000000..fa6d84e8
--- /dev/null
+++ b/oss/joomla/trunk/components/com_jdownloads/views/upload/tmpl/index.html
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/oss/joomla/trunk/components/com_jdownloads/views/view.download/index.html b/oss/joomla/trunk/components/com_jdownloads/views/view.download/index.html
new file mode 100644
index 00000000..fa6d84e8
--- /dev/null
+++ b/oss/joomla/trunk/components/com_jdownloads/views/view.download/index.html
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/oss/joomla/trunk/components/com_jdownloads/views/view.download/metadata.xml b/oss/joomla/trunk/components/com_jdownloads/views/view.download/metadata.xml
new file mode 100644
index 00000000..de4b1332
--- /dev/null
+++ b/oss/joomla/trunk/components/com_jdownloads/views/view.download/metadata.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/oss/joomla/trunk/components/com_jdownloads/views/view.download/tmpl/default.xml b/oss/joomla/trunk/components/com_jdownloads/views/view.download/tmpl/default.xml
new file mode 100644
index 00000000..840e7bc5
--- /dev/null
+++ b/oss/joomla/trunk/components/com_jdownloads/views/view.download/tmpl/default.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+ JD_MENU_VIEWDOWNLOAD_LAYOUT
+ JD_MENU_VIEWDOWNLOAD_LAYOUT_DESC
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/oss/joomla/trunk/components/com_jdownloads/views/view.download/tmpl/index.html b/oss/joomla/trunk/components/com_jdownloads/views/view.download/tmpl/index.html
new file mode 100644
index 00000000..fa6d84e8
--- /dev/null
+++ b/oss/joomla/trunk/components/com_jdownloads/views/view.download/tmpl/index.html
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/oss/joomla/trunk/components/com_jdownloads/views/viewcategories/index.html b/oss/joomla/trunk/components/com_jdownloads/views/viewcategories/index.html
new file mode 100644
index 00000000..fa6d84e8
--- /dev/null
+++ b/oss/joomla/trunk/components/com_jdownloads/views/viewcategories/index.html
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/oss/joomla/trunk/components/com_jdownloads/views/viewcategories/metadata.xml b/oss/joomla/trunk/components/com_jdownloads/views/viewcategories/metadata.xml
new file mode 100644
index 00000000..e1625879
--- /dev/null
+++ b/oss/joomla/trunk/components/com_jdownloads/views/viewcategories/metadata.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/oss/joomla/trunk/components/com_jdownloads/views/viewcategories/tmpl/default.xml b/oss/joomla/trunk/components/com_jdownloads/views/viewcategories/tmpl/default.xml
new file mode 100644
index 00000000..2af5e0d2
--- /dev/null
+++ b/oss/joomla/trunk/components/com_jdownloads/views/viewcategories/tmpl/default.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+ JD_MENU_CATEGORIES_LIST_LAYOUT
+ JD_MENU_CATEGORIES_LIST_LAYOUT_DESC
+
+
+
+
\ No newline at end of file
diff --git a/oss/joomla/trunk/components/com_jdownloads/views/viewcategories/tmpl/index.html b/oss/joomla/trunk/components/com_jdownloads/views/viewcategories/tmpl/index.html
new file mode 100644
index 00000000..fa6d84e8
--- /dev/null
+++ b/oss/joomla/trunk/components/com_jdownloads/views/viewcategories/tmpl/index.html
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/oss/joomla/trunk/components/com_jdownloads/views/viewcategory/index.html b/oss/joomla/trunk/components/com_jdownloads/views/viewcategory/index.html
new file mode 100644
index 00000000..fa6d84e8
--- /dev/null
+++ b/oss/joomla/trunk/components/com_jdownloads/views/viewcategory/index.html
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/oss/joomla/trunk/components/com_jdownloads/views/viewcategory/metadata.xml b/oss/joomla/trunk/components/com_jdownloads/views/viewcategory/metadata.xml
new file mode 100644
index 00000000..3b94282f
--- /dev/null
+++ b/oss/joomla/trunk/components/com_jdownloads/views/viewcategory/metadata.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/oss/joomla/trunk/components/com_jdownloads/views/viewcategory/tmpl/default.xml b/oss/joomla/trunk/components/com_jdownloads/views/viewcategory/tmpl/default.xml
new file mode 100644
index 00000000..f5d2cb20
--- /dev/null
+++ b/oss/joomla/trunk/components/com_jdownloads/views/viewcategory/tmpl/default.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+ JD_MENU_CATEGORY_LIST_LAYOUT
+ JD_MENU_CATEGORY_LIST_LAYOUT_DESC
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/oss/joomla/trunk/components/com_jdownloads/views/viewcategory/tmpl/index.html b/oss/joomla/trunk/components/com_jdownloads/views/viewcategory/tmpl/index.html
new file mode 100644
index 00000000..fa6d84e8
--- /dev/null
+++ b/oss/joomla/trunk/components/com_jdownloads/views/viewcategory/tmpl/index.html
@@ -0,0 +1 @@
+
\ No newline at end of file