Changeset 175817
- Timestamp:
- 11/21/2009 10:38:19 PM (17 years ago)
- Location:
- zingiri-hoster/trunk
- Files:
-
- 18 added
- 13 edited
-
apps/classes/sub.active_customer.class.php (added)
-
apps/classes/sub.cartprice.class.php (modified) (2 diffs)
-
apps/classes/sub.domain (added)
-
apps/classes/sub.domain.class.php (added)
-
apps/classes/sub.domain/config.txt (added)
-
apps/classes/sub.domain/samswhois.class.php (added)
-
apps/fields/hosting_billing_choice.xml (modified) (1 diff)
-
apps/fields/hosting_domain.xml (modified) (2 diffs)
-
apps/fields/hosting_price_per_period.xml (modified) (1 diff)
-
fws/admin.php (modified) (2 diffs)
-
fws/batch/orders.php (modified) (3 diffs)
-
fws/checkout.php (modified) (1 diff)
-
fws/classes/db.class.php (modified) (10 diffs)
-
fws/classes/error.class.php (added)
-
fws/classes/order.class.php (modified) (1 diff)
-
fws/classes/package.class.php (modified) (8 diffs)
-
fws/includes/subsh.inc.php (modified) (2 diffs)
-
fws/iptocountry.php (modified) (2 diffs)
-
fws/langs/en/lang.txt (modified) (1 diff)
-
fws/params (added)
-
fws/params/countries.txt (added)
-
fws/params/lang.txt (added)
-
fws/templates/default/images/domainpricing.png (added)
-
fws/templates/default/index.php (added)
-
fws/templates/index.php (added)
-
zing.globals.inc.php (added)
-
zing.inc.php (added)
-
zing.readcookie.inc.php (added)
-
zing.startfunctions.inc.php (added)
-
zing.startmodules.inc.php (added)
-
zing.subs.readcookie.inc.php (added)
Legend:
- Unmodified
- Added
- Removed
-
zingiri-hoster/trunk/apps/classes/sub.cartprice.class.php
r175051 r175817 27 27 function display(&$field_markup,&$subscript_markup) { 28 28 parent::display(&$field_markup,&$subscript_markup); 29 29 30 30 $e=$this->element; 31 31 $i=$this->subid; … … 33 33 34 34 } 35 35 36 36 function prepare() { 37 echo 'here'; 38 $this->int=123; 39 $this->ext=123; 37 parent::prepare(); 38 $e=$this->element; 39 $i=$this->subid; 40 41 //print_r($this->element->populated_column); 42 //print_r($this->element->populated_value); 43 $currency=$e->populated_column['CURRENCY']; 44 $frequency=$e->populated_column['FREQUENCY']; 45 $productid=$e->populated_column['PRODUCTID']; 46 $regtype=$e->populated_column['DOMAIN_REGTYPE']; 47 $domain=$e->populated_column['DOMAIN_NAME']; 48 $period=$e->populated_column['DOMAIN_PERIOD']; 49 50 $price=$this->calcPackagePrice($productid,$currency,$frequency); 51 $price+=$this->calcDomainPrice($currency,$period,$regtype,$domain); 52 $e->populated_value['element_'.$e->id.'_'.$i]=$price; 40 53 } 41 /* 42 function verify() 43 { 44 $this->ext=$this->int; 45 $status=$this->checkDomain(); 46 $j=$this->subid+2; 47 $regtype=$this->element->input['element_'.$this->element->id.'_'.$j]; 48 if ($status==1 && ($regtype==2)) 49 return $this->error("You can't transfer a domain that is not registered!"); 50 elseif ($status==2 && ($regtype==1)) 51 return $this->error("This domain is already registered!"); 52 elseif ($status==3) 53 return $this->error("This domain name is invalid!"); 54 return true; 54 55 private function calcPackagePrice($productid,$currency,$frequency) { 56 if (empty($frequency)) $frequency=1; 57 58 if (!empty($productid) && !empty($currency) && !empty($frequency)) { 59 $query="select ##pricing.price from ##pricing where ##pricing.productid=".zfqs($productid)." and ##pricing.currency=".zfqs($currency)." and ##pricing.frequency=".zfqs($frequency); 60 $sql=new db(); 61 $sql->select($query); 62 if ($row=$sql->next()) { 63 $price=$sql->row['price']; 64 } 65 66 } else { 67 $price=false; 68 } 69 return $price; 70 } 71 72 private function calcDomainPrice($currency,$period,$regtype,$domain) { 73 if ($regtype == 3) return 0; 55 74 75 $whois = new SamsWhois(); 76 if (!$whois->ValidDomain($domain)) return false; 77 78 //if (empty($period)) $period=1; 79 $extension=$whois->extension; 80 81 if (!empty($extension) && !empty($currency) && !empty($period)) { 82 $query="select ##domainpricing.price from ##domainpricing where ##domainpricing.extension=".zfqs($extension)." and ##domainpricing.currency=".zfqs($currency)." and ##domainpricing.period=".zfqs($period); 83 $sql=new db(); 84 $sql->select($query); 85 if ($row=$sql->next()) { 86 $price=$sql->row['price']; 87 } 88 89 } else { 90 $price=false; 91 } 92 return $price; 56 93 } 57 */58 94 95 function verify() { 96 $success=true; 97 $e=$this->element; 98 $i=$this->subid; 99 100 // print_r($this->element->populated_column); 101 // print_r($this->element->populated_value); 102 $currency=$e->populated_column['CURRENCY']; 103 $frequency=$e->populated_column['FREQUENCY']; 104 $productid=$e->populated_column['PRODUCTID']; 105 $regtype=$e->populated_column['DOMAIN_REGTYPE']; 106 $domain=$e->populated_column['DOMAIN_NAME']; 107 $period=$e->populated_column['DOMAIN_PERIOD']; 108 109 $price=$this->calcPackagePrice($productid,$currency,$frequency); 110 $price+=$this->calcDomainPrice($currency,$period,$regtype,$domain); 111 $this->ext=$this->int=$price; 112 return $success; 113 } 59 114 } -
zingiri-hoster/trunk/apps/fields/hosting_billing_choice.xml
r174990 r175817 6 6 <name>frequency</name> 7 7 <format>varchar(2)</format> 8 <default> </default>8 <default>1</default> 9 9 <type>sql</type> 10 10 <values type="sql"> 11 <query>select ##pricing.frequency, concat(##pricing.frequency,' - ',##pricing.price) from ##product,##pricing where ##product.id=##pricing.productid and ##product.id=$productid and ##pricing.currency=$myCurrencyorder by ##pricing.frequency</query>11 <query>select ##pricing.frequency,##parameter.label from ##pricing,##parameter where ##pricing.productid=$productid and ##pricing.currency=$myCurrency and ##parameter.name='frequency' and ##pricing.frequency=##parameter.value order by ##pricing.frequency</query> 12 12 <where>productid,myCurrency</where> 13 13 </values> -
zingiri-hoster/trunk/apps/fields/hosting_domain.xml
r174990 r175817 2 2 <config type="hosting" version="1.5.0"> 3 3 <name>Domain</name> 4 <fields count=" 3">4 <fields count="4"> 5 5 <field1> 6 6 <name>name</name> … … 30 30 </values> 31 31 </field3> 32 <field4> 33 <name>period</name> 34 <format>varchar(2)</format> 35 <label>registration length</label> 36 <default>1</default> 37 <type>select</type> 38 <values type="multi"> 39 <option1 value="1">1 Year</option1> 40 <option2 value="2">2 Year</option2> 41 <option3 value="3">3 Year</option3> 42 <option4 value="4">4 Year</option4> 43 <option5 value="5">5 Year</option5> 44 <option6 value="0">One time</option6> 45 </values> 46 </field4> 32 47 </fields> 33 48 </config> -
zingiri-hoster/trunk/apps/fields/hosting_price_per_period.xml
r174990 r175817 1 1 <?xml version="1.0" encoding="utf-8"?> 2 2 <config type="hosting" version="1.5.0"> 3 <name> Price per period</name>4 <fields count=" 2">3 <name>Cart price</name> 4 <fields count="1"> 5 5 <field1> 6 6 <name>price</name> 7 <label>Price</label>8 7 <format>decimal(12,2)</format> 8 <type>cartprice</type> 9 9 <size>10</size> 10 10 </field1> 11 <field2>12 <name>allow</name>13 <label>Allow in signup</label>14 <format>int(6)</format>15 <type>checkbox</type>16 </field2>17 11 </fields> 18 12 </config> -
zingiri-hoster/trunk/fws/admin.php
r175054 r175817 90 90 <td><div style="text-align:center;"><a class="plain" href="?page=customeradmin&action=showcustomers"><img src="<?php echo $gfx_dir; ?>/customers.gif" alt="" /><br /><?php echo $txt['admin3']." (".CountCustomers('CUSTOMER').")"; ?></a><br /><br /></div></td> 91 91 <td><div style="text-align:center;"><a class="plain" href="?zfaces=list&form=package"><img src="<?php echo $gfx_dir; ?>/package.png" height="32px" alt="package" /><br /><?php echo $txt['admin44']; ?></a><br /><br /></div></td> 92 92 <td><div style="text-align:center;"><a class="plain" href="?zfaces=list&form=domain"><img src="<?php echo $gfx_dir; ?>/domain.png" height="32px" alt="domain" /><br /><?php echo $txt['admin48']; ?></a><br /><br /></div></td> 93 93 </tr> 94 94 <tr><td colspan="3"><h6><?php echo $txt['admin46']; ?></h6></td></tr> … … 101 101 <td><div style="text-align:center;"><a class="plain" href="?zfaces=list&form=server"><img src="<?php echo $gfx_dir; ?>/server.png" height="32px" alt="server" /><br /><?php echo $txt['admin40']; ?></a><br /><br /></div></td> 102 102 <td><div style="text-align:center;"><a class="plain" href="?zfaces=list&form=registrar"><img src="<?php echo $gfx_dir; ?>/registrar.png" height="32px" alt="registrar" /><br /><?php echo $txt['admin42']; ?></a><br /><br /></div></td> 103 <td><div style="text-align:center;"><a class="plain" href="?zfaces=list&form=domainpricing"><img src="<?php echo $gfx_dir; ?>/domain .png" height="32px" alt="domain" /><br /><?php echo $txt['admin41']; ?></a><br /><br /></div></td>103 <td><div style="text-align:center;"><a class="plain" href="?zfaces=list&form=domainpricing"><img src="<?php echo $gfx_dir; ?>/domainpricing.png" height="32px" alt="domain" /><br /><?php echo $txt['admin41']; ?></a><br /><br /></div></td> 104 104 <td><div style="text-align:center;"><a class="plain" href="?zfaces=list&form=product"><img src="<?php echo $gfx_dir; ?>/product.png" height="32px" alt="product" /><br /><?php echo $txt['admin5']." (".CountProducts().")"; ?></a><br /><br /></div></td> 105 105 </tr> -
zingiri-hoster/trunk/fws/batch/orders.php
r175007 r175817 7 7 require (dirname(__FILE__)."/../includes/readsettings.inc.php"); // read shop settigns 8 8 require(dirname(__FILE__)."/../includes/setfolders.inc.php"); // set appropriate folders 9 define("DBTABLESPREFIX",$dbtablesprefix); 10 define("BR","\n\0"); 11 require(dirname(__FILE__)."/../classes/db.class.php"); 12 require(dirname(__FILE__)."/../classes/order.class.php"); 13 require(dirname(__FILE__)."/../classes/package.class.php"); 14 require(dirname(__FILE__)."/../plugins/controlpanel.class.php"); 9 15 } 10 16 11 define("DBTABLESPREFIX",$dbtablesprefix); 12 define("BR","\n\0"); 13 require(dirname(__FILE__)."/../classes/db.class.php"); 14 require(dirname(__FILE__)."/../classes/order.class.php"); 15 require(dirname(__FILE__)."/../classes/package.class.php"); 16 require(dirname(__FILE__)."/../plugins/controlpanel.class.php"); 17 echo 'Generate invoices<br />'; 17 18 18 echo 'Processing orders'; 19 20 $order=new db(); 19 $error=new error(); 20 $order=new order(); 21 21 22 22 //select paid and approved orders 23 $order->select ("select * from ##order where status in ('4')");23 $order->selectOpenOrders(); 24 24 while ($order->next()) { 25 print_r($order->row);26 25 27 26 $succes=true; … … 30 29 $basket->select("select * from ##basket where orderid=".$order->get('id')); 31 30 while ($basket->next()) { 32 echo "basket:";print_r($basket->row);33 34 31 //create the package 35 32 $package=new package(); … … 41 38 $package->price=$basket->get('price'); 42 39 43 $package->create($basket->get('productid')); 40 if (!$package->create($basket->get('productid'))) { 41 $succes=false; 42 $error->add("Couldn't create package: ".$package->domain); 43 } 44 44 45 45 //activate the package 46 $success=$package->activate(); 46 if ($succes && !$package->activate()) { 47 $succes=false; 48 $error->add("Couldn't activate package: ".$package->domain); 49 } 50 if ($succes && !$package->sendWelcomeEmail()) { 51 $succes=false; 52 $error->add("Couldn't send welcome email for package: ".$package->domain); 53 } 47 54 } 48 55 //update order 49 //$order->setStatusCompleted(); 56 if ($succes) { 57 $order->setStatusCompleted(); 58 } 50 59 51 60 } 52 61 62 $error->dump(); 53 63 ?> -
zingiri-hoster/trunk/fws/checkout.php
r175054 r175817 257 257 $payment_code = str_replace("%email%", $customer_row['EMAIL'], $payment_code); 258 258 $payment_code = str_replace("%phone%", $customer_row['PHONE'], $payment_code); 259 $payment_code = str_replace("%ipn%", ZING_URL.'fws/ ipn.php', $payment_code);259 $payment_code = str_replace("%ipn%", ZING_URL.'fws/plugins/gateways/paypal/ipn.php', $payment_code); 260 260 $payment_code = str_replace("%paypal_email%", $sales_mail, $payment_code); 261 261 $payment_code = str_replace("%return%", $shopurl . '/index.php?page=checkout&paypal=1', $payment_code); -
zingiri-hoster/trunk/fws/classes/db.class.php
r175010 r175817 7 7 var $sql=""; 8 8 var $row; 9 10 function __construct() {11 //echo "hello";12 }13 9 14 10 function select($query) { … … 22 18 23 19 function next() { 24 25 20 if ($this->row=mysql_fetch_assoc($this->sql)) { 26 27 21 return $this->row; 28 22 } else { return false; } … … 30 24 31 25 function update($query) { 32 $this->sql = mysql_query($query) or die(dbError(1,$query,"",$action)); 33 return $this->sql; 26 $query=str_replace("##",DBTABLESPREFIX,$query); 27 $sql = mysql_query($query) or die($this->dbError(1,$query,"",$action)); 28 return $sql; 34 29 } 35 30 … … 64 59 65 60 // echo $query."<br />"; 66 $sql = mysql_query($query) or die( dbError(1,$query,"substax.inc.php",$action));61 $sql = mysql_query($query) or die($this->dbError(1,$query,"substax.inc.php",$action)); 67 62 $numrows=mysql_num_rows($sql); 68 63 … … 105 100 106 101 // echo $query."<br />"; 107 $sql_update = mysql_query($query) or die( dbError(1,$query,"substax.inc.php",$action));102 $sql_update = mysql_query($query) or die($this->dbError(1,$query,"substax.inc.php",$action)); 108 103 } 109 104 … … 152 147 $query.=")"; 153 148 // echo $query."<br />"; 154 $sql_insert = mysql_query($query) or die( dbError(1,$query,"substax.inc.php",$action));149 $sql_insert = mysql_query($query) or die($this->dbError(1,$query,"substax.inc.php",$action)); 155 150 $id = mysql_insert_id(); 156 151 … … 172 167 173 168 // echo $query."<br />"; 174 $sql = mysql_query($query) or die( dbError(1,$query,"",$action));169 $sql = mysql_query($query) or die($this->dbError(1,$query,"",$action)); 175 170 } 176 171 … … 196 191 } 197 192 198 function txrollback()193 private function txrollback() 199 194 { 200 195 Global $txglobal; … … 208 203 } 209 204 210 function dbError($severity, $query, $page, $action)205 private function dbError($severity, $query, $page, $action) 211 206 { 212 207 Global $gfx_dir; … … 220 215 $sql=mysql_error(); 221 216 222 txrollback();217 $this->txrollback(); 223 218 224 219 echo "ERROR:".$severity."-".$query."-".$sql; -
zingiri-hoster/trunk/fws/classes/order.class.php
r175010 r175817 1 1 <?php 2 class order { 3 var $numrows; 4 var $sql=""; 5 var $row; 6 7 function __construct() { 8 //echo "hello"; 2 class order extends db { 3 4 5 function selectOpenOrders() { 6 $this->select("select * from ##order where status in ('4')"); 9 7 } 10 8 11 function select($query) {12 $action="";13 $query=str_replace("##",DBTABLESPREFIX,$query);14 $this->sql = mysql_query($query) or die($this->error($query));15 $this->numrows=mysql_num_rows($this->sql);16 echo $this->numrows;17 if ($this->numrows == 0) return false; else return $this->numrows;18 }19 20 function next() {21 if ($this->row=mysql_fetch_assoc($this->sql)) {22 return $this->row;23 } else { return false; }24 }25 26 9 function setStatusCompleted() { 27 10 $status='6'; 28 11 $query="update ##order set STATUS=".qs($status); 29 $sql = mysql_query($query) or die(dbError(1,$query,"",$action)); 30 return true; 12 return parent::update($query); 31 13 } 32 14 -
zingiri-hoster/trunk/fws/classes/package.class.php
r175010 r175817 31 31 $this->productid=$this->package->get('productid'); 32 32 $this->username=$this->package->get('username'); 33 $this->password=$this->package->get('password'); 34 $this->domain=$this->package->get('domain'); 33 35 } 34 36 … … 63 65 $c['STATUS']='10'; 64 66 $c['DOMAIN']=$this->domain; 65 $c['REGISTRATION']=$this->registration;66 67 $c['FREQUENCY']=$this->frequency; 68 $c['DATE_CREATED']=date("Y-m-d H:i:s"); 69 $c['DUEDATE']=$this->calcNextDueDate(); 67 70 68 71 $c['USERNAME']=$this->username=$this->createUsername($this->domain); … … 71 74 $p=new db(); 72 75 $this->id=$p->insertRecord("package",null,$c); 76 77 if ($this->id) return true; else return false; 73 78 //not defined yet 74 79 //$c['PERIOD']=$this->period; 75 //$c['NEXTDUEDATE']= 76 //$c['PRICE']= 77 } 78 80 //$c['REGISTRATION']=$this->registration; 81 82 } 83 84 private function calcNextDueDate() { 85 $today=date("Y-m-d"); 86 $mth=$this->frequency; 87 $duedate=add_date($today,$mth); 88 return $duedate; 89 } 90 79 91 function sendWelcomeEmail() { 80 92 global $webmaster_mail; 81 93 global $shopname; 82 94 95 if (!is_object($this->customer)) $this->getCustomer(); 96 83 97 $template=new template($this->product->get('templateid')); 84 98 $template->replace('FIRSTNAME',$this->customer->get('initials')); 85 99 $template->replace('LASTNAME',$this->customer->get('lastname')); 86 $template->replace('DOMAINUSERNAME',$this->package->get('username')); 87 $template->replace('DOMAINPASSWORD',$this->package->get('password')); 100 $template->replace('DOMAINUSERNAME',$this->package->username); 101 $template->replace('DOMAINPASSWORD',$this->package->password); 102 $template->replace('DOMAINNAME',$this->package->domain); 88 103 $ns=$this->server->get('NSIP1_NS')." - ".$this->server->get('NSIP1_IP'); 89 104 $ns.='<br />'; 90 105 $ns.=$this->server->get('NSIP2_NS')." - ".$this->server->get('NSIP2_IP'); 91 106 $template->replace('NAMESERVERS',$ns); 92 $template->replace('DOMAINNAME',$this->package->get('domain'));93 107 $template->replace('DOMAINIP',$this->server->get('ip')); 94 108 $template->replace('SUPPORTEMAIL',$this->settings->webmaster_mail); 95 109 $template->replace('COMPANY',$this->settings->shopname); 96 110 97 mymail($this->settings->webmaster_mail, $this->customer->get('email'), $this->product->get('msgtitle'), $template->content, $this->settings->charset);98 echo 'Email sent ';99 return true;111 $ret=mymail($this->settings->webmaster_mail, $this->customer->get('email'), $this->product->get('msgtitle'), $template->content, $this->settings->charset); 112 echo 'Email sent:'.$ret; 113 return $ret; 100 114 } 101 115 … … 140 154 $controlpanel=$this->server->get('controlpanel'); 141 155 $c=new $controlpanel($this->server->get('hostname'),$this->server->get('login'),$this->server->get('accesshash'),$this->server->get('ssl'),$this->server->get('dnstemplate')); 142 143 156 $ret=$c->activate ($this->domain,$this->username,$this->password,$this->product->get('plan')); 144 157 if ($ret) { … … 146 159 $keys['ID']=$this->id; 147 160 $row['STATUS']=20; 161 $row['STATUSDATE']=date("Y-m-d"); 148 162 $p->updateRecord("package",$keys,$row); 149 163 … … 155 169 function cancel() { 156 170 $controlpanel=$this->server->get('controlpanel'); 157 $c=new $controlpanel($this->server->get('hostname'),$this->server->get('login'),$this->server->get('accesshash'),$this->server->get('ssl')); 158 return $c->cancel ($this->username); 171 $c=new $controlpanel($this->server->get('hostname'),$this->server->get('login'),$this->server->get('accesshash'),$this->server->get('ssl'),$this->server->get('dnstemplate')); 172 $ret=$c->cancel ($this->username); 173 if ($ret) { 174 $keys['ID']=$this->packageid; 175 $row['STATUS']=10; 176 $row['STATUSDATE']=date("Y-m-d"); 177 $this->package->updateRecord('package',$keys,$row); 178 } 179 return $ret; 159 180 } 160 181 … … 166 187 $keys['ID']=$this->packageid; 167 188 $row['STATUS']=30; 189 $row['STATUSDATE']=date("Y-m-d"); 168 190 $this->package->updateRecord('package',$keys,$row); 169 191 } … … 178 200 $keys['ID']=$this->packageid; 179 201 $row['STATUS']=20; 202 $row['STATUSDATE']=date("Y-m-d"); 180 203 $this->package->updateRecord('package',$keys,$row); 181 204 } -
zingiri-hoster/trunk/fws/includes/subsh.inc.php
r175766 r175817 242 242 function AllCountries() { 243 243 global $dbtablesprefix; 244 244 245 245 $countries=array(); 246 246 $file = file(ZING_DIR.'params/countries.txt'); … … 259 259 } 260 260 261 function add_date($original_date,$month_interval) 262 { 263 $current_date = strtotime($original_date); 264 $resultant_date = date('Y-m-d', mktime(0,0,0,date('m',$current_date)+$month_interval,date('d',$current_date),date('Y',$current_date))); 265 return $resultant_date; 266 } 267 261 268 ?> -
zingiri-hoster/trunk/fws/iptocountry.php
r175054 r175817 27 27 } 28 28 else { 29 30 ini_set("memory_limit","128M"); 29 31 30 32 $handle1 = fopen("compress.zlib://http://software77.net/cgi-bin/ip-country/geo-ip.pl?action=download", "r"); … … 63 65 // fclose($handle3); 64 66 65 $query = "TRUNCATE TABLE `" . $dbtablesprefix . "iptocountry"."`";66 $sql=mysql_query($query) or die(mysql_error());67 68 67 PutWindow($gfx_dir, $txt['general13'], $txt['iptocountry1'].$i, "notify.gif", "50"); 69 68 -
zingiri-hoster/trunk/fws/langs/en/lang.txt
r175029 r175817 675 675 $txt['admin46'] = 'Orders'; 676 676 $txt['admin47'] = 'IP to country DB'; 677 677 $txt['admin48'] = 'Domains'; 678 678 679 679 $txt['browse21'] = 'Register';
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)