public function update()
	{

		global $db;
		
		$sql = "UPDATE ".TB_PREFIX."system_defaults SET value =  :value WHERE name = :name"; 

		//dont worry about checking db if were using the core extension
		if (  $this->extension_name != "core" )
		{
            $SI_EXTENSIONS = new SimpleInvoices_Db_Table_Extensions();
            $extension_id = $SI_EXTENSIONS->findByName($extension_name);
		} else {
			$extension_id = 0;
		}

		if ($extension_id >= 0) { 
			$sql .= " AND extension_id = :extension_id"; 
		} else { 
			die(htmlsafe("Invalid extension name: ".$extension)); 
		}
		if ($db->query($sql, ':value', $this->value, ':name', $this->name, ':extension_id', $extension_id)) { 
			return true; 
		}
		return false;

	}
예제 #2
0
<?php

//stop the direct browsing to this file - let index.php handle which files get displayed
checkLogin();

isset($_GET['id']) && $extension_id = $_GET['id'];
isset($_GET['action']) && $action = $_GET['action'];

$SI_EXTENSIONS = new SimpleInvoices_Db_Table_Extensions();
if ($action == 'toggle') {
    $SI_EXTENSIONS->toggleStatus($extension_id) or die(htmlsafe("Something went wrong with the status change!"));
}

$smarty -> assign("exts",$SI_EXTENSIONS->getCount());

$smarty -> assign('pageActive', 'setting');
$smarty -> assign('active_tab', '#setting');
$smarty -> assign('subPageActive', 'setting_extensions');
 /**
  * Replaces updateDefault
  * 
  * @param mixed $data
  * @param mixed $id
  * @return int
  */
 public function update($name, $value, $extension_name = "core")
 {
     $auth_session = Zend_Registry::get('auth_session');
     $where = array();
     $where[] = $this->getAdapter()->quoteInto('name = ?', $name);
     $SI_EXTENSIONS = new SimpleInvoices_Db_Table_Extensions();
     $extension_id = $SI_EXTENSIONS->findByName($extension_name);
     if ($extension_id >= 0) {
         $where[] = $this->getAdapter()->quoteInto('extension_id = ?', $extension_id);
     } else {
         throw new Exception("Invalid extension name: " . str_replace(array('{', '}', '+'), array('&#123', '&#125', '&#43;'), htmlentities($extension_name, ENT_QUOTES, 'UTF-8')));
         exit(1);
     }
     return parent::update(array('value' => $value), $where);
 }
예제 #4
0
include_once("sys/include/sql_queries.php");

$install_tables_exists = SimpleInvoices_Db::tableExists("biller");
if ($install_tables_exists == true)
{
	$install_data_exists = SimpleInvoices_Db::dataExists();
}

//TODO - add this as a function in sql_queries.php or a class file
//if ( ($install_tables_exists != false) AND ($install_data_exists != false) )
if ( $install_tables_exists != false )
{
	if (SimpleInvoices_Db_Table_SQLPatchManager::getNumberOfDoneSQLPatches() > "196")
	{
        $SI_EXTENSIONS = new SimpleInvoices_Db_Table_Extensions();
        // ToDo: Watch out! This get's translated while the original doesn't!!!
        $extensions = $SI_EXTENSIONS->fetchAll();
        $DB_extensions = array();
        foreach($extensions as $this_extension) {
            $DB_extensions[$this_extension['name']] = $this_extension;
        }
        /*
	    $sql="SELECT * from ".TB_PREFIX."extensions WHERE (domain_id = :id OR domain_id =  0 ) ORDER BY domain_id ASC";
	    $sth = dbQuery($sql,':id', $auth_session->domain_id ) or die(htmlsafe(end($dbh->errorInfo())));

	    while ( $this_extension = $sth->fetch() )
	    {
	    	$DB_extensions[$this_extension['name']] = $this_extension;
	    }
        */
예제 #5
0
else $extension_id = NULL;

if (isset($_GET['name'])) $extension_name = $_GET['name'];
else $extension_name = NULL;

$action = $_GET['action'];

if (isset($_GET['description'])) $extension_desc = $_GET['description'];
else $extension_desc = NULL;



if ($extension_id == null) {	// extension not yet registered
    $count = 0;
} else {
    $SI_EXTENSIONS = new SimpleInvoices_Db_Table_Extensions();
    $info = $SI_EXTENSIONS->getExtensionById($extension_id);
    $extension_name = $info['name'];
    $extension_desc = $info['description'];

    $system_defaults = new SimpleInvoices_Db_Table_SystemDefaults();
    $extension_defaults = $system_defaults->fetchAllForExtension($extension_id);
    $count = count($extension_defaults);
}

$smarty-> assign('id',$extension_id);
$smarty-> assign('action',$action);
$smarty-> assign('name',$extension_name);
$smarty-> assign('count',$count);
$smarty-> assign('description',$extension_desc);
$smarty-> assign('pageActive','extensions');