Example #1
0
 function destroy($params)
 {
     if (empty($params['id'])) {
         bail('Required param["id"] not set.');
     }
     $note = new note($params['id']);
     $note->destroy();
     $this->redirectTo(array('controller' => 'Note', 'action' => 'index'));
 }
Example #2
0
 static function activate($uid, $karmalevel = 'pear.dev')
 {
     require_once 'Damblan/Karma.php';
     global $dbh, $auth_user;
     $karma = new Damblan_Karma($dbh);
     $user = user::info($uid, null, 0);
     if (!isset($user['registered'])) {
         return false;
     }
     @($arr = unserialize($user['userinfo']));
     include_once 'pear-database-note.php';
     note::removeAll($uid);
     $data = array();
     $data['registered'] = 1;
     $data['active'] = 1;
     /* $data['ppp_only'] = 0; */
     if (is_array($arr)) {
         $data['userinfo'] = $arr[1];
     }
     $data['created'] = gmdate('Y-m-d H:i');
     $data['createdby'] = $auth_user->handle;
     $data['handle'] = $user['handle'];
     user::update($data, true);
     $karma->grant($user['handle'], $karmalevel);
     if ($karma->has($user['handle'], 'pear.dev')) {
         include_once 'pear-rest.php';
         $pear_rest = new pearweb_Channel_REST_Generator(PEAR_REST_PATH, $dbh);
         $pear_rest->saveMaintainerREST($user['handle']);
         $pear_rest->saveAllMaintainersREST();
     }
     include_once 'pear-database-note.php';
     note::add($uid, "Account opened");
     $msg = "Your PEAR account request has been opened.\n" . "To log in, go to http://" . PEAR_CHANNELNAME . "/ and click on \"login\" in\n" . "the top-right menu.\n";
     $xhdr = 'From: ' . $auth_user->handle . '@php.net';
     if (!DEVBOX) {
         mail($user['email'], "Your PEAR Account Request", $msg, $xhdr, '-f ' . PEAR_BOUNCE_EMAIL);
     }
     return true;
 }
Example #3
0
 function activate($uid)
 {
     global $dbh, $auth_user;
     $user =& new PEAR_User($dbh, $uid);
     if (@$user->registered) {
         return false;
     }
     @($arr = unserialize($user->userinfo));
     note::removeAll("uid", $uid);
     $user->set('registered', 1);
     /* $user->set('ppp_only', 0); */
     if (is_array($arr)) {
         $user->set('userinfo', $arr[1]);
     }
     $user->set('created', gmdate('Y-m-d H:i'));
     $user->set('createdby', $auth_user->handle);
     $user->set('registered', 1);
     $user->store();
     note::add("uid", $uid, "Account opened");
     $GLOBALS['pear_rest']->saveMaintainerREST($user->handle);
     $GLOBALS['pear_rest']->saveAllmaintainersREST();
     $msg = "Your PECL/PEAR account request has been opened.\n" . "To log in, go to http://pecl.php.net/ and click on \"login\" in\n" . "the top-right menu.\n";
     $xhdr = "From: " . $auth_user->handle . "@php.net";
     mail($user->email, "Your PECL Account Request", $msg, $xhdr, "-f noreply@php.net");
     return true;
 }
Example #4
0
         exit;
     }
     include_once 'pear-database-note.php';
     switch ($_GET['action']) {
         case "remove":
             $res = $karma->remove($handle, $_GET['level']);
             if ($res) {
                 echo "Successfully <b>removed</b> karma &quot;" . htmlspecialchars($_GET['level']) . "&quot;<br /><br />";
                 note::add($handle, 'removed ' . $_GET['level'] . ' karma', $auth_user->handle);
             }
             break;
         case "grant":
             $res = $karma->grant($handle, $_POST['level']);
             if ($res) {
                 echo "Successfully <b>added</b> karma &quot;" . htmlspecialchars($_POST['level']) . "&quot;<br /><br />";
                 note::add($handle, 'added ' . $_POST['level'] . ' karma', $auth_user->handle);
             }
             break;
     }
 }
 $user_karma = $karma->get($handle);
 if (count($user_karma) == 0) {
     echo 'No karma yet';
 } else {
     $table = new HTML_Table('style="width: 90%"');
     $table->setCaption('Karma levels for ' . htmlspecialchars($handle), 'style="background-color: #CCCCCC;"');
     $table->addRow(array("Level", "Added by", "Added at", "Remove"), null, 'th');
     foreach ($user_karma as $item) {
         $remove = sprintf("karma.php?action=remove&amp;handle=%s&amp;level=%s", htmlspecialchars($handle), htmlspecialchars($item['level']));
         $table->addRow(array(htmlspecialchars($item['level']), htmlspecialchars($item['granted_by']), htmlspecialchars($item['granted_at']), make_link($remove, make_image("delete.gif"), false, 'onclick="javascript:return confirm(\'Do you really want to remove the karma level ' . htmlspecialchars($item['level']) . '?\');"')));
     }
$datum = new datum();
$db = new basis_db();
$lehrveranstaltungen = array();
if (isset($_GET['uid'])) {
    $uid = $_GET['uid'];
} else {
    $uid = null;
}
$uid_arr = explode(";", $uid);
if ($uid_arr[0] == "") {
    unset($uid_arr[0]);
    $uid_arr = array_values($uid_arr);
}
// Noten laden
$note_arr = array();
$note = new note();
$note->getAll();
foreach ($note->result as $n) {
    $note_arr[$n->note]['anmerkung'] = $n->anmerkung;
    $note_arr[$n->note]['positiv'] = $n->positiv;
}
$note_arr['']['anmerkung'] = '';
$note_arr['']['positiv'] = false;
// Studienjahr ermitteln
if (isset($_GET['ss'])) {
    $studiensemester_kurzbz = $_GET['ss'];
} else {
    die('Parameter SS fehlt');
}
$studiensemester = new studiensemester();
$studiensemester_kurzbz2 = $studiensemester->getStudienjahrStudiensemester($studiensemester_kurzbz);
Example #6
0
 function confirmRequest($handle, $password, $name)
 {
     $sql = 'SELECT handle FROM users WHERE handle = ?';
     if ($handle == $this->dbh->getOne($sql, array($handle))) {
         $id = $this->dbh->nextId("karma");
         $query = 'INSERT INTO karma VALUES (?, ?, ?, ?, NOW())';
         $sth = $this->dbh->query($query, array($id, $this->handle, 'pear.bug', 'pearweb'));
         return true;
     }
     list($firstname, $lastname) = explode(' ', $name, 2);
     $data = array('handle' => $handle, 'firstname' => $firstname, 'lastname' => $lastname, 'email' => $this->email, 'purpose' => 'bug tracker', 'password' => $password, 'password2' => $password, 'purpose' => 'Open/Comment on bugs', 'moreinfo' => 'Automatic Account Request', 'homepage' => '');
     include_once 'pear-database-user.php';
     $useradd = user::add($data, true, true);
     if ($useradd !== true) {
         return $useradd;
     }
     $sql = 'SELECT handle from bug_account_request WHERE salt = ?';
     $temphandle = $this->dbh->getOne($sql, array($this->salt));
     // update all relevant records to the new handle
     $this->dbh->query('UPDATE bugdb_comments set reporter_name = ? WHERE handle = ?', array($name, $temphandle));
     $this->dbh->query('UPDATE bugdb set reporter_name = ? WHERE handle = ?', array($name, $temphandle));
     $this->dbh->query('UPDATE users set handle = ? WHERE handle = ?', array($handle, $temphandle));
     $this->dbh->query('UPDATE bugdb set registered = 1, handle = ? WHERE handle = ?', array($handle, $temphandle));
     $this->dbh->query('UPDATE bugdb_comments set handle = ? WHERE handle = ?', array($handle, $temphandle));
     $this->dbh->query('UPDATE bugdb_patchtracker set developer = ? WHERE developer = ?', array($handle, $temphandle));
     $this->handle = $handle;
     // activate the handle and grant karma
     // implicitly without human intervention
     // copied from the user class and Damblan_Karma
     include_once 'pear-database-user.php';
     $user = user::info($handle, null, 0);
     if (!isset($user['registered'])) {
         return false;
     }
     @($arr = unserialize($user['userinfo']));
     include_once 'pear-database-note.php';
     note::removeAll($handle);
     $data = array();
     $data['registered'] = 1;
     $data['password'] = $password;
     $data['name'] = $name;
     if (is_array($arr)) {
         $data['userinfo'] = $arr[1];
     }
     $data['create'] = gmdate('Y-m-d');
     $data['createBy'] = SITE . 'web';
     $data['handle'] = $handle;
     user::update($data, true);
     $query = 'INSERT INTO karma VALUES (?, ?, ?, ?, NOW())';
     $id = $this->dbh->nextId('karma');
     $sth = $this->dbh->query($query, array($id, $this->handle, 'pear.bug', SITE . 'web'));
     $id = $this->dbh->nextId('karma');
     $sth = $this->dbh->query($query, array($id, $this->handle, 'pear.voter', SITE . 'web'));
     if (!DB::isError($sth)) {
         require_once 'bugs/pear-bugs-utils.php';
         $pbu = new PEAR_Bugs_Utils();
         note::add($this->handle, 'Account opened', SITE . 'web');
         $bugs = $this->dbh->getAll('SELECT * FROM bugdb WHERE handle = ?', array($this->handle), DB_FETCHMODE_ASSOC);
         foreach ($bugs as $bug) {
             $this->sendBugEmail($bug);
         }
         $patches = $this->dbh->getAll('SELECT bugdb.package_name, bugdb_patchtracker.*
             FROM bugdb_patchtracker, bugdb
             WHERE bugdb_patchtracker.developer = ?
                 AND bugdb.id = bugdb_patchtracker.bugdb_id', array($this->handle), DB_FETCHMODE_ASSOC);
         foreach ($patches as $patch) {
             $pbu->sendPatchEmail($patch);
         }
         $bugs = $this->dbh->getAll('SELECT bugdb_comments.email,bugdb_comments.comment,
                 bugdb_comments.reporter_name, bugdb.id,
                 bugdb.bug_type,bugdb.package_name,bugdb.sdesc,
                 bugdb.ldesc,bugdb.php_version, bugdb.php_os,bugdb.status,
                 bugdb.assign,bugdb.package_version
              FROM bugdb_comments, bugdb
              WHERE bugdb.id = bugdb_comments.bug AND
              bugdb_comments.handle = ?', array($this->handle), DB_FETCHMODE_ASSOC);
         foreach ($bugs as $bug) {
             $this->sendBugCommentEmail($bug);
         }
         $msg = "Your PEAR bug tracker account has been opened.\n" . "Bugs you have opened will now be displayed, and you can\n" . "add new comments to existing bugs";
         $xhdr = "From: " . PEAR_WEBMASTER_EMAIL;
         if (!DEVBOX) {
             mail($user['email'], "Your PEAR Bug Tracker Account Request", $msg, $xhdr, "-f " . PEAR_BOUNCE_EMAIL);
         }
         $this->deleteRequest();
         return true;
     }
     return false;
 }
Example #7
0
function deleteNote($parm)
{
    $pNoteID = $parm["NoteID"];
    $note = new note($pNoteID);
    $note->delete();
}
 function confirmRequest($salt)
 {
     if (!$this->find($salt)) {
         return PEAR::raiseError('cannot find request');
     }
     // activate the handle and grant karma
     // implicitly without human intervention
     // copied from the user class and Damblan_Karma
     include_once 'pear-database-user.php';
     $user = user::info($this->handle, null, 0);
     if (!isset($user['registered'])) {
         return PEAR::raiseError('Error - user request was deleted, please try again');
     }
     include_once 'pear-database-note.php';
     note::removeAll($this->handle);
     $data = array();
     $data['handle'] = $user['handle'];
     $data['registered'] = 1;
     $data['created'] = gmdate('Y-m-d');
     $data['createdby'] = SITE . 'web';
     $e = user::update($data, true);
     if (PEAR::isError($e) || !$e) {
         return $e;
     }
     $query = 'INSERT INTO karma VALUES (?, ?, ?, ?, NOW())';
     $id = $this->dbh->nextId('karma');
     $sth = $this->dbh->query($query, array($id, $this->handle, 'pear.voter', SITE . 'web'));
     $id = $this->dbh->nextId('karma');
     $sth = $this->dbh->query($query, array($id, $this->handle, 'pear.bug', SITE . 'web'));
     if (!DB::isError($sth)) {
         note::add($this->handle, 'Account opened', SITE . 'web');
         $msg = "Your PEAR voter account has been opened.\n" . "You can now participate in the elections  by going to\n" . "    http://" . PEAR_CHANNELNAME . "/election/";
         $xhdr = "From: " . PEAR_WEBMASTER_EMAIL;
         if (!DEVBOX) {
             mail($user['email'], "Your PEAR Account Request", $msg, $xhdr, "-f " . PEAR_BOUNCE_EMAIL);
         }
         $this->deleteRequest();
         return true;
     }
     return false;
 }
                    $prj->updateamum = date('Y-m-d H:i:s');
                    $prj->updatevon = $user;
                    if (!$prj->save(false)) {
                        $errormsg .= "Fehler beim Speichern von {$prj->projektarbeit_id}:" . $prj->errormsg . '<br>';
                    }
                }
            }
        }
    }
    if ($errormsg != '') {
        echo $errormsg;
    } else {
        echo '<b>Daten wurden gespeichert</b><br><br>';
    }
}
$noten = new note();
$noten->getAll();
$stg_arr = array();
$stg_obj = new studiengang();
$stg_obj->getAll('typ, kurzbz', false);
foreach ($stg_obj->result as $row) {
    $stg_arr[$row->studiengang_kz] = $row->kuerzel;
}
echo '<form action="' . $_SERVER['PHP_SELF'] . '" mehtod="GET">';
echo 'Studiengang: <SELECT name="stg_kz">';
if ($rechte->isBerechtigt('admin', null, 'suid')) {
    foreach ($stg_obj->result as $row) {
        $stgs[] = $row->studiengang_kz;
    }
} else {
    $stgs = $rechte->getStgKz();
Example #10
0
    echo '      <li>Number of submitted patches: <strong>' . $info['patches'] . '</strong></li>' . "\n";
    echo '      <li>Number of bugs opened using account: <strong>' . $info['opened'] . '</strong></li>' . "\n";
    echo '      <li>Number of bug comments using account: <strong>' . $info['commented'] . '</strong></li>' . "\n";
    echo '     </ul>' . "\n";
    echo '    </li>' . "\n";
}
?>

   </ul>
  </td>
 </tr>

<?php 
$packages = user::getPackages($handle, true);
include_once 'pear-database-note.php';
$notes = note::getAll($handle);
if (count($packages) > 0 || count($notes) > 0) {
    ?>

 <tr>
  <th class="headrow" style="width: 50%">&raquo; Maintains These Packages</th>
  <th class="headrow" style="width: 50%">Karma and History</th>
 </tr>
 <tr>
  <td valign="top">

<?php 
    if (count($packages) == 0) {
        echo '<p>This user does not maintain any packages.</p>';
    }
    ?>
<?php

require_once dirname(__FILE__) . '/lib/redis.php';
require_once dirname(__FILE__) . '/lib/redis.pool.php';
require_once dirname(__FILE__) . '/lib/redis.peer.php';
$redis_pool = array('master' => array('full.host.name', 6379));
# Redis init
redis_pool::add_servers($redis_pool);
class note extends redis_peer
{
}
$note = new note();
# Create note, primary key is generated automatically
$id = $note->insert(array('title' => 'Hello', 'body' => 'world!'));
# Update note
$id = $note->update($id, array('body' => 'wwwwworld!'));
# Get some note by primary key
$note_data = $note->get_by_id($id);
# Delete note
$note->delete($id);
Example #12
0
 /**
  * @depends testQueryIsProperlyGeneratedForNoteWithRelatedOwnerSearch
  */
 public function testCreateAndGetNoteById()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $fileModel = ZurmoTestHelper::createFileModel();
     $accounts = Account::getByName('anAccount');
     $user = UserTestHelper::createBasicUser('Billy');
     $occurredOnStamp = DateTimeUtil::convertTimestampToDbFormatDateTime(time());
     $note = new Note();
     $note->owner = $user;
     $note->occurredOnDateTime = $occurredOnStamp;
     $note->description = 'myNote';
     $note->activityItems->add($accounts[0]);
     $note->files->add($fileModel);
     $this->assertTrue($note->save());
     $id = $note->id;
     unset($note);
     $note = note::getById($id);
     $this->assertEquals($occurredOnStamp, $note->occurredOnDateTime);
     $this->assertEquals('myNote', $note->description);
     $this->assertEquals($user, $note->owner);
     $this->assertEquals(1, $note->activityItems->count());
     $this->assertEquals($accounts[0], $note->activityItems->offsetGet(0));
     $this->assertEquals(1, $note->files->count());
     $this->assertEquals($fileModel, $note->files->offsetGet(0));
 }
Example #13
0
<?php

include 'notes.class.php';
if (isset($_POST['image']) && !empty($_POST['image'])) {
    $oNote = new note('../../assets/notes/', '', (string) strip_tags($_POST['image']), '.note');
}
if (isset($_POST['id']) && !empty($_POST['id'])) {
    $id = (int) strip_tags($_POST['id']);
}
if (isset($_POST['position']) && !empty($_POST['position'])) {
    $position = $_POST['position'];
}
if (isset($_POST['note']) && !empty($_POST['note'])) {
    $note = (string) strip_tags($_POST['note']);
}
if (isset($_POST['author']) && !empty($_POST['author'])) {
    $link = (string) strip_tags($_POST['author']);
}
if (isset($_POST['link']) && !empty($_POST['link'])) {
    $link = (string) strip_tags($_POST['link']);
}
if (isset($_POST['author']) && !empty($_POST['author'])) {
    $author = (string) strip_tags($_POST['author']);
}
if (isset($_POST['get']) && !empty($_POST['get'])) {
    echo json_encode($oNote->getNotes());
}
if (isset($_POST['add']) && !empty($_POST['add'])) {
    echo json_encode($oNote->addNote($position, $note, $author, $link));
}
if (isset($_POST['delete']) && !empty($_POST['delete'])) {
Example #14
0
$packages = $dbh->getAssoc($sql, false, null, DB_FETCHMODE_ASSOC);
foreach ($packages as $n => $id) {
    $m = maintainer::get((int) $id);
    if (!empty($m)) {
        echo "\nAltering karma for maintainers of {$n} package id {$id}\n";
        foreach ($m as $handle => $m_data) {
            if (!$karma->has($handle, $karma_level)) {
                echo "Giving {$handle} {$karma_level} karma\n";
                // Bypassing damblan karma because it needs a logged in user
                $id = $dbh->nextId('karma');
                if (DB::isError($id)) {
                    echo "Couldn't get a new id from the karma table\n";
                    exit;
                }
                $query = 'INSERT INTO karma (id, user, level, granted_by, granted_at)
                          VALUES (?, ?, ?, ?, NOW())';
                $sth = $dbh->query($query, array($id, $handle, $karma_level, 'peclweb'));
                if (DB::isError($sth)) {
                    echo "Giving karma to {$handle} failed!\n";
                    exit;
                }
                // Adding a note about it
                note::add($handle, 'karma ' . $karma_level . ' granted', 'peclweb');
            } else {
                echo "{$handle} already has {$karma_level}\n";
            }
        }
    } else {
        echo "Couldn't find any maintainers for {$n} id {$id} possibily an error!\n";
    }
}
Example #15
0
        }
        echo ">{$text}</td>\n";
        echo "{$i}    </tr>\n";
    }
}
response_header('PEAR Administration');
// {{{ adding and deleting notes
if (!empty($_REQUEST['cmd'])) {
    if ($_REQUEST['cmd'] == "Add note" && !empty($_REQUEST['note']) && !empty($_REQUEST['id'])) {
        include_once 'pear-database-note.php';
        note::add($_REQUEST['id'], $_REQUEST['note']);
        unset($_REQUEST['cmd']);
    } elseif ($_REQUEST['cmd'] == "Delete note" && !empty($_REQUEST['id'])) {
        include_once 'pear-database-note.php';
        // Delete note
        note::remove($_REQUEST['id']);
    } elseif ($_REQUEST['cmd'] == "Open Account" && !empty($_REQUEST['uid'])) {
        /**
         * Open account
         */
        $karmalevel = empty($_REQUEST['karma']) ? 'pear.pepr' : $_REQUEST['karma'];
        // another hack to remove the temporary "purpose" field
        // from the user's "userinfo"
        include_once 'pear-database-user.php';
        if (user::activate($_REQUEST['uid'], $karmalevel)) {
            $uid = strip_tags(htmlspecialchars($_REQUEST['uid']));
            print "<p>Opened account {$uid}...</p>\n";
        }
    } elseif ($_REQUEST['cmd'] == "Reject Request" && !empty($_REQUEST['uid'])) {
        // Reject account request
        include_once 'pear-database-user.php';
Example #16
0
 public static function load_notes($columns = null, $filter = null, $sortby = null, $sortdir = null, $limit = null, $start = null)
 {
     global $DB;
     $result = $DB->make_select('Notes', $columns, $filter, $sortby, $sortdir, $limit, $start);
     $dbo_array = array();
     while ($data = $DB->row($result)) {
         $dbo = new note();
         $dbo->load($data);
         $dbo_array[] = $dbo;
     }
     return $dbo_array;
 }