PHP Method User::from_mysql_id, codiad Code Examples

This page contains top rated real world PHP examples of method User::from_mysql_id from package codiad extracted from open source projects. You can rate examples to help us improve the quality of examples
Example #1
Show file File: UserWorkspace.php Project: Abuamany/concerto-platform
0
 public function revoke_privileges_db_user($user_id)
 {
     $wid = User::from_mysql_id($user_id)->get_main_UserWorkspace()->id;
     $user = Ini::$db_users_name_prefix . $wid;
     $db_name = Ini::$db_users_db_name_prefix . $this->id;
     $sql = sprintf("REVOKE ALL PRIVILEGES ON `%s`.* FROM '%s'@'localhost'", $db_name, $user);
     mysql_query($sql);
 }
Example #2
Show file File: UserShare.php Project: Abuamany/concerto-platform
0
 public function get_invitee()
 {
     return User::from_mysql_id($this->invitee_id);
 }
Example #3
Show file File: OModule.php Project: Abuamany/concerto-platform
0
 public function get_Owner()
 {
     return User::from_mysql_id($this->Owner_id);
 }
Example #4
Show file File: User_grant.php Project: Abuamany/concerto-platform
0
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/
if (!isset($ini)) {
    require_once '../../Ini.php';
    $ini = new Ini();
}
$logged_user = User::get_logged_user();
if ($logged_user == null) {
    echo "<script>location.reload();</script>";
    die(Language::string(278));
}
$owner = User::from_mysql_id($_POST['oid']);
?>
<script>
    Methods.iniTooltips();
</script>

<fieldset class="padding ui-widget-content ui-corner-all margin">
    <legend>
        <table>
            <tr>
                <td><span class="tooltip spanIcon ui-icon ui-icon-help" title="<?php 
echo Language::string(649);
?>
"></span></td>
                <td class=""><b><?php 
echo Language::string(677);
Example #5
Show file File: User_workspace_list.php Project: Abuamany/concerto-platform
0
 of the License, and not any of the later versions.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/
if (!isset($ini)) {
    require_once '../../Ini.php';
    $ini = new Ini();
}
$logged_user = User::get_logged_user();
if ($logged_user == null) {
    echo json_encode(array());
    exit;
}
$obj = User::from_mysql_id($_GET['oid']);
if ($obj == null) {
    echo json_encode(array());
    exit;
}
$workspaces = array();
foreach ($obj->get_workspaces() as $workspace) {
    $row = array("id" => $workspace->id, "name" => $workspace->name, "main" => $workspace->main);
    array_push($workspaces, $row);
}
echo json_encode($workspaces);
Example #6
Show file File: UserType_form.php Project: Abuamany/concerto-platform
0
                                <select id="form<?php 
        echo $class_name;
        ?>
SelectOwner" class="fullWidth ui-widget-content ui-corner-all">
                                    <option value="0" <?php 
        echo !$obj->has_Owner() ? "selected" : "";
        ?>
>&lt;<?php 
        echo Language::string(73);
        ?>
&gt;</option>
                                    <?php 
        $sql = $logged_user->mysql_list_rights_filter("User", "`User`.`lastname` ASC");
        $z = mysql_query($sql);
        while ($r = mysql_fetch_array($z)) {
            $owner = User::from_mysql_id($r[0]);
            ?>
                                        <option value="<?php 
            echo $owner->id;
            ?>
" <?php 
            echo $obj->Owner_id == $owner->id ? "selected" : "";
            ?>
><?php 
            echo $owner->get_full_name();
            ?>
</option>
                                    <?php 
        }
        ?>
                                </select>
Example #7
Show file File: users.php Project: Abuamany/concerto-platform
0
     `/usr/bin/passwd {$name} <<EOF\n{$password}\n{$password}\nEOF`;
     //insert UserR record
     $user = new UserR();
     $user->login = $name;
     $user->password = $password;
     $user->User_id = $r['id'];
     $user->mysql_save();
 }
 $media_dir = Ini::$path_internal_media . $r["id"];
 if (!is_dir($media_dir)) {
     mkdir($media_dir, 0775, true);
 }
 chown($media_dir, $name);
 chgrp($media_dir, Ini::$php_user_group);
 chmod($media_dir, 0775);
 $user = User::from_mysql_id($r['id']);
 foreach ($user->get_workspaces() as $workspace) {
     //dirs
     $session_dir = Ini::$path_data . $workspace->id;
     if (!is_dir($session_dir)) {
         mkdir($session_dir, 0770, true);
     }
     chown($session_dir, $name);
     chgrp($session_dir, Ini::$php_user_group);
     chmod($session_dir, 0770);
     $home_dir = "/home/{$name}";
     if (!is_dir($home_dir)) {
         mkdir($home_dir, 0750, true);
     }
     chown($home_dir, $name);
     chgrp($home_dir, Ini::$php_user_group);
Example #8
Show file File: User_share_list.php Project: Abuamany/concerto-platform
0
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/
if (!isset($ini)) {
    require_once '../../Ini.php';
    $ini = new Ini();
}
$logged_user = User::get_logged_user();
if ($logged_user == null) {
    echo json_encode(array());
    exit;
}
$obj = User::from_mysql_id($_GET['oid']);
if ($obj == null) {
    echo json_encode(array());
    exit;
}
$shares = array();
foreach ($obj->get_workspaces() as $ws) {
    foreach ($ws->get_shares() as $share) {
        $invitee = User::from_mysql_id($share->invitee_id);
        if ($invitee == null) {
            continue;
        }
        $row = array("id" => $share->id, "invitee_id" => $invitee->id, "name" => $invitee->get_full_name(), "institution" => $invitee->institution_name, "workspace_id" => $share->UserWorkspace_id, "workspace_name" => $ws->name);
        array_push($shares, $row);
    }
}
echo json_encode($shares);
Example #9
Show file File: User.php Project: Abuamany/concerto-platform
0
 public static function create_db($db = null)
 {
     if ($db == null) {
         $db = Ini::$db_master_name;
     }
     $sql = sprintf("\r\n            CREATE TABLE IF NOT EXISTS `%s`.`User` (\r\n            `id` bigint(20) NOT NULL auto_increment,\r\n            `updated` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,\r\n            `created` timestamp NOT NULL default '0000-00-00 00:00:00',\r\n            `login` text NOT NULL,\r\n            `firstname` text NOT NULL,\r\n            `lastname` text NOT NULL,\r\n            `email` text NOT NULL,\r\n            `phone` text NOT NULL,\r\n            `password` text NOT NULL,\r\n            `last_login` timestamp NOT NULL default '0000-00-00 00:00:00',\r\n            `UserInstitutionType_id` int(11) NOT NULL,\r\n            `institution_name` text NOT NULL,\r\n            `superuser` tinyint(1) NOT NULL,\r\n            PRIMARY KEY  (`id`)\r\n            ) ENGINE=InnoDB  DEFAULT CHARSET=utf8;\r\n            ", $db);
     if (!mysql_query($sql)) {
         return false;
     }
     $admin_data = array("updated" => time(), "created" => time(), "login" => "admin", "firstname" => "unknown", "modify_password" => 0);
     $admin = new User();
     $lid = $admin->mysql_save_from_post($admin_data);
     $admin = User::from_mysql_id($lid);
     $admin->password = $admin->calculate_raw_password_hash("admin");
     $admin->superuser = 1;
     return $admin->mysql_save();
 }
Example #10
Show file File: User.php Project: Abuamany/concerto-platform
0
 public static function create_db($delete = false)
 {
     if ($delete) {
         if (!mysql_query("DROP TABLE IF EXISTS `User`;")) {
             return false;
         }
     }
     $sql = "\r\n            CREATE TABLE IF NOT EXISTS `User` (\r\n            `id` bigint(20) NOT NULL auto_increment,\r\n            `updated` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,\r\n            `created` timestamp NOT NULL default '0000-00-00 00:00:00',\r\n            `login` text NOT NULL,\r\n            `firstname` text NOT NULL,\r\n            `lastname` text NOT NULL,\r\n            `email` text NOT NULL,\r\n            `phone` text NOT NULL,\r\n            `password` text NOT NULL,\r\n            `UserType_id` bigint(20) NOT NULL,\r\n            `UserGroup_id` bigint(20) NOT NULL,\r\n            `last_login` timestamp NOT NULL default '0000-00-00 00:00:00',\r\n            `UserInstitutionType_id` int(11) NOT NULL,\r\n            `institution_name` text NOT NULL,\r\n            `Sharing_id` int(11) NOT NULL,\r\n            `Owner_id` bigint(20) NOT NULL,\r\n            PRIMARY KEY  (`id`)\r\n            ) ENGINE=InnoDB  DEFAULT CHARSET=utf8;\r\n            ";
     if (!mysql_query($sql)) {
         return false;
     }
     $sql = "\r\n            INSERT INTO `User` (`id`, `updated`, `created`, `login`, `firstname`, `lastname`, `email`, `phone`, `password`, `UserType_id`, `UserGroup_id`, `last_login`, `Sharing_id`, `Owner_id`) VALUES (NULL, CURRENT_TIMESTAMP, NOW(), 'admin', 'unknown', '', '', '', '', '1', '', '0000-00-00 00:00:00', '1', '1');\r\n            ";
     if (!mysql_query($sql)) {
         return false;
     }
     $user = User::from_mysql_id(1);
     $user->password = $user->calculate_raw_password_hash("admin");
     return $user->mysql_save();
 }