Author: Scott Haefner (shaefner@usgs.gov)
Esempio n. 1
1
 public function getlastThread($topic_id)
 {
     global $mySession;
     $db = new Db();
     $forumThread = $db->runQuery("select * from " . FORUM_THREADS . " inner join " . USERS . " on " . USERS . ".user_id = " . FORUM_THREADS . ".user_id where topic_id=" . $topic_id . " order by thread_id desc limit 1");
     return $forumThread;
 }
Esempio n. 2
1
 public function deleteCurrency($currencyId)
 {
     global $mySession;
     $db = new Db();
     $condition1 = "currency_id='" . $currencyId . "'";
     $db->delete(CURRENCY, $condition1);
 }
Esempio n. 3
1
 public function init()
 {
     global $mySession;
     $db = new Db();
     $emailid_val = "";
     $qur = $db->runquery("SELECT * FROM  " . USERS . " WHERE user_id='" . $mySession->TeeLoggedID . "' ");
     //$qur=$db->runquery("select * from ".ADDRESS." join ".STATE." on ".STATE.".state_id=".ADDRESS.".state where user_id='".$mySession->TeeLoggedID."' ");
     if ($qur != "" and count($qur) > 0) {
         $emailid_val = $qur[0]['emailid'];
     }
     # FORM ELEMENT:public name
     # TYPE : text
     $emailid = new Zend_Form_Element_Text('emailid');
     $emailid->setRequired(true)->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'changeaddress')->setAttrib('readonly', 'readonly')->setAttrib("style", "width:300px; height:30px;")->setValue($emailid_val);
     # FORM ELEMENT:address
     # TYPE : text
     $friendsemailid = new Zend_Form_Element_Text('friendsemailid');
     $friendsemailid->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'One id is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("style", "width:300px; height:30px;")->setAttrib('class', 'changepasstextbox');
     //if(@$_REQUEST['friendsemailid']!="")
     //		{
     //		$friendsemailid-> addValidator('EmailAddress', true)
     //		->addDecorator('Errors', array('class'=>'errmsg'))
     //		->addErrorMessage('Please enter a valid email address');
     //		}
     //
     # FORM ELEMENT:city
     # TYPE : text
     $url = new Zend_Form_Element_Text('url');
     $url->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'URL is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'changeaddress')->setAttrib("style", "width:100px; height:30px;");
     $this->addElements(array($emailid, $friendsemailid, $url));
 }
Esempio n. 4
1
 public function init()
 {
     global $mySession;
     $db = new Db();
     $ConfigData = $db->runQuery("select * from " . ADMINISTRATOR . " where admin_id='1'");
     $SiteTitle = $ConfigData[0]['site_title'];
     $MetaDescription = $ConfigData[0]['site_description'];
     $MetaKeyword = $ConfigData[0]['site_keyword'];
     $AdminEmail = $ConfigData[0]['admin_email'];
     $PaypalEmail = $ConfigData[0]['paypal_email'];
     $welcomemessageC = $ConfigData[0]['welcomemessage'];
     $admin_name_value = $ConfigData[0]['admin_fullname'];
     $site_title = new Zend_Form_Element_Text('site_title');
     $site_title->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Site title is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($SiteTitle);
     $admin_name = new Zend_Form_Element_Text('admin_name');
     $admin_name->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Admin name is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($admin_name_value);
     $site_description = new Zend_Form_Element_Text('site_description');
     $site_description->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Site description is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($MetaDescription);
     $site_keyword = new Zend_Form_Element_Text('site_keyword');
     $site_keyword->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Site keyword is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($MetaKeyword);
     $admin_email = new Zend_Form_Element_Text('admin_email');
     $admin_email->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Administrator email is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required email")->setValue($AdminEmail);
     $paypal_email = new Zend_Form_Element_Text('paypal_email');
     $paypal_email->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Paypal email address is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required email")->setValue($PaypalEmail);
     /*$currency_symbol= new Zend_Form_Element_Text('currency_symbol');
     		$currency_symbol->setRequired(true)
     		->addValidator('NotEmpty',true,array('messages' =>'Currency symbol is required.'))
     		->addDecorator('Errors', array('class'=>'error'))
     		->setAttrib("class","required")
     		->setValue($CurrencySymbol);*/
     $welcomemessage = new Zend_Form_Element_Textarea('welcomemessage');
     $welcomemessage->setAttrib("id", "elrte")->setAttrib("cols", "auto")->setAttrib("rows", "auto")->setValue($welcomemessageC);
     $this->addElements(array($site_title, $admin_name, $site_description, $site_keyword, $admin_email, $paypal_email, $welcomemessage));
 }
Esempio n. 5
1
 public function __construct(Db $db, $name)
 {
     $this->db = $db;
     $this->name = $name;
     $this->usedColumns = $db->getTableColumns($name) ?: [];
     $this->isColumnUsageReportingEnabled = empty($this->usedColumns);
 }
 public function getsingletemple()
 {
     $db = new Db();
     $id = $_POST['temple_id'];
     $results = $db->gettempleDetails($id);
     echo json_encode($results);
 }
Esempio n. 7
1
 public function Addphoto($dataForm, $photoId = '')
 {
     global $mySession;
     $db = new Db();
     if ($dataForm['photo_path2'] != "") {
         $photoname = explode('.', $dataForm['photo_path2']);
         $len = count($photoname);
         $extension = $photoname[$len - 1];
         $datetime = date(d . m . y_h . i . s);
         $new_name = $datetime . '.' . $extension;
         rename(SITE_ROOT . 'photo/' . $dataForm['photo_path2'], SITE_ROOT . 'photo/' . $new_name);
         $data_update['photo_path'] = $new_name;
     }
     $data_update['photo_title'] = $dataForm['photo_title'];
     $data_update['photo_description'] = $dataForm['photo_description'];
     $data_update['photo_status'] = $dataForm['photo_status'];
     $data_update['website_id'] = $mySession->WebsiteId;
     if ($photoId != "") {
         $condition = 'photo_id=' . $photoId;
         $result = $db->modify(PHOTO, $data_update, $condition);
     } else {
         $result = $db->save(PHOTO, $data_update);
     }
     return 1;
 }
Esempio n. 8
1
 public function getUsers($restId)
 {
     $db = new Db();
     $table = "rest" . $restId . "_users";
     $checkRest = restExists($table);
     if ($checkRest != true) {
         return $checkRest;
     }
     $local_query = "SELECT * FROM `{$table}`";
     $result = $db->select($local_query);
     $userCount = count($result);
     $configurationTable = "rest" . $restId . "_userConfigurations";
     $configurationMappingTable = "rest" . $restId . "_userConfigurationMapping";
     $userTable = "rest" . $restId . "_users";
     $local_query = "SELECT M.`userID`,M.`configurationID`, C.`configurationName`,C.`configurationDisplayText`, C.`configurationType`, \n\t\tC.`configurationTag`, C.`configurationValueBinary`, C.`configurationValueText`, C.`configurationValueDecimal`, C.`comments`,M.`isAllowed` FROM \n\t\t`{$configurationMappingTable}` AS M INNER JOIN `{$configurationTable}` AS C ON `M`.`configurationID` = `C`.`configurationID`  \n\t\tORDER BY   M.`userID`, M.`configurationID`";
     $resultConfiguration = $db->select($local_query);
     $configurationCount = count($resultConfiguration);
     for ($i = 0; $i < $userCount; $i++) {
         $result[$i]['Permissions'] = array();
         for ($j = 0; $j < $configurationCount; $j++) {
             if ($result[$i]['ID'] == $resultConfiguration[$j]['userID']) {
                 array_push($result[$i]['Permissions'], $resultConfiguration[$j]);
             }
         }
     }
     for ($i = 0; $i < $userCount; $i++) {
         for ($j = 0; $j <= count($result[$i]['Permissions']); $j++) {
             unset($result[$i]['Permissions'][$j]['userID']);
         }
     }
     $response = array();
     $response["Users"] = $result;
     return $response;
 }
Esempio n. 9
0
 /**
  * Example of an Endpoint
  */
 protected function games($_args)
 {
     // var_dump($this->method);
     // var_dump($this->endpoint);
     // var_dump($this->verb);
     // var_dump($this->args);
     // var_dump($this->file);
     // var_dump($this->request);
     $db = new Db();
     if ($this->method == 'GET') {
         // /games/id
         if (count($this->args)) {
             return $this->_response($db->select($this->endpoint, $this->args[0]));
             // /games/search?name=value
         } elseif ($this->verb === "search") {
             return $this->_response($db->search($this->endpoint, $this->request));
             // /games/
         } else {
             return $this->_response($db->select($this->endpoint));
         }
         // /games/?name=value1&description=value2
     } elseif ($this->method == 'POST') {
         return $this->_response($db->insert($this->endpoint, $this->request));
     } elseif ($this->method == 'PUT') {
         return $this->_response("UPDATE method not found", 404);
     } elseif ($this->method == 'DELETE') {
         return $this->_response("DELETE method not found", 404);
     } else {
         return $this->_response("Request error ", 500);
     }
 }
Esempio n. 10
0
function get_site_name()
{
    global $db_config;
    $db = new Db($db_config);
    $settings = $db->row("SELECT * FROM `settings`");
    return $settings['site_name'];
}
Esempio n. 11
0
 public function ChildPost($post_id, $thread_id)
 {
     global $mySession;
     $db = new Db();
     $forumPostlist = $db->runQuery("select * from \n\t\t\t" . FORUM_POSTS . " inner join " . FORUM_THREADS . " on " . FORUM_POSTS . ".thread_id=" . FORUM_THREADS . ".thread_id \n\t\t\tinner join " . FORUM_TOPICS . " on " . FORUM_TOPICS . ".topic_id = " . FORUM_THREADS . ".topic_id  \n\t\t\t\tinner join " . USERS . " on " . USERS . ".user_id = " . FORUM_POSTS . ".user_id\n\t\t\t where topic_status='1' and " . FORUM_POSTS . ".replyof=" . $post_id . " and " . FORUM_THREADS . ".thread_id = " . $thread_id . " order by " . FORUM_POSTS . ".post_id desc");
     return $forumPostlist;
 }
Esempio n. 12
0
function conectar()
{
    $con = new Db("localhost", "root", "benjamin13");
    $con->connect();
    $con->select_db("conquistadores");
    return $con;
}
Esempio n. 13
0
 public function init()
 {
     global $mySession;
     $db = new Db();
     $myControllerName = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();
     $myActionName = Zend_Controller_Front::getInstance()->getRequest()->getActionName();
     $defineData = $db->runQuery("select * from " . ADMINISTRATOR . " where admin_id='1'");
     define("ADMIN_EMAIL", array_key_exists('admin_email', $defineData[0]) ? $defineData[0]['admin_email'] : '');
     define("SITE_NAME", array_key_exists('site_title', $defineData[0]) ? $defineData[0]['site_title'] : 'TeeshirtSCRIPT');
     define("SITE_KEYWORD", array_key_exists('site_keyword', $defineData[0]) ? $defineData[0]['site_keyword'] : '');
     define("PRICE_SYMBOL", array_key_exists('currency_symbol', $defineData[0]) ? $defineData[0]['currency_symbol'] : '$');
     define("DEFAULT_BUSINESS_IMAGE", array_key_exists('default_business_image', $defineData[0]) ? $defineData[0]['default_business_image'] : 'my_default_business_image.png');
     define("DEFAULT_EVENT_IMAGE", array_key_exists('default_event_image', $defineData[0]) ? $defineData[0]['default_event_image'] : 'my_default_event_image.png');
     define("DEFAULT_MALE_USER_IMAGE", array_key_exists('default_male_image', $defineData[0]) ? $defineData[0]['default_male_image'] : 'my_default_male_image.png');
     define("DEFAULT_FEMALE_USER_IMAGE", array_key_exists('default_female_image', $defineData[0]) ? $defineData[0]['default_female_image'] : 'my_default_female_image.png');
     define("DEFAULT_USER_IMAGE", array_key_exists('default_both_image', $defineData[0]) ? $defineData[0]['default_both_image'] : 'my_default_both_image.png');
     if ($mySession->adminId == "" && $myControllerName != 'index') {
         $mySession->errorMsg = "Please login now to access administrator control panel.";
         $this->_redirect('index');
     }
     if ($mySession->adminId != "" && ($myControllerName == 'index' && $myActionName == 'index')) {
         $this->_redirect('dashboard');
     }
     $this->_helper->layout->setLayout('main');
 }
Esempio n. 14
0
 public function init($categoryId)
 {
     global $mySession;
     $db = new Db();
     $CategoryName = "";
     $cattitle = "";
     $catdesc = "";
     $catimage = "";
     $rssurl = "";
     if ($categoryId != "") {
         //category_id, category_name, perent_id, cat_position, cat_title, cat_desc, cat_image, category_status, created_by, created_date
         $PageData = $db->runQuery("select * from " . CATEGORIES . " where category_id='" . $categoryId . "'");
         $CategoryName = $PageData[0]['category_name'];
         $catposition = $PageData[0]['cat_position'];
         $cattitle = $PageData[0]['cat_title'];
         $catdesc = $PageData[0]['cat_desc'];
         $catimage = $PageData[0]['cat_image'];
         $rssurl = $PageData[0]['rss_url'];
     }
     $cat_position = new Zend_Form_Element_Hidden('cat_position');
     $cat_position->setValue($catposition);
     $cat_image_file = new Zend_Form_Element_Hidden('cat_image_file');
     $cat_image_file->setValue($catimage);
     $cat_desc = new Zend_Form_Element_Textarea('cat_desc');
     $cat_desc->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Category Title is required.'))->setAttrib("style", "width:350px;height:150px")->setValue($catdesc);
     $category_name = new Zend_Form_Element_Text('category_name');
     $category_name->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Category Name is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->setAttrib("style", "width:350px;")->setValue($CategoryName);
     $cat_title = new Zend_Form_Element_Text('cat_title');
     $cat_title->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Category Title is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->setAttrib("style", "width:350px;")->setValue($cattitle);
     $rss_url = new Zend_Form_Element_Text('rss_url');
     $rss_url->setAttrib("class", "textInput")->setAttrib("style", "width:350px;")->setValue($rssurl);
     $photo_path = new Zend_Form_Element_File('photo_path');
     $photo_path->setDestination(SITE_ROOT . 'images/category/')->addValidator('Extension', false, 'jpg,jpeg,png,gif')->setRequired(false)->addDecorator('Errors', array('class' => 'error'));
     $this->addElements(array($category_name, $cat_title, $cat_desc, $cat_image_file, $rss_url, $cat_position, $photo_path));
 }
Esempio n. 15
0
 public function myInit()
 {
     global $mySession;
     $db = new Db();
     $public_name = "";
     $emailid_val = "";
     $bio_value = '';
     $old_profile_image_value = '';
     $qur = $db->runquery("SELECT * FROM  " . USERS . " WHERE user_id='" . $mySession->TeeLoggedID . "' ");
     if ($qur != "" and count($qur) > 0) {
         $public_name = $qur[0]['public_name'];
         $emailid_val = $qur[0]['emailid'];
         $bio_value = $qur[0]['bio'];
         $old_profile_image_value = $qur[0]['profile_image'];
     }
     $publicname = new Zend_Form_Element_Text('publicname');
     $publicname->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Public name is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'changepasstextbox')->setValue($public_name);
     $bio = new Zend_Form_Element_Textarea('bio');
     $bio->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Bio is required.'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "changepasstextarea")->setAttrib("style", "height:150px;width:354px;")->setAttrib("maxlength", "300")->setAttrib("placeholder", "Max 300 Characters")->setValue($bio_value);
     $profile_image = new Zend_Form_Element_File('profile_image');
     $profile_image->setDestination(SITE_ROOT . 'images/profileimages/')->addValidator('Extension', false, 'jpg,jpeg,png,gif')->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "textInput")->setAttrib("style", "width:325px");
     $old_profile_image = new Zend_Form_Element_Hidden('old_profile_image');
     $old_profile_image->setValue($old_profile_image_value);
     $emailid = new Zend_Form_Element_Text('emailid');
     $emailid->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Email Id is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'changepasstextbox')->setValue($emailid_val);
     $this->addElements(array($publicname, $emailid, $bio, $profile_image, $old_profile_image));
 }
Esempio n. 16
0
 function login()
 {
     if (!empty($_POST)) {
         $check = new Check();
         $user = new User();
         $pdo = new Db();
         $db = $pdo->get();
         $mapper = new Mapper($db);
         //Проверяем входные данные
         $user->login = $check->checkInput($_POST['login']);
         $password = $check->checkInput($_POST['pass']);
         $user->password = md5($password);
         //Если пользователь не найден
         $this->user = $mapper->select($user);
         if (empty($this->user)) {
             $this->error = "Пароль или логин не совпадают";
             $this->out('login.php');
         } else {
             $this->out('profile.php');
             //Если найден, выводим профиль
         }
     } else {
         $this->out('login.php');
     }
 }
Esempio n. 17
0
 public function setMotd($motd)
 {
     $db = new Db();
     if ($db->setInfoscreenMotd($this->infoscreenid, $motd)) {
         $this->motd = $motd;
     }
 }
Esempio n. 18
0
 public function Retrive($cin)
 {
     $bdd = new Db();
     $query = "SELECT * FROM card WHERE cin=" . $cin;
     $result = $bdd->select($query);
     return $result;
 }
Esempio n. 19
0
 public function init($blogId)
 {
     //  echo "hello ".$blogId; exit();
     global $mySession;
     $db = new Db();
     $title_value = "";
     $description_value = "";
     $status_value = "1";
     if ($blogId != "") {
         $blogData = $db->runQuery("select * from " . BLOG_POST . " where blog_post_id='" . $blogId . "'");
         $title_value = $blogData[0]['title'];
         $description_value = $blogData[0]['description'];
         $status_value = $blogData[0]['status'];
     }
     $StatusArr = array();
     $StatusArr[0]['key'] = "1";
     $StatusArr[0]['value'] = "Enable";
     $status = new Zend_Form_Element_Select('status');
     $status->addMultiOptions($StatusArr)->setAttrib("class", "textInput")->setValue($status_value);
     $title = new Zend_Form_Element_Text('title');
     $title->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'blog title is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->setValue($title_value);
     $description = new Zend_Form_Element_Textarea('description');
     $description->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'blog description is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->setAttrib("rows", "3")->setAttrib("style", "height:100px;")->setValue($description_value);
     $this->addElements(array($status, $title, $description));
 }
Esempio n. 20
0
 public function init()
 {
     global $mySession;
     $db = new Db();
     $myControllerName = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();
     $myActionName = Zend_Controller_Front::getInstance()->getRequest()->getActionName();
     $this->view->myControllerName = $myControllerName;
     $this->view->myActionName = $myActionName;
     $defineData = $db->runQuery("select * from " . ADMINISTRATOR . " where admin_id='1'");
     if (isset($mySession->LoggedUserId) and @$mySession->LoggedUserId != "") {
         $userData = $db->runQuery("select * from " . USERS . " where user_id='" . $mySession->LoggedUserId . "'");
         $this->view->userData = $userData;
     }
     if (!defined("ADMIN_EMAIL")) {
         define("ADMIN_EMAIL", array_key_exists('admin_email', $defineData[0]) ? $defineData[0]['admin_email'] : '');
     }
     if (!defined("PAYPAL_TOKEN")) {
         define("PAYPAL_TOKEN", array_key_exists('paypal_token', $defineData[0]) ? $defineData[0]['paypal_token'] : '');
     }
     if (!defined("PAYPAL_EMAIL")) {
         define("PAYPAL_EMAIL", array_key_exists('paypal_email', $defineData[0]) ? $defineData[0]['paypal_email'] : '');
     }
     if (!defined("SITE_NAME")) {
         define("SITE_NAME", array_key_exists('site_title', $defineData[0]) ? $defineData[0]['site_title'] : 'TeeshirtSCRIPT');
     }
     //define("PRICE_SYMBOL",$defineData[0]['currency_symbol']);
     $Explode = explode("/", $_SERVER['REQUEST_URI']);
     $SName = $Explode[count($Explode) - 1];
     $ChkCampaign = $db->runQuery("select * from " . LAUNCHCAMPAIGN . " where trim(url)='" . urldecode($SName) . "' ");
     if ($ChkCampaign != "" and count($ChkCampaign) > 0 && $myControllerName == "error" && $myActionName == "error") {
         // Routing did not came up with a page, no problem as the URL is related to a campaign URL
         $myform1 = new Form_Buy();
         //$this->view->myform1=$myform1;
         $sizes = $db->runQuery("select * from " . TSHIRT_SIZE);
         $this->view->sizes = $sizes;
         $this->view->CampaignData = $ChkCampaign;
         include "application/layouts/scripts/campaign.phtml";
         // Load Campaign view!
         exit;
     }
     if (isset($mySession->TeeLoggedID) and @$mySession->TeeLoggedID != "") {
         if ($myControllerName == "signup" || $myControllerName == "login" || $myControllerName == "forgotpassword") {
             $this->_redirect(APPLICATION_URL . 'myaccount/profile');
         }
     } else {
         if ($myControllerName == "myaccount" || $myControllerName == "launchcampaign" && $myActionName == "edit") {
             $this->_redirect(APPLICATION_URL . 'index/index');
         }
     }
     if ($myControllerName == "launchcampaign") {
         if (stripslashes(array_key_exists('recreation_product', $_POST) ? $_POST['recreation_product'] : '') != '') {
             $mySession->recreation_product = stripslashes($_POST['recreation_product']);
         }
         if (stripslashes(array_key_exists('priceValueKM', $_POST) ? $_REQUEST['priceValueKM'] != '' : '') && stripslashes(array_key_exists('idValueKM', $_POST) ? $_REQUEST['idValueKM'] != '' : '')) {
             $mySession->priceValueKM = $_REQUEST['priceValueKM'];
             $mySession->selectedIdValueKM = $_REQUEST['idValueKM'];
         }
     }
     $this->_helper->layout->setLayout('main');
 }
Esempio n. 21
0
 public function UpdateSub($dataForm, $userId)
 {
     global $mySession;
     $db = new Db();
     $dataForm = SetupMagicQuotes($dataForm);
     $chkQry = $db->runQuery("select * from " . SUBSCRIPTION . " where mobile_number='" . $dataForm['mobile_number'] . "' and user_id!='" . $userId . "'");
     if ($chkQry != "" and count($chkQry) > 0) {
         return 0;
     } else {
         $dataUpdate['first_name'] = $dataForm['first_name'];
         $dataUpdate['last_name'] = $dataForm['last_name'];
         $dataUpdate['email_address'] = $dataForm['email_address'];
         $dataUpdate['username'] = $dataForm['username'];
         $dataUpdate['address'] = $dataForm['address'];
         $dataUpdate['country_id'] = $dataForm['country_id'];
         $dataUpdate['state_id'] = $dataForm['state_id'];
         $dataUpdate['city_id'] = $dataForm['city_id'];
         $dataUpdate['zipcode'] = $dataForm['zipcode'];
         $dataUpdate['phone_number'] = $dataForm['phone_number'];
         $dataUpdate['mobile_number'] = $dataForm['mobile_number'];
         $dataUpdate['newsletter_subscribe'] = $dataForm['subscribe'];
         $conditionUpdate = "user_id='" . $userId . "'";
         $db->modify(USERS, $dataUpdate, $conditionUpdate);
         return $userId;
     }
 }
Esempio n. 22
0
 public function loginAction()
 {
     global $mySession;
     $db = new Db();
     $this->view->pageHeading = "Login";
     $this->_helper->layout->setLayout('login');
     if ($this->getRequest()->isPost()) {
         $request = $this->getRequest();
         $myform = new Form_Login();
         if ($myform->isValid($request->getPost())) {
             $dataForm = $myform->getValues();
             $chkLogin = $db->runQuery("select * from " . ADMINISTRATOR . " where admin_username='******'admin_username']) . "' and admin_password='******'admin_password'])) . "'");
             if ($chkLogin != "" and count($chkLogin) > 0) {
                 $mySession->adminId = $chkLogin[0]['admin_id'];
                 $this->_redirect('dashboard');
             } else {
                 $mySession->errorMsg = "Invalid username or password.";
                 $this->view->myform = $myform;
                 $this->render('index');
             }
         } else {
             $this->view->myform = $myform;
             $this->render('index');
         }
     } else {
         $this->_redirect('index');
     }
 }
Esempio n. 23
0
 public function myInit($Id)
 {
     global $mySession;
     $db = new Db();
     if ($Id != "") {
         $adminData = $db->runQuery("select * from " . TSHIRT_ICONS . " where id='" . $Id . "'");
         $title_value = $adminData[0]['title'];
         $oldicon_value = $adminData[0]['icon'];
         $colorcode_value = $adminData[0]['colorcode'];
     } else {
         $title_value = '';
         $oldicon_value = '';
         $colorcode_value = '';
     }
     $title = new Zend_Form_Element_Text('title');
     $title->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'First Name is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($title_value);
     $colorcode = new Zend_Form_Element_Text('colorcode');
     $colorcode->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Please enter color code.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "Expandable mws-textinput required")->setAttrib("onkeypress", "return checknummspK(event)")->setValue($colorcode_value);
     $this->addElement($colorcode);
     $this->addElement($title);
     if ($Id == "") {
         $image = new Zend_Form_Element_File('image');
         $image->setDestination(SITE_ROOT . 'images/tshirt-icons/')->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Please select an icon.'))->addValidator('Extension', false, 'jpg,jpeg,png,gif')->setAttrib("class", "textbox")->addDecorator('Errors', array('class' => 'error'));
     } else {
         $image = new Zend_Form_Element_File('image');
         $image->setDestination(SITE_ROOT . 'images/tshirt-icons/')->addValidator('Extension', false, 'jpg,jpeg,png,gif')->setAttrib("class", "textbox");
     }
     $this->addElement($image);
     if ($Id != "") {
         $oldicon = new Zend_Form_Element_Hidden('oldicon');
         $oldicon->setValue($oldicon_value);
         $this->addElement($oldicon);
         $this->addElement("hidden", "foo", array("decorators" => array(array(array("img" => "HtmlTag"), array("tag" => "img", "openOnly" => true, "src" => IMAGES_URL . 'tshirt-icons/' . $oldicon_value, "align" => "middle", "class" => "myClass", "style" => "max-width:200px;max-height:200px;")), array("ViewHelper"), array(array("span" => "HtmlTag"), array("tag" => "span", "class" => "myElement", "style" => "text-align:center;display:block;")))));
     }
 }
Esempio n. 24
0
 public function save()
 {
     $query = "INSERT INTO miembros values (null,'" . $this->getNombre() . "',null,'" . $this->getEmail() . "')";
     $conn = new Db("localhost", "root", "benjamin13");
     $conn->connect();
     $conn->insert($query, "conquistadores");
 }
Esempio n. 25
0
 public function init($pageId)
 {
     global $mySession;
     $db = new Db();
     $PageTitle = "";
     $PageContent = "";
     $PageMetaKeyword = "";
     $PageMetaDescription = "";
     if ($pageId != "") {
         $PageData = $db->runQuery("select * from " . PAGES1 . " where page_id='" . $pageId . "'");
         //                prd($PageData);
         $PageTitle = $PageData[0]['page_title'];
         $PageContent = $PageData[0]['page_content'];
         $PageMetaKeyword = $PageData[0]['meta_keywords'];
         $PageMetaDescription = $PageData[0]['meta_description'];
         $PageSynonyms = $PageData[0]['synonyms'];
     }
     $page_title = new Zend_Form_Element_Text('page_title');
     $page_title->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Page title is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($PageTitle);
     $page_content = new Zend_Form_Element_Textarea('page_content');
     $page_content->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Page content is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("id", "elrte")->setAttrib("cols", "auto")->setAttrib("rows", "auto")->setValue($PageContent);
     $meta_keywords = new Zend_Form_Element_Text('meta_keywords');
     $meta_keywords->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Keywords are required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($PageMetaKeyword);
     $meta_description = new Zend_Form_Element_Text('meta_description');
     $meta_description->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Description is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($PageMetaDescription);
     $synonyms = new Zend_Form_Element_Text('synonyms');
     $synonyms->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'URL is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($PageSynonyms);
     $this->addElements(array($page_title, $page_content, $meta_keywords, $meta_description, $synonyms));
 }
Esempio n. 26
0
 public function init($stateId)
 {
     global $mySession;
     $db = new Db();
     $CountryId = "";
     $StateName = "";
     if ($stateId != "") {
         $PageData = $db->runQuery("select * from " . STATE . " where state_id='" . $stateId . "'");
         $CountryId = $PageData[0]['country_id'];
         $StateName = $PageData[0]['state_name'];
     }
     $CounyryArr = array();
     $CounyryArr[0]['key'] = "";
     $CounyryArr[0]['value'] = "- - Country - -";
     $CounyryData = $db->runQuery("select * from " . COUNTRIES . " order by country_name");
     if ($CounyryData != "" and count($CounyryData) > 0) {
         $i = 1;
         foreach ($CounyryData as $key => $CounyryValues) {
             $CounyryArr[$i]['key'] = $CounyryValues['country_id'];
             $CounyryArr[$i]['value'] = $CounyryValues['country_name'];
             $i++;
         }
     }
     $country_id = new Zend_Form_Element_Select('country_id');
     $country_id->setRequired(true)->addMultiOptions($CounyryArr)->addValidator('NotEmpty', true, array('messages' => 'Country is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "required")->setValue($CountryId);
     $state_name = new Zend_Form_Element_Text('state_name');
     $state_name->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'State Name is required.'))->addValidator('regex', true, array('pattern' => '/^[a-zA-Z\\-]+$/', 'messages' => array('regexNotMatch' => 'Please enter proper name and without space')))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($StateName);
     $this->addElements(array($country_id, $state_name));
 }
Esempio n. 27
0
File: Index.php Progetto: airzhe/yaf
 public function indexAction()
 {
     /*print_r($config);
     		return;*/
     $medoo = new Db(Yaf\Registry::get('DbConf')['order']);
     #var_dump($medoo->quote("`id`"));
     #return;
     #print_r($medoo->info());return;
     $row = $medoo->debug()->select("post", ["[>]account" => ["author_id" => "user_id"], "[>]album" => "user_id", "[>]photo" => ["user_id", "avatar_id"], "[>]account (replyer)" => ["replyer_id" => "user_id"], "[>]account" => ["author_id" => "user_id"], "[>]album" => ["account.user_id" => "user_id"], "[>]account" => ["author_id" => "user_id", "album.user_id" => "user_id"]], ["post.post_id", "post.title", "account.user_id", "account.city", "replyer.user_id", "replyer.city"], ["post.user_id" => 100, "ORDER" => "post.post_id DESC", "LIMIT" => 50]);
     print_r($row);
     return var_dump($pdoStatement->fetchColumn());
     var_dump($pdoStatement->fetchColumn(1));
     var_dump($pdoStatement->fetchColumn());
     var_dump($pdoStatement->fetchColumn());
     var_dump($pdoStatement->fetchColumn());
     reset($pdoStatement);
     foreach ($pdoStatement as $v) {
         var_dump($v);
     }
     #var_dump($medoo->log());
     #var_dump($row);
     #print_r(get_class_methods($medoo));
     #$adminModel = new AdminModel();
     return;
     echo 'hello yaf';
 }
Esempio n. 28
0
 public function init($campid)
 {
     global $mySession;
     $db = new Db();
     $title_val = "";
     $baseprice_val = "";
     $goal_val = "";
     $sold_val = "";
     $sellingprice_val = "";
     $description_val = "";
     $camplength_val = "";
     $url_val = "";
     $launchdate_val = "";
     if ($campid != "") {
         $qur = $db->runquery("SELECT * FROM  " . LAUNCHCAMPAIGN . " WHERE campaign_id='" . $campid . "'");
         if ($qur != "" and count($qur) > 0) {
             //prd($qur);
             $title_val = $qur[0]['title'];
             $baseprice_val = $qur[0]['base_price'];
             $goal_val = $qur[0]['goal'];
             $sold_val = $qur[0]['sold'];
             $sellingprice_val = $qur[0]['selling_price'];
             $description_val = $qur[0]['description'];
             $camplength_val = $qur[0]['campaign_length'];
             $url_val = $qur[0]['url'];
             $launchdate_val = $qur[0]['launch_date'];
         }
     }
     # FORM ELEMENT:no of tee
     # TYPE : text
     $baseprice = new Zend_Form_Element_Text('baseprice');
     $baseprice->setRequired(true)->setAttrib("class", "mws-textinput required")->setAttrib("readonly", "readonly")->setAttrib("style", "width:50px; height:20px;")->setvalue($baseprice_val);
     $sellingprice = new Zend_Form_Element_Text('sellingprice');
     $sellingprice->setRequired(true)->setAttrib("class", "mws-textinput required")->setAttrib("readonly", "readonly")->setAttrib("style", "width:50px; height:20px;")->setvalue($sellingprice_val);
     # FORM ELEMENT:camptitle
     # TYPE : text
     $camptitle = new Zend_Form_Element_Text('camptitle');
     $camptitle->setRequired(true)->setAttrib("class", "mws-textinput required")->setAttrib("readonly", "readonly")->setAttrib("style", "width:250px; height:30px;")->setvalue($title_val);
     # FORM ELEMENT:description
     # TYPE : text
     $description = new Zend_Form_Element_Textarea('description');
     $description->setRequired(true)->setAttrib("class", "mws-textinput required")->setAttrib("readonly", "readonly")->setAttrib("style", "width:450px; height:120px;")->setvalue($description_val);
     $goal = new Zend_Form_Element_Text('goal');
     $goal->setRequired(true)->setAttrib("class", "mws-textinput required")->setAttrib("readonly", "readonly")->setAttrib("style", "width:50px; height:20px;")->setvalue($goal_val);
     $sold = new Zend_Form_Element_Text('sold');
     $sold->setRequired(true)->setAttrib("class", "mws-textinput required")->setAttrib("readonly", "readonly")->setAttrib("style", "width:50px; height:20px;")->setvalue($sold_val);
     # FORM ELEMENT:url
     # TYPE : text
     $url = new Zend_Form_Element_Text('url');
     $url->setRequired(true)->setAttrib("class", "mws-textinput required")->setAttrib("readonly", "readonly")->setAttrib("style", "width:60px; height:20px;")->setvalue($url_val);
     # FORM ELEMENT:url
     # TYPE : text
     $camplength = new Zend_Form_Element_Text('camplength');
     $camplength->setRequired(true)->setAttrib("class", "mws-textinput required")->setAttrib("readonly", "readonly")->setAttrib("style", "width:50px; height:20px;")->setvalue($camplength_val);
     # FORM ELEMENT:url
     # TYPE : text
     $launchdate = new Zend_Form_Element_Text('launchdate');
     $launchdate->setRequired(true)->setAttrib("class", "mws-textinput required")->setAttrib("readonly", "readonly")->setAttrib("style", "width:70px; height:20px;")->setvalue($launchdate_val);
     $this->addElements(array($sellingprice, $baseprice, $camptitle, $camplength, $launchdate, $url, $description, $sold, $goal));
 }
Esempio n. 29
0
 public function init($catId)
 {
     global $mySession;
     $db = new Db();
     $catname = "";
     $catdescription = "";
     if ($catId != "") {
         $Data = $db->runQuery("select * from " . CATEGORY . " where cat_id='" . $catId . "'");
         $catname = $Data[0]['cat_name'];
         $catdescription = $Data[0]['cat_description'];
     }
     $cat_name = new Zend_Form_Element_Text('cat_name');
     $cat_name->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Category name is required.'))->addDecorator('Errors', array('class' => 'errormsg'))->setAttrib("class", "mws-textinput required")->setValue($catname);
     $cat_description = new Zend_Form_Element_Textarea('cat_description');
     $cat_description->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Category description is required.'))->addDecorator('Errors', array('class' => 'errormsg'))->setAttrib("class", "mws-textinput required")->setValue($catdescription);
     /*	$pagepositionArr=array();
     		$pagepositionArr[0]['key']="0";
     		$pagepositionArr[0]['value']="Top";
     		$pagepositionArr[1]['key']="1";
     		$pagepositionArr[1]['value']="Bottom";
     		$pageposition= new Zend_Form_Element_Radio('pageposition');
     		$pageposition->addMultiOptions($pagepositionArr)
     		->setValue($pageposition_value);
     */
     $this->addElements(array($cat_name, $cat_description));
 }
Esempio n. 30
0
 public function init($pageId)
 {
     global $mySession;
     $db = new Db();
     $PageTitle = "";
     $PageContent = "";
     //$pageposition_value="";
     if ($pageId != "") {
         $PageData = $db->runQuery("select * from " . PAGES . " where page_id='" . $pageId . "'");
         $PageTitle = $PageData[0]['page_title'];
         $PageContent = $PageData[0]['page_content'];
         //$pageposition_value=$PageData[0]['page_position'];
     }
     $page_title = new Zend_Form_Element_Text('page_title');
     $page_title->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Page title is required.'))->addDecorator('Errors', array('class' => 'errormsg'))->setAttrib("class", "mws-textinput required")->setValue($PageTitle);
     $page_content = new Zend_Form_Element_Textarea('page_content');
     $page_content->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Page content is required.'))->addDecorator('Errors', array('class' => 'errormsg'))->setAttrib("class", "mws-textinput required")->setAttrib("id", "elrte")->setAttrib("cols", "auto")->setAttrib("style", "width:90%;")->setValue($PageContent);
     /*	$pagepositionArr=array();
     		$pagepositionArr[0]['key']="0";
     		$pagepositionArr[0]['value']="Top";
     		$pagepositionArr[1]['key']="1";
     		$pagepositionArr[1]['value']="Bottom";
     		$pageposition= new Zend_Form_Element_Radio('pageposition');
     		$pageposition->addMultiOptions($pagepositionArr)
     		->setValue($pageposition_value);
     */
     $this->addElements(array($page_title, $page_content));
 }