Exemple #1
0
 public function setViewed($objUser)
 {
     if (!$objUser) {
         return;
     }
     if ($this->hasViewed($objUser)) {
         return;
     }
     $objUserPictureView = new clsDB('usercommentview');
     $objUserPictureView->set('user_id', $objUser->get('id'));
     $objUserPictureView->set('comment_id', $this->get('id'));
     $objUserPictureView->set('date', date('Y-m-d H:i:s'));
     $objUserPictureView->save();
 }
Exemple #2
0
 public function setImage($img)
 {
     $objPicture = $this->getForeignObject('picture');
     $objAlbum = $objPicture->getForeignObject('album');
     $mime_type = $objAlbum->get('mime');
     if (!$mime_type || $mime_type == '') {
         $mime_type = DEFAULT_MIME;
     }
     $objImageData = new clsDB('imagedata');
     $objImageData->set('data', base64_encode(imgToString($img, $mime_type)), false);
     $objImageData->set('mime', $mime_type);
     $objImageData->save();
     $this->set('imagedata_id', $objImageData->get('id'));
     return 0;
 }
Exemple #3
0
 public static function set_by_name($strName, $strValue)
 {
     if (!preg_match("/^[a-zA-Z0-9_.]*\$/", $strName)) {
         throw new Exception(ERRORMSG_INVALID);
     }
     $arrResults = clsDB::selectQueryObjects('setting', "\n\t\t\t\t\t\t\t\tSELECT *\n\t\t\t\t\t\t\t\tFROM `<<tbl><setting>>` \n\t\t\t\t\t\t\t\tWHERE `<<setting><name>>`='{$strName}'\n\t\t\t\t\t\t\t\t\tAND `<<isdel><setting>>`='0' ");
     if (sizeof($arrResults) == 0) {
         $objSetting = new clsDB('setting');
         $objSetting->set('name', $strName);
         $objSetting->set('valud', $strValue);
         $objSetting->save();
     } else {
         $objSetting = $arrResults[0];
         $objSetting->set('value', $strValue);
         $objSetting->save();
     }
 }
Exemple #4
0
        throw new Exception("exception_accessdenied");
    }
    $objNews = new clsDB('news');
    $objNews->getFromRequest(array('id', 'title', 'text'));
    if ($strSubAction == 'edit') {
        $objNews->load();
        echo "<form action='index.php' method='post'>";
        echo "<input type='hidden' name='subaction' value='save'>";
        echo $objNews->getHiddenField('id');
        echo "Title:<br>";
        echo $objNews->getTextField('title', new clsParameters('size', 40)) . "<br><br>";
        echo "Post:<br>";
        echo $objNews->getTextArea('text', 4, 45) . "<br><br>";
        echo $objNews->getSubmit('Post');
    } else {
        if ($strSubAction == 'save') {
            if ($objNews->isNew()) {
                $objNews->set('user_id', $objUser->get('id'));
                $objNews->set('date', date('Y-m-d H:i:s'));
            }
            $objNews->save();
            header("Location: index.php");
        } else {
            if ($strSubAction == 'delete') {
                $objNews->delete();
                $objNews->save();
                header("Location: index.php");
            }
        }
    }
}
Exemple #5
0
 public function inviteUser($objUser, $objInviter)
 {
     if (!$objUser) {
         return 'groupinvite_error';
     }
     if ($this->isMemberOrPotential($objUser)) {
         return 'groupinvite_alreadyin';
     }
     if ($this->isNew()) {
         return 'groupinvite_error';
     }
     if (!$this->isMember($objInviter)) {
         return 'groupinvite_notmember';
     }
     $objUserGroup = new clsDB('usergroup');
     $objUserGroup->set('user_id', $objUser->get('id'));
     $objUserGroup->set('user_inviter_id', $objInviter->get('id'));
     $objUserGroup->set('group_id', $this->get('id'));
     $objUserGroup->set('has_accepted', '0');
     $objUserGroup->set('is_approved', '1');
     $objUserGroup->save();
     return 'groupinvite_successful';
 }
Exemple #6
0
 public function setDefaultPolicies($objUser)
 {
     $objGuest = new clsDB('albumpolicy');
     $objMember = new clsDB('albumpolicy');
     $objGroup = new clsDB('albumpolicy');
     $objGuest->set('user_id', $objUser->get('id'));
     $objMember->set('user_id', $objUser->get('id'));
     $objGroup->set('user_id', $objUser->get('id'));
     /* Everything hinges on whether or not there's a parent... */
     if ($this->get('album_id')) {
         $objGuest->set('allow_post_picture', INHERIT);
         $objGuest->set('allow_post_comment', INHERIT);
         $objGuest->set('allow_rate', INHERIT);
         $objGuest->set('allow_view', INHERIT);
         $objGuest->set('allow_delete_picture', INHERIT);
         $objGuest->set('allow_create_subalbum', INHERIT);
         $objMember->set('allow_post_picture', INHERIT);
         $objMember->set('allow_post_comment', INHERIT);
         $objMember->set('allow_rate', INHERIT);
         $objMember->set('allow_view', INHERIT);
         $objMember->set('allow_delete_picture', INHERIT);
         $objMember->set('allow_create_subalbum', INHERIT);
         $objGroup->set('allow_post_picture', INHERIT);
         $objGroup->set('allow_post_comment', INHERIT);
         $objGroup->set('allow_rate', INHERIT);
         $objGroup->set('allow_view', INHERIT);
         $objGroup->set('allow_delete_picture', INHERIT);
         $objGroup->set('allow_create_subalbum', INHERIT);
     } else {
         $objGuest->set('allow_post_picture', NO);
         $objGuest->set('allow_post_comment', YES);
         $objGuest->set('allow_rate', NO);
         $objGuest->set('allow_view', YES);
         $objGuest->set('allow_delete_picture', NO);
         $objGuest->set('allow_create_subalbum', NO);
         $objMember->set('allow_post_picture', NO);
         $objMember->set('allow_post_comment', YES);
         $objMember->set('allow_rate', NO);
         $objMember->set('allow_view', YES);
         $objMember->set('allow_delete_picture', NO);
         $objMember->set('allow_create_subalbum', NO);
         $objGroup->set('allow_post_picture', NO);
         $objGroup->set('allow_post_comment', YES);
         $objGroup->set('allow_rate', YES);
         $objGroup->set('allow_view', YES);
         $objGroup->set('allow_delete_picture', NO);
         $objGroup->set('allow_create_subalbum', NO);
     }
     $objGuest->save();
     $objMember->save();
     $objGroup->save();
     $this->set('albumpolicy_guest_id', $objGuest->get('id'));
     $this->set('albumpolicy_member_id', $objMember->get('id'));
     $this->set('albumpolicy_group_id', $objGroup->get('id'));
 }
Exemple #7
0
                            print "<img src='" . clsThumbnail::getUrl($objPicture, 70, 70) . "'> ";
                            if (++$i % 6 == 0) {
                                print "<br>";
                            }
                        }
                        print "<br><br>";
                    }
                }
            }
        }
    }
}
if ($strSubAction == 'settings_save') {
    $objSetting = new clsDB('setting');
    $objSetting->getFromRequest(array('id', 'value'));
    $objSetting->save();
    $strSubAction = 'settings';
}
if ($strSubAction == 'settings') {
    $arrSettings = clsDB::getListStatic('setting');
    print "<table>";
    print "<tr>";
    print "<td>Name</td><td>Value</td><td>Comments</td><td>Save</td>";
    print "</tr>";
    foreach ($arrSettings as $objSetting) {
        print "<form action='index.php' method='get'>";
        print $objSetting->getHiddenField('id');
        print "<input type='hidden' name='action'    value='admin'>";
        print "<input type='hidden' name='subaction' value='settings_save'>";
        print "<tr>";
        print "<td>" . $objSetting->get('name') . "</td>";