]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - scripts/makegroupadmin.php
Make attachment fit better in notice: drop text and link
[quix0rs-gnu-social.git] / scripts / makegroupadmin.php
old mode 100644 (file)
new mode 100755 (executable)
index 07f980d..58277c9
@@ -18,7 +18,8 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
 
 $shortoptions = 'g:n:';
 $longoptions = array('nickname=', 'group=');
@@ -44,13 +45,13 @@ if (empty($nickname) || empty($groupname)) {
 
 try {
 
-    $user = User::staticGet('nickname', $nickname);
+    $user = User::getKV('nickname', $nickname);
 
     if (empty($user)) {
         throw new Exception("No user named '$nickname'.");
     }
 
-    $group = User_group::staticGet('nickname', $groupname);
+    $group = User_group::getKV('nickname', $groupname);
 
     if (empty($group)) {
         throw new Exception("No group named '$groupname'.");
@@ -67,7 +68,7 @@ try {
         $member->created    = common_sql_now();
 
         if (!$member->insert()) {
-            throw new Exception("Cannot add '$nickname' to '$groupname'.");
+            throw new Exception("Can't add '$nickname' to '$groupname'.");
         }
     }
 
@@ -80,7 +81,7 @@ try {
     $member->is_admin = 1;
 
     if (!$member->update($orig)) {
-        throw new Exception("Cannot make '$nickname' admin of '$groupname'.");
+        throw new Exception("Can't make '$nickname' admin of '$groupname'.");
     }
 
 } catch (Exception $e) {