public static function request($parameters) { Mail::template_new_product_mail($parameters); isset($parameters['description']) ? $id = $parameters['name'] : ($id = $parameters['id']); $desc = array('id' => $id, 'name' => $parameters['name']); TunaLog::info_log(__CLASS__, __FUNCTION__, $_SERVER['REMOTE_USER'], $desc); }
function send() { TunaLog::info_log(__CLASS__, __FUNCTION__, $_SERVER['REMOTE_USER'], $this->xheaders['Subject']); $this->build_mail(); $this->strTo = implode(", ", $this->sendto); if (ENVIRONMENT == LOCAL || ENVIRONMENT == BETA) { $res = @mail($this->strTo, $this->xheaders['Subject'], $this->fullBody, $this->headers); } else { $res = @mail($this->strTo, $this->xheaders['Subject'], $this->fullBody, $this->headers); } }
public static function create($parameters) { if (!isset($GLOBALS[TUNA_RW]) || !$GLOBALS[TUNA_RW] || $GLOBALS[TUNA_RW] instanceof Error) { $GLOBALS[TUNA_RW] = WBB_Database::load(TUNA_RW); } $email = $GLOBALS[TUNA_RW]->escapeString(array_get($parameters, 'username', '')); if (empty($email)) { throw new Error(400, 'User E-Mail value is empty, unable to continue'); } $sql = 'INSERT INTO `' . DB_TUNA . '`.`users` SET `email` ="' . $email . '", `creation` = NOW()'; $GLOBALS[TUNA_RW]->query($sql); if ($GLOBALS[TUNA_RW]->affectedRows() < 1) { throw new Error(500, 'Error adding new user, affected rows was zero'); } $id = (int) $GLOBALS[TUNA_RW]->insertId(); $is_default = true; //* Add initial permissions foreach ($parameters['permissions'] as $key => $value) { if ($value) { $is_default = false; $sql = 'INSERT INTO `' . DB_TUNA . '`.`user_permissions` SET `user_id`="' . $id . '", `description`="' . $key . '", `creation`=NOW()'; $GLOBALS[TUNA_RW]->query($sql); } } if ($is_default) { /**Set default developer user when not in any group**/ $sql = 'INSERT INTO `' . DB_TUNA . '`.`user_permissions` SET `user_id`="' . $id . '", `description`="is_developer", `creation`=NOW()'; $GLOBALS[TUNA_RW]->query($sql); } $user = User::load($id); TunaLog::info_log(__CLASS__, __FUNCTION__, 'TUNA_APP', $parameters); return $user; }