Permalink
Browse files

Namespace everything in /src and then fix everything that broke. I th…

…ink it got it all, but we'll never know.
  • Loading branch information...
1 parent 2209af9 commit 1073f5b9a66e015d85196108063e0cc1e0142bd7 @jlbooker jlbooker committed Oct 27, 2016
Showing with 490 additions and 481 deletions.
  1. +1 −1 Autoloaders/Phpws2Loader.php
  2. +8 −7 Autoloaders/canopy.php
  3. +0 −2 core/class/DB/PHPWS_DB_Where.php
  4. +0 −2 core/class/Error.php
  5. +0 −2 core/class/Form.php
  6. +0 −2 core/class/Item.php
  7. +1 −3 core/class/Module.php
  8. +0 −2 core/class/PHPWS_Item.php
  9. +0 −2 core/class/Text.php
  10. +4 −3 index.php
  11. +1 −1 mod/access/class/Shortcut.php
  12. +1 −1 mod/access/inc/close.php
  13. +3 −3 mod/block/class/Block.php
  14. +2 −2 mod/block/inc/close.php
  15. +1 −2 mod/filecabinet/class/Cabinet.php
  16. +3 −3 mod/filecabinet/class/FC_Forms.php
  17. +1 −1 mod/filecabinet/class/FC_Forms/FC_Images.php
  18. +7 −8 mod/layout/class/Layout.php
  19. +11 −12 mod/menu/class/Menu.php
  20. +15 −15 mod/menu/class/Menu_Admin.php
  21. +4 −5 mod/menu/class/Menu_Item.php
  22. +2 −3 mod/menu/class/Menu_Link.php
  23. +30 −30 mod/menu/templates/admin/administrate.html
  24. +1 −2 mod/pagesmith/class/PS_Forms.php
  25. +9 −10 mod/pagesmith/class/PS_Page.php
  26. +3 −4 mod/pagesmith/inc/close.php
  27. +1 −1 mod/pagesmith/inc/runtime.php
  28. +1 −1 mod/pulse/class/PulseAdminController.php
  29. +3 −3 mod/search/class/User.php
  30. +1 −2 mod/users/class/Current_User.php
  31. +1 −1 secure/index.php
  32. +1 −1 src-phpws-legacy/src/Error.php
  33. +5 −5 src-phpws-legacy/src/PHPWS_Core.php
  34. +1 −2 src-phpws-legacy/src/PHPWS_File.php
  35. +1 −1 src-phpws-legacy/src/PHPWS_Mail.php
  36. +1 −2 src-phpws-legacy/src/PHPWS_Module.php
  37. +2 −2 src-phpws-legacy/src/PHPWS_Template.php
  38. +1 −2 src-phpws-legacy/src/Text.php
  39. +1 −1 src-phpws2/src/Activity.php
  40. +1 −1 src-phpws2/src/Body.php
  41. +1 −1 src-phpws2/src/Database/Alias.php
  42. +3 −3 src-phpws2/src/Database/Conditional.php
  43. +1 −1 src-phpws2/src/Database/DB.php
  44. +7 −6 src-phpws2/src/Database/DSN.php
  45. +1 −1 src-phpws2/src/Database/Datatype.php
  46. +1 −1 src-phpws2/src/Database/Value.php
  47. +2 −1 src-phpws2/src/Error.php
  48. +4 −4 src-phpws2/src/Form.php
  49. +1 −1 src-phpws2/src/Head.php
  50. +1 −1 src-phpws2/src/Http/Controller.php
  51. +3 −3 src-phpws2/src/Http/ErrorResponse.php
  52. +1 −1 src-phpws2/src/Http/Exception.php
  53. +3 −3 src-phpws2/src/ModuleRepository.php
  54. +2 −2 src-phpws2/src/PageCache.php
  55. +1 −1 src-phpws2/src/Pager.php
  56. +1 −1 src-phpws2/src/Session.php
  57. +1 −1 src-phpws2/src/Settings.php
  58. +3 −3 src-phpws2/src/Tag.php
  59. +4 −4 src-phpws2/src/Variable.php
  60. +1 −1 src-phpws2/src/View/HtmlErrorView.php
  61. +3 −2 src/Array.php
  62. +4 −0 src/Bootstrap.php
  63. +6 −5 src/CompatibilityModule.php
  64. +2 −1 src/Controller.php
  65. +3 −2 src/Data.php
  66. +2 −1 src/File.php
  67. +2 −1 src/GlobalModule.php
  68. +98 −98 src/Http.php
  69. +18 −17 src/Key.php
  70. +57 −49 src/Log.php
  71. +8 −7 src/Module.php
  72. +8 −7 src/PhpwebsiteController.php
  73. +5 −4 src/Request.php
  74. +3 −3 src/Response.php
  75. +1 −0 src/Security.php
  76. +8 −7 src/Server.php
  77. +64 −61 src/String.php
  78. +26 −22 src/Translation.php
  79. +1 −1 themes/bootstrap/theme.php
@@ -2,7 +2,7 @@
function Phpws2Loader($class_name)
{
- // Class name must start with the 'phpws\' namespace. If not, we pass and hope another autoloader can help
+ // Class name must start with the 'phpws2\' namespace. If not, we pass and hope another autoloader can help
// This is faster than searching the n-element $not_found array, so we'll fail faster by checking this before searching the array
if(substr($class_name, 0, strlen('phpws2\\')) !== 'phpws2\\'){
return false;
@@ -2,21 +2,22 @@
function CanopyLoader($class_name)
{
+ if(substr($class_name, 0, strlen('Canopy\\')) !== 'Canopy\\'){
+ return false;
+ }
+
static $not_found = array();
if (in_array($class_name, $not_found)) {
return;
}
- $class_array = explode('\\', $class_name);
- $class_dir = array_shift($class_array);
+ $file_path = PHPWS_SOURCE_DIR . 'src/' . str_replace('\\', '/', str_replace('Canopy\\', '', $class_name)) . '.php';
- $base_dir = PHPWS_SOURCE_DIR . "src/$class_dir/autoload.php";
-
- if (is_file($base_dir)) {
- require_once $base_dir;
+ if (is_readable($file_path)) {
+ require_once $file_path;
return true;
} else {
- $not_found[] = $class_name;
return false;
+ $not_found[] = $class_name;
}
}
@@ -1,5 +1,3 @@
<?php
-require_once PHPWS_SOURCE_DIR . 'src/phpws/src/DB/PHPWS_DB_Where.php';
-
class PHPWS_DB_Where extends \phpws\DB\PHPWS_DB_Where {}
@@ -1,7 +1,5 @@
<?php
-require_once PHPWS_SOURCE_DIR . 'src/phpws/src/Error.php';
-
class Error extends \phpws\PHPWS_Error
{
View
@@ -1,7 +1,5 @@
<?php
-require_once PHPWS_SOURCE_DIR . 'src/phpws/src/PHPWS_Form.php';
-
class Form extends \phpws\PHPWS_Form
{
View
@@ -1,7 +1,5 @@
<?php
-require_once PHPWS_SOURCE_DIR . 'src/phpws/src/Item.php';
-
class Item extends \phpws\PHPWS_Item
{
@@ -1,5 +1,3 @@
<?php
-require_once PHPWS_SOURCE_DIR . 'src/phpws/src/Module.php';
-
-class Module extends \phpws\PHPWS_Module{}
+class Module extends \phpws\PHPWS_Module{}
@@ -1,7 +1,5 @@
<?php
-require_once PHPWS_SOURCE_DIR . 'src/phpws/src/Item.php';
-
class PHPWS_Item extends \phpws\PHPWS_Item
{
View
@@ -1,7 +1,5 @@
<?php
-require_once PHPWS_SOURCE_DIR . 'src/phpws/src/Text.php';
-
class Text extends \phpws\PHPWS_Text
{
View
@@ -42,10 +42,11 @@
\phpws\PHPWS_Core::checkOverpost();
\phpws\PHPWS_Core::setLastPost();
Language::setLocale(Settings::get('Global', 'language'));
-loadTimeZone();
-$request = \Server::getCurrentRequest();
-$controller = new PhpwebsiteController();
+\Canopy\Log::loadTimeZone();
+
+$request = \Canopy\Server::getCurrentRequest();
+$controller = new \Canopy\PhpwebsiteController();
$controller->execute($request);
/**
@@ -40,7 +40,7 @@ public function init()
public function loadGet()
{
$url = explode(':', $this->url);
- $request = \Server::getCurrentRequest();
+ $request = \Canopy\Server::getCurrentRequest();
$module = array_shift($url);
$request->setVar('module', $module);
$request->setModule($module);
@@ -17,7 +17,7 @@
if (MOD_REWRITE_ENABLED && Current_User::allow('access')) {
- $key = Key::getCurrent();
+ $key = \Canopy\Key::getCurrent();
if (!empty($key) && !$key->isDummy()) {
\phpws\PHPWS_Core::initModClass('access', 'Access.php');
Access::shortcut($key);
@@ -15,7 +15,7 @@ public static function show()
{
Block::showAllBlocks();
- $key = Key::getCurrent();
+ $key = \Canopy\Key::getCurrent();
if (empty($key) || $key->isDummy(true)) {
return;
@@ -26,7 +26,7 @@ public static function show()
public static function showAllBlocks()
{
- $key = new Key;
+ $key = new \Canopy\Key;
$key->id = -1;
Block::showBlocks($key);
}
@@ -36,7 +36,7 @@ public static function showBlocks($key)
$db = new PHPWS_DB('block');
$db->addWhere('block_pinned.key_id', $key->id);
$db->addWhere('id', 'block_pinned.block_id');
- Key::restrictView($db, 'block');
+ \Canopy\Key::restrictView($db, 'block');
$result = $db->getObjects('Block_Item');
if (PHPWS_Error::isError($result)) {
@@ -7,8 +7,8 @@
if (Current_User::allow('block')) {
- $key = Key::getCurrent();
- if (Key::checkKey($key) && javascriptEnabled()) {
+ $key = \Canopy\Key::getCurrent();
+ if (\Canopy\Key::checkKey($key) && javascriptEnabled()) {
javascript('jquery');
javascript('ckeditor');
$js_address = PHPWS_SOURCE_HTTP . 'mod/block/javascript/addblock/script.js';
@@ -41,7 +41,7 @@ public function fmAdmin()
if (!$this->authenticate()) {
Current_User::disallow();
}
- require_once PHPWS_SOURCE_DIR . 'src/phpws/src/Security.php';
+ require_once PHPWS_SOURCE_DIR . 'src-phpws-legacy/src/Security.php';
if ($this->loadFileManager()) {
Layout::nakedDisplay($this->file_manager->admin(), null, false);
} else {
@@ -1367,4 +1367,3 @@ public static function setMessage($message)
}
}
-
@@ -41,7 +41,7 @@ private function printFolderFiles()
}
/**
- *
+ *
* @return void
*/
private function form()
@@ -82,7 +82,7 @@ private function loadFactory()
public function handle()
{
- $request = \Server::getCurrentRequest();
+ $request = \Canopy\Server::getCurrentRequest();
try {
switch ($request->getVar('ckop')) {
case 'form':
@@ -310,7 +310,7 @@ private function uploadFileToFolder($folder, $filename, $ftype)
/**
* Saves the $file object to the database depending on the file type. This is because Image, Document and Multimedia
- * have different save() parameters.
+ * have different save() parameters.
* @param mixed $file
*/
private function saveUploadedFile($file)
@@ -32,7 +32,7 @@ public function getForm()
public function printFolderFiles()
{
- $request = \Server::getCurrentRequest();
+ $request = \Canopy\Server::getCurrentRequest();
$show_thumbnail = ($request->isVar('thumbnail') && $request->getVar('thumbnail') == 1);
$files = $this->getFolderFileList('images');
foreach ($files as $k => $f) {
@@ -172,7 +172,7 @@ public static function addJSHeader($script, $index = NULL)
}
$GLOBALS['Layout_JS'][$index]['head'] = $script;
}
-
+
public static function removeJSHeader($index)
{
unset($GLOBALS['Layout_JS'][$index]);
@@ -913,8 +913,8 @@ public static function loadHeaderTags(&$template)
$page_metatags = null;
$theme = Layout::getCurrentTheme();
- $key = Key::getCurrent();
- if (Key::checkKey($key, false)) {
+ $key = \Canopy\Key::getCurrent();
+ if (\Canopy\Key::checkKey($key, false)) {
$page_metatags = Layout::getMetaPage($key->id);
if (PHPWS_Error::isError($page_metatags)) {
@@ -1058,8 +1058,8 @@ public static function getExtraStyles()
public static function showKeyStyle()
{
- $key = Key::getCurrent();
- if (!Key::checkKey($key)) {
+ $key = \Canopy\Key::getCurrent();
+ if (!\Canopy\Key::checkKey($key)) {
return NULL;
}
$style = Layout::getKeyStyle($key->id);
@@ -1081,8 +1081,8 @@ public static function keyDescriptions()
if (!PHPWS_Settings::get('layout', 'use_key_summaries')) {
return;
}
- $key = Key::getCurrent();
- if (!Key::checkKey($key, false)) {
+ $key = \Canopy\Key::getCurrent();
+ if (!\Canopy\Key::checkKey($key, false)) {
return NULL;
}
if (!empty($key->summary)) {
@@ -1093,4 +1093,3 @@ public static function keyDescriptions()
}
}
-
@@ -22,7 +22,7 @@ public static function getPinAllMenus()
$db = new PHPWS_DB('menus');
$db->addWhere('pin_all', 1);
$db->loadClass('menu', 'Menu_Item.php');
- Key::restrictView($db, 'menu');
+ \Canopy\Key::restrictView($db, 'menu');
return $db->getObjects('Menu_Item');
}
@@ -61,7 +61,7 @@ public static function miniadmin()
\PHPWS_Text::secureLink('<span class="fa fa-cog"></span> Administrate menus',
'menu', array('command' => 'list')));
- $key = \Key::getCurrent();
+ $key = \Canopy\Key::getCurrent();
$link_list = self::getLinkList();
if ($key && !$key->isDummy(true)) {
@@ -79,7 +79,7 @@ public static function miniadmin()
MiniAdmin::add('menu',
'<a href="javascript:void(0)" data-key-id="' . $key->id
. '" data-menu-id="' . $menu_id
- . '" id="menu-remove-page"><span class="fa fa-times"></span> ' . t('Remove from %s',
+ . '" id="menu-remove-page"><span class="fa fa-times"></span> ' . \Canopy\Translation::t('Remove from %s',
$menu_title) . '</a>');
$found = true;
}
@@ -100,7 +100,7 @@ private static function miniadminAddMenu($key)
$choice[] = '<div class="input-group-sm" style="margin-bottom : 5px"><select class="form-control" name="menu_id" id="menu-add-page" data-key-id="'
. $key->id . '">';
- $choice[] = '<option value="0" disabled="disabled" selected="selected"><i class="fa fa-caret-down"></i>' . t('Add link to menu') . '</option>';
+ $choice[] = '<option value="0" disabled="disabled" selected="selected"><i class="fa fa-caret-down"></i>' . \Canopy\Translation::t('Add link to menu') . '</option>';
foreach ($menus as $menu) {
$choice[] = '<option value="' . $menu['id'] . '">' . $menu['title'] . '</option>';
}
@@ -125,7 +125,7 @@ private static function miniadminUnpin($key)
$choice[] = '<div class="input-group-sm" style="margin-bottom : 5px"><select class="form-control" name="menu_id" id="menu-unpin-page" data-key-id="'
. $key->id . '">';
- $choice[] = '<option value="0" disabled="disabled" selected="selected"><i class="fa fa-caret-down"></i>' . t('Remove menu') . '</option>';
+ $choice[] = '<option value="0" disabled="disabled" selected="selected"><i class="fa fa-caret-down"></i>' . \Canopy\Translation::t('Remove menu') . '</option>';
$menu_found = false;
foreach ($menus as $menu) {
if (in_array($menu['id'], $ignore)) {
@@ -159,7 +159,7 @@ private static function miniadminPinMenu($key)
$choice[] = '<div class="input-group-sm" style="margin-bottom : 5px"><select class="form-control" name="menu_id" id="menu-pin-page" data-key-id="'
. $key->id . '">';
$choice[] = '<option value="0" disabled="disabled" selected="selected"><i class="fa fa-caret-down"></i>' .
- t('Show menu here') . '</option>';
+ \Canopy\Translation::t('Show menu here') . '</option>';
$menu_found = false;
foreach ($menus as $menu) {
if (!in_array($menu['id'], $ignore)) {
@@ -213,7 +213,7 @@ public static function show()
81);
$seen = array();
- $key = Key::getCurrent();
+ $key = \Canopy\Key::getCurrent();
if (empty($key) || empty($key->title) || empty($key->url)) {
return;
}
@@ -222,7 +222,7 @@ public static function show()
$db->addWhere('menu_assoc.key_id', $key->id);
$db->addWhere('id', 'menu_assoc.menu_id');
$db->loadClass('menu', 'Menu_Item.php');
- Key::restrictView($db, 'menu');
+ \Canopy\Key::restrictView($db, 'menu');
$result = $db->getObjects('Menu_Item');
if (PHPWS_Error::isError($result)) {
@@ -367,7 +367,7 @@ public static function updateKeyLink($key_id)
return false;
}
- $key = new Key($key_id);
+ $key = new \Canopy\Key($key_id);
if ($key->isDummy()) {
return false;
@@ -421,7 +421,7 @@ public static function categoryView()
$k->getField('id'), '='), 'left');
$m->addOrderBy($m->getField('queue'));
- $key = \Key::getCurrent();
+ $key = \Canopy\Key::getCurrent();
if ($key && $key->id) {
$current_key_id = $key->id;
} else {
@@ -487,7 +487,7 @@ private static function getCategoryViewLine($menu, $active)
*/
private static function getCurrentActiveMenu()
{
- $key = \Key::getCurrent(true);
+ $key = \Canopy\Key::getCurrent(true);
if (empty($key) || $key->isDummy(true)) {
return -1;
} elseif ($key->isHomeKey()) {
@@ -517,4 +517,3 @@ private static function getCurrentActiveMenu()
}
}
-
Oops, something went wrong.

0 comments on commit 1073f5b

Please sign in to comment.