Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Libraries properly supported.

Fixed crash issue with plugin dependency not existing
Validate code updated (was correct on site)
Validate URL updated to npppluginmgr project on SF.
  • Loading branch information...
commit f605ecb22f93615bd360e4509ab5b274eed2a830 1 parent 2dc7437
@bruderstein authored
View
2  libinstall/include/libinstall/Validate.h
@@ -2,7 +2,7 @@
#define _VALIDATE_H
-#define VALIDATE_BASEURL _T("http://notepad-plus.sourceforge.net/commun/pluginManager/validate.php?md5=")
+#define VALIDATE_BASEURL _T("http://npppluginmgr.sourceforge.net/app/validate.php?md5=")
#define VALIDATE_RESULT_OK "ok"
#define VALIDATE_RESULT_UNKNOWN "unknown"
#define VALIDATE_RESULT_BANNED "banned"
View
2  pluginManager/src/Plugin.cpp
@@ -30,7 +30,7 @@ using namespace boost;
Plugin::Plugin(void)
-: _isInstalled(FALSE), _detailsAdded(FALSE), _updateDetailsAdded(FALSE)
+: _isInstalled(FALSE), _detailsAdded(FALSE), _updateDetailsAdded(FALSE), _isLibrary(FALSE)
{
}
View
5 pluginManager/src/Plugin.h
@@ -57,7 +57,7 @@ class Plugin
void setLatestUpdate(const TCHAR* latestUpdate);
void setStability(const TCHAR* stability);
void setInstalledForAllUsers(BOOL installedForAllUsers);
-
+ void setIsLibrary(BOOL isLibrary) { _isLibrary = isLibrary; }
/* Getters */
tstring& getName();
PluginVersion& getVersion();
@@ -70,6 +70,8 @@ class Plugin
tstring& getStability();
tstring& getUpdateDescription();
BOOL getInstalledForAllUsers();
+ BOOL getIsLibrary() { return _isLibrary; }
+
/* General methods */
BOOL isInstalled();
@@ -122,6 +124,7 @@ class Plugin
BOOL _detailsAdded;
BOOL _updateDetailsAdded;
BOOL _installedForAllUsers;
+ BOOL _isLibrary;
/* Dependencies on other plugins */
std::list<tstring> _dependencies;
View
61 pluginManager/src/PluginList.cpp
@@ -341,6 +341,20 @@ BOOL PluginList::parsePluginFile(CONST TCHAR *filename)
plugin->setStability(_T("Good"));
+ TiXmlElement *isLibraryElement = pluginNode->FirstChildElement(_T("isLibrary"));
+ if (isLibraryElement && isLibraryElement->FirstChild())
+ {
+ tstring isLibrary(isLibraryElement->FirstChild()->Value());
+ if (isLibrary == _T("true"))
+ {
+ _libraries[plugin->getName()] = plugin;
+ plugin->setIsLibrary(true);
+ }
+ }
+
+
+
+
if (available)
_plugins[plugin->getName()] = plugin;
@@ -742,13 +756,23 @@ VariableHandler* PluginList::getVariableHandler()
Plugin* PluginList::getPlugin(tstring name)
{
- return _plugins[name];
+ Plugin* plugin = _plugins[name];
+ if (NULL == plugin)
+ {
+ plugin = _libraries[name];
+ }
+ return plugin;
}
BOOL PluginList::isInstallOrUpgrade(const tstring& name)
{
Plugin* plugin = _plugins[name];
- if (plugin->isInstalled() && plugin->getVersion() <= plugin->getInstalledVersion())
+ if (NULL == plugin)
+ {
+ plugin = _libraries[name];
+ }
+
+ if (!plugin || (plugin->isInstalled() && plugin->getVersion() <= plugin->getInstalledVersion()))
return FALSE;
else
return TRUE;
@@ -771,6 +795,7 @@ boost::shared_ptr< list<tstring> > PluginList::calculateDependencies(boost::shar
++pluginIter;
}
+
// Now check all dependencies are in the name map
pluginIter = selectedPlugins->begin();
while(pluginIter != selectedPlugins->end())
@@ -788,11 +813,15 @@ boost::shared_ptr< list<tstring> > PluginList::calculateDependencies(boost::shar
if (isInstallOrUpgrade(*depIter))
{
Plugin* dependsPlugin = getPlugin(*depIter);
- toBeInstalled.insert(*depIter);
+ if (NULL != dependsPlugin)
+ {
+ toBeInstalled.insert(*depIter);
- selectedPlugins->push_back(dependsPlugin);
- // Add the name to the list to show the message
- installDueToDepends->push_back(*depIter);
+ selectedPlugins->push_back(dependsPlugin);
+ // Add the name to the list to show the message
+ installDueToDepends->push_back(*depIter);
+
+ }
}
}
@@ -994,6 +1023,8 @@ void PluginList::installPlugins(HWND hMessageBoxParent, ProgressDialog* progress
if (!installDueToDepends->empty())
{
+ bool dependentPluginsToInstall = false;
+
tstring dependsMessage = _T("The following plugin");
if (installDueToDepends->size() > 1)
dependsMessage.append(_T("s"));
@@ -1001,14 +1032,24 @@ void PluginList::installPlugins(HWND hMessageBoxParent, ProgressDialog* progress
dependsMessage.append(_T(" need to be installed to support your selection.\r\n\r\n"));
for(list<tstring>::iterator msgIter = installDueToDepends->begin(); msgIter != installDueToDepends->end(); msgIter++)
{
- dependsMessage.append(*msgIter);
- dependsMessage.append(_T("\r\n"));
+ Plugin *plugin = getPlugin(*msgIter);
+ if (plugin && !plugin->getIsLibrary())
+ {
+ dependsMessage.append(*msgIter);
+ dependsMessage.append(_T("\r\n"));
+ dependentPluginsToInstall = true;
+ }
+
+
}
dependsMessage.append(_T("\r\nThey will be installed automatically."));
-
- ::MessageBox(hMessageBoxParent, dependsMessage.c_str(), _T("Plugin Manager"), MB_OK | MB_ICONINFORMATION);
+ // Only display the message if there are real plugin dependencies to install, and not just libraries
+ if (dependentPluginsToInstall)
+ {
+ ::MessageBox(hMessageBoxParent, dependsMessage.c_str(), _T("Plugin Manager"), MB_OK | MB_ICONINFORMATION);
+ }
}
View
1  pluginManager/src/PluginList.h
@@ -85,6 +85,7 @@ class PluginList
private:
/* Plugin name map */
PluginContainer _plugins;
+ PluginContainer _libraries;
/* Hashes to real names, for plugins that dynamically report their names */
std::map<tstring, tstring> _pluginRealNames;
View
6 pluginManager/src/PluginManagerVersion.h
@@ -1,9 +1,9 @@
#ifndef _PLUGINMANAGERVERSION_H
#define _PLUGINMANAGERVERSION_H
-#define PLUGINMANAGERVERSION_STRING "1.0.4.0"
-#define PLUGINMANAGERVERSION_RESOURCE 1,0,4,0
-#define PLUGINMANAGERVERSION_RESOURCE_STRING "1, 0, 4, 0"
+#define PLUGINMANAGERVERSION_STRING "1.0.5.0"
+#define PLUGINMANAGERVERSION_RESOURCE 1,0,5,0
+#define PLUGINMANAGERVERSION_RESOURCE_STRING "1, 0, 5, 0"
#define PLUGINMANAGERVERSION_RELEASEDATE "December 2011"
#endif
View
4 website/.htaccess
@@ -0,0 +1,4 @@
+<Limit GET POST PUT>
+ Order Allow,Deny
+ Deny from all
+</Limit>
View
33 website/validate.php
@@ -1,25 +1,30 @@
<?
- define('IN_PLUGIN_MANAGER', 'true');
- require_once('settings.php');
-
- if (!isset($_GET["md5"]))
+if (!isset($_GET["md5"]))
echo "param_error";
- else
- {
- $conn = new PDO('sqlite:hidden/files.db3');
-
- $md5 = str_replace("'", "\\'", $_GET["md5"]);
- $sql = "select status from FileHash where md5sum='" . $md5 . "'";
- $conn->query($sql);
- $row = $query->fetch();
+else
+{
+ try {
+ $db = substr(__FILE__, 0, strlen(__FILE__) - strlen(strrchr(__FILE__, '/')))
+ . '/hidden/files.db3';
+ $conn = new PDO("sqlite:$db");
+ } catch (Exception $e){
+
+ echo "connect_error";
+ exit;
+ }
+
+ $md5 = str_replace("'", "\\'", $_GET["md5"]);
+ $sql = "select status from FileHash where md5sum='" . $md5 . "'";
+ $query = $conn->query($sql);
+ $row = $query->fetch();
- if ($row == FALSE)
+ if ($row == FALSE)
echo "unknown";
else if ($row['status'] == "ok" || $row['status'] == "banned")
echo $row['status'];
- else
+ else
echo "unknown";
}
Please sign in to comment.
Something went wrong with that request. Please try again.