Exemplo n.º 1
0
 public static function favorite_user_Insert($favorite_blog, $user_id)
 {
     $sql = 'CALL `sp_favorite_user_Insert`(:favorite_blog, :user_id)';
     $params = array(':favorite_blog' => $favorite_blog, ':user_id' => $user_id);
     DatabaseHandler::Close();
     return DatabaseHandler::Execute($sql, $params);
 }
Exemplo n.º 2
0
 public static function users_Insert($first_name, $last_name, $password, $job_title, $gender, $marriage_state, $profile_pic, $cover_pic, $birthday, $mobile, $tel, $address, $email, $website, $job_state, $job_kind, $salary, $city_id, $about_me, $register_date)
 {
     $sql = 'CALL `sp_users_Insert`(:first_name, :last_name, :password, :job_title, :gender, :marriage_state, :profile_pic, :cover_pic, :birthday, :mobile, :tel, :address, :email, :website, :job_state, :job_kind, :salary, :city_id, :about_me, :register_date)';
     $params = array(':first_name' => $first_name, ':last_name' => $last_name, ':password' => $password, ':job_title' => $job_title, ':gender' => $gender, ':marriage_state' => $marriage_state, ':profile_pic' => $profile_pic, ':cover_pic' => $cover_pic, ':birthday' => $birthday, ':mobile' => $mobile, ':tel' => $tel, ':address' => $address, ':email' => $email, ':website' => $website, ':job_state' => $job_state, ':job_kind' => $job_kind, ':salary' => $salary, ':city_id' => $city_id, ':about_me' => $about_me, ':register_date' => $register_date);
     DatabaseHandler::Close();
     return DatabaseHandler::Execute($sql, $params);
 }
Exemplo n.º 3
0
 public static function blog_keywords_Insert($blog_id, $keyword)
 {
     $sql = 'CALL `sp_blog_keywords_Insert`(:blog_id, :keyword)';
     $params = array(':blog_id' => $blog_id, ':keyword' => $keyword);
     DatabaseHandler::Close();
     return DatabaseHandler::Execute($sql, $params);
 }
Exemplo n.º 4
0
 public static function comments_Insert($full_name, $mail, $text, $add_time, $activate, $ip, $user_id, $admin_id, $blog_id, $comment_id)
 {
     $sql = 'CALL `sp_comments_Insert`(:full_name, :mail, :text, :add_time, :activate, :ip, :user_id, :admin_id, :blog_id, :comment_id)';
     $params = array(':full_name' => $full_name, ':mail' => $mail, ':text' => $text, ':add_time' => $add_time, ':activate' => $activate, ':ip' => $ip, ':user_id' => $user_id, ':admin_id' => $admin_id, ':blog_id' => $blog_id, ':comment_id' => $comment_id);
     DatabaseHandler::Close();
     return DatabaseHandler::Execute($sql, $params);
 }
Exemplo n.º 5
0
 public static function quotations_Insert($author, $text)
 {
     $sql = 'CALL `sp_quotations_Insert`(:author, :text)';
     $params = array(':author' => $author, ':text' => $text);
     DatabaseHandler::Close();
     return DatabaseHandler::Execute($sql, $params);
 }
 public static function rolespermissions_Insert($roles_id, $permissions_id)
 {
     $sql = 'CALL `sp_rolespermissions_Insert`(:roles_id, :permissions_id)';
     $params = array(':roles_id' => $roles_id, ':permissions_id' => $permissions_id);
     DatabaseHandler::Close();
     return DatabaseHandler::Execute($sql, $params);
 }
Exemplo n.º 7
0
 public static function authors_Insert($full_name)
 {
     $sql = 'CALL `sp_authors_Insert`(:full_name)';
     $params = array(':full_name' => $full_name);
     DatabaseHandler::Close();
     return DatabaseHandler::Execute($sql, $params);
 }
Exemplo n.º 8
0
 public static function roles_Insert($title)
 {
     $sql = 'CALL `sp_roles_Insert`(:title)';
     $params = array(':title' => $title);
     DatabaseHandler::Close();
     return DatabaseHandler::Execute($sql, $params);
 }
Exemplo n.º 9
0
 public function updateTag($tag_id, $name)
 {
     $params[] = $name;
     $params[] = $post_id;
     $sql = "UPDATE {$this->tags} SET name = ? WHERE post_id = ?";
     DatabaseHandler::Execute($sql, $params);
 }
Exemplo n.º 10
0
 public static function permissions_Insert($title, $ENtitle)
 {
     $sql = 'CALL `sp_permissions_Insert`(:title, :ENtitle)';
     $params = array(':title' => $title, ':ENtitle' => $ENtitle);
     DatabaseHandler::Close();
     return DatabaseHandler::Execute($sql, $params);
 }
Exemplo n.º 11
0
 public static function blog_audience_Insert($audience_name)
 {
     $sql = 'CALL `sp_blog_audience_Insert`(:audience_name)';
     $params = array(':audience_name' => $audience_name);
     DatabaseHandler::Close();
     return DatabaseHandler::Execute($sql, $params);
 }
Exemplo n.º 12
0
 public static function b_a_Insert($blog_id, $audience_id)
 {
     $sql = 'CALL `sp_b_a_Insert`(:blog_id, :audience_id)';
     $params = array(':blog_id' => $blog_id, ':audience_id' => $audience_id);
     DatabaseHandler::Close();
     return DatabaseHandler::Execute($sql, $params);
 }
Exemplo n.º 13
0
 public static function educations_Insert($user_id, $education_level, $education_average, $education_university, $education_branch, $education_sub_branch, $from_date, $to_date, $now, $activities, $attach_file)
 {
     $sql = 'CALL `sp_educations_Insert`(:user_id, :education_level, :education_average, :education_university, :education_branch, :education_sub_branch, :from_date, :to_date, :now, :activities, :attach_file)';
     $params = array(':user_id' => $user_id, ':education_level' => $education_level, ':education_average' => $education_average, ':education_university' => $education_university, ':education_branch' => $education_branch, ':education_sub_branch' => $education_sub_branch, ':from_date' => $from_date, ':to_date' => $to_date, ':now' => $now, ':activities' => $activities, ':attach_file' => $attach_file);
     DatabaseHandler::Close();
     return DatabaseHandler::Execute($sql, $params);
 }
Exemplo n.º 14
0
 public static function blog_subject_Insert($subject_name)
 {
     $sql = 'CALL `sp_blog_subject_Insert`(:subject_name)';
     $params = array(':subject_name' => $subject_name);
     DatabaseHandler::Close();
     return DatabaseHandler::Execute($sql, $params);
 }
Exemplo n.º 15
0
 public static function admins_Insert($first_name, $last_name, $password, $mobile, $about, $roles_id)
 {
     $sql = 'CALL `sp_admins_Insert`(:first_name, :last_name, :password, :mobile, :about, :roles_id)';
     $params = array(':first_name' => $first_name, ':last_name' => $last_name, ':password' => $password, ':mobile' => $mobile, ':about' => $about, ':roles_id' => $roles_id);
     DatabaseHandler::Close();
     return DatabaseHandler::Execute($sql, $params);
 }
Exemplo n.º 16
0
 public static function blogs_Insert($title, $title_en, $image, $text, $source, $video, $description, $read_time, $hit_count, $admin_id, $add_time, $modify_time, $activate)
 {
     $sql = 'CALL `sp_blogs_Insert`(:title, :title_en, :image, :text, :source, :video, :description, :read_time, :hit_count, :admin_id, :add_time, :modify_time, :activate)';
     $params = array(':title' => $title, ':title_en' => $title_en, ':image' => $image, ':text' => $text, ':source' => $source, ':video' => $video, ':description' => $description, ':read_time' => $read_time, ':hit_count' => $hit_count, ':admin_id' => $admin_id, ':add_time' => $add_time, ':modify_time' => $modify_time, ':activate' => $activate);
     DatabaseHandler::Close();
     return DatabaseHandler::Execute($sql, $params);
 }
 public static function logToggle($user, $action, $type, $id, $ip)
 {
     // To be used for Activate, Deactivate, Delete, Upload
     // Ex: Deleted Nav with ID = 1 at NOW();
     $sql = "INSERT into log_activity (login_id, action, type, input, ip) VALUES (:user, :action, :type, :input, :ip)";
     $params = array(':user' => $user, ':action' => $action, ':type' => $type, ':input' => $id, ':ip' => $ip);
     $result = DatabaseHandler::Execute($sql, $params);
 }
function logAdminLogin()
{
    $username = $_SESSION['admin'];
    $ip = $_SERVER['REMOTE_ADDR'];
    $sql = "UPDATE log_login_sessions SET ip=:ip, login_time=NOW() WHERE username=:username ";
    $params = array(':username' => $username, ':ip' => $ip);
    $result = DatabaseHandler::Execute($sql, $params);
}
Exemplo n.º 19
0
 public static function Log($class, $category, $message)
 {
     $datetime = new DateTime();
     $stamp = $datetime->format('YmdHis');
     try {
         $sql = 'INSERT INTO logs (class, category, message, stamp) VALUES ("' . $class . '", "' . $category . '", "' . $message . '", ' . $stamp . ')';
         DatabaseHandler::Execute($sql);
     } catch (Exception $e) {
         Logger::Log(get_class($this), 'Exception', $e->getMessage());
     }
 }
 public static function checkBox($table, $idField, $titleField, $elementName, $whereClause = '', $cssClass = '', $onClick = '')
 {
     DatabaseHandler::Execute("SET NAMES UTF8;");
     $sql = "SELECT * FROM {$table} {$whereClause}";
     $records = DatabaseHandler::GetAll($sql);
     DatabaseHandler::Close();
     $checkBox = '';
     foreach ($records as $item) {
         $id = $item[$idField];
         $text = $item[$titleField];
         $checkBox .= "<label class='{$cssClass}'><input type='checkbox' name='{$elementName}' id='{$elementName}{$id}' value='{$id}' />{$text}</label>";
     }
     return $checkBox;
 }
function addTeam($team, $p1, $p2 = "", $p3 = "")
{
    $sql = "INSERT INTO mad_team(team, register_date) VALUES(:team, NOW())";
    $parms = array(':team', $team);
    $result = DatabaseHandler::Execute($sql, $parms);
    $teamid = getTeamId($team);
    if ($p1) {
        $sql = "INSERT INTO mad_registrations(user_id, team_id) VALUES(:p1, :teamid)";
        $parms = array(':p1' => $p1, ':teamid' => $teamid);
        $result = DatabaseHandler::Execute($sql, $parms);
    }
    if ($p2) {
        $sql = "INSERT INTO mad_registrations(user_id, team_id) VALUES(:p2, :teamid)";
        $parms = array(':p2' => $p2, ':teamid' => $teamid);
        $result = DatabaseHandler::Execute($sql, $parms);
    }
    if ($p3) {
        $sql = "INSERT INTO mad_registrations(user_id, team_id) VALUES(:p3, :teamid)";
        $parms = array(':p3' => $p3, ':teamid' => $teamid);
        $result = DatabaseHandler::Execute($sql, $parms);
    }
    return 1;
}
function deleteNews($id, $modified_by)
{
    $sql = "UPDATE news SET isactive = 0, isdeleted = 1, modified_on = NOW(), modified_by = :modified_by WHERE id = :id AND isdeleted = 0";
    $params = array(':id' => $id, ':modified_by' => $modified_by);
    $result = DatabaseHandler::Execute($sql, $params);
}
Exemplo n.º 23
0
 public static function MoveProductToCart($itemId)
 {
     // Составляем SQL - запрос
     $sql = 'CALL shopping_cart_move_product_to_cart(:item_id)';
     // Создаем массив параметров
     $params = array(':item_id' => $itemId);
     // Выполняем запрос
     DatabaseHandler::Execute($sql, $params);
 }
Exemplo n.º 24
0
 public static function SetThumbnail($productId, $thumbnailName)
 {
     // Build SQL query
     $sql = 'CALL catalog_set_thumbnail(:product_id, :thumbnail_name)';
     // Build the parameters array
     $params = array(':product_id' => $productId, ':thumbnail_name' => $thumbnailName);
     // Execute the query
     DatabaseHandler::Execute($sql, $params);
 }
Exemplo n.º 25
0
 public static function UpdateUser($user_id)
 {
     $sql = 'UPDATE posts SET name = \'' . $this->name . '\', email = \'' . $this->email . '\' WHERE user_id = ?';
     DatabaseHandler::Execute($sql, $user_id);
 }
Exemplo n.º 26
0
 public function editAuthor($params)
 {
     $sql = 'UPDATE authors SET logo = \'' . $params['logo'] . '\', name = \'' . $params['name'] . '\', pass = \'' . $params['pass'] . '\' WHERE author_id = \'' . $params['author_id'] . '\'';
     //var_dump($sql, $params);exit;
     return DatabaseHandler::Execute($sql);
 }
Exemplo n.º 27
0
 public static function SubscribeNewsletter($name, $email)
 {
     $res = self::GetNewsletterSubscription($email);
     if (empty($res)) {
         $sql = 'INSERT INTO newsletter (email, name) VALUES ("' . $email . '", "' . $name . '")';
         // Execute the query and return the results
         DatabaseHandler::Execute($sql);
         return 1;
     } else {
         return 0;
     }
 }
Exemplo n.º 28
0
 public function AddPost($params)
 {
     $date = date('Y-m-d H:i:s', time());
     $paramsExecut = ['post_id' => '', 'title' => '', 'text' => '', 'pubdate' => '', 'author_id' => ''];
     $paramsTemp = [];
     foreach ($params as $param => $value) {
         if (array_key_exists($param, $paramsExecut)) {
             $paramsTemp[$param] = $value;
         }
     }
     if (isset($date)) {
         $paramsExecut['pubdate'] = $date;
         $paramsTemp['pubdate'] = $date;
     }
     $fields = '';
     $values = '';
     $q = '';
     $fieldsValues = '';
     foreach ($paramsTemp as $param => $value) {
         $fields = $fields . $param . ',';
         if (strpos($param, '_id') !== false) {
             $values[] = intval($value);
         } else {
             $values[] = $value;
         }
         $q = $q . '?' . ',';
     }
     $fields = substr($fields, 0, -1);
     $q = substr($q, 0, -1);
     $sql = "INSERT INTO posts ({$fields}) VALUES({$q})";
     DatabaseHandler::Execute($sql, $values);
 }
Exemplo n.º 29
0
    public static function MakePayment($party, $scope, $supplierid, $amount, $ledgerId, $mode, $voucher, $descr)
    {
        try {
            $supplier = Supplier::GetSupplier($supplierid);
            $grns = "";
            /*foreach ($payments as $key => $payment) {
            			$grns .= $key.",";
            		}*/
            $descr .= ' (' . $voucher . ')';
            $sql = 'INSERT INTO payments (party_id, grns, amount, ledger_id, mode, voucher_no, description, status) VALUES 
			(' . $supplierid . ', "' . $grns . '", ' . $amount . ', ' . $ledgerId . ', "' . $mode . '", "' . $voucher . '", "' . $descr . '", 0)';
            DatabaseHandler::Execute($sql);
            $sql2 = 'SELECT * FROM payments WHERE party_id = ' . $supplierid . ' ORDER BY id DESC LIMIT 0,1';
            $res = DatabaseHandler::GetRow($sql2);
            $acc = Account::GetAccountByNo($supplierid, 'suppliers', 'Creditors');
            $expv = ExpenseVoucher::CreateSupplierProjectExpense($party, $scope, $amount, $acc->ledgerId, $voucher, $descr);
            if ($expv) {
                $tx = self::initialize($res);
                $tx->expVoucher = $expv;
                return $tx;
            } else {
                return false;
            }
            return self::initialize($res);
        } catch (Exception $e) {
        }
    }
function getUsernameByCode($code)
{
    $sql = "SELECT username FROM users WHERE code = :code";
    $params = array(':code' => $code);
    $result = DatabaseHandler::Execute($sql, $params);
    return $result[0]['username'];
}